Postman collection
Stock Read

pixiGetItemLogisticsStock

Returns the total bin stock of an item at one location and the quantity still available after subtracting open future (FUT) order lines.

Calculates the stock of a single item for direct fulfillment (DF) purposes, as stated in the code comment: stock based on open DF orders.

Steps:

  1. Sums BinItemQty of all bin entries in InvBinItem for the item @ItemKey whose bin (InvBin) belongs to the location @Location (BinLocId). This sum is returned as TotalQty (0 if there are no matching bins).
  2. Sums Qty of all order lines in Orderlines for the item that
    • have status FUT,
    • have Qty > 0, and
    • have no entry in OrderHistory with status FUT and ClientNotified = 'N'.
  3. Returns TotalQty minus the order line sum as FulfillmentAvailableQty, together with the passed @Location.

The call always returns exactly one row, because the query aggregates without grouping.

Notes

  • If @Location is omitted (NULL), the comparison BinLocId = NULL never matches, so TotalQty is always 0 and FulfillmentAvailableQty is 0 or negative. Always pass a location.
  • The open order line quantity is not filtered by location: FUT order lines of all locations are subtracted from the stock of the given location.
  • FulfillmentAvailableQty can become negative when open FUT quantities exceed the bin stock.
  • An unknown @ItemKey does not cause an error; the call returns a row with 0 values.
  • All tables are read with NOLOCK, so the result may include uncommitted data.

Tables used

InvBinItem · Read InvBin · Read Orderlines · Read OrderHistory · Read
SQL object:
dbo.pipiGetItemLogisticsStock
Updated at 2026-10-30