Warehouse Management Systems

Learn Warehouse Management Systems as part of the Domain Knowledge learning path for software engineers and architects.

A Warehouse Management System (WMS) is a software platform that manages the movement and storage of goods inside a warehouse. It coordinates receiving, putaway, inventory storage, replenishment, picking, packing, shipping, cycle counting, and returns.

In an e-commerce business, customers expect products to be available, orders to be fulfilled quickly, and deliveries to be accurate. A warehouse is where many of those promises become physical operations. Even when an online store, order management system, and inventory service work correctly, inefficient warehouse processes can still cause shipment delays, incorrect orders, inventory discrepancies, and increased operating costs.

For software engineers and solution architects, understanding WMS design means connecting business operations with inventory accuracy, workflow orchestration, scanning devices, warehouse automation, event-driven integration, and reliable distributed systems.

This article explains warehouse management from a business and technical perspective, including architecture, domain models, APIs, Java and Spring Boot implementation patterns, integration with inventory and order management, and practical exercises.

Learning Flow

flowchart TD
    A["Warehouse Management Fundamentals"] --> B["Warehouse Layout and Locations"]
    B --> C["Inbound Receiving and Putaway"]
    C --> D["Inventory Storage and Replenishment"]
    D --> E["Order Release and Picking"]
    E --> F["Packing and Shipping"]
    F --> G["Returns and Cycle Counting"]
    G --> H["WMS Architecture and Data Model"]
    H --> I["Java and Spring Boot Implementation"]
    I --> J["Integration, Reliability, and Observability"]
    J --> K["Hands-on WMS Project"]

1. What Is a Warehouse Management System?

A Warehouse Management System controls warehouse-level execution: what goods arrive, where they are stored, which stock should fulfill an order, how warehouse workers should move through tasks, and whether goods have been packed and dispatched correctly.

A WMS commonly supports:

  • Inbound receiving and inspection.
  • Purchase order and advance shipment notice processing.
  • Putaway and bin assignment.
  • Inventory movement between locations.
  • Replenishment of picking locations.
  • Wave, batch, zone, and discrete picking.
  • Packing, labeling, and shipping confirmation.
  • Cycle counting and inventory adjustments.
  • Returns processing and disposition.
  • Labor, productivity, and warehouse performance reporting.

A WMS is more than an inventory database. It coordinates physical work and records the results of that work.

For example, knowing that a warehouse contains 100 units of a product is not sufficient. The system must also know whether those units are in receiving, quality inspection, reserve storage, a picking bin, a damaged-goods area, or already assigned to outbound orders.

2. WMS vs. Inventory Management vs. Order Management

These systems collaborate, but they have different responsibilities.

System Primary responsibility Example
E-commerce platform Customer shopping experience Customer places an order
Order Management System (OMS) Order lifecycle and fulfillment coordination Assigns an order to a fulfillment location
Inventory Management System (IMS) Inventory availability across locations and channels Calculates sellable stock
Warehouse Management System (WMS) Physical warehouse execution Directs a picker to a specific bin
Transportation Management System (TMS) Transportation planning and carrier execution Selects a carrier and manages shipment movement
Enterprise Resource Planning (ERP) Enterprise-wide business operations Manages purchasing, finance, and supplier records

Example: One order across systems

A customer orders two laptops.

  1. The e-commerce platform captures the order.
  2. The OMS validates the order and determines the fulfillment location.
  3. The inventory service reserves the required quantities.
  4. The WMS receives the fulfillment request.
  5. Warehouse workers pick two laptops from the assigned bin.
  6. The WMS verifies the items, packs the shipment, and confirms dispatch.
  7. The OMS updates the order status.
  8. The customer receives a shipment notification.

The exact division of responsibilities varies by organization. Some companies combine inventory and WMS capabilities, while others use separate systems with clearly defined ownership.

Architecture principle: Define one authoritative owner for each business fact. Avoid allowing the OMS, inventory service, and WMS to independently modify the same inventory quantity without a clear synchronization contract.

3. Core Warehouse Concepts

3.1 Warehouse

A warehouse is a physical facility that stores and processes goods.

An e-commerce business might operate:

  • Regional distribution centers.
  • Fulfillment centers.
  • Store-based fulfillment locations.
  • Third-party logistics (3PL) warehouses.
  • Specialized facilities for refrigerated, hazardous, or high-value goods.

A warehouse has an identity, address, operational configuration, time zone, supported processes, and operating calendar.

3.2 Storage location and bin

A warehouse is divided into smaller physical locations.

A typical hierarchy is:

Warehouse
  └── Building
      └── Zone
          └── Aisle
              └── Rack
                  └── Shelf
                      └── Bin

A location may be identified by a code such as A-03-R02-S04-B01.

The hierarchy enables the WMS to guide workers to the correct storage position and optimize picking routes.

3.3 SKU and handling unit

A Stock Keeping Unit (SKU) identifies a product variant managed by the business.

A handling unit represents a physical unit of logistics handling, such as a carton, tote, pallet, or package. It may contain one or more products.

These concepts should not be confused:

  • SKU: What product is it?
  • Location: Where is it?
  • Lot or serial number: Which specific batch or individual item is it?
  • Handling unit: Which physical container or package holds it?

3.4 On-hand, reserved, and available inventory

Warehouse inventory may be categorized as:

  • On-hand: Quantity physically recorded at a location.
  • Reserved: Quantity committed to a demand or order.
  • Available: Quantity eligible for a specified operation.
  • Damaged: Quantity that cannot be sold or shipped normally.
  • Quarantined: Quantity awaiting inspection or authorization.
  • In transit: Quantity moving between locations.

