Přeskočit obsah

Inventury — Inventories

Správa inventur a jejich položek. Zahrnuje workflow od zahájení po dokončení.

Base path: /api/inventories


Endpointy — Inventury

GET /api/inventories — Neuzavřené inventury

GET /api/inventories
Authorization: Bearer <token>

Vrátí seznam neuzavřených inventur (stav ≠ Uzavřena, Zrušena).

Response 200 OK — pole Inventory objektů.


GET /api/inventories/{id} — Detail inventury

GET /api/inventories/15?includeItems=false
Parametr Typ Výchozí Popis
id long ID inventury
includeItems bool false Zahrnout položky inventury do odpovědi

Response 200 OK:

{
  "oid": 15,
  "name": "Inventura Q1 2026 — kancelář 201",
  "isClosed": false,
  "isApproved": false,
  "mustBeApproved": true,
  "locationId": 5,
  "inventoryStateId": 2,
  "inventoryState": { "oid": 2, "name": "Probíhá" },
  "items": []
}

GET /api/inventories/findById

GET /api/inventories/findById?id=15&filterOp=Equals

GET /api/inventories/findByName

GET /api/inventories/findByName?name=Q1&filterOp=Contains

Endpointy — Položky inventury

GET /api/inventories/{id}/items — Všechny položky

GET /api/inventories/15/items

Vrátí všechny InventoryItem objekty pro danou inventuru.


GET /api/inventories/{id}/items/findByLocation — Položky dle lokace

GET /api/inventories/15/items/findByLocation?locationId=5

Filtruje položky inventury podle lokace (přesná shoda).


GET /api/inventories/items/{id} — Detail položky

GET /api/inventories/items/128

Response 200 OK:

{
  "oid": 128,
  "inventoryId": 15,
  "articleId": 42,
  "article": { "oid": 42, "code": "NTB-001", "name": "Notebook Dell XPS 15" },
  "locationId": 5,
  "inventoryLocationId": 5,
  "quantity": 1,
  "inventoryQuantity": 1,
  "isFound": true,
  "isDisposal": false,
  "isApproved": false,
  "note": null
}

PUT /api/inventories/items/update — Aktualizace položky

PUT /api/inventories/items/update
Content-Type: application/json

Request bodyInventoryItemUpdate:

{
  "oid": 128,
  "inventoryQuantity": 1,
  "inventoryLocationId": 5,
  "isFound": true,
  "isDisposal": false,
  "disposalMethodId": null,
  "disposalReasonId": null,
  "note": "Nalezeno v kanceláři"
}

Response 200 OK — aktualizovaná položka.


Workflow — Správa stavu inventury

PUT /api/inventories/{id}/start — Zahájení inventury

PUT /api/inventories/15/start

Přepne inventuru do stavu Probíhá. Spustí fyzickou inventarizaci.

Response 200 OK | 400 pokud inventura není ve správném stavu.


PUT /api/inventories/{id}/postpone — Pozastavení

PUT /api/inventories/15/postpone

Přepne inventuru do stavu Pozastavena.


PUT /api/inventories/{id}/finish — Dokončení

PUT /api/inventories/15/finish

Přepne inventuru do stavu Dokončena. Fyzická část je hotova, čeká na zpracování výsledků.


Stavový diagram inventury

Příprava → Čeká na zahájení → Probíhá → Dokončena → Zpracování výsledků → Uzavřena
                             Pozastavena → Probíhá
                               Zrušena

Datový model

Inventory

Pole Typ Popis
OID long Primární klíč
Name string Název inventury
IsClosed bool Inventura je uzavřena
IsApproved bool Inventura je schválena
MustBeApproved bool Vyžaduje schválení
LocationId long? Výchozí lokace inventury
InventoryStateId long FK → InventoryState

InventoryItem

Pole Typ Popis
OID long Primární klíč
InventoryId long FK → Inventory
ArticleId long FK → Article
LocationId long? Původní umístění
InventoryLocationId long? Inventurní umístění (kde bylo nalezeno)
Quantity int Původní množství
InventoryQuantity int? Inventurní množství
IsFound bool Položka byla nalezena
IsDisposal bool Navrženo k vyřazení
IsApproved bool Schváleno správcem
DisposalMethodId long? FK → ArticleDisposalMethod
DisposalReasonId long? FK → ArticleDisposalReason
Note string? Poznámka inventarizátora