pixiBinUpdate
Updates one or more existing bins (Lagerplatz) from an XML list and returns a status row for each bin.
Updates existing bins in InvBin. Bins are identified by BinKey; new bins are not created.
- If
BinsXMLis empty or cannot be parsed as XML, a singleERRORrow is returned and nothing is changed. - Every
/Bins/Binelement is read:BinKey,Name,LocId,Group,SortNr,MaxItems,TransportBin. - Each bin is validated. A bin that fails a check gets
Status=ERRORand a message, and is skipped. The first failing check wins. The checks are:BinKeyis missing or0.SortNrorMaxItemsis not an integer, or is negative.LocIddiffers from the current location and the bin still has stock (InvBinItem).- The resulting name already exists on another bin:
- on the same location, always checked;
- on another location, only checked if the setting
FilterStockOperationsWithLocationis0; - if
TransportBin= 1 is sent, among all transport bins.
- The given
LocIddoes not exist inLocation. - No bin with that
BinKeyexists.
- All valid bins are updated in one transaction. Elements that are left out keep their current value. The update sets
BinName,BinLocID,BinGroup,BinSortNum,BinMaxItemsandTransportBin, plusUpdateEmpandUpdateDate. - One row per
Binelement is returned, ordered by its position in the XML (Row). Each row hasStatus=UPDATEDorERROR.
Notes
- Retaining values: most elements are read via
text(), so an empty element (e.g.<SortNr/>) counts as omitted and the current value is kept.Groupis read withouttext(): an empty<Group/>sets the group to an empty string. - Returned values: the result rows contain the values as sent in the XML, not the merged values stored in
InvBin. Omitted fields are returned asNULL. - Transport bins: the transport-bin duplicate check does not exclude the bin itself. Sending
TransportBin= 1 for a bin that already is a transport bin therefore reportsBin Name not updated (Duplicated).. - Duplicates within one request: names are only checked against existing rows in
InvBin, not against otherBinelements of the same request. - Unchecked check: the check
Bin not updated. Name is empty.only applies to rows withoutBinKey. Such rows already fail theBinKeycheck, so this message does not occur in practice. - Conversion errors: a non-integer
BinKeyor an invalidTransportBinvalue (anything other than0,1,true,false) fails during XML reading. This happens before theTRYblock and comes back asSqlMessage.SortNrandMaxItemsare parsed withTRY_PARSEand produce status rows instead. - Validation hints: validation reads
InvBin,InvBinItemandLocationwithNOLOCK. - Transaction: the update uses
ROWLOCKinside its own transaction, or a savepoint if a transaction is already open. - Unexpected errors: the error is logged via
log.InsertError(not attached), the transaction is rolled back and a rowStatus=ERRORis returned. ItsMessagecontains@@ERRORafter the logging call, so it is a number (typically0), not the error text. - UpdateEmp: an empty
UpdateEmpis replaced byAPI.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
BinsXML
Required
|
varchar(max) xml |
– |
XML list of bins to update, root Example:
|
UpdateEmp
|
varchar(50) string |
API |
User name written to Example: |
Result set 1 · If BinsXML is empty or cannot be parsed as XML.
Single error row; nothing is updated.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
|
varchar(21) string |
Error text. |
Result set 2 · After validation and a successful update.
One row per Bin element of the input, ordered by position, with the values as sent and the update status.
| Column | Type | Description |
|---|---|---|
Row
|
int |
Position of the |
BinKey
Nullable |
int |
Bin key as sent. |
BinName
Nullable |
varchar(50) string |
Bin name as sent; |
LocId
Nullable |
varchar(3) string |
Location ID as sent; |
BinGroup
Nullable |
varchar(20) string |
Bin group as sent; |
SortNr
Nullable |
int |
Parsed sort number; |
MaxItems
Nullable |
int |
Parsed maximum number of items; |
Status
|
varchar(10) string |
|
Message
|
varchar(50) string |
Error message; empty string for updated bins. |
TransportBin
Nullable |
bit boolean |
Transport bin flag as sent; |
Result set 3 · If an unexpected error occurs during the update.
Error row after the error was logged and the transaction rolled back.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
|
int |
Value of |
Response example
<SqlRowSet1>
<row>
<Row>1</Row>
<BinKey>1234</BinKey>
<BinName>A-01-02</BinName>
<LocId>001</LocId>
<BinGroup>Regal A</BinGroup>
<SortNr>10</SortNr>
<MaxItems>50</MaxItems>
<Status>UPDATED</Status>
<Message/>
<TransportBin>false</TransportBin>
</row>
<row>
<Row>2</Row>
<BinKey>9999</BinKey>
<SortNr>20</SortNr>
<Status>ERROR</Status>
<Message>Bin not updated (Bin does not exist).</Message>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | XML contains no data. | `BinsXML` is NULL or empty. Send a `Bins` document. |
| ERROR | Cannot parse XML | `BinsXML` is not well-formed XML. |
| ERROR | Bin not updated. Bin key is empty. | `BinKey` is missing or `0` in a `Bin` element. |
| ERROR | Bin not updated. Datatype error (SortNr). | `SortNr` is not an integer. |
| ERROR | Bin not updated. SortNr should be positive. | `SortNr` is negative. |
| ERROR | Bin not updated. Datatype error (MaxItems). | `MaxItems` is not an integer. |
| ERROR | Bin not updated. MaxItems should be positive. | `MaxItems` is negative. |
| ERROR | Bin not updated. Name is empty. | Row without `BinKey` and without name. In practice such rows already fail the `BinKey` check. |
| ERROR | Bin Location not updated. Bin has stock. | `LocId` differs from the bin's current location, but the bin still has stock. Empty the bin before moving it to another location. |
| ERROR | Bin Name not updated (Duplicated). | The resulting name is already used by another bin. This covers: the same location; another location if `FilterStockOperationsWithLocation` = 0; any transport bin if `TransportBin` = 1 is sent. |
| ERROR | Bin not updated (Location does not exist). | The given `LocId` does not exist in `Location`. |
| ERROR | Bin not updated (Bin does not exist). | No bin with the given `BinKey` exists. |
| ERROR | {@@ERROR} | Unexpected SQL error during the update. The error is logged and the transaction rolled back; `Message` contains a number, not the error text. |
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:pixiBinUpdate>
<BinsXML><![CDATA[<Bins><Bin><BinKey>1234</BinKey><Name>A-01-02</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>50</MaxItems><TransportBin>0</TransportBin></Bin><Bin><BinKey>1235</BinKey><SortNr>20</SortNr></Bin></Bins>]]></BinsXML>
<!-- <UpdateEmp>WMS</UpdateEmp> -->
</ns1:pixiBinUpdate>
</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:pixiBinUpdate>
<BinsXML><![CDATA[<Bins><Bin><BinKey>1234</BinKey><Name>A-01-02</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>50</MaxItems><TransportBin>0</TransportBin></Bin><Bin><BinKey>1235</BinKey><SortNr>20</SortNr></Bin></Bins>]]></BinsXML>
<!-- <UpdateEmp>WMS</UpdateEmp> -->
</ns1:pixiBinUpdate>
</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 = [
'BinsXML' => '<Bins><Bin><BinKey>1234</BinKey><Name>A-01-02</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>50</MaxItems><TransportBin>0</TransportBin></Bin><Bin><BinKey>1235</BinKey><SortNr>20</SortNr></Bin></Bins>',
// 'UpdateEmp' => 'WMS',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiBinUpdate', $soapArguments);
- SQL object:
- dbo.pipiBinUpdate