|
Author: jacopoc
Date: Mon Dec 21 17:51:17 2009 New Revision: 892904 URL: http://svn.apache.org/viewvc?rev=892904&view=rev Log: Refactored code to fix a bug happening when the 'quick issue and produce' form was used for a production run: actual routing costs were not computed properly because the actual time spent was set to zero instead of null. Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=892904&r1=892903&r2=892904&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Mon Dec 21 17:51:17 2009 @@ -1934,12 +1934,6 @@ if (addQuantityRejected == null) { addQuantityRejected = BigDecimal.ZERO; } - if (addSetupTime == null) { - addSetupTime = BigDecimal.ZERO; - } - if (addTaskTime == null) { - addTaskTime = BigDecimal.ZERO; - } if (comments == null) { comments = ""; } @@ -1968,15 +1962,6 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotRunning", locale)); } - Double actualMilliSeconds = theTask.getDouble("actualMilliSeconds"); - if (actualMilliSeconds == null) { - actualMilliSeconds = Double.valueOf(0); - } - Double actualSetupMillis = theTask.getDouble("actualSetupMillis"); - if (actualSetupMillis == null) { - actualSetupMillis = Double.valueOf(0); - } - BigDecimal quantityProduced = theTask.getBigDecimal("quantityProduced"); if (quantityProduced == null) { quantityProduced = BigDecimal.ZERO; @@ -1985,8 +1970,6 @@ if (quantityRejected == null) { quantityRejected = BigDecimal.ZERO; } - double totalMillis = actualMilliSeconds.doubleValue() + addTaskTime.doubleValue(); - double totalSetupMillis = actualSetupMillis.doubleValue() + addSetupTime.doubleValue(); BigDecimal totalQuantityProduced = quantityProduced.add(addQuantityProduced); BigDecimal totalQuantityRejected = quantityRejected.add(addQuantityRejected); @@ -2037,6 +2020,7 @@ // Create a new TimeEntry try { + /* String timeEntryId = delegator.getNextSeqId("TimeEntry"); Map timeEntryFields = UtilMisc.toMap("timeEntryId", timeEntryId, "workEffortId", workEffortId); @@ -2051,12 +2035,24 @@ timeEntryFields.put("comments", comments); GenericValue timeEntry = delegator.makeValue("TimeEntry", timeEntryFields); timeEntry.create(); - + */ Map serviceContext = new HashMap(); serviceContext.clear(); serviceContext.put("workEffortId", workEffortId); - serviceContext.put("actualMilliSeconds", Double.valueOf(totalMillis)); - serviceContext.put("actualSetupMillis", Double.valueOf(totalSetupMillis)); + if (addTaskTime != null) { + Double actualMilliSeconds = theTask.getDouble("actualMilliSeconds"); + if (actualMilliSeconds == null) { + actualMilliSeconds = Double.valueOf(0); + } + serviceContext.put("actualMilliSeconds", Double.valueOf(actualMilliSeconds.doubleValue() + addTaskTime.doubleValue())); + } + if (addSetupTime != null) { + Double actualSetupMillis = theTask.getDouble("actualSetupMillis"); + if (actualSetupMillis == null) { + actualSetupMillis = Double.valueOf(0); + } + serviceContext.put("actualSetupMillis", Double.valueOf(actualSetupMillis.doubleValue() + addSetupTime.doubleValue())); + } serviceContext.put("quantityProduced", totalQuantityProduced); serviceContext.put("quantityRejected", totalQuantityRejected); serviceContext.put("userLogin", userLogin); |
| Free forum by Nabble | Edit this page |
