Skip to main content

system.mes.inventory.scrap

Scraps inventory from the MES based on the provided parameters.

Syntax

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

Parameters

ParameterTypeDescription
typeStringThe type of request defined by the LotRecordType Enum. It is internally set and must not be modified, as changes may break functionality.
quantityDoubleThe quantity to scrap from the location.
unitOfMeasureSymbolStringThe symbol of the unit of measure for the quantity.
lotIdOrNameStringThe ID or name of the inventory lot that will be scrapped.
materialIdOrPathStringThe ID or path of the material being scrapped.
sourceLocationIdOrPathStringThe ID or path of the location from which inventory will be scrapped.
operationIdString (ULID)The ID of the operation scrapping this inventory.
productionOrderIdOrNameStringThe ID or name of the production order associated with the scrap.
materialReasonCodeIdString (ULID)The ID of the material reason code to add additional context.
startDateInstantThe start date and time of the scrap.
endDateInstantThe end date and time of the scrap.
ongoingBooleanIndicates whether this request is ongoing.
inventoryNameStringThe name of the inventory the scrapped inventory goes to.
notesStringNotes related to the scrap request.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Returns

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

Code Examples

# Generate the object structure for a new scrap request object with no initial arguments
new_request = system.mes.inventory.newScrapRequest()

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

# Scrap the request
scrapped_request = system.mes.inventory.scrap(**new_request)

# Output the JSON representation of the scrapped request
print(scrapped_request)