Przejdź do głównej zawartości

stockMovements

Dla: Programista

ZapytanieBetaQuery.stockMovements

Movements of paper, paint and foil stock — receipts (also purchase-order deliveries), issues, corrections and stock-take adjustments — one page at a time, with the total count; newest first unless sorted. Each movement says the stock before and after it, read under a lock of the material, so the movements of one material chain together: each one starts from the stock the one before it left. The stock entered when a card is created is a CORRECTION from 0 since version 0.34.0; the opening stock of older cards and changes made before version 0.28.0 have no movement, so reconcile with the stock levels of the materials (papers, paints, foils). Movements are only ever added and their quantities and time never change: sync them with occurredFrom and the OCCURRED_AT sort.

Wymagany zakreswarehouse:read
Dostępne odPrynt 0.28.0
StabilnośćBeta (co to znaczy)

Argumenty

NazwaTypOpis
filterStockMovementFilterInput

Conditions the movements must meet; without it every movement is listed.

paginationPaginationInput

Page of the list to return; without it the first page at the default size.

sortStockMovementSortInput

Order of the list; without it newest first.

Zwraca

StockMovementsResult!

Przykład

Zapytanie
query NewReceipts($since: DateTime) {
stockMovements(
filter: { type: RECEIPT, occurredFrom: $since }
sort: { field: OCCURRED_AT, direction: ASC }
pagination: { page: 1, pageSize: 100 }
) {
items {
id
occurredAt
materialType
materialId
unit
quantityChange
unitPrice
priceUnit
currency
netValue
supplierId
deliveredAt
documentNumber
purchaseOrderId
}
pageInfo {
hasNextPage
}
}
}
Zmienne
{
"since": "2026-10-24T06:55:00.000Z"
}
Wywołanie (curl)
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"query": "query NewReceipts($since: DateTime) {\n stockMovements(\n filter: { type: RECEIPT, occurredFrom: $since }\n sort: { field: OCCURRED_AT, direction: ASC }\n pagination: { page: 1, pageSize: 100 }\n ) {\n items {\n id\n occurredAt\n materialType\n materialId\n unit\n quantityChange\n unitPrice\n priceUnit\n currency\n netValue\n supplierId\n deliveredAt\n documentNumber\n purchaseOrderId\n }\n pageInfo {\n hasNextPage\n }\n }\n}",
"variables": {
"since": "2026-10-24T06:55:00.000Z"
}
}
JSON
Odpowiedź
{
"data": {
"stockMovements": {
"items": [
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b12",
"occurredAt": "2026-10-24T08:02:44.120Z",
"materialType": "PAINT",
"materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b02",
"unit": "GRAMS",
"quantityChange": 2500,
"unitPrice": 180,
"priceUnit": "kg",
"currency": "PLN",
"netValue": 450,
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 412/2026",
"purchaseOrderId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b07"
},
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b13",
"occurredAt": "2026-10-24T09:15:02.311Z",
"materialType": "PAPER",
"materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b01",
"unit": "SHEETS",
"quantityChange": 5000,
"unitPrice": 0.42,
"priceUnit": "ark.",
"currency": "PLN",
"netValue": 2100,
"supplierId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b06",
"deliveredAt": "2026-10-24T00:00:00.000Z",
"documentNumber": "WZ 412/2026",
"purchaseOrderId": null
},
{
"id": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b14",
"occurredAt": "2026-10-24T10:40:19.004Z",
"materialType": "FOIL",
"materialId": "3f6b2a1c-8d4e-4f5a-9b6c-1d2e3f4a5b03",
"unit": "ROLLS",
"quantityChange": 1,
"unitPrice": null,
"priceUnit": null,
"currency": null,
"netValue": null,
"supplierId": null,
"deliveredAt": null,
"documentNumber": null,
"purchaseOrderId": null
}
],
"pageInfo": {
"hasNextPage": false
}
}
}
}