Przejdź do treści

Przykłady WMS (Warehouse, Location, Inventory, InventoryDocument)

Przykłady zasobów z katalogu WMS: Warehouse (jako Location), Location, Inventory, InventoryDocument (jedyny zasób na ruch magazynowy: GR — goods receipt, GI — goods issue, przesunięcie, korekta; model Kamsoft.FAIR). System kodów: https://api-erp.kamsoft.pl/ns/. Standard modeli: Kamsoft.FAIR.


1. Warehouse (magazyn) = Location

Magazyn w modelu jest Location z type=warehouse. Posiada identifier, name, address i opcjonalnie managingParty (organizacja zarządzająca). Zob. Warehouse.

  • Location/loc-wh-01 – type=warehouse, identifier (np. MAG-01), name („Magazyn Główny – Warszawa”), address. Używany jako punkt odniesienia w strukturze stref/regałów/bins przez partOf i jako uczestnik InventoryDocument.participant.
{
  "resourceType": "Location",
  "id": "loc-wh-01",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/location-type", "code": "warehouse", "display": "Magazyn" }] },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "MAG-01" }],
  "name": "Magazyn Główny – Warszawa",
  "address": [{ "use": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/address-use", "code": "work" }] }, "component": [
    { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/address-component-type", "code": "street" }], "text": "ul. Magazynowa 10" },
    { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/address-component-type", "code": "city" }], "text": "Warszawa" },
    { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/address-component-type", "code": "postal-code" }], "text": "02-001" },
    { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/address-component-type", "code": "country" }], "text": "PL" }
  ] }]
}

2. Location (lokalizacja w magazynie)

Hierarchia: strefa → regał → bin. partOf = Location nadrzędna (magazyn lub strefa wyżej w hierarchii); opcjonalnie managingParty = Party (organizacja zarządzająca).

Strefa (zone):

{
  "resourceType": "Location",
  "id": "loc-zone-01",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "A" }],
  "name": "Strefa A – regały wysokie",
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/location-type", "code": "storage", "display": "Składowanie" }] },
  "partOf": [{ "reference": "Location/loc-wh-01", "display": "Magazyn Główny" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Regał (partOf = strefa):

{
  "resourceType": "Location",
  "id": "loc-rack-01",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "A-01" }],
  "name": "Regał A-01",
  "partOf": [{ "reference": "Location/loc-zone-01", "display": "Strefa A" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Bin (komórka):

{
  "resourceType": "Location",
  "id": "loc-bin-01",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "A-01-02-15" }],
  "name": "Bin A-01-02-15",
  "partOf": [{ "reference": "Location/loc-rack-01", "display": "Regał A-01" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

2a. Hierarchia magazynów (Location type=warehouse)

Hierarchia magazynów jest modelowana przez Location z type = warehouse: każdy magazyn to jeden Location (węzeł drzewa) z partOf = Location (magazyn nadrzędny). Magazyn najwyższego szczebla nie ma partOf. Zob. Location, Warehouse.

Magazyn centralny (szczebel najwyższy):

{
  "resourceType": "Location",
  "id": "loc-wh-central",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "WH-CENTRAL" }],
  "name": "Magazyn centralny",
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/location-type", "code": "warehouse", "display": "Magazyn" }] },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Magazyn regionalny (partOf = magazyn centralny):

{
  "resourceType": "Location",
  "id": "loc-wh-region-1",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "WH-REG-01" }],
  "name": "Magazyn regionalny – Południe",
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/location-type", "code": "warehouse", "display": "Magazyn" }] },
  "partOf": [{ "reference": "Location/loc-wh-central", "display": "Magazyn centralny" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Uwaga: Każdy magazyn to Location z type=warehouse i identifier. Strefy/regały/bin wewnątrz danego magazynu to Location z partOf = Location (ten magazyn), type = storage/zone/bin (nie warehouse).


3. Location (biuro / oddział)

Location jako miejsce w organizacji: budynek → piętro → pokój. owner lub managingParty = Party (oddział, organizacja); partOf = nadrzędna Location.

{
  "resourceType": "Location",
  "id": "loc-office-301",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "BUD-3-POK-301" }],
  "name": "Biuro 301 – piętro 3",
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/location-type", "code": "office", "display": "Biuro" }] },
  "owner": { "reference": "Party/party-branch-001", "display": "Oddział Kraków" },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

4. Inventory (stan zbiorczy – bez partii/serii)

product → ProductDefinition; location → Location; quantity – ilość.

{
  "resourceType": "Inventory",
  "id": "inv-001",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "INV-001" }],
  "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A – szt." },
  "location": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" },
  "quantity": { "value": 150, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
  "period": { "start": "2025-02-20", "end": "2025-02-20" },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

5. Inventory (stan z partią)

productProduct (productDefinition + attribute batch-number); location → Location; quantity – ilość partii w tej lokalizacji.

{
  "resourceType": "Inventory",
  "id": "inv-002",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "INV-002" }],
  "product": { "reference": "Product/prod-batch-L2025001", "display": "Towar A – partia L-2025-001" },
  "location": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" },
  "quantity": { "value": 50, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Product (partia):

{
  "resourceType": "Product",
  "id": "prod-batch-L2025001",
  "productDefinition": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "L-2025-001" }],
  "attribute": [{ "code": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/product-attribute-type", "code": "batch-number", "display": "Numer partii" }] }, "valueString": "L-2025-001" }]
}

6. Inventory (stan z numerem seryjnym)

productProduct (attribute serial-number); quantity = 1 (typowo jedna szt. na numer seryjny).

{
  "resourceType": "Inventory",
  "id": "inv-003",
  "meta": { "lastModified": "2025-02-20T10:00:00Z" },
  "product": { "reference": "Product/prod-serial-SN123456", "display": "Urządzenie X – SN-123456" },
  "location": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" },
  "quantity": { "value": 1, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] }
}

Product (numer seryjny):

{
  "resourceType": "Product",
  "id": "prod-serial-SN123456",
  "productDefinition": { "reference": "ProductDefinition/pd-urzadzenie-x", "display": "Urządzenie X" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "SN-123456" }],
  "attribute": [{ "code": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/product-attribute-type", "code": "serial-number", "display": "Numer seryjny" }] }, "valueString": "SN-123456" }]
}

7. InventoryDocument (dokument ruchu magazynowego — model Kamsoft.FAIR)

InventoryDocument reprezentuje wyłączny w tym modelu sposób zapisu przyjęcia (GR) i wydania (GI) oraz przesunięć i korekt — endpoint /v1/inventory-documents. Zasób Document nie służy do modelowania ruchów magazynowych GR/GI.

movementType (CodeableConcept, system inventory-movement-type): receipt = GR (goods receipt), issue = GI (goods issue); dalej transfer, adjustment. Uczestnicy (magazyn, dostawca, odbiorca) w participant; kierunek przez fromLocation / toLocation oraz quantity (delta: + przy receipt, − przy issue). Powiązanie P2P: relatedDocumentPurchaseOrder.

Uwaga: W jednym position valueReference może zawierać produkt (ProductDefinition lub Product) i Location; kolejność lub konwencja profilu określa, która referencja do czego się odnosi.

7.1. GR — goods receipt (movementType = receipt)

{
  "resourceType": "InventoryDocument",
  "id": "invdoc-pz-001",
  "meta": { "lastModified": "2025-02-20T12:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "GR/2025/001" }],
  "movementType": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/inventory-movement-type", "code": "receipt", "display": "Goods receipt (GR)" }] },
  "effectiveDate": "2025-02-20",
  "relatedDocument": [
    { "reference": "PurchaseOrder/po-2025-7788", "display": "PO-2025-7788" }
  ],
  "participant": [
    { "reference": "Location/loc-wh-01", "display": "Magazyn Główny" },
    { "reference": "Party/party-org-001", "display": "Dostawca ABC" }
  ],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "completed" }] },
  "position": [
    {
      "positionNo": 1,
      "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
      "quantity": { "value": 100, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "toLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" }
    },
    {
      "positionNo": 2,
      "product": { "reference": "Product/prod-batch-L2025001", "display": "Towar A – partia L-2025-001" },
      "quantity": { "value": 50, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "toLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" }
    }
  ]
}

7.2. GI — goods issue (movementType = issue)

{
  "resourceType": "InventoryDocument",
  "id": "invdoc-wz-001",
  "meta": { "lastModified": "2025-02-21T09:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "GI/2025/001" }],
  "movementType": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/inventory-movement-type", "code": "issue", "display": "Goods issue (GI)" }] },
  "effectiveDate": "2025-02-21",
  "fromLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" },
  "participant": [
    { "reference": "Location/loc-wh-01", "display": "Magazyn Główny" },
    { "reference": "Party/party-org-002", "display": "Odbiorca XYZ" }
  ],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "completed" }] },
  "position": [
    {
      "positionNo": 1,
      "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
      "quantity": { "value": -30, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "fromLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" }
    }
  ]
}

