From 290e5fd2e74efe19326f56e38c3391aaae23ffc5 Mon Sep 17 00:00:00 2001
From: IZCD4L12RTSW0VZ\Administrator <skyouc>
Date: 星期三, 24 十二月 2025 17:14:09 +0800
Subject: [PATCH] Merge branch 'jsxswms' of http://47.97.1.152:5880/r/zy-asrs into jsxswms

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   97 ++++++++++++++++++++++++++++--------------------
 1 files changed, 56 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 582a0ea..b07baec 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -700,13 +700,13 @@
                 OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),
                         elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                         elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
-                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
+                DetlDto detlDto = new DetlDto(order.getOrderNo(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
                         elem.getStandby2(), elem.getStandby3(),
                         elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
                         elem.getThreeCode());
                 detlDto.setOrderId(order.getId());
                 detlDto.setOrderNo(order.getOrderNo());
-                if (DetlDto.has(detlDtos, detlDto)) {
+                if (DetlDto.hasOrder(detlDtos, detlDto)) {
                     DetlDto one = DetlDto.findDto(detlDtos, detlDto);
                     assert one != null;
                     one.setAnfme(one.getAnfme() + detlDto.getAnfme());
@@ -991,7 +991,7 @@
                 try {
                     response = new HttpHandler.Builder()
                             .setUri(MesConstant.URL)
-                            .setPath(MesConstant.PACK_DOWN_URL)
+                            .setPath(MesConstant.IN_DISPATCH_RESULT)
                             .setJson(JSON.toJSONString(mesCombParam))
                             .build()
                             .doPost();
@@ -999,11 +999,11 @@
                     if (jsonObject.getInteger("code").equals(200)) {
                         success = true;
                     } else if (jsonObject.getInteger("code").equals(500)) {
-                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
+                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
                                 JSON.toJSONString(mesCombParam), response);
                         throw new CoolException(jsonObject.getString("msg"));
                     } else {
-                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.PACK_DOWN_URL,
+                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
                                 JSON.toJSONString(mesCombParam), response);
                         throw new CoolException("涓婃姤mes绯荤粺澶辫触");
                     }
@@ -1015,7 +1015,7 @@
                         // 淇濆瓨鎺ュ彛鏃ュ織
                         apiLogService.save(
                                 "鎵撳寘涓嬬嚎甯墭涓婃姤",
-                                MesConstant.URL + MesConstant.PACK_DOWN_URL,
+                                MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
                                 null,
                                 "127.0.0.1",
                                 JSON.toJSONString(mesCombParam),
@@ -1741,7 +1741,7 @@
                     throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
                 }
                 station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
-                station.setBarcode(null);
+                station.setBarcode("");
                 if (!basStationService.updateById(station)) {
                     throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
                 }
@@ -1786,7 +1786,7 @@
         }
 
         station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
-        station.setBarcode(null);
+        station.setBarcode("");
         if (!basStationService.updateById(station)) {
             throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐�!");
         }
@@ -2195,8 +2195,14 @@
                     .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
                     .orderAsc(Arrays.asList("row1", "bay1", "lev1"))
                     .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+
+            if (Objects.isNull(locMast)) {
+                throw new CoolException("鏈煡璇㈠埌鍙敤鐨勭┖鏉夸俊鎭紒锛�");
+            }
+
             CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls);
             locMasts.add(crnTaskDetlDTO);
+
             // 绌烘澘鍑哄簱
             generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
         }
@@ -2381,11 +2387,6 @@
      */
     @Transactional(rollbackFor = Exception.class)
     public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
-        List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
-        if (Objects.isNull(pakins) || pakins.isEmpty()) {
-            throw new CoolException("缁勬墭淇℃伅涓嶅瓨鍦紒锛�");
-        }
-
         List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
         if (!tasks.isEmpty()) {
             throw new CoolException("鎵樼洏宸插湪浠诲姟鎵ц涓�..");
@@ -2416,32 +2417,39 @@
             throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
         }
 
