pixiSetItemBuyingInfo
Sets minimum stock, minimum order quantity, target stock and safety stock of an item, globally or for a specific location.
Updates the purchasing-related quantities of one item.
Normalising the input
ItemKey=0and empty strings in all other parameters are treated asNULL, which means "not provided".- A negative
TargetStockis replaced by0.
Finding the item
The item is looked up in items by ItemKey, ItemNrInt or EANUPC. The conditions are combined with OR, so any record that matches one of the identifiers is used. If no item matches, the passed ItemKey stays unchanged.
Item level (items)
This step runs only if Location is not provided and at least one of MinStockQty or MinOrderQty is set. It updates MinStockQty and MinOrderQty of the item. A value that is not provided keeps its current value.
Location level (ItemLocationSpecific)
This step runs if at least one of the four quantities is set. It updates MinStockQty, MinOrderQty, TargetStock and SafetyStock of the location-specific records of the item:
- If
Locationis set, only the record with thatLocIDis updated. - If
Locationis not set, all location records of the item are updated.
Values that are not provided keep their current value.
TargetStock and SafetyStock exist only at location level.
The procedure returns no result set.
Notes
- Transactions: the procedure runs in its own transaction, or in a savepoint if a transaction is already open.
- Errors are not reported back: all errors are caught and passed to
log.InsertError. Examples are a non-numeric quantity that fails the conversion toint, or a value longer than 10 characters. That object is not attached, so it is unknown whether anything is returned to the caller. A successful call and a failed call can therefore look identical. - Ambiguous identifiers: if several items match the combined OR condition, which happens when the identifiers belong to different items, one of them is picked arbitrarily. Pass only one identifier, or consistent ones.
- Item not found: if no item is found, nothing is updated and no message is returned.
- No range check: only
TargetStockis clamped at0. Negative values forMinStockQty,MinOrderQtyandSafetyStockare written as they are. - Locking: the reads use
NOLOCK; the updates useROWLOCK.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal key of the item. Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number, used as an alternative identifier. An empty string is treated as not provided. Example: |
EANUPC
|
varchar(13) string |
NULL |
EAN/UPC of the item, used as an alternative identifier. An empty string is treated as not provided. Example: |
Location
|
varchar(3) string |
NULL |
Location ID ( Example: |
MinStockQty
|
varchar(10) string |
NULL |
New minimum stock quantity as an integer string. Empty means the value is not changed. Example: |
MinOrderQty
|
varchar(10) string |
NULL |
New minimum order quantity as an integer string. Empty means the value is not changed. Example: |
TargetStock
|
varchar(10) string |
NULL |
New target stock, location level only, as an integer string. Negative values are set to Example: |
SafetyStock
|
varchar(10) string |
NULL |
New safety stock, location level only, as an integer string. Empty means the value is not changed. Example: |
This call returns no result set.
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:pixiSetItemBuyingInfo>
<!-- <ItemKey>4711</ItemKey> -->
<!-- <ItemNrInt>ART-10025</ItemNrInt> -->
<!-- <EANUPC>4006381333931</EANUPC> -->
<!-- <Location>001</Location> -->
<!-- <MinStockQty>10</MinStockQty> -->
<!-- <MinOrderQty>25</MinOrderQty> -->
<!-- <TargetStock>100</TargetStock> -->
<!-- <SafetyStock>5</SafetyStock> -->
</ns1:pixiSetItemBuyingInfo>
</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:pixiSetItemBuyingInfo>
<!-- <ItemKey>4711</ItemKey> -->
<!-- <ItemNrInt>ART-10025</ItemNrInt> -->
<!-- <EANUPC>4006381333931</EANUPC> -->
<!-- <Location>001</Location> -->
<!-- <MinStockQty>10</MinStockQty> -->
<!-- <MinOrderQty>25</MinOrderQty> -->
<!-- <TargetStock>100</TargetStock> -->
<!-- <SafetyStock>5</SafetyStock> -->
</ns1:pixiSetItemBuyingInfo>
</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' => '4711',
// 'ItemNrInt' => 'ART-10025',
// 'EANUPC' => '4006381333931',
// 'Location' => '001',
// 'MinStockQty' => '10',
// 'MinOrderQty' => '25',
// 'TargetStock' => '100',
// 'SafetyStock' => '5',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSetItemBuyingInfo', $soapArguments);
- SQL object:
- dbo.pipiSetItemBuyingInfo