pixiUpdateDelivery
Updates the header of a supplier delivery (note, external numbers, status, Picco/Mobix lock) by delivery ID or delivery number.
Updates one record in SDelHeader (supplier delivery header) and always returns exactly one row with the column ReturnMSG.
Identifying the delivery
SDelHkeyandDeliveryNumberare treated as missing when they are0. At least one of them is required.- If
SDelHkeyis given, it is used andDeliveryNumberis ignored. - Otherwise the delivery with
SDelHNr = DeliveryNumberand the lowest key is used.
Validation
Statusmust beNEW,INVorCLS, or be left out (NULL), which keeps the current status. An empty string is rejected.- If
ExternalReceiptNris given, no other delivery of the same Lieferant may already carry this external receipt number. - Without
PiccoUser: the delivery must exist and must not be locked by Picco (LockedByPiccois notY). - With
PiccoUser(Mobix/Picco client): the delivery must exist and either be assigned to thisPiccoUseror not be locked by Picco.
Field handling
Note,extInvoiceNrandextOrderNrare trimmed. Empty or missing values keep the value already stored.ExternalReceiptNrandStatus: missing or empty values keep the stored value.UserNamedefaults toAPIand is stored as the last updating user; the update date is set to the current time.- Picco information is always rewritten:
- Without
PiccoUser, the delivery'sPiccoUserandLockedByPiccoare cleared. - With
PiccoUser, the user is stored andLockedByPiccois set toYifLockDelivery = 1. IfStatus = CLS, both the Picco user and the lock are cleared.
- Without
SupplNris obsolete. The supplier is never changed.
If the status actually changes, a delivery-status-changed event is published.
Notes
Note,extInvoiceNr,extOrderNrandExternalReceiptNrcannot be cleared with this call. Empty values keep the existing content.extOrderNris declared asvarchar(8000), but the internal update procedure accepts onlyvarchar(1000). Longer values are truncated.- A call without
PiccoUserremoves an existing Picco user assignment from the delivery. - For a delivery locked by Picco, a call without
PiccoUserfails withDelivery header does not exist, even though the delivery exists. - If
DeliveryNumbermatches no delivery, the same message is returned. - The procedure returns
-1as its return value on errors. Errors are reported only as aReturnMSGrow, not as SQL errors. - Existence checks read
SDelHeaderwithNOLOCK. No explicit transaction is used. - On a status change,
pixi_MQ_DeliveryStatusChanged_EventPublishis executed. Its definition is not attached, so the details of the published message are unknown. - The exact business meaning of the status
INVis not visible in the code.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SDelHkey
|
int | NULL |
Internal key of the delivery ( Example: |
SupplNr
|
varchar(4) string |
NULL |
Obsolete. Ignored; the Lieferant of the delivery is read from the header and never changed. |
DeliveryNumber
|
int | NULL |
Delivery number ( Example: |
Note
|
varchar(8000) string |
NULL |
New note of the delivery. Trimmed; empty or missing keeps the stored note. Example: |
extInvoiceNr
|
varchar(25) string |
NULL |
External invoice number of the Lieferant. Trimmed; empty or missing keeps the stored value. Example: |
extOrderNr
|
varchar(8000) string |
NULL |
External order number(s). Trimmed; empty or missing keeps the stored value. Effectively limited to 1000 characters. Example: |
UserName
|
varchar(50) string |
NULL |
User stored as last editor. Defaults to Example: |
PiccoUser
|
varchar(59) string |
NULL |
Picco/Mobix user working on the delivery. Empty is treated as not given. If not given, the Picco assignment and lock are cleared. Example: |
Status
|
varchar(3) string |
NULL |
New delivery status. Missing keeps the current status; an empty string is rejected. Allowed values
Example: |
LockDelivery
|
bit boolean |
0 |
Only with Allowed values
Example: |
ExternalReceiptNr
|
varchar(50) string |
NULL |
External receipt number. Must be unique per Lieferant; empty or missing keeps the stored value. Example: |
Result set 1 · Always (one row; success or error message)
Status message of the call.
| Column | Type | Description |
|---|---|---|
ReturnMSG
|
varchar string |
|
Response example
<SqlRowSet1>
<row>
<ReturnMSG>Update successful</ReturnMSG>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| -1 | Delivery ID or Delivery number must be provided. | Neither `SDelHkey` nor `DeliveryNumber` was given (or both are 0). |
| -1 | Wrong status code provided. | `Status` is not `NEW`, `INV` or `CLS` (including an empty string). Omit the parameter to keep the status. |
| -1 | For given External Receipt Number already exists an delivery. | Another delivery of the same Lieferant already has this `ExternalReceiptNr`. |
| -1 | Delivery header does not exist | No delivery found for the key or number. Also returned without `PiccoUser` if the delivery is locked by Picco, and with `PiccoUser` if the delivery is locked by a different Picco user. |
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:pixiUpdateDelivery>
<!-- <SDelHkey>15872</SDelHkey> -->
<!-- <SupplNr>?</SupplNr> -->
<!-- <DeliveryNumber>4711</DeliveryNumber> -->
<!-- <Note>Pallet damaged on arrival</Note> -->
<!-- <extInvoiceNr>RE-2024-00815</extInvoiceNr> -->
<!-- <extOrderNr>PO-55102</extOrderNr> -->
<!-- <UserName>shopsync</UserName> -->
<!-- <PiccoUser>mobix01</PiccoUser> -->
<!-- <Status>CLS</Status> -->
<!-- <LockDelivery>1</LockDelivery> -->
<!-- <ExternalReceiptNr>WE-778812</ExternalReceiptNr> -->
</ns1:pixiUpdateDelivery>
</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:pixiUpdateDelivery>
<!-- <SDelHkey>15872</SDelHkey> -->
<!-- <SupplNr>?</SupplNr> -->
<!-- <DeliveryNumber>4711</DeliveryNumber> -->
<!-- <Note>Pallet damaged on arrival</Note> -->
<!-- <extInvoiceNr>RE-2024-00815</extInvoiceNr> -->
<!-- <extOrderNr>PO-55102</extOrderNr> -->
<!-- <UserName>shopsync</UserName> -->
<!-- <PiccoUser>mobix01</PiccoUser> -->
<!-- <Status>CLS</Status> -->
<!-- <LockDelivery>1</LockDelivery> -->
<!-- <ExternalReceiptNr>WE-778812</ExternalReceiptNr> -->
</ns1:pixiUpdateDelivery>
</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 = [
// 'SDelHkey' => '15872',
// 'SupplNr' => '?',
// 'DeliveryNumber' => '4711',
// 'Note' => 'Pallet damaged on arrival',
// 'extInvoiceNr' => 'RE-2024-00815',
// 'extOrderNr' => 'PO-55102',
// 'UserName' => 'shopsync',
// 'PiccoUser' => 'mobix01',
// 'Status' => 'CLS',
// 'LockDelivery' => '1',
// 'ExternalReceiptNr' => 'WE-778812',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiUpdateDelivery', $soapArguments);
- SQL object:
- dbo.pipiUpdateDelivery