Skip to main content

system.mes.inventory.validateInventoryLotRecord

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

Syntax

system.mes.inventory.validateInventoryLotRecord(**lot_record_data)

Parameters

ParameterTypeNullableDescription
lotRecordTypeStringFalseThe type of change for the record.
inventoryLotIdString (ULID)FalseThe ULID of the primary inventory lot for the inventory lot record.
inventoryLotNameStringTrueThe name of the primary inventory lot for the inventory lot record.
secondaryInventoryLotIdString (ULID)TrueThe ULID of the secondary inventory lot for the inventory lot record.
secondaryInventoryLotNameStringTrueThe name of the secondary inventory lot for the inventory lot record.
operationRecordIdString (ULID)TrueThe ULID of the operation record for the inventory lot record.
inventoryOperationIdString (ULID)TrueThe ULID of the inventory operation for the inventory lot record.
productionOrderIdString (ULID)TrueThe ULID of the production order for the inventory lot record.
materialReasonCodeIdString (ULID)TrueThe ULID of the material reason code for the inventory lot record.
sourceLocationIdString (ULID)TrueThe source location of the inventory or lot being operated.
destinationLocationIdString (ULID)TrueThe destination location of the inventory or lot being operated.
lotStatusStringTrueThe status of the inventory lot.
quantityDoubleTrueThe quantity of units being changed depending on the lotRecordType.
startDateInstantFalseThe beginning timestamp of the inventory lot change. Default value is Current Instant.
endDateInstantTrueThe end timestamp of the inventory lot change.
statusStringFalseThe status of the inventory lot record (e.g. Running, Completed, Faulted).
idString (ULID)TrueThe ULID of the inventory lot record (optional, used for updating an existing inventory lot record).
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 record object
new_lot_record = system.mes.inventory.newInventoryLotRecord()

# Set basic attributes for the new inventory lot record
new_lot_record['lotRecordType'] = 'CONSUME'
new_lot_record['inventoryLotId'] = '01JE6F0CE9-T94PZD8R-TH9J01TJ'
new_lot_record['status'] = 'COMPLETED'
# (You can continue setting other properties as needed here)

# Validate inventory lot parameters
validation_errors = system.mes.inventory.validateInventoryLotRecord(**new_lot_record)

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