Skip to main content

system.mes.productionOrder.newProductionOrder

Generates an empty non-persisted Production Orders object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveProductionOrder method in order to persist the record.

Syntax

system.mes.productionOrder.newProductionOrder()

Parameters

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns

Returns a JSON representation of the newly created production order object. The following is a list of keys and default values:

KeyDefault Value
namenull
productIdnull
customerIdnull
locationIdnull
statusIDLE
schedulePriorityNORMAL
quantity0.0
quantityProduced0.0
quantityScheduled0.0
startDatenull
endDatenull
dueDatenull
unitOfMeasureIdnull
shiftRecordIdnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new production order object with no initial arguments
newProductionOrder = system.mes.productionOrder.newProductionOrder()

# Set basic attributes for the new production order
newProductionOrder['productId'] = '01JCH3ENGW-82KJDZDR-JHGYCXQN'
newProductionOrder['name'] = 'Order001'
newProductionOrder['unitOfMeasureId'] = '01JCH3EPVP-1MNNDJTS-37Z75NGB'
# (You can continue setting other properties as needed here)

# Save the new production order to the system
savedProductionOrder = system.mes.productionOrder.saveProductionOrder(**newProductionOrder)

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