pixiGetItemStockBins
Returns the bin locations (Lagerplätze) and quantities per batch and best-before date for one or more items identified by key, EAN, item numbers or an XML list.
Looks up the stock per bin for one or more items.
Input normalisation
ItemKey=0is treated asNULL.- String parameters are trimmed; empty strings are treated as
NULL. - If no parameter is left, a status row with
Status=Erroris returned.
Finding the items (all criteria are combined with OR, so the result is the union of all matches):
EANis matched against item codes of type barcode (code type 1) inItemCode.ItemNrIntis matched against item codes of type shop item number (code type 2).ItemNrSupplis matched against item codes of type supplier item number (code type 4).ItemKeyis matched against the item ID inItemCode.ItemXML(element-centric XML, path/ITEMS/ITEM) can list several items. PerITEM,ITEMKEYis taken directly, whileITEMNRINT,ITEMNRSUPPLandEANare matched against the columnsItemNrInt,ItemNrSupplandEANUPCof theitemstable.
If no candidate item is found, a status row No items found with given parameters. is returned.
Result
For each found item, one row per bin, batch number and best-before date with the summed quantity from InvBinItem. Bin data (name, sort number, location, bin group, transport bin flag) comes from InvBin. Rows are sorted by LocID and then by BinName (case-insensitive). Items that are found but have no bin stock records produce no rows (empty result, no error).
Notes
- All reads use
NOLOCK, so results may include uncommitted data. - The single parameter
ItemKeyis matched via theItemCodetable, not viaitems. An item without any entry inItemCodeis not found byItemKey; useItemXMLwithITEMKEYinstead, which is taken directly. - The single parameter
EANsearches all barcodes of type 1 inItemCode, whereasEANinsideItemXMLonly matches the main EAN (items.EANUPC). - If the same item is found both through the single parameters and through
ItemXML, it appears twice in the internal candidate list and itsQuantityvalues are summed twice. Identify each item through only one route. - A non-existing
ITEMKEYin the XML avoids the "No items found" error but simply yields no rows. - OPENXML element names are case-sensitive (
ITEMS,ITEM,ITEMKEY,ITEMNRINT,ITEMNRSUPPL,EAN). BestBeforeDateis returned as text in the formatyyyy-mm-dd hh:mi:ss.mmm; an empty string means no date.BatchNumberis an empty string if no batch is set.- On error the procedure returns code 1 after the status row.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal item key. Example: |
EAN
|
varchar(13) string |
NULL |
Barcode/EAN of the item, matched against item codes of type barcode (code type 1). Example: |
ItemNrSuppl
|
varchar(50) string |
NULL |
Supplier item number, matched against item codes of type supplier item number (code type 4). Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal/shop item number, matched against item codes of type shop item number (code type 2). Example: |
ItemXML
|
varchar(max) xml |
NULL |
Optional XML list of items ( Example:
|
Result set 1 · If at least one item was identified (may be empty if the items have no bin stock records).
Stock per bin, item, batch number and best-before date, sorted by LocID and BinName.
| Column | Type | Description |
|---|---|---|
BinName
Nullable |
string |
Name of the bin ( |
Quantity
Nullable |
int |
Sum of |
BinSortNum
Nullable |
int |
Sort number of the bin ( |
EAN
Nullable |
string |
Main EAN of the item ( |
ItemNRInt
Nullable |
string |
Internal item number ( |
LocID
Nullable |
string |
Location (warehouse) ID of the bin ( |
BatchNumber
|
string |
Batch number (Charge); empty string if none. |
BestBeforeDate
|
varchar(25) string |
Best-before date as text ( |
BinGroup
Nullable |
string |
Bin group ( |
TransportBin
Nullable |
boolean |
Transport bin flag of the bin ( |
Result set 2 · If no identifying parameter is given or no item is found; returned instead of the stock rows.
Status row describing the error.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
|
varchar(52) string |
Error text. |
Response example
<SqlRowSet1>
<row>
<BinName>A-01-02</BinName>
<Quantity>12</Quantity>
<BinSortNum>1020</BinSortNum>
<EAN>4006381333931</EAN>
<ItemNRInt>ART-1001</ItemNRInt>
<LocID>001</LocID>
<BatchNumber>CH2024-07</BatchNumber>
<BestBeforeDate>2025-06-30 00:00:00.000</BestBeforeDate>
<BinGroup>A</BinGroup>
<TransportBin>false</TransportBin>
</row>
<row>
<BinName>B-03-01</BinName>
<Quantity>5</Quantity>
<BinSortNum>2010</BinSortNum>
<EAN>4006381333931</EAN>
<ItemNRInt>ART-1001</ItemNRInt>
<LocID>001</LocID>
<BatchNumber/>
<BestBeforeDate/>
<BinGroup>B</BinGroup>
<TransportBin>false</TransportBin>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | Specify at least one parameter to identify the item. | All parameters are NULL, empty/whitespace or `ItemKey` = 0. Provide at least one of `ItemKey`, `EAN`, `ItemNrSuppl`, `ItemNrInt` or `ItemXML`. |
| Error | No items found with given parameters. | None of the given identifiers matches an item code or item. Check the values and the XML element names. |
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:pixiGetItemStockBins>
<!-- <ItemKey>1234</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-55-A</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-1001</ItemNrInt> -->
<!-- <ItemXML><![CDATA[<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>ART-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55-A</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY></ITEMKEY><ITEMNRINT>ART-2002</ITEMNRINT><ITEMNRSUPPL></ITEMNRSUPPL><EAN></EAN></ITEM></ITEMS>]]></ItemXML> -->
</ns1:pixiGetItemStockBins>
</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:pixiGetItemStockBins>
<!-- <ItemKey>1234</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-55-A</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-1001</ItemNrInt> -->
<!-- <ItemXML><![CDATA[<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>ART-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55-A</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY></ITEMKEY><ITEMNRINT>ART-2002</ITEMNRINT><ITEMNRSUPPL></ITEMNRSUPPL><EAN></EAN></ITEM></ITEMS>]]></ItemXML> -->
</ns1:pixiGetItemStockBins>
</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-55-A',
// 'ItemNrInt' => 'ART-1001',
// 'ItemXML' => '<ITEMS><ITEM><ITEMKEY>1234</ITEMKEY><ITEMNRINT>ART-1001</ITEMNRINT><ITEMNRSUPPL>SUP-55-A</ITEMNRSUPPL><EAN>4006381333931</EAN></ITEM><ITEM><ITEMKEY></ITEMKEY><ITEMNRINT>ART-2002</ITEMNRINT><ITEMNRSUPPL></ITEMNRSUPPL><EAN></EAN></ITEM></ITEMS>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetItemStockBins', $soapArguments);
- SQL object:
- dbo.pipiGetItemStockBins