ERP Core / Inventory

Inventory - Introduction & Executive Overview

Strategic architectural overview of the Inventory & Warehouse Management (WMS) domain, exploring physical spatial hierarchy, stock reservations, and cross-domain fulfillment.

Inventory & Warehouse Management Domain Design

Physical stock represents one of the largest capital commitments on an enterprise balance sheet. In modern omnichannel supply chains, merchandise is constantly in motion: receiving docks ingest ocean freight containers, automated conveyor systems route parcels through pick-pack-ship stations, retail shelves demand continuous replenishment, and manufacturing shop floors consume raw materials in tight production cadences.

The Inventory & Warehouse Management (WMS) domain acts as the sovereign authority for physical goods across all company facilities. It governs multi-warehouse spatial hierarchies (Zones, Aisles, Racks, Shelves, Bins), real-time stock balances (On-Hand, Reserved, Available-To-Promise), lot traceability, serialized equipment tracking, quarantine controls, and physical cycle count adjustments.

By establishing an independent Bounded Context, physical stock allocation and spatial movements remain cleanly decoupled from commercial sales orders, procurement purchasing contracts, point-of-sale register balances, and financial ledger accounts.


1. Business Drivers & The Warehouse Disarray Problem

Without a dedicated, isolated inventory domain, warehouse operations and stock tracking rapidly descend into stockouts, phantom inventory, and fulfillment bottlenecks:

flowchart TD
    subgraph Antipattern["Without Inventory Domain: Stock Drift & Fulfillment Chaos"]
        SharedQuantity["Single Quantity Column<br/>Sales and warehousing mutating a single 'stock' number without reservation mechanics"]
        Overselling["Catastrophic Overselling<br/>Multiple concurrent web checkouts claiming the same physical item simultaneously"]
        PhantomStock["Phantom Inventory Drift<br/>The system showing items in stock that warehouse pickers cannot physically locate"]
        UntrackedSpoilage["Untracked Spoilage & Expiry<br/>Expired perishable lots shipped to retail consumers due to missing FEFO controls"]
    end

    subgraph Solution["With Inventory Domain: Strict Domain-Driven Architecture"]
        TripartiteBalance["Tripartite Stock Equation<br/>Strict separation: Available = On-Hand minus Allocated/Reserved"]
        AtomicReservation["Atomic Reservation Locks<br/>Order checkouts place temporary reservation holds with deterministic TTLs"]
        SpatialPrecision["Granular Bin-Level Addressability<br/>Every physical unit mapped to an exact Zone-Aisle-Rack-Shelf-Bin coordinate"]
        StrictTraceability["Lot & Serial Traceability<br/>Mandatory FIFO/FEFO picking rules with complete genealogy tracking"]
    end

    Antipattern -.->|Resolved By Domain-Driven Design| Solution

The Cost of Supply Chain Chaos

  • Overselling & Order Cancellations: When the system only tracks a single, monolithic “quantity” field, high-velocity commercial sales channels oversell available inventory during promotional spikes, triggering costly customer cancellations and brand erosion.
  • Lost Warehouse Labor: Without granular bin-level addressability (knowing the exact shelf and bin), warehouse pickers waste hundreds of hours wandering warehouse aisles searching for displaced items.
  • Silent Inventory Discrepancies: In-place database edits that adjust stock numbers without recording an explicit stock movement voucher hide warehouse shrinkage, theft, and damaged goods from operational leadership.
  • Perishable & Batch Recalls: For pharmaceuticals, chemicals, and food products, failing to track batch/lot numbers and expiration dates prevents surgical product recalls and results in the distribution of expired goods.

Domain-Driven Design addresses these challenges by enforcing spatial addressability, atomic stock allocation state machines, and immutable stock movement ledgers.


2. Core Strategic Pillars of the Inventory Domain

The Inventory bounded context is anchored by seven foundational architectural pillars:

flowchart TD
    WMS["Inventory Domain Core"]

    P1["1. Tripartite Stock Model<br/>On-Hand, Reserved, and Available-To-Promise"]
    P2["2. Spatial Addressability<br/>Warehouse -> Zone -> Aisle -> Rack -> Bin"]
    P3["3. The Non-Negative Invariant<br/>Physical stock in a bin can never drop below zero"]
    P4["4. Atomic Allocation Lifecycles<br/>Soft reservations, hard allocations, and pack verification"]
    P5["5. Lot & Serial Genealogy<br/>FEFO/FIFO enforcement and component track-and-trace"]
    P6["6. Immutable Stock Move Ledgers<br/>Double-entry spatial movements from origin to destination"]
    P7["7. Blind Cycle Count Auditing<br/>Variance verification with compensatory adjustment vouchers"]

    WMS --> P1
    WMS --> P2
    WMS --> P3
    WMS --> P4
    WMS --> P5
    WMS --> P6
    WMS --> P7