7.3. Transfer (przesunięcie między lokalizacjami)

{
  "resourceType": "InventoryDocument",
  "id": "invdoc-transfer-001",
  "meta": { "lastModified": "2025-02-22T14:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "MM/2025/001" }],
  "movementType": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/inventory-movement-type", "code": "transfer", "display": "Przesunięcie" }] },
  "effectiveDate": "2025-02-22",
  "participant": [{ "reference": "Location/loc-wh-01", "display": "Magazyn Główny" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "completed" }] },
  "position": [
    {
      "positionNo": 1,
      "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
      "quantity": { "value": 20, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "fromLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" },
      "toLocation": { "reference": "Location/loc-bin-02", "display": "Bin A-01-02-16" }
    }
  ]
}

7.4. Adjustment (korekta stanu)

Korekta ilości na jednej lokalizacji (np. inwentaryzacja, poprawka). movementType = adjustment; pozycje z toLocation lub fromLocation (jedna lokacja) i quantity (delta: + uzupełnienie, − ubytek).

{
  "resourceType": "InventoryDocument",
  "id": "invdoc-adj-001",
  "meta": { "lastModified": "2025-02-23T10:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "KOR/2025/001" }],
  "movementType": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/inventory-movement-type", "code": "adjustment", "display": "Korekta stanu" }] },
  "effectiveDate": "2025-02-23",
  "participant": [{ "reference": "Location/loc-wh-01", "display": "Magazyn Główny" }],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "completed" }] },
  "position": [
    {
      "positionNo": 1,
      "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
      "quantity": { "value": -2, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "toLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" }
    }
  ]
}

7.5. GR z magazynem na nagłówku i binami na pozycjach

Na nagłówku toLocation = Location oznaczająca magazyn (np. Location z type=warehouse, jak w sekcji 2a); na pozycjach toLocation = konkretny bin (regał, półka). Lokalizacje na pozycjach powinny być w hierarchii magazynu z nagłówka (partOf lub ten sam owner). Dostawca w participant.

{
  "resourceType": "InventoryDocument",
  "id": "invdoc-pz-002",
  "meta": { "lastModified": "2025-02-24T08:00:00Z" },
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "GR/2025/002" }],
  "movementType": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/inventory-movement-type", "code": "receipt", "display": "Goods receipt (GR)" }] },
  "effectiveDate": "2025-02-24",
  "toLocation": { "reference": "Location/loc-wh-central", "display": "Magazyn centralny" },
  "participant": [
    { "reference": "Location/loc-wh-01", "display": "Magazyn Główny" },
    { "reference": "Party/party-org-001", "display": "Dostawca ABC" }
  ],
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "completed" }] },
  "position": [
    {
      "positionNo": 1,
      "product": { "reference": "ProductDefinition/pd-towar-100", "display": "Towar A" },
      "quantity": { "value": 80, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "toLocation": { "reference": "Location/loc-bin-01", "display": "Bin A-01-02-15" }
    },
    {
      "positionNo": 2,
      "product": { "reference": "ProductDefinition/pd-towar-200", "display": "Towar B" },
      "quantity": { "value": 25, "unit": "szt", "system": "http://unitsofmeasure.org", "code": "EA" },
      "toLocation": { "reference": "Location/loc-bin-02", "display": "Bin A-01-02-16" }
    }
  ]
}

8. Diagramy zależności obiektów WMS

8.1. Zależności między zasobami (relacje referencyjne)

