Postman collection
Items Write

pixiSetItemBuyingInfo

Sets minimum stock, minimum order quantity, target stock and safety stock of an item, globally or for a specific location.

Updates the purchasing-related quantities of one item.

Normalising the input

  • ItemKey = 0 and empty strings in all other parameters are treated as NULL, which means "not provided".
  • A negative TargetStock is replaced by 0.

Finding the item

The item is looked up in items by ItemKey, ItemNrInt or EANUPC. The conditions are combined with OR, so any record that matches one of the identifiers is used. If no item matches, the passed ItemKey stays unchanged.

Item level (items)

This step runs only if Location is not provided and at least one of MinStockQty or MinOrderQty is set. It updates MinStockQty and MinOrderQty of the item. A value that is not provided keeps its current value.

Location level (ItemLocationSpecific)

This step runs if at least one of the four quantities is set. It updates MinStockQty, MinOrderQty, TargetStock and SafetyStock of the location-specific records of the item:

  • If Location is set, only the record with that LocID is updated.
  • If Location is not set, all location records of the item are updated.

Values that are not provided keep their current value.

TargetStock and SafetyStock exist only at location level.

The procedure returns no result set.

Notes

  • Transactions: the procedure runs in its own transaction, or in a savepoint if a transaction is already open.
  • Errors are not reported back: all errors are caught and passed to log.InsertError. Examples are a non-numeric quantity that fails the conversion to int, or a value longer than 10 characters. That object is not attached, so it is unknown whether anything is returned to the caller. A successful call and a failed call can therefore look identical.
  • Ambiguous identifiers: if several items match the combined OR condition, which happens when the identifiers belong to different items, one of them is picked arbitrarily. Pass only one identifier, or consistent ones.
  • Item not found: if no item is found, nothing is updated and no message is returned.
  • No range check: only TargetStock is clamped at 0. Negative values for MinStockQty, MinOrderQty and SafetyStock are written as they are.
  • Locking: the reads use NOLOCK; the updates use ROWLOCK.

Tables used

items · Write ItemLocationSpecific · Write
SQL object:
dbo.pipiSetItemBuyingInfo
Updated at 2026-10-30