svn commit: r663950 - /ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r663950 - /ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/

ashish-18
Author: ashish
Date: Fri Jun  6 07:19:25 2008
New Revision: 663950

URL: http://svn.apache.org/viewvc?rev=663950&view=rev
Log:
Now the groovy featues are applied on the remaining files from Manufacturing component.
Party of JIRA issue # OFBIZ-1801.


Modified:
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsComponentsByFeature.groovy Fri Jun  6 07:19:25 2008
@@ -20,98 +20,91 @@
 // PRunsComponentsByFeature
 // ReportF
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.product.category.CategoryWorker;
 
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
-if (!UtilValidate.isEmpty(productFeatureTypeIdPar)) {
-    featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar));
-    context.put("featureType", featureType);
+if (productFeatureTypeIdPar) {
+    featureType = delegator.findByPrimaryKey("ProductFeatureType", [productFeatureTypeId : productFeatureTypeIdPar]);
+    context.featureType = featureType;
 }
 
-allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortName", planName), UtilMisc.toList("productId"));
-productionRuns = new ArrayList();
-features = new HashMap(); // each entry is a productFeatureId|{productFeature,products}
-products = new HashMap(); // each entry is a productId|{product,quantity}
-if (UtilValidate.isEmpty(productFeatureTypeIdPar)) {
+allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", [workEffortName : planName],["productId"]);
+productionRuns = [];
+features = [:]; // each entry is a productFeatureId|{productFeature,products}
+products = [:]; // each entry is a productId|{product,quantity}
+if (!productFeatureTypeIdPar) {
     features.put(null, UtilMisc.toMap("productFeature", null, "products", products));
 }
 
-if (allProductionRuns != null) {
-    allProductionRunsIt = allProductionRuns.iterator();
-    while (allProductionRunsIt.hasNext()) {
-        productionRun = allProductionRunsIt.next();
+if (allProductionRuns) {
+    allProductionRuns.each { productionRun ->
         // select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
-        productionRunTasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRun.getString("workEffortId"), "workEffortName", taskNamePar));
+        productionRunTasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRun.workEffortId, workEffortName : taskNamePar]);
         productionRunTask = EntityUtil.getFirst(productionRunTasks);
-        if (productionRunTask == null) {
+        if (!productionRunTask) {
             // the production run doesn't include the given task, skip it
             continue;
         }
 
         // select the task's components, if any
-        allProductionRunComponents = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", productionRunTask.getString("workEffortId"),"workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"));
-        allProductionRunComponentsIt = allProductionRunComponents.iterator();
-        while(allProductionRunComponentsIt.hasNext()) {
-            productionRunComponent = allProductionRunComponentsIt.next();
+        allProductionRunComponents = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : productionRunTask.workEffortId,workEffortGoodStdTypeId : "PRUNT_PROD_NEEDED"]);
+        allProductionRunComponents.each { productionRunComponent ->
             // verify if the product is a member of the given category (based on the report's parameter)
-            if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-                if (!isProductInCategory(delegator, productionRunComponent.getString("productId"), productCategoryIdPar)) {
+            if (productCategoryIdPar) {
+                if (!isProductInCategory(delegator, productionRunComponent.productId, productCategoryIdPar)) {
                     // the production run's product is not a member of the given category, skip it
                     continue;
                 }
             }
-            productionRunProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionRunComponent.getString("productId")));
+            productionRunProduct = delegator.findByPrimaryKey("Product", [productId : productionRunComponent.productId]);
 
             location = null;
-            if (!UtilValidate.isEmpty(productionRunProduct)) {
-                locations = delegator.findByAnd("ProductFacilityLocation", UtilMisc.toMap("facilityId", productionRun.getString("facilityId"), "productId", productionRunProduct.getString("productId")));
+            if (productionRunProduct) {
+                locations = delegator.findByAnd("ProductFacilityLocation", [facilityId : productionRun.facilityId, productId : productionRunProduct.productId]);
                 location = EntityUtil.getFirst(locations);
             }
 
             // group by standard feature of type productFeatureTypeIdPar
-            if (productFeatureTypeIdPar != null) {
-                standardFeatures = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRunComponent.getString("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
+            if (productFeatureTypeIdPar) {
+                standardFeatures = delegator.findByAnd("ProductFeatureAndAppl", [productFeatureTypeId : productFeatureTypeIdPar, productId : productionRunComponent.productId, productFeatureApplTypeId : "STANDARD_FEATURE"]);
                 standardFeatures = EntityUtil.filterByDate(standardFeatures);
                 standardFeature = EntityUtil.getFirst(standardFeatures);
                 standardFeatureId = null;
-                if (standardFeature != null) {
-                    standardFeatureId = standardFeature.getString("productFeatureId");
+                if (standardFeature) {
+                    standardFeatureId = standardFeature.productFeatureId;
                 }
                 if (!features.containsKey(standardFeatureId)) {
-                    features.put(standardFeatureId, UtilMisc.toMap("productFeature", standardFeature, "products", new HashMap()));
+                    features.put(standardFeatureId, [productFeature : standardFeature, products : [:]]);
                 }
                 feature = (Map)features.get(standardFeatureId);
-                products = (Map)feature.get("products");
+                products = (Map)feature.products;
             }
 
             //
             // populate the products map and sum the quantities
             //
             if (!products.containsKey(productionRunComponent.getString("productId"))) {
-                products.put(productionRunComponent.getString("productId"), UtilMisc.toMap("product", productionRunProduct, "quantity", new Double(0), "location", location));
+                products.put(productionRunComponent.productId, [product : productionRunProduct, quantity : new Double(0), location : location]);
             }
-            Map productMap = (Map)products.get(productionRunComponent.getString("productId"));
-            Double productMapQty = (Double)productMap.get("quantity");
+            Map productMap = (Map)products.get(productionRunComponent.productId);
+            Double productMapQty = (Double)productMap.quantity;
             Double currentProductQty = productionRunComponent.getDouble("estimatedQuantity");
-            productMap.put("quantity", new Double(productMapQty.doubleValue() + currentProductQty.doubleValue()));
+            productMap.quantity = new Double(productMapQty.doubleValue() + currentProductQty.doubleValue());
         }
     }
     // now create lists of products for each feature group
     featuresIt = features.values().iterator();
-    while (featuresIt.hasNext()) {
+    while (featuresIt) {
         feature = featuresIt.next();
-        productsMap = feature.get("products");
+        productsMap = feature.products;
         productsMapIt = productsMap.values().iterator();
         while (productsMapIt.hasNext()) {
             productMap = productsMapIt.next();
-            if (productMap.get("product").get("productWidth") != null && productMap.get("product").get("productHeight") != null) {
+            if (productMap.product.productWidth && productMap.product.productHeight) {
                 Double productMapQty = (Double)productMap.get("quantity");
                 Double productHeight = (Double)productMap.get("product").get("productHeight");
                 Double productWidth = (Double)productMap.get("product").get("productWidth");
@@ -121,10 +114,10 @@
                 if (productArea > 0) panelQty = productMapQty.doubleValue() / productArea;
                 panelQtyInt = (int)panelQty;
                 if (panelQtyInt < panelQty) panelQtyInt++;
-                productMap.put("panelQuantity", new Integer(panelQtyInt));
+                productMap.panelQuantity = new Integer(panelQtyInt);
             }
         }
-        feature.put("productList", productsMap.values());
+        feature.productList = productsMap.values();
     }
-    context.put("features", features.values());
+    context.features = features.values();
 }

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsInfoAndOrder.groovy Fri Jun  6 07:19:25 2008
@@ -20,70 +20,60 @@
 // PRunsInfoAndOrder
 // ReportG
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper;
 import org.ofbiz.order.order.OrderReadHelper;
-import org.ofbiz.product.category.CategoryWorker;
 
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
 
-allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV"), UtilMisc.toList("productId"));
-productionRuns = new ArrayList();
+allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", [workEffortName : planName, statusId : "WEGS_CREATED", workEffortGoodStdTypeId : "PRUN_PROD_DELIV"], ["productId"]);
+productionRuns = [];
 
-if (allProductionRuns != null) {
-    allProductionRunsIt = allProductionRuns.iterator();
-    while (allProductionRunsIt.hasNext()) {
-        productionRun = allProductionRunsIt.next();
+if (allProductionRuns) {
+    allProductionRuns.each { productionRun ->
         // verify if the product is a member of the given category (based on the report's parameter)
-        if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-            if (!isProductInCategory(delegator, productionRun.getString("productId"), productCategoryIdPar)) {
+        if (productCategoryIdPar) {
+            if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
                 // the production run's product is not a member of the given category, skip it
                 continue;
             }
         }
-        productionRunProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionRun.getString("productId")));
-        String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.getString("workEffortId"));
+        productionRunProduct = delegator.findByPrimaryKey("Product", [productId : productionRun.productId]);
+        String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId);
 
-        productionRunOrders = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", rootProductionRunId));
+        productionRunOrders = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId : rootProductionRunId]);
         productionRunOrder = EntityUtil.getFirst(productionRunOrders);
-        OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.getString("orderId"));
+        OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId);
 
         // select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
-        productionRunTasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRun.getString("workEffortId"), "workEffortName", taskNamePar));
+        productionRunTasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRun.workEffortId, workEffortName : taskNamePar]);
         productionRunTask = EntityUtil.getFirst(productionRunTasks);
-        if (productionRunTask == null) {
+        if (!productionRunTask) {
             // the production run doesn't include the given task, skip it
             continue;
         }
 
-        productionRunMap = UtilMisc.toMap("productionRun", productionRun,
-                                          "product", productionRunProduct,
-                                          "productionRunTask", productionRunTask,
-                                          "productionRunOrder", productionRunOrder,
-                                          "customer", orh.getPlacingParty(),
-                                          "address", orh.getShippingAddress());
-        allProductionComponents = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortId", productionRunTask.getString("workEffortId"), "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"), UtilMisc.toList("productId"));
-        componentList = new ArrayList();
-
-        if (allProductionComponents != null) {
-            allProductionComponentsIt = allProductionComponents.iterator();
-            while (allProductionComponentsIt.hasNext()) {
-                productionComponent = allProductionComponentsIt.next();
-
-                productionRunProductComp = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionComponent.getString("productId")));
-                productionRunProductMap = UtilMisc.toMap("component", productionComponent,
-                                                         "componentProduct", productionRunProductComp);
+        productionRunMap = [productionRun : productionRun,
+                                          product : productionRunProduct,
+                                          productionRunTask : productionRunTask,
+                                          productionRunOrder : productionRunOrder,
+                                          customer : orh.getPlacingParty(),
+                                          address : orh.getShippingAddress()];
+        allProductionComponents = delegator.findByAnd("WorkEffortAndGoods", [workEffortId : productionRunTask.workEffortId, statusId : "WEGS_CREATED", workEffortGoodStdTypeId : "PRUNT_PROD_NEEDED"], ["productId"]);
+        componentList = [];
+
+        if (allProductionComponents) {
+            allProductionComponents.each { productionComponent ->
+                productionRunProductComp = delegator.findByPrimaryKey("Product", [productId : productionComponent.productId]);
+                productionRunProductMap = [component : productionComponent,componentProduct : productionRunProductComp];
                 componentList.add(productionRunProductMap);
             }
         }
-        productionRunMap.put("componentList", componentList);
+        productionRunMap.componentList = componentList;
         productionRuns.add(productionRunMap);
     }
 }
