From fa9329c3a9aa5c57c66cb3906d2418bdf2a393a7 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 08 四月 2024 16:28:17 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java | 74 +++++++++++++++++++++++++++++++++---- 1 files changed, 66 insertions(+), 8 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 84edc5b..d8fcd42 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 @@ -4,6 +4,7 @@ import com.zy.asrs.wcs.core.entity.Task; import com.zy.asrs.wcs.core.kernel.command.AgvCommandService; import com.zy.asrs.wcs.core.kernel.command.CraneCommandService; +import com.zy.asrs.wcs.core.kernel.command.LiftCommandService; import com.zy.asrs.wcs.core.kernel.command.ShuttleCommandService; import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; import com.zy.asrs.wcs.core.model.enums.MotionCtgType; @@ -38,13 +39,13 @@ // private ConveyorCommandService conveyorCommandService; @Autowired private CraneCommandService craneCommandService; -// @Autowired -// private LiftCommandService liftCommandService; + @Autowired + private LiftCommandService liftCommandService; @Autowired private ShuttleCommandService shuttleCommandService; - @Scheduled(cron = "0/1 * * * * ? ") - public synchronized void executeWrkMast() { +// @Scheduled(cron = "0/1 * * * * ? ") + public synchronized void executeTask() { Date now = new Date(); // ANALYZE_INBOUND for (Task task : taskService.selectByAnalyzeSts()) { @@ -60,7 +61,7 @@ continue; } - // 鏇存柊wrkMast + // 鏇存柊Task switch (TaskStsType.query(task.getTaskSts())) { case ANALYZE_INBOUND: task.setTaskSts(TaskStsType.EXECUTE_INBOUND.sts); @@ -89,7 +90,7 @@ continue; } - // 鏇存柊wrkMast + // 鏇存柊Task switch (TaskStsType.query(task.getTaskSts())) { case EXECUTE_INBOUND: task.setTaskSts(TaskStsType.COMPLETE_INBOUND.sts); @@ -171,6 +172,63 @@ // } @Scheduled(cron = "0/1 * * * * ? ") + public synchronized void executeManualTask() { + Date now = new Date(); + // ANALYZE_MANUAL + for (Task task : taskService.selectManualByAnalyzeSts()) { + Motion executingMotion = motionService.selectOfTop1(task.getUuid(), MotionStsType.EXECUTING.val(), task.getHostId()); + if (executingMotion != null) {//瀛樺湪姝e湪鎵ц鐨刴otion + continue; + } + + Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.INIT.val(), task.getHostId()); + if (null != motion) { + boolean result = this.executeMotion(motion); + if (!result) { + continue; + } + // 鏇存柊Task + switch (TaskStsType.query(task.getTaskSts())) { + case ANALYZE_MANUAL: + task.setTaskSts(TaskStsType.EXECUTE_MANUAL.sts); + break; + } + task.setUpdateTime(now); + if (!taskService.updateById(task)) { + log.error("{}鍏朵粬宸ヤ綔妗f洿鏂扮姸鎬佸け璐ワ紒", task.getTaskNo()); + } + } + } + // EXECUTE_MANUAL + for (Task task : taskService.selectManualByExecuteSts()) { + if (!motionService.hasRunningMotion(task.getUuid(), task.getHostId())) { + Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.WAITING.val(), task.getHostId()); + if (null != motion) { + boolean result = this.executeMotion(motion); + if (!result) { + continue; + } + } else { + if (motionService.selectOfTop1(task.getUuid(), MotionStsType.EXECUTING.val(), task.getHostId()) != null) { + continue; + } + + // 鏇存柊Task + switch (TaskStsType.query(task.getTaskSts())) { + case EXECUTE_MANUAL: + task.setTaskSts(TaskStsType.COMPLETE_MANUAL.sts); + break; + } + task.setUpdateTime(now); + if (!taskService.updateById(task)) { + log.error("{}浠栧伐浣滄。鏇存柊鐘舵�佸け璐ワ紒", task.getTaskNo()); + } + } + } + } + } + + @Scheduled(cron = "0/1 * * * * ? ") public void scanMotionByExecuting() { List<Motion> motionList = motionService.selectBySts(MotionStsType.EXECUTING.val()); for (Motion motion : motionList) { @@ -191,7 +249,7 @@ executeRes = shuttleCommandService.accept(motion); break; case LIFT: -// executeRes = liftCommandService.accept(motion); + executeRes = liftCommandService.accept(motion); break; case AGV: executeRes = agvCommandService.accept(motion); @@ -223,7 +281,7 @@ case CRANE: break; case LIFT: -// executeRes = liftCommandService.finish(motion); + executeRes = liftCommandService.finish(motion); break; case SHUTTLE: executeRes = shuttleCommandService.finish(motion); -- Gitblit v1.9.1