OFBIZ-13262: Added inventory reservation logic for production run tasks in manufacturing and also improved inventory issuance feature that works with reservations#1168
Open
diveshdut wants to merge 4 commits intoapache:trunkfrom
Conversation
…l-time reconciliation, introduced a robust framework for managing inventory reservations and physical issuance in the manufacturing process.
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.
(OFBIZ-13262)
This PR introduces formal Inventory Reservation capabilities to the Manufacturing module. Previously, production components were largely tracked via direct issuance; this enhancement allows the system to reserve components ahead of physical issuance, bringing manufacturing parity with Sales Order fulfillment workflows.
User Workflow & UI Journey
Creation & Planning: A Production Run is created with estimated component requirements.
Formal Commitment (Approval): Upon changing the status to Printed or Approved, the system automatically triggers the reservation engine (if setting is enabled)
UI Impact: The "Components" screen now displays a "Reserved" column and a "Backordered" field for shortages.
Seamless Issuance: When the user clicks "Issue Component," the system automatically consumes the existing reservations first, ensuring that reserved lots or batches are accurately tracked through the issuance process. If no reservations are available, then system issues inventory.
"Force Issue" (Break-Glass Logic): In cases where reservations are not available (e.g., emergency jobs or stock discrepancies), the user can still perform a "Force Issue." This allows physical issuance to proceed regardless of the reservation state, ensuring that the production line never stops due to administrative blockers.
Automated Recovery: Any remaining backorders in the reservation ledger are automatically satisfied as soon as new stock is received in the warehouse.
New Data Model: WorkEffortInvRes
A new table, WorkEffortInvRes (Inventory Reservation for WorkEffort), has been introduced as the core ledger for this feature.
Purpose: It tracks "soft" commitments of materials to production tasks.
Backorder Support: Through the quantityNotAvailable field, it explicitly tracks "Global Debt" or backordered units, allowing the system to know exactly what is owed to the production line.
Auditability: It stores reservation timestamps and strategy enums (FIFO/LIFO), providing a full audit trail of how and when materials were committed.
New Policy Controls (Facility Settings)
To support diverse warehouse operations, three new flags have been introduced to the Facility entity:
autoReservePrun (Y/N): Controls the entry point of the reservation lifecycle. If enabled, the system automatically invokes autoReserveWorkEffortInventory whenever a production run reaches the Approved or Printed status.
allowInventoryTheft (Y/N): Determines if a production task can "claim" reservations currently held by another task. Essential for high-priority production in fluid environments.
reconcilePrunBackorders (Y/N): Enables real-time backorder fulfillment. When inventory is received, the system proactively reserves it for pending production tasks.
Core Services Added:
autoReserveWorkEffortInventory: Triggers when autoReservePrun in Facility is set to Y. Provides high-level automation by orchestrating the reservation of all components required for a production run. It evaluates current facility inventory levels and automatically generates WorkEffortInvRes records to secure materials.
reserveWorkEffortInventoryItem: Allows for granular, item-specific commitments. Users can explicitly reserve a particular InventoryItem (e.g., a specific batch or lot) against a production task, bypassing the automated selection logic.
reallocateAndIssueInventory: The primary engine for transition. It manages the logic of converting existing reservations into physical issuance. It also handles "Move-Then-Issue" strategies, allowing reservations to be reallocated between tasks if required by the facility's fluidity policies. Depends on allowInventoryTheft flag of Facility.
releaseProductionRunTaskComponent: Handles the cleanup of commitments. When a task is cancelled or a component is no longer needed, this service releases the reservation and ensures that the ATP (Available to Promise) balance is immediately restored across the facility.
reassignWorkEffortInventoryReservations: The Backorder Satisfier: Automatically fulfills backordered production tasks (quantityNotAvailable in WorkEffortInvRes) when new inventory is received or released.
reconcileGlobalReservations: The Public Auditor: The top-level service used to audit and reconcile inventory state. It ensures that any "Global Debt" (reservations without an item ID) is correctly localized to physical stock as soon as it becomes available.
trinitySync: The Integrity Guard: Performs real-time recalculation of availableToPromiseTotal by comparing physical stock against active reservations in WorkEffortInvRes and OrderItemShipGrpInvRes.
Real-time Automation (SECA)
To ensure a seamless user experience, several Service ECA (SECA) triggers have been introduced:
Approval Trigger: Automatically invokes autoReserveWorkEffortInventory when a production run status changes to Printed/Approved, ensuring stock is secured the moment a job is confirmed.
Receipt Satisfaction: Automatically invokes reassignWorkEffortInventoryReservations whenever inventory levels increase (via balanceInventoryItems), immediately satisfying any pending production backorders.
The primary objective is to allow production tasks to commit inventory early in the production lifecycle. This ensures that critical materials are "locked" for specific jobs, preventing stockouts and enabling more accurate Material Requirements Planning (MRP) and Available-to-Promise (ATP) calculations.
Business Impact
Accurate Material Planning: MRP and ATP calculations now reflect true manufacturing commitments, preventing component "hoarding" and stockouts.
Zero-Touch Fulfillment: Production backorders are satisfied automatically upon stock receipt, reducing manual intervention from warehouse managers.
Policy Flexibility: Facility managers can choose between strict reservation models or fluid environments where high-priority jobs can "steal" stock from others.
At a high level, this new inventory reservation framework delivers five critical business benefits:
Guaranteed Material Availability: By formally "locking" components for specific production tasks, the system prevents stockouts and ensures that materials are physically waiting for the production line when needed.
Reduced Production Lead Times: The automated backorder fulfillment logic removes manual intervention from the warehouse. As soon as missing stock arrives, it is instantly committed to the waiting production job, accelerating the entire manufacturing cycle.
Physical-to-Ledger Integrity: The "Trinity of Truth" synchronization ensures that your warehouse floor always matches your financial books. This eliminates "ghost inventory" and significantly reduces the time spent on manual inventory audits and corrections.
Strategic Operational Agility: New facility-level policies allow management to prioritize critical production runs. High-priority jobs can automatically secure materials from lower-priority tasks, ensuring that key customer deadlines are always met.
Proactive Shortage Visibility: Floor managers gain real-time visibility into material blockers. By identifying backorders at the planning stage rather than the issuance stage, the organization can proactively resolve shortages before they stop the production line.
In essence, these features move the organization from reactive inventory tracking to proactive material commitment, directly increasing manufacturing reliability and throughput.