feat(ppc): add RM identity labels, plan-item, and work-order carry-forward contracts - #53
Merged
ilramdhan merged 3 commits intoAug 4, 2026
Conversation
…racts A work order's RM allocation stores only crm_rm_id, and a route edge only its type-discriminated master key. Neither is renderable, so every consumer that wanted to show an RM had to either display a raw id or make a join it has no access to — PPC lives in a separate database from the finance masters. Resolve the labels at the boundary that can actually do it: - CostMasterRouteRm gains rm_code/rm_name, derived server-side by rm_type (PRODUCT -> cost_product_master, ITEM -> cost_erp_item, GROUP -> cst_rm_group_head). Empty when the referenced master row is missing, so a dangling edge still surfaces rather than vanishing. - WORmAllocation gains rm_code/rm_name plus route attribution (route_stage_name, route_level, route_rm_ratio) so an allocation line can explain which stage proposed it and at what per-unit coefficient. Both are read-time decorations; nothing new is persisted. Authored-By: Ilham R <ilhamram332@gmail.com> Co-Authored-By: Ilham R <me@ilramdhan.dev> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: IT Mutugading <it@mutugading.com> Co-Authored-By: Indra Putro <indraputro@mutugading.com> Co-Authored-By: Ilham R <ilham.ramadhan@mutugading.com> Co-Authored-By: IT Mutu Gading <mutugadingapps@gmail.com>
Uncovered plan items at month end had no way forward: the planner could carry a demand, but the plan items derived from it were left behind and had to be re-planned by hand. This adds the plan-item level equivalent. PlanCarryAction is deliberately narrower than CarryAction. A plan item has no DEFERRED state to move into, and SPLIT would need per-child machine groups and timelines that a demand split never carries — offering either would mean accepting a request the domain cannot honour. PlanItem gains carry_from_item_id and carry_action so a carried item states its own provenance, which is also what makes an already-carried source detectable per target month instead of globally. PlanCarryCandidate reports coverage (qty_covered / qty_uncovered / work_order_count) alongside the item and its demand label, so the planner decides from what is actually left rather than from the original target. Authored-By: Ilham R <ilhamram332@gmail.com> Co-Authored-By: Ilham R <me@ilramdhan.dev> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: IT Mutugading <it@mutugading.com> Co-Authored-By: Indra Putro <indraputro@mutugading.com> Co-Authored-By: Ilham R <ilham.ramadhan@mutugading.com> Co-Authored-By: IT Mutu Gading <mutugadingapps@gmail.com>
A work order that ran out of month with qty left had no continuation path. This adds the WO-level carry, producing a CONTINUATION WO in the target month. WorkOrderCarryCandidate carries ineligibility_reason rather than filtering ineligible WOs out. A silently absent row reads as "nothing left to carry", which is the one thing the planner must not conclude when the real answer is "this WO is closed" or "it was already carried". Two validation bounds are worth naming: - lot_no is max_len 30, matching work_order.wo_lot_no VARCHAR(30) as every other lot_no field in the file does. At 50 a 31..50-char lot cleared validation and then failed at INSERT as a raw driver error, reaching the planner as a 500 instead of a field-level complaint. Generated lots are 10 chars, so nothing real is excluded. - carry_qty admits the empty string, because unset means "carry the full remainder" — the documented default. A pattern that required at least one digit would have made the documented default unrepresentable. Authored-By: Ilham R <ilhamram332@gmail.com> Co-Authored-By: Ilham R <me@ilramdhan.dev> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: IT Mutugading <it@mutugading.com> Co-Authored-By: Indra Putro <indraputro@mutugading.com> Co-Authored-By: Ilham R <ilham.ramadhan@mutugading.com> Co-Authored-By: IT Mutu Gading <mutugadingapps@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces PPC domain contract enhancements for RM identity resolution and carry-forward functionality:
rm_codeandrm_nametoCostMasterRouteRmandWORmAllocation, along with route attribution fields (route_stage_name,route_level,route_rm_ratio) to allow displaying readable RM details and stage provenance without requiring external database joins.PlanCarryAction,PlanCarryCandidate, and provenance fields (carry_from_item_id,carry_action) onPlanItem.WorkOrderCarryCandidatewithineligibility_reason, updatinglot_novalidation constraint tomax_len 30, and allowingcarry_qtyto accept empty strings for full remainder defaults.Change Type
Proto Files Changed
common/v1/common.protofinance/v1/uom.protoppc/v1/*.protoChanges Made
rm_codeandrm_namefields toCostMasterRouteRm(derived server-side byrm_type:PRODUCT,ITEM,GROUP).rm_code,rm_name,route_stage_name,route_level, androute_rm_ratiofields toWORmAllocation.PlanCarryActionenum (tailored for plan items withoutDEFERREDorSPLITstates).carry_from_item_idandcarry_actionfields toPlanItemfor provenance and duplicate detection.PlanCarryCandidatemessage providing coverage details (qty_covered,qty_uncovered,work_order_count).CONTINUATIONWOs in target months.WorkOrderCarryCandidatecontainingineligibility_reasonto explicitly signal ineligible WOs.lot_nofield validation tomax_len 30to match database column limits (VARCHAR(30)).carry_qtyvalidation pattern to permit empty strings, enabling default full remainder carry functionality.Related Issues
Fixes #
Related to #
Breaking Change Check
Is this a breaking change?
buf breakingpassesBreaking Change Evidence
Lint Check
# Output of buf lint buf lintGenerated Code Preview (Optional)
Pre-merge Checklist
buf format -wappliedbuf lintpassesbuf breakingpassesImpact Assessment
Reviewer Notes
CostMasterRouteRmandWORmAllocationare read-time decorations resolved at the API boundary; no database schema modifications are required.lot_nolength validation to 30 characters matches database column limits (VARCHAR(30)), preventing potential runtime driver errors during inserts.