pixiGetStockBinsEmpty
Returns empty stock bins (Lagerplätze without any bin item record), optionally only those sorted near a reference bin.
Searches for empty bins (Lagerplätze). A bin counts as empty if no row in InvBinItem references it (BinRef = BinKey).
- If both
BinNameandLocIDare passed, the key of the bin with that name in that location is looked up and used as the reference bin (NearBinKey). If no such bin exists, a passedNearBinKeystays unchanged. LocIDempty orNULLmeans all locations; otherwise only bins of that location (BinLocID) are considered.- Without a reference bin (
NearBinKeyisNULLor0): returns the firstRowsempty bins ordered byBinSortNumascending. - With a reference bin: reads the
BinSortNumof the reference bin and returns up toRows / 2(integer division) empty bins withBinSortNumless than or equal to the reference (the closest ones, i.e. the highest sort numbers below it) plus up toRows / 2empty bins with a higherBinSortNum(the closest ones above it). The combined list is sorted byBinSortNumascending.
The reference bin itself is part of the result if it is empty and matches the location filter.
Notes
- All reads use
NOLOCK, so the result may include uncommitted changes; a bin reported as empty may already be occupied. - Any
InvBinItemrow makes a bin non-empty, regardless of its quantity. - With a reference bin and an odd
Rows, at mostRows - 1bins are returned (e.g.Rows = 1returns nothing). - If
NearBinKeypoints to a non-existing bin, the reference sort number isNULLand the result is empty. - The location of the reference bin is not checked against
LocID; when onlyNearBinKeyis passed, its sort number is compared with bins of the filtered location. BinNameis only used together withLocID; on its own it is ignored.Rowsmust not beNULLor negative, otherwise theTOPclause raises a SQL error.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
LocID
|
varchar(3) string |
NULL |
Location (Lager) ID to restrict the search to. Example: |
Rows
|
int | 10 |
Maximum number of bins to return. With a reference bin, half of it (integer division) is taken below and half above the reference. Example: |
NearBinKey
|
int | NULL |
Key ( Example: |
BinName
|
varchar(50) string |
NULL |
Name of the reference bin; only evaluated together with Example: |
Result set 1 · If no reference bin is set (NearBinKey is NULL or 0 after the optional lookup by BinName)
The first Rows empty bins, ordered by BinSortNum ascending.
| Column | Type | Description |
|---|---|---|
BinSortNum
|
int |
Sort number of the bin. |
BinLocID
|
varchar(3) string |
Location ID of the bin. |
BinName
|
varchar(50) string |
Name of the bin. |
BinKey
|
int |
Key of the bin. |
BinGroup
|
varchar(20) string |
Bin group. |
Result set 2 · If a reference bin is set (NearBinKey not NULL/0)
Up to Rows / 2 empty bins at or below and up to Rows / 2 above the reference sort number, ordered by BinSortNum ascending.
| Column | Type | Description |
|---|---|---|
BinSortNum
|
int |
Sort number of the bin. |
BinLocID
|
varchar(3) string |
Location ID of the bin. |
BinName
|
varchar(50) string |
Name of the bin. |
BinKey
|
int |
Key of the bin. |
BinGroup
|
varchar(20) string |
Bin group. |
Response example
<SqlRowSet1>
<row>
<BinSortNum>1020</BinSortNum>
<BinLocID>001</BinLocID>
<BinName>A-01-02</BinName>
<BinKey>4711</BinKey>
<BinGroup>REGAL</BinGroup>
</row>
<row>
<BinSortNum>1030</BinSortNum>
<BinLocID>001</BinLocID>
<BinName>A-01-03</BinName>
<BinKey>4712</BinKey>
<BinGroup>REGAL</BinGroup>
</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:pixiGetStockBinsEmpty>
<!-- <LocID>001</LocID> -->
<!-- <Rows>10</Rows> -->
<!-- <NearBinKey>4711</NearBinKey> -->
<!-- <BinName>A-01-02</BinName> -->
</ns1:pixiGetStockBinsEmpty>
</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:pixiGetStockBinsEmpty>
<!-- <LocID>001</LocID> -->
<!-- <Rows>10</Rows> -->
<!-- <NearBinKey>4711</NearBinKey> -->
<!-- <BinName>A-01-02</BinName> -->
</ns1:pixiGetStockBinsEmpty>
</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 = [
// 'LocID' => '001',
// 'Rows' => '10',
// 'NearBinKey' => '4711',
// 'BinName' => 'A-01-02',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetStockBinsEmpty', $soapArguments);
- SQL object:
- dbo.pipiGetStockBinsEmpty