-context.put("productionRuns", productionRuns);
+context.productionRuns = productionRuns;
\ No newline at end of file

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsAndOrder.groovy Fri Jun  6 07:19:25 2008
@@ -20,54 +20,48 @@
 // PRunsProductsAndOrder
 // ReportD
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.manufacturing.jobshopmgt.ProductionRunHelper;
 import org.ofbiz.order.order.OrderReadHelper;
-import org.ofbiz.product.category.CategoryWorker;
 
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
 
 allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortName", planName, "statusId", "WEGS_CREATED", "workEffortGoodStdTypeId", "PRUN_PROD_DELIV"), UtilMisc.toList("productId"));
-productionRuns = new ArrayList();
+productionRuns = [];
 
-if (allProductionRuns != null) {
-    allProductionRunsIt = allProductionRuns.iterator();
-    while (allProductionRunsIt.hasNext()) {
-        productionRun = allProductionRunsIt.next();
+if (allProductionRuns) {
+    allProductionRuns.each { productionRun ->
         // verify if the product is a member of the given category (based on the report's parameter)
-        if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-            if (!isProductInCategory(delegator, productionRun.getString("productId"), productCategoryIdPar)) {
+        if (productCategoryIdPar) {
+            if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
                 // the production run's product is not a member of the given category, skip it
                 continue;
             }
         }
-        productionRunProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionRun.getString("productId")));
-        String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.getString("workEffortId"));
+        productionRunProduct = delegator.findByPrimaryKey("Product", [productId : productionRun.productId]);
+        String rootProductionRunId = ProductionRunHelper.getRootProductionRun(delegator, productionRun.workEffortId);
 
-        productionRunOrders = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", rootProductionRunId));
+        productionRunOrders = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId : rootProductionRunId]);
         productionRunOrder = EntityUtil.getFirst(productionRunOrders);
-        OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.getString("orderId"));
-        locations = delegator.findByAnd("ProductFacilityLocation", UtilMisc.toMap("productId", productionRun.getString("productId"), "facilityId", productionRun.getString("facilityId")));
+        OrderReadHelper orh = new OrderReadHelper(delegator, productionRunOrder.orderId);
+        locations = delegator.findByAnd("ProductFacilityLocation", [productId : productionRun.productId, facilityId : productionRun.facilityId]);
         location = EntityUtil.getFirst(locations);
 
-        productionRunMap = UtilMisc.toMap("productionRun", productionRun,
-                                          "product", productionRunProduct,
-                                          "productionRunOrder", productionRunOrder,
-                                          "customer", orh.getPlacingParty(),
-                                          "address", orh.getShippingAddress(),
-                                          "location", location);
+        productionRunMap = [productionRun : productionRun,
+                                          product : productionRunProduct,
+                                          productionRunOrder : productionRunOrder,
+                                          customer : orh.getPlacingParty(),
+                                          address : orh.getShippingAddress(),
+                                          location : location];
 
-        productionRunMap.put("plan", planName);
-        quantity = productionRun.get("estimatedQuantity");
+        productionRunMap.plan = planName;
+        quantity = productionRun.estimatedQuantity;
         for (int i = 0; i < quantity; i++) {
             productionRuns.add(productionRunMap);
         }
     }
 }
-context.put("productionRuns", productionRuns);
+context.productionRuns = productionRuns;

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsByFeature.groovy Fri Jun  6 07:19:25 2008
@@ -20,69 +20,63 @@
 // PRunsProductsByFeature
 // ReportE
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.product.category.CategoryWorker;
-
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+import org.ofbiz.entity.util.EntityUtil;
+
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
-if (!UtilValidate.isEmpty(productFeatureTypeIdPar)) {
-    featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar));
-    context.put("featureType", featureType);
+if (productFeatureTypeIdPar) {
+    featureType = delegator.findByPrimaryKey("ProductFeatureType", [productFeatureTypeId : productFeatureTypeIdPar]);
+    context.featureType = featureType;
 }
 
-allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortName", planName), UtilMisc.toList("productId"));
-productionRuns = new ArrayList();
-features = new HashMap();
-if (UtilValidate.isEmpty(productFeatureTypeIdPar)) {
+allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", [workEffortName : planName], ["productId"]);
+productionRuns = [:];
+features = [];
+if (!productFeatureTypeIdPar) {
     features.put(null, UtilMisc.toMap("productFeature", null, "productionRuns", productionRuns));
 }
 
-if (allProductionRuns != null) {
-    allProductionRunsIt = allProductionRuns.iterator();
-    while (allProductionRunsIt.hasNext()) {
-        productionRun = allProductionRunsIt.next();
+if (allProductionRuns) {
+    allProductionRuns.each { productionRun ->
         // verify if the product is a member of the given category (based on the report's parameter)
-        if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-            if (!isProductInCategory(delegator, productionRun.getString("productId"), productCategoryIdPar)) {
+        if (productCategoryIdPar) {
+            if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
                 // the production run's product is not a member of the given category, skip it
                 continue;
             }
         }
-        productionRunProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionRun.getString("productId")));
+        productionRunProduct = delegator.findByPrimaryKey("Product", [productId : productionRun.productId]);
 
         // group by standard feature of type productFeatureTypeIdPar
-        if (productFeatureTypeIdPar != null) {
-            standardFeatures = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar, "productId", productionRun.getString("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
+        if (productFeatureTypeIdPar) {
+            standardFeatures = delegator.findByAnd("ProductFeatureAndAppl", [productFeatureTypeId : productFeatureTypeIdPar, productId : productionRun.productId, productFeatureApplTypeId : "STANDARD_FEATURE"]);
             standardFeatures = EntityUtil.filterByDate(standardFeatures);
             standardFeature = EntityUtil.getFirst(standardFeatures);
             standardFeatureId = null;
-            if (standardFeature != null) {
-                standardFeatureId = standardFeature.getString("productFeatureId");
+            if (standardFeature) {
+                standardFeatureId = standardFeature.productFeatureId;
             }
             if (!features.containsKey(standardFeatureId)) {
-                features.put(standardFeatureId, UtilMisc.toMap("productFeature", standardFeature, "productionRuns", new ArrayList()));
+                features.put(standardFeatureId, [productFeature : standardFeature, productionRuns : []]);
             }
-            feature = (Map)features.get(standardFeatureId);
-            productionRuns = (List)feature.get("productionRuns");
+            feature = (Map)features.standardFeatureId;
+            productionRuns = (List)feature.productionRuns;
         }
 
         // select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
-        productionRunTasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRun.getString("workEffortId"), "workEffortName", taskNamePar));
+        productionRunTasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRun.workEffortId, workEffortName : taskNamePar]);
         productionRunTask = EntityUtil.getFirst(productionRunTasks);
-        if (productionRunTask == null) {
+        if (!productionRunTask) {
             // the production run doesn't include the given task, skip it
             continue;
         }
 
-        productionRunMap = UtilMisc.toMap("productionRun", productionRun,
-                                          "product", productionRunProduct,
-                                          "productionRunTask", productionRunTask);
+        productionRunMap = [productionRun : productionRun,
+                                          product : productionRunProduct,
+                                          productionRunTask  : productionRunTask];
         productionRuns.add(productionRunMap);
     }
-    context.put("features", features.values());
+    context.features = features.values();
 }

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PRunsProductsStacks.groovy Fri Jun  6 07:19:25 2008
@@ -20,55 +20,49 @@
 // PRunsProductsStacks
 // ReportC
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.product.category.CategoryWorker;
-
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+import org.ofbiz.entity.util.EntityUtil;
+
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
-if (!UtilValidate.isEmpty(productFeatureTypeIdPar)) {
-    featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar));
-    context.put("featureType", featureType);
+if (productFeatureTypeIdPar) {
+    featureType = delegator.findByPrimaryKey("ProductFeatureType", [productFeatureTypeId : productFeatureTypeIdPar]);
+    context.featureType = featureType;
 }
 
-allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortName", planName), UtilMisc.toList("productId"));
-productionRuns = new ArrayList();
-features = new HashMap();
-products = new HashMap();
-
-if (allProductionRuns != null) {
-    allProductionRunsIt = allProductionRuns.iterator();
-    while (allProductionRunsIt.hasNext()) {
-        productionRun = allProductionRunsIt.next();
+allProductionRuns = delegator.findByAnd("WorkEffortAndGoods", [workEffortName : planName], ["productId"]);
+productionRuns = [];
+features = [:];
+products = [:];
+
+if (allProductionRuns) {
+    allProductionRuns.each { productionRun ->
         // verify if the product is a member of the given category (based on the report's parameter)
-        if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-            if (!isProductInCategory(delegator, productionRun.getString("productId"), productCategoryIdPar)) {
+        if (productCategoryIdPar) {
+            if (!isProductInCategory(delegator, productionRun.productId, productCategoryIdPar)) {
                 // the production run's product is not a member of the given category, skip it
                 continue;
             }
         }
-        productionRunProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productionRun.getString("productId")));
-        location = null;
-        if (!UtilValidate.isEmpty(productionRunProduct)) {
-            locations = delegator.findByAnd("ProductFacilityLocation", UtilMisc.toMap("facilityId", productionRun.getString("facilityId"), "productId", productionRun.getString("productId")));
+        productionRunProduct = delegator.findByPrimaryKey("Product", [productId : productionRun.productId]);
+        location = [:];
+        if (productionRunProduct) {
+            locations = delegator.findByAnd("ProductFacilityLocation", [facilityId : productionRun.facilityId, productId : productionRun.productId]);
             location = EntityUtil.getFirst(locations);
         }
-        if (!UtilValidate.isEmpty(taskNamePar)) {
+        if (taskNamePar) {
             // select the production run's task of a given name (i.e. type) if any (based on the report's parameter)
-            productionRunTasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRun.getString("workEffortId"), "workEffortName", taskNamePar));
+            productionRunTasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRun.workEffortId , workEffortName : taskNamePar]);
             productionRunTask = EntityUtil.getFirst(productionRunTasks);
-            if (productionRunTask == null) {
+            if (!productionRunTask) {
                 // the production run doesn't include the given task, skip it
                 continue;
             }
         }
 
         // Stack information
-        stackInfos = new ArrayList();
+        stackInfos = [];
         productionRunQty = productionRun.getDouble("quantityToProduce");
         //numOfStacks = (int)productionRunQty / stackQty; // number of stacks
         numOfStacks = productionRunQty / stackQty; // number of stacks
@@ -80,15 +74,15 @@
             qtyInLastStack = stackQty;
         }
         for (int i = 1; i < numOfStacks; i++) {
-            stackInfos.add(UtilMisc.toMap("stackNum", "" + i, "numOfStacks", "" + numOfStacks, "qty", stackQty));
+            stackInfos.add([stackNum : "" + i, numOfStacks : "" + numOfStacks, qty : stackQty]);
         }
-        stackInfos.add(UtilMisc.toMap("stackNum", "" + numOfStacks, "numOfStacks", "" + numOfStacks, "qty", qtyInLastStack));
+        stackInfos.add([stackNum : "" + numOfStacks, numOfStacks : "" + numOfStacks, qty : qtyInLastStack]);
 
-        productionRunMap = UtilMisc.toMap("productionRun", productionRun,
-                                          "product", productionRunProduct,
-                                          "location", location,
-                                          "stackInfos", stackInfos);
+        productionRunMap = [productionRun : productionRun,
+                                          product : productionRunProduct,
+                                          location : location,
+                                          stackInfos : stackInfos];
         productionRuns.add(productionRunMap);
     }
