Skip to main content

system.mes.inventory.newConsumeRequest

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

Syntax

system.mes.inventory.newUnconsumeRequest()

Parameters

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns

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

KeyDefault Value
typeUNCONSUME
quantitynull
unitOfMeasureSymbolnull
lotIdOrNamenull
materialIdOrPathnull
destinationLocationIdOrPathnull
operationIdnull
inventoryOperationIdnull
productionOrderIdOrNamenull
materialReasonCodeIdnull
startDateCurrent Time
endDatenull
ongoingfalse
inventoryNamenull
notesnull
spare1null
spare2null
spare3null

Code Examples

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

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

# Unconsume the request
unconsumedRequest = system.mes.inventory.unconsume(**newRequest)

# Output the JSON representation of the unconsumed request
print(unconsumedRequest)