Przejdź do głównej zawartości

receivePurchaseOrder

Dla: Programista

MutacjaBetaMutation.receivePurchaseOrder

Receives a delivery against a SENT, CONFIRMED or PARTIALLY_RECEIVED purchase order (another status: PURCHASE_ORDER_NOT_RECEIVABLE): each item's received quantity grows, never above what was ordered (PURCHASE_ORDER_OVER_RECEIVED), and the stock of its material rises by the delivery converted to the stock unit, with a RECEIPT in stockMovements linked to the order — unless the stock's precision rounds the delivery away (a few meters of a long foil roll), when only the received quantity grows. Each movement records the item's unit price and unit, the order's currency and supplier, and the delivery's deliveredAt and documentNumber. A delivery of a paper kept for pricing only (Paper.isStock false) is refused (PAPER_PRICING_ONLY). The status becomes PARTIALLY_RECEIVED or, once every item arrived in full, RECEIVED. Not idempotent: retry with Idempotency-Key. Answers with the order.

Wymagany zakreswarehouse:write
Dostępne odPrynt 0.28.0
StabilnośćBeta (co to znaczy)
PonawianieWysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja

Argumenty

NazwaTypOpis
idwymaganeID!

Identifier of the purchase order.

inputwymaganeReceivePurchaseOrderInput!

What arrived.

Zwraca

PurchaseOrder!

Przykład

Mutacja
mutation ReceiveDelivery($id: ID!, $input: ReceivePurchaseOrderInput!) {
receivePurchaseOrder(id: $id, input: $input) {
id
status
receivedAt
items {
id
receivedQuantity
}
}
}
Zmienne
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"input": {
"items": [
{
"itemId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b08",
"receivedQuantity": 2000
},
{
"itemId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b09",
"receivedQuantity": 2.5
}
],
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 412/2026"
}
}
Wywołanie (curl)
IDEMPOTENCY_KEY=$(uuidgen) # ponawiaj z tym samym kluczem
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
--data-binary @- <<'JSON'
{
"query": "mutation ReceiveDelivery($id: ID!, $input: ReceivePurchaseOrderInput!) {\n receivePurchaseOrder(id: $id, input: $input) {\n id\n status\n receivedAt\n items {\n id\n receivedQuantity\n }\n }\n}",
"variables": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"input": {
"items": [
{
"itemId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b08",
"receivedQuantity": 2000
},
{
"itemId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b09",
"receivedQuantity": 2.5
}
],
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 412/2026"
}
}
}
JSON
Odpowiedź
{
"data": {
"receivePurchaseOrder": {
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07",
"status": "PARTIALLY_RECEIVED",
"receivedAt": null,
"items": [
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b08",
"receivedQuantity": 2000
},
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b09",
"receivedQuantity": 2.5
}
]
}
}
}