Postman collection
Stock Write

pixiSetSupplierStockMultiple

Synchronises the stock of one supplier's items on a bin with a list of supplier item numbers and quantities, then returns the resulting bin stock.

Takes a list of supplier item numbers with target quantities and tries to make the stock of the given bin match it.

  1. The XML in Items is parsed: each /ITEMS/ITEM node gives ItemNrSuppl and Quantity.
  2. The bin is looked up in InvBin by Location (BinLocID) and BinName. If no bin is found, a single row with Code = 500 and Message = Bin Not Found is returned and nothing else happens.
  3. The items to change are determined:
    • Items from the XML whose ItemNrSuppl matches an AddItems entry of supplier SupplNr, whose article is enabled (Items.Enabled = 1), and whose target quantity differs from the current total quantity on the bin (missing stock counts as 0).
    • Items of the same supplier that currently have stock on the bin but are not listed in the XML. Their target quantity is 0, so they are meant to be cleared from the bin. The Enabled flag is not checked for these.
  4. For every such item, pixiSetStock is executed with the article's EANUPC, the BinName, the target quantity and Username.
  5. Finally one row per article is returned with the supplier item number and the total quantity that is now on the bin, restricted to articles that have an AddItems entry for SupplNr.

Notes

  • Stock is in practice not changed. A comment in the code states that the call to pixiSetStock always fails because no SMORef is passed. pixiSetStock raises Error Message: API pipiSetStockMultiple: SMO is not assigned to API! whenever SMORef is NULL, writes an entry to LogTable and re-raises the error. The outer procedure has no error handling, so it continues with the next item and the error messages reach the caller as SqlMessage entries next to the final result set.
  • If the setting API_Stock_Movements is disabled, pixiSetStock returns an extra status row (Status/StatusMessage) for every item to change instead of raising an error. These rows arrive as additional result sets before the final stock list, which shifts the numbering of SqlRowSet.
  • pixiSetStock is called without a location. It looks up the bin by BinName only, so if the same bin name exists in several locations, a different bin than the one checked here may be used.
  • Articles are passed to pixiSetStock by EANUPC. Articles without an EAN or with a duplicate EAN cannot be addressed reliably.
  • If any ITEM in the XML has no ItemNrSuppl, the NOT IN check returns no rows, so no items are cleared from the bin.
  • Items whose Quantity is missing or not numeric are ignored for the update.
  • All reads use NOLOCK. There is no transaction around the loop.

Tables used

InvBin · Read InvBinItem · Read AddItems · Read Items · Read LogTable · Write
SQL object:
dbo.pipiSetSupplierStockMultiple
Updated at 2026-10-30