OFBIZ-13459: Preserve facility context on MRP events#1474
Open
diveshdut wants to merge 1 commit into
Open
Conversation
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.
Jira Ticket:
https://issues.apache.org/jira/browse/OFBIZ-13459
Summary
This PR preserves known facility context on generated
MrpEventrows when the OFBiz MRP engine already has reliable facility information available from source data or the current run context.The goal is to improve planner traceability without changing MRP calculation behavior,
MrpEventidentity, orMrpEventmerge semantics.Problem
Today, some MRP events are created without
facilityIdeven when the engine already knows the relevant warehouse or manufacturing facility.That makes planner-facing event interpretation harder, especially for:
What This PR Changes
This PR preserves facility context for these event paths when the engine already has it:
SALES_ORDER_SHIPPROD_REQ_RECPPUR_ORDER_RECPMANUF_ORDER_REQMANUF_ORDER_RECPREQUIRED_MRPMRP_REQUIREMENTPROP_PUR_O_RECPPROP_MANUF_O_RECPERRORIt also adds a conservative merge-side backfill:
MrpEventrow has an emptyfacilityIdfacilityIdImportant Non-Goals
This PR does not:
MrpEventprimary keyMrpEventmerge semanticsFacility Group Note
When MRP is launched with
facilityGroupId, current code resolves the run into concrete facilities before event creation.This PR preserves those resolved concrete facilities on generated
MrpEventrows. It does not stamp the facility group id itself.Why Event-Level Facility Still Matters
Run-level provenance and event-level facility serve different purposes.
A run may have an overall planning context, but individual events can still belong to different concrete facilities within that run context, especially across warehouse-oriented and manufacturing-oriented event types.
This PR only preserves event-level facility when the engine already knows it.
Files Changed
applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.javaapplications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.javaVerification
Verified on a clean checkout of
mrp-event-facility-stamping-upstreamusing Java 17:./gradlew checkstyleTest./gradlew check javadoc./gradlew codenarcMain codenarcTest