📄 productionrundeclaration.bsh
字号:
context.put("editPrRoutingTaskWrapper",editPrRoutingTaskWrapper); context.put("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) { templateTask = templateTaskAssoc.getRelatedOne("FromWorkEffort"); } List delivProducts = null; if (templateTask != null) { delivProducts = EntityUtil.filterByDate(templateTask.getRelatedByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_DELIV"))); } HtmlFormWrapper createRoutingTaskDelivProductForm = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "CreateRoutingTaskDelivProduct", request, response); createRoutingTaskDelivProductForm.putInContext("formData", UtilMisc.toMap("productionRunId", productionRunId, "workEffortId", routingTaskId)); context.put("createRoutingTaskDelivProductForm", createRoutingTaskDelivProductForm); context.put("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); HtmlFormWrapper prunInventoryProducedForm = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskInventoryProducedList", request, response); prunInventoryProducedForm.putInContext("prunInventoryProduced", prunInventoryProduced); context.put("prunInventoryProducedForm", prunInventoryProducedForm); } // RoutingTasks list List productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks(); Iterator tasksIt = productionRunRoutingTasks.iterator(); String startTaskId = null; String issueTaskId = null; String completeTaskId = null; while (tasksIt.hasNext()) { GenericValue task = (GenericValue)tasksIt.next(); if (task.getString("currentStatusId").equals("PRUN_RUNNING")) { List components = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", task.getString("workEffortId"), "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED")); List issuances = delegator.findByAnd("WorkEffortInventoryAssign", UtilMisc.toMap("workEffortId", task.getString("workEffortId"))); if (components.size() > 0 && issuances.size() == 0) { issueTaskId = task.getString("workEffortId"); } if (issueTaskId == null) { completeTaskId = task.getString("workEffortId"); } } if (startTaskId == null && issueTaskId == null && completeTaskId == null && task.getString("currentStatusId").equals("PRUN_CREATED")) { startTaskId = task.getString("workEffortId"); } } HtmlFormWrapper ListProductionRunRoutingTasksWrapper = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "ListProductionRunDeclRoutingTasks", request, response); ListProductionRunRoutingTasksWrapper.putInContext("productionRunRoutingTasks", productionRunRoutingTasks); ListProductionRunRoutingTasksWrapper.putInContext("startTaskId", (startTaskId != null? startTaskId: "null")); ListProductionRunRoutingTasksWrapper.putInContext("issueTaskId", (issueTaskId != null? issueTaskId: "null")); ListProductionRunRoutingTasksWrapper.putInContext("completeTaskId", (completeTaskId != null? completeTaskId: "null")); context.put("ListProductionRunRoutingTasksWrapper",ListProductionRunRoutingTasksWrapper); context.put("productionRunRoutingTasks", productionRunRoutingTasks); //--------------- // Components //--------------- // Product component update sub-screen productId = request.getParameter("productId"); if (productId != null && (actionForm.equals("updateProductComponent") || actionForm.equals("EditProductComponent"))){ workEffortId = request.getParameter("workEffortId"); List productComponents = delegator.findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("workEffortId", workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "productId",productId)); GenericValue productComponent = EntityUtil.getFirst(productComponents); Map productComponentData = productComponent.getAllFields(); productComponentData.put("productionRunId", productionRunId); internalName = productComponent.getRelatedOne("Product").getString("internalName"); productComponentData.put("internalName",internalName); HtmlFormWrapper editPrProductComponentWrapper = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "EditProductionRunComponent", request, response); editPrProductComponentWrapper.putInContext("productComponentData", productComponentData); editPrProductComponentWrapper.putInContext("actionForm", "updateProductComponent"); editPrProductComponentWrapper.putInContext("uiLabelButton",request.getAttribute("uiLabelMap").get("CommonUpdate")); context.put("editPrProductComponentWrapper",editPrProductComponentWrapper); context.put("productId",productId); } // Product components list List productionRunComponents = productionRun.getProductionRunComponents(); List productionRunComponentsData = new LinkedList(); 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"); Map componentData = component.getAllFields(); componentData.put("internalName", componentName); componentData.put("workEffortName", workEffortName); Iterator issuances = (delegator.findByAnd("WorkEffortAndInventoryAssign", UtilMisc.toMap("workEffortId", component.getString("workEffortId"), "productId", product.getString("productId")))).iterator(); double totalIssued = 0.0; while (issuances.hasNext()) { GenericValue issuance = (GenericValue)issuances.next(); Double issued = issuance.getDouble("quantity"); if (issued != null) { totalIssued += issued.doubleValue(); } } Iterator returns = (delegator.findByAnd("WorkEffortAndInventoryProduced", UtilMisc.toMap("workEffortId", component.getString("workEffortId"), "productId", product.getString("productId")))).iterator(); 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) { Double qtyReturned = returnDetail.getDouble("quantityOnHandDiff"); if (qtyReturned != null) { 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"); } else { componentData.put("isRunning", "null"); } productionRunComponentsData.add(componentData); } } HtmlFormWrapper ListProductionRunComponentsWrapper = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "ListProductionRunDeclComponents", request, response); ListProductionRunComponentsWrapper.putInContext("productionRunId", productionRunId); ListProductionRunComponentsWrapper.putInContext("productionRunComponentsData", productionRunComponentsData); context.put("ListProductionRunComponentsWrapper",ListProductionRunComponentsWrapper); context.put("productionRunComponentsData", productionRunComponentsData); }}List msgResult = new LinkedList();msgResult = request.getParameter("msgResult");if (msgResult == null) msgResult = request.getAttribute("msgResult");context.put("msgResult", msgResult);tryEntity = true;errorMessage = request.getAttribute("_ERROR_MESSAGE_");if (errorMessage != null && errorMessage.length() > 0) { tryEntity = false; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -