From 20c607eaa0d2e8e34ab08306c003da4de4773c2c Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 08 六月 2024 12:40:29 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 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 5b7672b..c4cb96a 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
@@ -9,6 +9,7 @@
 import com.zy.asrs.common.utils.HttpHandler;
 import com.zy.asrs.framework.common.Cools;
 import com.zy.asrs.framework.common.SnowflakeIdWorker;
+import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wcs.core.domain.dto.MatDto;
 import com.zy.asrs.wcs.core.domain.dto.RedisMapDto;
 import com.zy.asrs.wcs.core.domain.dto.StaDto;
@@ -440,7 +441,7 @@
     /**
      * 鍑哄簱 ====>> 鍚屼竴鏃堕棿涓�鍙扮┛姊溅鍙兘鏈変竴涓嚭搴撲换鍔�
      */
-    public synchronized void generateOutboundWrkMast() {
+    public synchronized void analyzeOutBoundTask() {
         List<Task> tasks = taskService.selectPakOut();
         if (tasks.isEmpty()) {
             return;
@@ -476,6 +477,23 @@
 //                    continue;//娴呭簱浣嶅瓨鍦ㄦ湭鎵ц浠诲姟
 //                }
 
+                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 (Cools.isEmpty(motionList)) {
@@ -495,6 +513,25 @@
         }
     }
 
+    // 瑙f瀽灏忚溅绉诲姩宸ヤ綔妗�
+    public synchronized void analyzeMoveTask() {
+        for (Task task : taskService.selectWaitAnalyzeMoveTask()) {
+            // generate motion list
+            List<Motion> motionList = analyzeService.generateMotion(task);
+            if (motionList.isEmpty()) {
+                continue;
+            }
+            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()));
+
+            // 鏇存柊宸ヤ綔涓绘。
+            task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts); // 宸ヤ綔鐘舵��
+            task.setUpdateTime(new Date());
+            if (!taskService.updateById(task)) {
+                News.error("鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", task.getTaskNo());
+            }
+        }
+    }
+
     /**
      * 鍥涘悜绌挎杞︾數閲忔娴� ===>> 鍙戣捣鍏呯數
      */

--
Gitblit v1.9.1