pixiDeleteDeliveryItem
Deletes one or more item lines from a supplier delivery, identified by delivery line key, internal item number or EAN.
Removes item lines (SDelDetail) from a supplier delivery (SDelHeader).
Identifying the delivery. Pass either SDelHKey or DeliveryNumber, which is matched against SDelHNr. If only DeliveryNumber is given, the first matching SDelHKey is used.
Identifying the lines. Pass at least one of SDelDKey, ItemNrInternal or EANUPC.
Validation, in this order:
- A delivery reference or number is present.
- An item identifier is present.
- The delivery is not locked by Picco (
LockedByPiccois NULL). - The
SDelDKeyexists inSDelDetail, if given. - The
EANUPCexists inItems, if given. - The
ItemNrInternalexists inItems(ItemNrInt), if given. - The delivery exists and its status is not
CLS(closed) orINV(invoiced).
If a check fails, the call raises an error and nothing is deleted.
Deletion.
- If
SDelDKeyis given, exactly that delivery line is deleted.ItemNrInternalandEANUPCare then ignored for the deletion. - Otherwise the call deletes all lines of the delivery whose item matches
ItemNrInternalorEANUPC. This can remove several lines.
The call returns no result set.
Notes
- Line key not checked against the delivery. When deleting by
SDelDKey, the code does not check that the line belongs to the given delivery. The status and lock checks apply to the delivery passed in, but the line with that key is deleted even if it belongs to another delivery. - Unknown delivery number gives a misleading error. If
DeliveryNumberdoes not match any delivery, the key stays NULL. The call then fails withYou cant delete items from closed or invoiced deliveries. - Item checks are global. The
EANUPCandItemNrInternalchecks only test that the item exists inItems. If the item exists but is not on the delivery, nothing is deleted and no error is raised. - Both identifiers match with OR. If both
ItemNrInternalandEANUPCare given withoutSDelDKey, lines matching either value are deleted. - Zero counts as empty. Empty values are converted to NULL. Because the integer parameters are compared with
'', the value0forSDelHKey,DeliveryNumberorSDelDKeyis also treated as not provided. - No transaction and loose lock read. The procedure does not use an explicit transaction. The lock flag
LockedByPiccois readWITH (NOLOCK). - Return code. On errors the procedure returns
-1afterRAISERRORwith severity 16.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SDelHKey
|
int | NULL |
Internal key of the supplier delivery ( Example: |
DeliveryNumber
|
int | NULL |
Delivery number ( Example: |
SDelDKey
|
int | NULL |
Key of the delivery line ( Example: |
ItemNrInternal
|
varchar(50) string |
NULL |
Internal item number ( Example: |
EANUPC
|
varchar(13) string |
NULL |
EAN/UPC of the item ( Example: |
This call returns no result set.
| Status | Message | Cause |
|---|---|---|
| RAISERROR | You must provide Delivery referenc or Delivery number. | Neither `SDelHKey` nor `DeliveryNumber` was given (or both are empty or 0). |
| RAISERROR | You must provide item EAN, SDelDKey or ItemNrInternal. | None of `EANUPC`, `SDelDKey` or `ItemNrInternal` was given. |
| RAISERROR | Delivery is locked by pico | The delivery is locked by Picco (`LockedByPicco` is set). Release the lock first. |
| RAISERROR | Item with SDelDKey {SDelDKey} does not exist. | The given `SDelDKey` does not exist in `SDelDetail`. |
| RAISERROR | Item with EANUPC {EANUPC} does not exist. | No item with the given `EANUPC` exists in `Items`. |
| RAISERROR | Item with ItemNrInternal {ItemNrInternal} does not exist. | No item with the given internal item number exists in `Items`. |
| RAISERROR | You cant delete items from closed or invoiced deliveries. | The delivery has status `CLS` or `INV`, or the delivery was not found (for example an unknown `DeliveryNumber`). |
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:pixiDeleteDeliveryItem>
<!-- <SDelHKey>1542</SDelHKey> -->
<!-- <DeliveryNumber>20345</DeliveryNumber> -->
<!-- <SDelDKey>88123</SDelDKey> -->
<!-- <ItemNrInternal>ART-10045</ItemNrInternal> -->
<!-- <EANUPC>4006381333931</EANUPC> -->
</ns1:pixiDeleteDeliveryItem>
</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:pixiDeleteDeliveryItem>
<!-- <SDelHKey>1542</SDelHKey> -->
<!-- <DeliveryNumber>20345</DeliveryNumber> -->
<!-- <SDelDKey>88123</SDelDKey> -->
<!-- <ItemNrInternal>ART-10045</ItemNrInternal> -->
<!-- <EANUPC>4006381333931</EANUPC> -->
</ns1:pixiDeleteDeliveryItem>
</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' => '1542',
// 'DeliveryNumber' => '20345',
// 'SDelDKey' => '88123',
// 'ItemNrInternal' => 'ART-10045',
// 'EANUPC' => '4006381333931',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDeleteDeliveryItem', $soapArguments);
- SQL object:
- dbo.pipiDeleteDeliveryItem