Skip to content

This is an internal working record, not an everyday instruction. It was written while the system was being rebuilt, for whoever maintains it. If you are here to do today's work, use the everyday documents instead: Procedures · Processes · Runbooks · The working day, step by step

MK Inventory Allocation — Current Action Matrix — 2026-08-10

  • Status: CURRENT SOURCE-RECONCILED ACTION MATRIX / RUNTIME EVIDENCE NOT RUN
  • Task: CTC-CDOC-002
  • Process: PROC-OMS-INVENTORY-TO-OUTBOUND-ALLOCATION-MK
  • Source baseline: master@f82a91f596e6d3ed636c102b458b3dd07d8475be
  • Source refresh: MK_INVENTORY_ALLOCATION_CURRENT_SOURCE_REFRESH_2026-08-10.md
  • Phase implementation: USER HOLD
  • Effects performed: NONE

1. End-To-End Current Action Matrix

Step Page/UI Query/API or command Record predicate State predicate Persisted authority/effect Exact readback / recovery
Enter mk-allocation-workbench initial page context current tenant/session context none proves allocation eligibility none Workbench page only
Discover source Warehouse Inventory / Available Lots GET /api/oms/allocations/workbench active tenant lot, active joins OPEN/PARTIAL, received, remaining weight > 0, nonterminal source item none returned lot IDs, source lineage and balances
Search target target shipment search GET /api/oms/allocations/target-shipments tenant Outbound Sales + equipment bridge current query excludes Returned/Broken bridge and requires target context none target T_LOAD and bridge identity
Direct lot search caller/query compatibility GET /api/oms/allocations/allocatable-lots/search current tenant/query keys helper-defined source eligibility none exact lot rows only
Stage Target Allocation panel browser rowDrafts selected lot ID retained browser checks displayed remaining weight none; client-only staged weight/quantity/rate/remark
Apply Apply to Existing Shipment POST /api/oms/allocations/apply -> APPLY_WORKBENCH target order and source lot reloaded under tenant; source lot active positive allocated weight; mapped lot exists; remaining weight sufficient; not all list predicates are repeated new T_LOAD_ITEM; new T_LOAD_ALLOCATION; conditional lot weight decrement; bridge sync response IDs followed by Workbench/detail reread
Reconcile refreshed target/source Workbench/detail reads exact target item + allocation + lot IDs active rows; soft-deleted relations excluded from normal projection none compare item, relation, REMAIN_NET_WEIGHT, quantity and bridge
Unknown response error/missing response no automatic replay contract exact intended target/lot tuple commit state unknown unknown until reread search persisted item/allocation/balance before any retry
Concurrent same lot separate Apply requests same command same lot ID conditional remaining-weight predicate one or more transactions may succeed only while each conditional balance mutation succeeds runtime isolation/deadlock behavior remains evidence-required
Partial allocation editable row same Apply command one lot + target weight may be less than displayed remain; quantity independently staged allocation quantity/weight snapshot; lot immediate weight decrement only reread remaining weight and active relation; lot-status/quantity policy remains open
Wrong committed allocation no general current reverse route none source-confirmed exact allocation/item/lot IDs must be preserved downstream/progress state must be inspected no authorized generic repair described here stop; escalate to separately approved recovery owner

2. Current Sequence

sequenceDiagram
    actor Operator
    participant UI as Allocation Workbench
    participant Q as Allocation Query API
    participant C as Allocation Apply API
    participant W as Shared MK Writer
    participant DB as MySQL Records

    Operator->>UI: Select target and source lots
    UI->>Q: GET /api/oms/allocations/workbench
    Q-->>UI: Lot / target / allocation projections
    Operator->>UI: Stage weight, quantity, rate, remark
    UI->>C: POST /api/oms/allocations/apply
    C->>W: APPLY_WORKBENCH
    W->>DB: Create target T_LOAD_ITEM
    W->>DB: Insert T_LOAD_ALLOCATION
    W->>DB: Conditional REMAIN_NET_WEIGHT decrement
    W->>DB: Synchronize target bridge projections
    DB-->>W: Transaction result
    W-->>UI: ORDER_ID / ORDER_NUMBER / ITEM_IDS
    UI->>Q: GET Workbench reread
    Q-->>UI: Current persisted projection

The sequence is source reconstruction only. It is not runtime trace evidence.


3. Record And Field Authority Matrix

