pixiDFSetStatus
Sets the direct fulfillment status of orderlines from an XML list of order history keys and can optionally create the DF invoices afterwards.
Used by direct fulfillment suppliers to report back the processing state of orderlines (shipped, cancelled, not deliverable) together with shipping date, tracking ID, external invoice number, batch, best-before date and serial number.
Steps
- Authentication: looks up a supplier in
SupplierswithSupplNr=@SupplNr,CustNr=@Secret, not disabled andCanDoDirectFulfillment = 1. If none is found and the settingDFAPIAllowFullAccessWithoutSecretis0or missing, the call stops with the message403 Not Authorized…and returns no rows. - XML parsing: reads all
/SETDFSTATUS/ITEMelements (element-centric) into a work table. MissingERROR/ERRORMSGdefault to200/empty. - Duplicate check: if the same
ORDERHISTORYKEYappears more than once with the sameSTATUS, the call raises500 Duplicate Orderhistorykey and Status.and nothing is changed. - Processing per item (inside one transaction): the orderline is found via
OrderHistory.OrderHistKey→OrderLineRef, then the internal procedurePixi_UpdateOrderlineDFStatusByOrderlineKeyis executed. It:- rejects the item if the orderline does not exist, is already in status
FUSor in a final state, ifQTY< 1 or larger than the orderline quantity, or if batch number / best-before date are missing for items tagged with the system tags (only when settingDFRequiredDataForSystemTagsis active); - splits the orderline if
QTYis smaller than the current quantity (the reported quantity stays on the original line, the rest goes to a new line in the old status); - maps
STATUS:STO→STO,NLB→NLB, any other value →FUSfor DF type 1, 3 or empty, otherwiseBES(then a reservation for the Auftrag is created); - updates the orderline with status, ship date, tracking ID, external invoice number, batch number, best-before date and serial number (
UpdateEmp=DF API).
- rejects the item if the orderline does not exist, is already in status
- The result text of each item is written to
ERRORMSG;ERRORbecomes500if the text containserror, otherwise200. Each item is also logged inLogTable. - All items are returned as one result set and the transaction is committed.
- If
@CreateInvoices=Y,pipiDFCreateInvoicesis executed afterwards without parameters.
Notes
- Partial processing: item errors do not roll back the other items. The internal error counter is never increased, so the transaction is always committed; check
ERRORper row. @SupplNr/@Secretonly authenticate the caller. The code does not check that the orderlines belong to that supplier.- The 403 message is raised with severity 0, i.e. as an informational message, not as an SQL error. Clients must check for it explicitly when no rows are returned.
STATUSis read with up to 13 characters but processed asvarchar(3); longer values are truncated and the result row may then not be updated (keepsERROR200).- Ship date, tracking ID and external invoice number are always overwritten; omitted elements set these fields to NULL. Batch number, best-before date and serial number keep their existing values when empty.
BESTBEFOREDATEis converted implicitly to a date; invalid values cause an exception.- If an exception occurs, the transaction is rolled back, the error is logged via
log.InsertErrorand no result set is returned. Errors caught inside the internal procedure may not show up inERROR. - If several error conditions apply to one item, only the last message set is returned.
@CreateInvoices = 'Y'runspipiDFCreateInvoicesfor all DF orderlines ready for invoicing, not only the ones in this call; it runs after the commit and returns no rows. The invoice creation itself (Pixi_CreateFulfillmentIncoices) is not attached.- Reads use
NOLOCK.
Related calls
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
XML
Required
|
varchar(max) xml |
– |
XML document with one Example:
|
CreateInvoices
|
varchar(1) string |
N |
If Allowed values
Example: |
SupplNr
|
varchar(4) string |
NULL |
Supplier number of the direct fulfillment supplier, used for authentication. Example: |
Secret
|
varchar(20) string |
NULL |
Secret of the supplier; compared with Example: |
Result set 1 · After authentication and duplicate check passed and no exception occurred during processing
One row per ITEM of the input XML with the sent values and the processing result.
| Column | Type | Description |
|---|---|---|
ORDERHISTORYKEY
Nullable |
int |
Order history key as sent |
STATUS
Nullable |
varchar(13) string |
Status as sent |
QTY
Nullable |
int |
Reported quantity as sent |
SHIPDATE
Nullable |
datetime dateTime |
Ship date as sent |
TRACKINGID
Nullable |
varchar(100) string |
Tracking ID as sent |
INVOICENREXTERNAL
Nullable |
varchar(20) string |
External invoice number as sent |
BATCHNUMBER
Nullable |
varchar(50) string |
Batch number as sent |
BESTBEFOREDATE
Nullable |
varchar(50) string |
Best-before date as sent (text) |
SERIALNUMBER
Nullable |
varchar(50) string |
Serial number as sent |
ERROR
Nullable |
varchar(100) string |
|
ERRORMSG
Nullable |
varchar(max) string |
Result text: empty on success, |
Response example
<SqlRowSet1>
<row>
<ORDERHISTORYKEY>784512</ORDERHISTORYKEY>
<STATUS>FUS</STATUS>
<QTY>2</QTY>
<SHIPDATE>2024-05-14T10:30:00</SHIPDATE>
<TRACKINGID>00340434161094042557</TRACKINGID>
<INVOICENREXTERNAL>RE-2024-0815</INVOICENREXTERNAL>
<BATCHNUMBER>B2024-17</BATCHNUMBER>
<BESTBEFOREDATE>2025-12-31</BESTBEFOREDATE>
<SERIALNUMBER>SN-000123</SERIALNUMBER>
<ERROR>200</ERROR>
<ERRORMSG/>
</row>
<row>
<ORDERHISTORYKEY>784513</ORDERHISTORYKEY>
<STATUS>STO</STATUS>
<ERROR>500</ERROR>
<ERRORMSG>ERROR: Orderline was already processed.</ERRORMSG>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| RAISERROR | 403 Not Authorized. Secret or SupplNr is incorrect. | No active DF supplier matches `@SupplNr` and `@Secret` and the setting `DFAPIAllowFullAccessWithoutSecret` is not active. Raised with severity 0 (informational); no rows are returned. |
| RAISERROR | 500 Duplicate Orderhistorykey and Status. | The XML contains the same `ORDERHISTORYKEY` with the same `STATUS` more than once. Send each combination only once. |
| 500 | ERROR: Orderline not existing | No orderline found for the `ORDERHISTORYKEY`. |
| 500 | ERROR: Batch number and Best Before Date are required for the item Id {ItemId} | Setting `DFRequiredDataForSystemTags` is active, the Artikel is tagged for batch and best-before date and both are missing. |
| 500 | ERROR: Best Before Date is required for the item Id {ItemId} | Setting `DFRequiredDataForSystemTags` is active and the Artikel requires a best-before date that is missing. |
| 500 | ERROR: Batch number is required for the item Id {ItemId} | Setting `DFRequiredDataForSystemTags` is active and the Artikel requires a batch number that is missing. |
| 500 | ERROR: Only positive values bigger than 1 are allowed! Sent value is {Qty} | `QTY` is less than 1. |
| 500 | ERROR: Value {Qty} is too big, MAX value allowed:{OriginalQty} | `QTY` is larger than the quantity of the orderline. |
| 500 | ERROR: Orderline was already processed. | The orderline is already in status `FUS` or in a final order state. |
| 500 | ERROR: Error Creating Reservation | Appended when creating the reservation for an orderline set to `BES` reports an error. |
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:pixiDFSetStatus>
<XML><![CDATA[<SETDFSTATUS><ITEM><ORDERHISTORYKEY>784512</ORDERHISTORYKEY><STATUS>FUS</STATUS><QTY>2</QTY><SHIPDATE>2024-05-14T10:30:00</SHIPDATE><TRACKINGID>00340434161094042557</TRACKINGID><INVOICENREXTERNAL>RE-2024-0815</INVOICENREXTERNAL><BATCHNUMBER>B2024-17</BATCHNUMBER><BESTBEFOREDATE>2025-12-31</BESTBEFOREDATE><SERIALNUMBER>SN-000123</SERIALNUMBER><ERROR></ERROR><ERRORMSG></ERRORMSG></ITEM></SETDFSTATUS>]]></XML>
<!-- <CreateInvoices>Y</CreateInvoices> -->
<!-- <SupplNr>L042</SupplNr> -->
<!-- <Secret>K7x9Pq2mZ4</Secret> -->
</ns1:pixiDFSetStatus>
</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:pixiDFSetStatus>
<XML><![CDATA[<SETDFSTATUS><ITEM><ORDERHISTORYKEY>784512</ORDERHISTORYKEY><STATUS>FUS</STATUS><QTY>2</QTY><SHIPDATE>2024-05-14T10:30:00</SHIPDATE><TRACKINGID>00340434161094042557</TRACKINGID><INVOICENREXTERNAL>RE-2024-0815</INVOICENREXTERNAL><BATCHNUMBER>B2024-17</BATCHNUMBER><BESTBEFOREDATE>2025-12-31</BESTBEFOREDATE><SERIALNUMBER>SN-000123</SERIALNUMBER><ERROR></ERROR><ERRORMSG></ERRORMSG></ITEM></SETDFSTATUS>]]></XML>
<!-- <CreateInvoices>Y</CreateInvoices> -->
<!-- <SupplNr>L042</SupplNr> -->
<!-- <Secret>K7x9Pq2mZ4</Secret> -->
</ns1:pixiDFSetStatus>
</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 = [
'XML' => '<SETDFSTATUS><ITEM><ORDERHISTORYKEY>784512</ORDERHISTORYKEY><STATUS>FUS</STATUS><QTY>2</QTY><SHIPDATE>2024-05-14T10:30:00</SHIPDATE><TRACKINGID>00340434161094042557</TRACKINGID><INVOICENREXTERNAL>RE-2024-0815</INVOICENREXTERNAL><BATCHNUMBER>B2024-17</BATCHNUMBER><BESTBEFOREDATE>2025-12-31</BESTBEFOREDATE><SERIALNUMBER>SN-000123</SERIALNUMBER><ERROR></ERROR><ERRORMSG></ERRORMSG></ITEM></SETDFSTATUS>',
// 'CreateInvoices' => 'Y',
// 'SupplNr' => 'L042',
// 'Secret' => 'K7x9Pq2mZ4',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDFSetStatus', $soapArguments);
- SQL object:
- dbo.pipiDFSetStatus