Skip to main content

system.mes.operation.newOperation

Description

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

Syntax

system.mes.operation.newOperation()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

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

KeyDefault Value
locationIdnull
locationPathnull
namenull
statusIDLE
currentOperationRecordIdnull
currentProductionOrderIdnull
runningConflictStrategySTOP_PREVIOUS
triggerSourceEXPRESSION
startTriggerExpressionnull
startTriggerTypeRISING_EDGE
stopTriggerExpressionnull
stopTriggerTypeFALLING_EDGE
productionOrderResolutionStrategyNONE
productionOrderUpdateStrategyKEEP_FIRST_GOOD_VALUE
productionOrderExpressionnull
updateProductionOrderStatusOnStartfalse
startProductionOrderStatusRUNNING
updateProductionOrderStatusOnStopfalse
stopProductionOrderStatusSTOPPED
autoAddToScheduletrue
expectedDurationCalculationStrategySTATIC
expectedDurationSeconds0
expectedDurationExpressionnull
flushIntervalMillis0
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new operation object with no initial arguments
new_operation = system.mes.operation.newOperation()

# Set basic attributes for the new operation
new_operation['locationId'] = '01JD7M94CJ-HPEQEJ1F-QA8EQ6VE'
new_operation['name'] = 'Packaging'
# (You can continue setting other properties as needed here)

# Save the new operation to the system
saved_operation = system.mes.operation.saveOperation(**new_operation)

# Output the JSON representation of the saved operation
print(saved_operation)