[
https://issues.apache.org/jira/browse/OFBIZ-13262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17979910#comment-17979910
]
Yashwant Dhakad commented on OFBIZ-13262:
-----------------------------------------
h1. *Work Order Reservation Implementation Plan*
This implementation plan outlines enhancements to the Apache OFBiz
manufacturing module to support a robust work order reservation flow. The
proposed features include manual lot selection, automatic reservation to reduce
inventory issues, improve accuracy, and align with real-world manufacturing
requirements.
h2. *Objectives*
* {*}Manual Lot Selection{*}: Allow users to reserve and issue materials from
specific inventory lots via the UI, overriding default FIFO/LIFO logic.
* {*}Automatic Reservation{*}: Automatically reserve inventory at production
approval using FIFO/LIFO, preventing cross-run conflicts.
h2. *Data Model Enhancements*
h3. *New Entity: WorkEffortInvRes*
Introduce a new entity WorkEffortInvRes to handle inventory reservations
specific to work orders. This entity will follow a similar design pattern to
the existing OrderItemShipGrpInvRes entity used for managing order-based
reservations.
*Entity: WorkEffortInvRes*
* {*}Fields{*}:
* workEffortId (type: id, description: Identifier of the work effort/task)
* inventoryItemId (type: id, description: Identifier of the reserved inventory
item)
* wegsProductId (type: id, description: Reference to the
WorkEffortGoodStandard.productId record for tracking primary/substitute
products)
* reserveOrderEnumId (type: id, description: Enum indicating reservation type,
e.g., FIFO, LIFO, or manual)
* quantity (type: fixed-point, description: Quantity reserved)
* quantityNotAvailable (type: fixed-point, description: Quantity not available
at reservation time, if any)
* reservedDatetime (type: date-time, description: Timestamp when reservation
was made)
* createdDatetime (type: date-time, description: Timestamp when the record was
created)
* promisedDatetime (type: date-time, description: Original promised delivery
date for the reservation)
* currentPromisedDate (type: date-time, description: Current promised delivery
date, updated if changed)
* sequenceId (type: numeric, description: Sequence for ordering reservations
within a work effort)
* {*}Primary Key{*}: workEffortId, inventoryItemId, wegsProductId
* {*}Purpose{*}: Stores reservation details for inventory items tied to work
efforts, supporting both manual and automatic reservations.
h2. *Service Implementations*
h3. *1. Manual Reservation Service*
* {*}Service Name{*}: reserveWorkEffortInventoryItem
* {*}Purpose{*}: Allows users to manually reserve a specific inventory item
either from main product for a work effort, bypassing FIFO/LIFO logic. We have
added validation in the reserve service to ensure that users cannot select a
quantity greater than the required amount. Additionally, only those inventory
items with *Available to Promise (ATP) greater than 0* will be displayed and
considered for reservation. This ensures that users can only reserve inventory
that is currently available.
* {*}Input Parameters{*}:
* workEffortId (String, required): Work effort/task ID.
* inventoryItemId (String, required): Specific inventory item to reserve.
* wegsProductId (String, required): Reference to the WorkEffortGoodStandard
record.
* quantity (BigDecimal, required): Quantity to reserve.
* {*}Output{*}: Creates a record in WorkEffortInvRes and InventoryItemDetail.
* {*}Logic{*}:
* Validate the inventory item exists and has sufficient quantity(ATP) and will
not reserve more than the required quantity.
* Create a reservation record in WorkEffortInvRes.
* Create the InventoryItemDetail record for auditing purposes.
* Update InventoryItem to reduce availableToPromiseTotal by the reserved
quantity, locking the item for this reservation.
* If inventory is serialize then update inventory availability
status(Promised).
* Ensure that the reservation flow does not release the work order reservation
when inventory values are modified in reassignInventoryReservation flow.
* *UI Integration:* Add a UI form in the manufacturing module to allow users
to select specific lots, serial numbers, or expiration dates. The form should
display inventory for both the main and substitute products. Users should be
able to select and pick multiple inventory items along with their quantities.
We have added validation in the reserve service to ensure that users cannot
select a quantity greater than the required amount. Additionally, only those
inventory items with *Available to Promise (ATP) greater than 0* will be
displayed and considered for reservation. This ensures that users can only
reserve inventory that is currently available.
Upon clicking {*}"Reserve"{*}, the selected inventory will be reserved
accordingly.
h3. *2. Automatic Reservation Service*
* {*}Service Name{*}: autoReserveWorkEffortInventory
* {*}Purpose{*}: Automatically reserves inventory for all items in a work
effort task at production task approval, using FIFO or LIFO logic.
* {*}Input Parameters{*}:
* workEffortId (String, required): Work effort task ID.
* {*}Output{*}: Creates multiple WorkEffortInvRes along with
InventoryItemDetail records for all required items in the work effort.
* {*}Logic{*}:
* Retrieve all WorkEffortGoodStandard records for the given workEffortId.
* For each record, select inventory items based on FIFO/LIFO logic.
* Create reservation records in WorkEffortInvRes with the appropriate
wegsProductId.
* Create an InventoryItemDetail record for auditing purposes.
* Handle cross-run conflicts by checking existing reservations.
* {*}Trigger{*}: Automatically called during production run task approval.
h3. *3. Cancel Reservation Service*
* {*}Service Name{*}: cancelWorkEffortInventoryReservation
* {*}Purpose{*}: Allows users to cancel existing reservations manually,
enabling re-reservation if needed.
* {*}Input Parameters{*}:
* workEffortId (String, required): Work effort/task ID.
* inventoryItemId (String, required): Inventory item to cancel.
* wegsProductId (String, required): Reference to the WorkEffortGoodStandard
record.
* {*}Output{*}: Deletes the corresponding WorkEffortInvRes and
InventoryItemDetail record and updates inventory availability.
* {*}Logic{*}:
* Validate the reservation exists.
* Remove the reservation record.
* Update inventory status to reflect released quantities.
* {*}UI Integration{*}: Add a "Cancel Reservation" button in the routing task
component management screen.
h3. *4. Issuance Service Update*
* {*}Service Name{*}: Update the issueProductionRunTaskComponent or can create
new service(issueReservedProductionRunTaskComponent).
* {*}Purpose{*}: Issue reserved inventory items, using the WorkEffortInvRes
entity.
* {*}Input Parameters{*}:
* workEffortId (String, required): Work effort/task ID.
* wegsProductId (String, optional): Specific reference for issuance (supports
substitutes).
* {*}Logic{*}:
* Retrieve all WorkEffortInvRes records for the workEffortId.
* For each reservation, issue the reserved inventoryItemId.
* Update inventory quantities and mark reservations as issued.
* Add the ItemIssuance record for the issued inventory so we can update the
return flow to return the issued units in the same inventory instead of
creating new.
* {*}Output{*}: Remove WorkEffortInvRes records after issuance, log issuance
details and create InventoryItemDetail record for auditing purpose.
> Implement Inventory Reservation Flow for Work Orders in Manufacturing
> ---------------------------------------------------------------------
>
> Key: OFBIZ-13262
> URL: https://issues.apache.org/jira/browse/OFBIZ-13262
> Project: OFBiz
> Issue Type: Sub-task
> Components: manufacturing
> Affects Versions: Upcoming Branch
> Reporter: Yashwant Dhakad
> Priority: Minor
> Fix For: Upcoming Branch
>
>
> Introduce a robust inventory reservation flow for work orders in the
> manufacturing module. Currently, inventory is not reserved at the time of
> production run approval, leading to the risk of overcommitting stock across
> multiple runs. This enhancement will enable both manual lot selection by
> users and automatic reservation based on configured logic (like FIFO/LIFO).
> The goal is to prevent material conflicts, improve inventory accuracy, and
> align with real-world production control needs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)