Author: mrisaliti
Date: Sun Mar 13 10:55:49 2011 New Revision: 1081073 URL: http://svn.apache.org/viewvc?rev=1081073&view=rev Log: Remove some reduntant cast warning in manufacturing component (OFBIZ-4102) Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -72,7 +72,7 @@ public class BOMHelper { Iterator<GenericValue> nodesIterator = productNodesList.iterator(); int depth = 0; while (nodesIterator.hasNext()) { - oneNode = (GenericValue)nodesIterator.next(); + oneNode = nodesIterator.next(); depth = 0; depth = getMaxDepth(oneNode.getString("productId"), bomType, inDate, delegator); depth++; @@ -118,9 +118,9 @@ public class BOMHelper { GenericValue duplicatedNode = null; Iterator<GenericValue> nodesIterator = productNodesList.iterator(); while (nodesIterator.hasNext()) { - oneNode = (GenericValue)nodesIterator.next(); + oneNode = nodesIterator.next(); for (int i = 0; i < productIdKeys.size(); i++) { - if (oneNode.getString("productId").equals((String)productIdKeys.get(i))) { + if (oneNode.getString("productId").equals(productIdKeys.get(i))) { return oneNode; } } @@ -143,7 +143,7 @@ public class BOMHelper { List<GenericValue> shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId)); Iterator<GenericValue> shipmentPlansIt = shipmentPlans.iterator(); while (shipmentPlansIt.hasNext()) { - GenericValue shipmentPlan = (GenericValue)shipmentPlansIt.next(); + GenericValue shipmentPlan = shipmentPlansIt.next(); GenericValue orderItem = shipmentPlan.getRelatedOne("OrderItem"); List<GenericValue> productionRuns = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId"))); 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -118,7 +118,7 @@ public class BOMNode { GenericValue oneChild = null; BOMNode oneChildNode = null; while (childrenIterator.hasNext()) { - oneChild = (GenericValue)childrenIterator.next(); + oneChild = childrenIterator.next(); // Configurator oneChildNode = configurator(oneChild, productFeatures, getRootNode().getProductForRules(), inDate); // If the node is null this means that the node has been discarded by the rules. @@ -145,7 +145,7 @@ public class BOMNode { if (productPartRules != null) { GenericValue rule = null; for (int i = 0; i < productPartRules.size(); i++) { - rule = (GenericValue)productPartRules.get(i); + rule = productPartRules.get(i); String ruleCondition = (String)rule.get("productFeature"); String ruleOperator = (String)rule.get("ruleOperator"); String newPart = (String)rule.get("productIdInSubst"); @@ -163,7 +163,7 @@ public class BOMNode { } else { if (productFeatures != null) { for (int j = 0; j < productFeatures.size(); j++) { - feature = (GenericValue)productFeatures.get(j); + feature = productFeatures.get(j); if (ruleCondition.equals((String)feature.get("productFeatureId"))) { ruleSatisfied = true; break; @@ -277,7 +277,7 @@ public class BOMNode { if (productFeatures != null) { GenericValue feature = null; for (int j = 0; j < productFeatures.size(); j++) { - feature = (GenericValue)productFeatures.get(j); + feature = productFeatures.get(j); selectedFeatures.put(feature.getString("productFeatureTypeId"), feature.getString("productFeatureId")); // FIXME } } @@ -292,7 +292,7 @@ public class BOMNode { storeResult = dispatcher.runSync("getProductVariant", context); List<GenericValue> variantProducts = UtilGenerics.checkList(storeResult.get("products")); if (variantProducts.size() == 1) { - variantProduct = (GenericValue)variantProducts.get(0); + variantProduct = variantProducts.get(0); } } catch (GenericServiceException e) { if (Debug.infoOn()) Debug.logInfo("Error calling getProductVariant service " + e.getMessage(), module); @@ -346,7 +346,7 @@ public class BOMNode { GenericValue oneChild = null; BOMNode oneChildNode = null; while (childrenIterator.hasNext()) { - oneChild = (GenericValue)childrenIterator.next(); + oneChild = childrenIterator.next(); oneChildNode = new BOMNode(oneChild.getString("productId"), delegator, dispatcher, userLogin); // Configurator //oneChildNode = configurator(oneChild, productFeatures, getRootNode().getProductForRules(), delegator); @@ -392,14 +392,14 @@ public class BOMNode { BOMNode oneChildNode = null; depth++; for (int i = 0; i < children.size(); i++) { - oneChild = (GenericValue)children.get(i); + oneChild = children.get(i); BigDecimal bomQuantity = BigDecimal.ZERO; try { bomQuantity = oneChild.getBigDecimal("quantity"); } catch (Exception exc) { bomQuantity = BigDecimal.ONE; } - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); sb.append("<br/>"); if (oneChildNode != null) { oneChildNode.print(sb, quantity.multiply(bomQuantity), depth); @@ -451,7 +451,7 @@ public class BOMNode { BOMNode oneChildNode = null; depth++; for (int i = 0; i < children.size(); i++) { - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); if (excludeWIPs && "WIP".equals(oneChildNode.getProduct().getString("productTypeId"))) { continue; } @@ -473,7 +473,7 @@ public class BOMNode { BOMNode oneChildNode = null; depth++; for (int i = 0; i < children.size(); i++) { - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); if (excludeWIPs && "WIP".equals(oneChildNode.getProduct().getString("productTypeId"))) { continue; } @@ -486,7 +486,7 @@ public class BOMNode { public void sumQuantity(Map<String, BOMNode> nodes) { // First of all, we try to fetch a node with the same partId - BOMNode sameNode = (BOMNode)nodes.get(product.getString("productId")); + BOMNode sameNode = nodes.get(product.getString("productId")); // If the node is not found we create a new node for the current product if (sameNode == null) { sameNode = new BOMNode(product, dispatcher, userLogin); @@ -497,7 +497,7 @@ public class BOMNode { // Now (recursively) we visit the children. BOMNode oneChildNode = null; for (int i = 0; i < childrenNodes.size(); i++) { - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); if (oneChildNode != null) { oneChildNode.sumQuantity(nodes); } @@ -512,7 +512,7 @@ public class BOMNode { List<String> childProductionRuns = FastList.newInstance(); Timestamp maxEndDate = null; for (int i = 0; i < childrenNodes.size(); i++) { - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); if (oneChildNode != null) { Map<String, Object> tmpResult = oneChildNode.createManufacturingOrder(facilityId, date, null, null, null, null, null, shipGroupSeqId, shipmentId, false, false); String childProductionRunId = (String)tmpResult.get("productionRunId"); @@ -576,7 +576,7 @@ public class BOMNode { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", shipGroupSeqId)); } for (int i = 0; i < childProductionRuns.size(); i++) { - delegator.create("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", (String)childProductionRuns.get(i), "workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", startDate)); + delegator.create("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", childProductionRuns.get(i), "workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", startDate)); } } } catch (GenericEntityException e) { @@ -594,7 +594,7 @@ public class BOMNode { Timestamp startDate = proposedOrder.getRequirementStartDate(); minStartDate = startDate; for (int i = 0; i < childrenNodes.size(); i++) { - BOMNode oneChildNode = (BOMNode)childrenNodes.get(i); + BOMNode oneChildNode = childrenNodes.get(i); if (oneChildNode != null) { Timestamp childStartDate = oneChildNode.getStartDate(facilityId, startDate, false); if (childStartDate.compareTo(minStartDate) < 0) { @@ -633,7 +633,7 @@ public class BOMNode { } if (UtilValidate.isNotEmpty(pfs)) { for (int i = 0; i < pfs.size(); i++) { - GenericValue pf = (GenericValue)pfs.get(i); + GenericValue pf = pfs.get(i); if (UtilValidate.isNotEmpty(pf.get("minimumStock")) && UtilValidate.isNotEmpty(pf.get("reorderQuantity"))) { isWarehouseManaged = true; break; @@ -682,7 +682,7 @@ public class BOMNode { // Now (recursively) we visit the children. BOMNode oneChildNode = null; for (int i = 0; i < children.size(); i++) { - oneChildNode = (BOMNode)childrenNodes.get(i); + oneChildNode = childrenNodes.get(i); if (oneChildNode != null) { oneChildNode.isConfigured(arr); } 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -86,7 +86,7 @@ public class BOMServices { List<GenericValue> bomTypesValues = delegator.findByAnd("ProductAssocType", UtilMisc.toMap("parentTypeId", "PRODUCT_COMPONENT")); Iterator<GenericValue> bomTypesValuesIt = bomTypesValues.iterator(); while (bomTypesValuesIt.hasNext()) { - bomTypes.add(((GenericValue)bomTypesValuesIt.next()).getString("productAssocTypeId")); + bomTypes.add((bomTypesValuesIt.next()).getString("productAssocTypeId")); } } catch (GenericEntityException gee) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); @@ -100,7 +100,7 @@ public class BOMServices { Iterator<String> bomTypesIt = bomTypes.iterator(); try { while (bomTypesIt.hasNext()) { - String oneBomType = (String)bomTypesIt.next(); + String oneBomType = bomTypesIt.next(); depth = BOMHelper.getMaxDepth(productId, oneBomType, fromDate, delegator); if (depth > maxDepth) { maxDepth = depth; @@ -152,7 +152,7 @@ public class BOMServices { Iterator<GenericValue> virtualProductsIt = virtualProducts.iterator(); while (virtualProductsIt.hasNext()) { int virtualDepth = 0; - GenericValue oneVirtualProductAssoc = (GenericValue)virtualProductsIt.next(); + GenericValue oneVirtualProductAssoc = virtualProductsIt.next(); GenericValue virtualProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", oneVirtualProductAssoc.getString("productId"))); if (virtualProduct.get("billOfMaterialLevel") != null) { virtualDepth = virtualProduct.getLong("billOfMaterialLevel").intValue(); @@ -174,7 +174,7 @@ public class BOMServices { List<BOMNode> products = FastList.newInstance(); tree.print(products, llc.intValue()); for (int i = 0; i < products.size(); i++) { - BOMNode oneNode = (BOMNode)products.get(i); + BOMNode oneNode = products.get(i); GenericValue oneProduct = oneNode.getProduct(); int lev = 0; if (oneProduct.get("billOfMaterialLevel") != null) { @@ -192,7 +192,7 @@ public class BOMServices { variantProducts = EntityUtil.filterByDate(variantProducts, true); Iterator<GenericValue> variantProductsIt = variantProducts.iterator(); while (variantProductsIt.hasNext()) { - GenericValue oneVariantProductAssoc = (GenericValue)variantProductsIt.next(); + GenericValue oneVariantProductAssoc = variantProductsIt.next(); GenericValue variantProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", oneVariantProductAssoc.getString("productId"))); variantProduct.set("billOfMaterialLevel", llc); variantProduct.store(); @@ -224,7 +224,7 @@ public class BOMServices { Long zero = Long.valueOf(0); List<GenericValue> allProducts = FastList.newInstance(); while (productsIt.hasNext()) { - GenericValue product = (GenericValue)productsIt.next(); + GenericValue product = productsIt.next(); product.set("billOfMaterialLevel", zero); allProducts.add(product); } @@ -233,7 +233,7 @@ public class BOMServices { productsIt = products.iterator(); while (productsIt.hasNext()) { - GenericValue product = (GenericValue)productsIt.next(); + GenericValue product = productsIt.next(); try { Map<String, Object> depthResult = dispatcher.runSync("updateLowLevelCode", UtilMisc.<String, Object>toMap("productIdTo", product.getString("productId"), "alsoComponents", Boolean.valueOf(false), "alsoVariants", Boolean.valueOf(false))); Debug.logInfo("Product [" + product.getString("productId") + "] Low Level Code [" + depthResult.get("lowLevelCode") + "]", module); @@ -417,7 +417,7 @@ public class BOMServices { Iterator<BOMNode> componentsIt = components.iterator(); while (componentsIt.hasNext()) { Map<String, Object> componentMap = FastMap.newInstance(); - BOMNode node = (BOMNode)componentsIt.next(); + BOMNode node = componentsIt.next(); componentMap.put("product", node.getProduct()); componentMap.put("quantity", node.getQuantity()); componentsMap.add(componentMap); @@ -468,7 +468,7 @@ public class BOMServices { } Iterator<BOMNode> componentsIt = components.iterator(); while (componentsIt.hasNext()) { - BOMNode oneComponent = (BOMNode)componentsIt.next(); + BOMNode oneComponent = componentsIt.next(); if (!oneComponent.isManufactured()) { notAssembledComponents.add(oneComponent); } @@ -507,7 +507,7 @@ public class BOMServices { Map<String, Object> orderReadHelpers = FastMap.newInstance(); Map<String, Object> partyOrderShipments = FastMap.newInstance(); while (shipmentItemsIt.hasNext()) { - GenericValue shipmentItem = (GenericValue)shipmentItemsIt.next(); + GenericValue shipmentItem = shipmentItemsIt.next(); // Get the OrderShipments List<GenericValue> orderShipments = null; try { @@ -554,7 +554,7 @@ public class BOMServices { } List<BOMNode> productsInPackages = UtilGenerics.checkList(resultService.get("productsInPackages")); if (productsInPackages.size() == 1) { - BOMNode root = (BOMNode)productsInPackages.get(0); + BOMNode root = productsInPackages.get(0); String rootProductId = (root.getSubstitutedNode() != null? root.getSubstitutedNode().getProduct().getString("productId"): root.getProduct().getString("productId")); if (orderItem.getString("productId").equals(rootProductId)) { productsInPackages = null; @@ -583,7 +583,7 @@ public class BOMServices { // there are subcomponents: // this is a multi package shipment item for (int j = 0; j < productsInPackages.size(); j++) { - BOMNode component = (BOMNode)productsInPackages.get(j); + BOMNode component = productsInPackages.get(j); Map<String, Object> boxTypeContentMap = FastMap.newInstance(); boxTypeContentMap.put("content", orderShipmentReadMap); boxTypeContentMap.put("componentIndex", Integer.valueOf(j)); @@ -638,9 +638,9 @@ public class BOMServices { } // The packages and package contents are created. for (Map.Entry<String, List<Map<String, Object>>> boxTypeContentEntry : boxTypeContent.entrySet()) { - String boxTypeId = (String)boxTypeContentEntry.getKey(); + String boxTypeId = boxTypeContentEntry.getKey(); List<Map<String, Object>> contentList = UtilGenerics.checkList(boxTypeContentEntry.getValue()); - GenericValue boxType = (GenericValue)boxTypes.get(boxTypeId); + GenericValue boxType = boxTypes.get(boxTypeId); BigDecimal boxWidth = boxType.getBigDecimal("boxLength"); BigDecimal totalWidth = BigDecimal.ZERO; if (boxWidth == null) { @@ -660,7 +660,7 @@ public class BOMServices { if (subProduct) { // multi package Integer index = (Integer)contentMap.get("componentIndex"); - BOMNode component = (BOMNode)productsInPackages.get(index.intValue()); + BOMNode component = productsInPackages.get(index.intValue()); product = component.getProduct(); quantity = component.getQuantity(); } else { 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -106,7 +106,7 @@ public class BOMTree { List<GenericValue> productFeatures = FastList.newInstance(); GenericValue oneProductFeatureAppl = null; for (int i = 0; i < productFeaturesAppl.size(); i++) { - oneProductFeatureAppl = (GenericValue)productFeaturesAppl.get(i); + oneProductFeatureAppl = productFeaturesAppl.get(i); productFeatures.add(delegator.findByPrimaryKey("ProductFeature", UtilMisc.toMap("productFeatureId", oneProductFeatureAppl.getString("productFeatureId")))); 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -137,13 +137,13 @@ public class ProductionRun { } if (productionRunRoutingTasks != null) { for (Iterator<GenericValue> iter = productionRunRoutingTasks.iterator(); iter.hasNext();) { - GenericValue routingTask = (GenericValue) iter.next(); + GenericValue routingTask = iter.next(); routingTask.store(); } } if (productionRunComponents != null) { for (Iterator<GenericValue> iter = productionRunComponents.iterator(); iter.hasNext();) { - GenericValue component = (GenericValue) iter.next(); + GenericValue component = iter.next(); component.store(); } } @@ -202,7 +202,7 @@ public class ProductionRun { this.updateCompletionDate = true; if (productionRunComponents == null) getProductionRunComponents(); for (Iterator<GenericValue> iter = productionRunComponents.iterator(); iter.hasNext();) { - GenericValue component = (GenericValue) iter.next(); + GenericValue component = iter.next(); componentQuantity = component.getBigDecimal("estimatedQuantity"); component.set("estimatedQuantity", componentQuantity.divide(previousQuantity, 10, BigDecimal.ROUND_HALF_UP).multiply(newQuantity)); } @@ -257,7 +257,7 @@ public class ProductionRun { if (quantity == null) getQuantity(); Timestamp endDate=null; for (Iterator<GenericValue> iter = productionRunRoutingTasks.iterator(); iter.hasNext();) { - GenericValue routingTask = (GenericValue) iter.next(); + GenericValue routingTask = iter.next(); if (priority.compareTo(routingTask.getLong("priority")) <= 0) { // Calculate the estimatedCompletionDate long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity, dispatcher); @@ -332,7 +332,7 @@ public class ProductionRun { productionRunComponents = FastList.newInstance(); GenericValue routingTask; for (Iterator<GenericValue> iter = productionRunRoutingTasks.iterator(); iter.hasNext();) { - routingTask = (GenericValue)iter.next(); + routingTask = iter.next(); productionRunComponents.addAll(routingTask.getRelated("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"),null)); } } catch (GenericEntityException e) { @@ -375,7 +375,7 @@ public class ProductionRun { Debug.logWarning(e.getMessage(), module); } } - return (GenericValue) (UtilValidate.isNotEmpty(productionRunRoutingTasks) ? productionRunRoutingTasks.get(productionRunRoutingTasks.size() - 1): null); + return (UtilValidate.isNotEmpty(productionRunRoutingTasks) ? productionRunRoutingTasks.get(productionRunRoutingTasks.size() - 1): null); } return null; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java?rev=1081073&r1=1081072&r2=1081073&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java Sun Mar 13 10:55:49 2011 @@ -89,7 +89,7 @@ public class ProductionRunHelper { List<GenericValue> linkedWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY"))); for (int i = 0; i < linkedWorkEfforts.size(); i++) { - GenericValue link = (GenericValue)linkedWorkEfforts.get(i); + GenericValue link = linkedWorkEfforts.get(i); getLinkedProductionRuns(delegator, dispatcher, link.getString("workEffortIdFrom"), productionRuns); } } 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=1081073&r1=1081072&r2=1081073&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 Sun Mar 13 10:55:49 2011 @@ -109,7 +109,7 @@ public class ProductionRunServices { List<ProductionRun> mandatoryWorkEfforts = FastList.newInstance(); ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, productionRunId, mandatoryWorkEfforts); for (int i = 1; i < mandatoryWorkEfforts.size(); i++) { - GenericValue mandatoryWorkEffort = ((ProductionRun)mandatoryWorkEfforts.get(i)).getGenericValue(); + GenericValue mandatoryWorkEffort = (mandatoryWorkEfforts.get(i)).getGenericValue(); if (!(mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_CANCELLED"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunFound", locale)); } @@ -127,7 +127,7 @@ public class ProductionRunServices { if (!UtilValidate.isEmpty(products)) { Iterator<GenericValue> productsIt = products.iterator(); while (productsIt.hasNext()) { - GenericValue product = (GenericValue)productsIt.next(); + GenericValue product = productsIt.next(); product.set("statusId", "WEGS_CANCELLED"); product.store(); } @@ -138,7 +138,7 @@ public class ProductionRunServices { GenericValue oneTask = null; String taskId = null; for (int i = 0; i < tasks.size(); i++) { - oneTask = (GenericValue)tasks.get(i); + oneTask = tasks.get(i); taskId = oneTask.getString("workEffortId"); serviceContext.clear(); serviceContext.put("workEffortId", taskId); @@ -152,7 +152,7 @@ public class ProductionRunServices { if (!UtilValidate.isEmpty(components)) { Iterator<GenericValue> componentsIt = components.iterator(); while (componentsIt.hasNext()) { - GenericValue component = (GenericValue)componentsIt.next(); + GenericValue component = componentsIt.next(); component.set("statusId", "WEGS_CANCELLED"); component.store(); } @@ -308,7 +308,7 @@ public class ProductionRunServices { Iterator<GenericValue> rt = routingTaskAssocs.iterator(); boolean first = true; while (rt.hasNext()) { - GenericValue routingTaskAssoc = (GenericValue) rt.next(); + GenericValue routingTaskAssoc = rt.next(); if (EntityUtil.isValueActive(routingTaskAssoc, startDate)) { GenericValue routingTask = null; @@ -372,7 +372,7 @@ public class ProductionRunServices { while (pb.hasNext()) { // The components variable contains a list of BOMNodes: // each node represents a product (component). - BOMNode node = (BOMNode) pb.next(); + BOMNode node = pb.next(); GenericValue productBom = node.getProductAssoc(); if ((productBom.getString("routingWorkEffortId") == null && first) || (productBom.getString("routingWorkEffortId") != null && productBom.getString("routingWorkEffortId").equals(routingTask.getString("workEffortId")))) { serviceContext.clear(); @@ -435,7 +435,7 @@ public class ProductionRunServices { if (workEffortPartyAssignments != null) { Iterator<GenericValue> i = workEffortPartyAssignments.iterator(); while (i.hasNext()) { - GenericValue workEffortPartyAssignment = (GenericValue) i.next(); + GenericValue workEffortPartyAssignment = i.next(); Map<String, Object> partyToWorkEffort = UtilMisc.<String, Object>toMap( "workEffortId", productionRunTaskId, "partyId", workEffortPartyAssignment.getString("partyId"), @@ -602,7 +602,7 @@ public class ProductionRunServices { // change the production run tasks status to PRUN_SCHEDULED Iterator<GenericValue> tasks = productionRun.getProductionRunRoutingTasks().iterator(); while (tasks.hasNext()) { - GenericValue task = (GenericValue)tasks.next(); + GenericValue task = tasks.next(); serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", statusId); @@ -636,7 +636,7 @@ public class ProductionRunServices { // change the production run tasks status to PRUN_DOC_PRINTED Iterator<GenericValue> tasks = productionRun.getProductionRunRoutingTasks().iterator(); while (tasks.hasNext()) { - GenericValue task = (GenericValue)tasks.next(); + GenericValue task = tasks.next(); serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", "PRUN_DOC_PRINTED"); @@ -661,7 +661,7 @@ public class ProductionRunServices { try { List<GenericValue> mandatoryWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY"))); for (int i = 0; i < mandatoryWorkEfforts.size(); i++) { - GenericValue mandatoryWorkEffortAssoc = (GenericValue)mandatoryWorkEfforts.get(i); + GenericValue mandatoryWorkEffortAssoc = mandatoryWorkEfforts.get(i); GenericValue mandatoryWorkEffort = mandatoryWorkEffortAssoc.getRelatedOne("FromWorkEffort"); if (!(mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_COMPLETED") || mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_RUNNING") || @@ -728,7 +728,7 @@ public class ProductionRunServices { // change the production run tasks status to PRUN_CLOSED Iterator<GenericValue> tasks = productionRun.getProductionRunRoutingTasks().iterator(); while (tasks.hasNext()) { - GenericValue task = (GenericValue)tasks.next(); + GenericValue task = tasks.next(); serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", "PRUN_CLOSED"); @@ -773,7 +773,7 @@ public class ProductionRunServices { boolean allTaskCompleted = true; boolean allPrecTaskCompletedOrRunning = true; for (int i = 0; i < tasks.size(); i++) { - oneTask = (GenericValue)tasks.get(i); + oneTask = tasks.get(i); if (oneTask.getString("workEffortId").equals(taskId)) { theTask = oneTask; } else { @@ -942,7 +942,7 @@ public class ProductionRunServices { UtilMisc.toMap("productId", productionRun.getProductProduced().getString("productId")), UtilMisc.toList("sequenceNum")); for (int i = 0; i < productCostComponentCalcs.size(); i++) { - GenericValue productCostComponentCalc = (GenericValue)productCostComponentCalcs.get(i); + GenericValue productCostComponentCalc = productCostComponentCalcs.get(i); GenericValue costComponentCalc = productCostComponentCalc.getRelatedOne("CostComponentCalc"); GenericValue customMethod = costComponentCalc.getRelatedOne("CustomMethod"); if (customMethod == null) { @@ -1002,7 +1002,7 @@ public class ProductionRunServices { BigDecimal totalCost = ZERO; BigDecimal totalCostNoMaterials = ZERO; while (costComponentsIt.hasNext()) { - GenericValue costComponent = (GenericValue)costComponentsIt.next(); + GenericValue costComponent = costComponentsIt.next(); BigDecimal cost = costComponent.getBigDecimal("cost"); totalCost = totalCost.add(cost); if (!"ACTUAL_MAT_COST".equals(costComponent.getString("costComponentTypeId"))) { @@ -1034,7 +1034,7 @@ public class ProductionRunServices { BigDecimal productionRunHeaderCost = (BigDecimal)outputMap.get("totalCost"); totalCost = totalCost.add(productionRunHeaderCost); while (tasksIt.hasNext()) { - GenericValue task = (GenericValue)tasksIt.next(); + GenericValue task = tasksIt.next(); outputMap = dispatcher.runSync("getWorkEffortCosts", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", task.getString("workEffortId"))); BigDecimal taskCost = (BigDecimal)outputMap.get("totalCost"); @@ -1087,7 +1087,7 @@ public class ProductionRunServices { Iterator<GenericValue> workEffortCostCalcsIt = workEffortCostCalcs.iterator(); while (workEffortCostCalcsIt.hasNext()) { - GenericValue workEffortCostCalc = (GenericValue)workEffortCostCalcsIt.next(); + GenericValue workEffortCostCalc = workEffortCostCalcsIt.next(); GenericValue costComponentCalc = workEffortCostCalc.getRelatedOne("CostComponentCalc"); GenericValue customMethod = costComponentCalc.getRelatedOne("CustomMethod"); if (UtilValidate.isEmpty(customMethod) || UtilValidate.isEmpty(customMethod.getString("customMethodName"))) { @@ -1168,7 +1168,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", productionRunTaskId)).iterator(); Map<String, BigDecimal> materialsCostByCurrency = FastMap.newInstance(); while (inventoryAssignIt.hasNext()) { - GenericValue inventoryConsumed = (GenericValue)inventoryAssignIt.next(); + GenericValue inventoryConsumed = inventoryAssignIt.next(); BigDecimal quantity = inventoryConsumed.getBigDecimal("quantity"); BigDecimal unitCost = inventoryConsumed.getBigDecimal("unitCost"); if (UtilValidate.isEmpty(unitCost) || UtilValidate.isEmpty(quantity)) { @@ -1178,14 +1178,14 @@ public class ProductionRunServices { if (!materialsCostByCurrency.containsKey(currencyUomId)) { materialsCostByCurrency.put(currencyUomId, BigDecimal.ZERO); } - BigDecimal materialsCost = (BigDecimal)materialsCostByCurrency.get(currencyUomId); + BigDecimal materialsCost = materialsCostByCurrency.get(currencyUomId); materialsCost = materialsCost.add(unitCost.multiply(quantity)).setScale(decimals, rounding); materialsCostByCurrency.put(currencyUomId, materialsCost); } Iterator<String> currencyIt = materialsCostByCurrency.keySet().iterator(); while (currencyIt.hasNext()) { - String currencyUomId = (String)currencyIt.next(); - BigDecimal materialsCost = (BigDecimal)materialsCostByCurrency.get(currencyUomId); + String currencyUomId = currencyIt.next(); + BigDecimal materialsCost = materialsCostByCurrency.get(currencyUomId); Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", productionRunTaskId); inMap.put("costComponentTypeId", "ACTUAL_MAT_COST"); @@ -1241,7 +1241,7 @@ public class ProductionRunServices { List<GenericValue> pRRoutingTasks = productionRun.getProductionRunRoutingTasks(); boolean first = true; for (Iterator<GenericValue> iter = pRRoutingTasks.iterator(); iter.hasNext();) { - GenericValue routingTask = (GenericValue) iter.next(); + GenericValue routingTask = iter.next(); if (priority.equals(routingTask.get("priority")) && ! routingTaskId.equals(routingTask.get("workEffortId"))) return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskSeqIdAlreadyExist", locale)); if (routingTaskId.equals(routingTask.get("workEffortId"))) { @@ -1309,7 +1309,7 @@ public class ProductionRunServices { if (workEffortId != null) { boolean found = false; for (int i = 0; i < tasks.size(); i++) { - GenericValue oneTask = (GenericValue)tasks.get(i); + GenericValue oneTask = tasks.get(i); if (oneTask.getString("workEffortId").equals(workEffortId)) { found = true; break; @@ -1379,7 +1379,7 @@ public class ProductionRunServices { boolean found = false; GenericValue theComponent = null; for (int i = 0; i < components.size(); i++) { - theComponent = (GenericValue)components.get(i); + theComponent = components.get(i); if (theComponent.getString("productId").equals(productId)) { if (workEffortId != null) { if (theComponent.getString("workEffortId").equals(workEffortId)) { @@ -1541,7 +1541,7 @@ public class ProductionRunServices { if (workEffortPartyAssignments != null) { Iterator<GenericValue> i = workEffortPartyAssignments.iterator(); while (i.hasNext()) { - GenericValue workEffortPartyAssignment = (GenericValue) i.next(); + GenericValue workEffortPartyAssignment = i.next(); Map<String, Object> partyToWorkEffort = UtilMisc.<String, Object>toMap( "workEffortId", productionRunTaskId, "partyId", workEffortPartyAssignment.getString("partyId"), @@ -1811,7 +1811,7 @@ public class ProductionRunServices { List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); for (int i = 0; i < tasks.size(); i++) { - GenericValue oneTask = (GenericValue)tasks.get(i); + GenericValue oneTask = tasks.get(i); String taskId = oneTask.getString("workEffortId"); if ("PRUN_RUNNING".equals(oneTask.getString("currentStatusId"))) { BigDecimal quantityDeclared = oneTask.getBigDecimal("quantityProduced"); @@ -1977,7 +1977,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", productionRunTaskId, "productId", productId))).iterator(); BigDecimal totalIssued = BigDecimal.ZERO; while (issuances.hasNext()) { - GenericValue issuance = (GenericValue)issuances.next(); + GenericValue issuance = issuances.next(); BigDecimal issued = issuance.getBigDecimal("quantity"); if (issued != null) { totalIssued = totalIssued.add(issued); @@ -1987,7 +1987,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", productionRunTaskId, "productId", productId))).iterator(); BigDecimal totalReturned = BigDecimal.ZERO; while (returns.hasNext()) { - GenericValue returned = (GenericValue)returns.next(); + GenericValue returned = returns.next(); GenericValue returnDetail = EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", UtilMisc.toMap("inventoryItemId", returned.getString("inventoryItemId")), UtilMisc.toList("inventoryItemDetailSeqId"))); if (returnDetail != null) { BigDecimal qtyReturned = returnDetail.getBigDecimal("quantityOnHandDiff"); @@ -2072,7 +2072,7 @@ public class ProductionRunServices { GenericValue theTask = null; GenericValue oneTask = null; for (int i = 0; i < tasks.size(); i++) { - oneTask = (GenericValue)tasks.get(i); + oneTask = tasks.get(i); if (oneTask.getString("workEffortId").equals(workEffortId)) { theTask = oneTask; break; @@ -2338,12 +2338,12 @@ public class ProductionRunServices { Iterator<ConfigOption> options = config.getSelectedOptions().iterator(); Map<String, BigDecimal> components = FastMap.newInstance(); while (options.hasNext()) { - ConfigOption co = (ConfigOption)options.next(); + ConfigOption co = options.next(); //components.addAll(co.getComponents()); Iterator<GenericValue> selComponents = co.getComponents().iterator(); while (selComponents.hasNext()) { BigDecimal componentQuantity = null; - GenericValue selComponent = (GenericValue)selComponents.next(); + GenericValue selComponent = selComponents.next(); if (selComponent.get("quantity") != null) { componentQuantity = selComponent.getBigDecimal("quantity"); } @@ -2354,12 +2354,12 @@ public class ProductionRunServices { if (co.isVirtualComponent(selComponent)) { Map<String, String> componentOptions = co.getComponentOptions(); if (UtilValidate.isNotEmpty(componentOptions) && UtilValidate.isNotEmpty(componentOptions.get(componentProductId))) { - componentProductId = (String)componentOptions.get(componentProductId); + componentProductId = componentOptions.get(componentProductId); } } componentQuantity = quantity.multiply(componentQuantity); if (components.containsKey(componentProductId)) { - BigDecimal totalQuantity = (BigDecimal)components.get(componentProductId); + BigDecimal totalQuantity = components.get(componentProductId); componentQuantity = totalQuantity.add(componentQuantity); } @@ -2616,7 +2616,7 @@ public class ProductionRunServices { } List<String> productionRuns = FastList.newInstance(); for (int i = 0; i < orderItems.size(); i++) { - GenericValue orderItemOrShipGroupAssoc = (GenericValue)orderItems.get(i); + GenericValue orderItemOrShipGroupAssoc = orderItems.get(i); String productId = null; BigDecimal amount = null; GenericValue orderItem = null; @@ -2782,7 +2782,7 @@ public class ProductionRunServices { GenericValue oneTask = null; String taskId = null; for (int i = 0; i < tasks.size(); i++) { - oneTask = (GenericValue)tasks.get(i); + oneTask = tasks.get(i); taskId = oneTask.getString("workEffortId"); try { Map<String, Object> serviceContext = FastMap.newInstance(); @@ -2815,7 +2815,7 @@ public class ProductionRunServices { GenericValue oneTask = null; String taskId = null; for (int i = 0; i < tasks.size(); i++) { - oneTask = (GenericValue)tasks.get(i); + oneTask = tasks.get(i); taskId = oneTask.getString("workEffortId"); if ("PRUN_CREATED".equals(oneTask.getString("currentStatusId")) || "PRUN_SCHEDULED".equals(oneTask.getString("currentStatusId")) || @@ -2940,7 +2940,7 @@ public class ProductionRunServices { UtilMisc.toList("-estimatedStartDate"), null, false); if (outgoingProductionRuns != null) { for (int i = 0; i < outgoingProductionRuns.size(); i++) { - GenericValue outgoingProductionRun = (GenericValue)outgoingProductionRuns.get(i); + GenericValue outgoingProductionRun = outgoingProductionRuns.get(i); BigDecimal qty = outgoingProductionRun.getBigDecimal("estimatedQuantity"); qty = qty != null ? qty : BigDecimal.ZERO; totQty = totQty.add(qty); @@ -3115,7 +3115,7 @@ public class ProductionRunServices { "statusId", "WEGS_CREATED", "workEffortTypeId", "PROD_ORDER_HEADER")); Iterator<GenericValue> iteratorResult = resultList.iterator(); while (iteratorResult.hasNext()) { - GenericValue genericResult = (GenericValue) iteratorResult.next(); + GenericValue genericResult = iteratorResult.next(); if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || "PRUN_CREATED".equals(genericResult.getString("currentStatusId"))) { continue; @@ -3160,7 +3160,7 @@ public class ProductionRunServices { String orderId = null; GenericValue orderDeliverySchedule = null; while (iteratorResult.hasNext()) { - GenericValue genericResult = (GenericValue) iteratorResult.next(); + GenericValue genericResult = iteratorResult.next(); String newOrderId = genericResult.getString("orderId"); if (!newOrderId.equals(orderId)) { orderDeliverySchedule = null; @@ -3213,7 +3213,7 @@ public class ProductionRunServices { UtilMisc.toList("shipBeforeDate"), null, false); Iterator<GenericValue> backordersIt = backorders.iterator(); while (backordersIt.hasNext()) { - GenericValue genericResult = (GenericValue) backordersIt.next(); + GenericValue genericResult = backordersIt.next(); String productId = genericResult.getString("productId"); GenericValue orderItemShipGroup = delegator.findByPrimaryKey("OrderItemShipGroup", UtilMisc.toMap("orderId", genericResult.get("orderId"), "shipGroupSeqId", genericResult.get("shipGroupSeqId"))); @@ -3233,7 +3233,7 @@ public class ProductionRunServices { // iterate and 'reserve' Iterator<Timestamp> subsetMapKeysIt = subsetMap.keySet().iterator(); while (subsetMapKeysIt.hasNext()) { - Timestamp currentDate = (Timestamp)subsetMapKeysIt.next(); + Timestamp currentDate = subsetMapKeysIt.next(); Map<String, Object> currentDateMap = UtilGenerics.checkMap(subsetMap.get(currentDate)); //List reservations = (List)currentDateMap.get("reservations"); BigDecimal remainingQty = (BigDecimal)currentDateMap.get("remainingQty"); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?rev=1081073&r1=1081072&r2=1081073&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Sun Mar 13 10:55:49 2011 @@ -105,7 +105,7 @@ public class MrpServices { try { Iterator<GenericValue> listResultIt = listResult.iterator(); while (listResultIt.hasNext()) { - GenericValue tmpRequirement = (GenericValue)listResultIt.next(); + GenericValue tmpRequirement = listResultIt.next(); listResultRoles.addAll(tmpRequirement.getRelated("RequirementRole")); //int numOfRecordsRemoved = delegator.removeRelated("RequirementRole", tmpRequirement); } @@ -159,7 +159,7 @@ public class MrpServices { } iteratorResult = resultList.iterator(); while (iteratorResult.hasNext()) { - genericResult = (GenericValue) iteratorResult.next(); + genericResult = iteratorResult.next(); String productId = genericResult.getString("productId"); BigDecimal reservedQuantity = genericResult.getBigDecimal("reservedQuantity"); BigDecimal shipGroupQuantity = genericResult.getBigDecimal("quantity"); @@ -221,7 +221,7 @@ public class MrpServices { } iteratorResult = resultList.iterator(); while (iteratorResult.hasNext()) { - genericResult = (GenericValue) iteratorResult.next(); + genericResult = iteratorResult.next(); String productId = genericResult.getString("productId"); BigDecimal eventQuantityTmp = genericResult.getBigDecimal("quantity"); if (productId == null || eventQuantityTmp == null) { |
Free forum by Nabble | Edit this page |