⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productionrundeclaration.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
📖 第 1 页 / 共 2 页
字号:
/* *  Copyright (c) 2004 The Open For Business Project - www.ofbiz.org * *  Permission is hereby granted, free of charge, to any person obtaining a  *  copy of this software and associated documentation files (the "Software"),  *  to deal in the Software without restriction, including without limitation  *  the rights to use, copy, modify, merge, publish, distribute, sublicense,  *  and/or sell copies of the Software, and to permit persons to whom the  *  Software is furnished to do so, subject to the following conditions: * *  The above copyright notice and this permission notice shall be included  *  in all copies or substantial portions of the Software. * *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT  *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE. * *@author      Olivier.Heintz@nereide.biz *@version    $Rev: 7317 $ *@since      3.0 */// 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;userLogin = request.getAttribute("userLogin");HashMap productionRunData= new HashMap();productionRunId = request.getParameter("productionRunId");if (UtilValidate.isEmpty(productionRunId)) {    productionRunId = request.getParameter("workEffortId");}if (!UtilValidate.isEmpty(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());        // 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);        }        // 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);        }        // 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);        }        Double quantityToProduce = productionRun.getGenericValue().getDouble("quantityToProduce");        if (quantityToProduce == null) {            quantityToProduce = new Double(0);        }        // Find the inventory items produced        List inventoryItems = delegator.findByAnd("WorkEffortInventoryProduced", UtilMisc.toMap("workEffortId", productionRunId));        context.put("inventoryItems", inventoryItems);        // 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);        }        double maxQuantity = quantityDeclared.doubleValue() - quantityProduced.doubleValue();        // productionRun update sub-screen        HtmlFormWrapper updateProductionRunWrapper = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "ShowProductionRun", request, response);        updateProductionRunWrapper.putInContext("productionRunData", productionRunData);        updateProductionRunWrapper.putInContext("actionForm", "updateProductionRun");        updateProductionRunWrapper.setUseRequestParameters(false);        context.put("updateProductionRunWrapper",updateProductionRunWrapper);        context.put("productionRunData", productionRunData);        productionRunData.put("workEffortId",productionRunId);        productionRunData.put("productId", productionRun.getProductProduced().getString("productId"));        productionRunData.put("productName",productionRun.getProductProduced().getString("internalName"));        if (maxQuantity > 0 && !"WIP".equals(productionRun.getProductProduced().getString("productTypeId"))) {            productionRunData.put("quantity", new Double(maxQuantity));            updateProductionRunWrapper.putInContext("showQuantity", "Y");        } else {            productionRunData.put("quantity", "null");            updateProductionRunWrapper.putInContext("showQuantity", "null");        }        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"));        actionForm = request.getParameter("actionForm");        if (UtilValidate.isEmpty(actionForm)) {            actionForm = "beforeActionProductionRun";        }        context.put("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));            Map routingTaskData = routingTask.getAllFields();            routingTaskData.put("estimatedSetupMillis", routingTask.getDouble("estimatedSetupMillis"));            routingTaskData.put("estimatedMilliSeconds", routingTask.getDouble("estimatedMilliSeconds"));            HtmlFormWrapper editPrRoutingTaskWrapper = new HtmlFormWrapper("/jobshopmgt/ProductionRunForms.xml", "EditProductionRunDeclRoutingTask", request, response);            editPrRoutingTaskWrapper.putInContext("routingTaskData", routingTaskData);            editPrRoutingTaskWrapper.putInContext("actionForm", "UpdateRoutingTask");            routingTaskData.put("partyId", userLogin.getString("partyId"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -