pixiCanAddOrderlines
Checks whether new order lines may still be added to an order, based on the payment type and the status of its existing order lines.
Determines for the order PixiOrderNr whether further order lines can be added. It sets the output parameter CanAdd, optionally returns a status row and also uses the value as the procedure return value.
The order header (OrderHeader) is joined to its address (Addresses, via AddrRef). The decision depends on the payment type column APayment:
- Payment type other than
KorC:CanAdd = 1if the order has no order lines with statusEINorAUS. Otherwise0. - Payment type
KorC:CanAdd = 1only if all order lines of the order have one of the statusesNEW,ANG,HAL,MIN,OPH,BES,STO,NLB. As soon as one line has a different status, the result is0. - An order without any order lines therefore always returns
1, provided the payment type is set. - If
APaymentisNULL, neither condition is met and the result is0.
If SupressOutput = 0 (default), one row with CanAdd, OrderNr and ErrorMessage (always NULL) is returned. With SupressOutput = 1 no result set is returned and only the output parameter and the return value carry the result.
Notes
- All reads use
NOLOCK, so the result can reflect uncommitted changes. - If the order does not exist (or has no matching address record), no value is assigned:
CanAddkeeps the value the caller passed in (typicallyNULL), and the returned row shows that value. No error message is produced;ErrorMessageis alwaysNULL. Treat aNULLCanAddas "order not found". CanAddis declared asOUTPUTwithout a default, so it must be sent in the request (e.g. empty or0).- The column
APaymentis referenced without a table alias; it is resolved fromOrderHeaderorAddresses. The meaning of the payment typesKandCis not defined in the code. - Order lines with a
NULLstatus are not counted in the check for payment typesK/C. - The procedure does not change any data.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
PixiOrderNr
Required
|
int | – |
Pixi order number ( Example: |
CanAdd
OUTPUT
|
bit boolean |
– |
Output: Allowed values
Example: |
SupressOutput
|
bit boolean |
0 |
Controls whether the result row is returned. Allowed values
Example: |
Response
Result set 1 · If SupressOutput = 0 (default)
One row with the check result for the order.
| Column | Type | Description |
|---|---|---|
CanAdd
Nullable |
bit boolean |
|
OrderNr
|
int |
The checked order number (echo of |
ErrorMessage
Nullable |
int string |
Always |
Response example
<SqlRowSet1>
<row>
<CanAdd>1</CanAdd>
<OrderNr>104523</OrderNr>
</row>
</SqlRowSet1>
Examples
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:pixiCanAddOrderlines>
<PixiOrderNr>104523</PixiOrderNr>
<!-- <CanAdd>0</CanAdd> -->
<!-- <SupressOutput>0</SupressOutput> -->
</ns1:pixiCanAddOrderlines>
</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:pixiCanAddOrderlines>
<PixiOrderNr>104523</PixiOrderNr>
<!-- <CanAdd>0</CanAdd> -->
<!-- <SupressOutput>0</SupressOutput> -->
</ns1:pixiCanAddOrderlines>
</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 = [
'PixiOrderNr' => '104523',
// 'CanAdd' => '0',
// 'SupressOutput' => '0',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiCanAddOrderlines', $soapArguments);
Tables used
- SQL object:
- dbo.pipiCanAddOrderlines