pixiDFUpdateOrderlineStatus
Sets the direct-fulfillment status of an orderline for an authenticated supplier, optionally with ship date, tracking ID, invoice number, partial quantity and batch data.
API call for direct-fulfillment suppliers to report the processing state of an orderline back to Pixi.
1. Authentication
- The supplier is looked up in
SuppliersbySupplNr;Secretmust match the supplier'sCustNr, the supplier must not be disabled and must haveCanDoDirectFulfillment = 1. - If no supplier matches and the setting
DFAPIAllowFullAccessWithoutSecretis0(or missing), a single row withError = '403'is returned and nothing is changed. - If that setting is not
0, the call continues even with a wrong secret.
2. Finding the orderline
- If
OrderlineRefis less than 1 (default), the orderline key is read fromOrderHistoryusingOrderHistoryKey. - Empty strings in
BatchNumber,BestBeforeDateandSerialNumberare treated as NULL.
3. Validation (done by the internal procedure Pixi_UpdateOrderlineDFStatusByOrderlineKey). The update is rejected if:
- the orderline does not exist;
- the setting
DFRequiredDataForSystemTagsis active and the item carries the system tag for batch number (tag-6) and/or best-before date (tag-7) but the corresponding value is not sent; Qtyis less than 1 or greater than the current orderline quantity;- the orderline already has status
FUSor a status marked as final inOrderStates.
4. Update
- If
Qtyis smaller than the current quantity, the orderline is split first: the original line keepsQty, a new line with the remaining quantity is created with the old status. - The new status is derived from
Status:STOandNLBare taken over as they are; any other value results inFUSfor DF type 1, 3 or no DF type, otherwiseBES. - The orderline gets the new status,
DFShipDate,DFShipmentTrackingID(fromDFTrackingID),InvoiceNrExternal, batch number, best-before date, serial number,UpdateDateandUpdateEmp = 'DF API'. - If the resulting status is
BES, a reservation is created for the whole order.
5. Response
One row with Error (200 or 500) and ErrorMsg. 500 is returned if the message contains the word error. On success ErrorMsg is empty or contains the split info. Each call that passes authentication writes a line to LogTable.
Notes
- The call does not check that the orderline belongs to the authenticated supplier; any orderline key can be addressed.
DFShipDate,DFTrackingIDandInvoiceNrExternalare always written; omitting them overwrites existing values with NULL.BatchNumber,BestBeforeDateandSerialNumberkeep their existing values when not sent.- Validation messages overwrite each other; only the last failing check is reported.
- The detection of errors relies on
CHARINDEX('error', ErrorMsg); this works for the upper-caseERROR:messages only with a case-insensitive database collation. - Runtime exceptions inside the update are caught, rolled back and logged via
log.InsertError, but they do not changeErrorMsg; the response can therefore be200with an empty or INFO message although nothing was saved. Check the orderline afterwards if in doubt. - The check for a failed reservation (
ERROR: Error Creating Reservation) reads@@ERRORafter aSETstatement and is therefore practically never triggered. - The work runs in its own transaction or savepoint if called inside an existing transaction. Lookups use
NOLOCK. - The behaviour of
GOSBreakOrderline,Pixi_Res_CreateReservationForOrder,dbo.SettingGetandlog.InsertErroris not visible here; further tables may be written by them. - A best-before date of
1900-01-01is treated like an empty value because of the comparison with''.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SupplNr
Required
|
varchar(4) string |
– |
Supplier number of the direct-fulfillment supplier. Example: |
Secret
Required
|
varchar(20) string |
– |
Secret of the supplier; must match the Example: |
Status
Required
|
varchar(3) string |
– |
Requested status. Allowed values
Example: |
OrderHistoryKey
|
int | 0 |
Key of the Example: |
DFShipDate
|
datetime dateTime |
NULL |
Ship date reported by the supplier; stored in Example: |
DFTrackingID
|
varchar(100) string |
NULL |
Shipment tracking ID; stored in Example: |
Qty
|
int | NULL |
Processed quantity. Must be between 1 and the current orderline quantity; a smaller value splits the orderline. NULL keeps the full quantity. Example: |
InvoiceNrExternal
|
varchar(20) string |
NULL |
Invoice number of the supplier; stored in Example: |
OrderlineRef
|
int | 0 |
Key of the orderline ( Example: |
BatchNumber
|
varchar(50) string |
NULL |
Batch number (Charge). Required if the item has the batch system tag and Example: |
BestBeforeDate
|
datetime dateTime |
NULL |
Best-before date. Required if the item has the best-before system tag and Example: |
SerialNumber
|
varchar(50) string |
NULL |
Serial number; stored in Example: |
Result set 1 · Always; exactly one row (either the 403 authorization row or the result of the update).
Status row of the call.
| Column | Type | Description |
|---|---|---|
Error
|
varchar(3) string |
|
ErrorMsg
Nullable |
varchar(200) string |
Error message, split info ( |
Response example
<SqlRowSet1>
<row>
<Error>200</Error>
<ErrorMsg>INFO: Split Orderline - Updated Qty: 2, New Orderline Qty:1</ErrorMsg>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| 403 | Not Authorized. Secret or SupplNr is incorrect. | No active supplier with direct fulfillment matches `SupplNr` and `Secret`, and `DFAPIAllowFullAccessWithoutSecret` is `0`. Check supplier number, secret and the supplier's DF flag. |
| 500 | ERROR: Orderline not existing | No orderline found for `OrderlineRef` or for the orderline referenced by `OrderHistoryKey`. |
| 500 | ERROR: Batch number and Best Before Date are required for the item Id {ItemId} | `DFRequiredDataForSystemTags` is active, the item has both batch and best-before system tags, and neither `BatchNumber` nor `BestBeforeDate` was sent. |
| 500 | ERROR: Best Before Date is required for the item Id {ItemId} | `DFRequiredDataForSystemTags` is active, the item has the best-before system tag and `BestBeforeDate` is missing. |
| 500 | ERROR: Batch number is required for the item Id {ItemId} | `DFRequiredDataForSystemTags` is active, the item has the batch system tag and `BatchNumber` is missing. |
| 500 | ERROR: Only positive values bigger than 1 are allowed! Sent value is {Qty} | `Qty` is less than 1. Send a positive quantity or omit the parameter. |
| 500 | ERROR: Value {Qty} is too big, MAX value allowed:{OriginalQty} | `Qty` is greater than the current quantity of the orderline. Note the leading space in the message. |
| 500 | ERROR: Orderline was already processed. | The orderline already has status `FUS` or a final status according to `OrderStates`; it cannot be updated again. |
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:pixiDFUpdateOrderlineStatus>
<SupplNr>L001</SupplNr>
<Secret>K4711</Secret>
<Status>FUS</Status>
<!-- <OrderHistoryKey>123456</OrderHistoryKey> -->
<!-- <DFShipDate>2024-05-14T10:30:00</DFShipDate> -->
<!-- <DFTrackingID>00340434161234567890</DFTrackingID> -->
<!-- <Qty>2</Qty> -->
<!-- <InvoiceNrExternal>RE-2024-0815</InvoiceNrExternal> -->
<!-- <OrderlineRef>987654</OrderlineRef> -->
<!-- <BatchNumber>CH-2024-17</BatchNumber> -->
<!-- <BestBeforeDate>2025-12-31T00:00:00</BestBeforeDate> -->
<!-- <SerialNumber>SN123456789</SerialNumber> -->
</ns1:pixiDFUpdateOrderlineStatus>
</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:pixiDFUpdateOrderlineStatus>
<SupplNr>L001</SupplNr>
<Secret>K4711</Secret>
<Status>FUS</Status>
<!-- <OrderHistoryKey>123456</OrderHistoryKey> -->
<!-- <DFShipDate>2024-05-14T10:30:00</DFShipDate> -->
<!-- <DFTrackingID>00340434161234567890</DFTrackingID> -->
<!-- <Qty>2</Qty> -->
<!-- <InvoiceNrExternal>RE-2024-0815</InvoiceNrExternal> -->
<!-- <OrderlineRef>987654</OrderlineRef> -->
<!-- <BatchNumber>CH-2024-17</BatchNumber> -->
<!-- <BestBeforeDate>2025-12-31T00:00:00</BestBeforeDate> -->
<!-- <SerialNumber>SN123456789</SerialNumber> -->
</ns1:pixiDFUpdateOrderlineStatus>
</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 = [
'SupplNr' => 'L001',
'Secret' => 'K4711',
'Status' => 'FUS',
// 'OrderHistoryKey' => '123456',
// 'DFShipDate' => '2024-05-14T10:30:00',
// 'DFTrackingID' => '00340434161234567890',
// 'Qty' => '2',
// 'InvoiceNrExternal' => 'RE-2024-0815',
// 'OrderlineRef' => '987654',
// 'BatchNumber' => 'CH-2024-17',
// 'BestBeforeDate' => '2025-12-31T00:00:00',
// 'SerialNumber' => 'SN123456789',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDFUpdateOrderlineStatus', $soapArguments);
- SQL object:
- dbo.pipiDFUpdateOrderlineStatus