Skip to main content

system.mes.inventory.validateReturnRequest

Validates a return request based on the provided parameters.

Syntax

system.mes.inventory.validateReturnRequest(**return_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 return from the location.
unitOfMeasureSymbolStringThe symbol of the unit of measure for the quantity.
lotIdOrNameStringThe ID or name of the inventory lot being returned.
materialIdOrPathStringThe ID or path of the material being returned.
sourceLocationIdOrPathStringThe ID or path of the location from which inventory will be returned.
operationIdString (ULID)The ID of the operation returning this inventory.
productionOrderIdOrNameStringThe ID or name of the production order associated with the return.
materialReasonCodeIdString (ULID)The ID of the material reason code to add additional context.
startDateInstantThe start date and time of the return.
endDateInstantThe end date and time of the return.
ongoingBooleanIndicates whether this request is ongoing.
inventoryNameStringThe name of the inventory the returned inventory goes to.
notesStringNotes related to the return 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 return request object with no initial arguments
return_request = system.mes.inventory.newReturnRequest()

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

# Validate return request parameters
validation_errors = system.mes.inventory.validateReturnRequest(**return_request)

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