Skip to main content

system.mes.inventory.newLot

Description

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

Permissions

This method does not require any permissions.

Syntax

system.mes.inventory.newLot()

Parameters

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

Returns

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

KeyDefault Value
namenull
materialIdnull
statusOPEN
totalQuantity0.0
unitOfMeasureIdnull
expirationDatenull
closedDatenull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new inventory lot object with no initial arguments
newLot = system.mes.inventory.newLot()

# Set basic attributes for the new inventory lot
newLot['name'] = 'L2824L9CO'
newLot['materialId'] = '01JCH3GRA3-5ZYFZV5V-RW3FKFJX'
newLot['unitOfMeasureId'] = '01JCH3T85P-KVCB8ZR5-0B83A3SX'
# (You can continue setting other properties as needed here)

# Save the new inventory lot to the system
savedLot = system.mes.inventory.saveLot(**newLot)

# Output the JSON representation of the saved inventory lot
print(savedLot)