Author: doogie
Date: Sat Mar 21 23:44:48 2009 New Revision: 757092 URL: http://svn.apache.org/viewvc?rev=757092&view=rev Log: Fix purely empty whitespace lines, and remove trailing whitespace. 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/ProductionRunEvents.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/InventoryEventPlannedServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/routing/RoutingServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -39,13 +39,13 @@ * These methods are also available as services (see {@link BOMServices}). */ public class BOMHelper { - + public static final String module = BOMHelper.class.getName(); - + /** Creates a new instance of BOMHelper */ public BOMHelper() { } - + /** Returns the product's low level code (llc) i.e. the maximum depth * in which the productId can be found in any of the * bills of materials of bomType type. @@ -67,7 +67,7 @@ // If the date is null, set it to today. if (inDate == null) inDate = new Date(); int maxDepth = 0; - List productNodesList = delegator.findByAndCache("ProductAssoc", + List productNodesList = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType)); productNodesList = EntityUtil.filterByDate(productNodesList, inDate); @@ -83,7 +83,7 @@ maxDepth = depth; } } - + return maxDepth; } @@ -100,11 +100,11 @@ * @throws GenericEntityException If a db problem occurs * @return the ProductAssoc generic value for a duplicate productIdKey * ancestor if present, null otherwise. - */ + */ public static GenericValue searchDuplicatedAncestor(String productId, String productIdKey, String bomType, Date inDate, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException { return searchDuplicatedAncestor(productId, productIdKey, null, bomType, inDate, delegator, dispatcher, userLogin); } - + private static GenericValue searchDuplicatedAncestor(String productId, String productIdKey, ArrayList productIdKeys, String bomType, Date inDate, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException { // If the date is null, set it to today. if (inDate == null) inDate = new Date(); @@ -113,7 +113,7 @@ productIdKeys = tree.getAllProductsId(); productIdKeys.add(productIdKey); } - List productNodesList = delegator.findByAndCache("ProductAssoc", + List productNodesList = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType)); productNodesList = EntityUtil.filterByDate(productNodesList, inDate); @@ -148,7 +148,7 @@ while (shipmentPlansIt.hasNext()) { GenericValue shipmentPlan = (GenericValue)shipmentPlansIt.next(); GenericValue orderItem = shipmentPlan.getRelatedOne("OrderItem"); - + List productionRuns = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"))); if (UtilValidate.isNotEmpty(productionRuns)) { Debug.logError("Production Run for order item (" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + ") not created.", module); 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -50,7 +50,7 @@ protected LocalDispatcher dispatcher = null; protected GenericDelegator delegator = null; protected GenericValue userLogin = null; - + private BOMTree tree; // the tree to which this node belongs private BOMNode parentNode; // the parent node (null if it's not present) private BOMNode substitutedNode; // The virtual node (if any) that this instance substitutes @@ -66,7 +66,7 @@ private int depth; // the depth 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) { this.product = product; this.delegator = product.getDelegator(); @@ -96,16 +96,16 @@ if (inDate == null) inDate = new Date(); bomTypeId = partBomTypeId; // GenericDelegator delegator = product.getDelegator(); - List rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", product.get("productId"), + List rows = delegator.findByAnd("ProductAssoc", + UtilMisc.toMap("productId", product.get("productId"), "productAssocTypeId", partBomTypeId), UtilMisc.toList("sequenceNum","productIdTo ASC")); rows = EntityUtil.filterByDate(rows, inDate); if ((UtilValidate.isEmpty(rows)) && substitutedNode != null) { // If no child is found and this is a substituted node // we try to search for substituted node's children. - rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productId", substitutedNode.getProduct().get("productId"), + rows = delegator.findByAnd("ProductAssoc", + UtilMisc.toMap("productId", substitutedNode.getProduct().get("productId"), "productAssocTypeId", partBomTypeId), UtilMisc.toList("sequenceNum")); rows = EntityUtil.filterByDate(rows, inDate); @@ -127,7 +127,7 @@ oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, BOMTree.EXPLOSION); break; case BOMTree.EXPLOSION_MANUFACTURING: - // for manufacturing trees, do not look through and create production runs for children unless there is no warehouse stocking of this node item + // for manufacturing trees, do not look through and create production runs for children unless there is no warehouse stocking of this node item if (!oneChildNode.isWarehouseManaged(null)) { // FIXME: we will need to pass a facilityId here oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, type); } @@ -190,11 +190,11 @@ } // FIXME: AND operator still not implemented } // end of for - + } return oneChildNode; } - + private BOMNode configurator(GenericValue node, List productFeatures, String productIdForRules, Date inDate) throws GenericEntityException { BOMNode oneChildNode = new BOMNode((String)node.get("productIdTo"), delegator, dispatcher, userLogin); oneChildNode.setTree(tree); @@ -323,16 +323,16 @@ bomTypeId = partBomTypeId; // GenericDelegator delegator = product.getDelegator(); - List rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", product.get("productId"), + List rows = delegator.findByAnd("ProductAssoc", + UtilMisc.toMap("productIdTo", product.get("productId"), "productAssocTypeId", partBomTypeId), UtilMisc.toList("sequenceNum")); rows = EntityUtil.filterByDate(rows, inDate); if ((UtilValidate.isEmpty(rows)) && substitutedNode != null) { // If no parent is found and this is a substituted node // we try to search for substituted node's parents. - rows = delegator.findByAnd("ProductAssoc", - UtilMisc.toMap("productIdTo", substitutedNode.getProduct().get("productId"), + rows = delegator.findByAnd("ProductAssoc", + UtilMisc.toMap("productIdTo", substitutedNode.getProduct().get("productId"), "productAssocTypeId", partBomTypeId), UtilMisc.toList("sequenceNum")); rows = EntityUtil.filterByDate(rows, inDate); @@ -357,7 +357,7 @@ } } - + /** Getter for property parentNode. * @return Value of property parentNode. * @@ -555,7 +555,7 @@ if (!UtilValidate.isEmpty(shipmentId) && UtilValidate.isEmpty(workEffortName)) { serviceContext.put("workEffortName", "SP_" + shipmentId + "_" + serviceContext.get("productId")); } - + serviceContext.put("pRQuantity", getQuantity()); if (UtilValidate.isNotEmpty(maxEndDate)) { serviceContext.put("startDate", maxEndDate); @@ -670,7 +670,7 @@ public boolean isManufactured() { return isManufactured(false); } - + public boolean isVirtual() { return (product.get("isVirtual") != null? product.get("isVirtual").equals("Y"): false); } @@ -691,7 +691,7 @@ } } } - + /** Getter for property quantity. * @return Value of property quantity. @@ -713,11 +713,11 @@ public int getDepth() { return depth; } - + public GenericValue getProduct() { return product; } - + /** Getter for property substitutedNode. * @return Value of property substitutedNode. * @@ -725,7 +725,7 @@ public BOMNode getSubstitutedNode() { return substitutedNode; } - + /** Setter for property substitutedNode. * @param substitutedNode New value of property substitutedNode. * @@ -737,7 +737,7 @@ public String getRootProductForRules() { return getParentNode().getProductForRules(); } - + /** Getter for property productForRules. * @return Value of property productForRules. * @@ -745,7 +745,7 @@ public String getProductForRules() { return productForRules; } - + /** Setter for property productForRules. * @param productForRules New value of property productForRules. * @@ -753,7 +753,7 @@ public void setProductForRules(String productForRules) { this.productForRules = productForRules; } - + /** Getter for property bomTypeId. * @return Value of property bomTypeId. * @@ -761,15 +761,15 @@ public java.lang.String getBomTypeId() { return bomTypeId; } - + /** Getter for property quantityMultiplier. * @return Value of property quantityMultiplier. * */ public BigDecimal getQuantityMultiplier() { return quantityMultiplier; - } - + } + /** Setter for property quantityMultiplier. * @param quantityMultiplier New value of property quantityMultiplier. * @@ -777,7 +777,7 @@ public void setQuantityMultiplier(BigDecimal quantityMultiplier) { this.quantityMultiplier = quantityMultiplier; } - + /** Getter for property ruleApplied. * @return Value of property ruleApplied. * @@ -785,7 +785,7 @@ public org.ofbiz.entity.GenericValue getRuleApplied() { return ruleApplied; } - + /** Setter for property ruleApplied. * @param ruleApplied New value of property ruleApplied. * @@ -793,7 +793,7 @@ public void setRuleApplied(org.ofbiz.entity.GenericValue ruleApplied) { this.ruleApplied = ruleApplied; } - + /** Getter for property scrapFactor. * @return Value of property scrapFactor. * @@ -801,7 +801,7 @@ public BigDecimal getScrapFactor() { return scrapFactor; } - + /** Setter for property scrapFactor. * @param scrapFactor New value of property scrapFactor. * @@ -809,7 +809,7 @@ public void setScrapFactor(BigDecimal scrapFactor) { this.scrapFactor = scrapFactor; } - + /** Getter for property childrenNodes. * @return Value of property childrenNodes. * @@ -817,7 +817,7 @@ public java.util.ArrayList getChildrenNodes() { return childrenNodes; } - + /** Setter for property childrenNodes. * @param childrenNodes New value of property childrenNodes. * @@ -825,7 +825,7 @@ public void setChildrenNodes(java.util.ArrayList childrenNodes) { this.childrenNodes = childrenNodes; } - + /** Getter for property productAssoc. * @return Value of property productAssoc. * @@ -833,7 +833,7 @@ public org.ofbiz.entity.GenericValue getProductAssoc() { return productAssoc; } - + /** Setter for property productAssoc. * @param productAssoc New value of property productAssoc. * @@ -845,7 +845,7 @@ public void setTree(BOMTree tree) { this.tree = tree; } - + public BOMTree getTree() { return tree; } 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -51,7 +51,7 @@ public static final String module = BOMServices.class.getName(); public static final String resource = "ManufacturingUiLabels"; - + /** Returns the product's low level code (llc) i.e. the maximum depth * in which the productId can be found in any of the * bills of materials of bomType type. @@ -59,7 +59,7 @@ * @param dctx * @param context * @return - */ + */ public static Map getMaxDepth(DispatchContext dctx, Map context) { Map result = new HashMap(); @@ -67,7 +67,7 @@ String productId = (String) context.get("productId"); String fromDateStr = (String) context.get("fromDate"); String bomType = (String) context.get("bomType"); - + Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { try { @@ -92,7 +92,7 @@ } else { bomTypes.add(bomType); } - + int depth = 0; int maxDepth = 0; Iterator bomTypesIt = bomTypes.iterator(); @@ -112,14 +112,14 @@ return result; } - /** Updates the product's low level code (llc) + /** Updates the product's low level code (llc) * Given a product id, computes and updates the product's low level code (field billOfMaterialLevel in Product entity). * It also updates the llc of all the product's descendants. * For the llc only the manufacturing bom ("MANUF_COMPONENT") is considered. * @param dctx * @param context * @return - */ + */ public static Map updateLowLevelCode(DispatchContext dctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); @@ -139,7 +139,7 @@ GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); Map depthResult = dispatcher.runSync("getMaxDepth", UtilMisc.toMap("productId", productId, "bomType", "MANUF_COMPONENT")); llc = (Long)depthResult.get("depth"); - // If the product is a variant of a virtual, then the billOfMaterialLevel cannot be + // If the product is a variant of a virtual, then the billOfMaterialLevel cannot be // lower than the billOfMaterialLevel of the virtual product. List virtualProducts = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", "PRODUCT_VARIANT")); virtualProducts = EntityUtil.filterByDate(virtualProducts); @@ -204,7 +204,7 @@ * @param dctx * @param context * @return - */ + */ public static Map initLowLevelCode(DispatchContext dctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); @@ -247,13 +247,13 @@ * @param dctx * @param context * @return - */ + */ public static Map searchDuplicatedAncestor(DispatchContext dctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - + String productId = (String) context.get("productId"); String productIdKey = (String) context.get("productIdTo"); Timestamp fromDate = (Timestamp) context.get("fromDate"); @@ -280,7 +280,7 @@ * @param dctx * @param context * @return - */ + */ public static Map getBOMTree(DispatchContext dctx, Map context) { Map result = new HashMap(); @@ -296,7 +296,7 @@ if (type == null) { type = new Integer(0); } - + Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { try { @@ -307,7 +307,7 @@ if (fromDate == null) { fromDate = new Date(); } - + BOMTree tree = null; try { tree = new BOMTree(productId, bomType, fromDate, type.intValue(), delegator, dispatcher, userLogin); @@ -331,7 +331,7 @@ * @param dctx * @param context * @return - */ + */ public static Map getManufacturingComponents(DispatchContext dctx, Map context) { Map result = new HashMap(); @@ -344,7 +344,7 @@ BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); Boolean excludeWIPs = (Boolean) context.get("excludeWIPs"); - + if (quantity == null) { quantity = BigDecimal.ONE; } @@ -365,7 +365,7 @@ if (excludeWIPs == null) { excludeWIPs = Boolean.TRUE; } - + // // Components // @@ -446,7 +446,7 @@ if (fromDate == null) { fromDate = new Date(); } - + BOMTree tree = null; ArrayList components = new ArrayList(); ArrayList notAssembledComponents = new ArrayList(); @@ -468,7 +468,7 @@ result.put("notAssembledComponents" , notAssembledComponents); return result; } - + // --------------------------------------------- // Service for the Product (Shipment) component // @@ -681,10 +681,10 @@ if (productDepth == null) { productDepth = BigDecimal.ONE; } - + BigDecimal firstMaxNumOfProducts = boxWidth.subtract(totalWidth).divide(productDepth, 0, BigDecimal.ROUND_FLOOR); if (firstMaxNumOfProducts.compareTo(BigDecimal.ZERO) == 0) firstMaxNumOfProducts = BigDecimal.ONE; - // + // BigDecimal maxNumOfProducts = boxWidth.divide(productDepth, 0, BigDecimal.ROUND_FLOOR); if (maxNumOfProducts.compareTo(BigDecimal.ZERO) == 0) maxNumOfProducts = BigDecimal.ONE; @@ -745,18 +745,18 @@ * @param dctx * @param context * @return - */ + */ public static Map getProductsInPackages(DispatchContext dctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - + String productId = (String) context.get("productId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); String fromDateStr = (String) context.get("fromDate"); - + if (quantity == null) { quantity = BigDecimal.ONE; } @@ -770,7 +770,7 @@ if (fromDate == null) { fromDate = new Date(); } - + // // Components // @@ -783,7 +783,7 @@ } catch (GenericEntityException gee) { return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); } - + result.put("productsInPackages", components); return result; 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -39,7 +39,7 @@ /** It represents an (in-memory) bill of materials (in which each * component is an BOMNode) * Useful for tree traversal (breakdown, explosion, implosion). - */ + */ public class BOMTree { public static final int EXPLOSION = 0; @@ -72,7 +72,7 @@ public BOMTree(String productId, String bomTypeId, Date inDate, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException { this(productId, bomTypeId, inDate, EXPLOSION, delegator, dispatcher, userLogin); } - + /** Creates a new instance of BOMTree by reading * the productId's bill of materials (upward or downward). * If virtual products are found, it tries to configure them by running @@ -98,7 +98,7 @@ this.delegator = delegator; this.dispatcher = dispatcher; - + inputProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); String productIdForRules = productId; @@ -110,17 +110,17 @@ GenericValue oneProductFeatureAppl = null; for (int i = 0; i < productFeaturesAppl.size(); i++) { oneProductFeatureAppl = (GenericValue)productFeaturesAppl.get(i); - productFeatures.add(delegator.findByPrimaryKey("ProductFeature", + productFeatures.add(delegator.findByPrimaryKey("ProductFeature", UtilMisc.toMap("productFeatureId", oneProductFeatureAppl.getString("productFeatureId")))); - + } // If the product is manufactured as a different product, // load the new product GenericValue manufacturedAsProduct = manufacturedAsProduct(productId, inDate); // We load the information about the product that needs to be manufactured // from Product entity - GenericValue product = delegator.findByPrimaryKey("Product", - UtilMisc.toMap("productId", + GenericValue product = delegator.findByPrimaryKey("Product", + UtilMisc.toMap("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): productId))); if (product == null) return; BOMNode originalNode = new BOMNode(product, dispatcher, userLogin); @@ -137,8 +137,8 @@ // load the new product productIdForRules = virtualProduct.getString("productId"); manufacturedAsProduct = manufacturedAsProduct(virtualProduct.getString("productId"), inDate); - product = delegator.findByPrimaryKey("Product", - UtilMisc.toMap("productId", + product = delegator.findByPrimaryKey("Product", + UtilMisc.toMap("productId", (manufacturedAsProduct != null? manufacturedAsProduct.getString("productIdTo"): virtualProduct.get("productId")))); } } @@ -165,9 +165,9 @@ public GenericValue getInputProduct() { return inputProduct; } - + private GenericValue manufacturedAsProduct(String productId, Date inDate) throws GenericEntityException { - List manufacturedAsProducts = delegator.findByAnd("ProductAssoc", + List manufacturedAsProducts = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_MANUFACTURED")); manufacturedAsProducts = EntityUtil.filterByDate(manufacturedAsProducts, inDate); @@ -177,7 +177,7 @@ } return manufacturedAsProduct; } - + private boolean hasBom(GenericValue product, Date inDate) throws GenericEntityException { List children = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", bomTypeId)); children = EntityUtil.filterByDate(children, inDate); @@ -189,13 +189,13 @@ * or not. * @return true if no virtual nodes (products) are present in the tree. * - */ + */ public boolean isConfigured() { ArrayList notConfiguredParts = new ArrayList(); root.isConfigured(notConfiguredParts); return (notConfiguredParts.size() == 0); } - + /** Getter for property rootQuantity. * @return Value of property rootQuantity. * @@ -203,7 +203,7 @@ public BigDecimal getRootQuantity() { return rootQuantity; } - + /** Setter for property rootQuantity. * @param rootQuantity New value of property rootQuantity. * @@ -219,7 +219,7 @@ public BigDecimal getRootAmount() { return rootAmount; } - + /** Setter for property rootAmount. * @param rootAmount New value of property rootAmount. * @@ -227,15 +227,15 @@ public void setRootAmount(BigDecimal rootAmount) { this.rootAmount = rootAmount; } - + /** Getter for property root. * @return Value of property root. * */ public BOMNode getRoot() { return root; - } - + } + /** Getter for property inDate. * @return Value of property inDate. * @@ -243,7 +243,7 @@ public Date getInDate() { return inDate; } - + /** Getter for property bomTypeId. * @return Value of property bomTypeId. * @@ -251,12 +251,12 @@ public String getBomTypeId() { return bomTypeId; } - + /** It visits the in-memory tree that represents a bill of materials * and it collects info of its nodes in the StringBuffer. * Method used for debug purposes. * @param sb The StringBuffer used to collect tree info. - */ + */ public void print(StringBuffer sb) { if (root != null) { root.print(sb, getRootQuantity(), 0); @@ -268,22 +268,22 @@ * Method used for bom breakdown (explosion/implosion). * @param arr The ArrayList used to collect tree info. * @param initialDepth The depth of the root node. - */ + */ public void print(ArrayList arr, int initialDepth) { print(arr, initialDepth, true); } - + public void print(ArrayList arr, int initialDepth, boolean excludeWIPs) { if (root != null) { root.print(arr, getRootQuantity(), initialDepth, excludeWIPs); } } - + /** It visits the in-memory tree that represents a bill of materials * and it collects info of its nodes in the ArrayList. * Method used for bom breakdown (explosion/implosion). * @param arr The ArrayList used to collect tree info. - */ + */ public void print(ArrayList arr) { print(arr, 0, false); } @@ -296,17 +296,17 @@ * and it collects info of its nodes in the HashMap. * Method used for bom summarized explosion. * @param quantityPerNode The HashMap that will contain the summarized quantities per productId. - */ + */ public void sumQuantities(HashMap quantityPerNode) { if (root != null) { root.sumQuantity(quantityPerNode); } } - + /** It visits the in-memory tree that represents a bill of materials * and it collects all the productId it contains. * @return ArrayLsit conatining all the tree's productId. - */ + */ public ArrayList getAllProductsId() { ArrayList nodeArr = new ArrayList(); ArrayList productsId = new ArrayList(); @@ -316,7 +316,7 @@ } return productsId; } - + /** It visits the in-memory tree that represents a bill of materials * and it creates a manufacturing order for each of the nodes that needs * to be manufactured. @@ -324,7 +324,7 @@ * @param orderItemSeqId * @param delegator The delegator used. * @throws GenericEntityException If a db problem occurs. - */ + */ public String createManufacturingOrders(String facilityId, Date date, String workEffortName, String description, String routingId, String orderId, String orderItemSeqId, String shipmentId, GenericValue userLogin) throws GenericEntityException { String workEffortId = null; if (root != null) { 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -43,15 +43,15 @@ * */ public class ProductionRun { - + public static final String module = ProductionRun.class.getName(); public static final String resource = "ManufacturingUiLabels"; - + 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 BigDecimal quantity; // the estimatedQuantity - + protected Timestamp estimatedStartDate; protected Timestamp estimatedCompletionDate; protected String productionRunName; @@ -60,7 +60,7 @@ protected List productionRunComponents; protected List productionRunRoutingTasks; protected LocalDispatcher dispatcher; - + /** * indicate if quantity or estimatedStartDate has been modified and * estimatedCompletionDate not yet recalculated with recalculateEstimatedCompletionDate() methode. @@ -70,7 +70,7 @@ * indicate if quantity has been modified, used for store() method to update appropriate entity. */ private boolean quantityIsUpdated = false; - + public ProductionRun(String productionRunId, GenericDelegator delegator, LocalDispatcher dispatcher) { try { if (! UtilValidate.isEmpty(productionRunId)) { @@ -94,7 +94,7 @@ Debug.logWarning(e.getMessage(), module); } } - + /** * test if the productionRun exist. * @return true if it exist false otherwise. @@ -102,7 +102,7 @@ public boolean exist() { return productionRun != null; } - + /** * get the ProductionRun GenericValue . * @return the ProductionRun GenericValue @@ -154,7 +154,7 @@ } return false; } - + /** * get the Product GenericValue corresponding to the productProduced. * In the same time this method read the quantity property from SGBD @@ -176,7 +176,7 @@ } return null; } - + /** * get the quantity property. * @return the quantity property @@ -359,7 +359,7 @@ } return null; } - + /** * get the list of all the productionRunRoutingTasks as a list of GenericValue. * @return the productionRunRoutingTasks related object @@ -386,7 +386,7 @@ public void clearRoutingTasksList() { this.productionRunRoutingTasks = null; } - + /* * FIXME: the two getEstimatedTaskTime(...) methods will be removed and * implemented in the "getEstimatedTaskTime" service. @@ -428,7 +428,7 @@ Debug.logError(exc, "Problem calling the customMethod service " + serviceName); } } - + return (long) totalTaskTime; } 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -50,7 +50,7 @@ GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); - + Map parameters = UtilHttp.getParameterMap(request); BigDecimal quantity = 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -36,11 +36,11 @@ * */ public class ProductionRunHelper { - + public static final String module = ProductionRunHelper.class.getName(); public static final String resource = "ManufacturingUiLabels"; - - + + /** * Get a Production Run. * <li> check if routing - product link exist @@ -53,7 +53,7 @@ public static Map getProductionRun(GenericDelegator delegator, String productionRunId) { Map result = new HashMap(); // Timestamp now = UtilDateTime.nowTimestamp(); - + try { if (productionRunId != null ) { GenericValue productionRun = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId)); @@ -63,7 +63,7 @@ GenericValue productProduced = productionRunProduct.getRelatedOneCache("Product"); List productionRunComponents = productionRun.getRelated("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"),null); List productionRunRoutingTasks = productionRun.getRelated("FromWorkEffortAssoc",UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"),null); - + } } } catch (GenericEntityException e) { @@ -73,7 +73,7 @@ } public static boolean hasTask(GenericDelegator delegator, String taskName, String workEffortId) throws GenericEntityException { - List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", workEffortId, + List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", workEffortId, "workEffortTypeId", "PROD_ORDER_TASK", "workEffortName", taskName)); return (tasks != null && tasks.size() > 0); 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=757092&r1=757091&r2=757092&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 Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -63,10 +63,10 @@ * */ public class ProductionRunServices { - + public static final String module = ProductionRunServices.class.getName(); public static final String resource = "ManufacturingUiLabels"; - + private static BigDecimal ZERO = BigDecimal.ZERO; private static BigDecimal ONE = BigDecimal.ONE; private static int decimals = -1; @@ -91,9 +91,9 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); @@ -162,7 +162,7 @@ } return ServiceUtil.returnError("Cannot cancel productionRun, not in a valid status"); } - + /** * Creates a Production Run. * <li> check if routing - product link exist @@ -199,7 +199,7 @@ String workEffortId = (String) context.get("routingId"); String workEffortName = (String) context.get("workEffortName"); String description = (String) context.get("description"); - + GenericValue routing = null; GenericValue product = null; List workEffortProducts = null; @@ -264,7 +264,7 @@ String wefName = UtilValidate.isNotEmpty(routing.getString("workEffortName"))? routing.getString("workEffortName"): routing.getString("workEffortId"); workEffortName = prdName + "-" + wefName; } - + serviceContext.clear(); serviceContext.put("workEffortTypeId", "PROD_ORDER_HEADER"); serviceContext.put("workEffortPurposeTypeId", "WEPT_PRODUCTION_RUN"); @@ -285,7 +285,7 @@ if (Debug.infoOn()) { Debug.logInfo("ProductionRun created: " + productionRunId, module); } - + // ProductionRun, product will be produce creation = WorkEffortGoodStandard for the productId serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); @@ -301,13 +301,13 @@ Debug.logError(e, "Problem calling the createWorkEffortGoodStandard service", module); return ServiceUtil.returnError(e.getMessage()); } - + // Multi creation (like clone) ProductionRunTask and GoodAssoc Iterator rt = routingTaskAssocs.iterator(); boolean first = true; while (rt.hasNext()) { GenericValue routingTaskAssoc = (GenericValue) rt.next(); - + if (EntityUtil.isValueActive(routingTaskAssoc, startDate)) { GenericValue routingTask = null; try { @@ -318,7 +318,7 @@ // Calculate the estimatedCompletionDate long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity, dispatcher); Timestamp endDate = TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask),startDate, totalTime); - + serviceContext.clear(); serviceContext.put("priority", routingTaskAssoc.get("sequenceNum")); serviceContext.put("workEffortPurposeTypeId", routingTask.get("workEffortPurposeTypeId")); @@ -358,7 +358,7 @@ // copy date valid WorkEffortPartyAssignments from the routing task to the run task List workEffortPartyAssignments = null; try { - workEffortPartyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", + workEffortPartyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", UtilMisc.toMap("workEffortId", routingTaskAssoc.getString("workEffortIdTo")))); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); @@ -420,7 +420,7 @@ startDate = endDate; } } - + // update the estimatedCompletionDate field for the productionRun serviceContext.clear(); serviceContext.put("workEffortId",productionRunId); @@ -459,7 +459,7 @@ if (!UtilValidate.isEmpty(productionRunId)) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (productionRun.exist()) { - + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); @@ -469,22 +469,22 @@ if (quantity != null && ! quantity.equals(productionRun.getQuantity())) { productionRun.setQuantity(quantity); } - + Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); if (estimatedStartDate != null && ! estimatedStartDate.equals(productionRun.getEstimatedStartDate())) { productionRun.setEstimatedStartDate(estimatedStartDate); } - + String workEffortName = (String) context.get("workEffortName"); if (workEffortName != null) { productionRun.setProductionRunName(workEffortName); } - + String description = (String) context.get("description"); if (description != null) { productionRun.setDescription(description); } - + String facilityId = (String) context.get("facilityId"); if (facilityId != null) { productionRun.getGenericValue().set("facilityId", facilityId); @@ -513,23 +513,23 @@ Debug.logError("service updateProductionRun call with productionRunId empty",module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); } - + public static Map changeProductionRunStatus(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); String statusId = (String) context.get("statusId"); - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); } String currentStatusId = productionRun.getGenericValue().getString("currentStatusId"); - + if (currentStatusId.equals(statusId)) { result.put("newStatusId", currentStatusId); result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); @@ -591,7 +591,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - + // PRUN_DOC_PRINTED --> PRUN_RUNNING // this should be called only when the first task is started if (currentStatusId.equals("PRUN_DOC_PRINTED") && (statusId == null || statusId.equals("PRUN_RUNNING"))) { @@ -628,7 +628,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - + // PRUN_RUNNING --> PRUN_COMPLETED // this should be called only when the last task is completed if (currentStatusId.equals("PRUN_RUNNING") && (statusId == null || statusId.equals("PRUN_COMPLETED"))) { @@ -650,7 +650,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - + // PRUN_COMPLETED --> PRUN_CLOSED if (currentStatusId.equals("PRUN_COMPLETED") && (statusId == null || statusId.equals("PRUN_CLOSED"))) { // change the production run status to PRUN_CLOSED @@ -697,7 +697,7 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); String taskId = (String) context.get("workEffortId"); String statusId = (String) context.get("statusId"); @@ -705,7 +705,7 @@ if (issueAllComponents == null) { issueAllComponents = Boolean.FALSE; } - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); @@ -731,7 +731,7 @@ if (theTask == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } - + String currentStatusId = theTask.getString("currentStatusId"); String oldStatusId = theTask.getString("currentStatusId"); // pass back old status for secas to check @@ -741,7 +741,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } - + // PRUN_CREATED or PRUN_SCHEDULED --> PRUN_RUNNING // this should be called only when the first task is started if ((currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_SCHEDULED")) && (statusId == null || statusId.equals("PRUN_RUNNING"))) { @@ -784,7 +784,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - + // PRUN_RUNNING --> PRUN_COMPLETED // this should be called only when the last task is completed if (currentStatusId.equals("PRUN_RUNNING") && (statusId == null || statusId.equals("PRUN_COMPLETED"))) { @@ -1073,7 +1073,7 @@ if (! UtilValidate.isEmpty(productionRunId) && ! UtilValidate.isEmpty(routingTaskId)) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (productionRun.exist()) { - + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); @@ -1088,7 +1088,7 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); } } - + Long priority = (Long) context.get("priority"); List pRRoutingTasks = productionRun.getProductionRunRoutingTasks(); boolean first = true; @@ -1118,7 +1118,7 @@ if (first) first = false; } productionRun.setEstimatedCompletionDate(productionRun.recalculateEstimatedCompletionDate(priority, estimatedStartDate)); - + if (productionRun.store()) { return ServiceUtil.returnSuccess(); } else { @@ -1132,7 +1132,7 @@ Debug.logError("service updateProductionRun call with productionRunId empty",module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); } - + public static Map addProductionRunComponent(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -1146,13 +1146,13 @@ BigDecimal quantity = (BigDecimal) context.get("estimatedQuantity"); // Optional input fields String workEffortId = (String)context.get("workEffortId"); - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List tasks = productionRun.getProductionRunRoutingTasks(); if (UtilValidate.isEmpty(tasks)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } - + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); @@ -1173,7 +1173,7 @@ } else { workEffortId = EntityUtil.getFirst(tasks).getString("workEffortId"); } - + try { // Find the product GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); @@ -1203,7 +1203,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentAdded",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } - + public static Map updateProductionRunComponent(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -1216,13 +1216,13 @@ // Optional input fields String workEffortId = (String)context.get("workEffortId"); // the production run task BigDecimal quantity = (BigDecimal) context.get("estimatedQuantity"); - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List components = productionRun.getProductionRunComponents(); if (UtilValidate.isEmpty(components)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotExists", locale)); } - + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); @@ -1247,7 +1247,7 @@ if (!found) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } - + try { // Find the product GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); @@ -1278,7 +1278,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentUpdated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } - + public static Map addProductionRunRoutingTask(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -1289,7 +1289,7 @@ String productionRunId = (String)context.get("productionRunId"); String routingTaskId = (String)context.get("routingTaskId"); Long priority = (Long)context.get("priority"); - + // Optional input fields String workEffortName = (String)context.get("workEffortName"); String description = (String)context.get("description"); @@ -1297,14 +1297,14 @@ Timestamp estimatedCompletionDate = (Timestamp)context.get("estimatedCompletionDate"); Double estimatedSetupMillis = (Double)context.get("estimatedSetupMillis"); Double estimatedMilliSeconds = (Double)context.get("estimatedMilliSeconds"); - + // The production run is loaded ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); BigDecimal pRQuantity = productionRun.getQuantity(); if (pRQuantity == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } - + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); @@ -1316,7 +1316,7 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); } } - + // The routing task is loaded GenericValue routingTask = null; try { @@ -1329,7 +1329,7 @@ Debug.logError("Routing task: " + routingTaskId + " is null.", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskNotExists", locale)); } - + if (workEffortName == null) { workEffortName = (String)routingTask.get("workEffortName"); } @@ -1376,13 +1376,13 @@ } String productionRunTaskId = (String) resultService.get("workEffortId"); if (Debug.infoOn()) Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, module); - - + + productionRun.setEstimatedCompletionDate(productionRun.recalculateEstimatedCompletionDate()); if (!productionRun.store()) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); } - + // copy date valid WorkEffortPartyAssignments from the routing task to the run task List workEffortPartyAssignments = null; try { @@ -1410,7 +1410,7 @@ if (Debug.infoOn()) Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", module); } } - + result.put("routingTaskId", productionRunTaskId); result.put("estimatedStartDate", estimatedStartDate); result.put("estimatedCompletionDate", estimatedCompletionDate); @@ -1425,14 +1425,14 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); // Mandatory input fields String productionRunId = (String)context.get("workEffortId"); - + // Optional input fields BigDecimal quantity = (BigDecimal) context.get("quantity"); String inventoryItemTypeId = (String)context.get("inventoryItemTypeId"); String lotId = (String)context.get("lotId"); Boolean createLotIfNeeded = (Boolean)context.get("createLotIfNeeded"); Boolean autoCreateLot = (Boolean)context.get("autoCreateLot"); - + // The default is non-serialized inventory item if (UtilValidate.isEmpty(inventoryItemTypeId)) { inventoryItemTypeId = "NON_SERIAL_INV_ITEM"; @@ -1444,7 +1444,7 @@ if (autoCreateLot == null) { autoCreateLot = Boolean.FALSE; } - + List inventoryItemIds = new ArrayList(); result.put("inventoryItemIds", inventoryItemIds); // The production run is loaded @@ -1482,7 +1482,7 @@ if (quantity.compareTo(maxQuantity) > 0) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunProductProducedNotStillAvailable", locale)); } - + if (lotId == null && autoCreateLot.booleanValue()) { lotId = delegator.getNextSeqId("Lot"); createLotIfNeeded = Boolean.TRUE; @@ -1504,7 +1504,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + GenericValue orderItem = null; try { // Find the related order item (if exists) @@ -1525,12 +1525,12 @@ Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } - + if ("SERIALIZED_INV_ITEM".equals(inventoryItemTypeId)) { try { int numOfItems = quantity.intValue(); for (int i = 0; i < numOfItems; i++) { - Map serviceContext = UtilMisc.toMap("productId", productionRun.getProductProduced().getString("productId"), + Map serviceContext = UtilMisc.toMap("productId", productionRun.getProductProduced().getString("productId"), "inventoryItemTypeId", "SERIALIZED_INV_ITEM", "statusId", "INV_AVAILABLE"); serviceContext.put("facilityId", productionRun.getGenericValue().getString("facilityId")); @@ -1631,11 +1631,11 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); // Mandatory input fields String productionRunId = (String)context.get("workEffortId"); - + // Optional input fields BigDecimal quantity = (BigDecimal)context.get("quantity"); Map componentsLocationMap = (Map)context.get("componentsLocationMap"); - + // The production run is loaded ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); @@ -1697,18 +1697,18 @@ String productionRunTaskId = (String)context.get("workEffortId"); String productId = (String)context.get("productId"); BigDecimal quantity = (BigDecimal)context.get("quantity"); - + // Optional input fields String facilityId = (String)context.get("facilityId"); String currencyUomId = (String)context.get("currencyUomId"); BigDecimal unitCost = (BigDecimal)context.get("unitCost"); String inventoryItemTypeId = (String)context.get("inventoryItemTypeId"); - + // The default is non-serialized inventory item if (UtilValidate.isEmpty(inventoryItemTypeId)) { inventoryItemTypeId = "NON_SERIAL_INV_ITEM"; } - + if (facilityId == null) { // The production run is loaded ProductionRun productionRun = new ProductionRun(productionRunTaskId, delegator, dispatcher); @@ -1768,7 +1768,7 @@ serviceContext.put("userLogin", userLogin); Map resultService = dispatcher.runSync("createInventoryItem", serviceContext); String inventoryItemId = (String)resultService.get("inventoryItemId"); - + serviceContext.clear(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("workEffortId", productionRunTaskId); @@ -1856,7 +1856,7 @@ } return ServiceUtil.returnSuccess(); } - + public static Map updateProductionRunTask(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -1870,7 +1870,7 @@ if (UtilValidate.isEmpty(partyId)) { partyId = userLogin.getString("partyId"); } - + // Optional input fields Timestamp fromDate = (Timestamp)context.get("fromDate"); Timestamp toDate = (Timestamp)context.get("toDate"); @@ -1881,7 +1881,7 @@ String comments = (String)context.get("comments"); Boolean issueRequiredComponents = (Boolean)context.get("issueRequiredComponents"); Map componentsLocationMap = (Map)context.get("componentsLocationMap"); - + if (issueRequiredComponents == null) { issueRequiredComponents = Boolean.FALSE; } @@ -1906,7 +1906,7 @@ if (comments == null) { comments = ""; } - + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); @@ -1924,9 +1924,9 @@ if (theTask == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } - + String currentStatusId = theTask.getString("currentStatusId"); - + if (!currentStatusId.equals("PRUN_RUNNING")) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotRunning", locale)); } @@ -1952,7 +1952,7 @@ double totalSetupMillis = actualSetupMillis.doubleValue() + addSetupTime.doubleValue(); BigDecimal totalQuantityProduced = quantityProduced.add(addQuantityProduced); BigDecimal totalQuantityRejected = quantityRejected.add(addQuantityRejected); - + if (issueRequiredComponents.booleanValue() && addQuantityProduced.compareTo(ZERO) > 0) { BigDecimal quantityToProduce = theTask.getBigDecimal("quantityToProduce"); if (quantityToProduce == null) { @@ -1991,9 +1991,9 @@ } } } catch (GenericEntityException gee) { - + } catch (GenericServiceException gee) { - + } } } @@ -2014,7 +2014,7 @@ timeEntryFields.put("comments", comments); GenericValue timeEntry = delegator.makeValue("TimeEntry", timeEntryFields); timeEntry.create(); - + Map serviceContext = new HashMap(); serviceContext.clear(); serviceContext.put("workEffortId", workEffortId); @@ -2027,7 +2027,7 @@ } catch (Exception exc) { return ServiceUtil.returnError(exc.getMessage()); } - + return result; } @@ -2055,7 +2055,7 @@ } return ServiceUtil.returnSuccess(); } - + public static Map createProductionRunFromRequirement(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -2066,7 +2066,7 @@ String requirementId = (String)context.get("requirementId"); // Optional input fields BigDecimal quantity = (BigDecimal)context.get("quantity"); - + GenericValue requirement = null; try { requirement = delegator.findByPrimaryKey("Requirement", UtilMisc.toMap("requirementId", requirementId)); @@ -2078,7 +2078,7 @@ if (!"INTERNAL_REQUIREMENT".equals(requirement.getString("requirementTypeId"))) { return ServiceUtil.returnSuccess(); } - + if (quantity == null) { quantity = requirement.getBigDecimal("quantity"); } @@ -2115,7 +2115,7 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } - + public static Map createProductionRunFromConfiguration(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); @@ -2130,7 +2130,7 @@ BigDecimal quantity = (BigDecimal)context.get("quantity"); String orderId = (String)context.get("orderId"); String orderItemSeqId = (String)context.get("orderItemSeqId"); - + if (config == null && configId == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingConfigurationNotAvailable", locale)); } @@ -2146,7 +2146,7 @@ } String instanceProductId = null; try { - instanceProductId = ProductWorker.getAggregatedInstanceId(delegator, config.getProduct().getString("productId"), config.getConfigId()); + instanceProductId = ProductWorker.getAggregatedInstanceId(delegator, config.getProduct().getString("productId"), config.getConfigId()); } catch (Exception e) { return ServiceUtil.returnError(e.getMessage()); } @@ -2184,7 +2184,7 @@ componentQuantity = BigDecimal.ONE; } String componentProductId = selComponent.getString("productId"); - if (co.isVirtualComponent(selComponent)) { + if (co.isVirtualComponent(selComponent)) { Map componentOptions = co.getComponentOptions(); if (UtilValidate.isNotEmpty(componentOptions) && UtilValidate.isNotEmpty(componentOptions.get(componentProductId))) { componentProductId = (String)componentOptions.get(componentProductId); @@ -2196,7 +2196,7 @@ componentQuantity = totalQuantity.add(componentQuantity); } components.put(componentProductId, componentQuantity); - + // create production run notes from comments String comments = co.getComments(); if (UtilValidate.isNotEmpty(comments)) { @@ -2207,7 +2207,7 @@ serviceContext.put("noteInfo", comments); serviceContext.put("noteName", co.getDescription()); serviceContext.put("userLogin", userLogin); - serviceContext.put("noteParty", userLogin.getString("partyId")); + serviceContext.put("noteParty", userLogin.getString("partyId")); try { resultService = dispatcher.runSync("createWorkEffortNote", serviceContext); } catch (GenericServiceException e) { @@ -2217,7 +2217,7 @@ } } } - + Iterator componentsIt = components.entrySet().iterator(); while (componentsIt.hasNext()) { Map.Entry component = (Map.Entry)componentsIt.next(); @@ -2245,7 +2245,7 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRequirementNotDeleted", locale)); } - + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -2260,7 +2260,7 @@ String facilityId = (String)context.get("facilityId"); String orderId = (String)context.get("orderId"); String orderItemSeqId = (String)context.get("orderItemSeqId"); - + // Check if the order is to be immediately fulfilled, in which case the inventory // hasn't been reserved and ATP not yet decreased boolean isImmediatelyFulfilled = false; @@ -2288,7 +2288,7 @@ try { // first figure out how much of this product we already have in stock (ATP) - BigDecimal existingAtp = BigDecimal.ZERO; + BigDecimal existingAtp = BigDecimal.ZERO; Map tmpResults = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.<String, Object>toMap("productId", orderItem.getString("productId"), "facilityId", facilityId, "userLogin", userLogin)); if (tmpResults.get("availableToPromiseTotal") != null) { existingAtp = (BigDecimal) tmpResults.get("availableToPromiseTotal"); @@ -2297,8 +2297,8 @@ if (isImmediatelyFulfilled) { existingAtp = existingAtp.subtract(orderItem.getBigDecimal("quantity")); } - - if (Debug.verboseOn()) { Debug.logVerbose("Order item [" + orderItem + "] Existing ATP = [" + existingAtp + "]", module); } + + if (Debug.verboseOn()) { Debug.logVerbose("Order item [" + orderItem + "] Existing ATP = [" + existingAtp + "]", module); } // we only need to produce more marketing packages if there isn't enough in stock. if (existingAtp.compareTo(ZERO) < 0) { // how many should we produce? If there already is some inventory, then just produce enough to bring ATP back up to zero. @@ -2367,7 +2367,7 @@ String orderItemSeqId = (String) context.get("orderItemSeqId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); String fromDateStr = (String) context.get("fromDate"); - + BigDecimal amount = null; Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { @@ -2381,7 +2381,7 @@ } List orderItems = null; - + if (orderItemSeqId != null) { try { GenericValue orderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); @@ -2495,7 +2495,7 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); String taskId = (String) context.get("taskId"); @@ -2525,7 +2525,7 @@ } return result; } - + /** * Quick runs all the tasks of a ProductionRun to the completed status, * also issuing components if necessary. @@ -2539,7 +2539,7 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); @@ -2574,7 +2574,7 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); @@ -2615,7 +2615,7 @@ LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - + String productionRunId = (String) context.get("productionRunId"); String statusId = (String) context.get("statusId"); String startAllTasks = (String) context.get("startAllTasks"); @@ -2646,7 +2646,7 @@ serviceContext.put("productionRunId", productionRunId); serviceContext.put("userLogin", userLogin); resultService = dispatcher.runSync("quickRunAllProductionRunTasks", serviceContext); - } + } if (statusId.equals("PRUN_CLOSED")) { // Put in warehouse the products manufactured serviceContext.clear(); @@ -2673,7 +2673,7 @@ /** * Given a productId and an optional date, returns the total qty - * of productId reserved by production runs. + * of productId reserved by production runs. * @param ctx The DispatchContext that this service is operating in. * @param context Map containing the input parameters. * @return Map with the result of the service, the output parameters. @@ -2820,7 +2820,7 @@ } else { costCoefficient = inventoryItemCost.divide(packageCost, 10, rounding); } - + // the components are retrieved serviceContext.clear(); serviceContext = UtilMisc.toMap("productId", inventoryItem.getString("productId"), @@ -2842,7 +2842,7 @@ "userLogin", userLogin); resultService = dispatcher.runSync("getProductCost", serviceContext); BigDecimal componentCost = (BigDecimal)resultService.get("productCost"); - + // return the component to inventory at its standard cost multiplied by the cost coefficient from above BigDecimal componentInventoryItemCost = costCoefficient.multiply(componentCost); serviceContext.clear(); @@ -2867,12 +2867,12 @@ result.put("inventoryItemIds", inventoryItemIds); return result; } - + public static Map setEstimatedDeliveryDates(DispatchContext ctx, Map context) { Map result = new HashMap(); GenericDelegator delegator = ctx.getDelegator(); Timestamp now = UtilDateTime.nowTimestamp(); - + Map products = FastMap.newInstance(); try { @@ -2977,7 +2977,7 @@ while (backordersIt.hasNext()) { GenericValue genericResult = (GenericValue) backordersIt.next(); String productId = genericResult.getString("productId"); - GenericValue orderItemShipGroup = delegator.findByPrimaryKey("OrderItemShipGroup", UtilMisc.toMap("orderId", genericResult.get("orderId"), + GenericValue orderItemShipGroup = delegator.findByPrimaryKey("OrderItemShipGroup", UtilMisc.toMap("orderId", genericResult.get("orderId"), "shipGroupSeqId", genericResult.get("shipGroupSeqId"))); Timestamp requiredByDate = orderItemShipGroup.getTimestamp("shipByDate"); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java?rev=757092&r1=757091&r2=757092&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java Sat Mar 21 23:44:48 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -32,9 +32,9 @@ public class InventoryEventPlannedServices { - + public static final String module = InventoryEventPlannedServices.class.getName(); - + /** * * Create an MrpEvent. |
Free forum by Nabble | Edit this page |