Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_calendar.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_calendar.xml?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_calendar.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_calendar.xml Mon Jan 5 23:13:36 2009 @@ -50,19 +50,19 @@ <attribute name="calendarWeekId" type="String" mode="IN" optional="false"/> <attribute name="description" type="String" mode="IN" optional="true"/> <attribute name="mondayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="mondayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="mondayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="tuesdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="tuesdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="tuesdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="wednesdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="wednesdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="wednesdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="thursdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="thursdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="thursdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="fridayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="fridayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="fridayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="saturdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="saturdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="saturdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="sundayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="sundayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="sundayCapacity" type="BigDecimal" mode="IN" optional="true"/> </service> <service name="updateCalendarWeek" engine="simple" location="org/ofbiz/manufacturing/techdata/RoutingSimpleServices.xml" invoke="updateCalendarWeek"> @@ -70,19 +70,19 @@ <attribute name="calendarWeekId" type="String" mode="IN" optional="false"/> <attribute name="description" type="String" mode="IN" optional="true"/> <attribute name="mondayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="mondayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="mondayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="tuesdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="tuesdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="tuesdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="wednesdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="wednesdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="wednesdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="thursdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="thursdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="thursdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="fridayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="fridayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="fridayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="saturdayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="saturdayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="saturdayCapacity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="sundayStartTime" type="java.sql.Time" mode="IN" optional="true"/> - <attribute name="sundayCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="sundayCapacity" type="BigDecimal" mode="IN" optional="true"/> </service> <service name="removeCalendarWeek" engine="simple" location="org/ofbiz/manufacturing/techdata/RoutingSimpleServices.xml" invoke="removeCalendarWeek"> @@ -96,7 +96,7 @@ <attribute name="calendarId" type="String" mode="IN" optional="false"/> <attribute name="description" type="String" mode="IN" optional="true"/> <attribute name="exceptionDateStartTime" type="java.sql.Timestamp" mode="IN" optional="false"/> - <attribute name="exceptionCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="exceptionCapacity" type="BigDecimal" mode="IN" optional="true"/> </service> <service name="updateCalendarExceptionDay" engine="simple" location="org/ofbiz/manufacturing/techdata/RoutingSimpleServices.xml" invoke="updateCalendarExceptionDay"> @@ -104,7 +104,7 @@ <attribute name="calendarId" type="String" mode="IN" optional="false"/> <attribute name="description" type="String" mode="IN" optional="true"/> <attribute name="exceptionDateStartTime" type="java.sql.Timestamp" mode="IN" optional="false"/> - <attribute name="exceptionCapacity" type="Double" mode="IN" optional="true"/> + <attribute name="exceptionCapacity" type="BigDecimal" mode="IN" optional="true"/> </service> <service name="removeCalendarExceptionDay" engine="simple" location="org/ofbiz/manufacturing/techdata/RoutingSimpleServices.xml" invoke="removeCalendarExceptionDay"> Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_formula.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_formula.xml?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_formula.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_formula.xml Mon Jan 5 23:13:36 2009 @@ -27,7 +27,7 @@ <!-- BOM Formulas --> <service name="interfaceBomFormula" engine="interface" location="" invoke=""> <attribute mode="IN" name="arguments" optional="false" type="java.util.Map"/> - <attribute mode="OUT" name="quantity" optional="false" type="Double"/> + <attribute mode="OUT" name="quantity" optional="false" type="BigDecimal"/> </service> <service name="exampleComponentFormula" engine="simple" auth="true" location="org/ofbiz/manufacturing/bom/BomFormulas.xml" invoke="exampleComponentFormula"> @@ -42,7 +42,7 @@ <!-- Task Formulas --> <service name="interfaceTaskFormula" engine="interface" location="" invoke="" auth="false"> <attribute mode="IN" name="arguments" optional="false" type="java.util.Map"/> - <attribute mode="OUT" name="totalTime" optional="false" type="Double"/> + <attribute mode="OUT" name="totalTime" optional="false" type="BigDecimal"/> </service> <service name="exampleTaskFormula" engine="simple" auth="false" location="org/ofbiz/manufacturing/techdata/TaskFormulae.xml" invoke="exampleTaskFormula"> Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml Mon Jan 5 23:13:36 2009 @@ -48,7 +48,7 @@ location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="findProductMrpQoh" auth="true"> <description>Find the quantity on hand of products for the MRP</description> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="quantityOnHandTotal" type="Double" mode="OUT" optional="false"/> + <attribute name="quantityOnHandTotal" type="BigDecimal" mode="OUT" optional="false"/> </service> <service name="createMrpEvent" engine="java" location="org.ofbiz.manufacturing.mrp.InventoryEventPlannedServices" invoke="createMrpEvent" auth="false"> @@ -57,7 +57,7 @@ <attribute name="productId" type="String" mode="IN" optional="false"/> <attribute name="eventDate" type="Timestamp" mode="IN" optional="false"/> <attribute name="mrpEventTypeId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="false"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"/> <attribute name="facilityId" type="String" mode="IN" optional="true"/> <attribute name="eventName" type="String" mode="IN" optional="true"/> </service> Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Mon Jan 5 23:13:36 2009 @@ -29,7 +29,7 @@ location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="createProductionRunsForProductBom" auth="true"> <description>Explodes a product id and creates all the needed production runs.</description> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" optional="true" mode="IN" type="Double"/> + <attribute name="quantity" optional="true" mode="IN" type="BigDecimal"/> <attribute name="startDate" type="java.sql.Timestamp" mode="IN" optional="false"/> <attribute name="facilityId" type="String" mode="IN" optional="false"/> <attribute name="routingId" type="String" mode="IN" optional="true"/> @@ -43,7 +43,7 @@ location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="createProductionRun" auth="true"> <description>Create a Production Run</description> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="pRQuantity" type="Double" mode="IN" optional="false"/> + <attribute name="pRQuantity" type="BigDecimal" mode="IN" optional="false"/> <attribute name="startDate" type="java.sql.Timestamp" mode="IN" optional="false"/> <attribute name="facilityId" type="String" mode="IN" optional="false"/> <attribute name="routingId" type="String" mode="IN" optional="true"/> @@ -56,7 +56,7 @@ location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="updateProductionRun" auth="true"> <description>Update a Production Run</description> <attribute name="productionRunId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="true"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="estimatedStartDate" type="Timestamp" mode="IN" optional="true"/> <attribute name="workEffortName" type="String" mode="IN" optional="true"/> <attribute name="description" type="String" mode="IN" optional="true"/> @@ -85,8 +85,8 @@ <attribute name="productionRunId" type="String" mode="IN" optional="false"/> <attribute name="routingTaskId" type="String" mode="INOUT" optional="false"/> <attribute name="priority" type="Long" mode="IN" optional="false"/> - <attribute name="estimatedSetupMillis" type="Double" mode="IN" optional="true"/> - <attribute name="estimatedMilliSeconds" type="Double" mode="IN" optional="true"/> + <attribute name="estimatedSetupMillis" type="BigDecimal" mode="IN" optional="true"/> + <attribute name="estimatedMilliSeconds" type="BigDecimal" mode="IN" optional="true"/> <attribute name="workEffortName" type="String" mode="IN" optional="true"/> <attribute name="description" type="String" mode="IN" optional="true"/> <attribute name="estimatedStartDate" type="Timestamp" mode="INOUT" optional="true"/> @@ -99,8 +99,8 @@ <attribute name="routingTaskId" type="String" mode="IN" optional="false"/> <attribute name="priority" type="Long" mode="IN"/> <attribute name="estimatedStartDate" type="Timestamp" mode="IN"/> - <attribute name="estimatedSetupMillis" type="Double" mode="IN"/> - <attribute name="estimatedMilliSeconds" type="Double" mode="IN"/> + <attribute name="estimatedSetupMillis" type="BigDecimal" mode="IN"/> + <attribute name="estimatedMilliSeconds" type="BigDecimal" mode="IN"/> </service> <!-- TODO: NOT STILL IMPLEMENTED ('deleteWorkEffort' is called directly) --> <service name="deleteProductionRunRoutingTask" engine="java" @@ -114,7 +114,7 @@ <description>add a Product Component to an existing ProductionRun</description> <attribute name="productionRunId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="estimatedQuantity" type="Double" mode="IN"/> + <attribute name="estimatedQuantity" type="BigDecimal" mode="IN"/> <attribute name="workEffortId" type="String" mode="IN" optional="true"/> </service> <service name="updateProductionRunComponent" engine="java" @@ -123,7 +123,7 @@ <attribute name="productionRunId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> <attribute name="workEffortId" type="String" mode="IN" optional="true"/> - <attribute name="estimatedQuantity" type="Double" mode="IN" optional="true"/> + <attribute name="estimatedQuantity" type="BigDecimal" mode="IN" optional="true"/> </service> <!-- TODO: NOT STILL IMPLEMENTED ('removeWorkEffortGoodStandard' is called directly) --> <service name="deleteProductionRunComponent" engine="java" @@ -159,7 +159,7 @@ <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="quantity" type="Double" mode="IN" optional="true"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="failIfItemsAreNotAvailable" type="String" mode="IN" optional="true"/> <attribute name="failIfItemsAreNotOnHand" type="String" mode="IN" optional="true"/> <attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/> @@ -176,8 +176,8 @@ </description> <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="inventoryItem" type="GenericValue" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="true"/> - <attribute name="quantityIssued" type="Double" mode="OUT" optional="false"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/> + <attribute name="quantityIssued" type="BigDecimal" mode="OUT" optional="false"/> <attribute name="finishedProductId" type="String" mode="OUT" optional="false"/> </service> <service name="productionRunProduce" engine="java" transaction-timeout="7200" @@ -187,7 +187,7 @@ </description> <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/> - <attribute name="quantity" type="Double" mode="INOUT" optional="true"/> + <attribute name="quantity" type="BigDecimal" mode="INOUT" optional="true"/> <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> <attribute name="lotId" type="String" mode="IN" optional="true"/> <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/> @@ -200,7 +200,7 @@ </description> <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/> - <attribute name="quantity" type="Double" mode="INOUT" optional="false"/> + <attribute name="quantity" type="BigDecimal" mode="INOUT" optional="false"/> <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> <attribute name="lotId" type="String" mode="IN" optional="true"/> <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/> @@ -214,9 +214,9 @@ </description> <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="false"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="false"/> <attribute name="facilityId" type="String" mode="IN" optional="true"/> - <attribute name="unitCost" type="Double" mode="IN" optional="true"/> + <attribute name="unitCost" type="BigDecimal" mode="IN" optional="true"/> <attribute name="currencyUomId" type="String" mode="IN" optional="true"/> <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/> @@ -228,7 +228,7 @@ </description> <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="true"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> </service> <service name="checkDecomposeInventoryItem" engine="java" @@ -238,7 +238,7 @@ It is intended to be called as seca when a marketing package is received into warehouse (e.g. from a return). </description> <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/> - <!--<attribute name="quantityAccepted" type="Double" mode="IN" optional="true"/>--> + <!--<attribute name="quantityAccepted" type="BigDecimal" mode="IN" optional="true"/>--> </service> <service name="decomposeInventoryItem" engine="java" location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="decomposeInventoryItem" auth="true"> @@ -248,7 +248,7 @@ The components will be returned to inventory at ((Marketing Package Actual Inventory Unit Cost) / (Marketing Package Standard Cost)) * (Component Standard Cost) </description> <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/> - <attribute name="quantity" type="Double" mode="IN" optional="true"/> + <attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/> <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/> </service> <service name="updateProductionRunTask" engine="java" @@ -261,10 +261,10 @@ <attribute name="partyId" type="String" mode="IN" optional="true"/> <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="addQuantityProduced" type="Double" mode="IN" optional="true"/> - <attribute name="addQuantityRejected" type="Double" mode="IN" optional="true"/> - <attribute name="addSetupTime" type="Double" mode="IN" optional="true"/> - <attribute name="addTaskTime" type="Double" mode="IN" optional="true"/> + <attribute name="addQuantityProduced" type="BigDecimal" mode="IN" optional="true"/> + <attribute name="addQuantityRejected" type="BigDecimal" mode="IN" optional="true"/> + <attribute name="addSetupTime" type="BigDecimal" mode="IN" optional="true"/> + <attribute name="addTaskTime" type="BigDecimal" mode="IN" optional="true"/> <attribute name="comments" type="String" mode="IN" optional="true"/> <attribute name="issueRequiredComponents" type="Boolean" mode="IN" optional="true"/> <attribute name="componentsLocationMap" mode="IN" type="Map" optional="true"/> @@ -301,14 +301,14 @@ <description>Given a productId and an optional date, returns the total qty of productId reserved by production runs</description> <attribute name="productId" type="String" mode="IN" optional="false"/> <attribute name="startDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="reservedQuantity" type="Double" mode="OUT" optional="false"/> + <attribute name="reservedQuantity" type="BigDecimal" mode="OUT" optional="false"/> </service> <service name="createProductionRunsForOrder" engine="java" location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="createProductionRunsForOrder" auth="true"> <description>Explodes a product id and creates all the needed production runs; if an order id is also provided, it links the production runs to the sales order.</description> <attribute mode="IN" name="orderId" optional="false" type="String"/> <attribute mode="IN" name="orderItemSeqId" optional="true" type="String"/> - <attribute mode="IN" name="quantity" optional="true" type="Double"/> + <attribute mode="IN" name="quantity" optional="true" type="BigDecimal"/> <attribute mode="IN" name="fromDate" optional="true" type="String"/> <attribute mode="IN" name="shipmentId" optional="true" type="String"/> <attribute mode="OUT" name="productionRuns" type="java.util.List"/> @@ -317,7 +317,7 @@ location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="createProductionRunFromRequirement" auth="true"> <description>Creates a production run from a requirement.</description> <attribute mode="IN" name="requirementId" optional="false" type="String"/> - <attribute mode="IN" name="quantity" optional="true" type="Double"/> + <attribute mode="IN" name="quantity" optional="true" type="BigDecimal"/> <attribute mode="OUT" name="productionRunId" optional="true" type="String"/> </service> <service name="createProductionRunFromConfiguration" engine="java" @@ -326,7 +326,7 @@ <attribute mode="IN" name="facilityId" optional="false" type="String"/> <attribute mode="IN" name="configId" optional="true" type="String"/> <attribute mode="IN" name="config" optional="true" type="org.ofbiz.product.config.ProductConfigWrapper"/> - <attribute mode="IN" name="quantity" optional="true" type="Double"/> + <attribute mode="IN" name="quantity" optional="true" type="BigDecimal"/> <attribute mode="IN" name="orderId" optional="true" type="String"/> <attribute mode="IN" name="orderItemSeqId" optional="true" type="String"/> <attribute mode="OUT" name="productionRunId" optional="false" type="String"/> Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml Mon Jan 5 23:13:36 2009 @@ -63,9 +63,9 @@ <attribute mode="IN" name="taskId" optional="false" type="String"/> <attribute mode="IN" name="productId" optional="true" type="String"/> <attribute mode="IN" name="routingId" optional="true" type="String"/> - <attribute mode="IN" name="quantity" optional="true" type="Double"/> + <attribute mode="IN" name="quantity" optional="true" type="BigDecimal"/> <attribute mode="OUT" name="estimatedTaskTime" type="Long" optional="false"/> - <attribute mode="OUT" name="setupTime" type="Double" optional="true"/> - <attribute mode="OUT" name="taskUnitTime" type="Double" optional="true"/> + <attribute mode="OUT" name="setupTime" type="BigDecimal" optional="true"/> + <attribute mode="OUT" name="taskUnitTime" type="BigDecimal" optional="true"/> </service> </services> Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java Mon Jan 5 23:13:36 2009 @@ -154,7 +154,7 @@ Debug.logError("Production Run for order item (" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + ") not created.", module); continue; } - Map result = dispatcher.runSync("createProductionRunsForOrder", UtilMisc.<String, Object>toMap("quantity", shipmentPlan.getDouble("quantity"), "orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipmentId", shipmentId, "userLogin", userLogin)); + Map result = dispatcher.runSync("createProductionRunsForOrder", UtilMisc.<String, Object>toMap("quantity", shipmentPlan.getBigDecimal("quantity"), "orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipmentId", shipmentId, "userLogin", userLogin)); } } catch (Exception e) { // if there is an exception for either, the other probably wont work Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java Mon Jan 5 23:13:36 2009 @@ -19,6 +19,7 @@ package org.ofbiz.manufacturing.bom; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; @@ -59,11 +60,11 @@ private GenericValue productAssoc; // the product assoc record (from ProductAssoc entity) in which the current product is in productIdTo private ArrayList children; // current node's children (ProductAssocs) private ArrayList childrenNodes; // current node's children nodes (BOMNode) - private double quantityMultiplier; // the necessary quantity as declared in the bom (from ProductAssocs or ProductManufacturingRule) - private double scrapFactor; // the scrap factor as declared in the bom (from ProductAssocs) + private BigDecimal quantityMultiplier; // the necessary quantity as declared in the bom (from ProductAssocs or ProductManufacturingRule) + private BigDecimal scrapFactor; // the scrap factor as declared in the bom (from ProductAssocs) // Runtime fields private int depth; // the depth of this node in the current tree - private double quantity; // the quantity of this node in the current tree + private BigDecimal quantity; // the quantity of this node in the current tree private String bomTypeId; // the type of the current tree public BOMNode(GenericValue product, LocalDispatcher dispatcher, GenericValue userLogin) { @@ -76,11 +77,11 @@ parentNode = null; productForRules = null; bomTypeId = null; - quantityMultiplier = 1; - scrapFactor = 1; + quantityMultiplier = BigDecimal.ONE; + scrapFactor = BigDecimal.ONE; // Now we initialize the fields used in breakdowns depth = 0; - quantity = 0; + quantity = BigDecimal.ZERO; } public BOMNode(String productId, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException { @@ -145,11 +146,11 @@ String ruleCondition = (String)rule.get("productFeature"); String ruleOperator = (String)rule.get("ruleOperator"); String newPart = (String)rule.get("productIdInSubst"); - double ruleQuantity = 0; + BigDecimal ruleQuantity = BigDecimal.ZERO; try { - ruleQuantity = rule.getDouble("quantity").doubleValue(); + ruleQuantity = rule.getBigDecimal("quantity"); } catch(Exception exc) { - ruleQuantity = 0; + ruleQuantity = BigDecimal.ZERO; } GenericValue feature = null; @@ -179,7 +180,7 @@ oneChildNode.setRuleApplied(rule); oneChildNode.setProductAssoc(origNode.getProductAssoc()); oneChildNode.setScrapFactor(origNode.getScrapFactor()); - if (ruleQuantity > 0) { + if (ruleQuantity.compareTo(BigDecimal.ZERO) > 0) { oneChildNode.setQuantityMultiplier(ruleQuantity); } else { oneChildNode.setQuantityMultiplier(origNode.getQuantityMultiplier()); @@ -199,23 +200,24 @@ oneChildNode.setTree(tree); oneChildNode.setProductAssoc(node); try { - oneChildNode.setQuantityMultiplier(node.getDouble("quantity").doubleValue()); + oneChildNode.setQuantityMultiplier(node.getBigDecimal("quantity")); } catch(Exception nfe) { - oneChildNode.setQuantityMultiplier(1); + oneChildNode.setQuantityMultiplier(BigDecimal.ONE); } try { - double percScrapFactor = node.getDouble("scrapFactor").doubleValue(); + BigDecimal percScrapFactor = node.getBigDecimal("scrapFactor"); - // A negative scrap factor is a salvage factor - if (percScrapFactor > -100 && percScrapFactor < 100) { - percScrapFactor = 1 + percScrapFactor / 100; + // A negative scrap factor is a salvage factor + BigDecimal bdHundred = new BigDecimal("100"); + if (percScrapFactor.compareTo(bdHundred.negate()) > 0 && percScrapFactor.compareTo(bdHundred.negate()) < 0) { + percScrapFactor = BigDecimal.ONE.add(percScrapFactor.movePointLeft(2)); } else { Debug.logWarning("A scrap factor of [" + percScrapFactor + "] was ignored", module); - percScrapFactor = 1; + percScrapFactor = BigDecimal.ONE; } oneChildNode.setScrapFactor(percScrapFactor); } catch(Exception nfe) { - oneChildNode.setScrapFactor(1); + oneChildNode.setScrapFactor(BigDecimal.ONE); } BOMNode newNode = oneChildNode; // CONFIGURATOR @@ -376,7 +378,7 @@ } // ------------------------------------ // Method used for TEST and DEBUG purposes - public void print(StringBuffer sb, double quantity, int depth) { + public void print(StringBuffer sb, BigDecimal quantity, int depth) { for (int i = 0; i < depth; i++) { sb.append("<b> * </b>"); } @@ -388,21 +390,21 @@ depth++; for (int i = 0; i < children.size(); i++) { oneChild = (GenericValue)children.get(i); - double bomQuantity = 0; + BigDecimal bomQuantity = BigDecimal.ZERO; try { - bomQuantity = oneChild.getDouble("quantity").doubleValue(); + bomQuantity = oneChild.getBigDecimal("quantity"); } catch(Exception exc) { - bomQuantity = 1; + bomQuantity = BigDecimal.ONE; } oneChildNode = (BOMNode)childrenNodes.get(i); sb.append("<br/>"); if (oneChildNode != null) { - oneChildNode.print(sb, (quantity * bomQuantity), depth); + oneChildNode.print(sb, quantity.multiply(bomQuantity), depth); } } } - public void print(ArrayList arr, double quantity, int depth, boolean excludeWIPs) { + public void print(ArrayList arr, BigDecimal quantity, int depth, boolean excludeWIPs) { // Now we set the depth and quantity of the current node // in this breakdown. this.depth = depth; @@ -418,27 +420,27 @@ } if (serviceName != null) { Map resultContext = null; - Map arguments = UtilMisc.toMap("neededQuantity", new Double(quantity * quantityMultiplier), "amount", new Double((tree!=null? tree.getRootAmount():0))); - Double width = null; + Map arguments = UtilMisc.toMap("neededQuantity", quantity.multiply(quantityMultiplier), "amount", tree != null ? tree.getRootAmount() : BigDecimal.ZERO); + BigDecimal width = null; if (getProduct().get("productWidth") != null) { - width = getProduct().getDouble("productWidth"); + width = getProduct().getBigDecimal("productWidth"); } if (width == null) { - width = new Double(0); + width = BigDecimal.ZERO; } arguments.put("width", width); Map inputContext = UtilMisc.toMap("arguments", arguments, "userLogin", userLogin); try { resultContext = dispatcher.runSync(serviceName, inputContext); - Double calcQuantity = (Double)resultContext.get("quantity"); + BigDecimal calcQuantity = (BigDecimal)resultContext.get("quantity"); if (calcQuantity != null) { - this.quantity = calcQuantity.doubleValue(); + this.quantity = calcQuantity; } } catch (GenericServiceException e) { //Debug.logError(e, "Problem calling the getManufacturingComponents service", module); } } else { - this.quantity = quantity * quantityMultiplier * scrapFactor; + this.quantity = quantity.multiply(quantityMultiplier).multiply(scrapFactor); } // First of all we visit the current node. arr.add(this); @@ -458,11 +460,11 @@ } } - public void getProductsInPackages(ArrayList arr, double quantity, int depth, boolean excludeWIPs) { + public void getProductsInPackages(ArrayList arr, BigDecimal quantity, int depth, boolean excludeWIPs) { // Now we set the depth and quantity of the current node // in this breakdown. this.depth = depth; - this.quantity = quantity * quantityMultiplier * scrapFactor; + this.quantity = quantity.multiply(quantityMultiplier).multiply(scrapFactor); // First of all we visit the current node. if (this.getProduct().getString("shipmentBoxTypeId") != null) { arr.add(this); @@ -492,7 +494,7 @@ nodes.put(product.getString("productId"), sameNode); } // Now we add the current quantity to the node - sameNode.setQuantity(sameNode.getQuantity() + quantity); + sameNode.setQuantity(sameNode.getQuantity().add(quantity)); // Now (recursively) we visit the children. BOMNode oneChildNode = null; for (int i = 0; i < childrenNodes.size(); i++) { @@ -554,7 +556,7 @@ serviceContext.put("workEffortName", "SP_" + shipmentId + "_" + serviceContext.get("productId")); } - serviceContext.put("pRQuantity", new Double(getQuantity())); + serviceContext.put("pRQuantity", getQuantity()); if (UtilValidate.isNotEmpty(maxEndDate)) { serviceContext.put("startDate", maxEndDate); } else { @@ -695,11 +697,11 @@ * @return Value of property quantity. * */ - public double getQuantity() { + public BigDecimal getQuantity() { return quantity; } - public void setQuantity(double quantity) { + public void setQuantity(BigDecimal quantity) { this.quantity = quantity; } @@ -764,7 +766,7 @@ * @return Value of property quantityMultiplier. * */ - public double getQuantityMultiplier() { + public BigDecimal getQuantityMultiplier() { return quantityMultiplier; } @@ -772,7 +774,7 @@ * @param quantityMultiplier New value of property quantityMultiplier. * */ - public void setQuantityMultiplier(double quantityMultiplier) { + public void setQuantityMultiplier(BigDecimal quantityMultiplier) { this.quantityMultiplier = quantityMultiplier; } @@ -796,7 +798,7 @@ * @return Value of property scrapFactor. * */ - public double getScrapFactor() { + public BigDecimal getScrapFactor() { return scrapFactor; } @@ -804,7 +806,7 @@ * @param scrapFactor New value of property scrapFactor. * */ - public void setScrapFactor(double scrapFactor) { + public void setScrapFactor(BigDecimal scrapFactor) { this.scrapFactor = scrapFactor; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java Mon Jan 5 23:13:36 2009 @@ -19,6 +19,7 @@ package org.ofbiz.manufacturing.bom; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; @@ -290,8 +291,8 @@ String fromDateStr = (String) context.get("fromDate"); String bomType = (String) context.get("bomType"); Integer type = (Integer) context.get("type"); - Double quantity = (Double) context.get("quantity"); - Double amount = (Double) context.get("amount"); + BigDecimal quantity = (BigDecimal) context.get("quantity"); + BigDecimal amount = (BigDecimal) context.get("amount"); if (type == null) { type = new Integer(0); } @@ -314,10 +315,10 @@ return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); } if (tree != null && quantity != null) { - tree.setRootQuantity(quantity.doubleValue()); + tree.setRootQuantity(quantity); } if (tree != null && amount != null) { - tree.setRootAmount(amount.doubleValue()); + tree.setRootAmount(amount); } result.put("tree", tree); @@ -339,16 +340,16 @@ GenericValue userLogin = (GenericValue)context.get("userLogin"); String productId = (String) context.get("productId"); - Double quantity = (Double) context.get("quantity"); - Double amount = (Double) context.get("amount"); + BigDecimal quantity = (BigDecimal) context.get("quantity"); + BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); Boolean excludeWIPs = (Boolean) context.get("excludeWIPs"); if (quantity == null) { - quantity = new Double(1); + quantity = BigDecimal.ONE; } if (amount == null) { - amount = new Double(0); + amount = BigDecimal.ZERO; } Date fromDate = null; @@ -372,8 +373,8 @@ ArrayList components = new ArrayList(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_SINGLE_LEVEL, delegator, dispatcher, userLogin); - tree.setRootQuantity(quantity.doubleValue()); - tree.setRootAmount(amount.doubleValue()); + tree.setRootQuantity(quantity); + tree.setRootAmount(amount); tree.print(components, excludeWIPs.booleanValue()); if (components.size() > 0) components.remove(0); } catch(GenericEntityException gee) { @@ -411,7 +412,7 @@ Map componentMap = new HashMap(); BOMNode node = (BOMNode)componentsIt.next(); componentMap.put("product", node.getProduct()); - componentMap.put("quantity", new Double(node.getQuantity())); + componentMap.put("quantity", node); componentsMap.add(componentMap); } result.put("componentsMap", componentsMap); @@ -423,16 +424,16 @@ GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String productId = (String) context.get("productId"); - Double quantity = (Double) context.get("quantity"); - Double amount = (Double) context.get("amount"); + BigDecimal quantity = (BigDecimal) context.get("quantity"); + BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); GenericValue userLogin = (GenericValue)context.get("userLogin"); if (quantity == null) { - quantity = new Double(1); + quantity = BigDecimal.ONE; } if (amount == null) { - amount = new Double(0); + amount = BigDecimal.ZERO; } Date fromDate = null; @@ -451,8 +452,8 @@ ArrayList notAssembledComponents = new ArrayList(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); - tree.setRootQuantity(quantity.doubleValue()); - tree.setRootAmount(amount.doubleValue()); + tree.setRootQuantity(quantity); + tree.setRootAmount(amount); tree.print(components); } catch(GenericEntityException gee) { return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); @@ -539,7 +540,7 @@ // getProductsInPackages Map serviceContext = new HashMap(); serviceContext.put("productId", orderItem.getString("productId")); - serviceContext.put("quantity", orderShipment.getDouble("quantity")); + serviceContext.put("quantity", orderShipment.getBigDecimal("quantity")); Map resultService = null; try { resultService = dispatcher.runSync("getProductsInPackages", serviceContext); @@ -640,11 +641,10 @@ String boxTypeId = (String)boxTypeContentEntry.getKey(); List contentList = (List)boxTypeContentEntry.getValue(); GenericValue boxType = (GenericValue)boxTypes.get(boxTypeId); - Double boxWidth = boxType.getDouble("boxLength"); - double totalWidth = 0; - double boxWidthDbl = 0; - if (boxWidth != null) { - boxWidthDbl = boxWidth.doubleValue(); + BigDecimal boxWidth = boxType.getBigDecimal("boxLength"); + BigDecimal totalWidth = BigDecimal.ZERO; + if (boxWidth == null) { + boxWidth = BigDecimal.ZERO; } String shipmentPackageSeqId = null; for (int i = 0; i < contentList.size(); i++) { @@ -655,7 +655,7 @@ GenericValue orderShipment = (GenericValue)content.get("orderShipment"); GenericValue product = null; - double quantity = 0; + BigDecimal quantity = BigDecimal.ZERO; boolean subProduct = contentMap.containsKey("componentIndex"); if (subProduct) { // multi package @@ -671,35 +671,34 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } - quantity = orderShipment.getDouble("quantity").doubleValue(); + quantity = orderShipment.getBigDecimal("quantity"); } - Double productDepth = product.getDouble("shippingDepth"); + BigDecimal productDepth = product.getBigDecimal("shippingDepth"); if (productDepth == null) { - productDepth = product.getDouble("productDepth"); + productDepth = product.getBigDecimal("productDepth"); } - double productDepthDbl = 1; - if (productDepth != null) { - productDepthDbl = productDepth.doubleValue(); + if (productDepth == null) { + productDepth = BigDecimal.ONE; } - int firstMaxNumOfProducts = (int)((boxWidthDbl - totalWidth) / productDepthDbl); - if (firstMaxNumOfProducts == 0) firstMaxNumOfProducts = 1; + BigDecimal firstMaxNumOfProducts = boxWidth.subtract(totalWidth).divide(productDepth, 0, BigDecimal.ROUND_FLOOR); + if (firstMaxNumOfProducts.compareTo(BigDecimal.ZERO) == 0) firstMaxNumOfProducts = BigDecimal.ONE; // - int maxNumOfProducts = (int)(boxWidthDbl / productDepthDbl); - if (maxNumOfProducts == 0) maxNumOfProducts = 1; + BigDecimal maxNumOfProducts = boxWidth.divide(productDepth, 0, BigDecimal.ROUND_FLOOR); + if (maxNumOfProducts.compareTo(BigDecimal.ZERO) == 0) maxNumOfProducts = BigDecimal.ONE; - double remQuantity = quantity; + BigDecimal remQuantity = quantity; boolean isFirst = true; - while (remQuantity > 0) { - int maxQuantity = 0; + while (remQuantity.compareTo(BigDecimal.ZERO) > 0) { + BigDecimal maxQuantity = BigDecimal.ZERO; if (isFirst) { maxQuantity = firstMaxNumOfProducts; isFirst = false; } else { maxQuantity = maxNumOfProducts; } - double qty = (remQuantity < maxQuantity? remQuantity: maxQuantity); + BigDecimal qty = (remQuantity.compareTo(maxQuantity) < 0 ? remQuantity : maxQuantity); // If needed, create the package if (shipmentPackageSeqId == null) { try { @@ -708,7 +707,7 @@ } catch (GenericServiceException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } - totalWidth = 0; + totalWidth = BigDecimal.ZERO; } try { Map inputMap = null; @@ -718,21 +717,21 @@ "shipmentItemSeqId", orderShipment.getString("shipmentItemSeqId"), "subProductId", product.getString("productId"), "userLogin", userLogin, - "subProductQuantity", new Double(qty)); + "subProductQuantity", qty); } else { inputMap = UtilMisc.toMap("shipmentId", orderShipment.getString("shipmentId"), "shipmentPackageSeqId", shipmentPackageSeqId, "shipmentItemSeqId", orderShipment.getString("shipmentItemSeqId"), "userLogin", userLogin, - "quantity", new Double(qty)); + "quantity", qty); } Map resultService = dispatcher.runSync("createShipmentPackageContent", inputMap); } catch (GenericServiceException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } - totalWidth += qty * productDepthDbl; - if (qty == maxQuantity) shipmentPackageSeqId = null; - remQuantity = remQuantity - qty; + totalWidth = totalWidth.add( qty.multiply(productDepth) ); + if (qty.compareTo(maxQuantity) == 0) shipmentPackageSeqId = null; + remQuantity = remQuantity.subtract(qty); } } } @@ -755,11 +754,11 @@ GenericValue userLogin = (GenericValue)context.get("userLogin"); String productId = (String) context.get("productId"); - Double quantity = (Double) context.get("quantity"); + BigDecimal quantity = (BigDecimal) context.get("quantity"); String fromDateStr = (String) context.get("fromDate"); if (quantity == null) { - quantity = new Double(1); + quantity = BigDecimal.ONE; } Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { @@ -779,7 +778,7 @@ ArrayList components = new ArrayList(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); - tree.setRootQuantity(quantity.doubleValue()); + tree.setRootQuantity(quantity); tree.getProductsInPackages(components); } catch(GenericEntityException gee) { return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java Mon Jan 5 23:13:36 2009 @@ -19,6 +19,7 @@ package org.ofbiz.manufacturing.bom; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -50,8 +51,8 @@ protected GenericDelegator delegator = null; BOMNode root; - double rootQuantity; - double rootAmount; + BigDecimal rootQuantity; + BigDecimal rootAmount; Date inDate; String bomTypeId; GenericValue inputProduct; @@ -157,8 +158,8 @@ } this.bomTypeId = bomTypeId; this.inDate = inDate; - rootQuantity = 1; - rootAmount = 0; + rootQuantity = BigDecimal.ONE; + rootAmount = BigDecimal.ZERO; } public GenericValue getInputProduct() { @@ -199,7 +200,7 @@ * @return Value of property rootQuantity. * */ - public double getRootQuantity() { + public BigDecimal getRootQuantity() { return rootQuantity; } @@ -207,7 +208,7 @@ * @param rootQuantity New value of property rootQuantity. * */ - public void setRootQuantity(double rootQuantity) { + public void setRootQuantity(BigDecimal rootQuantity) { this.rootQuantity = rootQuantity; } @@ -215,7 +216,7 @@ * @return Value of property rootAmount. * */ - public double getRootAmount() { + public BigDecimal getRootAmount() { return rootAmount; } @@ -223,7 +224,7 @@ * @param rootAmount New value of property rootAmount. * */ - public void setRootAmount(double rootAmount) { + public void setRootAmount(BigDecimal rootAmount) { this.rootAmount = rootAmount; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java Mon Jan 5 23:13:36 2009 @@ -19,6 +19,7 @@ package org.ofbiz.manufacturing.jobshopmgt; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Iterator; import java.util.LinkedList; @@ -49,7 +50,7 @@ protected GenericValue productionRun; // WorkEffort (PROD_ORDER_HEADER) protected GenericValue productionRunProduct; // WorkEffortGoodStandard (type: PRUN_PROD_DELIV) protected GenericValue productProduced; // Product (from WorkEffortGoodStandard of type: PRUN_PROD_DELIV) - protected Double quantity; // the estimatedQuantity + protected BigDecimal quantity; // the estimatedQuantity protected Timestamp estimatedStartDate; protected Timestamp estimatedCompletionDate; @@ -165,7 +166,7 @@ try { List productionRunProducts = productionRun.getRelated("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV"),null); this.productionRunProduct = EntityUtil.getFirst(productionRunProducts); - quantity = productionRunProduct.getDouble("estimatedQuantity"); + quantity = productionRunProduct.getBigDecimal("estimatedQuantity"); productProduced = productionRunProduct.getRelatedOneCache("Product"); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); @@ -180,7 +181,7 @@ * get the quantity property. * @return the quantity property **/ - public Double getQuantity(){ + public BigDecimal getQuantity(){ if (exist()) { if (quantity == null) getProductProduced(); return quantity; @@ -191,17 +192,17 @@ * set the quantity property and recalculated the productComponent quantity. * @return **/ - public void setQuantity(Double newQuantity) { + public void setQuantity(BigDecimal newQuantity) { if (quantity == null) getProductProduced(); - double previousQuantity = quantity.doubleValue(), componentQuantity; + BigDecimal previousQuantity = quantity, componentQuantity; this.quantity = newQuantity; this.quantityIsUpdated = true; this.updateCompletionDate = true; if (productionRunComponents == null) getProductionRunComponents(); for (Iterator iter = productionRunComponents.iterator(); iter.hasNext();){ GenericValue component = (GenericValue) iter.next(); - componentQuantity = component.getDouble("estimatedQuantity").doubleValue(); - component.set("estimatedQuantity", new Double(componentQuantity / previousQuantity * newQuantity.doubleValue())); + componentQuantity = component.getBigDecimal("estimatedQuantity"); + component.set("estimatedQuantity", componentQuantity.divide(previousQuantity, 10, BigDecimal.ROUND_HALF_UP).multiply(newQuantity)); } } /** @@ -387,18 +388,15 @@ } /* - * FIXME: the three getEstimatedTaskTime(...) methods will be removed and + * FIXME: the two getEstimatedTaskTime(...) methods will be removed and * implemented in the "getEstimatedTaskTime" service. */ - public static long getEstimatedTaskTime(GenericValue task, double quantity, LocalDispatcher dispatcher) { - return getEstimatedTaskTime(task, new Double(quantity), dispatcher); - } - public static long getEstimatedTaskTime(GenericValue task, Double quantity, LocalDispatcher dispatcher) { + public static long getEstimatedTaskTime(GenericValue task, BigDecimal quantity, LocalDispatcher dispatcher) { return getEstimatedTaskTime(task, quantity, null, null, dispatcher); } - public static long getEstimatedTaskTime(GenericValue task, Double quantity, String productId, String routingId, LocalDispatcher dispatcher) { + public static long getEstimatedTaskTime(GenericValue task, BigDecimal quantity, String productId, String routingId, LocalDispatcher dispatcher) { if (quantity == null) { - quantity = new Double(1); + quantity = BigDecimal.ONE; } if (task == null) return 0; double setupTime = 0; Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java?rev=731851&r1=731850&r2=731851&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java Mon Jan 5 23:13:36 2009 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.manufacturing.jobshopmgt; +import java.math.BigDecimal; import java.sql.Timestamp; import java.util.Collection; import java.util.List; @@ -52,9 +53,9 @@ Map parameters = UtilHttp.getParameterMap(request); - Double quantity = null; + BigDecimal quantity = null; try { - quantity = Double.valueOf((String)parameters.get("quantity")); + quantity = new BigDecimal((String)parameters.get("quantity")); } catch(NumberFormatException nfe) { String errMsg = "Invalid format for quantity field: " + nfe.toString(); Debug.logError(nfe, errMsg, module); |
Free forum by Nabble | Edit this page |