Skip to main content
Version: V3 (Ignition 8.3)

system.mes.inventory.changeStatus

Description​

Changes the status of the inventory lot from the MES based on the provided parameters.

Permissions​

This method requires the INVENTORY.WRITE.CHANGE_STATUS permission.

Syntax​

system.mes.inventory.changeStatus(**change_status_request)

Parameters​

ParameterTypeNullableDescription
typeStringTrueThe type of request defined by the LotRecordType Enum. It is internally set and must not be modified, as changes may break functionality.
lotIdString (ULID)FalseThe ID of the inventory lot whose status is being updated.
newStatusStringFalseThe new status to be assigned to the inventory lot.
destinationLotIdOrNameStringTrueThe ID or name of the inventory lot this status change hands the material over to, for example a hold, quarantine or rework lot. Recorded as the lot record's secondary lot so track and trace can draw an edge from the lot whose status changed to this lot. Leave it unset for a plain status change that involves no other lot. A name that matches no existing lot creates one. Recorded for traceability only, neither lot's quantities change and only the primary lot's status is updated.
destinationMaterialIdOrPathStringTrueThe ID or path of the material for the destination lot. Only needed when it differs from the material of the lot whose status is changing.
operationIdString (ULID)TrueThe ID of the operation changing the status of this inventory.
inventoryOperationIdString (ULID)TrueThe ID of the inventory operation related to this change status action.
notesStringTrueNotes related to the change status request.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.
Lot genealogy

Name destinationLotIdOrName to record the lot the reclassified material is booked against, so track and trace can follow it from the lot whose status changed into that lot. The link is recorded on the inventory lot record as its secondary lot, and is what getLotTraceGraph follows when it draws the genealogy. Naming a lot that does not exist yet creates it. No quantity arithmetic changes, the link is recorded for traceability only.

Returns​

Returns a JSON representation of an inventory lot record for a Change Status Request.

NameTypeDescription
lotRecordTypeStringThe type of change for the record.
inventoryLotIdString (ULID)The ULID of the primary inventory lot for the inventory lot record.
inventoryLotNameStringThe name of the primary inventory lot for the inventory lot record.
secondaryInventoryLotIdString (ULID)The ULID of the secondary inventory lot for the inventory lot record.
secondaryInventoryLotNameStringThe name of the secondary inventory lot for the inventory lot record.
operationRecordIdString (ULID)The ULID of the operation record for the inventory lot record.
inventoryOperationIdString (ULID)The ULID of the inventory operation for the inventory lot record.
inventoryOperationNameStringThe name of the inventory operation for the inventory lot record.
productionOrderIdString (ULID)The ULID of the production order for the inventory lot record.
productionOrderNameStringThe name of the production order for the inventory lot record.
materialReasonCodeIdString (ULID)The ULID of the material reason code for the inventory lot record.
materialReasonCodeNameStringThe name of the material reason code for the inventory lot record.
sourceLocationIdString (ULID)The source location of the inventory or lot being operated.
sourceLocationNameStringThe name of the source location of the inventory or lot being operated.
sourceLocationPathStringThe path of the source location of the inventory or lot being operated.
destinationLocationIdString (ULID)The destination location of the inventory or lot being operated.
destinationLocationNameStringThe name of the destination location of the inventory or lot being operated.
destinationLocationPathStringThe path of the destination location of the inventory or lot being operated.
lotStatusStringThe status of the inventory lot.
quantityDoubleThe quantity of units being changed depending on the lotRecordType.
unitOfMeasureIdStringThe ID of the unit of measure for the quantity.
unitOfMeasureNameStringThe name of the unit of measure for the quantity.
unitOfMeasureSymbolStringThe symbol of the unit of measure for the quantity.
startDateInstantThe beginning timestamp of the inventory lot change.
endDateInstantThe end timestamp of the inventory lot change.
statusStringThe status of the inventory lot record (e.g. Running, Completed, Faulted).
durationLongThe duration in seconds.
shiftRecordIdStringThe shift the inventory lot record occurred in.
idString (ULID)The ULID of the inventory lot record (optional, used for updating an existing inventory lot record).
notesStringNotes related to the inventory lot.
enabledBooleanIndicates if the inventory lot is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Code Examples​

# Generate the object structure for a new change status request object with no initial arguments
newRequest = system.mes.inventory.newChangeStatusRequest()

# Set basic attributes for the new change status request
newRequest['newStatus'] = 'AVAILABLE'
newRequest['lotId'] = '01JJCQEJYG-E31FHVTF-JB6WEJTC'
# (You can continue setting other properties as needed here)

# Change the status of the lot
changedStatusLotRecord = system.mes.inventory.changeStatus(**newRequest)

# Output the JSON representation of the lot record of the change status action
print(changedStatusLotRecord)