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

ParameterTypeDescription
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
scheduleShiftIdnull
scheduleShiftNamenull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

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

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

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

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