erDiagram
    Party ||--o{ Location : "owner"
    Party ||--o{ Location : "managingParty"
    Location ||--o{ Location : "partOf"
    Party ||--o{ Inventory : "warehouse via Location"
    ProductDefinition ||--o{ Inventory : "product"
    Product ||--o{ Inventory : "product"
    Location ||--o{ Inventory : "location"
    Party ||--o{ InventoryDocument : "participant"
    InventoryDocument ||--o{ InventoryDocumentPosition : "position"
    ProductDefinition ||--o{ InventoryDocumentPosition : "product"
    Product ||--o{ InventoryDocumentPosition : "product"
    Location ||--o{ InventoryDocumentPosition : "fromLocation toLocation"

    Party {
        string id
        string display
        string type
        string category
    }

    Location {
        string id
        string name
        Reference owner
        Reference managingParty
        Reference partOf
        Attribute attribute
    }

    Inventory {
        string id
        Reference product
        Reference location
        Quantity quantity
    }

    InventoryDocument {
        string id
        CodeableConcept movementType
        Reference participant
    }

    InventoryDocumentPosition {
        Reference product
        Quantity quantity
        Reference fromLocation
        Reference toLocation
    }

    Product {
        Reference productDefinition
        Attribute batchSerial
    }

    ProductDefinition {
        string id
        string name
    }

8.2. Hierarchia magazynów (Location type=warehouse)

flowchart TB
    C[Location: Magazyn centralny\ntype=warehouse]
    R1[Location: Magazyn regionalny 1\ntype=warehouse\npartOf → centralny]
    R2[Location: Magazyn regionalny 2\ntype=warehouse\npartOf → centralny]
    C --> R1
    C --> R2

8.3. Hierarchia Location w magazynie (magazyn → strefa → regał → bin)

flowchart TB
    subgraph Lokalizacje["Location"]
        W[Magazyn Główny\nloc-wh-01\ntype=warehouse]
        Z[Strefa A\nloc-zone-01\npartOf → Magazyn]
        R[Regał A-01\nloc-rack-01\npartOf → Strefa A]
        B[Bin A-01-02-15\nloc-bin-01\npartOf → Regał A-01]
    end

    W --> Z
    Z --> R
    R --> B

8.4. Przepływ: InventoryDocument (GR) → Inventory

flowchart LR
    subgraph InvDoc["InventoryDocument (GR)"]
        D[GR/2025/001\nmovementType=receipt]
        C1[position: product qty toLocation]
        C2[position: product qty toLocation]
    end

    subgraph Poz["Pola pozycji"]
        PD[ProductDefinition]
        Prod[Product batch]
        Loc[Location]
        Party[Party warehouse]
    end

    subgraph Stan["Inventory"]
        I1[Inventory product+location+qty]
        I2[Inventory product+location+qty]
    end

    D --> C1
    D --> C2
    C1 --> PD
    C1 --> Loc
    D --> Party
    C2 --> Prod
    C2 --> Loc
    C1 -.->|"aktualizuje / tworzy"| I1
    C2 -.->|"aktualizuje / tworzy"| I2

8.5. Podsumowanie: zasoby WMS i ich powiązania

Zasób Zależności (odniesienia) Użycie w WMS
Location (type=warehouse) partOf → Location (hierarchia), managingParty → Party (org.) Magazyn; punkt odniesienia dla stref/regałów/bins przez partOf; participant w InventoryDocument
Location managingParty (Party), partOf → Location, attribute[] Strefa, regał, bin; location w Inventory; fromLocation / toLocation na pozycji InventoryDocument
Inventory product → ProductDefinition lub Product; location → Location Stan: co, gdzie, ile; opcjonalnie period
Product productDefinition → ProductDefinition; attribute (batch-number, serial-number) Partia/seria w Inventory i na pozycji InventoryDocument
ProductDefinition Katalog; product w Inventory (stan zbiorczy); pole product na pozycji InventoryDocument
InventoryDocument movementType (receipt/GR, issue/GI, transfer, adjustment); position (product, quantity, fromLocation, toLocation) Jedyny zasób na ruch magazynowy w tym modelu
InventoryDocumentPosition product, quantity, fromLocation, toLocation Wiersz GR/GI / transfer / adjustment

Przykłady i diagramy zgodne z Resources: WMS/README, Location, WMS/Inventory, WMS/Warehouse, InventoryDocument, InventoryDocumentPosition. Data: 2026-02-20.