Skip to main content

system.mes.inventory.validateLot

Description

Validates the specified parameters for an Inventory Lots record and returns any validation errors. This only checks if the inventory lot can be saved based on the attributes given, without actually creating or modifying any inventory lots. Use this function to verify your parameters before executing a save lot operation.

Syntax

system.mes.inventory.validateLot(**lot_data)

Parameters

ParameterTypeNullableDescription
nameStringFalseThe name of the inventory lot.
materialIdString (ULID)FalseThe ULID of the material associated with this inventory lot.
statusStringTrueThe status of the inventory lot.
totalQuantityDoubleFalseThe total quantity of material in the inventory lot. Must be greater than or equal to 0
unitOfMeasureIdString (ULID)FalseThe ULID of the unit of measure for the quantity of the inventory lot.
expirationDateInstantTrueThe expected expiration date of the inventory lot.
closedDateInstantTrueThe date that the inventory lot was closed.
supplierIdString (ULID)TrueThe ULID of the supplier for the inventory lot.
idString (ULID)TrueThe ULID of the inventory lot (optional, used for updating an existing inventory lot).
notesStringTrueNotes related to the inventory lot.
enabledBooleanTrueIndicates if the inventory lot is active and enabled.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON object where keys are field names and values are lists of validation violation messages.

Code Examples

# Generate the object structure for a new inventory lot object
lot_data = system.mes.inventory.newLot()

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

# Validate inventory lot parameters
validation_errors = system.mes.inventory.validateLot(**lot_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Lot parameters are valid.')