From 6923315545b3f97c86719148f85dac1220a14a63 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期三, 14 一月 2026 19:23:54 +0800
Subject: [PATCH] agv空托入库接口以及机器人组站点配置

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   62 +++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 7 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 8cb66c6..6a89950 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -23,6 +23,7 @@
 import com.zy.common.model.DetlDto;
 import com.zy.common.model.MesCombParam;
 import com.zy.common.model.enums.WorkNoType;
+import com.zy.common.properties.AgvProperties;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
 import lombok.extern.slf4j.Slf4j;
@@ -122,6 +123,9 @@
     @Resource
     private BasDevpMapper basDevpMapper;
 
+    @Resource
+    private AgvProperties agvProperties;
+
     @Override
     public R inLocCallAgv(CallAgvParam param,Long userId) {
         int type = param.getType();
@@ -159,23 +163,33 @@
                 locCacheService.updateById(locCache);
                 break;
             case 3:
-                // 鍒ゆ柇鏉$爜鍦╳ms涓嶅瓨鍦紝鏄┖鎵樼洏
-                // 宸茬粍鎵�
+                // 鍒ゆ柇鏄惁涓虹┖鎵樺叆搴擄細妫�鏌ユ潯鐮佸湪wms涓笉瀛樺湪锛岀‘璁や负绌烘墭鐩�
+                log.info("寮�濮嬪垽鏂槸鍚︿负绌烘墭鍏ュ簱锛屾潯鐮侊細{}", barcode);
+                
+                // 妫�鏌ユ槸鍚﹀凡缁勬墭
                 int waitPakInCount = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
                 if (waitPakInCount != 0) {
+                    log.warn("鏉$爜缁勬墭妗e凡瀛樺湪锛屼笉鏄┖鎵樼洏锛歿}", barcode);
                     throw new CoolException("鏉$爜缁勬墭妗e凡瀛樺湪锛�" + barcode);
                 }
-                // 鏈変换鍔�
+                
+                // 妫�鏌ユ槸鍚︽湁浠诲姟
                 int wrkMastCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("barcode", barcode));
                 if (wrkMastCount != 0) {
+                    log.warn("鏉$爜浠诲姟妗e凡瀛樺湪锛屼笉鏄┖鎵樼洏锛歿}", barcode);
                     throw new CoolException("鏉$爜浠诲姟妗e凡瀛樺湪锛�" + barcode);
                 }
-                // 鏈夊簱瀛�
+                
+                // 妫�鏌ユ槸鍚︽湁搴撳瓨
                 int locDetlCount = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", barcode));
                 if (locDetlCount != 0) {
+                    log.warn("鏉$爜搴撳瓨宸插瓨鍦紝涓嶆槸绌烘墭鐩橈細{}", barcode);
                     throw new CoolException("鏉$爜搴撳瓨宸插瓨鍦細" + barcode);
                 }
+                
+                // 閫氳繃鎵�鏈夋鏌ワ紝纭涓虹┖鎵樼洏锛岃缃负绌烘墭鍏ュ簱
                 ioType = 10;
+                log.info("纭涓虹┖鎵樼洏锛岃缃负绌烘墭鍏ュ簱锛屾潯鐮侊細{}锛宨oType锛歿}", barcode, ioType);
                 break;
             default:
                 throw new CoolException("鍏ュ簱绫诲瀷閿欒,type锛�" + type);
@@ -186,15 +200,47 @@
             throw new CoolException(barcode+ "锛氭潯鐮佸瓨鍦╝gv鎼繍浠诲姟!");
         }
 
