📄 shipmentlabelprepare.bsh
字号:
/* * $Id: ShipmentLabelPrepare.bsh 5462 2005-08-05 18:35:48Z jonesde $ * * 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.entity.util.*;import org.ofbiz.base.util.*;import org.ofbiz.order.order.*;import org.ofbiz.content.report.*;delegator = request.getAttribute("delegator");dispatcher = request.getAttribute("dispatcher");userLogin = request.getSession().getAttribute("userLogin");jrParameters = new HashMap();shipmentId = request.getParameter("shipmentId");shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));jrParameters.put("shipmentIdPar", shipment.getString("shipmentId"));if (shipment != null) { shipmentPackages = delegator.findByAnd("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId)); shipmentPackagesIt = shipmentPackages.iterator(); records = new ArrayList(); orderReaders = new HashMap(); while(shipmentPackagesIt.hasNext()) { shipmentPackage = shipmentPackagesIt.next(); shipmentPackageComponents = delegator.findByAnd("ShipmentPackageContent", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackage.getString("shipmentPackageSeqId"))); shipmentPackageComponentsIt = shipmentPackageComponents.iterator(); while(shipmentPackageComponentsIt.hasNext()) { shipmentPackageComponent = shipmentPackageComponentsIt.next(); shipmentItem = shipmentPackageComponent.getRelatedOne("ShipmentItem"); orderShipments = shipmentItem.getRelated("OrderShipment"); orderShipment = EntityUtil.getFirst(orderShipments); String orderId = null; if (orderShipment != null) orderId = orderShipment.getString("orderId"); record = new HashMap(); if (shipmentPackageComponent.get("subProductId") != null) { record.put("productId", shipmentPackageComponent.getString("subProductId")); record.put("quantity", shipmentPackageComponent.getDouble("subQuantity")); } else { record.put("productId", shipmentItem.getString("productId")); record.put("quantity", shipmentPackageComponent.getDouble("quantity")); } record.put("shipmentPackageSeqId", shipmentPackageComponent.getString("shipmentPackageSeqId")); record.put("orderId", orderId); product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", (String)record.get("productId"))); record.put("productName", product.getString("internalName")); record.put("shipDate", shipment.getString("estimatedShipDate")); // --- orderReadHelper = null; if (orderReaders.containsKey(orderId)) { orderReadHelper = (OrderReadHelper)orderReaders.get(orderId); } else { orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); orderReadHelper = new OrderReadHelper(orderHeader); orderReaders.put(orderId, orderReadHelper); } displayParty = orderReadHelper.getPlacingParty(); shippingAddress = orderReadHelper.getShippingAddress(); record.put("shippingAddressName", shippingAddress.getString("toName")); record.put("shippingAddressAddress", shippingAddress.getString("address1")); record.put("shippingAddressCity", shippingAddress.getString("city")); record.put("shippingAddressPostalCode", shippingAddress.getString("postalCode")); record.put("shippingAddressCountry", shippingAddress.getString("countryGeoId")); 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 + -