-        for (WaitPakin pakin : pakins) {
-            TaskDetl wrkDetl = new TaskDetl();
-            BeanUtils.copyProperties(pakin, wrkDetl);
-            wrkDetl.setId(null).setWrkNo(workNo)
-                    .setIoTime(new Date())
-                    .setOrderNo(pakin.getOrderNo())
-                    .setAnfme(pakin.getAnfme())
-                    .setZpallet(pakin.getZpallet())
-                    .setBatch(pakin.getBatch())
-                    .setMatnr(pakin.getMatnr())
-                    .setMaktx(pakin.getMaktx())
-                    .setAppeUser(userId)
-                    .setUnit(pakin.getUnit())
-                    .setModel(pakin.getModel())
-                    .setAppeTime(new Date())
-                    .setModiUser(userId);
-            if (!taskDetlService.insert(wrkDetl)) {
-                throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+        if (!type.equals("agv_back")) {
+            List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
+            if (Objects.isNull(pakins) || pakins.isEmpty()) {
+                throw new CoolException("缁勬墭淇℃伅涓嶅瓨鍦紒锛�");
             }
 
-        }
+            for (WaitPakin pakin : pakins) {
+                TaskDetl wrkDetl = new TaskDetl();
+                BeanUtils.copyProperties(pakin, wrkDetl);
+                wrkDetl.setId(null).setWrkNo(workNo)
+                        .setIoTime(new Date())
+                        .setOrderNo(pakin.getOrderNo())
+                        .setAnfme(pakin.getAnfme())
+                        .setZpallet(pakin.getZpallet())
+                        .setBatch(pakin.getBatch())
+                        .setMatnr(pakin.getMatnr())
+                        .setMaktx(pakin.getMaktx())
+                        .setAppeUser(userId)
+                        .setUnit(pakin.getUnit())
+                        .setModel(pakin.getModel())
+                        .setAppeTime(new Date())
+                        .setModiUser(userId);
+                if (!taskDetlService.insert(wrkDetl)) {
+                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+                }
 
-        for (WaitPakin pakin : pakins) {
-            pakin.setIoStatus("Y");
-            if (!waitPakinService.updateById(pakin)) {
-                throw new CoolException("鏇存柊缁勬墭淇℃伅澶辫触");
+            }
+
+            for (WaitPakin pakin : pakins) {
+                pakin.setIoStatus("Y");
+                if (!waitPakinService.updateById(pakin)) {
+                    throw new CoolException("鏇存柊缁勬墭淇℃伅澶辫触");
+                }
             }
         }
 
@@ -2463,9 +2471,9 @@
             throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
         }
 
-        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
+        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type) || station.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
             station.setLocSts("R"); // S.鍏ュ簱棰勭害
-//            station.setBarcode(barcode);
+            station.setBarcode(barcode);
             station.setModiTime(new Date());
             station.setModiUser(userId);
             if (!basStationService.updateById(station)) {
@@ -2531,7 +2539,7 @@
     }
 
     /**
-     * 鍛煎彨AGV杩斿洖
+     * 鍛煎彨AGV绌哄彴杞﹁繑鍥�
      * @author Ryan
      * @date 2025/9/24
      * @param callAgvBackParam
@@ -2550,9 +2558,16 @@
         if (Objects.isNull(locCache)) {
             return R.error("鏈煡璇㈠埌鍙敤搴撲綅");
         }
-        
+
+        // 淇敼鐩爣绔欑偣淇℃伅
+        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite()));
+        if (Objects.isNull(station)) {
+            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
+        }
+
         try {
-            generateAgvTask("agv", locCache, callAgvBackParam.getOrgSite(), callAgvBackParam.getBarcode(), userId);
+            //绌哄彴杞﹀洖搴�
+            generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId);
         } catch (Exception e) {
             e.printStackTrace();
             return R.error(e.getMessage());

--
Gitblit v1.9.1