Postman collection
Stock Read

pixiReportInventoryItemsToRefillMinStock

Returns a pick list of items to move from a source location to a target location, with the quantity per source bin, computed by one of three refill modes.

The call passes all parameters unchanged to the internal report procedure Report_InventoryItemsToRefillMinStock and returns its result.

Step 1 – candidate items

An item is a candidate only if:

  • FromLocID and ToLocID are different,
  • the item has an ItemLocationSpecific record for both FromLocID and ToLocID,
  • the item is assigned to at least one bin (InvBinItem/InvBin) at FromLocID,
  • the calculated missing quantity is greater than 0.

Open order quantities are summed from Orderlines of the item at an order location. The order location is ToLocID for Type 1 and 3 and FromLocID otherwise. Statuses ANG, BES and BOR count as open customer orders, HAL counts as orders on hold. If the setting InventoryItemsToRefill_NoHAL is 1, on-hold quantities are ignored in the calculations.

The available stock at the source is the location quantity at FromLocID, minus the minimum stock of FromLocID (only if MinStock = 1 and Type = 2), minus the open customer order quantity (only if the order location is FromLocID), minus the on-hold quantity (unless the setting excludes it).

The missing quantity at the additional location is minimum stock minus location quantity at AdditionalLocID, or 0 if it is not below minimum.

The missing quantity depends on Type:

  • 1: demand = open customer orders at ToLocID + on-hold quantity + minimum stock of ToLocID (only if MinStock = 1). If the demand fits into the available stock, the target is missing quantity at the additional location + demand, otherwise the available stock. The result is the target minus the current stock at ToLocID, never below 0.
  • 2: the missing quantity at the additional location, limited to the available stock at the source.
  • 3: only if the minimum stock at ToLocID is 0, the stock at AdditionalLocID is 0, the stock at FromLocID is greater than 0 and there are open customer orders at ToLocID. The result is the smaller value of open customer orders and stock at FromLocID.

Step 2 – distribution over bins

For each candidate, the item's InvBinItem records in bins at FromLocID are numbered by InvBinItemKey. Only the first n records are used, where n is the missing quantity. The rows are grouped per source bin. In the output, MissingQty is the number of these records in that bin. This equals a piece count if each bin record stands for one piece. One bin at ToLocID is added as the target bin, if there is one.

Sort order

If SortBy = 1, rows are sorted by the sort number of the target bin, otherwise by the sort number of the source bin. Within that, rows are sorted by ItemName.

Notes

  • The header comment of the wrapper describes it as calling the 1SS Report for billing purposes.
  • Type defaults to NULL in the wrapper. With NULL or any value other than 1, 2 or 3, the missing quantity is NULL and the call returns no rows. Always pass Type.
  • The missing quantity at the additional location comes from an outer join. If AdditionalLocID is NULL or the item has no ItemLocationSpecific record there, the value is NULL, not 0:
    • Type 2 and Type 3 then return no row for the item.
    • Type 1 only returns a row if the demand exceeds the available stock.
  • The target bin is taken with TOP 1 without an ORDER BY. For items with several bins at ToLocID, the bin shown is not deterministic.
  • The value of the setting InventoryItemsToRefill_NoHAL is read at runtime via fPIXI_GetSetting; that function is not attached.
  • All reads use NOLOCK, so results can include uncommitted data.
  • The call only reads data. It uses a temporary table internally.

Tables used

Items · Read Orderlines · Read ItemLocationSpecific · Read InvBinItem · Read InvBin · Read
SQL object:
dbo.pipiReportInventoryItemsToRefillMinStock
Updated at 2026-10-30