Skip to main content

system.mes.inventory.operation.saveInventoryOperation

Description

Creates or updates an Inventory Operations record in the system based on the provided parameters.

Syntax

system.mes.inventory.operation.saveInventoryOperation(**inventory_operation_data)

Parameters

ParameterTypeDescription
operationIdString (ULID)The ULID of the operation associated with this inventory operation.
operationNameStringThe name of the operation associated with this inventory operation.
nameStringThe name of the inventory operation.
statusStringThe status of the inventory operation.
currentRecordIdString (ULID)The ULID of the current inventory lot record associated with this inventory operation.
operationTypeStringThe type of operation record for this inventory operation.
triggerSourceStringThe ways that the various inventory operations can trigger.
startTriggerExpressionStringThe Ignition expression to trigger the start of the transfer of materials.
startTriggerTypeStringThe trigger type when starting the transfer of materials.
stopTriggerExpressionStringThe Ignition expression to trigger the end of the transfer of materials.
stopTriggerTypeStringThe trigger type when stopping the transfer of materials.
sourceLocationIdString (ULID)The ULID of the location for movement source.
sourceLocationPathStringThe path of the location for movement source.
destinationLocationIdString (ULID)The ULID of the location for movement destination.
destinationLocationPathStringThe path of the location for movement destination.
materialSourceStringThe strategy used for resolving material ID for an operation.
materialIdString (ULID)The ULID of the material associated with the inventory operation.
materialPathStringThe path of the material associated with the inventory operation.
materialExpressionStringThe Ignition expression for the material associated with this inventory operation.
primaryLotResolutionStrategyStringThe resolution strategy to get the primary lot code.
secondaryLotResolutionStrategyStringThe resolution strategy to get the secondary lot code.
primaryLotCodeExpressionStringThe Ignition expression to specify the primary lot code.
secondaryLotCodeExpressionStringThe Ignition expression to specify the secondary lot code.
createLotIfNotFoundBooleanIndicates if a lot should be created if it doesn't exist. Only used if operationType is CONSUME.
inventoryNameResolutionStrategyStringThe resolution strategy to get the inventory name.
inventoryNameStringThe name of the inventory associated with the inventory operation.
inventoryNameExpressionStringThe Ignition expression to specify the inventory name.
quantitySourceStringThe source of the quantity of an inventory operation.
quantityExpressionStringThe Ignition expression to specify the quantity.
quantityCalcTypeStringThe calculation type for quantity. Only used if quantitySource is EXPRESSION.
quantityOverflowValueStringThe overflow value for the quantity. Only used if quantitySource is EXPRESSION and the quantityCalcType is RISING.
unitOfMeasureIdString (ULID)The ULID of the unit of measure associated with the inventory operation.
unitOfMeasureNameStringThe name of the unit of measure associated with the inventory operation.
unitOfMeasureResolutionStrategyStringThe source of the unit of measure associated with the inventory operation.
reasonCodeIdString (ULID)The ULID of the reason code associated with the inventory operation.
reasonCodeNameStringThe name of the reason code associated with the inventory operation.
incrementProductionOrderCountBooleanIndicates if the production order quantity should be updated if we are shipping or producing material.
flushIntervalMillisIntegerThe flush interval in milliseconds.
idString (ULID)The ULID of the inventory operation (optional, used for updating an existing inventory operation).
notesStringNotes related to the inventory operation.
enabledBooleanIndicates if the inventory operation is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Returns

Returns a JSON representation of the saved inventory operation.

Code Examples

# Generate the object structure for a new inventory operation object, set the initial arguments and save it
new_inventory_operation = system.mes.inventory.operation.newInventoryOperation()
new_inventory_operation['name'] = 'Lids'
new_inventory_operation['sourceLocationId'] = '01JD7M94CJ-HPEQEJ1F-QA8EQ6VE'
saved_inventory_operation = system.mes.inventory.operation.saveInventoryOperation(**new_inventory_operation)

# Output the JSON representation of the saved inventory operation
print(saved_inventory_operation)

# Generate the object structure for another new inventory operation object to update the previous inventory operation
inventory_operation_data = system.mes.inventory.operation.newInventoryOperation()

# Set basic attributes for the updated inventory operation
inventory_operation_data['id'] = saved_inventory_operation.id
inventory_operation_data['name'] = 'Lids'
inventory_operation_data['sourceLocationId'] = '01JD7M94CJ-HPEQEJ1F-QA8EQ6VE'
inventory_operation_data['materialId'] = '01JCH3GRA3-5ZYFZV5V-RW3FKFJX'
inventory_operation_data['unitOfMeasureId'] = '01JCH3T85P-KVCB8ZR5-0B83A3SX'
# (You can continue setting other properties as needed here)

# Save the inventory operation to update it in the system
updated_inventory_operation = system.mes.inventory.operation.saveInventoryOperation(**inventory_operation_data)

# Output the JSON representation of the updated inventory operation
print(updated_inventory_operation)