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.

Permissions

This method does not require any permissions.

Syntax

system.mes.operation.newOperation()

Parameters

ParameterTypeNullableDescription
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
newOperation = system.mes.operation.newOperation()

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

# Save the new operation to the system
savedOperation = system.mes.operation.saveOperation(**newOperation)

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