From 9f43ee66e8fa2e0d02945f4bdd40d9c3a53a4bd7 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期六, 24 一月 2026 13:41:13 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
index 06bceca..a40715c 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
@@ -11,7 +11,9 @@
 import com.vincent.rsf.server.manager.enums.LocStsType;
 import com.vincent.rsf.server.manager.enums.PakinIOStatus;
 import com.vincent.rsf.server.manager.enums.StationTypeEnum;
+import com.vincent.rsf.server.manager.enums.TaskType;
 import com.vincent.rsf.server.manager.service.*;
+import com.vincent.rsf.server.manager.service.impl.DeviceSiteServiceImpl;
 import com.vincent.rsf.server.manager.utils.LocManageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -36,6 +38,8 @@
     private TaskService taskService;
     @Autowired
     private BasContainerService basContainerService;
+    @Autowired
+    private DeviceSiteServiceImpl deviceSiteService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -56,6 +60,14 @@
             return R.error("鏉$爜鏈壘鍒板搴旇鍒�");
         }
         return R.ok();
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean AGVBindAndInTaskStart(String barcode, String sta) {
+        //楠岃瘉鏉$爜
+        checkStaStatus(barcode,sta);
+        return true;
     }
 
     @Override
@@ -98,17 +110,26 @@
         String sta = waitPakinPda.getStaNo();
         String area = waitPakinPda.getArea();
         if (Cools.isEmpty(sta)) {
-            throw new CoolException("鎺ラ┏浣嶆潯鐮佷笉鑳戒负绌�");
+            throw new CoolException("璧风偣涓嶈兘涓虹┖");
         }
         if (Cools.isEmpty(area)) {
             throw new CoolException("鐩爣搴撳尯涓嶈兘涓虹┖");
         }
+
+        DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
+                .eq(DeviceSite::getSite, sta)
+                .eq(DeviceSite::getAreaIdEnd, Long.parseLong(area))
+                .eq(DeviceSite::getType, TaskType.TASK_TYPE_IN.type).last("limit 1"));
+        if (Cools.isEmpty(deviceSite)) {
+            throw new CoolException("鏃犲彲鐢ㄨ矾寰勶紒锛�");
+        }
+
         BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                 .eq(BasStation::getStationName, sta)
                 .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
         );
         if (Cools.isEmpty(basStation)) {
-            throw new CoolException("鏈壘鍒版帴椹崇珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
+            throw new CoolException("鏈壘鍒拌捣鐐圭珯鐐逛俊鎭紝璇锋鏌ョ珯鐐圭姸鎬�");
         }
         if (Cools.isEmpty(basStation.getBarcode())) {
             throw new CoolException("鏁版嵁閿欒锛屾帴椹崇珯鏃犳潯鐮佷俊鎭�");
@@ -122,7 +143,7 @@
         }
         String targetLoc = LocManageUtil.getTargetLoc(Long.parseLong(area));
 
-        taskService.generateAGVTasks(waitPakin, targetLoc, sta, loginUserId);
+        taskService.generateAGVTasks(waitPakin, targetLoc, sta, deviceSite.getTarget(),loginUserId);
 
         basStation.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
         if (!basStationService.updateById(basStation)) {
@@ -236,15 +257,9 @@
             throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
         }
         if (Cools.isEmpty(sta)) {
-            throw new CoolException("鎺ラ┏浣嶆潯鐮佷笉鑳戒负绌�");
+            throw new CoolException("绔欑偣淇℃伅涓嶈兘涓虹┖");
         }
-        WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
-                .eq(WaitPakin::getBarcode, barcode)
-                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)
-        );
-        if (Cools.isEmpty(waitPakin)) {
-            throw new CoolException("瀹瑰櫒鐮佹湭鎵惧埌缁勬墭淇℃伅,璇锋鏌ョ粍鎵樼姸鎬�");
-        }
+
         BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                         .eq(BasStation::getBarcode, barcode)
                 , false
@@ -257,9 +272,6 @@
         );
         if (Cools.isEmpty(basStation)) {
             throw new CoolException("鏈壘鍒扮珯鐐逛俊鎭�");
-        }
-        if (!basStation.getUseStatus().equals("O")) {
-            throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
         }
         if (!Cools.isEmpty(basStation.getContainerType())) {
             List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class);
@@ -275,9 +287,6 @@
                     break;  // 鎵惧埌鍖归厤鐨勫氨閫�鍑哄惊鐜�
                 }
             }
-//            boolean matches = containers.stream()
-//                    .map(BasContainer::getCodeType)
-//                    .anyMatch(codeType -> barcode.matches(codeType));
             if (!matches) {
                 throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
             }

--
Gitblit v1.9.1