pixiBinCreate
Creates one or more bins (Lagerplätze) from an XML list, validates each entry and returns a status row per bin.
Creates new bins in the table InvBin from the XML passed in BinsXML. Each /Bins/Bin element describes one bin.
Input checks for the whole request
- If
BinsXMLis NULL or empty, or contains no/Bins/Binelement, a single status rowERROR/XML contains no data.is returned. - If the text cannot be converted to XML,
ERROR/Cannot parse XMLis returned.
Validation per bin (a bin that fails a check gets Status = ERROR and is not inserted):
- Duplicates within the request: with setting
FilterStockOperationsWithLocation= 0 the bin name must be unique in the request; with setting = 1 the combination name + location must be unique. Transport bins (TransportBin= 1) with the same name are always duplicates, regardless of location. Namemust not be empty.LocIdmust not be empty.SortNrmust be an integer ≥ 0 (mandatory).MaxItemsmust be an integer ≥ 0 (mandatory).- Duplicates in the database: with setting = 0 no existing bin may have the same name in any location; with setting = 1 no existing bin may have the same name in the same location.
- The location
LocIdmust exist inLocation.
Insert
All bins without error are inserted in one transaction into InvBin with BinLocID, BinName, BinMaxItems, BinSortNum, BinGroup, TransportBin; CreateEmp/UpdateEmp are set to CreateEmp (default API), CreateDate/UpdateDate to the current time. A missing Group is stored as empty string, a missing TransportBin as 0.
Response
One row per Bin element, sorted by its position in the XML (Row). Successfully created bins have Status = CREATED, an empty Message and the new BinKey (looked up by name and location). Rejected bins have Status = ERROR, the reason in Message and BinKey = NULL.
Notes
- The behaviour depends on the setting
FilterStockOperationsWithLocation(read viaSettingGet, default 0): with 0 bin names are unique system-wide, with 1 only per location. - Only one error message is kept per bin. An empty name overwrites a previously set duplicate message; later checks only run on rows that have no error yet.
- Which of several duplicate entries in the request is accepted is not guaranteed to be the first in the XML, because the numbering within a duplicate group is ordered only by the bin name.
SortNrandMaxItemsare parsed withTRY_PARSE(culture of the session language). A missing value already fails asDatatype error, so the messagesSortNr is empty./MaxItems is empty.are practically never returned. TheSortNrandMaxItemscolumns of the response show the parsed input, so they are NULL for non-numeric values.TransportBinis read directly asbit. A value that cannot be converted (e.g.yes) raises a SQL error outside the error handling and comes back asSqlMessage.- Existence checks against
InvBinandLocationuseNOLOCK; parallel calls with the same bin names can therefore still create duplicates. - The insert runs in its own transaction (or a savepoint if a transaction is already open). On an unexpected error everything is rolled back, the error is logged via
log.InsertError(not attached) and a single rowERRORwith the SQL error text is returned.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
BinsXML
Required
|
varchar(max) xml |
– |
XML list of bins to create. Root Example:
|
CreateEmp
|
varchar(50) string |
API |
User name stored as creator and last editor of the new bins. An empty value is replaced by Example: |
Result set 1 · If BinsXML is empty, cannot be parsed or contains no /Bins/Bin element.
Single status row; no bin is created.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
|
varchar(21) string |
Error text. |
Result set 2 · After validation, if no unexpected SQL error occurs.
One row per Bin element of the request with the result of the creation, sorted by Row.
| Column | Type | Description |
|---|---|---|
Row
|
int |
Position of the |
BinKey
Nullable |
int |
Key of the created bin in |
BinName
Nullable |
varchar(50) string |
Bin name from the request. |
LocId
Nullable |
varchar(3) string |
Location ID from the request. |
BinGroup
Nullable |
varchar(20) string |
Bin group from the request (empty string if not given). |
SortNr
Nullable |
int |
Sort number parsed from the request; NULL if missing or not numeric. |
MaxItems
Nullable |
int |
Maximum number of items parsed from the request; NULL if missing or not numeric. |
Status
|
varchar(10) string |
|
Message
|
varchar(50) string |
Reason for rejection; empty string on success. |
TransportBin
|
bit boolean |
Whether the bin is a transport bin. |
Result set 3 · If an unexpected SQL error occurs during insert or response creation.
Single status row with the SQL error text; all inserts of the call are rolled back.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(5) string |
Always |
Message
Nullable |
nvarchar(4000) string |
SQL error message. |
Response example
<SqlRowSet1>
<row>
<Row>1</Row>
<BinKey>4711</BinKey>
<BinName>A-01-01</BinName>
<LocId>001</LocId>
<BinGroup>Regal A</BinGroup>
<SortNr>10</SortNr>
<MaxItems>100</MaxItems>
<Status>CREATED</Status>
<Message/>
<TransportBin>false</TransportBin>
</row>
<row>
<Row>2</Row>
<BinName>A-01-02</BinName>
<LocId>099</LocId>
<BinGroup>Regal A</BinGroup>
<SortNr>20</SortNr>
<MaxItems>100</MaxItems>
<Status>ERROR</Status>
<Message>Bin not created (Location does not exist).</Message>
<TransportBin>false</TransportBin>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | XML contains no data. | `BinsXML` is NULL, empty or contains no `/Bins/Bin` element. Send at least one `Bin` element below the root `Bins`. |
| ERROR | Cannot parse XML | `BinsXML` is not well-formed XML. |
| ERROR | Bin not created (Duplicated). | The bin name occurs more than once in the request (per location if `FilterStockOperationsWithLocation` = 1; always for transport bins), or, with setting = 0, a bin with this name already exists in any location. |
| ERROR | Bin Name not created (Duplicated). | With `FilterStockOperationsWithLocation` = 1 a bin with the same name already exists in the same location. |
| ERROR | Bin not created. Name is empty. | `Name` is missing or empty. |
| ERROR | Bin not created. Location is empty. | `LocId` is missing or empty. |
| ERROR | Bin not created. Datatype error (SortNr). | `SortNr` is missing or not a valid integer. |
| ERROR | Bin not created. SortNr is empty. | `SortNr` is NULL after parsing; in practice a missing value is already reported as datatype error. |
| ERROR | Bin not created. SortNr should be positive. | `SortNr` is negative. Use 0 or a positive integer. |
| ERROR | Bin not created. Datatype error (MaxItems). | `MaxItems` is missing or not a valid integer. |
| ERROR | Bin not created. MaxItems is empty. | `MaxItems` is NULL after parsing; in practice a missing value is already reported as datatype error. |
| ERROR | Bin not created. MaxItems should be positive. | `MaxItems` is negative. Use 0 or a positive integer. |
| ERROR | Bin not created (Location does not exist). | The given `LocId` does not exist in the location table. |
| ERROR | {ERROR_MESSAGE()} | Unexpected SQL error while inserting the bins or building the response; the transaction is rolled back and the error is logged. |
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:pixiBinCreate>
<BinsXML><![CDATA[<Bins><Bin><Name>A-01-01</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>100</MaxItems><TransportBin>0</TransportBin></Bin><Bin><Name>TR-01</Name><LocId>001</LocId><Group></Group><SortNr>900</SortNr><MaxItems>0</MaxItems><TransportBin>1</TransportBin></Bin></Bins>]]></BinsXML>
<!-- <CreateEmp>ShopSync</CreateEmp> -->
</ns1:pixiBinCreate>
</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:pixiBinCreate>
<BinsXML><![CDATA[<Bins><Bin><Name>A-01-01</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>100</MaxItems><TransportBin>0</TransportBin></Bin><Bin><Name>TR-01</Name><LocId>001</LocId><Group></Group><SortNr>900</SortNr><MaxItems>0</MaxItems><TransportBin>1</TransportBin></Bin></Bins>]]></BinsXML>
<!-- <CreateEmp>ShopSync</CreateEmp> -->
</ns1:pixiBinCreate>
</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><Name>A-01-01</Name><LocId>001</LocId><Group>Regal A</Group><SortNr>10</SortNr><MaxItems>100</MaxItems><TransportBin>0</TransportBin></Bin><Bin><Name>TR-01</Name><LocId>001</LocId><Group></Group><SortNr>900</SortNr><MaxItems>0</MaxItems><TransportBin>1</TransportBin></Bin></Bins>',
// 'CreateEmp' => 'ShopSync',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiBinCreate', $soapArguments);
- SQL object:
- dbo.pipiBinCreate