From 0927dceed8e5504ec0b5eeaa446f5423ddc74ec3 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 26 十一月 2025 13:04:05 +0800
Subject: [PATCH] 1.完善验布组托 2.修复销售订单默认勾选数据对不上

---
 src/main/java/com/zy/asrs/controller/MobileController.java |  230 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 117 insertions(+), 113 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index d16713a..93b7a21 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -15,11 +15,13 @@
 import com.zy.asrs.entity.result.MobileAdjustResult;
 import com.zy.asrs.mapper.ManLocDetlMapper;
 import com.zy.asrs.service.*;
+import com.zy.asrs.service.impl.MatServiceImpl;
 import com.zy.common.model.WrkDto;
 import com.zy.common.utils.HttpHandler;
 import com.zy.common.web.BaseController;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
+import com.zy.third.entity.ExdMaterial;
 import com.zy.third.entity.ExdvYanbu;
 import com.zy.third.mapper.ExdMaterialMapper;
 import lombok.extern.slf4j.Slf4j;
@@ -81,6 +83,8 @@
 
     @Autowired
     private ExdMaterialMapper exdMaterialMapper;
+    @Autowired
+    private MatServiceImpl matService;
 
     // 鍟嗗搧涓婃灦
     @RequestMapping("/mat/onSale/auth")
@@ -116,19 +120,25 @@
         if (docType.getPakin() == null || docType.getPakin() != 1) {
             return R.ok();
         }
-        if (order.getSettle() > 2) {
-            return R.ok();
-        }
+
         List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
         if (Cools.isEmpty(orderDetls)) {
             return R.ok();
         }
-        return R.ok().add(orderDetls);
+        List<OrderDetl> orderDetls1= new ArrayList<>();
+        for (OrderDetl orderDetl : orderDetls) {
+            if(orderDetl.getAnfme()-orderDetl.getWorkQty()>0){
+                orderDetls1.add(orderDetl);
+            }
+
+        }
+        return R.ok().add(orderDetls1);
     }
 
     @RequestMapping("/comb/auth")
     @ManagerAuth(memo = "缁勬墭")
-    public R comb(@RequestBody CombParam combParam) {
+    public synchronized R comb(@RequestBody CombParam combParam) {
+        log.info("缁勬墭鏁版嵁锛歿}", combParam.toString());
         mobileService.comb(combParam, getUserId(), getUser().getEmail());
         return R.ok("缁勬墭鎴愬姛");
     }
@@ -193,7 +203,7 @@
         if (wrkMast != null) {
             List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
             // 鍘婚櫎宸插嚭搴撶‘璁ょ殑鏄庣粏
-            wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
+//            wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0);
             return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls));
         }
         return R.ok();
@@ -463,121 +473,97 @@
         }
         //绌烘墭鐩樼紦鍐插尯 灏忥細E8  澶э細E9
         String rStaNo = "E8";
