Skip to main content

system.mes.productionOrder.saveProductionOrderProperty

Description

Creates or updates a Production Order Properties record in the system based on the provided parameters.

Syntax

system.mes.productionOrder.saveProductionOrderProperty(**property_data)

Parameters

ParameterTypeNullableDescription
nameStringFalseThe name of the production order property.
descriptionStringTrueA description of the production order property.
dataTypeStringFalseThe data type of the property (e.g., Integer, String, Float). Default value is String
lowLimitDoubleTrueThe minimum value allowed for a numerical property.
highLimitDoubleTrueThe maximum value allowed for a numerical property.
formatStringTrueThe format of the property, if applicable.
unitOfMeasureIdString (ULID)TrueThe ULID of the unit of measure for this production order property.
unitOfMeasureNameStringTrueThe name of the unit of measure for this production order property. For display purposes only.
unitOfMeasureSymbolStringTrueThe symbol of the unit of measure for this production order property. For display purposes only.
optionsStringTrueList of possible values for the property (e.g., "[option1, option2]").
nullableBooleanFalseDefines if the property can accept null values. Default value is false
defaultValueMixedTrueThe default value assigned to the property if none is provided. The type is mixed as it depends on what dataType is.
idString (ULID)TrueThe ULID of the production order property (optional, for updating an existing property).
notesStringTrueNotes related to the production order property.
enabledBooleanTrueIndicates if the property is active and enabled. Default value is true
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON representation of the saved production order property.

Code Examples

# Generate the object structure for a new production order property object, set the name and save it
new_property = system.mes.productionOrder.newProductionOrderProperty()
new_property['name'] = 'Batch Size'
saved_property = system.mes.productionOrder.saveProductionOrderProperty(**new_property)

# Output the JSON representation of the saved production order property
print(saved_property)

# Generate the object structure for another new property object to update the previous property
production_order_property = system.mes.productionOrder.newProductionOrderProperty()

# Define property attributes
production_order_property['id'] = saved_property.id
production_order_property['name'] = 'Batch Size'
production_order_property['description'] = 'Batch size property'
# (You can continue setting other properties as needed here)

# Save the production order property to update it in the system
updated_property = system.mes.productionOrder.saveProductionOrderProperty(**production_order_property)

# Output the JSON representation of the updated production order property
print(updated_property)