pixiSetItemBuyingInfoXML
Updates buying data such as minimum stock, minimum order quantity, order unit, target and safety stock for several items from an XML document.
Reads one Item element per article from /BuyingInfo/Item (element-centric) and writes the given values to the item master, the location-specific item data and the supplier item data.
Identifying the item
An item can be identified by ItemKey, ItemNrInt or EAN. The lookup runs in this order: by ItemKey, then by ItemNrInt, then by EAN. Each match overwrites the identifiers with those of the found item, so a later match wins. Entries for which no item is found are silently skipped.
Value cleanup
- Empty text fields (
ItemNrInt,EAN,Location,SupplierCode) and an empty or0ItemKeyare treated as not given. - Quantity fields (
MinStockQty,MinOrderQty,OrderUnit,VPE,TargetStock,SafetyStock) are only used if they are numeric; otherwise they are ignored. OrderUnitandVPEare merged: ifOrderUnitis given, its value is used for both; otherwiseVPEis used for both.- A negative
TargetStockis set to0. - Fields that are not given (NULL) are not changed.
What is updated
MinStockQty: on the item master (items) only if noLocationis given; inItemLocationSpecificfor all locations of the item if noLocationis given, otherwise only for that location.MinOrderQty: same rule asMinStockQty; additionally on the supplier item (AddItems) for the supplier given inSupplierCode(independent ofLocation).OrderUnit/VPE: on the item master only, and only if noLocationis given.TargetStockandSafetyStock: only inItemLocationSpecific, for all locations or only for the givenLocation.
Result
Returns one row per item that was found, with the resolved identifiers and the values that were applied.
Notes
- All updates run in one transaction (or a savepoint if the caller already has an open transaction). On any error the changes are rolled back and the error is logged via
log.InsertError; that object is not attached, so it is unknown whether the error is passed on to the caller. In that case no result set is returned. ISNUMERICalso accepts values such as1.5or1e3. Such values pass the check but fail when converted toint, which aborts and rolls back the whole call. Send integers only.- Item lookups use
NOLOCK. If several items share the same EAN, the EAN lookup can pick any of them and override a match byItemKeyorItemNrInt. - Values cannot be cleared: an empty element means "do not change". Use
0to reset a quantity. Locationis not returned in the result set, and the returned row does not show whether a location or supplier record actually existed.- The header comment ("Set Tags for Items") does not match the actual function of the procedure.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
BuyingXML
|
varchar(max) xml |
NULL |
XML document with one Example:
|
Result set 1 · On success (no error during processing)
One row per XML item for which an article was found, with resolved identifiers and the applied values.
| Column | Type | Description |
|---|---|---|
ItemKey
|
int |
Internal key of the found item. |
ItemNrInt
Nullable |
varchar(50) string |
Internal item number of the found item. |
EAN
Nullable |
varchar(13) string |
EAN/UPC of the found item. |
MinStockQty
Nullable |
varchar(10) string |
Minimum stock quantity applied; NULL if not given. |
MinOrderQty
Nullable |
varchar(10) string |
Minimum order quantity applied; NULL if not given. |
SupplierCode
Nullable |
varchar(4) string |
Supplier code from the input; NULL if not given. |
TargetStock
Nullable |
varchar(10) string |
Target stock applied (negative values set to 0); NULL if not given. |
SafetyStock
Nullable |
varchar(10) string |
Safety stock applied; NULL if not given. |
PackingUnit
Nullable |
varchar(10) string |
Order unit / packing unit applied ( |
Response example
<SqlRowSet1>
<row>
<ItemKey>10045</ItemKey>
<ItemNrInt>A-10045</ItemNrInt>
<EAN>4006381333931</EAN>
<MinStockQty>20</MinStockQty>
<MinOrderQty>50</MinOrderQty>
<SupplierCode>L001</SupplierCode>
<TargetStock>100</TargetStock>
<SafetyStock>15</SafetyStock>
<PackingUnit>10</PackingUnit>
</row>
<row>
<ItemKey>10046</ItemKey>
<ItemNrInt>A-10046</ItemNrInt>
<EAN>4006381333948</EAN>
<MinStockQty>5</MinStockQty>
<TargetStock>30</TargetStock>
<SafetyStock>3</SafetyStock>
<PackingUnit>6</PackingUnit>
</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:pixiSetItemBuyingInfoXML>
<!-- <BuyingXML><![CDATA[<BuyingInfo><Item><ItemNrInt>A-10045</ItemNrInt><ItemKey>10045</ItemKey><EAN>4006381333931</EAN><MinStockQty>20</MinStockQty><MinOrderQty>50</MinOrderQty><Location>001</Location><OrderUnit>10</OrderUnit><VPE>10</VPE><SupplierCode>L001</SupplierCode><TargetStock>100</TargetStock><SafetyStock>15</SafetyStock></Item><Item><ItemNrInt>A-10046</ItemNrInt><ItemKey></ItemKey><EAN></EAN><MinStockQty>5</MinStockQty><MinOrderQty></MinOrderQty><Location></Location><OrderUnit></OrderUnit><VPE>6</VPE><SupplierCode></SupplierCode><TargetStock>30</TargetStock><SafetyStock>3</SafetyStock></Item></BuyingInfo>]]></BuyingXML> -->
</ns1:pixiSetItemBuyingInfoXML>
</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:pixiSetItemBuyingInfoXML>
<!-- <BuyingXML><![CDATA[<BuyingInfo><Item><ItemNrInt>A-10045</ItemNrInt><ItemKey>10045</ItemKey><EAN>4006381333931</EAN><MinStockQty>20</MinStockQty><MinOrderQty>50</MinOrderQty><Location>001</Location><OrderUnit>10</OrderUnit><VPE>10</VPE><SupplierCode>L001</SupplierCode><TargetStock>100</TargetStock><SafetyStock>15</SafetyStock></Item><Item><ItemNrInt>A-10046</ItemNrInt><ItemKey></ItemKey><EAN></EAN><MinStockQty>5</MinStockQty><MinOrderQty></MinOrderQty><Location></Location><OrderUnit></OrderUnit><VPE>6</VPE><SupplierCode></SupplierCode><TargetStock>30</TargetStock><SafetyStock>3</SafetyStock></Item></BuyingInfo>]]></BuyingXML> -->
</ns1:pixiSetItemBuyingInfoXML>
</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 = [
// 'BuyingXML' => '<BuyingInfo><Item><ItemNrInt>A-10045</ItemNrInt><ItemKey>10045</ItemKey><EAN>4006381333931</EAN><MinStockQty>20</MinStockQty><MinOrderQty>50</MinOrderQty><Location>001</Location><OrderUnit>10</OrderUnit><VPE>10</VPE><SupplierCode>L001</SupplierCode><TargetStock>100</TargetStock><SafetyStock>15</SafetyStock></Item><Item><ItemNrInt>A-10046</ItemNrInt><ItemKey></ItemKey><EAN></EAN><MinStockQty>5</MinStockQty><MinOrderQty></MinOrderQty><Location></Location><OrderUnit></OrderUnit><VPE>6</VPE><SupplierCode></SupplierCode><TargetStock>30</TargetStock><SafetyStock>3</SafetyStock></Item></BuyingInfo>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSetItemBuyingInfoXML', $soapArguments);
- SQL object:
- dbo.pipiSetItemBuyingInfoXML