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.
- The reference order is read from
OrderHeader: customer (CustRef), currency (CurrencyId), order type (OrderType) and the payment method (APayment) of the address linked viaAddrRef. - Other orders are returned when all of the following apply:
- same customer (
CustRef), but a different order number; - same
OrderTypeand sameCurrencyId; - 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 usesK, no orders are returned at all); - none of the candidate's orderlines is on a picklist item whose picklist has not yet expired (
PLHexpiryDatelater than now) and whoseReservedOrderNris empty or 0; - every orderline of the candidate order has status
ANG(orders without any orderlines are therefore excluded).
- same customer (
- The result is sorted by
CreateDateascending (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
Kis not defined in the code; it is simply excluded from merging. - The column
ReservedOrderNris referenced without table alias; it belongs to eitherPLitemorPLHeader, which the code does not make explicit. - The call only lists candidates; it does not merge anything.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
Required
|
int | – |
Internal number of the reference order for which mergeable orders are searched. Example: |
Result set 1 · Always (empty if the reference order does not exist or no candidate matches).
Orders that can be merged with the reference order, oldest first.
| Column | Type | Description |
|---|---|---|
OrderNr
|
int |
Internal number of the mergeable order. |
CreateDate
Nullable |
datetime dateTime |
Creation date of the order (sort key). |
OrderNrExternal
Nullable |
string |
External order number, e.g. from the shop. |
Response example
<SqlRowSet1>
<row>
<OrderNr>104498</OrderNr>
<CreateDate>2024-03-11T09:15:22</CreateDate>
<OrderNrExternal>SHOP-100231</OrderNrExternal>
</row>
<row>
<OrderNr>104517</OrderNr>
<CreateDate>2024-03-12T14:02:47</CreateDate>
<OrderNrExternal>SHOP-100245</OrderNrExternal>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetMergableOrders>
<OrderNr>104523</OrderNr>
</ns1:pixiGetMergableOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiGetMergableOrders>
<OrderNr>104523</OrderNr>
</ns1:pixiGetMergableOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
'OrderNr' => '104523',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetMergableOrders', $soapArguments);
- SQL object:
- dbo.pipiGetMergableOrders