From e29a9f245ff4e57a40bbab1c0acc3cbc31d3ac2b Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期一, 21 四月 2025 11:13:13 +0800 Subject: [PATCH] #出库找待机位优化 --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 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..537e3a8 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.*; @@ -40,6 +41,8 @@ private LiftCommandService liftCommandService; @Autowired private ShuttleCommandService shuttleCommandService; + @Autowired + private MapCommandService mapCommandService; @Scheduled(cron = "0/1 * * * * ? ") public synchronized void executeTask() { @@ -50,6 +53,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 +128,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 +201,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 +268,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()); @@ -299,6 +334,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;//涓嬩竴鏉″姩浣滃凡缁忚鎵ц锛屼笉鍏佽鍐嶆墽琛屽悗缁姩浣� + } } } @@ -375,6 +418,9 @@ case AGV: executeRes = agvCommandService.accept(motion); break; + case MAP: + executeRes = mapCommandService.accept(motion); + break; default: break; } @@ -410,6 +456,9 @@ case CONVEYOR: executeRes = conveyorCommandService.finish(motion); break; + case MAP: + executeRes = mapCommandService.finish(motion); + break; default: break; } -- Gitblit v1.9.1