From 2bbb655dcb98b9d54083286825f14bf8aff7143b Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期二, 20 一月 2026 17:22:36 +0800
Subject: [PATCH] 1. 查询库存接口调整优化

---
 src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 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 23276e6..5b28ddd 100644
--- a/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
+++ b/src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -19,6 +19,8 @@
 import com.zy.asrs.entity.*;
 import com.zy.asrs.enums.OrderTypeEnum;
 import com.zy.asrs.service.*;
+import com.zy.asrs.service.impl.TaskDetlLogServiceImpl;
+import com.zy.asrs.service.impl.TaskDetlServiceImpl;
 import com.zy.asrs.task.AbstractHandler;
 import com.zy.asrs.task.core.ReturnT;
 import com.zy.asrs.utils.OrderInAndOutUtil;
@@ -69,6 +71,8 @@
     private LocDetlService locDetlService;
     @Autowired
     CheckOrderDetlService checkOrderDetlService;
+    @Autowired
+    private TaskDetlLogService taskDetlLogService;
 
 
     @Transactional
@@ -288,9 +292,9 @@
                         .setPro_id(detl.getSuppCode())
                         .setLocation_no(locDetl.getZpallet())
                         .setSj_emp(locDetl.getModiUser$())
-                        .setLocation_type(MatLocType.getMatTag(material.getTagId()  + ""))
+                        .setLocation_type(MatLocType.getMatTag(material.getTagId() + ""))
                         // 涓婃姤鏃讹紝榛樿涓婃姤鏃堕棿鏄洿鏂版椂闂�
-                        .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss") )
+                        .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss"))
                         // 涓婃姤鏃讹紝榛樿涓婃姤鏁伴噺鏄鍗曟暟閲�
                         .setPick_qty(detl.getQty().intValue())
                         // 涓婃姤鏃讹紝榛樿鎹熷潖鏁伴噺鏄�0
@@ -353,7 +357,7 @@
                     .setUpdate_time(Utils.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"))
                     //鐩爣搴撳尯
                     .setTarget_location("")
-                    .setTarget_location("1");
+                    .setSource_location("1");
 
             List<OrderItemsParam> reportOrderParams = new ArrayList<>();
             orderDetls.forEach(detl -> {
@@ -361,6 +365,15 @@
                 if (Objects.isNull(material)) {
                     throw new CoolException("鐗╂枡涓嶅瓨鍦�");
                 }
+                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槸鍚﹀凡瀹屾垚锛侊紒");
+                }
+                //鐩爣搴撳尯
+                orderParam.setTarget_location(detlLog.getAreaType());
                 OrderItemsParam itemParam = new OrderItemsParam();
                 // BS Code
                 itemParam
@@ -371,12 +384,19 @@
                         // 涓婃姤鏃讹紝榛樿浜у搧id鏄緵搴斿晢缂栫爜
                         .setPro_id(detl.getSuppCode())
 //                        // 涓婃姤鏃讹紝榛樿鏉ユ簮浣嶇疆鏄痭ull
-                        .setLocation_no(null)
+                        .setLocation_no(detlLog.getZpallet())
                         // 涓婃姤鏃讹紝榛樿涓婃姤鏁伴噺鏄鍗曟暟閲�
                         .setPick_qty(detl.getQty().intValue());
                 reportOrderParams.add(itemParam);
             });
 
+            if (orderParam.getTarget_location().equals("2")) {
+                orderParam.setType("11");
+            } else if (orderParam.getTarget_location().equals("3")) {
+                orderParam.setType("12");
+            } else {
+                orderParam.setType("13");
+            }
             orderParam.setPartList(reportOrderParams);
 
             XSR response = null;
@@ -438,6 +458,14 @@
                 if (Objects.isNull(material)) {
                     throw new CoolException("鐗╂枡涓嶅瓨鍦�");
                 }
+
+                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
                 itemParam.setPro_type(material.getProType());
@@ -446,9 +474,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);
@@ -516,7 +545,7 @@
 
     /**
      * 鎹熸孩鍗曞畬缁撲笂鎶�
-     * 
+     *
      * @param order
      * @return
      */
@@ -562,7 +591,7 @@
             if (response.getSuccess()) {
                 return SUCCESS;
             } else {
-                return  FAIL;
+                return FAIL;
             }
         }
 

--
Gitblit v1.9.1