[ 
https://issues.apache.org/jira/browse/OFBIZ-13254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17958627#comment-17958627
 ] 

Yashwant Dhakad commented on OFBIZ-13254:
-----------------------------------------

I have fixed this issue and created a [pull 
request|https://github.com/apache/ofbiz-framework/pull/893]. Please review it 
and let me know if any further changes are required.

> 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: Improvement
>          Components: manufacturing
>    Affects Versions: Upcoming Branch, 24.09
>            Reporter: Yashwant Dhakad
>            Assignee: Yashwant Dhakad
>            Priority: Major
>             Fix For: Upcoming Branch
>
>
> 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)

Reply via email to