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

📄 shipmentplanstockreportprepare.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
/* *  Copyright (c) 2003 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. */import org.ofbiz.entity.*;import org.ofbiz.base.util.*;import org.ofbiz.content.report.*;delegator = request.getAttribute("delegator");dispatcher = request.getAttribute("dispatcher");userLogin = request.getSession().getAttribute("userLogin");jrParameters = new HashMap();inventoryStock = new HashMap();shipmentId = request.getParameter("shipmentId");shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));jrParameters.put("shipmentIdPar", shipment.getString("shipmentId"));jrParameters.put("estimatedReadyDatePar", shipment.getString("estimatedReadyDate"));jrParameters.put("estimatedShipDatePar", shipment.getString("estimatedShipDate"));if (shipment != null) {	shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId));        shipmentPlansIt = shipmentPlans.iterator();        records = new ArrayList();                while(shipmentPlansIt.hasNext()) {            shipmentPlan = shipmentPlansIt.next();            orderLine = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId")));            //recordGroup = new HashMap(shipmentPlan);            recordGroup = new HashMap();            recordGroup.put("ORDER_ID", shipmentPlan.getString("orderId"));            recordGroup.put("ORDER_ITEM_SEQ_ID", shipmentPlan.getString("orderItemSeqId"));            recordGroup.put("SHIPMENT_ID", shipmentPlan.getString("shipmentId"));            recordGroup.put("SHIPMENT_ITEM_SEQ_ID", shipmentPlan.getString("shipmentItemSeqId"));            recordGroup.put("PRODUCT_ID", orderLine.getString("productId"));            recordGroup.put("QUANTITY", shipmentPlan.getDouble("quantity"));            product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", orderLine.getString("productId")));            recordGroup.put("PRODUCT_NAME", product.getString("internalName"));            Map context = UtilMisc.toMap("productId", orderLine.getString("productId"),                                         "quantity", shipmentPlan.getDouble("quantity"),                                         "fromDate", "" + new Date(),                                         "userLogin", userLogin);            Map result = null;            result = dispatcher.runSync("getNotAssembledComponents",context);            if (result != null)                components = (List)result.get("notAssembledComponents");            componentsIt = components.iterator();            while(componentsIt.hasNext()) {                oneComponent = (org.ofbiz.manufacturing.bom.BOMNode)componentsIt.next();                record = new HashMap(recordGroup);                record.put("componentId", oneComponent.getProduct().getString("productId"));                record.put("componentName", oneComponent.getProduct().getString("internalName"));                record.put("componentQuantity", new Float(oneComponent.getQuantity()));                facilityId = shipment.getString("originFacilityId");                float qty = 0;                if (facilityId != null) {                    if (!inventoryStock.containsKey(oneComponent.getProduct().getString("productId"))) {                        serviceInput = UtilMisc.toMap("productId",oneComponent.getProduct().getString("productId"), "facilityId", facilityId);                        serviceOutput = dispatcher.runSync("getInventoryAvailableByFacility",serviceInput);                        qha = serviceOutput.get("quantityOnHandTotal");                        if (qha == null) qha = new Double(0);                        inventoryStock.put(oneComponent.getProduct().getString("productId"), qha);                    }                    qty = ((Double)inventoryStock.get(oneComponent.getProduct().getString("productId"))).floatValue();                    qty = (float)(qty - oneComponent.getQuantity());                    inventoryStock.put(oneComponent.getProduct().getString("productId"), new Double(qty));                }                record.put("componentOnHand", new Float(qty));                // Now we get the product's qty already reserved by production runs                serviceInput = UtilMisc.toMap("productId", oneComponent.getProduct().getString("productId"));                serviceOutput = dispatcher.runSync("getProductionRunTotResQty", serviceInput);                resQty = serviceOutput.get("reservedQuantity");                record.put("reservedQuantity", new Double(resQty));                records.add(record);            }                   }	jrDataSource = new JRMapCollectionDataSource(records);	request.setAttribute("jrDataSource", jrDataSource);        request.setAttribute("jrParameters", jrParameters);}return "success";

⌨️ 快捷键说明

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