System Design Atlas

Warehouse fulfilment and dynamic route planning

05 / 10Worked example

Data and states

Which changes to the picking order must apply together, and what remains protected after completion?

The contracts require a authoritative stock for picking order E-36. Stock at the storage location 5 pieces minus open allocation 3 pieces gives 2 newly allocable pieces. A confirmed pick of 3 pieces reduces stock to 2 and open allocation to 0. The route plan contains order and version, no authoritative stock figures. The state is stored together with its command result; this keeps the same change task visible after restart.

Starting point A pick binds the storage location and actual quantity.

Assumptions for the example case

Own fictitious example design. A warehouse with integer quantities, manual picking and a heuristic route recommendation. A route plan is marked as requiring rechecking at age 60 seconds and older; confirmed picks remain valid evidence. All figures and test goals are illustrative assumptions.

Authoritative data and permitted state transitions

Data and states

Picking order E-36Quantity allocated and handling status
Storage location L-36Confirmed stock and open allocations
Route plan W-36Refreshable recommendation without commitment authority
Entnahmeauftrag E-36 → Lagerplatz L-36reserved quantity in exact place
Entnahmeauftrag E-36 → Wegeplan W-36Uses a refreshable recommendation
1geplant → zugeteilt
2zugeteilt → entnommen | fehlmenge
3entnommen → bereitgestellt → abgeschlossen
4storniert | abgeschlossen (terminal)

Open allocations do not exceed available stock at the location; routes do not change commitments.

Location stock of 5 items minus open allocation of 3 items leaves 2 items available for allocation. A confirmed pick of 3 items reduces stock to 2 and open allocation to 0. The route plan contains order and version information, not authoritative stock quantities.

Domain entities and relationships

EntityAuthoritative attributesRelationship
Stock at the storage locationL-36; articles and confirmed number of piecesOpen allocations are checked against the same authoritative stock at the storage location.
Picking orderE-36; Articles, Place and QuantityThe worked path has exactly one line item and no partial picking.
Route planW-36; version and proposed place orderDerived recommendation does not change a stock commitment.
Pick recordOrder, actual quantity and scan originConsumes the allocation together with the stock reduction.

Stock at the storage location

Authoritative attributes
L-36; articles and confirmed number of pieces
Relationship
Open allocations are checked against the same authoritative stock at the storage location.

Picking order

Authoritative attributes
E-36; Articles, Place and Quantity
Relationship
The worked path has exactly one line item and no partial picking.

Route plan

Authoritative attributes
W-36; version and proposed place order
Relationship
Derived recommendation does not change a stock commitment.

Pick record

Authoritative attributes
Order, actual quantity and scan origin
Relationship
Consumes the allocation together with the stock reduction.

Permitted state transitions

Starting pointTargetPrecondition
geplantzugeteiltAll required item quantities are reserved atomically.
zugeteiltentnommenPicking confirms actual quantity at the allocated place.
zugeteiltMissing quantityThe inventory team investigates the shortage; no fictitious pick is recorded.
entnommenProvidedThe complete shipment is evidenced.
ProvidedabgeschlossenThe shipping system shall acknowledge the same transfer order.
Missing quantitystorniertRelease the allocation once after investigation.
abgeschlossen or storniertterminalFurther pick or stock release does not produce any effect.

geplant

Target
zugeteilt
Precondition
All required item quantities are reserved atomically.

zugeteilt

Target
entnommen
Precondition
Picking confirms actual quantity at the allocated place.

zugeteilt

Target
Missing quantity
Precondition
The inventory team investigates the shortage; no fictitious pick is recorded.

entnommen

Target
Provided
Precondition
The complete shipment is evidenced.

Provided

Target
abgeschlossen
Precondition
The shipping system shall acknowledge the same transfer order.

Missing quantity

Target
storniert
Precondition
Release the allocation once after investigation.

abgeschlossen or storniert

Target
terminal
Precondition
Further pick or stock release does not produce any effect.

Atomic changes and versions

Content reference
Location stock of 5 items minus open allocation of 3 items leaves 2 items available for allocation. A confirmed pick of 3 items reduces stock to 2 and open allocation to 0. The route plan contains order and version information, not authoritative stock quantities.
Shared commit
Warehouse API checks order, storage location, allocated amount, actual number of pieces and scan record and writes domain change, command result and, if applicable, pending work in a transaction. Commit means that these changes become permanently visible together. Before commit, a rollback ends the attempt without partial effect.
Concurrency
With location stock of 1 item and open allocation of 0, two allocations compete for the last item. In either winning order, exactly one wins: stock remains 1, open allocation becomes 1 and newly available stock is 0. The losing order receives no partial allocation. Only confirmed picking changes both stock and open allocation to 0 together.
Terminal completion
An identical pick reduces physical stock and its open allocation exactly once. An identical shortage cancellation releases only the open allocation once and does not increase physical stock. Completed orders remain blocked against new picks.

Cover the full scope of the case

Concrete rule
The worked path uses one line item, with either a complete pick or a complete shortage. Partial picking and relocation remain extensions. Cancelling a shortage releases the open allocation without increasing physical stock.

Derive storage needs from access patterns

Authoritative relational datastore
Open allocations are checked against the same authoritative stock at the storage location. In the elaborated path exactly one position without partial picking. The draft therefore selects a relational metadata store with uniqueness constraints and short transactions. Historical versions remain referenceable; a rebuildable read model must not overwrite the authoritative state.
Large content and measurement series
Derived views and extensive measurement or event histories are read separately according to their access patterns. Binding state decisions remain in the authoritative datastore.

Stock and open allocations change together

Stock and open allocations change together

Stock and open allocations change together.

With location stock of 1 item and open allocation of 0, two allocations compete for the last item. In either winning order, exactly one wins: stock remains 1, open allocation becomes 1 and newly available stock is 0. The losing order receives no partial allocation. Only confirmed picking changes both stock and open allocation to 0 together.

Identical pick reduces physical stock and associated open allocation exactly once. Identical shortfall cancellation releases only the open allocation once and does not increase any physical stock. Completed orders remain blocked against new pick. The exercise specifies the input and expected result.

Alternative considered
Separate unversioned changes allow an older state to overwrite the newer one.
Trade-off
Changes to picking order E-36 are briefly serialized.
Reassess
Measurable waiting times for 50 allocations on one piece at the same storage location justify a check of the transaction duration.

Try it yourself

Explain the two possible winner orders in the case contract. Also determine the behaviour after terminal completion.

A hint for your attempt

Content revision and aggregate version have different tasks.

Compare with a possible solution
Concurrency
With location stock of 1 item and open allocation of 0, two allocations compete for the last item. In either winning order, exactly one wins: stock remains 1, open allocation becomes 1 and newly available stock is 0. The losing order receives no partial allocation. Only confirmed picking changes both stock and open allocation to 0 together.
Completion
An identical pick reduces physical stock and its open allocation exactly once. An identical shortage cancellation releases only the open allocation once and does not increase physical stock. Completed orders remain blocked against new picks.

Apply to your project

Which states must remain protected in your model against late replay?

Next: The route planner must not write authoritative quantities.