pixiGetResolvedItemDependencies
Resolves a list of items into the actual stock items: non-bundle items are returned as they are, bundles are replaced by their components with multiplied quantities.
Takes a list of items with quantities as XML and returns the items that the request actually depends on, for example to check or reserve stock for an order.
Steps:
- The XML in
ItemXMLis parsed from/Items/Item. EachItemcan identify the article byItemKey, byItemNrIntor by both, and carries aQty. - Missing identifiers are completed from the
Itemstable: ifItemKeyis missing it is looked up byItemNrInt; ifItemNrIntis missing it is looked up byItemKey. - Entries whose
ItemKeycannot be determined (unknown item number) are silently discarded. - Resolution:
- Items with
IsBundle = 0are returned with the requestedQty. - Items with
IsBundle = 1are not returned themselves. Instead every component fromBundleItemsis returned with quantityQty× component quantity.
- Items with
- The result is grouped by
ItemKey: quantities of the same item (listed several times or contained in several bundles) are summed up.
If ItemXML is not passed, an empty result set is returned. No sort order is defined.
Notes
- Read-only; all reads on
ItemsandBundleItemsuseNOLOCK, so uncommitted data may be returned. - Bundles are resolved only one level deep. A component that is itself a bundle is returned as it is and is not expanded further.
- If both
ItemKeyandItemNrIntare given,ItemKeyis used andItemNrIntis not checked against it. - Unknown items are dropped without any error message; compare the result with the request if this matters.
- If
Qtyis omitted for an entry, its quantity isNULLand does not contribute to the summedQty(the sum becomesNULLif all contributions areNULL). - Invalid XML causes an SQL error from
sp_xml_preparedocument, returned asSqlMessage. - The data type of the returned
Qtydepends on the type ofBundleItems.Qty, which is not visible in the code.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemXML
|
varchar(max) xml |
NULL |
XML list of requested items. Root Example:
|
Result set 1 · Always (empty if ItemXML is NULL or no item could be resolved)
One row per resolved stock item with the total required quantity.
| Column | Type | Description |
|---|---|---|
ItemKey
|
int |
Key of the resolved item (a non-bundle item from the request or a bundle component). |
ItemNrInt
Nullable |
varchar(50) string |
Internal item number of the resolved item from |
Qty
Nullable |
decimal |
Total required quantity: sum of the requested quantities, multiplied by the component quantity for bundle components. |
Response example
<SqlRowSet1>
<row>
<ItemKey>1052</ItemKey>
<ItemNrInt>ART-10052</ItemNrInt>
<Qty>3</Qty>
</row>
<row>
<ItemKey>1077</ItemKey>
<ItemNrInt>ART-10077</ItemNrInt>
<Qty>2</Qty>
</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:pixiGetResolvedItemDependencies>
<!-- <ItemXML><![CDATA[<Items><Item><ItemKey>1052</ItemKey><ItemNrInt>ART-10052</ItemNrInt><Qty>2</Qty></Item><Item><ItemNrInt>BUNDLE-200</ItemNrInt><Qty>1</Qty></Item></Items>]]></ItemXML> -->
</ns1:pixiGetResolvedItemDependencies>
</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:pixiGetResolvedItemDependencies>
<!-- <ItemXML><![CDATA[<Items><Item><ItemKey>1052</ItemKey><ItemNrInt>ART-10052</ItemNrInt><Qty>2</Qty></Item><Item><ItemNrInt>BUNDLE-200</ItemNrInt><Qty>1</Qty></Item></Items>]]></ItemXML> -->
</ns1:pixiGetResolvedItemDependencies>
</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 = [
// 'ItemXML' => '<Items><Item><ItemKey>1052</ItemKey><ItemNrInt>ART-10052</ItemNrInt><Qty>2</Qty></Item><Item><ItemNrInt>BUNDLE-200</ItemNrInt><Qty>1</Qty></Item></Items>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetResolvedItemDependencies', $soapArguments);
- SQL object:
- dbo.pipiGetResolvedItemDependencies