pixiGetSOrders
Returns supplier orders (purchase orders) of one location, filtered by status, overdue/missing delivery dates, status change date and external order numbers.
Returns supplier orders from pixi.SupplierOrder together with supplier, status, location, creating/modifying user and the related goods receipts. The statement is built as dynamic SQL and executed with sp_executesql.
Filters
- Only orders whose delivery location has
LocID=LocationID(default001). - At most
RLimitrows are returned (TOP (@RLimit)). The default0returns no rows, so a positive value must be passed. - Status filter:
- If
ShowDueDateandShowNoDateare both0, the flags are combined with OR:ShowNew→ status flagIsNew,ShowOrd→IsOrdered,ShowCon→IsConfirmed,ShowCls→IsClosed. - If
ShowNoDate=1, only ordered orders (IsOrdered) with at least one order line without an estimated delivery date are returned. This takes precedence overShowDueDate. - If
ShowDueDate=1(andShowNoDate=0), only ordered orders with at least one line whose estimated delivery date is earlier than now are returned. - In both date modes the flags
ShowNew,ShowOrd,ShowConandShowClsare ignored. - If all six flags are
0, no status filter is applied.
- If
- Status change date: if
StatusChangeDateFromand/orStatusChangeDateTois set, only orders whose latest audit entry inhist.pixi_SupplierOrder(MAX(AuditDate)) lies in the range>= Fromand< Toare returned. - External order numbers: if
ExtOrderNrsis set (an XML list), only orders whoseExternalCodematches one of the listed numbers are returned.
Goods receipts
For each goods receipt in SDelHeader, the field SDelHextOrderNr is split at ;. Numeric parts are matched to the order's InternalNumber. The goods receipt numbers (SDelHNr) are returned in GoodsReceipts as a list separated by ; .
Rows are sorted by OrderDate descending.
Notes
- Pitfall
RLimit: the default0leads toTOP (0)and an empty result. There is no "unlimited" value. - Pitfall status change date: if only
StatusChangeDateFromis passed, the upper bound falls back toMAX(AuditDate). The conditionMAX(AuditDate) < MAX(AuditDate)is never true, so no orders are returned. PassStatusChangeDateToas well, or onlyStatusChangeDateTo. The upper bound is exclusive. NULLvalues for the flags,LocationIDandRLimitare replaced by their defaults. An empty or whitespace-onlyExtOrderNrsis treated asNULL.ExtOrderNrsis parsed element-centric withOPENXMLat path/ExtOrders/ExtOrder, reading the child elementExtOrderNr. The XML document is not released withsp_xml_removedocument.- All tables are read with
NOLOCK, so uncommitted data can appear. - Orders are joined with
INNER JOINto supplier, status, location and toucs_usersfor both the creating and the modifying user. Orders without a matching record are not returned. GoodsReceiptsis built with avarchar(100)conversion, so long lists are truncated. The goods receipt list is computed over the wholeSDelHeadertable on every call, which can be slow on large databases.RecordBatchNrandPixiOrderCreatedare alwaysNULL. They are kept for compatibility.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
LocationID
|
varchar(3) string |
001 |
Location code ( Example: |
RLimit
|
int | 0 |
Maximum number of rows ( Example: |
ShowNew
|
bit boolean |
1 |
Include orders with a new status ( Example: |
ShowOrd
|
bit boolean |
1 |
Include ordered orders ( Example: |
ShowCon
|
bit boolean |
1 |
Include confirmed orders ( Example: |
ShowCls
|
bit boolean |
1 |
Include closed orders ( Example: |
ShowDueDate
|
bit boolean |
0 |
If Example: |
ShowNoDate
|
bit boolean |
0 |
If Example: |
StatusChangeDateFrom
|
datetime dateTime |
NULL |
Lower bound (inclusive) for the latest change in the order history. Passed alone, it returns no rows (see notes). Example: |
StatusChangeDateTo
|
datetime dateTime |
NULL |
Upper bound (exclusive) for the latest change in the order history. Example: |
ExtOrderNrs
|
varchar(max) xml |
NULL |
Optional XML list of external order numbers. Only orders whose Example:
|
Result set 1 · Always (empty if RLimit = 0 or nothing matches)
Supplier orders sorted by order date descending.
| Column | Type | Description |
|---|---|---|
OrderNr
|
int |
Internal supplier order number ( |
SupplNr
Nullable |
string |
Supplier number. |
SupplGroup
Nullable |
string |
Supplier group. |
OrderDate
Nullable |
datetime dateTime |
Order date. |
Status
Nullable |
varchar(3) string |
Status code, e.g. BES, CON, CLS. |
CreateDate
Nullable |
datetime dateTime |
Creation timestamp. |
CreateEmp
Nullable |
string |
User name of the creator. |
UpdateDate
Nullable |
datetime dateTime |
Last modification timestamp. |
UpdateEmp
Nullable |
string |
User name of the last modifier. |
SOrderLocation
|
string |
Location code ( |
RecordBatchNr
Nullable |
int |
Always |
SOrderKey
|
int |
Technical key of the supplier order ( |
ExtOrderNr
Nullable |
string |
External order number ( |
XMLsent
Nullable |
boolean |
Indicates whether the direct fulfillment XML was sent ( |
SupplierFulfillment
Nullable |
boolean |
Indicates a direct fulfillment order ( |
SOrdersNote
Nullable |
varchar(1024) string |
Note for the supplier. |
SupplName
Nullable |
string |
Supplier name. |
PixiOrderCreated
Nullable |
bit boolean |
Always |
GoodsReceipts
Nullable |
varchar(8000) string |
Goods receipt numbers ( |
Response example
<SqlRowSet1>
<row>
<OrderNr>10452</OrderNr>
<SupplNr>70001</SupplNr>
<SupplGroup>A</SupplGroup>
<OrderDate>2024-05-14T09:12:00</OrderDate>
<Status>BES</Status>
<CreateDate>2024-05-14T09:10:00</CreateDate>
<CreateEmp>mmueller</CreateEmp>
<UpdateDate>2024-05-15T11:30:00</UpdateDate>
<UpdateEmp>mmueller</UpdateEmp>
<SOrderLocation>001</SOrderLocation>
<SOrderKey>8831</SOrderKey>
<ExtOrderNr>PO-2024-0012</ExtOrderNr>
<XMLsent>false</XMLsent>
<SupplierFulfillment>false</SupplierFulfillment>
<SOrdersNote>Bitte Liefertermin bestätigen</SOrdersNote>
<SupplName>Muster Buchvertrieb GmbH</SupplName>
<GoodsReceipts>5521; 5530</GoodsReceipts>
</row>
</SqlRowSet1>
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:pixiGetSOrders>
<!-- <LocationID>001</LocationID> -->
<!-- <RLimit>500</RLimit> -->
<!-- <ShowNew>1</ShowNew> -->
<!-- <ShowOrd>1</ShowOrd> -->
<!-- <ShowCon>1</ShowCon> -->
<!-- <ShowCls>0</ShowCls> -->
<!-- <ShowDueDate>0</ShowDueDate> -->
<!-- <ShowNoDate>0</ShowNoDate> -->
<!-- <StatusChangeDateFrom>2024-05-01T00:00:00</StatusChangeDateFrom> -->
<!-- <StatusChangeDateTo>2024-06-01T00:00:00</StatusChangeDateTo> -->
<!-- <ExtOrderNrs><![CDATA[<ExtOrders><ExtOrder><ExtOrderNr>PO-2024-0012</ExtOrderNr></ExtOrder><ExtOrder><ExtOrderNr>PO-2024-0013</ExtOrderNr></ExtOrder></ExtOrders>]]></ExtOrderNrs> -->
</ns1:pixiGetSOrders>
</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:pixiGetSOrders>
<!-- <LocationID>001</LocationID> -->
<!-- <RLimit>500</RLimit> -->
<!-- <ShowNew>1</ShowNew> -->
<!-- <ShowOrd>1</ShowOrd> -->
<!-- <ShowCon>1</ShowCon> -->
<!-- <ShowCls>0</ShowCls> -->
<!-- <ShowDueDate>0</ShowDueDate> -->
<!-- <ShowNoDate>0</ShowNoDate> -->
<!-- <StatusChangeDateFrom>2024-05-01T00:00:00</StatusChangeDateFrom> -->
<!-- <StatusChangeDateTo>2024-06-01T00:00:00</StatusChangeDateTo> -->
<!-- <ExtOrderNrs><![CDATA[<ExtOrders><ExtOrder><ExtOrderNr>PO-2024-0012</ExtOrderNr></ExtOrder><ExtOrder><ExtOrderNr>PO-2024-0013</ExtOrderNr></ExtOrder></ExtOrders>]]></ExtOrderNrs> -->
</ns1:pixiGetSOrders>
</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 = [
// 'LocationID' => '001',
// 'RLimit' => '500',
// 'ShowNew' => '1',
// 'ShowOrd' => '1',
// 'ShowCon' => '1',
// 'ShowCls' => '0',
// 'ShowDueDate' => '0',
// 'ShowNoDate' => '0',
// 'StatusChangeDateFrom' => '2024-05-01T00:00:00',
// 'StatusChangeDateTo' => '2024-06-01T00:00:00',
// 'ExtOrderNrs' => '<ExtOrders><ExtOrder><ExtOrderNr>PO-2024-0012</ExtOrderNr></ExtOrder><ExtOrder><ExtOrderNr>PO-2024-0013</ExtOrderNr></ExtOrder></ExtOrders>',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiGetSOrders', $soapArguments);
- SQL object:
- dbo.pipiGetSOrders