From 11da5829433e788d8f901ee5cd910d5923f0806a Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 13 六月 2024 09:51:37 +0800
Subject: [PATCH] #小车地图严格模式

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
index e3860e7..bc42ae0 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -18,6 +18,7 @@
 import com.zy.asrs.wcs.core.model.MapNode;
 import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.core.model.enums.MotionStsType;
+import com.zy.asrs.wcs.core.model.enums.TaskCtgType;
 import com.zy.asrs.wcs.core.model.enums.TaskStsType;
 import com.zy.asrs.wcs.core.service.*;
 import com.zy.asrs.wcs.core.utils.RedisUtil;
@@ -180,7 +181,7 @@
 
                         //鑾峰彇鍏ュ簱浠诲姟绫诲瀷
                         TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
-                                .eq(TaskCtg::getFlag, "IN")
+                                .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.IN))
                                 .eq(TaskCtg::getStatus, 1));
 
                         // 鍒ゆ柇閲嶅宸ヤ綔妗�
@@ -422,6 +423,23 @@
     // 瑙f瀽鍏ュ簱宸ヤ綔妗�
     public synchronized void analyzeInBoundTask() {
         for (Task task : taskService.selectWaitAnalyzeInBoundTask()) {
+            if (Cools.isEmpty(task.getShuttleNo())) {
+                //鍒嗛厤灏忚溅
+                //鎼滅储绌洪棽杞�
+                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
+                if (shuttleThread == null) {
+                    News.info("{}浠诲姟鏈壘鍒扮┖闂茬┛姊溅", task.getTaskNo());
+                    continue;
+                }
+
+                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//淇濆瓨绌挎杞﹀彿
+                task.setUpdateTime(new Date());
+                if (!taskService.updateById(task)) {
+                    News.info("{}浠诲姟鏇存柊绌挎杞﹀彿澶辫触", task.getTaskNo());
+                }
+                continue;
+            }
+
             // generate motion list
             List<Motion> motionList = analyzeService.generateMotion(task);
             if (motionList.isEmpty()) {
@@ -516,6 +534,23 @@
     // 瑙f瀽灏忚溅绉诲姩宸ヤ綔妗�
     public synchronized void analyzeMoveTask() {
         for (Task task : taskService.selectWaitAnalyzeMoveTask()) {
+            if (Cools.isEmpty(task.getShuttleNo())) {
+                //鍒嗛厤灏忚溅
+                //鎼滅储绌洪棽杞�
+                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
+                if (shuttleThread == null) {
+                    News.info("{}浠诲姟鏈壘鍒扮┖闂茬┛姊溅", task.getTaskNo());
+                    continue;
+                }
+
+                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//淇濆瓨绌挎杞﹀彿
+                task.setUpdateTime(new Date());
+                if (!taskService.updateById(task)) {
+                    News.info("{}浠诲姟鏇存柊绌挎杞﹀彿澶辫触", task.getTaskNo());
+                }
+                continue;
+            }
+
             // generate motion list
             List<Motion> motionList = analyzeService.generateMotion(task);
             if (motionList.isEmpty()) {
@@ -546,7 +581,7 @@
 
         //鑾峰彇鍏呯數浠诲姟绫诲瀷
         TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
-                .eq(TaskCtg::getFlag, "CHARGE")
+                .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.CHARGE))
                 .eq(TaskCtg::getStatus, 1));
         if (taskCtg == null) {
             return;
@@ -690,7 +725,7 @@
 
         //鑾峰彇杩佺Щ浠诲姟绫诲瀷
         TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
-                .eq(TaskCtg::getFlag, "MOVE")
+                .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.MOVE))
                 .eq(TaskCtg::getStatus, 1));
         if (taskCtg == null) {
             return;

--
Gitblit v1.9.1