Skip to main content
Version: V3 (Ignition 8.3)

system.mes.inventory.operation.stopInventoryOperation

Description​

Stops the Inventory Operation with the provided id. This action finds the currently running inventory lot record, records the specified quantity and end state into it, sets its end time to the specified date (or current time if not specified), and updates its status to completed. This effectively concludes the active operation and finalizes the lot record.

This method takes keyword arguments. inventoryOperationId and quantity are required, inventoryName, endDateMillis and secondaryLotIdOrName are optional.

Existing calls are unaffected

The first four keywords are declared in the order of the previous positional signature (inventoryOperationId, quantity, inventoryName, endDateMillis), so calls written positionally against that signature keep their meaning. secondaryLotIdOrName is appended after them.

Permissions​

This method requires the INVENTORY_OPERATION.EXECUTE permission.

Syntax​

system.mes.inventory.operation.stopInventoryOperation(inventoryOperationId, quantity)
system.mes.inventory.operation.stopInventoryOperation(inventoryOperationId, quantity, inventoryName, endDateMillis, secondaryLotIdOrName) # Overload

Parameters​

ParameterTypeNullableDescription
inventoryOperationIdString (ULID)FalseThe ID of the inventory operation to end.
quantityDoubleFalseThe quantity that the inventory operation processed.
inventoryNameStringTrueThe name of the inventory associated with the inventory operation.
endDateMillisLongTrueThe end date of the inventory operation (milliseconds since epoch).
secondaryLotIdOrNameStringTrueThe ID or name of the secondary lot to record against the stopped inventory lot record. Overrides the secondary lot captured when the operation was started, which is how a caller who omitted it at start can still record one. When omitted, the started record's secondary lot is carried forward.
Receive and Consume links its two lots both ways

A Receive and Consume operation writes two inventory lot records in one go, a receive and a consume, and both carry the same secondary lot. The two record types face opposite ways in track and trace: a receive reads as material arriving into the primary lot from the secondary lot, a consume as material leaving the primary lot into the secondary lot.

The trace graph therefore shows an edge in each direction between that one pair of lots. The secondary lot is both an ancestor and a descendant of the primary lot, and a trace that runs two levels or more comes back round to the lot it started from. This is expected for this operation type and is not corrupt data. No other operation type writes two records, so no other type does this.

Returns​

Returns a JSON object of the updated inventory lot record with the completed operation details, including the end time and final quantity.

Example Usage​

# Stop the inventory operation
stoppedLotRecord = system.mes.inventory.operation.stopInventoryOperation('01JPAND53P-BZ61RZHZ-V7C6EEHG', 100, None, None)

# Output the inventory lot record of the stopped inventory operation
print(stoppedLotRecord)
# Stop the inventory operation, naming the secondary lot that the start call left out.
# Written with keyword arguments so only the arguments that matter have to be given.
stoppedLotRecord = system.mes.inventory.operation.stopInventoryOperation(
inventoryOperationId = '01JPAND53P-BZ61RZHZ-V7C6EEHG',
quantity = 100,
secondaryLotIdOrName = 'Blend-2026-014'
)

print(stoppedLotRecord)