Skip to main content

system.mes.inventory.operation.newInventoryOperation

Generates an empty non-persisted Inventory Operations object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveInventoryOperation method in order to persist the record.

Syntax

system.mes.inventory.operation.newInventoryOperation()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

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

KeyDefault Value
operationIdnull
operationNamenull
namenull
statusIDLE
currentRecordIdnull
operationTypeCONSUME
triggerSourceEXPRESSION
startTriggerExpressionnull
startTriggerTypeRISING_EDGE
stopTriggerExpressionnull
stopTriggerTypeFALLING_EDGE
sourceLocationIdnull
sourceLocationPathnull
destinationLocationIdnull
destinationLocationPathnull
materialSourceSTATIC
materialIdnull
materialPathnull
materialExpressionnull
primaryLotResolutionStrategyAUTO_GENERATE
secondaryLotResolutionStrategyAUTO_GENERATE
primaryLotCodeExpressionnull
secondaryLotCodeExpressionnull
createLotIfNotFoundfalse
inventoryNameResolutionStrategyMANUAL
inventoryNamenull
inventoryNameExpressionnull
quantitySourceEXPRESSION
quantityExpressionnull
quantityCalcTypeDIRECT
quantityOverflowValuenull
unitOfMeasureIdnull
unitOfMeasureNamenull
unitOfMeasureResolutionStrategySTATIC
reasonCodeIdnull
reasonCodeNamenull
incrementProductionOrderCountfalse
flushIntervalMillis0
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new inventory operation object with no initial arguments
new_inventory_operation = system.mes.inventory.operation.newInventoryOperation()

# Set basic attributes for the new inventory operation
new_inventory_operation['name'] = 'Lids'
new_inventory_operation['sourceLocationId'] = '01JD7M94CJ-HPEQEJ1F-QA8EQ6VE'
# (You can continue setting other properties as needed here)

# Save the new inventory operation to the system
saved_inventory_operation = system.mes.inventory.operation.saveInventoryOperation(**new_inventory_operation)

# Output the JSON representation of the saved inventory operation
print(saved_inventory_operation)