1. Tripartite Stock Equation

Inventory enforces the fundamental operational balance identity: $\text{Available To Promise (ATP)} = \text{Physical On Hand} - \text{Hard Allocated} - \text{Quarantined}$. Commercial channels can only sell against ATP, preventing overselling.

2. Five-Tier Spatial Hierarchy

Every warehouse is structured into a deterministic coordinate tree: Warehouse $\to$ Zone $\to$ Aisle $\to$ Rack $\to$ Bin. Items are never floating vaguely “in the building”; they are assigned to explicit physical storage locations.

3. The Non-Negative Stock Invariant

Physical stock stored in any specific bin can never drop below zero. Any outbound transfer or pick command that would result in a negative physical balance is strictly rejected by the domain.

4. Deterministic Stock Allocation Lifecycle

Reservations move through formal states: Soft Reserved (temporary checkout cart hold with a time-to-live), Hard Allocated (locked to a confirmed order pick wave), Picked (relocated to a packing staging area), and Dispatched (permanently decremented from on-hand stock upon carrier handover).

5. Lot & Serial Traceability

Items governed by manufacturing lots enforce First-Expired, First-Out (FEFO) or First-In, First-Out (FIFO) picking algorithms. Serialized items enforce 1:1 hardware identifier uniqueness across the enterprise.

6. Double-Entry Spatial Stock Movements

Every stock movement (putaway, internal transfer, picking, scrap) is modeled as a transfer from a Source Location to a Destination Location. Physical quantities are never silently overwritten; they are transitioned via immutable movement vouchers.

7. Continuous Cycle Counting & Discrepancy Reconciliation

To avoid disruptive annual shutdowns, warehouses conduct ongoing blind cycle counts. Variances between physical counts and system records trigger explicit quarantine reviews and compensating adjustment vouchers.


3. High-Level Inter-Domain Choreography

The Inventory context orchestrates goods receipt, reservation, and fulfillment across the enterprise:

flowchart TD
    WMS["Inventory / WMS Domain<br/>Physical Warehousing & Spatial Stock"]

    Sales["Sales / OMS<br/>Customer Orders"]
    Purchase["Purchasing<br/>Vendor Shipments"]
    POS["Point of Sale<br/>Store Replenishment"]
    MRP["Manufacturing<br/>Work Orders"]
    FMS["Accounting / FMS<br/>Inventory Asset Valuation"]

    Sales -->|"OrderPlaced, OrderCancelled"| WMS
    Purchase -->|"GoodsReceived"| WMS
    WMS -->|"StockAllocated, StockDispatched"| Sales
    WMS -->|"StockThresholdBreached"| Purchase
    WMS -->|"StockValuationChanged, ScrapPosted"| FMS
    MRP -->|"MaterialsConsumed, ProductProduced"| WMS
Integrating ContextReceived EventInventory Operational Reaction
Sales / OMSOrderPlacedLocks stock in a specific warehouse bin into a Hard Allocated state.
Sales / OMSOrderCancelledReleases reserved stock back to the general Available-To-Promise pool.
PurchasingGoodsReceivedIngests supplier delivery into the receiving staging zone, awaiting QA inspection and putaway.
Manufacturing (MRP)WorkOrderReleasedReserves raw materials and sub-assemblies in the production floor staging bins.
Point of Sale (POS)ReplenishmentRequestedGenerates inter-facility transfer orders from central distribution centers to retail store backrooms.
Accounting (FMS)Emits: StockValuationChangedInforms general ledger of write-offs, physical adjustments, and inventory asset movements.

4. Architectural Domain Blueprint Directory

Explore the tactical models, invariants, and workflows across the Inventory domain chapters:

  1. Bounded Context & System Boundaries: Operational scope, multi-facility boundaries, out-of-scope concerns, and Anti-Corruption Layer (ACL) translation interfaces.
  2. Ubiquitous Language & Domain Glossary: Canonical warehouse terminology, spatial units, stock state definitions, and picking methods.
  3. Structural Topology & Spatial Hierarchy: Multi-warehouse topology, zone configurations, bin capacity limits, lot tracking, and aggregate roots.
  4. Domain Invariants & Business Rules (“The Law”): Non-negative stock rules, reservation expiration TTLs, FEFO picking rules, and bin weight capacities.
  5. Operational Workflows & State Machines: Receiving, putaway, pick-pack-ship, inter-warehouse transfers, and cycle count workflows.
  6. Domain Events & Integration Contracts: Authoritative inventory domain events, stock alert thresholds, and integration payload schemas.
  7. Audit Trail, Governance & Compensation: Stock movement ledgers, physical count reconciliation, scrap authorization, and rollback strategies.

Our Premium Sponsors

Obelaw is proudly open-source. Continued development, bug fixes, and community support are made possible by the generosity of our sponsors.

Sponsor Obelaw