From 11c2bb226b870d2f4958c3ab2cfb0fb92b591349 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 16:10:47 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java | 78 ++++++++++++++++++++++++++++++++++-----
1 files changed, 68 insertions(+), 10 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 c4ed1af..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,14 +4,15 @@
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;
import com.zy.asrs.wcs.core.model.enums.MotionStsType;
import com.zy.asrs.wcs.core.model.enums.TaskStsType;
import com.zy.asrs.wcs.core.service.TaskService;
-import com.zy.asrs.wcs.rcs.entity.Motion;
-import com.zy.asrs.wcs.rcs.service.MotionService;
+import com.zy.asrs.wcs.core.entity.Motion;
+import com.zy.asrs.wcs.core.service.MotionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -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