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 | 65 ++++++++++++++++++++------------
1 files changed, 40 insertions(+), 25 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 44aad5b..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,12 +75,12 @@
|| 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;
}
}
- shuttleProtocol.setTaskNo(assignCommand.getTaskNo());
+ shuttleProtocol.setSyncTaskNo(assignCommand.getTaskNo());
return true;
}
return false;
@@ -111,10 +113,8 @@
return false;
}
- //鍒ゆ柇璁惧鏄惁绌洪棽
- if (!shuttleThread.isIdle(() -> {
- return shuttleProtocol.getTaskNo().equals(taskNo);
- })) {
+ //鍒ゆ柇宸ヤ綔鍙锋槸鍚︾浉鍚�
+ if (!shuttleProtocol.getTaskNo().equals(taskNo)) {
return false;
}
@@ -151,10 +151,11 @@
// 鎵樼洏椤跺崌
//鍒ゆ柇鏄惁椤跺崌鍒颁綅
if (shuttleProtocol.getHasLift()) {
- //鍒ゆ柇鏄惁鏈夌墿
- if (shuttleProtocol.getHasPallet()) {
- command.setComplete(true);
- }
+ command.setComplete(true);
+// //鍒ゆ柇鏄惁鏈夌墿
+// if (shuttleProtocol.getHasPallet()) {
+// command.setComplete(true);
+// }
}
} else if (command.getMode() == ShuttleCommandModeType.PALLET_DOWN.id) {
// 鎵樼洏涓嬮檷鍛戒护
@@ -173,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;
@@ -186,27 +187,27 @@
// 绯荤粺浠诲姟
if (assignCommand.getAuto()) {
-// if (!assignCommand.getCharge()) {
-// //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
-// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
-// }else {
-// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
-// }
+ if (!assignCommand.getCharge()) {
+ //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+ }else {
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
+ }
News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
// 鎵嬪姩浠诲姟
} else {
//鎵嬪姩妯″紡涓嶆姏鍑虹瓑寰呯姸鎬侊紝鐩存帴澶嶄綅绌洪棽鐘舵��
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
//浠诲姟鍙锋竻闆�
- shuttleProtocol.setTaskNo(0);
+ shuttleThread.setSyncTaskNo(0);
//鏍囪澶嶄綅
- shuttleProtocol.setPakMk(true);
+ shuttleThread.setPakMk(true);
News.info("鍥涘悜绌挎杞︽墜鍔ㄤ换鍔℃墽琛屽畬鎴愶紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
}
//鍒犻櫎redis
- redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo());
+ redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo());
return false;//绂佹鍐嶄笅鍙戝懡浠�
}
}
@@ -214,17 +215,32 @@
//鍙栧嚭鍛戒护
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)) {
News.error("鍥涘悜绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
return false;
}
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WORKING);
commandStep++;
//鏇存柊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;
}
@@ -234,7 +250,6 @@
if (shuttleThread == null) {
return;
}
-
ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
if (shuttleProtocol == null) {
return;
--
Gitblit v1.9.1