Warehouse execution (WES) · Core domain · EventStorming board

network-inventory-planning

Plans moving stock between warehouses: advises, then runs an approved transfer from stock reservation through pick, dispatch and arrival.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

events published
7
commands
16
policies
16
read models
4
hot spots
5

The story in 4 key events

The pivotal events: the few that matter most, in the order they happen.

  1. Pivotal eventTransferPlanApproved
  2. Pivotal eventTransferAllocationRequested
  3. Pivotal eventWorkDemandReleased
  4. Pivotal eventTransferAllocationReleaseRequested

Listens to (6): contexts whose events this one reacts to

Tells (2): contexts that react to its events

The board, row by row

16 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.

  • Event
  • Command
  • Actor
  • Aggregate
  • Policy
  • Read model
  • External system
  • Hot spot
  • Opportunity
  1. Keep the site capability copy

    facility-layout says which sites may send or receive transfers. Here a local copy follows it, and a newer revision replaces the older one, so planning never has to ask.

    Systemfacility-layout
    EventSiteCapabilityChanged
    PolicyWhenever a site's capability changes, replace its row if the revision is newer
    CommandApplySiteCapabilityChangedstarted by the policy
    Read model · kept up to dateSite capabilities

    Source: adapters/inbound/kafka/consumers.go · domain/planning/capability.go

  2. Keep the demand copy

    order-management reports the units each order line needs from a site. A local copy keeps the newest fact per line. A removed line counts for nothing.

    Systemorder-management
    EventSiteSkuDemandChanged
    PolicyWhenever an order line's demand changes, keep its newest version; a removed line counts for none
    CommandApplySiteSkuDemandChangedstarted by the policy
    Read model · kept up to dateSite demand per SKU

    Source: adapters/inbound/kafka/consumers.go · domain/planning/demand.go · adr/0014-site-sku-demand-ordering-guard.md

  3. Keep the capacity plan copy

    warehouse-planning publishes capacity plans. A local copy keeps the newest plan for each plan id. A plan with no site is left out.

    Systemwarehouse-planning
    EventCapacityPlanPublished
    PolicyWhenever a plan for a site is published, keep the newest version of it
    CommandApplyCapacityPlanPublishedstarted by the policy
    Read model · kept up to datePublished capacity plans

    Source: adapters/inbound/kafka/consumers_capacity_plan.go · domain/planning/capacity_plan.go

  4. Set the rebalance rules

    An operator writes the policies that say which SKUs may move, and the lanes between sites. The scheduled rebalance plans only from these catalogues. Lanes are set the same way.

    ActorOperator
    CommandPutRebalancePolicyPUT /v1/rebalance-policies
    AggregateRebalancePolicy

    Source: application/usecases/catalogue.go · domain/transfer/catalogue.go · adr/0015-rebalance-policy-and-lane-catalogue.md

  5. Try out transfers without committing

    An operator submits positions, policies and lanes and gets advisory proposals back. A simulation can instead use the local copies. Nothing is reserved or published.

    ActorOperator
    CommandGenerateTransferProposalsPOST /v1/transfer-proposal-runs

    Source: application/usecases/generate_transfer_proposals.go · application/usecases/simulate_transfer_options.go

  6. Approve a transfer and ask for stock

    An operator approves a proposal. It is checked against the local copies, and refused if a fact is missing or stale. SKUs sold in cases move in whole cases. inventory-storage is then asked for the origin stock.

    ActorOperator
    Read modelSite capabilities
    Read modelSite demand per SKU
    Read modelPublished capacity plans
    Read modelPack levels
    CommandApproveTransferPOST /v1/transfer-approvals
    AggregateInterWarehouseTransfer
    EventTransferPlanApproved
    EventTransferAllocationRequested
    EventTransferStateAdvancedanalytics stream only
    Systeminventory-storage
    PolicyReserves the origin stock and answers allocated or rejected

    Source: application/usecases/approve_transfer.go · domain/transfer/saga.go · domain/transfer/approval.go · adr/0003-transfer-saga.md

  7. Release the pick once stock is held

    inventory-storage reports the stock reserved. The transfer becomes allocated and the pick work is released in the same step, so an allocated transfer never lacks its pick work.

    Systeminventory-storage
    EventTransferStockAllocated
    PolicyWhenever origin stock is reserved, mark the transfer allocated and release its pick work
    CommandApplyTransferAllocationstarted by the policy
    AggregateInterWarehouseTransfer
    EventWorkDemandReleased
    EventTransferStateAdvancedanalytics stream only
    Systemwes-work-planning
    PolicyCreates the transfer pick as a work unit referring to the transfer

    Source: application/usecases/transfer_facts.go · adapters/inbound/kafka/transfer_reply_consumer.go · adr/0005-work-demand-release-and-fact-transitions.md

  8. Give up when stock cannot be held

    inventory-storage refuses the reservation, with a reason from a fixed list. The transfer is marked unfulfillable and ends there.

    Systeminventory-storage
    EventTransferStockAllocationRejected
    PolicyWhenever origin stock cannot be reserved, mark the transfer unfulfillable with the reason
    CommandApplyTransferRejectionstarted by the policy
    AggregateInterWarehouseTransfer
    EventTransferStateAdvancedanalytics stream only

    Source: application/usecases/approve_transfer.go · adapters/inbound/kafka/transfer_reply_consumer.go

  9. Cancel a transfer

    An operator cancels with a reason. Before any stock is held the transfer is cancelled at once. If stock is already reserved, a release is requested first. From picking onwards the cancel is refused.

    ActorOperator
    CommandCancelTransferPOST /v1/transfers/{transferId}/cancellation
    AggregateInterWarehouseTransfer
    EventTransferAllocationReleaseRequested
    EventTransferStateAdvancedanalytics stream only
    Systeminventory-storage
    PolicyLets go of the origin reservation and reports back

    Source: application/usecases/cancel_transfer.go · domain/transfer/saga.go · adr/0022-cancel-after-allocation-compensation.md

  10. Finish a cancel once the hold is gone

    inventory-storage confirms the origin reservation is released, or was already gone. Either way the hold no longer exists, so the transfer is cancelled for good.

    Systeminventory-storage
    EventTransferStockAllocationReleased
    PolicyWhenever the origin reservation is released, mark the cancelling transfer cancelled
    CommandApplyTransferAllocationReleasedstarted by the policy
    AggregateInterWarehouseTransfer
    EventTransferStateAdvancedanalytics stream only

    Source: application/usecases/apply_transfer_released.go · adapters/inbound/kafka/transfer_reply_released.go · adr/0022-cancel-after-allocation-compensation.md

  11. Release the dispatch once picked

    fulfillment-execution reports the pick, possibly short. The picked quantity is recorded and dispatch work is released for exactly that quantity.

    Systemfulfillment-execution
    EventTransferPicked
    PolicyWhenever the pick completes, record the picked quantity and release the dispatch work
    CommandApplyTransferPickstarted by the policy
    AggregateInterWarehouseTransfer
    EventWorkDemandReleased
    EventTransferStateAdvancedanalytics stream only
    Systemwes-work-planning
    PolicyCreates the dispatch as a work unit referring to the transfer

    Source: application/usecases/transfer_facts.go · adapters/inbound/kafka/transfer_fact_consumer.go · adr/0005-work-demand-release-and-fact-transitions.md

  12. Mark the transfer in transit

    fulfillment-execution reports that the goods left the origin. The transfer moves to in transit. No work is released for this step.

    Systemfulfillment-execution
    EventTransferDispatched
    PolicyWhenever dispatch completes, mark the transfer in transit
    CommandApplyTransferDispatchedstarted by the policy
    AggregateInterWarehouseTransfer
    EventTransferStateAdvancedanalytics stream only

    Source: application/usecases/transfer_facts.go · adapters/inbound/kafka/transfer_fact_consumer.go

  13. Mark the transfer arrived

    inventory-storage reports the receipt staged at the destination. A work-driven arrival fact from fulfillment-execution may also exist. Whichever comes first moves the transfer to arrived; the other is skipped.

    Systeminventory-storage
    EventTransferReceiptStaged
    PolicyWhenever the first arrival signal comes, mark the transfer arrived
    CommandApplyTransferReceiptStagedstarted by the policy
    AggregateInterWarehouseTransfer
    EventTransferStateAdvancedanalytics stream only

    Source: application/usecases/transfer_facts.go · adapters/inbound/kafka/transfer_fact_consumer.go · adr/0005-work-demand-release-and-fact-transitions.md

  14. Close the transfer once stowed

    inventory-storage reports the goods stowed at the destination, with where they went. The transfer is received and its journey ends.

    Systeminventory-storage
    EventTransferStockStowed
    PolicyWhenever the stow is confirmed, mark the transfer received and keep where the stock went
    CommandApplyTransferStowstarted by the policy
    AggregateInterWarehouseTransfer
    EventTransferStateAdvancedanalytics stream only

    Source: application/usecases/transfer_facts.go · adapters/inbound/kafka/transfer_fact_consumer.go

  15. Flag transfers that are stuck

    A periodic check compares each open transfer with a time limit for its state and reports the ones past it. It only reports: it never cancels or changes a transfer.

    TimeHealth check
    PolicyEvery check, report each open transfer that has stayed too long in its state
    CommandCheckStuckTransfersstarted by the clock
    AggregateStuckCheck
    EventTransferStuckDetectedanalytics stream only

    Source: application/usecases/saga_health.go · domain/transfer/stuck.go · adr/0007-phase4-observability-and-scheduled-runs.md

  16. Run a scheduled rebalance

    On a schedule, the planner works from the local copies and the operator's catalogues, and records how many proposals it made and how many it rejected. It never approves anything.

    TimeRebalance schedule
    PolicyEvery run, plan proposals from the local copies and record the outcome, without approving any
    Read modelSite capabilities
    Read modelSite demand per SKU
    Read modelPublished capacity plans
    CommandRunScheduledRebalancestarted by the clock
    AggregatePlanner
    EventRebalanceRunCompletedanalytics stream only

    Source: application/usecases/scheduled_rebalance.go · domain/transfer/planner.go · adr/0015-rebalance-policy-and-lane-catalogue.md

Hot spots and opportunities

Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.

Opportunities

This board is a reconstruction from the code and documentation of network-inventory-planning at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.