Skip to main content

Journey: Allocation of One Order Line

The allocation pass handles the lines of an order one by one, in line_no order. This page follows one line from "how much is open" to the pick_detail rows.

1. From the open quantity to the picks​

What this shows. The planning phase reads stock but locks nothing. The reserving phase locks each chosen stock row and writes. A line that loses a race is planned once more.

Reading notes.

  • If the open quantity is zero or less, the line is skipped without a message.
  • Configuration faults are errors, not shortages. They stop the command: no policy on the line, policy version changed, no active step, a step the build cannot run, a pack with no active unit, a policy that names no unit of the pack, a rotate_by outside the code list.
  • A step that has no share and no carry is skipped without reading stock (verdict no_quantity_for_uom).
  • The pick keeps the policy id, the policy version, the step id and the step version that made it.
  • Contended means the row (or its LPN) was locked by another transaction. The quantity is counted as deferred, not as short, and is not retried inside this command (see page 14).
  • The result of a line: reserved_now (allocated), stock_short, contention_deferred. short = need - allocated - deferred.

Where it comes from​

Step in the diagramCode
Open quantity ordered - cancelled - allocated; zero or less skips the linecrates/libs/wms-outbound/src/domain/shipment_order_line/aggregate.rs:69-71, crates/libs/wms-outbound/src/service/order/allocate.rs:493-504
Lines in line_no ordercrates/libs/wms-lib-core/src/model/outbound/shipment_order_line.rs:220-230
Plan the line (same code for the preview)crates/libs/wms-outbound/src/allocation/trace.rs:260-313
Frozen policy: id and version from the line; version must match; active steps; the whole policy is refused if one step cannot runcrates/libs/wms-outbound/src/allocation/policy.rs:203-230
SKU facts: rotation, rotate_by, minimum shelf life on pick and shelf life (reserve limit)crates/libs/wms-outbound/src/allocation/trace.rs
Pack units: active, base_qty above 0, biggest firstcrates/libs/wms-outbound/src/allocation/plan.rs:83-102
Split of the need over the units that active steps namecrates/libs/wms-outbound/src/allocation/trace.rs:330-436, crates/libs/wms-lib-core/src/model/pack/breakdown.rs:72-110
Step loop: share of the unit plus the carry of earlier stepscrates/libs/wms-outbound/src/allocation/trace.rs:534-553
Stock read per stepcrates/libs/wms-outbound/src/allocation/trace.rs:574-575, crates/libs/wms-lib-core/src/model/inventory/inventory_balance_atp.rs:430-473
Earlier steps of the same plan are subtracted from the same rowcrates/libs/wms-outbound/src/allocation/trace.rs:585-590
LPN rule, quantity fit, sort ranks, greedy takecrates/libs/wms-outbound/src/allocation/select.rs:162-216
Plan sorted by balance id; short = unit gap + carrycrates/libs/wms-outbound/src/allocation/trace.rs:680-698
Reserve: lock line, skip-locked container and balance, hold re-check, counters, pick_detailcrates/libs/wms-outbound/src/allocation/reserve.rs:100-239
Result values Taken, Raced, Contended, Gonecrates/libs/wms-outbound/src/allocation/reserve.rs:76-91
Raced or Gone: one new plan without the tried rowscrates/libs/wms-outbound/src/service/order/allocate.rs:549-610
Event process.order.line_allocatedcrates/libs/wms-outbound/src/service/order/allocate.rs:616-636
Short is not counted for deferred quantitycrates/libs/wms-outbound/src/service/order/allocate.rs:667-669

2. What the whole pass does after the last line​

What this shows. The three things that follow the line loop.

Reading notes.

  • A failure of the carton plan does not undo the reservation. The error is returned in cartonization_error.
  • The task step looks at all live picks of the order that have no task, not only the picks of this run.
  • A pick gets a task only when its carton outcome is executable (Planned with a carton, ShipAsIs with the factory-package proof, or Bypassed). Pending and Blocked picks wait.
  • The task carries the order priority and, if the order is in a wave, the wave id.

Where it comes from​

Step in the diagramCode
Carton plan after the reservation, a failure is reported not throwncrates/libs/wms-outbound/src/service/order/allocate.rs:398-405
Tasks only when released_at is set; all live picks of the ordercrates/libs/wms-outbound/src/service/order/allocate.rs:407-437
Which carton outcomes are executablecrates/libs/wms-outbound/src/cartonization/handoff.rs:27-67
Create the task and set the pick to Releasedcrates/libs/wms-outbound/src/picking/infrastructure/tasks.rs:119-143
Wave id for the taskcrates/libs/wms-outbound/src/waves/task_grouping.rs:8-18
Statuses recomputedcrates/libs/wms-outbound/src/service/order/allocate.rs:444

Not shown here​

  • The carton plan itself (policy, boxes, weights) belongs to the cartonization area.
  • What the operator does with the task belongs to the picking area. See picking.