Browse Source

增加打印面单需求:判断是否为维修机

xian 6 years ago
parent
commit
f74ca86405

+ 14 - 17
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AwaitSendController.java

@@ -1,10 +1,7 @@
 package com.iamberry.rst.controllers.order;
 
 import com.alibaba.fastjson.JSONObject;
-import com.iamberry.rst.core.cm.SalesOrder;
-import com.iamberry.rst.core.cm.SalesOrderItem;
-import com.iamberry.rst.core.cm.StoreInfo;
-import com.iamberry.rst.core.cm.StoreShip;
+import com.iamberry.rst.core.cm.*;
 import com.iamberry.rst.core.order.EOrderRequestData;
 import com.iamberry.rst.core.order.PostInfo;
 import com.iamberry.rst.core.order.PostOrderNum;
@@ -12,10 +9,7 @@ import com.iamberry.rst.core.order.ProductColor;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.pts.PtsBatch;
 import com.iamberry.rst.core.tools.LogisticsInfo;
-import com.iamberry.rst.faces.cm.PostOrderNumService;
-import com.iamberry.rst.faces.cm.SalesOrderService;
-import com.iamberry.rst.faces.cm.StoreInfoService;
-import com.iamberry.rst.faces.cm.StoreShipService;
+import com.iamberry.rst.faces.cm.*;
 import com.iamberry.rst.faces.order.LogisticsInfoService;
 import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.utils.OrderUtils;
@@ -62,6 +56,8 @@ public class AwaitSendController {
     private PostOrderNumService postOrderNumService;
     @Autowired
     private StoreInfoService storeInfoService;
+    @Autowired
+    private CustomerService customerService;
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(AwaitSendController.class);
@@ -210,7 +206,6 @@ public class AwaitSendController {
         SalesOrder salesOrderInfo = salesOrderService.getSalesOrderById(salesId);
         // 替换
         post = salesOrderInfo.getSalesPostFirm();
-
         StoreShip storeShip = null;
         if(salesOrderInfo.getSalesStoreId() != null){
             storeShip = storeShipService.getStoreShipByStoreId(salesOrderInfo.getSalesStoreId());
@@ -230,7 +225,6 @@ public class AwaitSendController {
         eOrderRequestData.Cost = (0.00);
         eOrderRequestData.OtherCost = (0.0);
         eOrderRequestData.Remark = salesId + "-" + orderId;
-
         // 不同的快递公司需要做不同的处理
         if (post.equalsIgnoreCase("EMS")) {
             // 省内EMS
@@ -255,15 +249,12 @@ public class AwaitSendController {
             eOrderRequestData.CustomerName = ("651476854");
             eOrderRequestData.ExpType = ("2");
         }
-
         LOGGER.info( "===salesId:" + salesId + "快递方式:" + post+ "订单编号:"+ orderId);
-
         // 收件人信息
         String[] addrs = salesOrderInfo.getSalesAddressInfo().split("-");
         if (addrs.length <= 3) {
             addrs = salesOrderInfo.getSalesAddressInfo().split(" ");
         }
-
         // 获取收件人邮编
         String postCode = AddrUtil.getPostCode(addrs[2]);
         if (postCode == null || "".equals(postCode)) {
@@ -300,9 +291,17 @@ public class AwaitSendController {
         // 整个产品的重量
         Double colorIsWeight = 0.00;
         StringBuilder goodName = new StringBuilder();
+        // 2018-12-21 增加打印面单需求:判断是否为维修机
+        if (salesOrderInfo.getSalesCustomerId() != null) {
+            CustomerInfo customerInfo = customerService.getCustomerInfo(salesOrderInfo.getSalesCustomerId());
+            if (customerInfo != null && customerInfo.getCustomerIsSolve() != null && customerInfo.getCustomerIsSolve() == 4) {
+                goodName.append("【原机返回】");
+            }
+        }
         int Goodsquantity = 0;
         for (SalesOrderItem temp : items) {
-            goodName.append(temp.getProductAbbreviation()).append("(").append(temp.getColorAbbreviation()).append(")*").append(temp.getItemNum()).append(";");
+            goodName.append(temp.getProductAbbreviation())
+                    .append("(").append(temp.getColorAbbreviation()).append(")*").append(temp.getItemNum()).append(";");
             if(temp.getColorIsWeight() != null){
                 colorIsWeight += temp.getColorIsWeight();
             }
@@ -311,15 +310,13 @@ public class AwaitSendController {
         // 20181113增加需求:产品名称后面增加打印订单日期
         goodName.append("【D").append(DateTimeUtil.format(new Date(), "MMdd")).append("】");
         String uuid = UUIDGenerator.getUUID().substring(0, 8);
-
+        // 增加产品信息
         Map<String, Object> product1 = new HashMap<String, Object>();
         product1.put("GoodsName", uuid);
         product1.put("Goodsquantity", Goodsquantity);
         // 计算产品重量deliver_statistics
         product1.put("GoodsWeight", colorIsWeight/1000);
-
         commodity.add(product1);
-
         eOrderRequestData.Commodity = (commodity);
         eOrderRequestData.Weight = (colorIsWeight/1000);
         eOrderRequestData.Quantity = (1);