[ https://issues.apache.org/jira/browse/OFBIZ-13254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17958641#comment-17958641 ]
Deepak Dixit edited comment on OFBIZ-13254 at 6/10/25 9:48 AM: --------------------------------------------------------------- This has been merged. Thanks [~yashwant.dhakad] for reporting and providing the patch. was (Author: deepak.dixit): This has been merged. Thanks [~yashwant.dhakad] for reporting the providing the patch. > ArithmeticException when producing inventory with general cost set on routing > task > ---------------------------------------------------------------------------------- > > Key: OFBIZ-13254 > URL: https://issues.apache.org/jira/browse/OFBIZ-13254 > Project: OFBiz > Issue Type: Bug > Components: manufacturing > Affects Versions: Upcoming Branch, 24.09 > Reporter: Yashwant Dhakad > Assignee: Deepak Dixit > Priority: Major > Fix For: 24.09.02 > > > h3. {*}Description{*}: > We are encountering a runtime exception when attempting to produce inventory > from a *Production Run* in the *Manufacturing* module. This issue > specifically occurs when a *general cost* is configured on a {*}routing > task{*}. > ---- > h3. {*}Steps to Reproduce{*}: > # Navigate to the *Manufacturing > Production Run* module. > # Create a Production Run for any finished good item. > # Assign a routing that includes one or more routing tasks. > # On any of the routing tasks, set a *general cost* (e.g., other fixed cost). > # Start the production run and complete the tasks. > # Try to *produce inventory* using the "Produce" button. > h3. {*}Expected Behavior{*}: > The inventory should be produced successfully, and unit cost should be > calculated based on total cost and quantity. > ---- > h3. {*}Actual Behavior{*}: > The system throws the following exception: > java.lang.ArithmeticException: Non-terminating decimal expansion; no exact > representable decimal result. > at java.base/java.math.BigDecimal.divide(BigDecimal.java:1780) > at > org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRunServices.productionRunProduce(ProductionRunServices.java:1872) > > This happens when {{unitCost = totalCost.divide(quantity)}} is called and the > result is a non-terminating decimal (e.g., 10 / 3). -- This message was sent by Atlassian Jira (v8.20.10#820010)