Skip to main content

system.mes.operation.validateOperation

Description

Validates the specified parameters for an Operations record and returns any validation errors. This only checks if the operation object can be saved based on the attributes given, without actually creating or modifying the operation. Use this function to verify your parameters before executing save operation.

Syntax

system.mes.operation.validateOperation(**operation_data)

Parameters

ParameterTypeNullableDescription
locationIdString (ULID)FalseThe ULID of the location associated with the operation.
locationPathStringTrueThe path of the location associated with the operation.
nameStringFalseThe name of the operation.
statusStringTrueThe status of the operation. Default value is IDLE
currentOperationRecordIdString (ULID)TrueThe ULID of the current operation record.
currentProductionOrderIdString (ULID)TrueThe ULID of the current production order associated with the operation.
runningConflictStrategyStringFalseThe conflict strategy when a new operation is started while another is running. Default value is STOP_PREVIOUS
triggerSourceStringFalseThe ways that the various operations can trigger. Default value is EXPRESSION
startTriggerExpressionStringTrueThe Ignition expression to trigger the start of the operation.
startTriggerTypeStringFalseThe trigger type when starting the operation. Default value is RISING_EDGE
stopTriggerExpressionStringTrueThe Ignition expression to trigger the end of the operation.
stopTriggerTypeStringFalseThe trigger type when stopping the operation. Default value is FALLING_EDGE
productionOrderResolutionStrategyStringTrueThe resolution strategy to get the production order. Default value is NONE
productionOrderUpdateStrategyStringTrueThe update strategy if the production order expression changes while the operation is active. Default value is KEEP_FIRST_GOOD_VALUE
productionOrderExpressionStringTrueThe Ignition expression of the production order associated with the operation.
updateProductionOrderStatusOnStartBooleanFalseIndicates if the production order status should update when the operation starts. Default value is false
startProductionOrderStatusStringTrueThe status of the production order when the operation starts. Default value is RUNNING
updateProductionOrderStatusOnStopBooleanFalseIndicates if the production order status should update when the operation stops. Default value is false
stopProductionOrderStatusStringTrueThe status of the production order when the operation stops. Default value is STOPPED
autoAddToScheduleBooleanFalseIndicates if the operation should be automatically added to the schedule if it doesn't exist. Default value is true
expectedDurationCalculationStrategyStringTrueThe resolution strategy to get the expected duration of the operation. Default value is STATIC
expectedDurationSecondsIntegerTrueThe expected duration of the operation in seconds. Default value is 0
expectedDurationExpressionStringTrueThe Ignition expression of the expected duration of the operation.
flushIntervalMillisIntegerTrueThe flush interval in milliseconds. Default value is 0
idString (ULID)TrueThe ULID of the operation (optional, used for updating an existing operation).
notesStringTrueNotes related to the operation.
enabledBooleanTrueIndicates if the operation 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 object where keys are field names and values are lists of validation violation messages.

Code Examples

# Generate the object structure for a new operation object
operation_data = system.mes.operation.newOperation()

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

# Validate operation parameters
validation_errors = system.mes.operation.validateOperation(**operation_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Operation parameters are valid.')