pixiDeleteDelivery
Deletes a supplier delivery (delivery header and lines) with status NEW, identified by delivery reference or delivery number.
Deletes a supplier delivery from SDelHeader together with its lines in SDelDetail.
- At least one of
SDelHkeyorDeliveryNumbermust be given; otherwise an error is raised and the procedure returns-1. - If only
DeliveryNumberis given, the delivery key is looked up inSDelHeaderbySDelHNr(first match, no defined order). IfSDelHkeyis given, it is used andDeliveryNumberis ignored; the two values are not checked against each other. - The delivery is only deleted if it
- is not locked by Picco (
LockedByPiccois notY), or is locked by Picco for the same user passed inPiccoUser, and - has status
NULLorNEW.
- is not locked by Picco (
- If these conditions are met, the internal delete routine runs:
- all delivery lines (
SDelDetail) of the delivery are deleted, - entries in
InvBinItemLog_In_Pricethat reference the delivery (viaDeliveryIdorDeliveryId_Assigned) are unlinked: delivery references andSupplierIdare set toNULL,Priceto0,QuerySourceto7andRecordModifiedOnto the current time, - the delivery header (
SDelHeader) is deleted. The call then returns the rowReturnMSG=Deleting was successfull.
- all delivery lines (
- Otherwise the row
ReturnMSG=Delivery Header does not existsis returned.
Notes
- The check for missing values uses
ISNULL(..., ''); forintparameters the value0is treated the same as "not provided". - The message
Delivery Header does not existsis also returned when the delivery exists but is locked by Picco for another user or has a status other thanNULL/NEW. - The pre-check accepts status
NULL, but the internal delete routine only deletes deliveries with status exactlyNEW. For a delivery with statusNULLnothing is deleted, yetDeleting was successfullis returned. - The internal delete runs in its own transaction (or a savepoint if a transaction is already open). Errors are caught, rolled back and written to the error log via
log.InsertError; they are not passed to the caller, and the success message is returned anyway. Verify the result if needed. - The delivery and its lines are read with
NOLOCKbefore deletion; the deletes and updates useROWLOCK. - When looking up by
DeliveryNumber, duplicate numbers lead to an arbitrary delivery being chosen.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
SDelHkey
|
int | NULL |
Internal key of the supplier delivery ( Example: |
DeliveryNumber
|
int | NULL |
Delivery number ( Example: |
PiccoUser
|
varchar(50) string |
NULL |
Picco user name. A delivery locked by Picco can only be deleted if this value equals the user stored in Example: |
Result set 1 · Always, unless the error for missing delivery reference and number is raised.
One status row with the result message.
| Column | Type | Description |
|---|---|---|
ReturnMSG
|
varchar(31) string |
|
Response example
<SqlRowSet1>
<row>
<ReturnMSG>Deleting was successfull</ReturnMSG>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| RAISERROR | You must provide Delivery referenc or Delivery number. | Neither `SDelHkey` nor `DeliveryNumber` was given (or both are `0`). Pass at least one of them. |
| ReturnMSG | Delivery Header does not exists | No delivery with the given key/number exists, or it is locked by Picco for a different user, or its status is neither `NULL` nor `NEW`. |
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:pixiDeleteDelivery>
<!-- <SDelHkey>15872</SDelHkey> -->
<!-- <DeliveryNumber>40213</DeliveryNumber> -->
<!-- <PiccoUser>lager01</PiccoUser> -->
</ns1:pixiDeleteDelivery>
</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:pixiDeleteDelivery>
<!-- <SDelHkey>15872</SDelHkey> -->
<!-- <DeliveryNumber>40213</DeliveryNumber> -->
<!-- <PiccoUser>lager01</PiccoUser> -->
</ns1:pixiDeleteDelivery>
</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',
// 'DeliveryNumber' => '40213',
// 'PiccoUser' => 'lager01',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDeleteDelivery', $soapArguments);
- SQL object:
- dbo.pipiDeleteDelivery