Design a Warehouse Management System
MediumReal World SystemsInventoryLocation ManagementFIFO/LIFOOrder FulfillmentConcurrency
Problem Statement
Design a warehouse management system that tracks inventory locations within a warehouse, manages inbound stock receipts, picks items to fulfill outbound orders, and optimizes storage space.
Requirements
Functional Requirements
- Warehouse layout: zones, aisles, shelves, bins — each bin has a location code and capacity
- Inbound: receive stock for a product; system assigns it to an available bin
- Outbound: fulfill an order — pick items from bins (FIFO order by receipt date)
- Inventory query: how many units of product X are in warehouse?
- Location query: where is product X stored? (list of bins)
- Transfer: move stock between bins
- Low stock alerts: notify when product quantity falls below reorder threshold
- Bin occupancy: how full is each bin? Can a given quantity fit?
Non-Functional Requirements
- Thread-safe stock operations
- Singleton WarehouseService
Key Entities
- Bin: locationCode, zone, aisle, shelf, capacity, currentOccupancy, stock (List<StockLot>)
- StockLot: productId, quantity, receivedDate (for FIFO)
- Product: id, name, SKU, unit, reorderThreshold
- InboundOrder: products and quantities received
- OutboundOrder: products and quantities to ship
- WarehouseService: Singleton; manages bins, stock, picks
Constraints
- FIFO picking: oldest stock lots are picked first
- Bin cannot exceed its capacity
- Picking is atomic: all items in order picked or none
- Low stock alert fires when total product quantity < reorderThreshold
!Constraints
- FIFO stock picking: oldest lots picked first within each bin
- Bin capacity strictly enforced
- Outbound order picking is atomic (all or nothing)
- Thread-safe concurrent inbound/outbound operations
- Low stock notifications fire asynchronously
Output
Run or submit your code to see output here.