pixiDeleteItemSupplier
Deletes the supplier assignment (AddItems record) of an Artikel for a given Lieferant, provided no open supplier orders exist for it.
Removes exactly one item-supplier record from AddItems.
ItemKey=0is treated asNULL, an emptyItemNrIntasNULL.- Candidate items are all rows in
ItemswhereItemNrInt=@ItemNrIntorItemKey=@ItemKeyorEANUPC=@EAN. The criteria are combined with OR, so several items can become candidates. - In
AddItems, the records of these candidate items are searched that belong to@SupplNr. If@EANis given, theEanUpcof theAddItemsrecord must also match. - If no record is found, the error No records found with provided parameters. is returned. If more than one record is found, the error Item could not be uniquely identified. is returned. In both cases nothing is changed.
- If any candidate item appears on a supplier order of this Lieferant whose status is flagged as open (
IsAllOpen= 1, e.g. NEW, BES, CON), an error is returned and nothing is deleted. - Otherwise the
AddItemsrecord is deleted inside a transaction (or a savepoint if the caller already has an open transaction). - If
@EANwas given, the item's main barcode inItems.EanUpcequals@EAN, and noAddItemsrecord of the candidate items carries that EAN anymore,Items.EanUpcis replaced by theEanUpcof one of the remainingAddItemsrecords of the item. Records of suppliers other thanMGSare preferred. - A single status row with
STATUSandMESSAGEis returned.
Notes
- All lookups use
NOLOCK, so the uniqueness and open-order checks can see uncommitted data. - Because the item criteria are combined with OR, passing several identifiers that point to different items widens the candidate set. The open supplier order check and the barcode update apply to all candidate items, not only to the item whose
AddItemsrecord was deleted. - If no
AddItemsrecord remains for an item when the barcode is replaced,Items.EanUpcis set toNULL. - An empty string for
EANis not converted toNULL; it is used as a filter value. - The success message only contains
ItemNrIntif it was passed; when calling withItemKeyorEANonly, that part is empty. - The success row is produced before the temporary tables are dropped via
util.TempTableDrop(not attached) and before the commit. If an error occurs at that point, an additional error row may follow. - Errors inside the delete/update block are caught, the transaction (or savepoint) is rolled back and an
Errorrow is returned instead of a SQL error.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
ItemKey
|
int | NULL |
Internal key of the Artikel. Example: |
ItemNrInt
|
varchar(50) string |
NULL |
Internal item number of the Artikel. An empty string is treated as not set. Example: |
SupplNr
Required
|
varchar(4) string |
– |
Supplier number of the Lieferant whose assignment is deleted. Example: |
EAN
|
varchar(13) string |
NULL |
EAN/UPC barcode. Used to find the Artikel via Example: |
Result set 1 · Always; exactly one status row (success or error).
Status row describing the outcome of the call.
| Column | Type | Description |
|---|---|---|
STATUS
|
varchar(7) string |
|
MESSAGE
Nullable |
varchar(max) string |
Success or error text. |
Response example
<SqlRowSet1>
<row>
<STATUS>Success</STATUS>
<MESSAGE>Item with ItemNrInt: ART-10045 and SupplNr: ABC was deleted.</MESSAGE>
</row>
</SqlRowSet1>
| Status | Message | Cause |
|---|---|---|
| Error | No records found with provided parameters. | No `AddItems` record matches the given item identifiers, `SupplNr` and (if set) `EAN`. Check the identifiers and supplier number. |
| Error | Item could not be uniquely identified. | More than one `AddItems` record matches, e.g. because the identifiers point to different items or the item has several records for this supplier. Narrow the search, for example by passing `EAN` or only `ItemKey`. |
| Error | Open supplier orders were found connected to the item. Item supplier can not be deleted. | A candidate item is on a supplier order of this Lieferant with an open status (`IsAllOpen` = 1). Close or complete the supplier orders first. |
| Error | Unexpected error: "{error message}" | A SQL error occurred while deleting the record or updating the barcode; all changes of the call were 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:pixiDeleteItemSupplier>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <ItemNrInt>ART-10045</ItemNrInt> -->
<SupplNr>ABC</SupplNr>
<!-- <EAN>4006381333931</EAN> -->
</ns1:pixiDeleteItemSupplier>
</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:pixiDeleteItemSupplier>
<!-- <ItemKey>12345</ItemKey> -->
<!-- <ItemNrInt>ART-10045</ItemNrInt> -->
<SupplNr>ABC</SupplNr>
<!-- <EAN>4006381333931</EAN> -->
</ns1:pixiDeleteItemSupplier>
</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 = [
// 'ItemKey' => '12345',
// 'ItemNrInt' => 'ART-10045',
'SupplNr' => 'ABC',
// 'EAN' => '4006381333931',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiDeleteItemSupplier', $soapArguments);
- SQL object:
- dbo.pipiDeleteItemSupplier