These categories are business-dependent. A warehouse may track physical on-hand quantities separately from the inventory service's sellable availability.

3.5 Tasks and work queues

A warehouse task represents a unit of work assigned to an operator, device, or automated system.

Examples include:

  • Receive carton.
  • Move pallet to reserve storage.
  • Replenish a picking bin.
  • Pick five units.
  • Move a tote to packing.
  • Count a location.
  • Load a shipment.

Tasks need explicit states, assignment rules, priority, timestamps, and exception handling.

4. Warehouse Inbound Process

Inbound operations handle products arriving from suppliers, manufacturing facilities, or other warehouses.

A common inbound workflow is:

  1. Purchase order or expected shipment is created.
  2. An advance shipment notice (ASN) provides expected shipment details, when available.
  3. A truck arrives at the warehouse.
  4. Receiving staff identify the shipment and scan items.
  5. Actual quantities are compared with expected quantities.
  6. Damaged, unexpected, or mismatched goods are recorded.
  7. Accepted goods are assigned to storage locations.
  8. Putaway tasks are created and executed.
  9. Inventory records and receiving documents are updated.

Receiving example

A supplier is expected to deliver 100 units of a product. The receiving team scans 96 acceptable units and identifies four damaged units.

The WMS should record the discrepancy rather than blindly accepting the expected quantity.

Expected quantity:        100
Accepted quantity:         96
Damaged quantity:           4
Unexplained variance:       0

The actual inventory and supplier receiving records should reflect the physical outcome. Whether damaged goods count toward on-hand stock depends on the company's inventory model, but they must not accidentally become sellable.

Receiving design considerations

  • Support partial receipts.
  • Prevent duplicate receipt processing.
  • Track supplier, purchase order, shipment, lot, and serial number.
  • Record damaged or rejected goods.
  • Preserve who received the goods and when.
  • Support offline scanners where warehouse connectivity is unreliable.
  • Publish inventory updates only after the receiving transaction reaches its defined completion point.

5. Putaway and Storage Optimization

Putaway determines where received goods should be stored.

A WMS can select a location based on:

  • Available capacity.
  • Product dimensions and weight.
  • Hazardous-material restrictions.
  • Temperature requirements.
  • Product compatibility.
  • Fast-moving versus slow-moving demand.
  • Picking convenience.
  • Lot and expiry requirements.
  • Replenishment needs.
  • Warehouse travel distance.

For example, frequently ordered products may be stored near packing areas, while reserve stock may occupy higher racks or less accessible locations.

A simplified putaway decision can be represented as:

[ \text{Score}(l) = w_1 C_l + w_2 P_l + w_3 D_l + w_4 S_l ]

Where:

  • (l) is a candidate location.
  • (C_l) represents capacity suitability.
  • (P_l) represents product compatibility.
  • (D_l) represents demand-based suitability.
  • (S_l) represents storage-policy compliance.
  • (w_1, w_2, w_3, w_4) are business-defined weights.

This is an illustrative scoring model, not a universal warehouse algorithm. Hard constraints such as hazardous-material separation must be enforced before ranking candidate locations.

Putaway workflow

flowchart TD
    A["Receiving Completed"] --> B["Identify SKU and Handling Unit"]
    B --> C["Find Eligible Locations"]
    C --> D{"Suitable Location Found?"}
    D -- Yes --> E["Create Putaway Task"]
    E --> F["Worker Moves Goods"]
    F --> G["Scan Source and Destination"]
    G --> H["Commit Location Transfer"]
    D -- No --> I["Exception Queue or Overflow Area"]

A key design rule is to update the location balance only after the move is confirmed according to the warehouse's operational policy. Creating a task does not necessarily mean the goods have already moved.

6. Picking Strategies

Picking is the process of retrieving goods to fulfill demand.

The best picking strategy depends on order volume, warehouse layout, product mix, equipment, and service-level commitments.

6.1 Discrete picking

A worker picks one order at a time.

Advantages:

  • Simple to implement.
  • Easy to trace order-level progress.
  • Suitable for low-volume operations.

Disadvantages:

  • Repeated travel across the warehouse.
  • Lower efficiency when many orders contain similar products.

6.2 Batch picking

A worker picks items for multiple orders in one trip.

For example, instead of visiting the same bin for five separate orders, a worker collects the combined demand and sorts the units afterward.

6.3 Zone picking

The warehouse is divided into zones. Workers pick items within their assigned zones, and orders or totes move between zones as required.

This can reduce travel and allow workers to specialize in specific areas.

6.4 Wave picking

Orders are released in planned groups, or waves, based on criteria such as carrier cutoff time, destination, priority, or available labor.

Wave planning may coordinate picking with packing capacity, replenishment, and shipping schedules.

6.5 Picking method comparison

Strategy Best fit Main trade-off
Discrete Low order volume or simple operations More travel per order
Batch Many orders with overlapping SKUs Requires sorting and order allocation
Zone Large warehouses with distinct areas Requires coordination across zones
Wave Time-based shipping and cutoff requirements Less flexible after a wave is released
Cluster Several orders picked into separate compartments on one cart Requires accurate compartment and scan validation

Many production warehouses combine multiple strategies.

7. Replenishment

Replenishment moves stock from reserve storage into picking locations.

A picking bin may be empty even though the warehouse contains plenty of stock in reserve. Without replenishment, the picking process can stall.

A basic replenishment policy can use a minimum and maximum quantity:

[ Q_{\text{replenish}} = \max(0, Q_{\text{target}} - Q_{\text{pick-bin}}) ]

