From 89c7f6e5bcc21b0e8f83a2bc6d680e2ffe431e6f Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 13 一月 2025 09:38:29 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java
index a22e804..1542f2f 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java
@@ -73,8 +73,8 @@
 
             if (funcSta.getType().equals(FuncStaType.CHARGE.toString())) {
                 // if the type of this funSta is charge and the existing agv is in charge status, then that means this funSta is occupied
-                if (null != agv) {
-                    AgvModel agvModel = agvModelService.getById(agv.getAgvModel());
+                if (null != agv && !agv.getId().equals(agvId)) {
+                    AgvModel agvModel = agvModelService.getByAgvId(agv.getId());
                     AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
                     if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) {
                         if (agvDetail.getVol() < agvModel.getQuaBattery()) {
@@ -96,7 +96,7 @@
 
                 // if there is a running task whose destination is this funSta, then that means this funSta is occupied
                 if (0 < taskService.count(new LambdaQueryWrapper<Task>()
-                        .eq(Task::getTaskType, TaskTypeType.TO_CHARGE.val())
+                        .in(Task::getTaskType, TaskTypeType.TO_STANDBY.val(), TaskTypeType.TO_CHARGE.val())
                         .in(Task::getTaskSts, TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val())
                         .eq(Task::getDestCode, code)
                 )) {
@@ -110,7 +110,11 @@
                 if (null == agv) {
                     // if there is a running task whose destination is this funSta, then that means this funSta is occupied
                     if (0 < taskService.count(new LambdaQueryWrapper<Task>()
-                            .eq(Task::getTaskType, TaskTypeType.TO_STANDBY.val())
+                            .in(Task::getTaskType
+                                    , TaskTypeType.TO_STANDBY.val()
+                                    , TaskTypeType.TO_CHARGE.val()
+                                    , TaskTypeType.MOVE.val()
+                            )
                             .in(Task::getTaskSts, TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val())
                             .eq(Task::getDestCode, code)
                     )) {
@@ -118,11 +122,14 @@
                     }
 
                 } else {
-                    // if there is an agv on the code of this funSta, should we let this agv leave?
-                    // we need to judge whether the agv went to this funSta based on a task which in GO_STANDBY type
+                    if (!agv.getId().equals(agvId)) {
+                        // if there is an agv on the code of this funSta, should we let this agv leave?
+                        // we need to judge whether the agv went to this funSta based on a task which in GO_STANDBY type
 
 //                    Task latestTaskByAgv = taskService.findLatestTask(existAgv.getId());
-                    return false;
+                        return false;
+                    }
+
                 }
             }
 
@@ -182,7 +189,7 @@
 
                 agv = agvService.findByPosition(funcSta.getCode());
                 if (null != agv) {
-                    AgvModel agvModel = agvModelService.getById(agv.getAgvModel());
+                    AgvModel agvModel = agvModelService.getByAgvId(agv.getId());
                     AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
                     if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) {
                         return false;

--
Gitblit v1.9.1