Skip to main content

Changing a line quantity

The Ordered quantity of a line is the one field that stays editable after the order is launched. You can change it in two places:

  • the Ordered box of the line card, then Save;
  • the Ordered cell of the lines list, then the Save of the lines toolbar.

Both places use the same rule. They pick the command by the state of the line.

Which command runs​

State of the order and the lineCommandWho may run it
The order is in the New family, was never released, and the line has no reservationshipment_order_line_upsert (a whole-line write)ADMIN, MANAGER, SUPERVISOR, OPERATOR
The order is launched, or the line has a reservationshipment_order_line_adjust_qty (changes the quantity only)ADMIN, MANAGER, SUPERVISOR
The order is Closed or CancelledNeither. The Ordered field is read only.Nobody

The screen does not hide the field from an operator. The operator may type the number. If the second command is needed, the server refuses with a sentence that says to ask a supervisor. Hiding the field per role would be a weaker second copy of the server rule (line_write_route.rs, module comment).

Steps​

  1. Open the order. Check the line.
  2. Change Ordered in the line card, or in the grid cell.
  3. Click Save (card) or Save of the lines toolbar (grid).

Rules of the quantity​

  • It must be greater than zero.
  • It cannot go below what is already committed: the reserved quantity plus the cancelled quantity. The message is cannot reduce qty_ordered to {new} — {committed} is already committed — release the line's reservations first (Unallocate). To go lower, give the reservation back first. See Unallocating an order.
  • To take a part of the quantity away from a launched line with a reason, use Cancel Qty instead. See Cancelling part of a line.
  • Raising the quantity of a line that was fully cancelled brings the line back to NotAllocated. The program works the status out from the numbers.

Source: crates/libs/wms-outbound/src/service/order_line/adjust_qty.rs:1-135, crates/libs/wms-outbound/src/domain/shipment_order_line/aggregate.rs:22.

What the screen says​

WhereResultMessage
CardSaved by the quantity-only commandOrdered qty set to {qty} — now {status}
CardThe line is not saved yetSave the line first
CardZero or emptyOrdered quantity must be greater than zero
CardRefused, permissionPermission denied: changing the ordered quantity of a launched or reserved line is a supervisor action — ask a supervisor to make this change
CardRefused, other reasonCould not change the ordered quantity: {error}
CardYou changed something other than Ordered on a frozen lineOnly the ordered quantity can change on this line — release its reservations first (Unallocate) to edit the rest
GridReason of a failed row (whole-line command)Could not save the line: {error}, or Permission denied: you do not have permission to edit this order's lines
GridReason of a failed row (quantity-only command)Could not change the ordered quantity: {error}, or the supervisor sentence above
GridSavedSaved {n} line(s)
GridNot savedNothing saved — line {id}: {reason}
GridPart savedSaved {n} line(s), {m} failed — line {id}: {reason}
GridSomebody else changed the same linethe ordered quantity was {seen} when you started editing and is {stored} now — someone else changed it; your {typed} is still in the cell; press Save again to apply it, or Discard changes to drop it

Source: line_save_action.rs:300-395, line_write_route.rs:196-230, lines_grid_save.rs (functions summary and changed_elsewhere_message).

What changes​

WhatChange
LineOrdered and the version are written.
Line statusWorked out again from the numbers. For example Allocated can become Partially allocated after a raise.
Order statusWorked out again in the same transaction. The order header on screen is read again.
Eventprocess.order.line_qty_adjusted (only for the quantity-only command).