From f09b972bb7adf8d4fd75fcb87c85973e493432a8 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 30 四月 2024 11:14:20 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
index 791709f..6c02d01 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -4,12 +4,14 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.entity.Task;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
+import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType;
import com.zy.asrs.wcs.core.service.BasShuttleService;
@@ -26,12 +28,12 @@
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
-import org.aspectj.apache.bcel.generic.RET;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
@Component
public class ShuttleAction {
@@ -63,7 +65,7 @@
ShuttleRedisCommand redisCommand = new ShuttleRedisCommand();
redisCommand.setShuttleNo(assignCommand.getShuttleNo());//鍥涘悜绌挎杞﹀彿
- redisCommand.setWrkNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
+ redisCommand.setTaskNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
redisCommand.setCommandStep(0);//鍛戒护鎵ц姝ュ簭
redisCommand.setAssignCommand(assignCommand);//鍛戒护
//浠诲姟鏁版嵁淇濆瓨鍒皉edis
@@ -73,7 +75,7 @@
|| assignCommand.getTaskMode() == ShuttleTaskModeType.MOVE_LOC_NO.id
|| assignCommand.getTaskMode() == ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id) {
//涓嬪彂琛岄┒璺緞
- boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getTaskNo());
+ boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getDeviceTaskNo());
if (!result) {
return false;
}
@@ -110,16 +112,6 @@
if (shuttleProtocol == null) {
return false;
}
-
- //鍒ゆ柇璁惧鏄惁绌洪棽
- if (!shuttleThread.isDeviceIdle()) {
- return false;
- }
-// if (!shuttleThread.isIdle(() -> {
-// return shuttleProtocol.getTaskNo().equals(taskNo);
-// })) {
-// return false;
-// }
//鍒ゆ柇宸ヤ綔鍙锋槸鍚︾浉鍚�
if (!shuttleProtocol.getTaskNo().equals(taskNo)) {
@@ -182,7 +174,7 @@
}
// 鏇存柊redis鏁版嵁
- redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
if (!command.getComplete()) {
return false;
@@ -215,13 +207,27 @@
}
//鍒犻櫎redis
- redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo());
+ redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo());
return false;//绂佹鍐嶄笅鍙戝懡浠�
}
}
//鍙栧嚭鍛戒护
ShuttleCommand command = commands.get(commandStep);
+
+ Integer mode = command.getMode();
+ //鍒ゆ柇璁惧鏄惁绌洪棽
+ if (!shuttleThread.isDeviceIdle(new ExecuteSupport() {
+ @Override
+ public Boolean judgement() {
+ if (ShuttleCommandModeType.CHARGE_CLOSE.id.equals(mode)) {//鍏抽棴鍏呯數motion
+ return false;//涓嶉渶瑕佸垽鏂姸鎬�
+ }
+ return true;//闇�瑕佸垽鏂姸鎬�
+ }
+ })) {
+ return false;
+ }
// 涓嬪彂鍛戒护
if (!write(command, device)) {
@@ -234,7 +240,7 @@
//鏇存柊redis鏁版嵁
redisCommand.setCommandStep(commandStep);
//浠诲姟鏁版嵁淇濆瓨鍒皉edis
- redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
return true;
}
@@ -244,7 +250,6 @@
if (shuttleThread == null) {
return;
}
-
ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
if (shuttleProtocol == null) {
return;
--
Gitblit v1.9.1