pixiDispoGetItemBinLog
Returns aggregated stock movements from the bin item log for an external disposition software (LogControl), optionally summed up per item in inventory mode.
Exports stock movements from InvBinItemLog for an external disposition tool (LogControl).
Selection
- Only log entries with
IBILKEY>@ItemBinLogKeyStart,Qty<> 0 andUpdateDatebetween@DateStartand@DateEnd(both inclusive). If@DateStartis NULL,1900-01-01is used; if@DateEndis NULL, the current date and time is used. - Entries are grouped by update timestamp,
ForOrderline, location, item, reason, update employee and stock movement type. Groups whose quantity sum is 0 are dropped. - The first
@RowCountgroups (default 10000), ordered by their lowest log key, are taken. The lowest log key of a group is returned asItemBinLogKeyandPItemBinLogKey.
Movement type code A hard-coded type is derived per group:
0300: outflow (negative sum) not related to an order line2000: outflow related to an order line (ForOrderlineset and not 0)0200: inflow booked by an employee whose name starts with the value of settingDispoInventoryUser1000: all other movements
If setting DispoExportAllImportTypes is 1, mode 0 returns the Type of the joined StockMovementTypes record instead.
Supplier order data
If the reason contains Picco Del.Nr. followed by a numeric delivery number and the movement has no order line, the procedure looks up the supplier delivery (SDelHeader/SDelDetail), its buying match and the related supplier order line. Order date, internal supplier order number and estimated delivery date are returned; if nothing is found, these columns contain '0'.
Output modes
@InventoryMode= 0: one row per group, ordered byItemBinLogKey, with the absolute quantity and the location.@InventoryMode= 1: movements without order line are summed up per item (type0300for a negative total, otherwise0200); movements with order line are returned individually (type2000for outflow,1000for inflow). Both parts are combined withUNIONand ordered byType. This mode returns noEstimatedDeliveryDateand noLocationID.
For incremental export, pass the highest ItemBinLogKey of the previous call as @ItemBinLogKeyStart.
Notes
- All reads use
NOLOCK, so uncommitted data may be included. SET NOCOUNTis intentionally not set; the intermediateSELECT ... INTOstatements produce row-count messages.fpixi_GetSettingreturns'0'when a setting does not exist. IfDispoInventoryUseris missing, the inventory user prefix becomes'0', not NULL, so inflows by employees whose name starts with0are typed0200.@DateEndis compared with the full timestamp: a date like20110820means midnight, so movements later on that day are excluded.UpdateDateis returned as text in formatdd.mm.yyyy. In inventory mode,MAX(UpdateDate)compares these strings alphabetically, so the result is not necessarily the latest date.- In inventory mode, sums run across all locations of an item,
@RowCountlimits the underlying groups (not the output rows), andUNIONremoves identical rows. The column order differs from mode 0 (SupplOrderNrbeforeSupplOrderDate) and the item column is namedItemKeyinstead ofITemKey. - The delivery number is taken from position 14 of
Reason, which assumes the reason starts withPicco Del.Nr.. - An unused
LEFT JOINonSDelHeadervia the part ofUpdateEmpafter/could multiply rows and inflate sums if several deliveries share that number. - Temporary tables are dropped via
util.TempTableDrop(definition not attached).
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemBinLogKeyStart
Required
|
int | – |
Only log entries with a key greater than this value are exported. Pass 0 for a full export or the last exported Example: |
DateStart
|
datetime dateTime |
NULL |
Earliest update timestamp (inclusive). NULL means 1900-01-01. Example: |
DateEnd
|
datetime dateTime |
NULL |
Latest update timestamp (inclusive). NULL means the current date and time. Example: |
InventoryMode
|
bit boolean |
0 |
Selects the output format: single movements or movements summed up per item. Allowed values
Example: |
RowCount
|
int | 10000 |
Maximum number of grouped movements taken from the log. NULL means 10000. Example: |
Result set 1 · If @InventoryMode = 0
One row per grouped stock movement, ordered by ItemBinLogKey.
| Column | Type | Description |
|---|---|---|
PItemBinLogKey
|
int |
Lowest log key of the group (same as |
ItemBinLogKey
|
int |
Lowest log key of the group; use the highest value as next |
ITemKey
|
int |
Item key. |
UpdateDate
|
varchar(10) string |
Date of the movement as text |
Qty
|
decimal |
Absolute quantity of the movement. |
Type
Nullable |
string |
Movement type code |
SupplNR
Nullable |
string |
Supplier number of the item. |
ItemNrInt
Nullable |
string |
Internal item number. |
ItemNrSuppl
Nullable |
string |
Supplier item number, or the internal item number if empty. |
SupplOrderDate
|
varchar(10) string |
Order date of the related supplier order as |
SupplOrderNr
|
string |
Internal number of the related supplier order, or |
EstimatedDeliveryDate
|
varchar(10) string |
Estimated delivery date of the supplier order line as |
LocationID
Nullable |
string |
Location (warehouse) ID of the movement. |
Result set 2 · If @InventoryMode = 1
Movements without order line summed per item plus individual movements with order line, ordered by Type.
| Column | Type | Description |
|---|---|---|
PItemBinLogKey
|
int |
Highest log key of the summed item (or the log key of the single movement). |
ItemBinLogKey
|
int |
Same as |
ItemKey
|
int |
Item key. |
UpdateDate
|
varchar(10) string |
Date as |
Qty
|
decimal |
Absolute (summed) quantity. |
Type
|
varchar(4) string |
|
SupplNr
Nullable |
string |
Supplier number of the item. |
ItemNrInt
Nullable |
string |
Internal item number. |
ItemNrSuppl
Nullable |
string |
Supplier item number or internal item number. |
SupplOrderNr
|
string |
Internal supplier order number, or |
SupplOrderDate
|
varchar(10) string |
Supplier order date as |
Response example
<SqlRowSet1>
<row>
<PItemBinLogKey>154873</PItemBinLogKey>
<ItemBinLogKey>154873</ItemBinLogKey>
<ITemKey>4711</ITemKey>
<UpdateDate>02.08.2011</UpdateDate>
<Qty>5</Qty>
<Type>1000</Type>
<SupplNR>L100</SupplNR>
<ItemNrInt>ART-4711</ItemNrInt>
<ItemNrSuppl>SUP-998</ItemNrSuppl>
<SupplOrderDate>25.07.2011</SupplOrderDate>
<SupplOrderNr>BE-2011-0815</SupplOrderNr>
<EstimatedDeliveryDate>01.08.2011</EstimatedDeliveryDate>
<LocationID>001</LocationID>
</row>
<row>
<PItemBinLogKey>154880</PItemBinLogKey>
<ItemBinLogKey>154880</ItemBinLogKey>
<ITemKey>4711</ITemKey>
<UpdateDate>03.08.2011</UpdateDate>
<Qty>1</Qty>
<Type>2000</Type>
<SupplNR>L100</SupplNR>
<ItemNrInt>ART-4711</ItemNrInt>
<ItemNrSuppl>SUP-998</ItemNrSuppl>
<SupplOrderDate>0</SupplOrderDate>
<SupplOrderNr>0</SupplOrderNr>
<EstimatedDeliveryDate>0</EstimatedDeliveryDate>
<LocationID>001</LocationID>
</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:pixiDispoGetItemBinLog>
<ItemBinLogKeyStart>0</ItemBinLogKeyStart>
<!-- <DateStart>2011-08-01T00:00:00</DateStart> -->
<!-- <DateEnd>2011-08-20T23:59:59</DateEnd> -->
<!-- <InventoryMode>0</InventoryMode> -->
<!-- <RowCount>10000</RowCount> -->
</ns1:pixiDispoGetItemBinLog>
</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:pixiDispoGetItemBinLog>
<ItemBinLogKeyStart>0</ItemBinLogKeyStart>
<!-- <DateStart>2011-08-01T00:00:00</DateStart> -->
<!-- <DateEnd>2011-08-20T23:59:59</DateEnd> -->
<!-- <InventoryMode>0</InventoryMode> -->
<!-- <RowCount>10000</RowCount> -->
</ns1:pixiDispoGetItemBinLog>
</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 = [
'ItemBinLogKeyStart' => '0',
// 'DateStart' => '2011-08-01T00:00:00',
// 'DateEnd' => '2011-08-20T23:59:59',
// 'InventoryMode' => '0',
// 'RowCount' => '10000',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDispoGetItemBinLog', $soapArguments);
- SQL object:
- dbo.pipiDispoGetItemBinLog