Concern Current authoritative record/field Derived or compatibility surface Non-implication
source lot T_INVENTORY_LOT.ID browser row key, commodity grouping visible row != command eligibility
source provenance SOURCE_ORDER_ID, SOURCE_ORDER_ITEM_ID, related receipt/transload identity source labels/reference/load number label “leftover” != second allocation source
current weight balance T_INVENTORY_LOT.REMAIN_NET_WEIGHT Available Weight, after-remain preview preview != commit
current quantity REMAIN_QUANTITY plus source/item evidence staged QUANTITY Apply quantity snapshot != immediate remaining-quantity decrement
target shipment target T_LOAD.ID selected target browser state selection != valid Apply
target line Apply-created T_LOAD_ITEM.ID UI target line card item presence alone != complete source relation
allocation relation T_LOAD_ALLOCATION.ID allocation detail list relation != Scale/Packing/Delivery completion
target-line relation OUTBOUND_ORDER_ITEM_ID browser ITEM_IDS response order ID != item ID
accepted weight ALLOCATED_NET_WEIGHT DTO ALLOCATED_WEIGHT, target NET_WEIGHT DTO name != DB column name
accepted quantity ALLOCATED_QUANTITY DTO QUANTITY quantity != weight conversion
active relation DELETED_AT IS NULL current allocation projection soft delete != approved reversal

4. State Predicates

Source query

tenant match
AND lot DELETED_AT IS NULL
AND LOT_STATUS IN (OPEN, PARTIAL)
AND RECEIVED_DATE IS NOT NULL
AND REMAIN_NET_WEIGHT > 0
AND source item is absent/empty or not ALLOCATED/COMPLETED/TRANSLOADED

Source command recheck

The command rechecks tenant-scoped active lot existence and remaining weight, plus lot/commodity identity used by the new target item. It does not encode the complete query predicate as one shared eligibility policy.

Weight concurrency guard

REMAIN_NET_WEIGHT >= requested allocation weight

is present on the mutation itself, followed by an affected-row check. Treat this as current source behavior, not as executed concurrency proof.

Target query/command

Target projection requires current Outbound/equipment context. The current command validates target order/container bridge, but source review still leaves target close/progress/demand policy incomplete.


5. Partial Allocation Contract From Current Source

Current UI explicitly exposes:

Apply weight
Quantity
Rate
Remark
Use Full Remain

Use Full Remain is optional. The client caps staged weight at the displayed remaining weight and sends an independent quantity.

Persisted result:

target item QUANTITY
target item NET_WEIGHT
allocation ALLOCATED_QUANTITY
allocation ALLOCATED_NET_WEIGHT
lot REMAIN_NET_WEIGHT reduced
lot REMAIN_QUANTITY not immediately reduced

Open policy:

  • whether quantity is informational or consumptive for each UOM;
  • whether a partially consumed lot must become/remain PARTIAL;
  • whether full consumption must close the lot;
  • precision and rounding;
  • correction/reversal of quantity/weight divergence.

6. Duplicate And Unknown-Result Matrix

Condition Current source behavior Safe current interpretation
same browser click while request is in flight state.applying disables the immediate UI action browser guard only; not idempotency
exact request replay after committed response loss no durable request token can duplicate if remaining balance still allows; reread first
replay when remaining weight is insufficient conditional lot update can fail and request transaction should roll back failure does not identify whether first request committed
two concurrent requests whose total exceeds lot remain conditional balance mutation is designed to reject an update once predicate fails exact live isolation/deadlock outcome remains not run
two distinct valid partial allocations whose total stays within balance both may legitimately commit as separate allocations no duplicate-intent identity distinguishes accidental replay
response error/missing JSON browser displays error and retains no durable pending command identity error != rollback proof
wrong committed allocation no general reverse command source-confirmed preserve IDs and stop; do not delete rows directly

7. Stale Contract Corrections Used By This Matrix

Current source supersedes these older route names:

/api/oms/allocation-workbench/sources
/api/oms/allocation-workbench/targets
/api/oms/allocation-workbench/apply

with:

/api/oms/allocations/workbench
/api/oms/allocations/target-shipments
/api/oms/allocations/allocatable-lots/search
/api/oms/allocations/apply

Also superseded as current-source facts:

  • full-lot-only UI;
  • no partial weight editor;
  • OPEN-only lot selection;
  • no conditional remaining-weight predicate.

The owning historical files are outside this task's write set and are intentionally not edited.


8. Current Completion Boundary

source relation created
+ target item created
+ source weight decremented
+ transaction response returned
+ authoritative reread agrees
= allocation command evidence

allocation command evidence
!= outbound demand policy accepted
!= lot quantity policy accepted
!= physical shipment completion
!= Scale / Packing / Delivery completion
!= correction/reversal capability
!= M3 / M4

---

Source: docs/processes/MK_INVENTORY_ALLOCATION_CURRENT_ACTION_MATRIX_2026-08-10.md — ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.