Skip to main content

system.mes.productionOrder.validateProductionOrder

Description

Validates the specified parameters for a Production Orders record and returns any validation errors. This only checks if the production order object can be saved based on the attributes given.

Syntax

system.mes.productionOrder.validateProductionOrder(**production_order_data)

Parameters

ParameterTypeDescription
nameStringThe name of the production order.
productIdString (ULID)The ULID of the material produce to be produced.
customerIdString (ULID)The ULID of the customer that is associated with this production order.
locationIdString (ULID)The ULID of the location associated with this production order.
statusStringThe status of the production order. (e.g., IDLE, SCHEDULED, RUNNING, PAUSED, STOPPED, CLOSED, CANCELLED).
schedulePriorityStringThe schedule priority of the production order (e.g., LOW, NORMAL, HIGH, URGENT).
quantityDoubleThe total quantity to be produced in this production order.
quantityProducedDoubleThe quantity that has been already produced in this production order.
quantityScheduledDoubleThe quantity that has been scheduled to be produced in this production order.
startDateInstantThe date this production order started.
endDateInstantThe date this production order ended.
dueDateInstantThe date this production order is due.
unitOfMeasureIdString (ULID)The ULID of the unit of measure for this production order.
scheduleShiftIdString (ULID)The ULID of the shift the production order started in.
scheduleShiftNameStringThe name of the shift the production order started in.
idString (ULID)The ULID of the production order (optional, used for updating an existing production order).
notesStringNotes related to the production order.
enabledBooleanIndicates if the production order 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 production order object
production_order_data = system.mes.productionOrder.newProductionOrder()

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

# Validate production order parameters
validation_errors = system.mes.productionOrder.validateProductionOrder(**production_order_data)

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