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

📄 editproductinventoryitems.bsh

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 BSH
字号:
/* *  Copyright (c) 2003-2005 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     David E. Jones *@author     Brad Steiner *@version    $Rev: 7057 $ *@since      2.2 */import java.util.*;import java.io.*;import org.ofbiz.entity.*;import org.ofbiz.entity.condition.*;import org.ofbiz.base.util.*;import org.ofbiz.widget.html.*;import org.ofbiz.securityext.login.*;quantitySummaryByFacility = new HashMap();manufacturingInQuantitySummaryByFacility = new HashMap();manufacturingOutQuantitySummaryByFacility = new HashMap();// The warehouse list is selectedshowAllFacilities = parameters.get("showAllFacilities");if (showAllFacilities != null && showAllFacilities.equals("Y")) {    facilityList = delegator.findAll("Facility");} else {    facilityList = delegator.findByAnd("ProductFacility", UtilMisc.toMap("productId", productId));}facilityIterator = facilityList.iterator();dispatcher = request.getAttribute("dispatcher");Map contextInput = null;Map resultOutput = null;// For every warehouse the product's atp and qoh // are obtained (calling the "getInventoryAvailableByFacility" service)while (facilityIterator.hasNext()) {    facility = facilityIterator.next();    contextInput = UtilMisc.toMap("productId",productId, "facilityId", facility.getString("facilityId"));    resultOutput = dispatcher.runSync("getInventoryAvailableByFacility",contextInput);    quantitySummary = new HashMap();    quantitySummary.put("facilityId", facility.getString("facilityId"));    quantitySummary.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal"));    quantitySummary.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal"));    quantitySummaryByFacility.put(facility.getString("facilityId"), quantitySummary);}productInventoryItems = delegator.findByAnd("InventoryItem",         UtilMisc.toMap("productId", productId),         UtilMisc.toList("facilityId", "-datetimeReceived", "-inventoryItemId"));// TODO: get all incoming shipments not yet arrived coming into each facility that this product is in, use a view entity with ShipmentAndItemfindIncomingShipmentsConds = new LinkedList();findIncomingShipmentsConds.add(new EntityExpr("productId", EntityOperator.EQUALS, productId));findIncomingShipmentsTypeConds = new LinkedList();findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "INCOMING_SHIPMENT"));findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "PURCHASE_SHIPMENT"));findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "SALES_RETURN"));findIncomingShipmentsConds.add(new EntityConditionList(findIncomingShipmentsTypeConds, EntityOperator.OR));findIncomingShipmentsStatusConds = new LinkedList();findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED"));findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED"));findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PURCH_SHIP_RECEIVED"));findIncomingShipmentsConds.add(new EntityConditionList(findIncomingShipmentsStatusConds, EntityOperator.AND));findIncomingShipmentsStatusCondition = new EntityConditionList(findIncomingShipmentsConds, EntityOperator.AND);incomingShipmentAndItems = delegator.findByCondition("ShipmentAndItem", findIncomingShipmentsStatusCondition, null, UtilMisc.toList("-estimatedArrivalDate"));incomingShipmentAndItemIter = incomingShipmentAndItems.iterator();while (incomingShipmentAndItemIter.hasNext()) {	incomingShipmentAndItem = incomingShipmentAndItemIter.next();	facilityId = incomingShipmentAndItem.getString("destinationFacilityId");	quantitySummary = quantitySummaryByFacility.get(facilityId);	if (quantitySummary == null) {		quantitySummary = new HashMap();		quantitySummary.put("facilityId", facilityId);		quantitySummaryByFacility.put(facilityId, quantitySummary);	}		incomingShipmentAndItemList = quantitySummary.get("incomingShipmentAndItemList");	if (incomingShipmentAndItemList == null) {		incomingShipmentAndItemList = new LinkedList();		quantitySummary.put("incomingShipmentAndItemList", incomingShipmentAndItemList);	}		incomingShipmentAndItemList.add(incomingShipmentAndItem);}// --------------------// Production RunscontextInput = UtilMisc.toMap("productId", productId, "userLogin", userLogin);resultOutput = dispatcher.runSync("getProductManufacturingSummaryByFacility", contextInput);// incoming productsmanufacturingInQuantitySummaryByFacility = resultOutput.get("summaryInByFacility");// outgoing products (materials)manufacturingOutQuantitySummaryByFacility = resultOutput.get("summaryOutByFacility");showEmpty = "true".equals(request.getParameter("showEmpty"));// Find oustanding purchase orders for this item.  The orders and the items cannot be completed, cancelled, or rejectedpurchaseOrderConditions = UtilMisc.toList(new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"),        new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),        new EntityExpr("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),        new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"),        new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"),        new EntityExpr("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"));purchaseOrderConditions.add(new EntityExpr("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER"));purchaseOrderConditions.add(new EntityExpr("productId", EntityOperator.EQUALS, productId));purchaseOrders = delegator.findByCondition("OrderHeaderAndItems", new EntityConditionList(purchaseOrderConditions, EntityOperator.AND),         null, UtilMisc.toList("estimatedDeliveryDate DESC", "orderDate"));context.put("productInventoryItems", productInventoryItems);context.put("quantitySummaryByFacility", quantitySummaryByFacility);context.put("manufacturingInQuantitySummaryByFacility", manufacturingInQuantitySummaryByFacility);context.put("manufacturingOutQuantitySummaryByFacility", manufacturingOutQuantitySummaryByFacility);context.put("showEmpty", showEmpty);context.put("purchaseOrders", purchaseOrders);

⌨️ 快捷键说明

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