MK Analysis¶
Historical reference for the MK Metal migration. Source-of-truth contracts now live in .agents/rules/.
Source System Shape¶
- Legacy MK app uses a single Ajax controller and table-driven UI.
- Core pages: dashboard, booking, purchase, warehouse purchase, sales, inventory, commodity, rate, company, reports.
- Core DB concepts map into CTC through order-first tables.
MK Operating Model¶
| Area | MK concept | CTC target |
|---|---|---|
| Inbound purchase | purchase header/items | T_LOAD, T_LOAD_ITEM, T_INVENTORY_LOT |
| Sales/outbound | sales header/items | T_LOAD, T_LOAD_ITEM |
| Allocation | sales items consume purchase commodity | T_LOAD_ALLOCATION |
| Inventory | remaining purchase commodity | T_INVENTORY_LOT |
| Rates | commodity/freight rates | T_COMMODITY_RATE, T_TRUCKING_RATE |
| Scale/tickets | weight ticket reporting | T_SCALE_TICKET, BMS/YMS scale paths |
| Reports | invoices, packing list, booking confirmation | server-rendered print pages, BMS invoice seam |
Design Decision¶
MK is order-first. Do not create T_TRANSLOAD or equipment execution rows automatically at every order write. Stabilize the document/inventory layer first, then add explicit execution bridges.
Implemented / Active CTC Paths¶
- Commercial order module.
- Inbound/purchase order helper paths.
- Outbound order module.
- Allocation module.
- Inventory module.
- BMS rate module.
- Scale ticket and scale portal seams.
Known Gaps¶
- Full execution bridge from order/inventory to transload/yard remains explicit follow-up work.
- Some print pages still render through server-side legacy pages.
- Settings/UOM/rate behavior should move through tenant config where it is tenant-specific.
- Shared controllers still own some MK-related
TYPE/ACTIONbranches.
Migration Rules¶
- Keep
TYPE/ACTIONuntil callers are migrated. - Do not add freight-rate alias wrappers; route directly to trucking-rate implementation where the contract maps there.
- Keep allocation safety visible: do not silently over-allocate or delete allocated inventory.
- Verify local runtime before removing shared-controller cases.
Sources¶
- Product model:
docs/PRODUCT.md; target design:docs/DESIGN.md - API contracts:
.agents/rules/API_CONTRACTS.md - DB ownership:
.agents/rules/DB_SCHEMA.md - Current migration status:
.agents/rules/API_V2_CONTRACT_INVENTORY.md - Future migration order:
docs/ROADMAP.mdP2/P5 Tasks
---¶
Source:
.agents/reference/MK_ANALYSIS.md— ctc repository · This page is an English translation of the source document. Identifiers, file paths and code symbols are unchanged.