From 5edbc95f689813cee37ee573af48e59175ddff92 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期二, 21 一月 2025 13:37:28 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/task/AutoMoveScheduler.java |   93 ++++++++++++++++++++--------------------------
 1 files changed, 41 insertions(+), 52 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java b/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
index 406beea..2182cb5 100644
--- a/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
+++ b/src/main/java/com/zy/asrs/task/AutoMoveScheduler.java
@@ -11,7 +11,9 @@
 import com.zy.asrs.service.AgvBasDevpService;
 import com.zy.asrs.service.AgvLocMastService;
 import com.zy.asrs.service.AgvWrkMastService;
+import com.zy.asrs.task.core.ProcesTimeData;
 import com.zy.asrs.task.handler.AutoMoveHandler;
+import com.zy.asrs.utils.TimeUtils;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
 import lombok.extern.slf4j.Slf4j;
@@ -66,13 +68,7 @@
      */
     @Scheduled(cron = "0/1 * * * * ? ")
     private synchronized void execute2() {
-        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
-                .eq("wrk_sts", 22)
-                .andNew().eq("io_type", 108)
-                .andNew()
-                .eq("crn_no", 2).or().eq("crn_no", 3)
-                .orderBy("io_pri", false).orderBy("appe_time", true)
-        );
+        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 22).andNew().eq("io_type", 108).andNew().eq("crn_no", 2).or().eq("crn_no", 3).orderBy("io_pri", false).orderBy("appe_time", true));
         if (agvWrkMastList.isEmpty()) {
             return;
         }
@@ -116,12 +112,7 @@
      */
     @Scheduled(cron = "0/2 * * * * ? ")
     private void execute3() {
-        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
-                .eq("wrk_sts", 22)
-                .andNew().eq("io_type", 111)
-                .orderBy("io_pri", false)
-                .orderBy("appe_time", true)
-        );
+        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 22).andNew().eq("io_type", 111).orderBy("io_pri", false).orderBy("appe_time", true));
         if (agvWrkMastList.isEmpty()) {
             return;
         }
@@ -137,12 +128,7 @@
 
     @Scheduled(cron = "0/2 * * * * ? ")
     private void execute4() {
-        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
-                .eq("wrk_sts", 22)
-                .andNew().eq("io_type", 114)
-                .orderBy("io_pri", false)
-                .orderBy("appe_time", true)
-        );
+        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 22).andNew().eq("io_type", 114).orderBy("io_pri", false).orderBy("appe_time", true));
         if (agvWrkMastList.isEmpty()) {
             return;
         }
@@ -186,11 +172,7 @@
     @Scheduled(cron = "0/2 * * * * ? ")
     private void autoEmptyBack3() {
         // 宸ヤ綔妗d负201 涓� 鍏ュ嚭搴撶被鍨嬩负109
-        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>()
-                .eq("wrk_sts", 214)
-                .eq("loc_no", "")
-                .eq("io_type", 113)
-                .orderBy("io_pri", false));
+        List<AgvWrkMast> agvWrkMastList = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 214).eq("loc_no", "").eq("io_type", 113).orderBy("io_pri", false));
         if (agvWrkMastList.isEmpty()) {
             return;
         }