-        if (barcode.substring(0, 1).equals("9")) {
-        String rStaNo ="E8";
-        String type ="ZONE"; //鍖哄煙
-        if(barcode.substring(0,1).equals("9")){
-            rStaNo = "E9";
-        }
-        String type = "ZONE"; //鍖哄煙
         Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
-        if (config != null) {
-            type = "STACK"; //宸烽亾
-            if (Cools.isEmpty(config.getValue())) {
-                rStaNo = rStaNo + "01";
-                config.setValue("2");
-            } else if (config.getValue().equals("1")) {
-                rStaNo = rStaNo + "01";
-                config.setValue("2");
-            } else if (config.getValue().equals("2")) {
-                rStaNo = rStaNo + "02";
-                config.setValue("3");
-            } else if (config.getValue().equals("3")) {
-                rStaNo = rStaNo + "03";
-                config.setValue("1");
-            }
-            configService.updateById(config);
-        }else{
-            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
-
-            if (config != null) {
-                type ="STACK"; //宸烽亾
-                if (Cools.isEmpty(config.getValue())) {
-                    rStaNo = rStaNo + "01";
-                    config.setValue("2");
-                }else if (config.getValue().equals("1")) {
-                    rStaNo = rStaNo + "01";
-                    config.setValue("2");
-                }else if (config.getValue().equals("2")) {
-                    rStaNo = rStaNo + "02";
-                    config.setValue("3");
-                }else if (config.getValue().equals("3")) {
-                    rStaNo = rStaNo + "03";
-                    config.setValue("1");
+            String type = "ZONE"; //鍖哄煙
+            if (barcode.substring(0, 1).equals("9")) {
+                rStaNo = "E9";
+            }else {
+                if (config != null) {
+                    type = "STACK"; //宸烽亾
+                    if (Cools.isEmpty(config.getValue())) {
+                        rStaNo = rStaNo + "01";
+                        config.setValue("2");
+                    } else if (config.getValue().equals("1")) {
+                        rStaNo = rStaNo + "01";
+                        config.setValue("2");
+                    } else if (config.getValue().equals("2")) {
+                        rStaNo = rStaNo + "02";
+                        config.setValue("3");
+                    } else if (config.getValue().equals("3")) {
+                        rStaNo = rStaNo + "03";
+                        config.setValue("1");
+                    }
+                    configService.updateById(config);
                 }
-                configService.updateById(config);
             }
-        }
 
-        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
-        rcsParam.put("taskType", "PF-FMR-COMMON");
-        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
-        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
-        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
-        t1.put("seq", 0);
-        t1.put("type", "SITE");
-        t1.put("code", sourceStaNo);
-        t1.put("autoStart", 0);
-        t1.put("operation", "COLLECT");
+            LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+            rcsParam.put("taskType", "PF-FMR-COMMON");
+            List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+            LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+            LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+            t1.put("seq", 0);
+            t1.put("type", "SITE");
+            t1.put("code", sourceStaNo);
+            t1.put("autoStart", 0);
+            t1.put("operation", "COLLECT");
 
-        t2.put("seq", 0);
-        t2.put("type", type);
-        t2.put("code", rStaNo);
-        t2.put("autoStart", 0);
-        t2.put("operation", "DELIVERY");
+            t2.put("seq", 0);
+            t2.put("type", type);
+            t2.put("code", rStaNo);
+            t2.put("autoStart", 0);
+            t2.put("operation", "DELIVERY");
 
-        targetRoutes.add(t1);
-        targetRoutes.add(t2);
-        rcsParam.put("targetRoute", targetRoutes);
-        rcsParam.put("initPriority", 100);
+            targetRoutes.add(t1);
+            targetRoutes.add(t2);
+            rcsParam.put("targetRoute", targetRoutes);
+            rcsParam.put("initPriority", 100);
 
 
-        String response = "";
-        Boolean bool = false;
-        String msg = "";
-        HashMap<String, Object> map = new HashMap<>();
-        Date date = new Date();
-        String time = date.getTime() + "";
+            String response = "";
+            Boolean bool = false;
+            String msg = "";
+            HashMap<String, Object> map = new HashMap<>();
+            Date date = new Date();
+            String time = date.getTime() + "";
 
-        map.put("X-LR-REQUEST-ID", time);
-        try {
-            log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
-            response = new HttpHandler.Builder()
-                    .setHeaders(map)
-                    .setUri(url)
-                    .setHttps(true)
-                    .setPath(attrcs)
-                    .setJson(JSON.toJSONString(rcsParam))
-                    .build()
-                    .doPostCloseSSL();
-            JSONObject jsonObject = JSON.parseObject(response);
-            if (jsonObject.getString("code").equals("SUCCESS")) {
-                bool = true;
+            map.put("X-LR-REQUEST-ID", time);
+            try {
+                log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+                response = new HttpHandler.Builder()
+                        .setHeaders(map)
+                        .setUri(url)
+                        .setHttps(true)
+                        .setPath(attrcs)
+                        .setJson(JSON.toJSONString(rcsParam))
+                        .build()
+                        .doPostCloseSSL();
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getString("code").equals("SUCCESS")) {
+                    bool = true;
+                } else {
+                    msg = jsonObject.getString("message");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+            } finally {
+                apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
+                        , url + attrcs
+                        , null
+                        , "127.0.0.1"
+                        , JSON.toJSONString(rcsParam)
+                        , response
+                        , bool
+                );
+            }
+
+            if (bool) {
+                return R.ok();
             } else {
-                msg = jsonObject.getString("message");
+                return R.error(msg);
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
-        } finally {
-            apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
-                    , url + attrcs
-                    , null
-                    , "127.0.0.1"
-                    , JSON.toJSONString(rcsParam)
-                    , response
-                    , bool
-            );
-        }
-
-        if (bool) {
-            return R.ok();
-        } else {
-            return R.error(msg);
-        }
-
     }
-
 
     /**
      * 鎵ц绉诲簱浠诲姟--鐐瑰埌鐐�
@@ -877,7 +863,10 @@
 
         } else if (sourceStaNo.equals("R02")) {
             rcsParam.put("carrierDir", "90");
-        } else {
+        } else if(sourceStaNo.substring(0,1).equals("C")){
+            rcsParam.put("carrierDir", "90");
+        }
+        else{
             rcsParam.put("carrierDir", "180");
         }
 
@@ -948,13 +937,18 @@
         }
 
         R r = R.ok();
+        //闃叉鏈夋湭涓嬫灦鐨勭墿鏂欑洿鎺ヨ繘琛岀┖鏉垮洖搴撴垨鑰呮嫞鏂欏洖搴�
+        WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("wrk_sts", 33));
+        if (!Cools.isEmpty(wrkMast1)) {
+            return R.error("璇ユ墭鐩�="+wrkMast1.getBarcode()+",娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
+        }
 
         WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("io_type", 103, 105, 107));
         if (wrkMast == null) {
             r = FillEmptyPalletsStack(sourceStaNo, staNo);
         } else {
-            if (wrkMast.getWrkSts() > 30) {
-                return R.error("璇ユ墭鐩�={},娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
+            if (wrkMast.getWrkSts() > 30&& 34< wrkMast.getWrkSts()) {
+                return R.error("璇ユ墭鐩�="+wrkMast.getBarcode()+",娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
             }
             List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", wrkMast.getStaNo()).in("io_type", 101, 103, 105, 107).lt("wrk_sts", 33));
             if (!Cools.isEmpty(wrkMasts)) {
@@ -1003,7 +997,17 @@
         if (barcode1 == null) {
             return R.error("鎵规瀵瑰簲鐨勯獙甯冩暟鎹笉瀛樺湪");
         }
-        return R.ok(barcode1);
+        Mat mat = matService.selectByMatnr(barcode1.getItemnumber());
+        if(Cools.isEmpty(mat.getUuid())) {
+            ExdMaterial fnumber = exdMaterialMapper.getID(barcode1.getItemnumber());
+            mat.setUuid(fnumber.getId());
+        }
+        mat.setAnfme(barcode1.getQty());
+        mat.setBc(barcode);
+        mat.setBatch(barcode);
+        matService.updateById(mat);
+
+        return R.ok(mat);
     }
 
     @RequestMapping(value = "/getOrderNo/auth")

--
Gitblit v1.9.1