Skip to main content
Version: V3 (Ignition 8.3)

system.mes.productionOrder.executeProductionOrder

Description

Executes a production order in a single call. Sets the start date, end date, status to STOPPED, and the supplied quantities. Useful for backfilling completed work in one shot. If startDate is omitted the current time is used, and if endDate is omitted it defaults to the resolved start time. The active shift record for the order's location is resolved at the start time.

caution

Throws if the order's status is already CLOSED - no execution operations are permitted on a closed order.

Permissions

This method requires the PRODUCTION_ORDER.EXECUTE permission.

Syntax

system.mes.productionOrder.executeProductionOrder(idOrName, [startDate], [endDate], [quantity], [quantityScheduled], [quantityProduced])

Parameters

ParameterTypeNullableDescription
idOrNameStringFalseThe ULID or name of the production order.
startDateDateTrueOptional start time. If null, the current time is used.
endDateDateTrueOptional end time. If null, defaults to the resolved start time.
quantityDoubleTrueOptional total quantity to set on the order.
quantityScheduledDoubleTrueOptional scheduled quantity to set on the order.
quantityProducedDoubleTrueOptional produced quantity to set on the order.

Returns

Returns a JSON representation of the updated production order.

Code Examples

# Backfill a completed production order in one call
order = system.mes.productionOrder.executeProductionOrder(
idOrName="ORDER-001",
startDate=system.date.addHours(system.date.now(), -2),
endDate=system.date.now(),
quantityProduced=500.0,
)
print order["status"] # "STOPPED"