-    context.put("productionRuns", productionRuns);
+    context.productionRuns = productionRuns;
 }

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/PackageContentsAndOrder.groovy Fri Jun  6 07:19:25 2008
@@ -20,57 +20,50 @@
 // PackageContentsAndOrder
 // ReportB
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.util.*;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
 import org.ofbiz.order.order.OrderContentWrapper;
-import org.ofbiz.product.category.CategoryWorker;
 
-if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-    category = delegator.findByPrimaryKey("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryIdPar));
-    context.put("category", category);
+if (productCategoryIdPar) {
+    category = delegator.findByPrimaryKey("ProductCategory", [productCategoryId : productCategoryIdPar]);
+    context.category = category;
 }
-if (!UtilValidate.isEmpty(productFeatureTypeIdPar)) {
-    featureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeIdPar));
-    context.put("featureType", featureType);
+if (productFeatureTypeIdPar) {
+    featureType = delegator.findByPrimaryKey("ProductFeatureType", [productFeatureTypeId : productFeatureTypeIdPar]);
+    context.featureType = featureType;
 }
-packageContents = delegator.findByAnd("ShipmentPackageContent", UtilMisc.toMap("shipmentId", shipmentId));
+packageContents = delegator.findByAnd("ShipmentPackageContent", [shipmentId : shipmentId]);
 
