pixiSetOrderlinesInBoxToAUS
Ships out an order that sits alone in exactly one box: sets its boxed orderlines to status AUS and empties the box.
Performs the ship-out (scan-out) of an order that has been collected in a box and empties the box.
Steps:
- Collects all boxes that contain orderlines of
OrderNr(viaboxitems) and every order that is in these boxes. - Checks that at least one of the settings
Premium_APIorCentralized_Ship_Outis enabled. Otherwise an error is returned. - Checks that the order is in exactly one box. If no box is found, or the order is spread over several boxes, an error is returned.
- Checks that the box contains no other order. If it does, an error is returned.
- Reads the shipping address of the box (
boxes.SAddrRef) and checks the shipping lock. The customer flagCustomers.SLockedand the address flagAddresses.ASLockedare checked. If either isY, an error is returned. - If all checks pass, three internal procedures run:
GOSScanOutOrderlinewith statusAUS. It sets the orderlines in the box with statusEINtoAUS. It also sets orderlines of the same invoices that have statusMIN, or a status listed in the settingPutThisStatusesOnInvoice, toAUS. For these lines it setsShipDate, updates the order header status, writes order history, deletes reservations, updates bundle lines and closes related return case lines and return cases.GOSDeleteAllItemsForBoxremoves allboxitemsof the box.GOSEmptyBoxresets the box: customer, addresses and order are set to 0,BoxEndDateis set to now, and the wait and lock flags are reset.
The call always returns one row with Status (SUCCESS or ERROR) and Info. UserName is stored as the updating employee on the changed records.
Notes
- All work runs in the named transaction
OrderToAUS. On an error in the main procedure the transaction is rolled back. The returned row then hasStatus=ERRORand the SQL error text inInfo.Infois truncated to 150 characters. - The called
GOS…procedures catch their own errors and log them vialog.InsertErrorwithout re-raising them. A failure inside them can therefore be rolled back (completely or to a savepoint) while the call still reportsSUCCESS. Check the data if in doubt. - The box and order counts are taken from grouped queries. The value of the last processed group is used. In mixed cases (for example several boxes that hold several orders), the specific error message returned may vary. The call is still rejected as long as the order is not alone in a single box.
- Reads use
NOLOCK. Updates in the sub-procedures useROWLOCK.GOSScanOutOrderlinesuppresses theOrderlinesupdate trigger viaCONTEXT_INFOand writesOrderHistoryitself. - Validation errors still end with a commit, but nothing has been written at that point.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderNr
Required
|
int | – |
Number of the order whose box is to be shipped out and emptied. Example: |
UserName
|
varchar(50) string |
API |
User name stored as the updating employee on orderlines, history and return cases. Example: |
Result set 1 · Always
One status row with the result of the call.
| Column | Type | Description |
|---|---|---|
Status
|
varchar(50) string |
|
Info
Nullable |
varchar(150) string |
Success message or error text. |
Response example
<SqlRowSet1>
<row>
<Status>SUCCESS</Status>
<Info>Box: 17 was emptied. Order: 104523 was set to status AUS.</Info>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| ERROR | Setting "Centralized_Ship_Out" or "Premium_API" is not enabled. | Neither the setting `Centralized_Ship_Out` nor `Premium_API` is enabled. Enable one of them. |
| ERROR | No box exists for order: {OrderNr} | No orderline of the order is in a box. |
| ERROR | More than 1 box found for order: {OrderNr} | The order is spread over several boxes. Consolidate it into one box first. |
| ERROR | There is more than 1 order in the box: {BoxNr} | The box also contains orderlines of other orders. |
| ERROR | Customer has SHIPPING LOCK flag set! | The customer of the box's shipping address has `SLocked` = `Y`. Remove the shipping lock first. |
| ERROR | Order has SHIPPING LOCK flag set! | The shipping address of the box has `ASLocked` = `Y`. Remove the shipping lock first. |
| ERROR | {ERROR_MESSAGE()} | An SQL error occurred in the main procedure. The transaction was rolled back. |
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:pixiSetOrderlinesInBoxToAUS>
<OrderNr>104523</OrderNr>
<!-- <UserName>WarehouseApp</UserName> -->
</ns1:pixiSetOrderlinesInBoxToAUS>
</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:pixiSetOrderlinesInBoxToAUS>
<OrderNr>104523</OrderNr>
<!-- <UserName>WarehouseApp</UserName> -->
</ns1:pixiSetOrderlinesInBoxToAUS>
</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' => '104523',
// 'UserName' => 'WarehouseApp',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiSetOrderlinesInBoxToAUS', $soapArguments);
- SQL object:
- dbo.pipiSetOrderlinesInBoxToAUS