From 6efbf154b3ed88d376763b9d9807256c7bd5eaeb Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期一, 09 三月 2026 20:23:38 +0800
Subject: [PATCH] no message

---
 src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java |  114 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 78 insertions(+), 36 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java b/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
index 83e07af..3286885 100644
--- a/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -21,6 +21,7 @@
 import com.zy.asrs.service.*;
 import com.zy.asrs.service.impl.TaskDetlLogServiceImpl;
 import com.zy.asrs.service.impl.TaskDetlServiceImpl;
+import com.zy.asrs.service.impl.WrkDetlLogServiceImpl;
 import com.zy.asrs.task.AbstractHandler;
 import com.zy.asrs.task.core.ReturnT;
 import com.zy.asrs.utils.OrderInAndOutUtil;
@@ -73,6 +74,8 @@
     CheckOrderDetlService checkOrderDetlService;
     @Autowired
     private TaskDetlLogService taskDetlLogService;
+    @Autowired
+    private WrkDetlLogServiceImpl wrkDetlLogService;
 
 
     @Transactional
@@ -144,6 +147,7 @@
                 orderDetlList.add(detail);
             }
         }
+
         for (OrderDetl orderDetl : orderDetlList) {
             orderDetl.setWorkQty(0D);
             OrderInAndOutUtil.insertOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl);