+        // 鏍规嵁whs_type閫夋嫨绔欑偣鍜屾満鍣ㄤ汉缁�
+        Long whsType = locCache.getWhsType();
+        List<String> targetStations;
+        String robotGroup;
+        
+        if (whsType != null && whsType.equals(agvProperties.getWhsTypeMapping().getInboundArea())) {
+            // whs_type = 1: 鍏ュ簱鍖猴紝浣跨敤涓滀晶绔欑偣鍜孏roup-001
+            targetStations = agvProperties.getEastStations();
+            robotGroup = agvProperties.getRobotGroupEast();
+            log.info("搴撲綅whs_type={}锛屼娇鐢ㄥ叆搴撳尯閰嶇疆锛堜笢渚х珯鐐瑰拰Group-001锛�", whsType);
+        } else if (whsType != null && whsType.equals(agvProperties.getWhsTypeMapping().getCacheArea())) {
+            // whs_type = 2: 缂撳瓨鍖猴紝浣跨敤瑗夸晶绔欑偣鍜孏roup-002
+            targetStations = agvProperties.getWestStations();
+            robotGroup = agvProperties.getRobotGroupWest();
+            log.info("搴撲綅whs_type={}锛屼娇鐢ㄧ紦瀛樺尯閰嶇疆锛堣タ渚х珯鐐瑰拰Group-002锛�", whsType);
+        } else {
+            // whs_type涓虹┖鎴栧叾浠栧�硷紝鏍规嵁type鍒ゆ柇锛堝吋瀹规棫閫昏緫锛�
+            if (type == 1) {
+                targetStations = agvProperties.getEastStations();
+                robotGroup = agvProperties.getRobotGroupEast();
+            } else {
+                targetStations = agvProperties.getWestStations();
+                robotGroup = agvProperties.getRobotGroupWest();
+            }
+            log.warn("搴撲綅whs_type={}鏈厤缃垨涓嶅湪鏄犲皠鑼冨洿鍐咃紝浣跨敤type={}鐨勯粯璁ら�昏緫", whsType, type);
+        }
+        
+        // 灏嗙珯鐐瑰瓧绗︿覆鍒楄〃杞崲涓烘暣鏁板垪琛�
+        List<Integer> siteIntList = targetStations.stream()
+                .map(Integer::parseInt)
+                .collect(Collectors.toList());
+        
         // 鍒ゆ柇鑳藉叆绔欑偣
         List<Integer> sites = basDevpMapper.selectList(
                 new EntityWrapper<BasDevp>()
                         .eq("canining", "Y")
-                        .in("dev_no", type == 1 ? Arrays.asList(1003, 1005, 1007) : Arrays.asList(1044, 1046, 1048))
+                        .in("dev_no", siteIntList)
         ).stream().map(BasDevp::getDevNo).collect(Collectors.toList());
 
         if (sites.isEmpty()) {
-            throw new CoolException("娌℃湁鑳藉叆绔欑偣,type锛�" + type);
+            throw new CoolException("娌℃湁鑳藉叆绔欑偣,whs_type锛�" + whsType + ",type锛�" + type);
         }
 
         // 鑾峰彇娌℃湁鍑哄簱浠诲姟鐨勭珯鐐�
@@ -228,10 +274,12 @@
                 .setTaskType("agv")
                 .setIoPri(10D)
                 .setStaNo(String.valueOf(endSite))
+                .setSourceStaNo(sourceSite) // 璁剧疆婧愮珯鐐�
+                .setInvWh(robotGroup) // 鏍规嵁whs_type璁剧疆鏈哄櫒浜虹粍
                 .setFullPlt(ioType != 10 ? "N" : "Y")// 婊℃澘锛歒
                 .setPicking("N") // 鎷f枡
                 .setExitMk("N")// 閫�鍑�
-                .setSourceLocNo(sourceSite)
+                .setSourceLocNo(locCache.getLocNo()) // 璁剧疆婧愬簱浣嶇紪鍙凤紝鐢ㄤ簬AGV fromBin
                 .setEmptyMk(ioType == 10 ? "Y" : "N")// 绌烘澘
                 .setBarcode(barcode)// 鎵樼洏鐮�
                 .setLinkMis("N")

--
Gitblit v1.9.1