pixiGetItemStock
Returns available and physical stock, supplier price and open order line quantities for one or more items, optionally broken down by location.
Looks up items and returns their stock figures.
Item identification
- Empty strings are treated as
NULL;ItemKey = 0is treated asNULL. - At least one of
ItemKey,EAN,ItemNrSuppl,ItemNrIntorItemXMLis required, otherwise an error row is returned. - The single parameters are combined with OR against
pixi.ItemCode:EANmatches code type 1 (barcode),ItemNrIntcode type 2 (shop item number),ItemNrSupplcode type 4 (supplier item number),ItemKeymatches the item id of any code row. ItemXMLadds further items: each/ITEMS/ITEMelement can containITEMKEY(taken directly),ITEMNRINT,ITEMNRSUPPLorEAN(matched againstitems.ItemNrInt,items.ItemNrSupplanditems.EANUPC).- If no candidate is found, an error row is returned.
Stock calculation (per item from items)
AvailableStock=ItemQtyIBIExportStock_locationsminus, for non-bundle items and when settingStockExportUsePhysicalStockis0:ItemQtyOpenOrderLinesif reservations (ReservePrepaymentOrders) are disabled orExportAvailableStock_WhenReservationsAreEnabled= 1,- otherwise
ItemQtyOpenReservationsif reservations are enabled, - otherwise nothing is subtracted.
PhysicalStock= stock outside special stock locations,PhysicalStockAllLocations= including special stock.OnlyEnabledItems = 1restricts the output to enabled items.
Excluding bin groups
If ExcludeBinGroups (comma-separated list) is given, the quantities in bins (InvBin/InvBinItemLog) of these bin groups are summed per item and subtracted from AvailableStock, PhysicalStock and PhysicalStockAllLocations. For bundles containing such components, a derived quantity (minimum over components of the excluded quantity divided by the component quantity, rounded up) is subtracted as well.
Location breakdown
With LocationStock = 1 two additional text columns are returned:
Locations:All:<qty>; <LocID>:<qty>; …with the total quantity and the quantity per location.OpenOrderlineSumLocations:<LocID>:<qty>; …; All:<qty>;with open customer order quantities (ANG/FUT and recent HAL orders) per location and in total, computed bypixi.ItemInfoStockPerLocation.
One row is returned per found item; no explicit sort order is applied.
Notes
- Read-only; all tables are read
WITH (NOLOCK), so values may reflect uncommitted data. - On errors the procedure returns code
1in addition to the status row. ItemKeyas a single parameter only matches if the item has at least one row inpixi.ItemCode.ITEMKEYvalues fromItemXMLare not validated; unknown keys count as found but produce no output row, so the result can be empty without an error row.- An item found both via single parameters and via
ItemXMLcan appear twice in the result. EANinItemXMLis read asvarchar(13); longer values are truncated.- Passing
OnlyEnabledItemsexplicitly as NULL yields no rows. - The bin group exclusion only affects items that have a shop item number (code type 2) and whose
ItemNrIntequals that code. - The order of entries inside
LocationsandOpenOrderlineSumLocationsis not guaranteed. pixi.ItemInfoStockPerLocationis executed even whenLocationStockis not 1; for many items this aggregates order lines and supplier orders and can be costly. Its result depends on the settingsHalOrdersActiveDaysandInclude_FUT_StatusInOpenOrdersForSupplierOrdering.- Invalid XML in
ItemXMLcauses an SQL error fromsp_xml_preparedocument.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal item key. Example: |
EAN
|
varchar(50) string |
NULL |
Barcode of the item (item code type 1). Example: |
ItemNrSuppl
|
varchar(50) string |
NULL |
Supplier item number (item code type 4). Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Shop item number (item code type 2). Example: |
LocationStock
|
bit boolean |
NULL |
If 1, the result additionally contains the per-location columns Allowed values
Example: |
OnlyEnabledItems
|
bit boolean |
0 |
Restricts the result to enabled items. Allowed values
Example: |
ExcludeBinGroups
|
varchar(max) string |
NULL |
Comma-separated list of bin groups whose quantities are subtracted from the stock figures. Example: |
ItemXML
|
varchar(max) xml |
NULL |
XML list of additional items. Each Example:
|
Result set 1 · If no identifying parameter is given or no item candidate is found
Error status row; processing stops.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
|
varchar(52) string |
Error text. |
Result set 2 · On success with LocationStock = 1
One row per found item including per-location strings.
| Column | Type | Description |
|---|---|---|
AvailableStock
Nullable |
int |
Available stock for export, reduced by open order lines or reservations depending on settings and by excluded bin groups. |
PhysicalStock
Nullable |
int |
Physical stock without special stock locations ( |
PhysicalStockAllLocations
Nullable |
int |
Physical stock including special stock locations. |
SupplPrice
Nullable |
money decimal |
Supplier purchase price of the item. |
ItemKey
|
int |
Internal item key. |
EANUPC
Nullable |
varchar(50) string |
EAN/UPC of the item. |
ItemNrSuppl
Nullable |
varchar(50) string |
Supplier item number. |
ItemNrInt
Nullable |
varchar(50) string |
Shop item number. |
Locations
Nullable |
varchar(4000) string |
Quantities as |
OpenOrderlineSum
Nullable |
int |
Quantity in open order lines ( |
OpenOrderlineSumLocations
Nullable |
varchar(max) string |
Open customer order quantities (ANG/FUT and recent HAL) as |
Result set 3 · On success with LocationStock not 1 (0 or NULL)
One row per found item without per-location columns.
| Column | Type | Description |
|---|---|---|
AvailableStock
Nullable |
int |
Available stock for export (see above). |
PhysicalStock
Nullable |
int |
Physical stock without special stock locations. |
PhysicalStockAllLocations
Nullable |
int |
Physical stock including special stock locations. |
SupplPrice
Nullable |
money decimal |
Supplier purchase price. |
ItemKey
|
int |
Internal item key. |
EANUPC
Nullable |
varchar(50) string |
EAN/UPC of the item. |
ItemNrSuppl
Nullable |
varchar(50) string |
Supplier item number. |
ItemNrInt
Nullable |
varchar(50) string |
Shop item number. |
OpenOrderlineSum
Nullable |
int |
Quantity in open order lines. |
Response example
<SqlRowSet1>
<row>
<AvailableStock>18</AvailableStock>
<PhysicalStock>25</PhysicalStock>
<PhysicalStockAllLocations>27</PhysicalStockAllLocations>
<SupplPrice>12.5000</SupplPrice>
<ItemKey>1234</ItemKey>
<EANUPC>4006381333931</EANUPC>
<ItemNrSuppl>SUP-55012</ItemNrSuppl>
<ItemNrInt>A-1001</ItemNrInt>
<Locations>All:27; 001:20; 002:7; </Locations>
<OpenOrderlineSum>7</OpenOrderlineSum>
<OpenOrderlineSumLocations>001:5; 002:2; All:7; </OpenOrderlineSumLocations>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | Specify at least one parameter to identify the item. | None of `ItemKey`, `EAN`, `ItemNrSuppl`, `ItemNrInt`, `ItemXML` was given (or all were empty / 0). Pass at least one identifier. |
| Error | No items found with given parameters. | No item code or XML entry matched an item. Check the identifiers and code types. |
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:pixiGetItemStock>
<!-- <ItemKey>1234</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-55012</ItemNrSuppl> -->
<!-- <ItemNrInt>A-1001</ItemNrInt> -->
<!-- <LocationStock>1</LocationStock> -->
<!-- <OnlyEnabledItems>0</OnlyEnabledItems> -->
<!-- <ExcludeBinGroups>RETURNS,DAMAGED</ExcludeBinGroups> -->
<!-- <ItemXML><![CDATA[<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>A-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55012</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY>1240</ITEMKEY><ITEMNRINT>A-1002</ITEMNRINT><ITEMNRSUPPL>SUP-55013</ITEMNRSUPPL><EAN>4006381333948</EAN></ITEM></ITEMS>]]></ItemXML> -->
</ns1:pixiGetItemStock>
</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:pixiGetItemStock>
<!-- <ItemKey>1234</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-55012</ItemNrSuppl> -->
<!-- <ItemNrInt>A-1001</ItemNrInt> -->
<!-- <LocationStock>1</LocationStock> -->
<!-- <OnlyEnabledItems>0</OnlyEnabledItems> -->
<!-- <ExcludeBinGroups>RETURNS,DAMAGED</ExcludeBinGroups> -->
<!-- <ItemXML><![CDATA[<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>A-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55012</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY>1240</ITEMKEY><ITEMNRINT>A-1002</ITEMNRINT><ITEMNRSUPPL>SUP-55013</ITEMNRSUPPL><EAN>4006381333948</EAN></ITEM></ITEMS>]]></ItemXML> -->
</ns1:pixiGetItemStock>
</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 = [
// 'ItemKey' => '1234',
// 'EAN' => '4006381333931',
// 'ItemNrSuppl' => 'SUP-55012',
// 'ItemNrInt' => 'A-1001',
// 'LocationStock' => '1',
// 'OnlyEnabledItems' => '0',
// 'ExcludeBinGroups' => 'RETURNS,DAMAGED',
// 'ItemXML' => '<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>A-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55012</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY>1240</ITEMKEY><ITEMNRINT>A-1002</ITEMNRINT><ITEMNRSUPPL>SUP-55013</ITEMNRSUPPL><EAN>4006381333948</EAN></ITEM></ITEMS>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetItemStock', $soapArguments);
- SQL object:
- dbo.pipiGetItemStock