@@ -165,17 +169,22 @@
 
     @Transactional(rollbackFor = Exception.class)
     public void ifTransfetInsertStockIn(Order order, OrderDetl orderDetl) {
-        OrderPakin orderPakin = new OrderPakin();
-        BeanUtils.copyProperties(order, orderPakin);
-        orderPakin.setDocType(OrderTypeEnum.STOCK_IN.type.longValue());
-
-        if (!orderPakinService.insert(orderPakin)) {
-            throw new CoolException("鎻掑叆澶囪揣鍏ュ簱鍗曞け璐�");
+        OrderPakin pakin = orderPakinService.selectOne(new EntityWrapper<OrderPakin>()
+                .eq("order_no", order.getOrderNo())
+                .eq("doc_type", OrderTypeEnum.STOCK_IN.type.longValue()));
+        if (Objects.isNull(pakin)) {
+            OrderPakin orderPakin = new OrderPakin();
+            BeanUtils.copyProperties(order, orderPakin);
+            orderPakin.setDocType(OrderTypeEnum.STOCK_IN.type.longValue());
+            if (!orderPakinService.insert(orderPakin)) {
+                throw new CoolException("鎻掑叆澶囪揣鍏ュ簱鍗曞け璐�");
+            }
+            pakin = orderPakin;
         }
+
         OrderDetlPakin orderDetlPakin = new OrderDetlPakin();
         BeanUtils.copyProperties(orderDetl, orderDetlPakin);
-        orderDetlPakin.setOrderId(orderPakin.getId());
-
+        orderDetlPakin.setOrderId(pakin.getId());
         if (!orderDetlPakinService.insert(orderDetlPakin)) {
             throw new CoolException("鎻掑叆澶囪揣鍏ュ簱鍗曞け璐�");
         }
@@ -270,7 +279,7 @@
             orderDetls.forEach(detl -> {
                 Mat material = matService.selectByMatnr(detl.getMatnr());
                 if (Objects.isNull(material)) {
-                    throw new CoolException("鐗╂枡涓嶅瓨鍦�");
+                    throw new CoolException(material.getMatnr() +  "鐗╂枡涓嶅瓨鍦�");
                 }
                 ReportOrderParams itemParam = new ReportOrderParams();
 
@@ -279,29 +288,46 @@
                         .eq("supp_code", detl.getSuppCode())
                         .eq("order_no", detl.getOrderNo()));
                 if (Objects.isNull(locDetl)) {
-                    throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦� 锛岃妫�鏌ュ崟鎹槸鍚﹀畬鎴愶紒锛�");
+                    // BS Code
+                    itemParam.setTotal_serial(detl.getThreeCode())
+                            // 涓婃姤鏃讹紝榛樿浜у搧绫诲瀷鏄痭ull
+                            .setPro_type(material.getProType())
+                            // 涓婃姤鏃讹紝榛樿浜у搧缂栫爜
+                            .setPro_komcode(detl.getMatnr())
+                            // 涓婃姤鏃讹紝榛樿浜у搧id鏄緵搴斿晢缂栫爜
+                            .setPro_id(detl.getSuppCode())
+                            .setLocation_no("LX000000000")
+                            .setSj_emp("9527")
+                            .setLocation_type(MatLocType.getMatTag(material.getTagId() + ""))
+                            // 涓婃姤鏃讹紝榛樿涓婃姤鏃堕棿鏄洿鏂版椂闂�
+                            .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"))
+                            // 涓婃姤鏃讹紝濡傛灉涓虹┖榛樿涓婃姤 0
+                            .setPick_qty(0)
+                            // 涓婃姤鏃讹紝榛樿鎹熷潖鏁伴噺鏄�0
+                            .setDamage_qty(0)
+                            // 涓婃姤鏃讹紝榛樿宸紓鏁伴噺鏄�0
+                            .setDiff_qty(0);
+                } else {
+                    // BS Code
+                    itemParam.setTotal_serial(detl.getThreeCode())
+                            // 涓婃姤鏃讹紝榛樿浜у搧绫诲瀷鏄痭ull
+                            .setPro_type(material.getProType())
+                            // 涓婃姤鏃讹紝榛樿浜у搧缂栫爜
+                            .setPro_komcode(detl.getMatnr())
+                            // 涓婃姤鏃讹紝榛樿浜у搧id鏄緵搴斿晢缂栫爜
+                            .setPro_id(detl.getSuppCode())
+                            .setLocation_no(locDetl.getZpallet())
+                            .setSj_emp(locDetl.getModiUser$())
+                            .setLocation_type(MatLocType.getMatTag(material.getTagId() + ""))
+                            // 涓婃姤鏃讹紝榛樿涓婃姤鏃堕棿鏄洿鏂版椂闂�
+                            .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"))
+                            // 涓婃姤鏃讹紝榛樿涓婃姤鏁伴噺鏄鍗曟暟閲�
+                            .setPick_qty(locDetl.getAnfme().intValue())
+                            // 涓婃姤鏃讹紝榛樿鎹熷潖鏁伴噺鏄�0
+                            .setDamage_qty(0)
+                            // 涓婃姤鏃讹紝榛樿宸紓鏁伴噺鏄�0
+                            .setDiff_qty(0);
                 }
-
-                // BS Code
-                itemParam.setTotal_serial(detl.getThreeCode())
-                        // 涓婃姤鏃讹紝榛樿浜у搧绫诲瀷鏄痭ull
-                        .setPro_type(material.getProType())
-                        // 涓婃姤鏃讹紝榛樿浜у搧缂栫爜
-                        .setPro_komcode(detl.getMatnr())
-                        // 涓婃姤鏃讹紝榛樿浜у搧id鏄緵搴斿晢缂栫爜
-                        .setPro_id(detl.getSuppCode())
-                        .setLocation_no(locDetl.getZpallet())
-                        .setSj_emp(locDetl.getModiUser$())
-                        .setLocation_type(MatLocType.getMatTag(material.getTagId() + ""))
-                        // 涓婃姤鏃讹紝榛樿涓婃姤鏃堕棿鏄洿鏂版椂闂�
-                        .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"))
-                        // 涓婃姤鏃讹紝榛樿涓婃姤鏁伴噺鏄鍗曟暟閲�
-                        .setPick_qty(detl.getQty().intValue())
-                        // 涓婃姤鏃讹紝榛樿鎹熷潖鏁伴噺鏄�0
-                        .setDamage_qty(0)
-                        // 涓婃姤鏃讹紝榛樿宸紓鏁伴噺鏄�0
-                        .setDiff_qty(0);
-
                 reportOrderParams.add(itemParam);
             });
 
@@ -363,7 +389,7 @@
             orderDetls.forEach(detl -> {
                 Mat material = matService.selectByMatnr(detl.getMatnr());
                 if (Objects.isNull(material)) {
-                    throw new CoolException("鐗╂枡涓嶅瓨鍦�");
+                    throw new CoolException(material.getMatnr() +  "鐗╂枡涓嶅瓨鍦�");
                 }
                 TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>()
                         .eq("matnr", detl.getMatnr())
@@ -372,7 +398,15 @@
                 if (Objects.isNull(detlLog)) {
                     throw new CoolException("鏁版嵁閿欒 锛岃妫�鏌GV浠诲姟妗f槸鍚﹀凡瀹屾垚锛侊紒");
                 }
+/*                WrkDetlLog detlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>()
+                        .eq("matnr", detl.getMatnr())
+                        .eq("supp_code", detl.getStandby1())
+                        .eq("order_no", detl.getOrderNo()));
+                if (Objects.isNull(detlLog)) {
+                    throw new CoolException("鐗╂枡缂栫爜锛�" + detl.getMatnr() + "鏁版嵁閿欒 锛岃妫�鏌ュ爢鍨涙満浠诲姟妗f槸鍚﹀凡瀹屾垚锛侊紒");
+                }*/
                 //鐩爣搴撳尯
+//                orderParam.setTarget_location("2");
                 orderParam.setTarget_location(detlLog.getAreaType());
                 OrderItemsParam itemParam = new OrderItemsParam();
                 // BS Code
@@ -386,7 +420,7 @@
 //                        // 涓婃姤鏃讹紝榛樿鏉ユ簮浣嶇疆鏄痭ull
                         .setLocation_no(detlLog.getZpallet())
                         // 涓婃姤鏃讹紝榛樿涓婃姤鏁伴噺鏄鍗曟暟閲�
-                        .setPick_qty(detl.getQty().intValue());
+                        .setPick_qty(Objects.isNull(detl.getQty()) ? 0 : detl.getQty().intValue());
                 reportOrderParams.add(itemParam);
             });
 
@@ -456,7 +490,14 @@
             orderDetls.forEach(detl -> {
                 Mat material = matService.selectByMatnr(detl.getMatnr());
                 if (Objects.isNull(material)) {
-                    throw new CoolException("鐗╂枡涓嶅瓨鍦�");
+                    throw new CoolException(material.getMatnr() +  "鐗╂枡涓嶅瓨鍦�");
+                }
+                TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>()
+                        .eq("matnr", detl.getMatnr())
+                        .eq("supp_code", detl.getStandby1())
+                        .eq("order_no", detl.getOrderNo()));
+                if (Objects.isNull(detlLog)) {
+                    throw new CoolException("鏁版嵁閿欒 锛岃妫�鏌GV浠诲姟妗f槸鍚﹀凡瀹屾垚锛侊紒");
                 }
                 OrderItemsParam itemParam = new OrderItemsParam();
                 // 涓婃姤鏃讹紝榛樿浜у搧绫诲瀷鏄痭ull
@@ -466,9 +507,10 @@
                 // 涓婃姤鏃讹紝榛樿浜у搧id鏄緵搴斿晢缂栫爜
                 itemParam.setPro_id(detl.getSuppCode());
                 //todo 鍙拌溅缂栫爜
-                itemParam.setTruck_no("TC310080014");
+                itemParam.setTruck_no(detlLog.getZpallet());
                 // 涓婃姤鏃讹紝榛樿涓婃姤鏃堕棿鏄洿鏂版椂闂�
                 itemParam.setPick_qty(detl.getQty().intValue());
+
                 reportOrderParams.add(itemParam);
             });
             pubOrderParams.setPartList(reportOrderParams);
@@ -564,7 +606,7 @@
         detls.forEach(detl -> {
             Mat material = matService.selectByMatnr(detl.getMatnr());
             if (Objects.isNull(material)) {
-                throw new CoolException("鐗╂枡涓嶅瓨鍦�");
+                throw new CoolException(material.getMatnr() +  "鐗╂枡涓嶅瓨鍦�");
             }
             OrderItemsParam itemParam = new OrderItemsParam();
             itemParam.setLocation_no(detl.getZpallet())

--
Gitblit v1.9.1