当前位置: 首页>>代码示例>>Java>>正文


Java ShipmentWorker类代码示例

本文整理汇总了Java中org.ofbiz.shipment.shipment.ShipmentWorker的典型用法代码示例。如果您正苦于以下问题:Java ShipmentWorker类的具体用法?Java ShipmentWorker怎么用?Java ShipmentWorker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShipmentWorker类属于org.ofbiz.shipment.shipment包,在下文中一共展示了ShipmentWorker类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: splitEstimatePackages

import org.ofbiz.shipment.shipment.ShipmentWorker; //导入依赖的package包/类
private static void splitEstimatePackages(DispatchContext dctx, Document requestDoc, Element shipmentElement, List<Map<String, Object>> shippableItemInfo, 
        BigDecimal maxWeight, BigDecimal minWeight, String totalWeightStr) {
    List<Map<String, BigDecimal>> packages = ShipmentWorker.getPackageSplit(dctx, shippableItemInfo, maxWeight);
    if (UtilValidate.isNotEmpty(packages)) {
        for (Map<String, BigDecimal> packageMap: packages) {
            addPackageElement(dctx, requestDoc, shipmentElement, shippableItemInfo, packageMap, minWeight);
        }
    } else {
        // Add a dummy package
        BigDecimal packageWeight = BigDecimal.ONE;
        try {
            packageWeight = new BigDecimal(totalWeightStr);
        } catch (NumberFormatException e) {
            Debug.logError(e, module);
        }
        Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", requestDoc);
        Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
        UtilXml.addChildElementValue(packagingTypeElement, "Code", "00", requestDoc);
        Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
        UtilXml.addChildElementValue(packageWeightElement, "Weight", "" + packageWeight, requestDoc);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:UpsServices.java

示例2: addPackageElement

import org.ofbiz.shipment.shipment.ShipmentWorker; //导入依赖的package包/类
private static void addPackageElement(DispatchContext dctx, Document requestDoc, Element shipmentElement, List<Map<String, Object>> shippableItemInfo, Map<String, BigDecimal> packageMap, BigDecimal minWeight) {
    BigDecimal packageWeight = checkForDefaultPackageWeight(ShipmentWorker.calcPackageWeight(dctx,packageMap, shippableItemInfo, BigDecimal.ZERO), minWeight);
    Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", requestDoc);
    Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", requestDoc);
    UtilXml.addChildElementValue(packagingTypeElement, "Code", "00", requestDoc);
    UtilXml.addChildElementValue(packagingTypeElement, "Description", "Unknown PackagingType", requestDoc);
    UtilXml.addChildElementValue(packageElement, "Description", "Package Description", requestDoc);
    Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc);
    UtilXml.addChildElementValue(packageWeightElement, "Weight", packageWeight.toPlainString(), requestDoc);
    //If product is in shippable Package then it we should have one product per packagemap
    if (packageMap.size() ==1) {
        Iterator<String> i = packageMap.keySet().iterator();
        String productId = i.next();
        Map<String, Object> productInfo = ShipmentWorker.getProductItemInfo(shippableItemInfo, productId);
        if (productInfo.get("inShippingBox") != null &&  ((String) productInfo.get("inShippingBox")).equalsIgnoreCase("Y")
                && productInfo.get("shippingDepth") !=null && productInfo.get("shippingWidth") !=null && productInfo.get("shippingHeight") !=null) {
            Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", requestDoc);
            UtilXml.addChildElementValue(dimensionsElement, "Length", productInfo.get("shippingDepth").toString(), requestDoc);
            UtilXml.addChildElementValue(dimensionsElement, "Width", productInfo.get("shippingWidth").toString(), requestDoc);
            UtilXml.addChildElementValue(dimensionsElement, "Height", productInfo.get("shippingHeight").toString(), requestDoc);
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:24,代码来源:UpsServices.java


注:本文中的org.ofbiz.shipment.shipment.ShipmentWorker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。