-Map packagesMap = new HashMap();
-if (packageContents != null) {
-    packageContentsIt = packageContents.iterator();
-    while (packageContentsIt.hasNext()) {
-        packageContent = packageContentsIt.next();
-
-        orderShipments = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", packageContent.getString("shipmentItemSeqId")));
+packagesMap = [:];
+if (packageContents) {
+    packageContents.each { packageContent ->
+        orderShipments = delegator.findByAnd("OrderShipment", [shipmentId : shipmentId, shipmentItemSeqId : packageContent.shipmentItemSeqId]);
         orderShipment = EntityUtil.getFirst(orderShipments);
-        orderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderShipment.getString("orderId"), "orderItemSeqId", orderShipment.getString("orderItemSeqId")));
+        orderItem = delegator.findByPrimaryKey("OrderItem", [orderId : orderShipment.orderId, orderItemSeqId : orderShipment.orderItemSeqId]);
         product = orderItem.getRelatedOne("Product");
         // verify if the product is a member of the given category (based on the report's parameter)
-        if (!UtilValidate.isEmpty(productCategoryIdPar)) {
-            if (!isProductInCategory(delegator, product.getString("productId"), productCategoryIdPar)) {
+        if (productCategoryIdPar) {
+            if (!isProductInCategory(delegator, product.productId, productCategoryIdPar)) {
                 // the production run's product is not a member of the given category, skip it
                 continue;
             }
         }
 
-        if (!packagesMap.containsKey(packageContent.getString("shipmentPackageSeqId"))) {
-            OrderReadHelper orh = new OrderReadHelper(delegator, orderItem.getString("orderId"));
-            packagesMap.put(packageContent.getString("shipmentPackageSeqId"),
-                            UtilMisc.toMap("packageId", packageContent.getString("shipmentPackageSeqId"),
-                                           "party", orh.getPlacingParty(),
-                                           "address", orh.getShippingAddress(),
-                                           "orderHeader", orh.getOrderHeader(),
-                                           "orderShipment", orderShipment,
-                                           "components", new ArrayList()));
+        if (!packagesMap.containsKey(packageContent.shipmentPackageSeqId)) {
+            OrderReadHelper orh = new OrderReadHelper(delegator, orderItem.orderId);
+            packagesMap.put(packageContent.shipmentPackageSeqId,
+                            [packageId : packageContent.shipmentPackageSeqId,
+                             party : orh.getPlacingParty(),
+                             address : orh.getShippingAddress(),
+                             orderHeader : orh.getOrderHeader(),
+                             orderShipment : orderShipment,
+                             components : []]);
         }
         OrderContentWrapper orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderItem, request);
-        String imageUrl = orderContentWrapper.get("IMAGE_URL");
-        packageMap = (Map)packagesMap.get(packageContent.getString("shipmentPackageSeqId"));
-        components = (List)packageMap.get("components");
-        components.add(UtilMisc.toMap("product", product, "orderItem", orderItem, "imageUrl", imageUrl));
+        String imageUrl = orderContentWrapper.IMAGE_URL;
+        packageMap = (Map)packagesMap.packageContent.shipmentPackageSeqId;
+        components = (List)packageMap.components;
+        components.add([product : product, orderItem : orderItem, imageUrl : imageUrl]);
     }
 }
-context.put("packages", packagesMap.values());
+context.packages = packagesMap.values();

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentLabel.groovy Fri Jun  6 07:19:25 2008
@@ -17,86 +17,73 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.order.order.*;
-import org.ofbiz.content.report.*;
-
-delegator = request.getAttribute("delegator");
-dispatcher = request.getAttribute("dispatcher");
-userLogin = request.getSession().getAttribute("userLogin");
-
-shipmentId = request.getParameter("shipmentId");
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-
-context.put("shipmentIdPar", shipment.getString("shipmentId"));
-
-if (shipment != null) {    
-    shipmentPackages = delegator.findByAnd("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId));
-    shipmentPackagesIt = shipmentPackages.iterator();
-    records = new ArrayList();
-    orderReaders = new HashMap();
-    while(shipmentPackagesIt.hasNext()) {
-        shipmentPackage = shipmentPackagesIt.next();
-
-        shipmentPackageComponents = delegator.findByAnd("ShipmentPackageContent", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackage.getString("shipmentPackageSeqId")));
-        shipmentPackageComponentsIt = shipmentPackageComponents.iterator();
-        while(shipmentPackageComponentsIt.hasNext()) {
-            shipmentPackageComponent = shipmentPackageComponentsIt.next();
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.order.order.OrderReadHelper;
 
+shipmentId = parameters.shipmentId;
+shipment = delegator.findByPrimaryKey("Shipment", [shipmentId : shipmentId]);
+
+context.shipmentIdPar = shipment.shipmentId;
+
+if (shipment) {    
+    shipmentPackages = delegator.findByAnd("ShipmentPackage", [shipmentId : shipmentId]);
+    records = [];
+    orderReaders = [:];
+    shipmentPackages.each { shipmentPackage ->
+        shipmentPackageComponents = delegator.findByAnd("ShipmentPackageContent", [shipmentId : shipmentId, shipmentPackageSeqId : shipmentPackage.shipmentPackageSeqId]);
+        shipmentPackageComponents.each { shipmentPackageComponent ->
             shipmentItem = shipmentPackageComponent.getRelatedOne("ShipmentItem");
             orderShipments = shipmentItem.getRelated("OrderShipment");
             orderShipment = EntityUtil.getFirst(orderShipments);
             
             String orderId = null;
             String orderItemSeqId = null;
-            if (orderShipment != null) {            
-                orderId = orderShipment.getString("orderId");
-                orderItemSeqId = orderShipment.getString("orderItemSeqId");
+            if (orderShipment) {            
+                orderId = orderShipment.orderId;
+                orderItemSeqId = orderShipment.orderItemSeqId;
             }
 
-            record = new HashMap();
-            if (shipmentPackageComponent.get("subProductId") != null) {
-                record.put("productId", shipmentPackageComponent.getString("subProductId"));
-                record.put("quantity", shipmentPackageComponent.getDouble("subQuantity"));
+            record = [:];
+            if (shipmentPackageComponent.subProductId) {
+                record.productId = shipmentPackageComponent.subProductId;
+                record.quantity = shipmentPackageComponent.getDouble("subQuantity");
             } else {
-                record.put("productId", shipmentItem.getString("productId"));
-                record.put("quantity", shipmentPackageComponent.getDouble("quantity"));
+                record.productId = shipmentItem.productId;
+                record.quantity = shipmentPackageComponent.getDouble("quantity");
             }
-            record.put("shipmentPackageSeqId", shipmentPackageComponent.getString("shipmentPackageSeqId"));
-            record.put("orderId", orderId);
-            record.put("orderItemSeqId", orderItemSeqId);            
-            product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", (String)record.get("productId")));
-            record.put("productName", product.getString("internalName"));
-            record.put("shipDate", shipment.getString("estimatedShipDate"));
+            record.shipmentPackageSeqId = shipmentPackageComponent.shipmentPackageSeqId;
+            record.orderId = orderId;
+            record.orderItemSeqId = orderItemSeqId;            
+            product = delegator.findByPrimaryKey("Product", [productId : record.productId]);
+            record.productName = product.internalName;
+            record.shipDate = shipment.estimatedShipDate;
             // ---
             orderReadHelper = null;
             if (orderReaders.containsKey(orderId)) {
                 orderReadHelper = (OrderReadHelper)orderReaders.get(orderId);
             } else {
-                orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
+                orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]);
                 orderReadHelper = new OrderReadHelper(orderHeader);
                 orderReaders.put(orderId, orderReadHelper);
             }
             displayParty = orderReadHelper.getPlacingParty();
             shippingAddress = orderReadHelper.getShippingAddress();
-            record.put("shippingAddressName", shippingAddress.getString("toName"));
-            record.put("shippingAddressAddress", shippingAddress.getString("address1"));
-            record.put("shippingAddressCity", shippingAddress.getString("city"));
-            record.put("shippingAddressPostalCode", shippingAddress.getString("postalCode"));
-            record.put("shippingAddressCountry", shippingAddress.getString("countryGeoId"));
+            record.shippingAddressName = shippingAddress.toName;
+            record.shippingAddressAddress = shippingAddress.address1;
+            record.shippingAddressCity = shippingAddress.city;
+            record.shippingAddressPostalCode = shippingAddress.postalCode;
+            record.shippingAddressCountry = shippingAddress.countryGeoId;
             records.add(record);
         }
     }
-    context.put("records", records);
+    context.records = records;
     
     // check permission
     hasPermission = false;
     if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
         hasPermission = true;
     }
-    context.put("hasPermission", hasPermission);    
+    context.hasPermission = hasPermission;    
 }
 
 return "success";

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentPlanStockReport.groovy Fri Jun  6 07:19:25 2008
@@ -19,88 +19,77 @@
 
 import org.ofbiz.entity.*;
 import org.ofbiz.base.util.*;
-import org.ofbiz.content.report.*;
 
-delegator = request.getAttribute("delegator");
-security = request.getAttribute("security");
-dispatcher = request.getAttribute("dispatcher");
-userLogin = request.getSession().getAttribute("userLogin");
-
-inventoryStock = new HashMap();
-shipmentId = request.getParameter("shipmentId");
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-
-context.put("shipmentIdPar", shipment.getString("shipmentId"));
-context.put("estimatedReadyDatePar", shipment.getString("estimatedReadyDate"));
-context.put("estimatedShipDatePar", shipment.getString("estimatedShipDate"));
-
-if (shipment != null) {
-    shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId));
-    shipmentPlansIt = shipmentPlans.iterator();
-    records = new ArrayList();
-
-    while(shipmentPlansIt.hasNext()) {
-        shipmentPlan = shipmentPlansIt.next();
-        orderLine = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId")));
-        recordGroup = new HashMap();
-        recordGroup.put("ORDER_ID", shipmentPlan.getString("orderId"));
-        recordGroup.put("ORDER_ITEM_SEQ_ID", shipmentPlan.getString("orderItemSeqId"));
-        recordGroup.put("SHIPMENT_ID", shipmentPlan.getString("shipmentId"));
-        recordGroup.put("SHIPMENT_ITEM_SEQ_ID", shipmentPlan.getString("shipmentItemSeqId"));
-
-        recordGroup.put("PRODUCT_ID", orderLine.getString("productId"));
-        recordGroup.put("QUANTITY", shipmentPlan.getDouble("quantity"));
-        product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", orderLine.getString("productId")));
-        recordGroup.put("PRODUCT_NAME", product.getString("internalName"));
+inventoryStock = [:];
+shipmentId = parameters.shipmentId;
+shipment = delegator.findByPrimaryKey("Shipment", [shipmentId : shipmentId]);
+
+context.shipmentIdPar = shipment.shipmentId;
+context.estimatedReadyDatePar = shipment.estimatedReadyDate;
+context.estimatedShipDatePar = shipment.estimatedShipDate;
+
+if (shipment) {
+    shipmentPlans = delegator.findByAnd("OrderShipment", [shipmentId : shipmentId]);
+    shipmentPlans.each { shipmentPlan ->
+        orderLine = delegator.findByPrimaryKey("OrderItem", [orderId : shipmentPlan.orderId , orderItemSeqId : shipmentPlan.orderItemSeqId]);
+        recordGroup = [:];
+        recordGroup.ORDER_ID = shipmentPlan.orderId;
+        recordGroup.ORDER_ITEM_SEQ_ID = shipmentPlan.orderItemSeqId;
+        recordGroup.SHIPMENT_ID = shipmentPlan.shipmentId;
+        recordGroup.SHIPMENT_ITEM_SEQ_ID = shipmentPlan.shipmentItemSeqId;
+
+        recordGroup.PRODUCT_ID = orderLine.productId;
+        recordGroup.QUANTITY = shipmentPlan.getDouble("quantity");
+        product = delegator.findByPrimaryKey("Product", [productId : orderLine.productId]);
+        recordGroup.PRODUCT_NAME = product.internalName;
     
-        Map inputPar = UtilMisc.toMap("productId", orderLine.getString("productId"),
-                                     "quantity", shipmentPlan.getDouble("quantity"),
-                                     "fromDate", "" + new Date(),
-                                     "userLogin", userLogin);
+        inputPar = [productId : orderLine.productId,
+                                     quantity : shipmentPlan.getDouble("quantity"),
+                                     fromDate : "" + new Date(),
+                                     userLogin: userLogin];
                             
-        Map result = null;
+        result = [:];
         result = dispatcher.runSync("getNotAssembledComponents",inputPar);
-        if (result != null)
+        if (result)
             components = (List)result.get("notAssembledComponents");
         componentsIt = components.iterator();
-        while(componentsIt.hasNext()) {
+        while(componentsIt) {
             oneComponent = (org.ofbiz.manufacturing.bom.BOMNode)componentsIt.next();
             record = new HashMap(recordGroup);
-            record.put("componentId", oneComponent.getProduct().getString("productId"));
-            record.put("componentName", oneComponent.getProduct().getString("internalName"));
-            record.put("componentQuantity", new Float(oneComponent.getQuantity()));
-            facilityId = shipment.getString("originFacilityId");
+            record.componentId = oneComponent.getProduct().productId;
+            record.componentName = oneComponent.getProduct().internalName;
+            record.componentQuantity = new Float(oneComponent.getQuantity());
+            facilityId = shipment.originFacilityId;
             float qty = 0;
-            if (facilityId != null) {
-                if (!inventoryStock.containsKey(oneComponent.getProduct().getString("productId"))) {
-                    serviceInput = UtilMisc.toMap("productId",oneComponent.getProduct().getString("productId"), "facilityId", facilityId);
+            if (facilityId) {
+                if (!inventoryStock.containsKey(oneComponent.getProduct().productId)) {
+                    serviceInput = [productId : oneComponent.getProduct().productId , facilityId : facilityId];
                     serviceOutput = dispatcher.runSync("getInventoryAvailableByFacility",serviceInput);
-                    qha = serviceOutput.get("quantityOnHandTotal");
-                    if (qha == null) qha = new Double(0);
-                    inventoryStock.put(oneComponent.getProduct().getString("productId"), qha);
+                    qha = serviceOutput.quantityOnHandTotal ?: new Double(0);
+                    inventoryStock.oneComponent.getProduct().productId = qha;
                 }
-                qty = ((Double)inventoryStock.get(oneComponent.getProduct().getString("productId"))).floatValue();
+                qty = ((Double)inventoryStock.get(oneComponent.getProduct().productId)).floatValue();
                 qty = (float)(qty - oneComponent.getQuantity());
-                inventoryStock.put(oneComponent.getProduct().getString("productId"), new Double(qty));
+                inventoryStock.oneComponent.getProduct().productId = new Double(qty);
             }
-            record.put("componentOnHand", new Float(qty));
+            record.componentOnHand = new Float(qty);
             // Now we get the products qty already reserved by production runs
-            serviceInput = UtilMisc.toMap("productId", oneComponent.getProduct().getString("productId"),
-                                          "userLogin", userLogin);
+            serviceInput = [productId : oneComponent.getProduct().productId,
+                                          userLogin : userLogin];
             serviceOutput = dispatcher.runSync("getProductionRunTotResQty", serviceInput);
-            resQty = serviceOutput.get("reservedQuantity");
-            record.put("reservedQuantity", resQty);
+            resQty = serviceOutput.reservedQuantity;
+            record.reservedQuantity = resQty;
             records.add(record);
         }
     }
-    context.put("records", records);
+    context.records = records;
 
     // check permission
     hasPermission = false;
     if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
         hasPermission = true;
     }
-    context.put("hasPermission", hasPermission);
+    context.hasPermission = hasPermission;
 }
 
 return "success";

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy?rev=663950&r1=663949&r2=663950&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/reports/ShipmentWorkEffortTasks.groovy Fri Jun  6 07:19:25 2008
@@ -17,70 +17,54 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.order.order.*;
-import org.ofbiz.content.report.*;
+import org.ofbiz.entity.GenericValue;
 
-delegator = request.getAttribute("delegator");
-dispatcher = request.getAttribute("dispatcher");
-userLogin = request.getSession().getAttribute("userLogin");
+shipmentId = parameters.shipmentId;
+shipment = delegator.findByPrimaryKey("Shipment", [shipmentId : shipmentId]);
 
-shipmentId = request.getParameter("shipmentId");
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-
-context.put("shipmentIdPar", shipment.getString("shipmentId"));
-context.put("date", new Date());
+context.shipmentIdPar = shipment.shipmentId;
+context.date = new Date();
 Double fixedAssetTime = new Double(0);
 
-if (shipment != null) {
-    shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId));
-    shipmentPlansIt = shipmentPlans.iterator();
-    records = new ArrayList();
-
-    while(shipmentPlansIt.hasNext()) {
-        shipmentPlan = shipmentPlansIt.next();
-        productionRuns = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId")), UtilMisc.toList("workEffortId")); // TODO: add shipmentId
-        if (productionRuns != null && productionRuns.size() > 0) {
-            productionRunsIt = productionRuns.iterator();
-            while (productionRunsIt.hasNext()) {
-                productionRun = productionRunsIt.next();
-                productionRunProduct = null;
-                productionRunProducts = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", productionRun.getString("workEffortId"), "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED"));
-                if (productionRunProducts != null && productionRunProducts.size() > 0) {
-                    //productionRunProduct = ((GenericValue)productionRunProducts.get(0)).getString("productId");
+if (shipment) {
+    shipmentPlans = delegator.findByAnd("OrderShipment", [shipmentId : shipmentId]);
+    shipmentPlans.each { shipmentPlan ->
+        productionRuns = delegator.findByAnd("WorkOrderItemFulfillment", [orderId : shipmentPlan.orderId, orderItemSeqId : shipmentPlan.orderItemSeqId] , ["workEffortId"]); // TODO: add shipmentId
+        if (productionRuns) {
+            productionRuns.each { productionRun ->
+                productionRunProduct = [:];
+                productionRunProducts = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : productionRun.workEffortId , workEffortGoodStdTypeId : "PRUN_PROD_DELIV", statusId : "WEGS_CREATED"]);
+                if (productionRunProducts) {
                     productionRunProduct = ((GenericValue)productionRunProducts.get(0)).getRelatedOne("Product");
                 }
-                tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRun.getString("workEffortId"), "workEffortTypeId", "PROD_ORDER_TASK"));
-                tasksIt = tasks.iterator();
-                while (tasksIt.hasNext()) {
-                    task = tasksIt.next();
-                    record = new HashMap();
-                    record.put("productId", productionRunProduct.getString("productId"));
-                    record.put("productName", productionRunProduct.getString("internalName"));
-                    record.put("fixedAssetId", task.getString("fixedAssetId"));
-                    record.put("priority", task.getLong("priority"));
-                    record.put("workEffortId", productionRun.getString("workEffortId"));
-                    record.put("taskId", task.getString("workEffortId"));
-                    record.put("taskName", task.getString("workEffortName"));
-                    record.put("taskDescription", task.getString("description"));
-                    record.put("taskEstimatedTime", task.getDouble("estimatedMilliSeconds"));
-                    record.put("taskEstimatedSetup", task.getDouble("estimatedSetupMillis"));
+                tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRun.workEffortId, workEffortTypeId : "PROD_ORDER_TASK"]);
+                tasks.each { task ->
+                    record = [:];
+                    record.productId = productionRunProduct.productId;
+                    record.productName = productionRunProduct.internalName;
+                    record.fixedAssetId = task.fixedAssetId;
+                    record.priority = task.getLong("priority");
+                    record.workEffortId = productionRun.workEffortId;
+                    record.taskId = task.workEffortId;
+                    record.taskName = task.workEffortName;
+                    record.taskDescription = task.description;
+                    record.taskEstimatedTime = task.getDouble("estimatedMilliSeconds");
+                    record.taskEstimatedSetup = task.getDouble("estimatedSetupMillis");
                     records.add(record);
                     fixedAssetTime = fixedAssetTime + task.getDouble("estimatedMilliSeconds");
                 }
             }
         }
     }
-    context.put("fixedAssetTime", fixedAssetTime);
-    context.put("records", records);
+    context.fixedAssetTime = fixedAssetTime;
+    context.records = records;
     
     // check permission
     hasPermission = false;
     if (security.hasEntityPermission("MANUFACTURING", "_VIEW", session)) {
         hasPermission = true;
     }
-    context.put("hasPermission", hasPermission);
+    context.hasPermission = hasPermission;
 }
 
 return "success";