Postman collection
Orders Read

pixiGetMergableOrders

Returns the orders that can be merged with a given order: same customer, order type, currency and payment method, all lines in status ANG and not on an active picklist.

Finds candidate orders for merging with the reference order OrderNr.

  1. The reference order is read from OrderHeader: customer (CustRef), currency (CurrencyId), order type (OrderType) and the payment method (APayment) of the address linked via AddrRef.
  2. Other orders are returned when all of the following apply:
    • same customer (CustRef), but a different order number;
    • same OrderType and same CurrencyId;
    • the address of the candidate order has the same payment method as the reference order, and that payment method is not K (if the reference order uses K, no orders are returned at all);
    • none of the candidate's orderlines is on a picklist item whose picklist has not yet expired (PLHexpiryDate later than now) and whose ReservedOrderNr is empty or 0;
    • every orderline of the candidate order has status ANG (orders without any orderlines are therefore excluded).
  3. The result is sorted by CreateDate ascending (oldest order first).

If the reference order does not exist, the result set is empty.

Notes

  • Read-only; all tables are read WITH (NOLOCK), so uncommitted data may be seen.
  • The reference order itself is not checked for line status or picklist assignment; only the candidates are filtered.
  • The meaning of payment method code K is not defined in the code; it is simply excluded from merging.
  • The column ReservedOrderNr is referenced without table alias; it belongs to either PLitem or PLHeader, which the code does not make explicit.
  • The call only lists candidates; it does not merge anything.

Tables used

OrderHeader · Read Addresses · Read PLitem · Read PLHeader · Read Orderlines · Read
SQL object:
dbo.pipiGetMergableOrders
Updated at 2026-10-30