Skip to main content

system.mes.inventory.scrap

Scraps inventory from the MES based on the provided parameters.

Syntax

system.mes.inventory.scrap(**scrapRequest)

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.
quantityDoubleFalseThe quantity to scrap from the location.
unitOfMeasureSymbolStringTrueThe symbol of the unit of measure for the quantity.
lotIdOrNameStringTrueThe ID or name of the inventory lot that will be scrapped.
materialIdOrPathStringFalseThe ID or path of the material being scrapped.
sourceLocationIdOrPathStringFalseThe ID or path of the location from which inventory will be scrapped.
destinationLotIdOrNameStringTrueThe id or name of the lot being scrapped into.
destinationMaterialIdOrPathStringTrueThe id or path of the material for the destination lot.
destinationLocationIdOrPathStringTrueThe ID or path of the location that the inventory will be scrapped into.
operationIdString (ULID)TrueThe ID of the operation scrapping this inventory.
inventoryOperationIdString (ULID)TrueThe ID of the inventory operation related to this scrap action.
productionOrderIdOrNameStringTrueThe ID or name of the production order associated with the scrap.
materialReasonCodeIdString (ULID)TrueThe ID of the material reason code to add additional context.
startDateInstantFalseThe start date and time of the scrap. Default value is Current Instant.
endDateInstantTrueThe end date and time of the scrap.
ongoingBooleanFalseIndicates whether this request is ongoing. Default value is false.
inventoryNameStringTrueThe name of the inventory the scrapped inventory goes to.
notesStringTrueNotes related to the scrap request.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON representation of an inventory lot record for a Scrap 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 scrap request object with no initial arguments
newRequest = system.mes.inventory.newScrapRequest()

# Set basic attributes for the new scrap request
newRequest['materialIdOrPath'] = 'Bottle/Milk'
newRequest['sourceLocationIdOrPath'] = 'DairyCo'
newRequest['quantity'] = 610
# (You can continue setting other properties as needed here)

# Scrap the inventory
scrapLotRecord = system.mes.inventory.scrap(**newRequest)

# Output the JSON representation of the lot record of the scrap action
print(scrapLotRecord)