pixiGetItemStockOnForOrder2Store
Returns the physical and available stock of items per stock location plus an aggregated 'All' row per item, taking open orders or reservations into account.
Returns one row per item and stock location (ItemLocationSpecific joined with Location) and, combined via UNION, one additional row per item with Location = All.
Settings read at runtime
HalOrdersActiveDays: number of days that order lines in statusHALcount as open. A value of0is replaced by7.ReservePrepaymentOrders: if1, availability is calculated from reservations, otherwise from open order lines.
Per-location rows
PhysicalQTYis theLocationQuantityof the item on that location.OpenOrdersis the sum ofQtyof order lines of the item on that location with statusANG, or statusHALand anOrderDatewithin the lastHalOrdersActiveDaysdays.ReservedOrdersis the number of reservation records of the item whose order line is on that location and has a non-final order state other thanEIN,FUT,FUS.AvailQTY=PhysicalQTYminusReservedOrders(reservations enabled) or minusOpenOrders(reservations disabled).SpecialStockis the special-stock flag of the location.- Filtered by
LocationIdif given.
'All' rows
PhysicalQTYis the total item quantity (Items.Quantity).OpenOrdersandReservedOrdersare computed like above, but over all locations.AvailQTY= total quantity minus the stock on special-stock locations (Location.SpecialStock = 1) minusReservedOrdersorOpenOrders(depending on the setting).SpecialStockis always0.LocationIdis not applied to these rows, they are always returned for the selected items.
Item selection
The item parameters ItemKey, EAN, ItemNrSuppl and ItemNrInt are combined with OR, and each condition is true when its parameter is NULL. See the notes for the consequences. No sort order is defined.
Notes
- Filter pitfall: because the four item conditions are OR-combined and each is true when its parameter is
NULL, leaving out any ofItemKey,EAN,ItemNrSuppl,ItemNrIntreturns all items. Passing onlyItemKeytherefore does not restrict the result. Only when all four parameters are filled are the items returned that match at least one of them. - Without any filter the call returns rows for every item and location, which can be very large and slow because of the correlated subqueries per row.
- The output parameter
Quantityis never assigned by the code; it is returned unchanged. ReservedOrderscounts reservation records, not quantities.- If the setting
HalOrdersActiveDaysdoes not exist, the cut-off date isNULLandHALorder lines are never counted as open. - A code comment mentions 14 days for
HALorders, but the actual period comes fromHalOrdersActiveDays(default 7 if set to 0). - All tables are read with
NOLOCK, so values may include uncommitted data.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal item key. Only effective as a filter if all other item parameters are also set (see notes). Example: |
EAN
|
varchar(13) string |
NULL |
EAN/UPC of the item ( Example: |
ItemNrSuppl
|
varchar(50) string |
NULL |
Supplier item number ( Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number ( Example: |
LocationId
|
varchar(50) string |
NULL |
Restricts the per-location rows to this location ID. Example: |
Quantity
OUTPUT
|
int | NULL |
Output parameter that is never assigned by the code; it is returned unchanged. |
Response
Result set 1 · Always
Stock rows per item and location plus one 'All' row per item; unsorted.
| Column | Type | Description |
|---|---|---|
Location
|
string |
Location ID ( |
ItemKey
|
int |
Internal item key. |
PhysicalQTY
Nullable |
int |
Physical stock: |
OpenOrders
|
int |
Sum of quantities of open order lines (status |
ReservedOrders
|
int |
Number of reservation records for order lines in non-final states other than |
AvailQTY
Nullable |
int |
Available stock: physical stock minus reservations or open orders (depending on |
SpecialStock
Nullable |
int |
Special-stock flag of the location ( |
Response example
<SqlRowSet1>
<row>
<Location>001</Location>
<ItemKey>12345</ItemKey>
<PhysicalQTY>20</PhysicalQTY>
<OpenOrders>3</OpenOrders>
<ReservedOrders>0</ReservedOrders>
<AvailQTY>17</AvailQTY>
<SpecialStock>0</SpecialStock>
</row>
<row>
<Location>All</Location>
<ItemKey>12345</ItemKey>
<PhysicalQTY>25</PhysicalQTY>
<OpenOrders>4</OpenOrders>
<ReservedOrders>0</ReservedOrders>
<AvailQTY>16</AvailQTY>
<SpecialStock>0</SpecialStock>
</row>
</SqlRowSet1>
Examples
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:pixiGetItemStockOnForOrder2Store>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-4711</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-10001</ItemNrInt> -->
<!-- <LocationId>001</LocationId> -->
<!-- <Quantity>?</Quantity> -->
</ns1:pixiGetItemStockOnForOrder2Store>
</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:pixiGetItemStockOnForOrder2Store>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-4711</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-10001</ItemNrInt> -->
<!-- <LocationId>001</LocationId> -->
<!-- <Quantity>?</Quantity> -->
</ns1:pixiGetItemStockOnForOrder2Store>
</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' => '12345',
// 'EAN' => '4006381333931',
// 'ItemNrSuppl' => 'SUP-4711',
// 'ItemNrInt' => 'ART-10001',
// 'LocationId' => '001',
// 'Quantity' => '?',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetItemStockOnForOrder2Store', $soapArguments);
Tables used
- SQL object:
- dbo.pipiGetItemStockOnForOrder2Store