Warehouse management (WMS) · Supporting domain · EventStorming board

yard-management

The physical yard outside the walls: who passed the gate, where each trailer is, who moves it, and what is done at the door.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

events published
23
commands
16
policies
17
read models
7
hot spots
4

The story in 5 key events

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

  1. Pivotal eventVisitCheckedIn
  2. Pivotal eventTrailerDocked
  3. Pivotal eventDoorWorkCompleted
  4. Pivotal eventTrailerUndocked
  5. Pivotal eventTrailerDeparted

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

Tells (4): 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. Check a truck in at the gate

    The gate clerk records a visit and its trailers. The seal is compared with the booking, and each trailer gets a move: to its door if on time and the door is free, otherwise to a spot. Site policy can turn a seal mismatch or a suspended carrier away.

    ActorGate clerk
    Read modelAppointments (copy from dock-scheduling)
    Read modelYard spots and doors (copy from facility-layout)
    Read modelCarrier registry (copy from dock-scheduling)
    Read modelYard policy
    CommandCheckInVisitPOST /visits
    AggregateVisit
    EventVisitCheckedIn
    EventSealExceptionRaised
    EventYardMoveRequestedanalytics stream only
    Systemdock-scheduling
    PolicyMarks the appointment as arrived: early, on time or late
    Systeminbound-receiving
    PolicyStores the gate arrival, the start of the dock-to-stock clock
    Systemexception-management
    PolicyOpens a case when the seal does not match

    Source: application/usecases/gate_checkin.go · application/usecases/targeting.go · domain/yardvisit/visit.go

  2. Turn a truck away at the gate

    The gate clerk refuses a visit and records the reason. The refused visit is recorded as rejected and gets no trailer.

    ActorGate clerk
    CommandRejectAtGatePOST /visit-rejections
    AggregateVisit
    EventVisitRejected
    Systemdock-scheduling
    PolicyCancels the booked appointment with the reason 'turned away'
    Systemexception-management
    PolicyOpens a case for the rejected visit

    Source: application/usecases/gate_checkin.go · domain/yardvisit/visit.go

  3. Ask for a trailer to be moved

    A yard supervisor asks for a trailer to go to a spot or a door. The destination is checked and reserved. The yard also asks by itself: it calls the next trailer in when a door frees up and clears a dropped trailer after door work.

    ActorYard supervisor
    Read modelYard spots and doors (copy from facility-layout)
    Read modelDoor closures (copy from dock-scheduling)
    CommandRequestMovePOST /moves
    AggregateMove
    EventYardMoveRequestedanalytics stream only

    Source: application/usecases/moves.go · application/usecases/doors.go · domain/yardmove/yardmove.go

  4. Hand the next move to a yard-truck driver

    A hostler (yard-truck driver) asks for work. The yard picks the most urgent waiting move and lends it for a limited time. The trailer leaves its place at once; leaving a door frees that door.

    ActorHostler
    CommandClaimNextMovePOST /moves/claims
    AggregateMove
    EventYardMoveClaimedanalytics stream only
    EventTrailerUndocked
    Systemdock-scheduling
    PolicyCompletes the appointment when its trailer leaves the door

    Source: application/usecases/moves.go · domain/yardmove/yardmove.go · domain/trailer/movement.go

  5. Park or dock the trailer

    The hostler reports where the trailer was left. The move ends and the trailer is parked on a spot or docked at a door, in one step. An occupied place is refused and the move stays open.

    ActorHostler
    Read modelYard spots and doors (copy from facility-layout)
    CommandCompleteMovePOST /moves/{moveId}/completions
    AggregateMove
    EventYardMoveCompletedanalytics stream only
    EventTrailerParkedanalytics stream only
    EventTrailerDocked
    Systemdock-scheduling
    PolicyMoves the booking to the door the trailer really took, if different
    Systemoutbound-shipping
    PolicyAttaches the trailer to the load at that door and starts loading

    Source: application/usecases/moves.go · domain/trailer/trailer.go · domain/trailer/placement.go

  6. Start work at the door

    A dock operator starts unloading or loading a docked trailer. If the site asks for it, an unsecured trailer is refused, and so is loading before a required inspection has passed.

    ActorDock operator
    CommandStartDoorWorkPOST /trailers/{trailerId}/door-work-starts
    AggregateTrailer
    EventDoorWorkStartedanalytics stream only

    Source: application/usecases/doors.go · domain/trailer/work.go

  7. Secure a docked trailer

    A dock operator records that the trailer is held to the dock by a vehicle restraint or wheel chocks. It must be docked and have no open move.

    ActorDock operator
    CommandSecureTrailerPOST /trailers/{trailerId}/securings
    AggregateTrailer
    EventTrailerSecured

    Source: application/usecases/doors.go · domain/trailer/securing.go · 0013-dock-safety-interlock.md

  8. Finish unloading when the receipt closes

    inbound-receiving closes a receipt. When every ASN on a docked trailer has a closed receipt, its door work is completed and the trailer counts as empty. Staff can also complete door work by hand.

    Systeminbound-receiving
    EventReceiptClosed
    PolicyWhenever the last receipt of a docked trailer closes, complete its door work
    CommandCompleteDoorWorkPOST /trailers/{trailerId}/door-work-completions
    AggregateTrailer
    EventDoorWorkCompleted
    Read model · kept up to dateReceipts at the door
    Systemoutbound-shipping
    PolicyKeeps the door-work completion for its load adherence view

    Source: application/usecases/consumers.go · adapters/inbound/kafka/inbound_receiving_consumer.go · domain/trailer/work.go

  9. Release the securing before the trailer leaves

    A dock operator frees the trailer from restraint or chocks. This is needed before it can leave its door, and is refused while door work is in progress.

    ActorDock operator
    CommandReleaseTrailerSecuringPOST /trailers/{trailerId}/securing-releases
    AggregateTrailer
    EventTrailerSecuringReleased

    Source: application/usecases/doors.go · domain/trailer/securing.go · 0013-dock-safety-interlock.md

  10. Inspect a trailer

    An inspector works through a checklist and completes it. If a required item fails, the inspection fails and the trailer is put on hold in the same step.

    ActorInspector
    Read modelInspection checklist templates
    CommandCompleteInspectionPOST /inspections/{inspectionId}/completions
    AggregateInspection
    EventInspectionCompleted
    EventInspectionFailed
    EventTrailerHeldanalytics stream only

    Source: application/usecases/inspections.go · domain/inspection/inspection.go · 0015-compliance-inspections.md

  11. Release a hold on a trailer

    A yard supervisor lifts the hold on a trailer, whether it was placed by hand, by a broken seal or by a failed inspection.

    ActorYard supervisor
    CommandReleaseHoldPOST /trailers/{trailerId}/hold-releases
    AggregateTrailer
    EventTrailerHoldReleasedanalytics stream only

    Source: application/usecases/doors.go · domain/trailer/trailer.go

  12. Check a truck out of the yard

    The gate clerk lets the visit leave with the trailers it takes. Each must be on site and released, and an inspection before departure may be required. A trailer left behind is a drop and stays.

    ActorGate clerk
    CommandCheckOutVisitPOST /visits/{visitId}/check-outs
    AggregateVisit
    EventVisitCheckedOutanalytics stream only
    EventTrailerDeparted
    EventTrailerUndocked
    Systemoutbound-shipping
    PolicyConfirms the shipment and issues the bill of lading when the load is closed
    Systemdock-scheduling
    PolicyCompletes the appointment when its trailer leaves the door

    Source: application/usecases/gate_checkout.go · domain/yardvisit/visit.go · domain/trailer/trailer.go

  13. Free the yard when a booking falls through

    dock-scheduling reports a booking cancelled, missed or moved to another door. The yard cancels the open moves that were bringing a trailer to that door. A trailer already on site stays where it is.

    Systemdock-scheduling
    EventDockAppointmentNoShow
    PolicyWhenever a booking is cancelled, missed or moved, cancel its open hostler moves to the door
    CommandCancelMovePOST /moves/{moveId}/cancellations
    AggregateMove
    EventYardMoveCancelledanalytics stream only
    Read model · kept up to dateAppointments (copy from dock-scheduling)

    Source: application/usecases/consumers.go · adapters/inbound/kafka/dock_scheduling_consumer.go · domain/yardmove/yardmove.go

  14. Take back moves whose lease ran out

    A sweep looks for claimed moves whose time ran out. Each goes back to the waiting list and its trailer back to where it was, unless that place was taken meanwhile.

    TimeScheduler cron
    PolicyEvery sweep, put each claimed move whose lease has expired back on the waiting list
    CommandSweepMoveLeasesPOST /move-lease-sweeps
    AggregateMove
    EventYardMoveLeaseExpiredanalytics stream only

    Source: application/usecases/moves.go · domain/yardmove/yardmove.go

  15. Chase trailers that stay too long

    A sweep finds trailers on site whose time reached the limit for their kind and raises one alert for each.

    TimeScheduler cron
    PolicyEvery sweep, raise a dwell alert once for each trailer past its limit
    Read modelYard policy
    CommandSweepDwellPOST /dwell-sweeps
    AggregateTrailer
    EventTrailerDwellExceeded
    Systemexception-management
    PolicyOpens a case for the overdue trailer

    Source: application/usecases/checks_policy.go · domain/trailer/trailer.go

  16. Audit the yard against the records

    A supervisor walks the yard, notes what is at each place, then closes the check. It reports every difference from what the yard believes. A place not seen is missing if a trailer should be there.

    ActorYard supervisor
    CommandCloseYardCheckPOST /yard-checks/{yardCheckId}/closures
    AggregateCheck
    EventYardCheckClosed
    Systemexception-management
    PolicyOpens one case per difference; a clean check opens none

    Source: application/usecases/checks_policy.go · domain/yardcheck/yardcheck.go

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.

  • Hot spotA door closure or a retired slot under a trailer already there is not handled. Closures only guard arrival. Handling the case is left to a later phase.

    Source: docs/ddd/eventstorming.md

  • Hot spotHazmat and reefer rules trust the declared load. The yard cannot check what a trailer holds, and one classified after parking stays where it is.

    Source: adr/0014-hazmat-and-reefer-placement.md

  • Hot spotSecuring, release and inspection results are published but nobody reads them yet.

    Source: adr/0004-cloudevents-envelope-and-type-catalogue.md

  • Hot spotThe event contract does not yet declare who made a change when an agent writes through the tool interface. The data is on the wire.

    Source: adr/0007-mcp-server.md

Opportunities

  • Opportunityexception-management is the planned reader of failed inspections, so that a failure becomes an exception case to work.

    Source: adr/0015-compliance-inspections.md

  • OpportunityA hazmat segregation rule, so classes may not stand on adjacent spots, needs spot neighbours that facility-layout does not publish yet. A later ADR is planned.

    Source: adr/0014-hazmat-and-reefer-placement.md

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