The WMS should additionally check:

  • Whether reserve stock is available.
  • Whether stock is eligible for the target location.
  • Whether the replenishment task is already active.
  • Whether another task has committed the same source stock.
  • Whether replenishment is urgent enough to interrupt current work.

Replenishment can be demand-driven, threshold-based, scheduled, or triggered by a picking shortage.

8. Packing and Shipping

After picking, items must be verified and prepared for shipment.

A common packing workflow includes:

  1. Scan the tote or order.
  2. Verify every required item.
  3. Detect missing, extra, or incorrect products.
  4. Select an appropriate package.
  5. Record package dimensions and weight where required.
  6. Generate shipping labels and documentation.
  7. Associate package identifiers with the order.
  8. Confirm shipment handoff to the carrier.
  9. Publish shipment status updates.

Important distinction: packed vs. shipped

An order is not necessarily shipped when a label is printed.

The WMS should distinguish operational milestones such as:

  • Picking completed.
  • Packing completed.
  • Shipment label created.
  • Shipment manifested.
  • Carrier handoff confirmed.

The OMS may present a simplified customer-facing status, but internal systems should preserve the more precise operational states.

Multiple packages

A single order can produce several packages. Therefore, shipment modeling should not assume a strict one-order-to-one-package relationship.

A suitable relationship is:

Order
  └── Fulfillment
      ├── Package 1
      │   ├── Item A
      │   └── Item B
      └── Package 2
          └── Item C

Each package may have its own tracking number, dimensions, weight, and carrier status.

9. Returns and Reverse Logistics

Returned goods must be evaluated before they re-enter sellable inventory.

A return workflow may include:

  1. Receive the returned package.
  2. Identify the original order and return authorization.
  3. Scan the returned SKU and quantity.
  4. Inspect product condition.
  5. Determine disposition.
  6. Move accepted goods to an appropriate location.
  7. Update inventory and return records.
  8. Notify the returns or order management service.

Possible dispositions include:

  • Return to sellable inventory.
  • Send to refurbishment.
  • Place in quarantine.
  • Return to supplier.
  • Mark as damaged.
  • Dispose of according to policy.

The WMS should not automatically add every returned unit to sellable stock. Inspection and disposition rules protect inventory accuracy and customer safety.

10. Cycle Counting and Inventory Accuracy

Cycle counting verifies recorded inventory against physical stock.

Instead of closing an entire warehouse for an annual count, an organization can count selected products or locations continuously.

Common methods include:

  • ABC-based counting, where high-value or fast-moving products are counted more frequently.
  • Location-based counting.
  • Random sampling.
  • Event-triggered counts after repeated discrepancies.
  • Directed counts when pickers discover a shortage.

A count process typically includes:

  1. Generate a count task.
  2. Identify the target location and SKU.
  3. Capture the physical quantity.
  4. Compare the result with the recorded balance.
  5. Investigate discrepancies according to policy.
  6. Approve an adjustment if required.
  7. Record the reason, actor, and audit trail.

Inventory adjustments should be controlled business transactions. Avoid allowing arbitrary updates to stock balances without a reason code and traceable record.

11. WMS High-Level Architecture

A warehouse platform often contains several logical components.

flowchart TB
    OMS["Order Management System"]
    IMS["Inventory Management Service"]
    ERP["ERP and Procurement"]
    TMS["Transportation Management System"]

    subgraph WMS["Warehouse Management Platform"]
        API["API Gateway / WMS API"]
        ORDER["Fulfillment Work Manager"]
        INBOUND["Receiving and Putaway"]
        STOCK["Warehouse Inventory and Locations"]
        PICK["Picking and Replenishment"]
        PACK["Packing and Shipping"]
        COUNT["Cycle Count and Adjustments"]
        TASK["Task Assignment and Work Queues"]
        DB[("WMS Operational Database")]
        OUTBOX["Transactional Outbox"]
    end

    DEV["Scanners, Mobile Devices, Automation"]
    BUS["Event Broker"]

    OMS --> API
    ERP --> API
    API --> ORDER
    API --> INBOUND
    INBOUND --> STOCK
    ORDER --> PICK
    PICK --> TASK
    TASK --> DEV
    DEV --> PACK
    COUNT --> STOCK
    PACK --> DB
    INBOUND --> DB
    STOCK --> DB
    PICK --> DB
    DB --> OUTBOX
    OUTBOX --> BUS
    BUS --> IMS
    BUS --> OMS
    PACK --> TMS

This diagram illustrates logical responsibilities. In a smaller deployment, several components may be implemented in one Spring Boot application. In a larger warehouse network, the system may be divided into multiple services or integrated with a commercial WMS product.

Key components

WMS API: Exposes authenticated operations for receiving, movement, picking, packing, and task execution.

Fulfillment work manager: Accepts fulfillment requests and coordinates warehouse work.

Receiving and putaway: Records incoming goods and assigns storage destinations.

Warehouse inventory and locations: Maintains warehouse-level quantities, locations, handling units, and movements.

Picking and replenishment: Creates work to satisfy demand and keep picking bins stocked.

Task assignment: Assigns work based on priority, worker permissions, zone, equipment, and operational rules.

Packing and shipping: Verifies picked goods and prepares outbound packages.

Cycle count and adjustments: Controls physical verification and inventory corrections.

Event broker and outbox: Distributes reliable business events to external systems.

12. Core WMS Data Model

A practical data model separates products, physical locations, inventory balances, warehouse tasks, and movements.

Main entities

