From 4ac5ff223ee7757b55d86b0f34b74152874d68c9 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 23 九月 2024 15:56:11 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
index 782d0e6..82408aa 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
@@ -1,5 +1,6 @@
 package com.zy.asrs.wcs.core.timer;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wcs.core.entity.Task;
 import com.zy.asrs.wcs.core.kernel.command.*;
@@ -50,6 +51,14 @@
             if (executingMotion != null) {//瀛樺湪姝e湪鎵ц鐨刴otion
                 if (executingMotion.getSync() == 1) {//褰撳墠鎵ц涓殑鍔ㄤ綔鏄悓姝ュ姩浣滐紝绛夊緟鎵ц瀹屾垚鍚庡啀鎵ц涓嬩竴涓姩浣�
                     continue;
+                }
+
+                //寮傛鍔ㄤ綔锛屽彧鍏佽涓嬩竴鏉″姩浣滆鎵ц
+                Motion nextMotion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getUuid, executingMotion.getUuid()).eq(Motion::getPriority, executingMotion.getPriority() - 1));
+                if (nextMotion != null) {
+                    if (!(nextMotion.getMotionSts() == MotionStsType.INIT.val() || nextMotion.getMotionSts() == MotionStsType.WAITING.val())) {
+                        continue;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣�
+                    }
                 }
             }
 
@@ -117,6 +126,14 @@
                 if (executingMotion.getSync() == 1) {//褰撳墠鎵ц涓殑鍔ㄤ綔鏄悓姝ュ姩浣滐紝绛夊緟鎵ц瀹屾垚鍚庡啀鎵ц涓嬩竴涓姩浣�
                     continue;
                 }
+
+                //寮傛鍔ㄤ綔锛屽彧鍏佽涓嬩竴鏉″姩浣滆鎵ц
+                Motion nextMotion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getUuid, executingMotion.getUuid()).eq(Motion::getPriority, executingMotion.getPriority() - 1));
+                if (nextMotion != null) {
+                    if (!(nextMotion.getMotionSts() == MotionStsType.INIT.val() || nextMotion.getMotionSts() == MotionStsType.WAITING.val())) {
+                        continue;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣�
+                    }
+                }
             }
 
             Motion motion = motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.INIT.val(), taskCharge.getHostId());
@@ -182,6 +199,14 @@
                 if (executingMotion.getSync() == 1) {//褰撳墠鎵ц涓殑鍔ㄤ綔鏄悓姝ュ姩浣滐紝绛夊緟鎵ц瀹屾垚鍚庡啀鎵ц涓嬩竴涓姩浣�
                     continue;
                 }
+
+                //寮傛鍔ㄤ綔锛屽彧鍏佽涓嬩竴鏉″姩浣滆鎵ц
+                Motion nextMotion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getUuid, executingMotion.getUuid()).eq(Motion::getPriority, executingMotion.getPriority() - 1));
+                if (nextMotion != null) {
+                    if (!(nextMotion.getMotionSts() == MotionStsType.INIT.val() || nextMotion.getMotionSts() == MotionStsType.WAITING.val())) {
+                        continue;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣�
+                    }
+                }
             }
 
             Motion motion = motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.INIT.val(), taskCharge.getHostId());
@@ -241,6 +266,14 @@
                 if (executingMotion.getSync() == 1) {//褰撳墠鎵ц涓殑鍔ㄤ綔鏄悓姝ュ姩浣滐紝绛夊緟鎵ц瀹屾垚鍚庡啀鎵ц涓嬩竴涓姩浣�
                     continue;
                 }
+
+                //寮傛鍔ㄤ綔锛屽彧鍏佽涓嬩竴鏉″姩浣滆鎵ц
+                Motion nextMotion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getUuid, executingMotion.getUuid()).eq(Motion::getPriority, executingMotion.getPriority() - 1));
+                if (nextMotion != null) {
+                    if (!(nextMotion.getMotionSts() == MotionStsType.INIT.val() || nextMotion.getMotionSts() == MotionStsType.WAITING.val())) {
+                        continue;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣�
+                    }
+                }
             }
 
             Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.INIT.val(), task.getHostId());
@@ -300,6 +333,14 @@
                 if (executingMotion.getSync() == 1) {//褰撳墠鎵ц涓殑鍔ㄤ綔鏄悓姝ュ姩浣滐紝绛夊緟鎵ц瀹屾垚鍚庡啀鎵ц涓嬩竴涓姩浣�
                     continue;
                 }
+
+                //寮傛鍔ㄤ綔锛屽彧鍏佽涓嬩竴鏉″姩浣滆鎵ц
+                Motion nextMotion = motionService.getOne(new LambdaQueryWrapper<Motion>().eq(Motion::getUuid, executingMotion.getUuid()).eq(Motion::getPriority, executingMotion.getPriority() - 1));
+                if (nextMotion != null) {
+                    if (!(nextMotion.getMotionSts() == MotionStsType.INIT.val() || nextMotion.getMotionSts() == MotionStsType.WAITING.val())) {
+                        continue;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣�
+                    }
+                }
             }
 
             Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.INIT.val(), task.getHostId());

--
Gitblit v1.9.1