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
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idOrName | String | False | The ULID or name of the production order. |
startDate | Date | True | Optional start time. If null, the current time is used. |
endDate | Date | True | Optional end time. If null, defaults to the resolved start time. |
quantity | Double | True | Optional total quantity to set on the order. |
quantityScheduled | Double | True | Optional scheduled quantity to set on the order. |
quantityProduced | Double | True | Optional 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"