當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。