Skip to main content

system.mes.inventory.validateUnconsumeRequest

Validates an unconsume request based on the provided parameters.

Syntax

system.mes.inventory.validateUnconsumeRequest(**unconsume_request)

Parameters

ParameterTypeDescription
typeStringThe type of request defined by the LotRecordType Enum. It is internally set and must not be modified, as changes may break functionality.
quantityDoubleThe quantity to unconsume from the location.
unitOfMeasureSymbolStringThe symbol of the unit of measure for the quantity.
lotIdOrNameStringThe ID or name of the inventory lot that will be unconsuming the given lot.
materialIdOrPathStringThe ID or path of the material being unconsumed.
sourceLocationIdOrPathStringThe ID or path of the location from which inventory will be unconsumed.
consumingLotIdOrNameStringThe ID or name of the inventory lot from which the material is being unconsumed.
destinationLocationIdOrPathStringThe ID or path of the location the unconsumed inventory goes to.
createIfNotExistsBooleanIndicates whether the system should create the lot if it does not exist.
operationIdString (ULID)The ID of the operation unconsuming this inventory.
productionOrderIdOrNameStringThe ID or name of the production order associated with the unconsumption.
materialReasonCodeIdString (ULID)The ID of the material reason code to add additional context.
startDateInstantThe start date and time of the unconsumption.
endDateInstantThe end date and time of the unconsumption.
ongoingBooleanIndicates whether this request is ongoing.
inventoryNameStringThe name of the inventory.
notesStringNotes related to the unconsume request.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional 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 unconsume request object with no initial arguments
unconsume_request = system.mes.inventory.newUnconsumeRequest()

# Set basic attributes for the new unconsume request
unconsume_request['materialIdOrPath'] = 'Bottle/Milk'
unconsume_request['destinationLocationIdOrPath'] = 'DairyCo'
unconsume_request['quantity'] = 610
# (You can continue setting other properties as needed here)

# Validate unconsume request parameters
validation_errors = system.mes.inventory.validateUnconsumeRequest(**unconsume_request)

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