Data and states
What values change in the case of a replacement and a later restocking?
The interfaces require a authoritative data state. P denotes the shelf forecast in packs, Z the still unpicked online allocations. The display calculates max(0,P−Z). After an allocation for B-17, the original applies P=1 and Z=1. Only a confirmed pick moves the pack from the shelf forecast to the goods receipt of the order.
Starting point The commands from step 4 need a authoritative shared order and goods status.
Assumptions for the example case
Own example design for pick-up from a store and packaged piece goods with strictly positive integer cent prices. Free and fully discounted baskets are outside the case. Replacement items are specifically allowed in advance; the final positive amount arises from goods actually provided and is collected on collection. Figures and target values are illustrative design assumptions.
The package shall change its proof
P, Z and pick · each pack retains domain evidence
Original pick · a transactionP−1 · Z−1 · Pick +1
Replacement pick · a transactionOriginal empty: P=0,Z−1 · Replacement: P−1 · Pick A-11
The substitute pick corrects the original shortage to P=0, releases its allocation and records the substitute stock decrease. Subsequent restocking increases only A-11, at most once, after physical confirmation.
Entities and Authoritative relationships
| Entity | Authoritative fields | Relationship and purpose |
|---|---|---|
| Order | Store, version, condition, frozen amount | Connects order lines, payment and issuance of a store. |
| Order line | Original, Quantity, Replacement Release, Conclusion | Ends as picked or left out. |
| Allocation | Item, article, open quantity | Forms Z as the sum of active unpicked allocations. |
| Picking record | Items, quantity, positive cent price, restocking status | Evidences the goods actually picked and any later restocking. |
| Stock movement | Source, event identifier, sequence | Leads orderly and deduplicated store stock movements. |
| Payment instruction | E-17, B-17, frozen amount, EUR, external reference, result | Ties each confirmation to order, payment instruction, amount and currency. |
| Command result | Actor, operation, order, content hash, result | Makes repetitions after disconnection clear. |
| Outbox and Inbox | Order or feedback, status, deduplication | Conveys external work and accepts feedback permanently. |
Order
- Authoritative fields
- Store, version, condition, frozen amount
- Relationship and purpose
- Connects order lines, payment and issuance of a store.
Order line
- Authoritative fields
- Original, Quantity, Replacement Release, Conclusion
- Relationship and purpose
- Ends as picked or left out.
Allocation
- Authoritative fields
- Item, article, open quantity
- Relationship and purpose
- Forms Z as the sum of active unpicked allocations.
Picking record
- Authoritative fields
- Items, quantity, positive cent price, restocking status
- Relationship and purpose
- Evidences the goods actually picked and any later restocking.
Stock movement
- Authoritative fields
- Source, event identifier, sequence
- Relationship and purpose
- Leads orderly and deduplicated store stock movements.
Payment instruction
- Authoritative fields
- E-17, B-17, frozen amount, EUR, external reference, result
- Relationship and purpose
- Ties each confirmation to order, payment instruction, amount and currency.
Command result
- Authoritative fields
- Actor, operation, order, content hash, result
- Relationship and purpose
- Makes repetitions after disconnection clear.
Outbox and Inbox
- Authoritative fields
- Order or feedback, status, deduplication
- Relationship and purpose
- Conveys external work and accepts feedback permanently.
A relational transaction store supports the relationships and atomic multi-line changes of the replacement pick. An outbox contains, together with the domain change, stored orders that are still to be transmitted. An inbox contains permanently accepted feedback.
Stock rules and evidenced store reconciliation
- New allocation and confirmed pick
- A new original-item allocation atomically checks P−Z≥quantity and increases Z. A physically confirmed original pick reduces P and Z together. Delayed in-store sales can make P negative; the display remains max(0,P−Z), and the negative state requires investigation.
- Replacement protects existing allocations
- The scanned substitute satisfies the approved item, quantity and positive price. Approval also checks its P−Z≥quantity against other allocations and requires a gap-free or fully reconciled feed. Lock the order and both item rows in a stable order. The transaction sets P for the confirmed empty original shelf location to zero, releases its own allocation, records the substitute stock decrease and stores the pick record.
- Restocking needs physical confirmation
- Cancellation releases unpicked allocations without increasing P. Picked goods increase the forecast for the item actually picked exactly once, and only after confirmed return to saleable stock. Disposal completes goods resolution without increasing stock.
- Sequence of events in the inventory management
- The agreed feed supplies an event identifier and a gap-free increasing sequence for each store. It excludes online picks and their restocking so local stock movements remain unique. A sequence gap blocks new original-item commitments and substitute picks for that store until full reconciliation is complete.
- A common cut for full adjustment
- The snapshot contains lastIncludedSequence and forecast values for both items. It includes all POS movements up to that sequence watermark, plus all previously confirmed local online picks, shortage corrections and restocking. Block affected item changes while establishing this common snapshot boundary. Preserve open allocations Z; subsequent events resume at watermark plus one. An outdated inventory-system snapshot that excludes online movements must not replace P. Producing this common snapshot remains an open integration requirement.
Allowed states and transitions
| Starting point | Permitted transition | Condition or result |
|---|---|---|
| angenommen | in_kommissionierung | The store team begins the processing. |
| Accepted or in_Commissioned | bereit | All order lines are closed and at least one order line is picked; the positive amount is frozen. |
| Accepted or in_Commissioned | abbruch_in_klaerung | All order lines are omitted or the termination begins before a payment instruction. |
| bereit | abbruch_in_klaerung | Cancellation is possible before a permanently stored payment instruction. Picked goods remain bound until the confirmed restocking or disposal. |
| bereit | zahlung_offen | E-17 is permanently stored for B-17, the positive frozen amount and EUR. |
| zahlung_offen | bezahlt | An authenticated confirmation matches B-17, E-17, amount and EUR. |
| zahlung_offen | zahlung_fehlgeschlagen | The payment service confirms a definitive refusal. |
| zahlung_offen | zahlung_offen | An unknown result remains open with a visible clearing ground. |
| zahlung_fehlgeschlagen | abbruch_in_klaerung | The handover remains blocked; picked goods are clarified. |
| abbruch_in_klaerung | abgebrochen | All allocations are released, picked packs are restocked or disposed of, and evidence confirms that no charge occurred. |
| bezahlt | ausgegeben | The issuance of the same order is confirmed once. |
| bezahlt | bezahlt | Missing handover remains visible as an open customer service case. |
| Issued or terminated | terminal | More new picks, payment starts and handovers do not produce any effect; identical old repetitions provide their saved result. |
angenommen
- Permitted transition
- in_kommissionierung
- Condition or result
- The store team begins the processing.
Accepted or in_Commissioned
- Permitted transition
- bereit
- Condition or result
- All order lines are closed and at least one order line is picked; the positive amount is frozen.
Accepted or in_Commissioned
- Permitted transition
- abbruch_in_klaerung
- Condition or result
- All order lines are omitted or the termination begins before a payment instruction.
bereit
- Permitted transition
- abbruch_in_klaerung
- Condition or result
- Cancellation is possible before a permanently stored payment instruction. Picked goods remain bound until the confirmed restocking or disposal.
bereit
- Permitted transition
- zahlung_offen
- Condition or result
- E-17 is permanently stored for B-17, the positive frozen amount and EUR.
zahlung_offen
- Permitted transition
- bezahlt
- Condition or result
- An authenticated confirmation matches B-17, E-17, amount and EUR.
zahlung_offen
- Permitted transition
- zahlung_fehlgeschlagen
- Condition or result
- The payment service confirms a definitive refusal.
zahlung_offen
- Permitted transition
- zahlung_offen
- Condition or result
- An unknown result remains open with a visible clearing ground.
zahlung_fehlgeschlagen
- Permitted transition
- abbruch_in_klaerung
- Condition or result
- The handover remains blocked; picked goods are clarified.
abbruch_in_klaerung
- Permitted transition
- abgebrochen
- Condition or result
- All allocations are released, picked packs are restocked or disposed of, and evidence confirms that no charge occurred.
bezahlt
- Permitted transition
- ausgegeben
- Condition or result
- The issuance of the same order is confirmed once.
bezahlt
- Permitted transition
- bezahlt
- Condition or result
- Missing handover remains visible as an open customer service case.
Issued or terminated
- Permitted transition
- terminal
- Condition or result
- More new picks, payment starts and handovers do not produce any effect; identical old repetitions provide their saved result.
The direct transition from angenommen to bereit is a shortened main path. Cancellation does not recreate missing original stock.
Case decision and verification approach
Order, both ordered locked inventory lines, pick and command result change in a short transaction.
A replacement takes another item and at the same time ends the original allocation.
Both pages of articles must fit together after a crash. Before commit, everything remains unchanged; after commit, both changes and the result are visible.
- Alternative considered
- Sequential bookings can generate half-finished replacements.
- Trade-off
- Two item rows are briefly blocked.
- Reassess
- Measurable waiting times for replacement give rise to the investigation of lock duration and query order.
Terms in this step
- Shelf forecast P
- The locally managed forecast value per store and item.
- Open allocations Z
- The sum of active, still unpicked online allocations.
- Picking record
- The immutable evidence of actually picked items, quantity and price.
Try it yourself
Start with original P=1, Z=1 and substitute P=2, Z=0. The original shelf location is empty and the permitted substitute is picked. State all four values. Then cancel and report completed restocking of the substitute twice.
A hint for your attempt
An allocation counts unpicked goods; the restocking relates to the item actually picked.
Compare with a possible solution
- Replacement pick
- After the replacement, the original is P=0, Z=0 and the replacement is P=1, Z=0.
- Termination request
- The desire to abandon alone does not change the forecasts.
- Confirmed restocking
- The first physically confirmed restocking gives P=2 for the replacement; the repetition remains ineffective. The original remains at P=0.
Apply to your project
Which two state changes must be visible together in your draft?