Cartonization: how a plan is made
What this shows. The steps from "Release" or "Allocate" on an order to a saved carton plan, and how the plan reaches the pickers.
There is no button and no RPC for cartonization. It runs inside the reserve command. If it fails, the reservation stays and the command result carries the error text.
What the steps mean
| Step | What happens |
|---|---|
| Savepoint | The whole attempt is nested in the reserve transaction. A failure undoes only the plan, not the reservation. |
| Read reservation | Only picks with status Allocated or Released are read. A pick quantity becomes whole units of the pick's pack level. |
| Bypassed picks | A pick skips the solver when its pack level is unknown, is a factory package, is not cartonized, or no policy resolves. See 11. |
| Input hash | After release, if the hash of the input equals the live plan, nothing is rewritten. |
| After release | The engine plans only the new work around boxes that already stand. Before release it makes a full new plan. |
| Write | Plan status is Planned, or PlannedWithExceptions if any unit is unplaced. A pick that spans two cartons is split into two pick rows. |
| Tasks | Only picks whose outcome is Planned, ShipAsIs or Bypassed get a task. Pending and Blocked get none. Tasks are created only when the order is released. |
Plans are also marked after other commands: Unallocate and Delete Selected (picks) call plan_lost_its_work, which sets the live plan to Superseded or Stale.
Where it comes from
| Claim | Source |
|---|---|
| Release runs the same reserve body as Allocate | crates/libs/wms-outbound/src/service/order/release.rs:371 |
| Reserve calls cartonization, then makes tasks | crates/libs/wms-outbound/src/service/order/allocate.rs:398 |
| Tasks only when the order is released | crates/libs/wms-outbound/src/service/order/allocate.rs:408 |
| Only executable outcomes get tasks | crates/libs/wms-outbound/src/service/order/allocate.rs:418 |
| The result carries the plan or the error | crates/libs/wms-outbound/src/service/order/allocate.rs:447 |
| Savepoint wrapper, error becomes text | crates/libs/wms-outbound/src/cartonization/ensure.rs:455 |
| Failure does not cancel the reservation | crates/libs/wms-outbound/src/cartonization/ensure.rs:507 |
| Plan steps: read, solve, hash, validate, supersede, write | crates/libs/wms-outbound/src/cartonization/ensure.rs:112 |
| Same hash after release means no rewrite | crates/libs/wms-outbound/src/cartonization/ensure.rs:194 |
Old plan becomes Superseded before the write | crates/libs/wms-outbound/src/cartonization/ensure.rs:227 |
Unplaced units give PlannedWithExceptions | crates/libs/wms-outbound/src/cartonization/write.rs:142 |
| Bypassed picks get their outcome | crates/libs/wms-outbound/src/cartonization/write.rs:217 |
| Pick tasks per outcome | crates/libs/wms-outbound/src/cartonization/handoff.rs:27 |
Reserved picks read (Allocated, Released) | crates/libs/wms-outbound/src/cartonization/read_from_db.rs:140 |
| Lost work marks the plan | crates/libs/wms-outbound/src/cartonization/ensure.rs:322 |