Skip to main content

system.mes.inventory.newScrapAllRequest

Description

Generates an empty Scrap All Request to provide the structure required by the API to save a new record into the database. This method must be combined with the scrapAll method in order to persist the record.

Permissions

This method does not require any permissions.

Syntax

system.mes.inventory.newScrapAllRequest()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

Returns a JSON representation of the newly created Scrap All Request object. The following is a list of keys and default values:

KeyDefault Value
typeSCRAP
sourceLocationIdOrPathnull
materialIdOrPathnull
destinationLotIdOrNamenull
destinationMaterialIdOrPathnull
destinationLocationIdOrPathnull
operationIdnull
inventoryOperationIdnull
productionOrderIdOrNamenull
materialReasonCodeIdnull
startDateCurrent Time
endDatenull
notesnull
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new scrap all request object
newRequest = system.mes.inventory.newScrapAllRequest()

# Set basic attributes for the new scrap all request
newRequest['materialIdOrPath'] = 'Bottle/Milk'
newRequest['sourceLocationIdOrPath'] = 'DairyCo'

# Scrap all inventory at the specified location that matches the material (if specified)
scrappedRecords = system.mes.inventory.scrapAll(**newRequest)

# Output the JSON representation of the scrapped records
print(scrappedRecords)