You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2008/06/05 13:48:15 UTC
svn commit: r663544 [1/2] - in /ofbiz/trunk:
applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/
applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/
applications/manufacturing/webapp/manufacturing/WEB-INF/action...
Author: ashish
Date: Thu Jun 5 04:48:15 2008
New Revision: 663544
URL: http://svn.apache.org/viewvc?rev=663544&view=rev
Log:
Applied Groovy Features on the Manufacturing Component.
Also committing files from previous commit.
Part of JIRA issue # OFBIZ-1801
Modified:
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunTasks.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/productionRunAllFixedAssets.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendarExceptionDay.groovy
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendarExceptionWeek.groovy
ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/BomSimulation.groovy Thu Jun 5 04:48:15 2008
@@ -17,58 +17,50 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
-
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.manufacturing.bom.BOMNode;
tree = request.getAttribute("tree");
-String currencyUomId = request.getParameter("currencyUomId");
-String facilityId = request.getParameter("facilityId");
+currencyUomId = parameters.currencyUomId;
+facilityId = parameters.facilityId;
-if (tree != null) {
- List treeArray = new ArrayList();
- Map treeQty = new HashMap();
+if (tree) {
+ treeArray = [];
+ treeQty = [:];
tree.print(treeArray);
tree.sumQuantities(treeQty);
- context.put("tree", treeArray);
+ context.tree = treeArray;
Iterator treeQtyIt = treeQty.values().iterator();
- List productsData = new ArrayList();
+ productsData = [];
Double grandTotalCost = null;
- while (treeQtyIt.hasNext()) {
+ while (treeQtyIt) {
BOMNode node = (BOMNode)treeQtyIt.next();
Double unitCost = null;
Double totalCost = null;
Double qoh = null;
// The standard cost is retrieved
try {
- Map outMap = null;
- if (UtilValidate.isNotEmpty(currencyUomId)) {
- outMap = dispatcher.runSync("getProductCost", UtilMisc.toMap("productId", node.getProduct().getString("productId"),
- "currencyUomId", currencyUomId,
- "costComponentTypePrefix", "EST_STD",
- "userLogin", userLogin));
- unitCost = (Double)outMap.get("productCost");
+ outMap = [:];
+ if (currencyUomId) {
+ outMap = dispatcher.runSync("getProductCost", [productId : node.getProduct().productId,
+ currencyUomId : currencyUomId,
+ costComponentTypePrefix : "EST_STD",
+ userLogin : userLogin]);
+ unitCost = (Double)outMap.productCost;
totalCost = unitCost * node.getQuantity();
- if (grandTotalCost == null) {
- grandTotalCost = 0;
- }
- grandTotalCost = grandTotalCost + totalCost;
+ grandTotalCost = grandTotalCost + totalCost ?: 0;
}
- if (UtilValidate.isNotEmpty(facilityId)) {
- outMap = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", node.getProduct().getString("productId"),
- "facilityId", facilityId,
- "userLogin", userLogin));
- qoh = (Double)outMap.get("quantityOnHandTotal");
+ if (facilityId) {
+ outMap = dispatcher.runSync("getInventoryAvailableByFacility", [productId : node.getProduct().productId,
+ facilityId : facilityId,
+ userLogin : userLogin]);
+ qoh = (Double)outMap.quantityOnHandTotal;
}
} catch(Exception e) {}
- productsData.add(UtilMisc.toMap("node", node, "unitCost", unitCost, "totalCost", totalCost, "qoh", qoh));
+ productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh]);
}
- context.put("productsData", productsData);
- context.put("grandTotalCost", grandTotalCost);
+ context.productsData = productsData;
+ context.grandTotalCost = grandTotalCost;
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy Thu Jun 5 04:48:15 2008
@@ -17,68 +17,58 @@
* under the License.
*/
-import java.util.*;
-import java.sql.*;
-import java.io.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.widget.html.*;
+import java.sql.Timestamp;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilDateTime;
-security = request.getAttribute("security");
-delegator = request.getAttribute("delegator");
-
-nowDate = UtilDateTime.nowDate();
-context.put("nowDate", nowDate);
-
-String nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString());
-context.put("nowTimestampString", nowTimestampString);
+context.nowDate = UtilDateTime.nowDate();
+context.nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString());
boolean useValues = true;
-if (request.getAttribute("_ERROR_MESSAGE_") != null) useValues = false;
+if (request.getAttribute("_ERROR_MESSAGE_")) useValues = false;
-String productId = request.getParameter("productId");
-if (productId != null) context.put("productId", productId);
+productId = parameters.productId;
+if (productId) context.productId = productId;
-String productIdTo = request.getParameter("productIdTo");
-String updateMode = request.getParameter("UPDATE_MODE");
+productIdTo = parameters.productIdTo;
+updateMode = parameters.UPDATE_MODE;
-if (productIdTo != null) context.put("productIdTo", productIdTo);
+if (productIdTo) context.productIdTo = productIdTo;
-String productAssocTypeId = request.getParameter("productAssocTypeId");
-if (productAssocTypeId != null) context.put("productAssocTypeId", productAssocTypeId);
+productAssocTypeId = parameters.productAssocTypeId;
+if (productAssocTypeId) context.productAssocTypeId = productAssocTypeId;
-String fromDateStr = request.getParameter("fromDate");
+fromDateStr = parameters.fromDate;
Timestamp fromDate = null;
-if (UtilValidate.isNotEmpty(fromDateStr)) fromDate = Timestamp.valueOf(fromDateStr);
-if (fromDate == null) fromDate = (Timestamp)request.getAttribute("ProductAssocCreateFromDate");
-if (fromDate != null) context.put("fromDate", fromDate);
-
-GenericValue productAssoc = delegator.findByPrimaryKey("ProductAssoc", UtilMisc.toMap("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate));
-if (updateMode != null) {
- productAssoc = null;
+if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate");;
+context.fromDate = fromDate;
+
+productAssoc = delegator.findByPrimaryKey("ProductAssoc", [productId : productId, productIdTo : productIdTo, productAssocTypeId : productAssocTypeId, fromDate : fromDate]);
+if (updateMode) {
+ productAssoc = [:];
context.remove("productIdTo");
}
-if (productAssoc != null) {
- context.put("productAssoc", productAssoc);
+if (productAssoc) {
+ context.productAssoc = productAssoc;
}
if("true".equalsIgnoreCase((String)request.getParameter("useValues"))) useValues = true;
-if(productAssoc == null) useValues = false;
+if(!productAssoc) useValues = false;
-context.put("useValues", useValues);
+context.useValues = useValues;
-Collection assocTypes = delegator.findByAnd("ProductAssocType", UtilMisc.toMap("parentTypeId", "PRODUCT_COMPONENT"), UtilMisc.toList("productAssocTypeId", "description"));
-context.put("assocTypes", assocTypes);
+Collection assocTypes = delegator.findByAnd("ProductAssocType", [parentTypeId : "PRODUCT_COMPONENT"], ["productAssocTypeId", "description"]);
+context.assocTypes = assocTypes;
-Collection formulae = delegator.findByAnd("CustomMethod", UtilMisc.toMap("customMethodTypeId", "BOM_FORMULA"), UtilMisc.toList("customMethodId", "description"));
-context.put("formulae", formulae);
+Collection formulae = delegator.findByAnd("CustomMethod", [customMethodTypeId : "BOM_FORMULA"], ["customMethodId", "description"]);
+context.formulae = formulae;
-if (product != null) {
- List assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId != null? UtilMisc.toMap("productAssocTypeId", productAssocTypeId): null), UtilMisc.toList("sequenceNum"));
- if (assocFromProducts != null) context.put("assocFromProducts", assocFromProducts);
+if (product) {
+ assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum"]);
+ if (assocFromProducts) context.assocFromProducts = assocFromProducts;
- List assocToProducts = product.getRelatedByAnd("AssocProductAssoc", (productAssocTypeId != null? UtilMisc.toMap("productAssocTypeId", productAssocTypeId): null));
- if (assocTOProducts != null) context.put("assocToProducts", assocToProducts);
+ assocToProducts = product.getRelatedByAnd("AssocProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]));
+ if (assocTOProducts) context.assocToProducts = assocToProducts;
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy Thu Jun 5 04:48:15 2008
@@ -1,46 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.widget.html.HtmlFormWrapper;
-
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-
-List taskInfos = new ArrayList();
-List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("workEffortId"));
-Iterator tasksIt = tasks.iterator();
-while (tasksIt.hasNext()) {
- GenericValue task = (GenericValue)tasksIt.next();
- List records = delegator.findByAnd("InventoryItemDetail", UtilMisc.toMap("workEffortId", task.getString("workEffortId")));
- HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskActualComponents", request, response);
- taskForm.putInContext("records", records);
- taskInfos.add(UtilMisc.toMap("task", task, "taskForm", taskForm));
-}
-context.put("taskInfos", taskInfos);
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.widget.html.HtmlFormWrapper;
+
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+
+taskInfos = [];
+tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"]);
+tasks.each { task ->
+ records = delegator.findByAnd("InventoryItemDetail", [workEffortId : task.workEffortId]);
+ HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskActualComponents", request, response);
+ taskForm.putInContext("records", records);
+ taskInfos.add([task : task, taskForm : taskForm]);
+}
+context.taskInfos = taskInfos;
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy Thu Jun 5 04:48:15 2008
@@ -1,46 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.widget.html.HtmlFormWrapper;
-
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-
-List taskInfos = new ArrayList();
-List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("workEffortId"));
-Iterator tasksIt = tasks.iterator();
-while (tasksIt.hasNext()) {
- GenericValue task = (GenericValue)tasksIt.next();
- List records = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", task.getString("workEffortId")));
- HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskComponents", request, response);
- taskForm.putInContext("records", records);
- taskInfos.add(UtilMisc.toMap("task", task, "taskForm", taskForm));
-}
-context.put("taskInfos", taskInfos);
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.widget.html.HtmlFormWrapper;
+
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+
+taskInfos = [];
+tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"]);
+tasks.each { task ->
+ records = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : task.workEffortId]);
+ HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskComponents", request, response);
+ taskForm.putInContext("records", records);
+ taskInfos.add([task : task, taskForm : taskForm]);
+}
+context.taskInfos = taskInfos;
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy Thu Jun 5 04:48:15 2008
@@ -17,31 +17,15 @@
* under the License.
*/
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-//import java.util.HashMap;
-
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.widget.html.HtmlFormWrapper;
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-
-List taskCosts = new ArrayList();
-List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("workEffortId"));
-Iterator tasksIt = tasks.iterator();
-while (tasksIt.hasNext()) {
- GenericValue task = (GenericValue)tasksIt.next();
- List costs = EntityUtil.filterByDate(delegator.findByAnd("CostComponent", UtilMisc.toMap("workEffortId", task.getString("workEffortId"))));
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+taskCosts = [];
+tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"]);
+tasks.each { task ->
+ costs = EntityUtil.filterByDate(delegator.findByAnd("CostComponent", [workEffortId : task.workEffortId]));
HtmlFormWrapper taskCostsForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskCosts", request, response);
taskCostsForm.putInContext("taskCosts", costs);
- taskCosts.add(UtilMisc.toMap("task", task, "costsForm", taskCostsForm));
+ taskCosts.add([task : task ,costsForm : taskCostsForm]);
}
-context.put("taskCosts", taskCosts);
+context.taskCosts = taskCosts;
\ No newline at end of file
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy Thu Jun 5 04:48:15 2008
@@ -20,240 +20,209 @@
// The only required parameter is "productionRunId".
// The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml").
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.*;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.widget.html.HtmlFormWrapper;
import org.ofbiz.manufacturing.jobshopmgt.ProductionRun;
import javolution.util.FastList;
-userLogin = request.getAttribute("userLogin");
-
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-if (!UtilValidate.isEmpty(productionRunId)) {
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+if (productionRunId) {
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
- productionRunId = productionRun.getGenericValue().getString("workEffortId");
- context.put("productionRunId", productionRunId);
- context.put("productionRun", productionRun.getGenericValue());
+ productionRunId = productionRun.getGenericValue().workEffortId;
+ context.productionRunId = productionRunId;
+ context.productionRun = productionRun.getGenericValue();
// Find all the order items to which this production run is linked.
- List orderItems = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId));
- if (orderItems.size() > 0) {
- context.put("orderItems", orderItems);
+ orderItems = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId : productionRunId]);
+ if (orderItems) {
+ context.orderItems = orderItems;
}
// Find all the work efforts that must be completed before this one.
- List mandatoryWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
- if (mandatoryWorkEfforts.size() > 0) {
- context.put("mandatoryWorkEfforts", mandatoryWorkEfforts);
+ mandatoryWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdTo : productionRunId, workEffortAssocTypeId : "WORK_EFF_PRECEDENCY"]));
+ if (mandatoryWorkEfforts) {
+ context.mandatoryWorkEfforts = mandatoryWorkEfforts;
}
// Find all the work efforts that can start after this one.
- List dependentWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
- if (dependentWorkEfforts.size() > 0) {
- context.put("dependentWorkEfforts", dependentWorkEfforts);
+ dependentWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdFrom : productionRunId, workEffortAssocTypeId : "WORK_EFF_PRECEDENCY"]));
+ if (dependentWorkEfforts) {
+ context.dependentWorkEfforts = dependentWorkEfforts;
}
- Double quantityToProduce = productionRun.getGenericValue().getDouble("quantityToProduce");
- if (quantityToProduce == null) {
- quantityToProduce = new Double(0);
- }
+ Double quantityToProduce = productionRun.getGenericValue().getDouble("quantityToProduce") ?: new Double(0);
// Find the inventory items produced
- List inventoryItems = delegator.findByAnd("WorkEffortInventoryProduced", UtilMisc.toMap("workEffortId", productionRunId));
- context.put("inventoryItems", inventoryItems);
- if (UtilValidate.isNotEmpty(inventoryItems)) {
- GenericValue lastWorkEffortInventoryProduced = (GenericValue)inventoryItems.get(inventoryItems.size() - 1);
- GenericValue lastInventoryItem = lastWorkEffortInventoryProduced.getRelatedOne("InventoryItem");
- context.put("lastLotId", lastInventoryItem.getString("lotId"));
+ inventoryItems = delegator.findByAnd("WorkEffortInventoryProduced", [workEffortId : productionRunId]);
+ context.inventoryItems = inventoryItems;
+ if (inventoryItems) {
+ lastWorkEffortInventoryProduced = (GenericValue)inventoryItems.get(inventoryItems.size() - 1);
+ lastInventoryItem = lastWorkEffortInventoryProduced.getRelatedOne("InventoryItem");
+ context.lastLotId = lastInventoryItem.lotId;
}
// Find if the production run can produce inventory.
- Double quantityProduced = productionRun.getGenericValue().getDouble("quantityProduced");
- if (quantityProduced == null) {
- quantityProduced = new Double(0);
- }
- Double quantityRejected = productionRun.getGenericValue().getDouble("quantityRejected");
- if (quantityRejected == null) {
- quantityRejected = new Double(0);
- }
-
- GenericValue lastTask = productionRun.getLastProductionRunRoutingTask();
- Double quantityDeclared = (lastTask != null? lastTask.getDouble("quantityProduced"): null);
- if (quantityDeclared == null) {
- quantityDeclared = new Double(0);
- }
- if (lastTask != null && ("PRUN_RUNNING".equals(lastTask.getString("currentStatusId")) || "PRUN_COMPLETED".equals(lastTask.getString("currentStatusId")))) {
- context.put("canDeclareAndProduce", "Y");
+ Double quantityProduced = productionRun.getGenericValue().getDouble("quantityProduced") ?: new Double(0);
+ Double quantityRejected = productionRun.getGenericValue().getDouble("quantityRejected")?: new Double(0);
+
+ lastTask = productionRun.getLastProductionRunRoutingTask();
+ Double quantityDeclared = (lastTask ? lastTask.getDouble("quantityProduced"): new Double(0));
+
+ if (lastTask && ("PRUN_RUNNING".equals(lastTask.currentStatusId) || "PRUN_COMPLETED".equals(lastTask.currentStatusId))) {
+ context.canDeclareAndProduce = "Y";
}
double maxQuantity = quantityDeclared.doubleValue() - quantityProduced.doubleValue();
- HashMap productionRunData = new HashMap();
- productionRunData.put("workEffortId",productionRunId);
- productionRunData.put("productId", productionRun.getProductProduced().getString("productId"));
- if (maxQuantity > 0 && !"WIP".equals(productionRun.getProductProduced().getString("productTypeId"))) {
- productionRunData.put("quantity", new Double(maxQuantity));
- context.put("canProduce", "Y");
- }
- productionRunData.put("quantityToProduce", quantityToProduce);
- productionRunData.put("quantityProduced", quantityProduced);
- productionRunData.put("quantityRejected", quantityRejected);
- productionRunData.put("quantityRemaining", new Double(quantityToProduce.doubleValue() - quantityProduced.doubleValue()));
- productionRunData.put("estimatedCompletionDate", productionRun.getEstimatedCompletionDate());
- productionRunData.put("productionRunName", productionRun.getProductionRunName());
- productionRunData.put("description", productionRun.getDescription());
- productionRunData.put("estimatedStartDate", productionRun.getEstimatedStartDate());
- productionRunData.put("actualStartDate", productionRun.getGenericValue().getTimestamp("actualStartDate"));
- productionRunData.put("actualCompletionDate", productionRun.getGenericValue().getTimestamp("actualCompletionDate"));
- productionRunData.put("currentStatusId", productionRun.getGenericValue().getString("currentStatusId"));
-
- context.put("productionRunData", productionRunData);
-
- actionForm = request.getParameter("actionForm");
- if (UtilValidate.isEmpty(actionForm)) {
- actionForm = "beforeActionProductionRun";
- }
- context.put("actionForm",actionForm);
+ productionRunData = [:];
+ productionRunData.workEffortId = productionRunId;
+ productionRunData.productId = productionRun.getProductProduced().productId;
+ if (maxQuantity > 0 && !"WIP".equals(productionRun.getProductProduced().productTypeId)) {
+ productionRunData.quantity = new Double(maxQuantity);
+ context.canProduce = "Y";
+ }
+ productionRunData.quantityToProduce = quantityToProduce;
+ productionRunData.quantityProduced = quantityProduced;
+ productionRunData.quantityRejected = quantityRejected;
+ productionRunData.quantityRemaining = new Double(quantityToProduce.doubleValue() - quantityProduced.doubleValue());
+ productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate();
+ productionRunData.productionRunName = productionRun.getProductionRunName();
+ productionRunData.description = productionRun.getDescription();
+ productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate();
+ productionRunData.actualStartDate = productionRun.getGenericValue().getTimestamp("actualStartDate");
+ productionRunData.actualCompletionDate = productionRun.getGenericValue().getTimestamp("actualCompletionDate");
+ productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId;
+
+ context.productionRunData = productionRunData;
+
+ actionForm = parameters.actionForm ?: "beforeActionProductionRun";
+ context.actionForm = actionForm;
//---------------
// Routing tasks
//---------------
// routingTask update sub-screen
- routingTaskId = request.getParameter("routingTaskId");
- if (routingTaskId != null && (actionForm.equals("UpdateRoutingTask") || actionForm.equals("EditRoutingTask"))){
- GenericValue routingTask = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", routingTaskId));
+ routingTaskId = parameters.routingTaskId;
+ if (routingTaskId && (actionForm.equals("UpdateRoutingTask") || actionForm.equals("EditRoutingTask"))){
+ routingTask = delegator.findByPrimaryKey("WorkEffort", [workEffortId : routingTaskId]);
Map routingTaskData = routingTask.getAllFields();
- routingTaskData.put("estimatedSetupMillis", routingTask.getDouble("estimatedSetupMillis"));
- routingTaskData.put("estimatedMilliSeconds", routingTask.getDouble("estimatedMilliSeconds"));
+ routingTaskData.estimatedSetupMillis = routingTask.getDouble("estimatedSetupMillis");
+ routingTaskData.estimatedMilliSeconds = routingTask.getDouble("estimatedMilliSeconds");
HtmlFormWrapper editPrRoutingTaskWrapper = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "EditProductionRunDeclRoutingTask", request, response);
editPrRoutingTaskWrapper.putInContext("routingTaskData", routingTaskData);
editPrRoutingTaskWrapper.putInContext("actionForm", "UpdateRoutingTask");
- routingTaskData.put("partyId", userLogin.getString("partyId"));
- context.put("editPrRoutingTaskWrapper",editPrRoutingTaskWrapper);
- context.put("routingTaskId",routingTaskId);
+ routingTaskData.partyId = userLogin.partyId;
+ context.editPrRoutingTaskWrapper = editPrRoutingTaskWrapper;
+ context.routingTaskId = routingTaskId;
// Get the list of deliverable products, i.e. the WorkEffortGoodStandard entries
// with workEffortGoodStdTypeId = "PRUNT_PROD_DELIV":
// first of all we get the template task (the routing task)
- GenericValue templateTaskAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", routingTask.getString("workEffortId"), "workEffortAssocTypeId", "WORK_EFF_TEMPLATE"))));
- GenericValue templateTask = null;
- if (templateTaskAssoc != null) {
+ templateTaskAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdTo : routingTask.workEffortId, workEffortAssocTypeId : "WORK_EFF_TEMPLATE"])));
+ templateTask = [:];
+ if (templateTaskAssoc) {
templateTask = templateTaskAssoc.getRelatedOne("FromWorkEffort");
}
- List delivProducts = null;
- if (templateTask != null) {
- delivProducts = EntityUtil.filterByDate(templateTask.getRelatedByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_DELIV")));
+ delivProducts = [];
+ if (templateTask) {
+ delivProducts = EntityUtil.filterByDate(templateTask.getRelatedByAnd("WorkEffortGoodStandard", [workEffortGoodStdTypeId : "PRUNT_PROD_DELIV"]));
}
HtmlFormWrapper createRoutingTaskDelivProductForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "CreateRoutingTaskDelivProduct", request, response);
- createRoutingTaskDelivProductForm.putInContext("formData", UtilMisc.toMap("productionRunId", productionRunId, "workEffortId", routingTaskId));
- context.put("createRoutingTaskDelivProductForm", createRoutingTaskDelivProductForm);
- context.put("delivProducts", delivProducts);
+ createRoutingTaskDelivProductForm.putInContext("formData", [productionRunId : productionRunId, workEffortId : routingTaskId]);
+ context.createRoutingTaskDelivProductForm = createRoutingTaskDelivProductForm;
+ context.delivProducts = delivProducts;
// Get the list of delivered products, i.e. inventory items
- List prunInventoryProduced = delegator.findByAnd("WorkEffortAndInventoryProduced", UtilMisc.toMap("workEffortId", routingTaskId));
- context.put("prunInventoryProduced", prunInventoryProduced);
+ prunInventoryProduced = delegator.findByAnd("WorkEffortAndInventoryProduced", [workEffortId : routingTaskId]);
+ context.prunInventoryProduced = prunInventoryProduced;
HtmlFormWrapper prunInventoryProducedForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskInventoryProducedList", request, response);
prunInventoryProducedForm.putInContext("prunInventoryProduced", prunInventoryProduced);
- context.put("prunInventoryProducedForm", prunInventoryProducedForm);
+ context.prunInventoryProducedForm = prunInventoryProducedForm;
}
// RoutingTasks list
List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- Iterator tasksIt = productionRunRoutingTasks.iterator();
String startTaskId = null; // which production run task is ready to start and has the [Start] buton next to it
String issueTaskId = null; // which production run task is ready to have products issued with [Issue Components] button
String completeTaskId = null; // which task has the [Complete] button next to it
- while (tasksIt.hasNext()) {
- GenericValue task = (GenericValue)tasksIt.next();
+ productionRunRoutingTasks.each { task ->
// only PRUN_RUNNING tasks can have items issued or production run completed
- if (task.getString("currentStatusId").equals("PRUN_RUNNING")) {
+ if ("PRUN_RUNNING".equals(task.currentStatusId)) {
// Use WorkEffortGoodStandard to figure out if there are products which are needed for this task (PRUNT_PRODNEEDED) and which have not been issued (ie, WEGS_CREATED).
// If so this task should have products issued
- List components = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", task.getString("workEffortId"), "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"));
- List notIssued = EntityUtil.filterByAnd(components, UtilMisc.toMap("statusId", "WEGS_CREATED"));
- if (components.size() > 0 && notIssued.size() > 0) {
- issueTaskId = task.getString("workEffortId");
+ components = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : task.workEffortId, workEffortGoodStdTypeId : "PRUNT_PROD_NEEDED"]);
+ List notIssued = EntityUtil.filterByAnd(components, [statusId : "WEGS_CREATED"]);
+ if (components && notIssued) {
+ issueTaskId = task.workEffortId;
}
- if (issueTaskId == null) {
- completeTaskId = task.getString("workEffortId");
+ if (!issueTaskId) {
+ completeTaskId = task.workEffortId;
}
}
// the first CREATED and SCHEDULED task will be the startTaskId. As the issue and complete tasks are filled out this condition will no longer be true
- if (startTaskId == null &&
- issueTaskId == null &&
- completeTaskId == null &&
- ("PRUN_CREATED".equals(task.getString("currentStatusId")) ||
- "PRUN_SCHEDULED".equals(task.getString("currentStatusId")))) {
- startTaskId = task.getString("workEffortId");
+ if (!startTaskId &&
+ !issueTaskId &&
+ !completeTaskId &&
+ ("PRUN_CREATED".equals(task.currentStatusId) ||
+ "PRUN_SCHEDULED".equals(task.currentStatusId))) {
+ startTaskId = task.workEffortId;
}
}
- context.put("productionRunRoutingTasks", productionRunRoutingTasks);
- context.put("startTaskId", (startTaskId != null? startTaskId: "null"));
- context.put("issueTaskId", (issueTaskId != null? issueTaskId: "null"));
- context.put("completeTaskId", (completeTaskId != null? completeTaskId: "null"));
+ context.productionRunRoutingTasks = productionRunRoutingTasks;
+ context.startTaskId = (startTaskId ? startTaskId: "null");
+ context.issueTaskId = (issueTaskId? issueTaskId: "null");
+ context.completeTaskId = (completeTaskId != null? completeTaskId: "null");
// Product components list
- List productionRunComponents = productionRun.getProductionRunComponents();
- List productionRunComponentsData = FastList.newInstance();
- List productionRunComponentsDataReadyForIssuance = FastList.newInstance();
- List productionRunComponentsAlreadyIssued = FastList.newInstance();
- if (productionRunComponents != null){
- GenericValue component;
- for (Iterator iter=productionRunComponents.iterator(); iter.hasNext();){
- component = (GenericValue) iter.next();
- GenericValue product = component.getRelatedOne("Product");
- String componentName = product.getString("internalName");
- GenericValue productionRunTask = component.getRelatedOne("WorkEffort");
- String workEffortName = productionRunTask.getString("workEffortName");
+ productionRunComponents = productionRun.getProductionRunComponents();
+ productionRunComponentsData = FastList.newInstance();
+ productionRunComponentsDataReadyForIssuance = FastList.newInstance();
+ productionRunComponentsAlreadyIssued = FastList.newInstance();
+ if (productionRunComponents){
+ productionRunComponents.each { component ->
+ product = component.getRelatedOne("Product");
+ componentName = product.getString("internalName");
+ productionRunTask = component.getRelatedOne("WorkEffort");
+ workEffortName = productionRunTask.getString("workEffortName");
Map componentData = component.getAllFields();
- componentData.put("internalName", componentName);
- componentData.put("workEffortName", workEffortName);
- componentData.put("facilityId", productionRunTask.getString("facilityId"));
- Iterator issuances = (delegator.findByAnd("WorkEffortAndInventoryAssign", UtilMisc.toMap("workEffortId", component.getString("workEffortId"), "productId", product.getString("productId")))).iterator();
+ componentData.internalName = componentName;
+ componentData.workEffortName = workEffortName;
+ componentData.facilityId = productionRunTask.facilityId;
+ issuances = delegator.findByAnd("WorkEffortAndInventoryAssign", [workEffortId : component.workEffortId, productId : product.productId]);
double totalIssued = 0.0;
- while (issuances.hasNext()) {
- GenericValue issuance = (GenericValue)issuances.next();
+ issuances.each { issuance ->
Double issued = issuance.getDouble("quantity");
- if (issued != null) {
+ if (issued) {
totalIssued += issued.doubleValue();
}
}
- Iterator returns = (delegator.findByAnd("WorkEffortAndInventoryProduced", UtilMisc.toMap("workEffortId", component.getString("workEffortId"), "productId", product.getString("productId")))).iterator();
+ returns = delegator.findByAnd("WorkEffortAndInventoryProduced", [workEffortId : component.workEffortId , productId : product.productId]);
double totalReturned = 0.0;
- while (returns.hasNext()) {
- GenericValue returned = (GenericValue)returns.next();
- GenericValue returnDetail = EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", UtilMisc.toMap("inventoryItemId", returned.getString("inventoryItemId")), UtilMisc.toList("inventoryItemDetailSeqId")));
- if (returnDetail != null) {
+ returns.each { returned ->
+ returnDetail = EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", [inventoryItemId : returned.inventoryItemId], ["inventoryItemDetailSeqId"]));
+ if (returnDetail) {
Double qtyReturned = returnDetail.getDouble("quantityOnHandDiff");
- if (qtyReturned != null) {
+ if (qtyReturned) {
totalReturned += qtyReturned.doubleValue();
}
}
}
- componentData.put("issuedQuantity", totalIssued);
- componentData.put("returnedQuantity", totalReturned);
- componentData.put("currentStatusId", productionRunTask.getString("currentStatusId"));
- if (productionRunTask.getString("currentStatusId").equals("PRUN_RUNNING")) {
- componentData.put("isRunning", "Y");
+ componentData.issuedQuantity = totalIssued;
+ componentData.returnedQuantity = totalReturned;
+ componentData.currentStatusId = productionRunTask.currentStatusId;
+ if ("PRUN_RUNNING".equals(productionRunTask.currentStatusId)) {
+ componentData.isRunning = "Y";
} else {
- componentData.put("isRunning", "null");
+ componentData.isRunning = "null";
}
productionRunComponentsData.add(componentData);
- if (productionRunTask.getString("currentStatusId").equals("PRUN_RUNNING") && "WEGS_CREATED".equals(component.getString("statusId"))) {
+ if ("PRUN_RUNNING".equals(productionRunTask.currentStatusId) && "WEGS_CREATED".equals(component.getString("statusId"))) {
productionRunComponentsDataReadyForIssuance.add(componentData);
} else if (totalIssued > 0.0) {
productionRunComponentsAlreadyIssued.add(componentData);
}
}
}
- context.put("productionRunComponentsData", productionRunComponentsData);
- context.put("productionRunComponentsDataReadyForIssuance", productionRunComponentsDataReadyForIssuance);
- context.put("productionRunComponentsAlreadyIssued", productionRunComponentsAlreadyIssued);
+ context.productionRunComponentsData = productionRunComponentsData;
+ context.productionRunComponentsDataReadyForIssuance = productionRunComponentsDataReadyForIssuance;
+ context.productionRunComponentsAlreadyIssued = productionRunComponentsAlreadyIssued;
}
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy Thu Jun 5 04:48:15 2008
@@ -1,46 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.widget.html.HtmlFormWrapper;
-
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-
-List taskInfos = new ArrayList();
-List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("workEffortId"));
-Iterator tasksIt = tasks.iterator();
-while (tasksIt.hasNext()) {
- GenericValue task = (GenericValue)tasksIt.next();
- List records = task.getRelated("WorkEffortFixedAssetAssign");
- HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskFixedAssets", request, response);
- taskForm.putInContext("records", records);
- taskInfos.add(UtilMisc.toMap("task", task, "taskForm", taskForm));
-}
-context.put("taskInfos", taskInfos);
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.widget.html.HtmlFormWrapper;
+
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+
+taskInfos = [];
+tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"]);
+tasks.each { task ->
+ records = task.getRelated("WorkEffortFixedAssetAssign");
+ HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskFixedAssets", request, response);
+ taskForm.putInContext("records", records);
+ taskInfos.add([task : task, taskForm : taskForm]);
+}
+context.taskInfos = taskInfos;
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunTasks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunTasks.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunTasks.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunTasks.groovy Thu Jun 5 04:48:15 2008
@@ -17,29 +17,14 @@
* under the License.
*/
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.widget.html.HtmlFormWrapper;
import org.ofbiz.manufacturing.jobshopmgt.ProductionRun;
-
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-
-
-if (!UtilValidate.isEmpty(productionRunId)) {
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+if (productionRunId) {
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
- List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- context.put("productionRunRoutingTasks", productionRunRoutingTasks);
- context.put("quantity", productionRun.getQuantity()); // this is useful to compute the total estimates runtime in the form
+ productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
+ context.productionRunRoutingTasks = productionRunRoutingTasks;
+ context.quantity = productionRun.getQuantity(); // this is useful to compute the total estimates runtime in the form
}
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy Thu Jun 5 04:48:15 2008
@@ -20,61 +20,47 @@
// The only required parameter is "productionRunId".
// The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml").
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.*;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.widget.html.HtmlFormWrapper;
import org.ofbiz.manufacturing.jobshopmgt.ProductionRun;
-delegator = request.getAttribute("delegator");
-
-productionRunId = parameters.get("productionRunId");
-if (!UtilValidate.isEmpty(productionRunId)) {
+productionRunId = parameters.productionRunId;
+if (productionRunId) {
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
- productionRunId = productionRun.getGenericValue().getString("workEffortId");
- context.put("productionRunId", productionRunId);
- context.put("productionRun", productionRun.getGenericValue());
+ productionRunId = productionRun.getGenericValue().workEffortId;
+ context.productionRunId = productionRunId;
+ context.productionRun = productionRun.getGenericValue();
// Prepare production run header data
- HashMap productionRunData = new HashMap();
- productionRunData.put("productionRunId", productionRunId);
- productionRunData.put("productId", productionRun.getProductProduced().getString("productId"));
- productionRunData.put("currentStatusId", productionRun.getGenericValue().getString("currentStatusId"));
- productionRunData.put("facilityId", productionRun.getGenericValue().getString("facilityId"));
- productionRunData.put("workEffortName", productionRun.getProductionRunName());
- productionRunData.put("description", productionRun.getDescription());
- productionRunData.put("quantity", productionRun.getQuantity());
- productionRunData.put("estimatedStartDate",productionRun.getEstimatedStartDate());
- productionRunData.put("estimatedCompletionDate",productionRun.getEstimatedCompletionDate());
- context.put("productionRunData", productionRunData);
+ productionRunData = [:];
+ productionRunData.productionRunId = productionRunId;
+ productionRunData.productId = productionRun.getProductProduced().productId;
+ productionRunData.currentStatusId = productionRun.getGenericValue().currentStatusId;
+ productionRunData.facilityId = productionRun.getGenericValue().facilityId;
+ productionRunData.workEffortName = productionRun.getProductionRunName();
+ productionRunData.description = productionRun.getDescription();
+ productionRunData.quantity = productionRun.getQuantity();
+ productionRunData.estimatedStartDate = productionRun.getEstimatedStartDate();
+ productionRunData.estimatedCompletionDate = productionRun.getEstimatedCompletionDate();
+ context.productionRunData = productionRunData;
// Find all the order items to which this production run is linked.
- List orderItems = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId));
- if (orderItems.size() > 0) {
- context.put("orderItems", orderItems);
+ orderItems = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId , productionRunId]);
+ if (orderItems) {
+ context.orderItems = orderItems;
}
-
// Find all the work efforts that must be completed before this one.
- List mandatoryWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
- if (mandatoryWorkEfforts.size() > 0) {
- context.put("mandatoryWorkEfforts", mandatoryWorkEfforts);
+ mandatoryWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdTo : productionRunId, workEffortAssocTypeId : "WORK_EFF_PRECEDENCY"]));
+ if (mandatoryWorkEfforts) {
+ context.mandatoryWorkEfforts = mandatoryWorkEfforts;
}
// Find all the work efforts that can start after this one.
- List dependentWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
- if (dependentWorkEfforts.size() > 0) {
- context.put("dependentWorkEfforts", dependentWorkEfforts);
+ dependentWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdFrom : productionRunId, workEffortAssocTypeId : "WORK_EFF_PRECEDENCY"]));
+ if (dependentWorkEfforts) {
+ context.dependentWorkEfforts = dependentWorkEfforts;
}
-
// RoutingTasks list
- List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- context.put("productionRunRoutingTasks", productionRunRoutingTasks);
- context.put("quantity", productionRun.getQuantity()); // this is useful to compute the total estimates runtime in the form
-
+ context.productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
+ context.quantity = productionRun.getQuantity(); // this is useful to compute the total estimates runtime in the form
// Product component/parts list
- List productionRunComponentsData = productionRun.getProductionRunComponents();
- context.put("productionRunComponents", productionRunComponentsData);
+ context.productionRunComponents = productionRun.getProductionRunComponents();;
}
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy Thu Jun 5 04:48:15 2008
@@ -17,86 +17,71 @@
* under the License.
*/
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.widget.html.*;
-
-delegator = request.getAttribute("delegator");
-
-shipmentId = request.getParameter("shipmentId");
-if (UtilValidate.isEmpty(shipmentId)) {
- shipmentId = context.get("shipmentId");
-}
-action = request.getParameter("action");
+import org.ofbiz.widget.html.HtmlFormWrapper;
+
+shipmentId = parameters.shipmentId ?: context.get("shipmentId");
+
+action = parameters.action;
shipment = null;
-if (UtilValidate.isNotEmpty(shipmentId)) {
- shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+if (shipmentId) {
+ shipment = delegator.findByPrimaryKey("Shipment", [shipmentId : shipmentId]);
}
-
// **************************************
// ShipmentPlan list form
// **************************************
-shipmentPlans = null;
-shipmentPlansIt = null;
-rows = new ArrayList();
-if (shipment != null) {
- shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipment.getString("shipmentId")));
+shipmentPlans = [];
+rows = [];
+if (shipment) {
+ shipmentPlans = delegator.findByAnd("OrderShipment", [shipmentId : shipment.shipmentId]);
}
-if (shipmentPlans != null) {
+if (shipmentPlans) {
boolean workInProgress = false;
- shipmentPlansIt = shipmentPlans.iterator();
- while (shipmentPlansIt.hasNext()) {
- shipmentPlan = shipmentPlansIt.next();
+ shipmentPlans.each { shipmentPlan ->
oneRow = new HashMap(shipmentPlan);
// oneRow.putAll(shipmentPlan.getRelatedOne("OrderItemInventoryRes"));
orderItem = shipmentPlan.getRelatedOne("OrderItem");
- oneRow.put("productId", orderItem.getString("productId"));
+ oneRow.productId = orderItem.productId;
orderedQuantity = orderItem.getDouble("quantity");
canceledQuantity = orderItem.getDouble("cancelQuantity");
- if (canceledQuantity != null) {
+ if (canceledQuantity) {
orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
}
- oneRow.put("totOrderedQuantity", orderedQuantity.intValue());
+ oneRow.totOrderedQuantity = orderedQuantity.intValue();
// Total quantity issued
issuedQuantity = 0.0;
- qtyIssuedInShipment = new HashMap();
+ qtyIssuedInShipment = [:];
issuances = orderItem.getRelated("ItemIssuance");
- issuancesIt = issuances.iterator();
- while (issuancesIt.hasNext()) {
- issuance = issuancesIt.next();
- if (issuance.get("quantity") != null) {
+ issuances.each { issuance ->
+ if (issuance.quantity) {
issuedQuantity += issuance.getDouble("quantity");
- if (issuance.get("cancelQuantity") != null) {
+ if (issuance.cancelQuantity) {
issuedQuantity -= issuance.getDouble("cancelQuantity");
}
- if (qtyIssuedInShipment.containsKey(issuance.getString("shipmentId"))) {
- qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.getString("shipmentId"))).doubleValue();
+ if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
+ qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue();
qtyInShipment += issuance.getDouble("quantity");
- qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
+ qtyIssuedInShipment.issuance.shipmentId = qtyInShipment;
} else {
qtyInShipment = issuance.getDouble("quantity");
- if (issuance.get("cancelQuantity") != null) {
+ if (issuance.cancelQuantity) {
qtyInShipment -= issuance.getDouble("cancelQuantity");
}
- qtyIssuedInShipment.put(issuance.getString("shipmentId"), qtyInShipment);
+ qtyIssuedInShipment.issuance.shipmentId = qtyInShipment;
}
}
}
- oneRow.put("totIssuedQuantity", issuedQuantity);
+ oneRow.totIssuedQuantity = issuedQuantity;
// Total quantity planned not issued
plannedQuantity = 0.0;
- qtyPlannedInShipment = new HashMap();
- plans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")));
- plansIt = plans.iterator();
- while (plansIt.hasNext()) {
- plan = plansIt.next();
- if (plan.get("quantity") != null) {
+ qtyPlannedInShipment = [:];
+ plans = delegator.findByAnd("OrderShipment", [orderId : orderItem.orderId ,orderItemSeqId : orderItem.orderItemSeqId]);
+ plans.each { plan ->
+ if (plan.quantity) {
netPlanQty = plan.getDouble("quantity");
- if (qtyIssuedInShipment.containsKey(plan.getString("shipmentId"))) {
- qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.getString("shipmentId"))).doubleValue();
+ if (qtyIssuedInShipment.containsKey(plan.shipmentId)) {
+ qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.shipmentId)).doubleValue();
if (netPlanQty > qtyInShipment) {
netPlanQty -= qtyInShipment;
} else {
@@ -104,106 +89,99 @@
}
}
plannedQuantity += netPlanQty;
- if (qtyPlannedInShipment.containsKey(plan.getString("shipmentId"))) {
- qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.getString("shipmentId"))).doubleValue();
+ if (qtyPlannedInShipment.containsKey(plan.shipmentId)) {
+ qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.shipmentId)).doubleValue();
qtyInShipment += netPlanQty;
- qtyPlannedInShipment.put(plan.getString("shipmentId"), qtyInShipment);
+ qtyPlannedInShipment.plan.shipmentId = qtyInShipment;
} else {
- qtyPlannedInShipment.put(plan.getString("shipmentId"), netPlanQty);
+ qtyPlannedInShipment.plan.shipmentId = netPlanQty;
}
}
}
- oneRow.put("totPlannedQuantity", plannedQuantity);
+ oneRow.totPlannedQuantity = plannedQuantity;
if (qtyIssuedInShipment.containsKey(shipmentId)) {
- oneRow.put("issuedQuantity", qtyIssuedInShipment.get(shipmentId));
+ oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentId);
} else {
- oneRow.put("issuedQuantity", "");
+ oneRow.issuedQuantity = "";
}
// Reserved and Not Available quantity
reservedQuantity = 0.0;
reservedNotAvailable = 0.0;
reservations = orderItem.getRelated("OrderItemShipGrpInvRes");
- reservationsIt = reservations.iterator();
- while (reservationsIt.hasNext()) {
- reservation = reservationsIt.next();
- if (reservation.get("quantity") != null) {
+ reservations.each { reservation ->
+ if (reservation.quantity) {
reservedQuantity += reservation.getDouble("quantity");
}
- if (reservation.get("quantityNotAvailable") != null) {
+ if (reservation.quantityNotAvailable) {
reservedNotAvailable += reservation.getDouble("quantityNotAvailable");
}
}
- oneRow.put("notAvailableQuantity", reservedNotAvailable);
+ oneRow.notAvailableQuantity = reservedNotAvailable;
// Planned Weight and Volume
product = orderItem.getRelatedOne("Product");
weight = 0.0;
quantity = 0.0;
- if (shipmentPlan.getDouble("quantity") != null) {
+ if (shipmentPlan.getDouble("quantity")) {
quantity = shipmentPlan.getDouble("quantity");
}
- if (product.getDouble("weight") != null) {
+ if (product.getDouble("weight")) {
weight = product.getDouble("weight") * quantity;
}
- oneRow.put("weight", weight);
- if (product.get("weightUomId") != null) {
- weightUom = delegator.findByPrimaryKeyCache("Uom", UtilMisc.toMap("uomId", product.getString("weightUomId")));
- oneRow.put("weightUom", weightUom.getString("abbreviation"));
+ oneRow.weight = weight;
+ if (product.weightUomId) {
+ weightUom = delegator.findByPrimaryKeyCache("Uom", [uomId : product.weightUomId]);
+ oneRow.weightUom = weightUom.abbreviation;
}
volume = 0.0;
- if (product.getDouble("productHeight") != null &&
- product.getDouble("productWidth") != null &&
- product.getDouble("productDepth") != null) {
+ if (product.getDouble("productHeight") &&
+ product.getDouble("productWidth") &&
+ product.getDouble("productDepth")) {
// TODO: check if uom conversion is needed
volume = product.getDouble("productHeight") *
product.getDouble("productWidth") *
product.getDouble("productDepth") *
quantity;
}
- oneRow.put("volume", volume);
- if (product.get("heightUomId") != null &&
- product.get("widthUomId") != null &&
- product.get("depthUomId") != null) {
-
- heightUom = delegator.findByPrimaryKeyCache("Uom", UtilMisc.toMap("uomId", product.getString("heightUomId")));
- widthUom = delegator.findByPrimaryKeyCache("Uom", UtilMisc.toMap("uomId", product.getString("widthUomId")));
- depthUom = delegator.findByPrimaryKeyCache("Uom", UtilMisc.toMap("uomId", product.getString("depthUomId")));
- oneRow.put("volumeUom", heightUom.getString("abbreviation") + "x" +
- widthUom.getString("abbreviation") + "x" +
- depthUom.getString("abbreviation"));
+ oneRow.volume = volume;
+ if (product.get("heightUomId") &&
+ product.get("widthUomId") &&
+ product.get("depthUomId")) {
+
+ heightUom = delegator.findByPrimaryKeyCache("Uom", [uomId : product.heightUomId]);
+ widthUom = delegator.findByPrimaryKeyCache("Uom", [uomId : product.widthUomId]);
+ depthUom = delegator.findByPrimaryKeyCache("Uom", [uomId : product.depthUomId]);
+ oneRow.volumeUom = heightUom.abbreviation + "x" +
+ widthUom.abbreviation + "x" +
+ depthUom.abbreviation;
}
// Select the production runs, if available
- 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) {
+ productionRuns = delegator.findByAnd("WorkOrderItemFulfillment", [orderId : shipmentPlan.orderId , orderItemSeqId : shipmentPlan.orderItemSeqId],["workEffortId"]); // TODO: add shipmentId
+ if (productionRuns) {
workInProgress = true;
- productionRunsIt = productionRuns.iterator();
- productionRunsId = "";
- while (productionRunsIt.hasNext()) {
- productionRun = productionRunsIt.next();
- productionRunsId = productionRun.getString("workEffortId") + " " + productionRunsId;
+ productionRuns.each { productionRun ->
+ productionRunsId = productionRun.workEffortId + " " + productionRunsId;
}
- oneRow.put("productionRuns", productionRunsId);
+ oneRow.productionRuns = productionRunsId;
}
rows.add(oneRow);
}
- context.put("workInProgress", workInProgress);
+ context.workInProgress = workInProgress;
HtmlFormWrapper listShipmentPlanForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "listShipmentPlan", request, response);
listShipmentPlanForm.putInContext("shipmentPlan", rows);
- context.put("listShipmentPlanForm", listShipmentPlanForm); // Form for ShipmentPlan list
+ context.listShipmentPlanForm = listShipmentPlanForm; // Form for ShipmentPlan list
} else {
- List shipments = new ArrayList();
- List scheduledShipments = delegator.findByAndCache("Shipment", UtilMisc.toMap("shipmentTypeId", "SALES_SHIPMENT", "statusId", "SHIPMENT_SCHEDULED"));
- Iterator scheduledShipmentsIt = scheduledShipments.iterator();
- while (scheduledShipmentsIt.hasNext()) {
- // TODO: put in the list only the shipments with a shipment plan
- shipments.add(scheduledShipmentsIt.next());
+ shipments = [];
+ scheduledShipments = delegator.findByAndCache("Shipment", [shipmentTypeId : "SALES_SHIPMENT", statusId : "SHIPMENT_SCHEDULED"]);
+ scheduledShipments.each { scheduledShipment ->
+ shipments.add(scheduledShipment);
}
//List confirmedShipments = delegator.findByAndCache("Shipment", UtilMisc.toMap("shipmentTypeId", "SALES_SHIPMENT", "statusId", "SCHEDULED_CONFIRMED"));
HtmlFormWrapper listShipmentPlansForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "listShipmentPlans", request, response);
listShipmentPlansForm.putInContext("shipmentPlans", shipments);
- context.put("listShipmentPlansForm", listShipmentPlansForm);
+ context.listShipmentPlansForm = listShipmentPlansForm;
}
-context.put("shipmentId", shipmentId);
-context.put("shipment", shipment);
+context.shipmentId = shipmentId;
+context.shipment = shipment;
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/productionRunAllFixedAssets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/productionRunAllFixedAssets.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/productionRunAllFixedAssets.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/productionRunAllFixedAssets.groovy Thu Jun 5 04:48:15 2008
@@ -17,25 +17,20 @@
* under the License.
*/
-import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.manufacturing.jobshopmgt.ProductionRun;
import javolution.util.FastList;
-productionRunId = request.getParameter("productionRunId");
-if (UtilValidate.isEmpty(productionRunId)) {
- productionRunId = request.getParameter("workEffortId");
-}
-if (!UtilValidate.isEmpty(productionRunId)) {
+productionRunId = parameters.productionRunId ?: parameters.workEffortId;
+if (productionRunId) {
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
- List productionRunFixedAssetsData = FastList.newInstance();
- List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
- for (Iterator tasksIt = productionRunRoutingTasks.iterator(); tasksIt.hasNext();) {
- GenericValue prodRunTask = (GenericValue)tasksIt.next();
- List taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign");
+ productionRunFixedAssetsData = FastList.newInstance();
+ productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks();
+ productionRunRoutingTasks.each { prodRunTask ->
+ taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign");
productionRunFixedAssetsData.addAll(taskFixedAssets);
}
- context.put("productionRunFixedAssetsData", productionRunFixedAssetsData);
+ context.productionRunFixedAssetsData = productionRunFixedAssetsData;
}
}
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.groovy Thu Jun 5 04:48:15 2008
@@ -17,51 +17,37 @@
* under the License.
*/
-import java.util.*;
-import java.sql.Timestamp;
-import org.ofbiz.base.util.*;
-import org.ofbiz.service.*;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.widget.html.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.manufacturing.mrp.MrpServices;
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.condition.EntityCondition;
-GenericDelegator delegator = request.getAttribute("delegator");
-LocalDispatcher dispatcher = request.getAttribute("dispatcher");
-
-productId = request.getParameter("productId");
+productId = parameters.productId;
// get the lookup flag
-lookupFlag = request.getParameter("lookupFlag");
+lookupFlag = parameters.lookupFlag;
// blank param list
paramList = "";
-inventoryList = null;
+inventoryList = [];
-if (lookupFlag != null) {
+if (lookupFlag) {
paramList = paramList + "&lookupFlag=" + lookupFlag;
- lookupErrorMessage = null;
- andExprs = new ArrayList();
+ andExprs = [];
//define main condition
mainCond = null;
// now do the filtering
- eventDate = request.getParameter("eventDate");
- if (eventDate != null && eventDate.length() > 8) {
+ eventDate = parameters.eventDate;
+ if (eventDate?.length() > 8) {
eventDate = eventDate.trim();
if (eventDate.length() < 14) eventDate = eventDate + " " + "00:00:00.000";
paramList = paramList + "&eventDate=" + eventDate;
andExprs.add(EntityCondition.makeCondition("eventDate", EntityOperator.GREATER_THAN, eventDate));
}
- if (productId != null && productId.length() > 0) {
- paramList = paramList + "&productId=" + productId;
- if ( productId.length() > 0)
+ if (productId) {
+ paramList = paramList + "&productId=" + productId;
andExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId));
}
andExprs.add(EntityCondition.makeCondition("mrpEventTypeId", EntityOperator.NOT_EQUAL, "INITIAL_QOH"));
@@ -70,26 +56,26 @@
mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
- if ( mainCond != null) {
+ if ( mainCond) {
// do the lookup
- inventoryList = delegator.findList("MrpEvent", mainCond, null, UtilMisc.toList("productId", "eventDate"), null, false);
+ inventoryList = delegator.findList("MrpEvent", mainCond, null, ["productId", "eventDate"], null, false);
}
- context.put("inventoryList", inventoryList);
+ context.inventoryList = inventoryList;
}
-context.put("paramList", paramList);
+context.paramList = paramList;
// set the page parameters
viewIndex = 0;
try {
- viewIndex = Integer.valueOf((String) request.getParameter("VIEW_INDEX")).intValue();
+ viewIndex = Integer.valueOf((String) parameters.VIEW_INDEX).intValue();
} catch (Exception e) {}
viewSize = 100;
try {
- viewSize = Integer.valueOf((String) request.getParameter("VIEW_SIZE")).intValue();
+ viewSize = Integer.valueOf((String) parameters.VIEW_SIZE).intValue();
} catch (Exception e) {}
listSize = 0;
-if (inventoryList != null)
+if (inventoryList)
listSize = inventoryList.size();
lowIndex = viewIndex * viewSize;
@@ -98,9 +84,9 @@
highIndex = listSize;
if( highIndex < 1 )
highIndex = 0;
-context.put("viewIndex", viewIndex);
-context.put("listSize", listSize);
-context.put("highIndex", highIndex);
-context.put("lowIndex", lowIndex);
-context.put("viewSize", viewSize);
+context.viewIndex = viewIndex;
+context.listSize = listSize;
+context.highIndex = highIndex;
+context.lowIndex = lowIndex;
+context.viewSize = viewSize;
Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy?rev=663544&r1=663543&r2=663544&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/routing/EditCalendar.groovy Thu Jun 5 04:48:15 2008
@@ -17,32 +17,24 @@
* under the License.
*/
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.UtilHttp;
requestParams = UtilHttp.getParameterMap(request);
-delegator = request.getAttribute("delegator");
-calendarId = requestParams.get("calendarId");
-if (calendarId == null) {
- calendarId = request.getAttribute("calendarId");
-}
+calendarId = requestParams.get("calendarId") ?: request.getAttribute("calendarId");
if (calendarId != null) {
- techDataCalendar = delegator.findByPrimaryKey("TechDataCalendar", UtilMisc.toMap("calendarId", calendarId));
- context.put("techDataCalendar", techDataCalendar);
+ techDataCalendar = delegator.findByPrimaryKey("TechDataCalendar", [calendarId : calendarId]);
+ context.techDataCalendar = techDataCalendar;
}
tryEntity = true;
errorMessage = request.getAttribute("_ERROR_MESSAGE_");
-if (errorMessage != null && errorMessage.length() > 0) {
+if (errorMessage) {
tryEntity = false;
}
-calendarData = context.get("techDataCalendar");
-if (!tryEntity) calendarData = requestParams;
-if (calendarData == null) calendarData = new HashMap();
-context.put("calendarData", calendarData);
-
-List allCalendarWeek = delegator.findList("TechDataCalendarWeek", null, null, null, null, false);
-context.put("calendarWeeks", allCalendarWeek);
+calendarData = context.techDataCalendar;
+if (!tryEntity) calendarData = requestParams ?: [:];
+context.calendarData = calendarData;
+allCalendarWeek = delegator.findList("TechDataCalendarWeek", null, null, null, null, false);
+context.calendarWeeks = allCalendarWeek;
\ No newline at end of file