V3_ItemInventory_Move (Put)
- Last UpdatedNov 06, 2025
- 7 minute read
| Put | V3_ItemInventory_Move |
Resource Path:/api/v3/ItemInventory/Move
| Name | Description |
|---|---|
| trans_id | Used to supply the ID of the transaction if the call is taking part in a transaction. |
The request body is of type Mes.WebApi.Models.V3.EnProd.MoveInventory.
The following MoveInventory model properties are required.
- To specify the locations from which to move inventory: list_of_inv_locs_to_move_from.
- To indicate whether the inventory is moved to a downstream job: move_inventory_to_downstream_job.
Additional Information About an Inventory Move
For each location in the list_of_inv_locs_to_move_from array in the MoveInventory model, this endpoint moves the quantity from the source location to the destination location. The rules specified below are applicable for each inventory transfer. Thus, each inventory move is validated against these rules. The inventory transfer is completed only when all source quantities are successfully moved to a destination location. If any error occurs, none of the quantities will be moved from any source location to a destination location, thus putting the database back to the previous state, as if nothing has happened. All inventory transactions are automatically logged to the Item_Transfer table to track inventory movements.
If the destination entity, item, lot, sublot, work order, operation, or job sequence number is not supplied, then the value is defaulted from the source inventory location. If the item grade, status, or expiration date is not supplied, then the value from the existing destination row (if any) is used.
If the destination item is configured to identify the inventory quantities uniquely by job (item.inv_unique_by_job = true) and the Supplied Move Inventory To Downstream Job flag (move_inv_to_dwnstrm_job XML tag) is set to true, and the override serialization flag for this work order is set to false, then the inventory table identifying which job produced this serial number will be updated to match those of any job immediately preceding the first job identified by the work order and operation that produces the item being transferred. If there are no such upstream jobs, then these fields are left unchanged.
The ent_id, item_id, lot_no, and sublot_no column uniquely identify a row in the Item_Inv table, as long as the inventory is not stored uniquely for this job (item.inv_unique_by_job is set to false). However, if this item is configured to differentiate inventory by job (item.inv_unique_by_job is set to true), then a unique row in the Item_Inv table is identified by ent_id, item_id, lot_no, sublot_no, wo_id, oper_id, and seq_no columns.
If a destination inventory location could not be identified, then a new inventory location is created. If item grade, status, expiry, work order, operation, and job sequence number are supplied, then those values are used while creating a destination inventory location. Otherwise these values are defaulted from the source inventory location. If the supplied lot or a sublot does not exist for the destination item, then the lot and sublot are automatically created for the destination item while adding the item to the inventory. Finally, a destination inventory location is created based on the supplied values and the default values specified on the previous step. Subsequently, the quantities (item_inv.qty_left, .qty_left_erp) from the source inventory location are reduced, and the date out is set to the current date and time, indicating that some quantities of this item were removed at this time.
If the supplied source inventory location and the destination inventory location are same, then the inventory location is updated with the supplied item grade, status, expiry date and time, work order, operation, and job sequence number.
If the supplied source inventory location differs from the destination inventory location, and the item grade, status code, and expiry date and time from the source inventory location do not match those of the destination inventory location, then the caller must supply one of the transfer options specified below to perform an inventory transfer. The transfer option defaults to 2 if a null value is supplied. Otherwise, the endpoint fails.
- Transfer option 1 (source and destination values match; no change in values). The grade code, status code, and the expiry date and time from the source inventory location match those in the destination inventory location. If they match, then this option is selected by default regardless of the transfer option supplied by the client. Otherwise, the method fails if this transfer option is selected. The supplied quantities are added to the destination inventory location, and the work order, operation, and job sequence number are updated to the destination inventory location. Subsequently, the supplied quantities are reduced from the source inventory location, and the date out is set to the current date and time, indicating that some quantities are removed at this time.
- Transfer option 2 (values don't match; use the destination values unless they are supplied in the request body). Either the grade code, status code, or the expiry date and time from the source inventory location do not match those in the destination inventory location. The supplied quantities are added to the destination inventory location. If a non-null value for the grade, status, expiry date and time, work order, operation, and job sequence number are supplied, then those values are updated against the destination inventory location. Otherwise the existing values in the destination location are retained. Subsequently, the supplied quantities are reduced from the source inventory location, and the date out is set to the current date and time, indicating that some quantities are removed at this time.
- Transfer option 3 (values don't match; use source values for any values that don't match the destination values). Either the grade code, status code, or the expiry date and time from the source inventory location do not match those in the destination inventory location. The supplied quantities are added to the destination inventory location, and the grade, status and expiry date and time in the destination location are overwritten with the values from the source location. Subsequently, the supplied quantities are reduced from the source inventory location, and the date out is set to the current date and time, indicating that some quantities are removed at this time.
If a destination inventory location already exists with a unit of measurement (UOM) other than the supplied UOM (if the UOM for the destination item is not explicitly supplied, then the item’s UOM is inferred), then the supplied units are converted to the destination units based on the conversion factor specified in the Uom_Conv table.
Regardless of the source/destination inventory locations, if the quantity in the storage location results in zero quantity, and if the Auto Delete Zero Inventory flag is turned on for that storage entity (storage_exec.auto_del_zero_inv), then the inventory row is automatically deleted.
Additionally, if the sum of all quantities for a storage entity is greater than 0, then the storage status for that entity is set to USED. If the sum of all quantities for a storage location is less than or equal to 0, then:
- If the storage entity is configured to allow the Dirty state, then the storage status for this entity is set to DIRTY.
- If the storage entity does not allow the Dirty state, then the storage status for this entity is set to AVAILABLE.
If the supplied LogInventoryTransfer flag is set to true, then a row is created in the Item_Transfer table identifying this inventory transaction.
Finally, a genealogy is logged for this inventory transfer. A lot split type of genealogy is logged when this inventory transfer results in a single lot.
Otherwise, a lot combine type of genealogy is logged for this inventory transfer. While logging the genealogy (item_cons), the current shift time for the source entity is used and the item reason code derived from the grade code of the source item is used.
All of the following conditions must be true for this method to succeed:
- The following supplied fields are not null or empty, and exist in the database: source inventory row ID, source entity, source item, quantity, storage property for the source entity (Storage_Exec), destination entity, destination item, storage property for the destination entity (Storage_Exec).
- The supplied entity is capable of storing items in the inventory (ent.can_store is true).
- A unique storage location is identified. That is, ent_id, item_id, lot_no, and sublot_no are unique if the item.inv_unique_by_job flag is set to false. Otherwise ent_id, item_id, lot_no, sublot_no, wo_id, oper_id. and seq_no are unique. Only one storage location (see condition above) is identified.
- The supplied destination item grade or destination item status exists in the database.
- The source grade code, status, and expiry do match those of the destination grade, status, or expiry for the destination inventory row in the database, and the supplied transfer option is 2 or 3.
- A non-null value for the item grade or status is supplied when creating a new inventory row.
- Adding the supplied quantity to the existing quantities does not exceed the maximum storage capacity for this entity.
- If the storage exec property for this entity does not allow negative quantities to be stored in the inventory, adding the supplied quantity to the existing quantities does not result in negative quantities.
- The entity is currently not in the Dirty state.
- If the storage location is configured/does not support multiple items added to the inventory, then the item being added to the inventory does not result as a new item to this storage location.
- If the storage location is configured not to/does not support multiple lots added to the inventory, then the lot being added to the inventory does not result as a new lot to this storage location.
- If the inventory exists for an item in units other than the supplied units for an item, a conversion factor to convert the source units for the item to a destination units exists in the database.