@@ -234,13 +216,9 @@
     @Scheduled(cron = "0/2 * * * * ? ")
     private void autoEmptyBack4() {
         // 鏌ヨ 涓嶄负1妤肩殑绌鸿揣鏋�
-        List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(
-                new EntityWrapper<AgvLocMast>()
-                        // TODO 鍥涙湡
-                        .eq("loc_sts", "D")
-                        .eq("loc_type1", 3)
-                        .ne("floor", 1)
-                        .ne("lve1", 1));
+        List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(new EntityWrapper<AgvLocMast>()
+                // TODO 鍥涙湡
+                .eq("loc_sts", "D").eq("loc_type1", 3).ne("floor", 1).ne("lev1", 1));
         if (agvLocMasts.isEmpty()) {
             return;
         }
@@ -255,16 +233,37 @@
 
 
     /**
-     // TODO 鍥涙湡
+     * 灏嗕簩鍘傜殑6绫诲瀷鐨勭┖璐ф灦璋冩嫧鍥炲惛濉戜簩妤�
      */
+    // TODO 鍥涙湡
     @Scheduled(cron = "0/2 * * * * ? ")
     private void autoEmptyBackSiqi() {
+        // 鏌ヨ6绫诲瀷绌鸿揣鏋惰繑鍥炵殑鎵ц鏃堕棿鐐�
+        Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "RETURN_6_TIME"));
+        if (config != null && !Cools.isEmpty(config.getValue())) {
+            boolean flag = false;
+            try {
+                // 鍒ゆ柇鏄惁鍦ㄦ墽琛屾椂闂村唴
+                ProcesTimeData procesTimeData = JSONObject.parseObject(config.getValue(), ProcesTimeData.class);
+                if (procesTimeData != null && TimeUtils.between(procesTimeData)) {
+                    flag = true;
+                }
+            } catch (Exception e) {
+                log.error("6绫诲瀷绌鸿揣鏋惰繑鍥炵殑鎵ц鏃堕棿鐐硅В鏋愬紓甯革細===銆嬪紓甯稿師鍥狅細" + e.getMessage());
+                flag = true;
+            }
+            if (flag) {
+                executeLocType6();
+            }
+        } else {
+            executeLocType6();
+        }
+    }
+
+
+    private void executeLocType6() {
         // 鏌ヨ 浜屽巶鐨勭殑鍗婃垚鍝佺澹崇被鍨嬬殑绌鸿揣鏋�
-        List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(
-                new EntityWrapper<AgvLocMast>()
-                        .eq("loc_sts", "D")
-                        .eq("loc_type1", 6)
-                        .eq("floor", 2));
+        List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(new EntityWrapper<AgvLocMast>().eq("loc_sts", "D").eq("loc_type1", 6).eq("floor", 2));
         if (agvLocMasts.isEmpty()) {
             return;
         }
@@ -276,7 +275,6 @@
             }
         }
     }
-
 
     private boolean determineFloorConnection(Integer floor) {
         try {
@@ -304,10 +302,7 @@
      */
     @Scheduled(cron = "0/2 * * * * ? ")
     private void autoEmptyBack5() {
-        List<AgvBasDevp> agvBasDevps = agvBasDevpService.selectList(new EntityWrapper<AgvBasDevp>()
-                .ne("floor", 1)
-                .eq("loc_sts", "F")
-                .like("dev_no", "DB"));
+        List<AgvBasDevp> agvBasDevps = agvBasDevpService.selectList(new EntityWrapper<AgvBasDevp>().ne("floor", 1).eq("loc_sts", "F").like("dev_no", "DB"));
         if (agvBasDevps.isEmpty()) {
             return;
         }
@@ -326,10 +321,7 @@
      */
     @Scheduled(cron = "0/2 * * * * ? ")
     private void autoEmptyBack6() {
-        List<AgvBasDevp> agvBasDevps = agvBasDevpService.selectList(new EntityWrapper<AgvBasDevp>()
-                .eq("floor", 1)
-                .eq("loc_sts", "F")
-                .like("dev_no", "DB"));
+        List<AgvBasDevp> agvBasDevps = agvBasDevpService.selectList(new EntityWrapper<AgvBasDevp>().eq("floor", 1).eq("loc_sts", "F").like("dev_no", "DB"));
         if (agvBasDevps.isEmpty()) {
             return;
         }
@@ -374,12 +366,7 @@
                     return;
                 }
 
-                List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(
-                        new EntityWrapper<AgvLocMast>()
-                                .eq("floor", 1)
-                                .eq("lev1", 1)
-                                .eq("loc_sts", "F")
-                                .eq("loc_type1", 3));
+                List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(new EntityWrapper<AgvLocMast>().eq("floor", 1).eq("lev1", 1).eq("loc_sts", "F").eq("loc_type1", 3));
                 if (agvLocMasts.isEmpty()) {
                     return;
                 }
@@ -393,4 +380,6 @@
             }
         }
     }
+
+
 }

--
Gitblit v1.9.1