pixiBreakOrderline
Splits (breaks) an order line into two lines by moving a given quantity into a new order line, optionally with a new status.
Breaks an existing order line, identified by OrderlineKey, into two order lines. The call is a thin wrapper around the internal procedure GOSBreakOrderline. All parameters are passed through unchanged.
Steps:
GOSBreakOrderlineis executed withOrderlineKey,NewQty,NewStatus,InvlineRef,UserNameandBinRef. Its internal parametersTermID,LargeOrderToBreakandPLHKeykeep their defaults.GOSBreakOrderlineopens a transaction, or sets a savepoint if a transaction is already open. It takes an exclusive application lock namedOrderline_<OrderlineKey>with a 5-second timeout, then callsGOSBreakOrderline_Baseto do the actual split.- The inner procedure returns a row with
SuccessandNewOrderlineKey. The wrapper captures this row internally and does not pass it to the caller. - If the captured
Successvalue is not1, the call raises an error with severity 11.
On success the call returns no result set. The key of the newly created order line is not returned. Callers must find it afterwards, for example by reading the order lines of the order again.
Notes
- The split logic lives in
GOSBreakOrderline_Base, which is not attached. The exact meaning ofNewQty(quantity of the new line or of the remaining line), the valid values ofNewStatus, the effect ofInvlineRefandBinRef, and the tables changed cannot be derived from the available code. GOSBreakOrderlineuses an exclusive application lock per order line (sp_getapplock, 5-second timeout). Concurrent splits of the same line are serialized. If the lock cannot be obtained, the errorCould not obtain the lockis raised internally.- Errors inside
GOSBreakOrderlineare caught. The transaction is rolled back and the error is logged vialog.InsertError. Whether the original error then reaches the caller depends onlog.InsertError, which is not attached. - The result of the inner procedure is captured with
INSERT ... EXEC. AROLLBACKinside anINSERT ... EXECcan itself cause a SQL Server error, so failures may surface with a different message than expected. - Pitfall: if the inner procedure returns no row, the check on
Successevaluates to NULL. In that case no error is raised, even though nothing may have been split.
| Parameter | Type | Default | Description |
|---|---|---|---|
OrderlineKey
Required
|
integer int |
– |
Key of the order line to be split. Also used for the application lock name Example: |
NewQty
Required
|
integer int |
– |
Quantity used for the split. It is passed to Example: |
NewStatus
|
varchar(3) string |
– |
Optional order line status for the split-off line. An empty string means no explicit status is given. Valid values are checked in the inner procedure. Example: |
InvlineRef
|
int | 0 |
Optional reference to an invoice line, passed through to the split logic. Example: |
UserName
|
varchar(50) string |
NULL |
Name of the user performing the split, passed through to the split logic. Example: |
BinRef
|
int | NULL |
Optional reference to a bin location (Lagerplatz), passed through to the split logic. Example: |
This call returns no result set.
| Status | Message | Cause |
|---|---|---|
| RAISERROR | GOSBreakOrderline not successful in procedure: pipiBreakOrderline | The inner procedure `GOSBreakOrderline` reported `Success` other than 1, i.e. the order line could not be split. Check the order line key, the quantity and the status. |
| RAISERROR | Could not obtain the lock | Raised inside `GOSBreakOrderline` when the exclusive lock on the order line cannot be obtained within 5 seconds, for example because another process is splitting the same line. The error is caught and logged; whether it reaches the caller depends on `log.InsertError`. Retry later. |
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:pixiBreakOrderline>
<OrderlineKey>123456</OrderlineKey>
<NewQty>2</NewQty>
<!-- <NewStatus>AUF</NewStatus> -->
<!-- <InvlineRef>0</InvlineRef> -->
<!-- <UserName>shopsync</UserName> -->
<!-- <BinRef>4711</BinRef> -->
</ns1:pixiBreakOrderline>
</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:pixiBreakOrderline>
<OrderlineKey>123456</OrderlineKey>
<NewQty>2</NewQty>
<!-- <NewStatus>AUF</NewStatus> -->
<!-- <InvlineRef>0</InvlineRef> -->
<!-- <UserName>shopsync</UserName> -->
<!-- <BinRef>4711</BinRef> -->
</ns1:pixiBreakOrderline>
</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 = [
'OrderlineKey' => '123456',
'NewQty' => '2',
// 'NewStatus' => 'AUF',
// 'InvlineRef' => '0',
// 'UserName' => 'shopsync',
// 'BinRef' => '4711',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiBreakOrderline', $soapArguments);
- SQL object:
- dbo.pipiBreakOrderline