Skip to main content

system.mes.inventory.newLot

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.

Syntax

system.mes.inventory.newLot()

Parameters

ParameterTypeDescription
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
supplierIdnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

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

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

# Save the new inventory lot to the system
saved_lot = system.mes.inventory.saveLot(**new_lot)

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