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.

Syntax

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

Parameters

ParameterTypeDescription
locationIdString (ULID)The ULID of the location associated with the operation.
locationPathStringThe path of the location associated with the operation.
nameStringThe name of the operation.
statusStringThe status of the operation.
currentOperationRecordIdString (ULID)The ULID of the current operation record.
currentProductionOrderIdString (ULID)The ULID of the current production order associated with the operation.
runningConflictStrategyStringThe conflict strategy when a new operation is started while another is running.
triggerSourceStringThe ways that the various operations can trigger.
startTriggerExpressionStringThe Ignition expression to trigger the start of the operation.
startTriggerTypeStringThe trigger type when starting the operation.
stopTriggerExpressionStringThe Ignition expression to trigger the end of the operation.
stopTriggerTypeStringThe trigger type when stopping the operation.
productionOrderResolutionStrategyStringThe resolution strategy to get the production order.
productionOrderUpdateStrategyStringThe update strategy if the production order expression changes while the operation is active.
productionOrderExpressionStringThe Ignition expression of the production order associated with the operation.
updateProductionOrderStatusOnStartBooleanIndicates if the production order status should update when the operation starts.
startProductionOrderStatusStringThe status of the production order when the operation starts.
updateProductionOrderStatusOnStopBooleanIndicates if the production order status should update when the operation stops.
stopProductionOrderStatusStringThe status of the production order when the operation stops.
autoAddToScheduleBooleanIndicates if the operation should be automatically added to the schedule if it doesn't exist.
expectedDurationCalculationStrategyStringThe resolution strategy to get the expected duration of the operation.
expectedDurationSecondsIntegerThe expected duration of the operation in seconds.
expectedDurationExpressionStringThe Ignition expression of the expected duration of the operation.
flushIntervalMillisIntegerThe flush interval in milliseconds.
idString (ULID)The ULID of the operation (optional, used for updating an existing operation).
notesStringNotes related to the operation.
enabledBooleanIndicates if the operation is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional 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.')