pixiCancelOrder
Cancels all open order lines of an order by setting their status to `STO` (cancelled) or `NLB` (not deliverable).
Sets the status of the order lines of the order OrderNr to the value of Status.
- If
Statusis empty orNULL,STOis used. - Only
STOandNLBare accepted. Any other value returns a row withErrorMessageand nothing is changed. - The call selects the order lines of the order that meet all of these conditions:
- the line's current status is not a final status (
OrderStates.FinalState = 'Y'); - no order line of the order is referenced in
BoxItems; - no order line of the order is referenced in
InvLines.
- the line's current status is not a final status (
- The selected lines get the new
Status.UpdateDateis set to the current time andUpdateEmptoAPI. - If at least one line was updated, the call returns a row with
SuccessfulMessage. If no line was updated, the call returns no result set; the procedure's return code is then1(on success it is0).
Notes
- Order-wide check: The comments in the code suggest a per-line check. However, the
BoxItemsandInvLinessubqueries are only correlated on the order number. If any line of the order is already in a box or on an invoice, no line is cancelled, not only that one line. - Lines in a final status are skipped. Calling the call again for an order that is already cancelled therefore usually returns no rows.
- If nothing was changed, no message is returned (e.g. unknown order, all lines final, lines boxed or invoiced). Callers should treat a missing
SuccessfulMessagerow as "not cancelled". - The selection reads with
NOLOCK; the update usesROWLOCK. There is no explicit transaction. - Only the order line statuses are changed. The order header and stock reservations are not touched directly by this procedure.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
Required
|
int | – |
Number of the order whose order lines are cancelled ( Example: |
Status
|
varchar(3) string |
STO |
New status for the order lines. Empty or Allowed values
Example: |
Result set 1 · If Status is not STO or NLB
Error row for an invalid status value.
| Column | Type | Description |
|---|---|---|
ErrorMessage
|
varchar(30) string |
Fixed text |
Result set 2 · If at least one order line was updated
Success row.
| Column | Type | Description |
|---|---|---|
SuccessfulMessage
|
varchar(31) string |
Fixed text |
Response example
<SqlRowSet1>
<row>
<SuccessfulMessage>Order was successfully canceled</SuccessfulMessage>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | Only status STO or NLB allowed | `Status` contains a value other than `STO` or `NLB`. Send `STO`, `NLB` or leave the parameter out. |
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:pixiCancelOrder>
<OrderNr>123456</OrderNr>
<!-- <Status>STO</Status> -->
</ns1:pixiCancelOrder>
</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:pixiCancelOrder>
<OrderNr>123456</OrderNr>
<!-- <Status>STO</Status> -->
</ns1:pixiCancelOrder>
</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 = [
'OrderNr' => '123456',
// 'Status' => 'STO',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCancelOrder', $soapArguments);
- SQL object:
- dbo.pipiCancelOrder