Przejdź do treści

Inventory

Inventory (stan magazynowy) to zasób reprezentujący stan ilościowy produktu w danej lokalizacji – co (product), gdzie (location), ile (quantity). Opcjonalnie period (stan na dzień / snapshot). Partia lub seria mogą być cechami stanu w attribute[]; product zawsze wskazuje ProductDefinition. Wzorowany na SAP (Quant, material document), Oracle (on-hand inventory), D365 (inventory quantity).

Rozszerza DomainResource.


1. Zakres i zastosowanie

Inventory = jeden rekord stanu: product (Reference do ProductDefinition), location (Reference do Location), quantity (Quantity – ilość + jednostka). Opcjonalnie period (stan na dzień); status (z DomainResource).

  • Stany – zapytania typu „ile szt. produktu X w lokalizacji Y” → Inventory z product + location + quantity.
  • Ruch magazynowy – po przyjęciu, wydaniu lub przesunięciu stan może być aktualizowany; źródło ruchu w InventoryDocument (kanoniczny dokument ruchu).
  • Raportowanie – agregacja Inventory po location (stan magazynu) lub po product (stan produktu).

2. Zawartość (struktura)

Oprócz elementów DomainResource (id, resourceType, meta, owner, comment, category, status, type, contained, attribute):

Nazwa Kard. Typ Opis
identifier 0..* Identifier Identyfikatory stanu magazynowego
location 1..1 Reference(Location) Lokalizacja (gdzie leży stan; magazyn lub miejsce składowania)
product 1..1 Reference(ProductDefinition) Produkt (definicja asortymentu)
quantity 1..1 Quantity Ilość (value + unit; code = identyfikator jednostki w systemie magazynowym)
period 0..1 Period Okres / punkt w czasie (np. start=end=2025-01-31 – stan na dzień); brak = stan bieżący

Schemat wymaga location, product, quantity. Odczyt wypełnia dziś location, product i quantity; pozostałe pola pozostają w kontrakcie, ale nie są zasilane.

Uwaga: Partia lub numer seryjny są cechami stanu w attribute[]; kody atrybutów nadaje wdrożenie (brak opublikowanego słownika). product zawsze wskazuje ProductDefinition.


3. Operacje

Metoda Ścieżka Opis
GET /v1/inventories Lista stanów magazynowych

Parametry GET /v1/inventories:

Parametr Format Opis
location system\|value Lokalizacja; system = przestrzeń identyfikatora lokalizacji urn:oid:1.2.616.1.113769.4.<instalacja>.<klucz>
product system\|value Produkt; system = przestrzeń identyfikatora definicji produktu
count, offset integer Paginacja (domyślnie count=20, offset=0)

Odpowiedź 200 ma kopertę { "items": [...], "nextToken": null }. Zapis nie jest dostępny.


4. Zgodność z systemami ERP

System Odpowiednik Uwagi
SAP Quant, material document (MARD, MSKA…) Stan na bin/location; product = Material, location = Storage Bin (u nas Location)
Oracle On-hand quantity (MTL_ONHAND_QUANTITIES), Subinventory + Locator product = Item, location = Locator; quantity
D365 Inventory quantity (WHSInventStatus) Product + Location + Qty; mapowanie na Inventory

5. Odniesienia