pixiGetPhysicalItemStock
Returns the physical stock quantity of one item at one location, identifying the item by item key, EAN, supplier item number or internal item number.
Scalar function that returns a single integer: the value of LocationQuantity from the location-specific item data for the given location.
Steps:
- The item identifiers are normalised:
ItemKey=0and empty strings forEAN,ItemNrSupplandItemNrIntare treated as not set (NULL). - Location-specific item records (
ItemLocationSpecific) are joined with the item master (Items) and filtered onLocID=LocationId. - A record matches if any of the supplied identifiers matches:
ItemKey,EANUPC=EAN,ItemNrSupplorItemNrInt. The identifiers are combined with OR, not AND. - The
LocationQuantityof the matching record is returned asResult.
If no record matches, or no identifier is supplied, the result is NULL.
Notes
- Reads with
NOLOCK, so the value may reflect uncommitted changes. - Because the identifiers are combined with OR, passing several identifiers that belong to different Artikel can match more than one record. In that case the function returns the quantity of one of them, and which one is not defined (no sort order). Pass only one identifier, ideally
ItemKey, to get a deterministic result. EAN,ItemNrSupplorItemNrIntmay not be unique across items; the same ambiguity applies then.LocationIdhas no default and must always be supplied.- The function returns the stored
LocationQuantityonly; it does not subtract reservations or open orders.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal key of the item. Example: |
EAN
|
varchar(13) string |
NULL |
EAN/UPC of the item, compared with Example: |
ItemNrSuppl
|
varchar(50) string |
NULL |
Supplier item number. Empty string is treated as not set. Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number. Empty string is treated as not set. Example: |
LocationId
Required
|
char(50) string |
– |
Location (warehouse) ID, compared with Example: |
Result set 1 · Always (scalar return value; NULL if no matching record).
Physical stock quantity of the item at the given location.
| Column | Type | Description |
|---|---|---|
Result
Nullable |
int |
|
Response example
<SqlRowSet1>
<row>
<Result>42</Result>
</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:pixiGetPhysicalItemStock>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-4711</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-100200</ItemNrInt> -->
<LocationId>001</LocationId>
</ns1:pixiGetPhysicalItemStock>
</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:pixiGetPhysicalItemStock>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <EAN>4006381333931</EAN> -->
<!-- <ItemNrSuppl>SUP-4711</ItemNrSuppl> -->
<!-- <ItemNrInt>ART-100200</ItemNrInt> -->
<LocationId>001</LocationId>
</ns1:pixiGetPhysicalItemStock>
</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-100200',
'LocationId' => '001',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetPhysicalItemStock', $soapArguments);
- SQL object:
- dbo.pipiGetPhysicalItemStock