Skip to main content

system.mes.inventory.validateUnconsumeRequest

Validates the specified parameters for an unconsume request and returns any validation errors. This only checks if the unconsume request can be processed based on the attributes given, without actually performing the unconsumption. Use this function to verify your parameters before executing the actual unconsume operation.

Syntax

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

Parameters

ParameterTypeNullableDescription
typeStringTrueThe type of request defined by the LotRecordType Enum. It is internally set and must not be modified, as changes may break functionality.
quantityDoubleFalseThe quantity to unconsume from the location.
unitOfMeasureSymbolStringTrueThe symbol of the unit of measure for the quantity.
lotIdOrNameStringTrueThe ID or name of the inventory lot that will be unconsuming the given lot.
materialIdOrPathStringFalseThe ID or path of the material being unconsumed.
destinationLocationIdOrPathStringFalseThe ID or path of the location the unconsumed inventory goes to.
sourceLocationIdOrPathStringTrueThe ID or path of the location where the inventory is being unconsumed from. TODO
operationIdString (ULID)TrueThe ID of the operation unconsuming this inventory.
inventoryOperationIdString (ULID)TrueThe ID of the inventory operation related to this unconsume action.
productionOrderIdOrNameStringTrueThe ID or name of the production order associated with the unconsumption.
materialReasonCodeIdString (ULID)TrueThe ID of the material reason code to add additional context.
startDateInstantFalseThe start date and time of the unconsumption. Default value is Current Instant.
endDateInstantTrueThe end date and time of the unconsumption.
ongoingBooleanFalseIndicates whether this request is ongoing. Default value is false.
inventoryNameStringTrueThe name of the inventory.
notesStringTrueNotes related to the unconsume request.
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 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.')