Entity Purpose
warehouse Represents a physical warehouse
warehouse_location Defines zones, bins, and other locations
sku Represents a product identifier
handling_unit Represents a carton, pallet, tote, or similar unit
inventory_balance Stores quantity by SKU, location, and relevant inventory dimensions
inventory_movement Records stock movement and adjustment history
receiving Tracks inbound receipt processing
putaway_task Tracks movement from receiving to storage
fulfillment_request Represents demand sent to the warehouse
pick_task Tracks item retrieval work
package Represents an outbound physical package
shipment Tracks dispatch and carrier handoff
cycle_count Records physical count activity
warehouse_task Represents assignable warehouse work

Entity relationship diagram

erDiagram
    WAREHOUSE ||--o{ WAREHOUSE_LOCATION : contains
    WAREHOUSE_LOCATION ||--o{ INVENTORY_BALANCE : stores
    SKU ||--o{ INVENTORY_BALANCE : identifies
    HANDLING_UNIT ||--o{ INVENTORY_BALANCE : groups
    WAREHOUSE ||--o{ RECEIVING : processes
    RECEIVING ||--o{ WAREHOUSE_TASK : generates
    FULFILLMENT_REQUEST ||--o{ PICK_TASK : creates
    PICK_TASK ||--o{ INVENTORY_MOVEMENT : records
    INVENTORY_BALANCE ||--o{ INVENTORY_MOVEMENT : changes
    FULFILLMENT_REQUEST ||--o{ PACKAGE : produces
    PACKAGE ||--o{ SHIPMENT : ships
    WAREHOUSE_LOCATION ||--o{ CYCLE_COUNT : counted_at

This is a conceptual model. A production implementation may use separate fulfillment, package, and shipment entities with more detailed relationships.

Inventory balance dimensions

A simple balance might use:

warehouse_id
location_id
sku_id
lot_id
inventory_status
quantity_on_hand
quantity_reserved
version
updated_at

Not every warehouse needs every dimension. Lot, serial, expiry, ownership, and inventory status should be included where business or regulatory requirements demand them.

A balance should not rely on sku_id alone. The same SKU can exist in several warehouses, locations, lots, and stock conditions.

Movement ledger

Inventory movements provide an audit trail for changes such as:

  • Receiving into a warehouse.
  • Putaway from receiving to storage.
  • Replenishment between bins.
  • Picking for an order.
  • Moving damaged goods into quarantine.
  • Approved inventory adjustments.
  • Transfer between warehouses.

A movement record should capture the source, destination, SKU, quantity, business reference, actor or device, timestamp, and movement reason.

Balances support efficient operational queries; movement history supports reconciliation, investigation, and audit.

13. Warehouse Task Lifecycle

Warehouse tasks need explicit state transitions.

A common task lifecycle is:

stateDiagram-v2
    [*] --> Created
    Created --> Ready
    Ready --> Assigned
    Assigned --> InProgress
    InProgress --> Completed
    Assigned --> Ready: Reassignment
    InProgress --> Exception: Blocked or discrepancy
    Exception --> Ready: Resolved
    Exception --> Cancelled: Authorized cancellation
    Created --> Cancelled: Cancelled before execution
    Completed --> [*]
    Cancelled --> [*]

Real implementations may use different states and transition rules.

Important design rules

  • Do not allow a completed task to be completed again with different results.
  • Validate the current state before every transition.
  • Record who performed each action.
  • Store timestamps for assignment, start, completion, and exceptions.
  • Support controlled reassignment when workers or devices become unavailable.
  • Preserve a task's business reference, such as receipt, order, or replenishment request.
  • Use idempotency keys for scanner requests that may be retried.

A task should not be considered complete merely because a mobile device sent a request. The backend must validate and commit the corresponding business operation.

14. API Design for a WMS

APIs should represent warehouse operations as explicit business commands.

Example endpoints:

POST /api/v1/receipts
POST /api/v1/receipts/{receiptId}/confirm
POST /api/v1/putaway-tasks
POST /api/v1/tasks/{taskId}/assign
POST /api/v1/tasks/{taskId}/start
POST /api/v1/tasks/{taskId}/complete
POST /api/v1/pick-tasks/{taskId}/confirm
POST /api/v1/packages
POST /api/v1/shipments/{shipmentId}/dispatch
POST /api/v1/cycle-counts
POST /api/v1/cycle-counts/{countId}/submit

A task completion request could contain:

{
  "taskId": "TASK-10042",
  "workerId": "WORKER-21",
  "sku": "LAPTOP-001",
  "quantity": 2,
  "sourceLocation": "A-03-B01",
  "destinationLocation": "PACK-STATION-02",
  "idempotencyKey": "scanner-42-request-781"
}

The backend should verify that the task exists, the worker is authorized, the requested quantity is valid, the source location is correct, and the operation is permitted in the current state.

An idempotency key should be persisted and associated with the operation result. Repeated requests using the same key should return a consistent result rather than repeating the stock movement.

API design considerations

  • Use appropriate HTTP status codes.
  • Validate quantities, identifiers, and state transitions.
  • Return stable error codes that scanner applications can interpret.
  • Support pagination for task lists and inventory queries.
  • Include correlation IDs for distributed tracing.
  • Apply authorization at the warehouse, zone, and task level where necessary.
  • Avoid exposing internal database entities directly as public API contracts.

15. Implementing a Warehouse Task with Java and Spring Boot

The following example demonstrates a small domain service for completing a warehouse task. It focuses on the business operation rather than a complete production application.

15.1 Define the task states

public enum WarehouseTaskStatus {
    CREATED,
    READY,
    ASSIGNED,
    IN_PROGRESS,
    COMPLETED,
    EXCEPTION,
    CANCELLED
}

15.2 Define a task entity

import jakarta.persistence.*;
import java.time.Instant;

@Entity
@Table(name = "warehouse_task")
public class WarehouseTask {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String warehouseId;

    @Column(nullable = false)
    private String taskType;

    @Column(nullable = false)
    private String referenceId;

    @Enumerated(EnumType.STRING)
    @Column(nullable = false)
    private WarehouseTaskStatus status;

    private String assignedWorkerId;
    private Instant completedAt;

    @Version
    private Long version;

    protected WarehouseTask() {}

    public void complete(String workerId) {
        if (status != WarehouseTaskStatus.IN_PROGRESS) {
            throw new IllegalStateException(
                "Only in-progress tasks can be completed"
            );
        }

        if (assignedWorkerId != null
                && !assignedWorkerId.equals(workerId)) {
            throw new IllegalStateException(
                "Task is assigned to another worker"
            );
        }

        status = WarehouseTaskStatus.COMPLETED;
        completedAt = Instant.now();
    }

    public Long getId() {
        return id;
    }

    public WarehouseTaskStatus getStatus() {
        return status;
    }

    public String getAssignedWorkerId() {
        return assignedWorkerId;
    }
}

The @Version field enables optimistic locking. It can detect concurrent updates to the same task, provided the application handles optimistic-lock failures appropriately.

This example is intentionally simplified. Production systems should also validate worker permissions, warehouse scope, task type, quantity, source and destination locations, and associated inventory movements.

15.3 Repository

import org.springframework.data.jpa.repository.JpaRepository;

public interface WarehouseTaskRepository
        extends JpaRepository<WarehouseTask, Long> {
}

15.4 Service layer

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class WarehouseTaskService {

    private final WarehouseTaskRepository taskRepository;

    public WarehouseTaskService(
            WarehouseTaskRepository taskRepository) {
        this.taskRepository = taskRepository;
    }

    @Transactional
    public void completeTask(Long taskId, String workerId) {
        WarehouseTask task = taskRepository.findById(taskId)
            .orElseThrow(() ->
                new IllegalArgumentException("Task not found"));

        task.complete(workerId);

        // JPA persists the updated entity within the transaction.
        // The transaction commits when the method completes successfully.
    }
}

The task transition is handled inside a transaction. However, task completion in a real WMS usually includes additional work: recording movement details, validating inventory, writing audit records, and publishing an event through a transactional outbox.

A task must not be marked completed if its required inventory operation fails.

15.5 Controller

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/tasks")
public class WarehouseTaskController {

    private final WarehouseTaskService taskService;

    public WarehouseTaskController(
            WarehouseTaskService taskService) {
        this.taskService = taskService;
    }

    @PostMapping("/{taskId}/complete")
    public ResponseEntity<Void> complete(
            @PathVariable Long taskId,
            @RequestHeader("X-Worker-Id") String workerId) {

        taskService.completeTask(taskId, workerId);
        return ResponseEntity.noContent().build();
    }
}

The header is shown for illustration only. A production application should derive the authenticated worker identity from a validated security principal rather than trusting a caller-supplied identity header.

16. Inventory Movement: Avoiding Incorrect Updates

Suppose a worker moves 10 units from receiving location RECEIVING-01 to storage location A-03-B01.

A correct operation should:

  1. Validate the source and destination locations.
  2. Validate the quantity and SKU.
  3. Verify sufficient eligible stock at the source.
  4. Decrease the source balance.
  5. Increase the destination balance.
  6. Record the movement.
  7. Complete the associated task.
  8. Commit the related changes atomically.

If the source decrement succeeds but the destination increment fails, the system must not leave the warehouse inventory in an inconsistent state.

For a relational database, a transaction can coordinate balance updates and movement records when those records share the same transactional boundary.

A conditional update can prevent a negative source balance:

UPDATE inventory_balance
SET quantity_on_hand = quantity_on_hand - :quantity,
    version = version + 1
WHERE warehouse_id = :warehouseId
  AND location_id = :sourceLocation
  AND sku_id = :sku
  AND quantity_on_hand >= :quantity;

The application must verify that exactly one row was updated. If zero rows were updated, the stock may be insufficient, the balance may not exist, or another transaction may have changed the data.

Next, the destination balance and movement record should be updated in the same database transaction. If any required operation fails, roll back the entire transaction.

Movement ledger example

CREATE TABLE inventory_movement (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    warehouse_id VARCHAR(50) NOT NULL,
    sku_id VARCHAR(100) NOT NULL,
    source_location_id VARCHAR(100),
    destination_location_id VARCHAR(100),
    quantity INTEGER NOT NULL CHECK (quantity > 0),
    movement_type VARCHAR(40) NOT NULL,
    reference_id VARCHAR(100),
    idempotency_key VARCHAR(150) NOT NULL UNIQUE,
    performed_by VARCHAR(100) NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

The unique idempotency key helps prevent the same logical movement from being applied twice. Its scope and lifecycle must be designed to match the business operation.

For complex warehouse workflows, task state changes, inventory balance changes, and movement history should be coordinated by a clearly defined transaction boundary.

17. Event-Driven Integration

WMS platforms integrate with OMS, inventory services, ERP, carrier systems, and warehouse automation.

Typical business events include:

  • ReceiptConfirmed
  • InventoryPutawayCompleted
  • InventoryMoved
  • ReplenishmentCompleted
  • PickTaskCompleted
  • PackingCompleted
  • ShipmentDispatched
  • CycleCountCompleted
  • InventoryAdjustmentApproved

An event might look like:

{
  "eventId": "evt-7f2d91",
  "eventType": "ShipmentDispatched",
  "eventVersion": 1,
  "occurredAt": "2026-06-24T14:30:00Z",
  "warehouseId": "WH-TX-01",
  "orderId": "ORD-90021",
  "shipmentId": "SHP-50018",
  "packageId": "PKG-50018-01"
}

This payload is illustrative. A production event contract should specify required fields, versioning rules, identity, and the meaning of each status.

Example integration flow

sequenceDiagram
    participant OMS as Order Management
    participant WMS as Warehouse Management
    participant DB as WMS Database
    participant OB as Outbox Publisher
    participant BUS as Event Broker
    participant IMS as Inventory Service

    OMS->>WMS: Create fulfillment request
    WMS->>DB: Save request and work tasks
    WMS->>DB: Commit transaction
    DB-->>OB: Outbox record available
    OB->>BUS: Publish FulfillmentAccepted
    BUS->>IMS: Deliver event
    IMS->>IMS: Process idempotently

The transactional outbox pattern stores the business update and event record in the same database transaction. A separate publisher sends committed outbox records to the event broker.

This reduces the risk of committing a warehouse operation while losing the corresponding event. Because delivery may happen more than once, consumers still need idempotent processing.

Event-processing rules

  • Use stable event IDs.
  • Include event schema versions.
  • Design consumers to handle duplicates.
  • Retry transient failures with bounded backoff.
  • Route repeatedly failing events to a dead-letter mechanism.
  • Monitor consumer lag and publication delays.
  • Preserve event ordering where the business requires it.
  • Define which system owns each status and inventory fact.

An event is evidence that a business transition occurred. It should not be treated as an unrestricted command to overwrite another system's state.

18. Distributed Transactions and Consistency

Warehouse workflows often span several systems. A shipment can involve WMS task completion, inventory updates, carrier integration, OMS status updates, and customer notifications.

A single ACID database transaction cannot normally cover all those independent systems.

Use a combination of:

  • Local database transactions for atomic changes within a service.
  • Transactional outbox for reliable event publication.
  • Idempotent consumers for duplicate delivery.
  • Explicit workflow state for long-running processes.
  • Retries and reconciliation for transient failures.
  • Saga-style coordination when a business process spans services.

For example, if the WMS completes packing but a carrier service is temporarily unavailable, the package should remain in an appropriate state such as PACKED or LABEL_PENDING. The system should retry carrier processing without creating duplicate packages or falsely claiming that the carrier has received the shipment.

Avoid pretending that distributed operations are atomic when they are not. Model intermediate states and recovery actions explicitly.

19. Warehouse Devices and Automation

Modern warehouses can include:

  • Barcode scanners.
  • RFID readers.
  • Mobile handheld devices.
  • Label printers.
  • Weigh scales.
  • Conveyor systems.
  • Sortation equipment.
  • Autonomous mobile robots.
  • Automated storage and retrieval systems.
  • Warehouse control systems (WCS).

The WMS typically manages business-level warehouse tasks, while a WCS or equipment-control platform may coordinate machine-level actions. Exact boundaries vary with the automation vendor and architecture.

Scanner interaction pattern

A scanner workflow may be:

  1. Worker scans a location.
  2. Worker scans an item or handling unit.
  3. Device submits a command to the WMS.
  4. WMS validates the task and inventory.
  5. WMS commits the operation.
  6. Device receives a success or actionable error response.

Device reliability considerations

  • Scanners may submit duplicate requests after a timeout.
  • Wi-Fi coverage can be inconsistent.
  • Operators may scan the wrong bin or SKU.
  • Devices may reconnect after being offline.
  • A task may be reassigned while a device still displays stale information.

Use server-side validation, idempotency keys, explicit task versions, and understandable error messages. For offline operation, define which actions may be queued and how conflicting changes are reconciled when connectivity returns.

20. Security and Auditability

Warehouse systems can affect high-value inventory, customer orders, supplier records, and shipping operations.

Important controls include:

  • Authentication for employees and service accounts.
  • Role-based access control.
  • Warehouse and zone-level authorization.
  • Least-privilege permissions.
  • Separation of duties for sensitive inventory adjustments.
  • Approval workflows for exceptional movements.
  • Audit records for receiving, picking, counting, and dispatch.
  • Encryption in transit and at rest.
  • Secret management for external integrations.
  • Device enrollment and revocation.
  • Protection against duplicate or replayed commands.
  • Controlled access to customer shipping information.

A picker may be permitted to confirm assigned picking tasks but not approve inventory write-offs. A supervisor may authorize certain adjustments, while a warehouse administrator manages locations and operational configuration.

Audit records should capture the actor, action, business reference, relevant before-and-after values, timestamp, and reason where applicable.

21. Performance and Scalability

Warehouse performance is affected by both software throughput and physical operations.

A WMS must often handle high volumes of short-lived scanner requests while also processing inventory movements, task assignments, carrier responses, and event streams.

Database considerations

  • Index inventory balances by warehouse, location, and SKU.
  • Index task queues by status, priority, and assignment.
  • Use appropriate unique constraints for idempotency.
  • Avoid unbounded queries for open tasks.
  • Keep transactional operations short.
  • Use pagination for operational lists.
  • Monitor hot rows and lock contention.
  • Partition or archive high-volume movement history when justified by measured growth.

Concurrency

Multiple workers may try to pick the same stock, complete the same task, or move inventory from the same bin.

Use optimistic locking, conditional updates, appropriate row locking, or other database concurrency controls. Choose based on the workload and the consistency guarantees required.

For high-contention inventory operations, carefully designed atomic updates are safer than reading a quantity into application memory and writing back a calculated value without concurrency protection.

Scaling strategies

  • Scale stateless API instances horizontally.
  • Separate high-volume reporting from operational transactions.
  • Use queues for asynchronous integration work.
  • Apply backpressure when downstream systems are overloaded.
  • Batch non-interactive processing where it improves efficiency.
  • Avoid excessive synchronous calls in scanner-critical paths.
  • Use caching for relatively stable reference data, not as the sole authority for stock mutations.

Do not optimize for theoretical throughput alone. Warehouse systems must balance speed, traceability, physical accuracy, and recovery behavior.

22. Reliability and Exception Handling

Warehouse operations encounter many exceptions:

  • A received shipment is short.
  • A product is damaged.
  • A bin is empty despite recorded stock.
  • A picker scans the wrong item.
  • A package exceeds a carrier's weight limit.
  • A label service is unavailable.
  • A worker's device disconnects.
  • An automation system cannot move a tote.
  • An order is cancelled after picking starts.

These cases should be represented as explicit operational states or exceptions rather than hidden inside logs.

A useful exception record includes:

exception_id
warehouse_id
task_id
exception_type
severity
status
reported_by
reported_at
resolution
resolved_by
resolved_at

The resolution process may require a recount, supervisor approval, task reassignment, inventory adjustment, or a retry of a failed external operation.

Reliability practices

  • Use timeouts on external service calls.
  • Retry transient errors, not every error.
  • Make retryable commands idempotent.
  • Avoid retry loops that overwhelm downstream services.
  • Preserve failed tasks for investigation.
  • Provide controlled recovery and replay mechanisms.
  • Reconcile WMS, IMS, and OMS records regularly.
  • Alert on accumulating exception queues and stalled tasks.

A system that returns an error without giving warehouse staff a safe next step is operationally incomplete.

23. Observability and Business Metrics

Technical monitoring alone cannot show whether warehouse operations are healthy.

Technical metrics

  • API latency and error rates.
  • Database connection utilization.
  • Transaction rollback rate.
  • Lock waits and deadlocks.
  • Event publication failures.
  • Consumer lag.
  • External carrier integration failures.
  • Scanner request retries.
  • Task-processing backlog.

Operational metrics

  • Receiving throughput.
  • Putaway completion time.
  • Picking accuracy.
  • Units picked per labor hour.
  • Order fulfillment cycle time.
  • Packing throughput.
  • On-time dispatch rate.
  • Inventory record accuracy.
  • Cycle count variance.
  • Replenishment delay.
  • Exception resolution time.

Use correlation IDs to connect scanner requests, warehouse tasks, inventory movements, and downstream events.

Dashboards should distinguish technical failures from physical-process delays. For example, a growing picking backlog might be caused by insufficient replenishment, not API latency.

24. Common WMS Design Mistakes

Mistake 1: Treating the warehouse as one inventory quantity

A warehouse can have multiple locations, lots, conditions, and handling units. A single quantity per SKU cannot support accurate execution.

Better approach: Model stock at the appropriate physical and business dimensions.

Mistake 2: Treating task creation as task completion

Creating a pick task does not mean the product has been picked.

Better approach: Record task transitions and physical confirmations separately.

Mistake 3: Allowing arbitrary stock updates

Uncontrolled balance updates destroy traceability.

Better approach: Use movement transactions, approved adjustments, and audit records.

Mistake 4: Ignoring duplicate scanner requests

Network timeouts can cause a device to resend a command after the first request already succeeded.

Better approach: Persist idempotency keys and return the original operation result for duplicate requests.

Mistake 5: Publishing events before the database transaction commits

A downstream service may process an event for a warehouse operation that later rolls back.

Better approach: Use a transactional outbox or another reliable publication strategy.

Mistake 6: Assuming packed means shipped

A package can be packed and labeled without having been handed to a carrier.

Better approach: Represent packing, manifesting, and dispatch as distinct milestones.

Mistake 7: Ignoring warehouse exceptions

Real operations include discrepancies, damaged products, and blocked tasks.

Better approach: Build exception queues, ownership, resolution actions, and auditability into the workflow.

Mistake 8: Overengineering too early

Not every warehouse needs dozens of microservices, AI-driven slotting, or autonomous robots.

Better approach: Start with clear domain boundaries, correct transactions, and measurable operational needs. Introduce additional services and automation when scale and requirements justify them.

25. Hands-on Project: Build a Mini WMS

Build a warehouse application using Java, Spring Boot, PostgreSQL, and a message broker such as Kafka or RabbitMQ.

Functional requirements

  1. Create warehouses and storage locations.
  2. Register SKUs and handling units.
  3. Receive supplier shipments.
  4. Record quantity discrepancies and damaged stock.
  5. Generate putaway tasks.
  6. Move inventory between locations.
  7. Create fulfillment requests from the OMS.
  8. Generate picking tasks.
  9. Confirm picks using scanner-style APIs.
  10. Pack order items into one or more packages.
  11. Record shipment dispatch.
  12. Perform cycle counts and approved adjustments.
  13. Publish events for inventory and fulfillment changes.
  14. Maintain audit records and support exception resolution.

Suggested database tables

warehouse
warehouse_location
sku
handling_unit
inventory_balance
inventory_movement
receipt
receipt_line
warehouse_task
putaway_task
fulfillment_request
fulfillment_line
pick_task
pick_task_line
package
package_line
shipment
cycle_count
cycle_count_line
inventory_adjustment
idempotency_record
outbox_event
audit_log

Use separate tables only when they represent meaningful domain entities. For a learning project, some task types can share a common task table with type-specific details.

Suggested API endpoints

POST /api/v1/warehouses
POST /api/v1/locations
POST /api/v1/receipts
POST /api/v1/receipts/{receiptId}/confirm
POST /api/v1/putaway-tasks/{taskId}/complete
GET  /api/v1/inventory?warehouseId=WH-01&sku=SKU-100
POST /api/v1/fulfillment-requests
POST /api/v1/pick-tasks/{taskId}/confirm
POST /api/v1/packages
POST /api/v1/shipments/{shipmentId}/dispatch
POST /api/v1/cycle-counts
POST /api/v1/cycle-counts/{countId}/submit

Implementation phases

Phase 1: Domain and persistence

  • Create the Spring Boot project.
  • Define the core entities and relationships.
  • Implement warehouse, location, and SKU APIs.
  • Add database migrations and validation.

Phase 2: Receiving and putaway

  • Implement receipt processing.
  • Record expected versus actual quantities.
  • Generate putaway tasks.
  • Record inventory movements atomically.

Phase 3: Picking and packing

  • Accept fulfillment requests.
  • Create pick tasks.
  • Confirm quantities and locations.
  • Model packages and shipment states.

Phase 4: Reliability and integration

  • Add idempotency.
  • Add optimistic locking or conditional inventory updates.
  • Implement the transactional outbox.
  • Publish warehouse events.
  • Add retry handling and exception workflows.

Phase 5: Production readiness

  • Add authentication and authorization.
  • Write integration and concurrency tests.
  • Add structured logs, metrics, and tracing.
  • Test duplicate scanner submissions.
  • Test failures between inventory updates and event publication.
  • Load-test task queues and inventory operations.

Test scenarios

  • Two workers attempt to pick the final unit of a SKU.
  • The same task-completion request is submitted twice.
  • A receiving shipment contains fewer units than expected.
  • A destination bin has insufficient capacity.
  • A worker scans an unauthorized location.
  • The carrier API fails after packing completes.
  • An event is delivered twice.
  • A cycle count detects a discrepancy while inventory is moving.
  • A device reconnects and submits a stale task version.

These scenarios reveal whether the system protects inventory correctness under real operational conditions.

26. What to Practice

Use this checklist to evaluate your understanding.

  • Explain the difference between WMS, IMS, OMS, and TMS.
  • Model a warehouse hierarchy with zones, aisles, racks, and bins.
  • Design receiving, putaway, picking, packing, and shipping workflows.
  • Explain discrete, batch, zone, and wave picking.
  • Model inventory by warehouse, location, SKU, and relevant stock dimensions.
  • Design a warehouse task state machine.
  • Implement a stock movement using a database transaction.
  • Prevent duplicate commands with idempotency keys.
  • Handle concurrent inventory updates safely.
  • Publish reliable events using a transactional outbox.
  • Design cycle counting and inventory adjustment workflows.
  • Define exception handling for damaged, missing, and misplaced goods.
  • Identify warehouse-specific security controls.
  • Create dashboards for inventory accuracy and fulfillment performance.
  • Explain how a WMS integrates with scanners, carrier APIs, and automation systems.

27. Interview Questions

Beginner

  1. What is a Warehouse Management System?
  2. What is the difference between a WMS and an Inventory Management System?
  3. What is putaway?
  4. What is replenishment?
  5. What is the difference between picking and packing?
  6. What is cycle counting?

Intermediate

  1. How would you model warehouse locations and inventory balances?
  2. How would you prevent two workers from picking the same stock?
  3. How would you design a warehouse task state machine?
  4. How do batch picking and zone picking differ?
  5. How would you handle damaged goods during receiving?
  6. How would you model partial shipments and multiple packages?
  7. How would you integrate a WMS with an OMS and a carrier service?
  8. Why are idempotency keys important for scanner APIs?

Advanced

  1. How would you maintain inventory consistency across WMS and IMS?
  2. How would you implement reliable event publication after a warehouse transaction?
  3. How would you recover from a failure between packing completion and carrier dispatch?
  4. How would you design a WMS for several warehouses across multiple regions?
  5. How would you scale task assignment and inventory updates under high concurrency?
  6. How would you reconcile discrepancies between physical stock and system records?
  7. How would you integrate autonomous robots without tightly coupling the WMS to a specific vendor?
  8. Which business metrics would you use to measure warehouse efficiency?

28. Key Takeaways

  • A WMS manages the physical execution of warehouse operations.
  • Warehouse inventory must be modeled with enough detail to represent locations, handling units, and stock conditions.
  • Receiving, putaway, replenishment, picking, packing, shipping, returns, and cycle counting are distinct workflows.
  • Task creation and physical task completion are different business events.
  • Inventory movement should be transactional, traceable, and protected against concurrent updates.
  • Scanner APIs need validation, authorization, and idempotency.
  • Event-driven integration helps connect WMS, OMS, IMS, ERP, and TMS, but requires explicit consistency and recovery strategies.
  • Warehouse automation introduces device and equipment integration concerns beyond ordinary web APIs.
  • Operational exception handling and inventory accuracy are as important as throughput.
  • A strong WMS architecture balances physical workflow efficiency, reliable data, security, scalability, and recoverability.

Was this guide helpful?

CodeWithVenu is free to read, with no paywall. If this guide saved you time or helped you prepare, a small voluntary contribution helps me write more practical tutorials, architecture guides, and interview-prep content.