From 15b5002fd412a5d33be5d5c6deb63b3d02c77c41 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期二, 23 九月 2025 14:35:39 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/command/LiftCommand.java | 10 +++++
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java | 11 +++--
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 16 +++++++-
src/main/java/com/zy/core/action/LiftAction.java | 6 +-
src/main/java/com/zy/core/enums/RedisKeyType.java | 2 +
src/main/java/com/zy/core/thread/impl/NyLiftThread.java | 28 ++++++++++++-
6 files changed, 60 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index e1d18d0..d307a5c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1666,7 +1666,13 @@
int targetLev = Utils.getLev(shuttleProtocol.getCurrentLocNo());
if (object == null || liftProtocol.getLev() != targetLev) {
//鑾峰彇鎻愬崌鏈哄懡浠�
- LiftCommand liftCommand = liftThread.getMoveCommand(wrkMast.getWrkNo(), liftProtocol.getLev(), targetLev);
+ LiftStaProtocol startSta = LiftUtils.getLiftStaByLev(liftProtocol.getLiftNo(), liftProtocol.getLev());
+ LiftStaProtocol targetSta = LiftUtils.getLiftStaByLev(liftProtocol.getLiftNo(), targetLev);
+ if (startSta == null || targetSta == null) {
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙锋彁鍗囨満锛岀珯鐐规暟鎹笉瀛樺湪", wrkMast.getWrkNo(), wrkMast.getLiftNo());
+ return false;
+ }
+ LiftCommand liftCommand = liftThread.getMoveCommand(commonService.getWorkNo(WrkIoType.PREVIEW_LIFT_MOVE.id), startSta.getSiteId(), targetSta.getSiteId());
ArrayList<LiftCommand> commands = new ArrayList<>();
commands.add(liftCommand);
@@ -1680,6 +1686,12 @@
liftAction.assignWork(wrkMast.getLiftNo(), assignCommand);
News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}鍙锋彁鍗囨満鍦▄}灞傦紝鎻愬崌鏈轰笉鍦ㄥ皬杞﹀眰锛岃皟搴︾Щ鍔ㄤ腑", wrkMast.getWrkNo(), liftProtocol.getLev(), wrkMast.getLiftNo());
redisUtil.set(RedisKeyType.LIFT_MOVE_TO_SHUTTLE_LIMIT.key + wrkMast.getWrkNo(), "lift_moving", 60 * 3);
+ redisUtil.set(RedisKeyType.TASK_RUN_LIMIT.key + wrkMast.getWrkNo(), "lock", 8);
+ return false;
+ }
+
+ Object limitObj = redisUtil.get(RedisKeyType.TASK_RUN_LIMIT.key + wrkMast.getWrkNo());
+ if (limitObj != null) {
return false;
}
@@ -1756,7 +1768,7 @@
}
//鑾峰彇鎻愬崌鏈哄懡浠�
- LiftCommand liftCommand = liftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getLev(), liftSta.getLev());
+ LiftCommand liftCommand = liftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getSiteId(), liftSta.getSiteId());
ArrayList<LiftCommand> commands = new ArrayList<>();
commands.add(liftCommand);
diff --git a/src/main/java/com/zy/core/action/LiftAction.java b/src/main/java/com/zy/core/action/LiftAction.java
index 81a20b7..0626be0 100644
--- a/src/main/java/com/zy/core/action/LiftAction.java
+++ b/src/main/java/com/zy/core/action/LiftAction.java
@@ -129,15 +129,15 @@
LiftCommand lastCommand = commands.get(commandStep - 1);
if (lastCommand.getMode() == LiftTaskModeType.PICK_PUT.id) {
- if (liftProtocol.getLev() == lastCommand.getPut()) {
+ if (liftProtocol.getLev() == lastCommand.getPutLev()) {
lastCommand.setComplete(true);
}
} else if (lastCommand.getMode() == LiftTaskModeType.SHUTTLE_SWITCH.id) {
- if (liftProtocol.getLev() == lastCommand.getPut()) {
+ if (liftProtocol.getLev() == lastCommand.getPutLev()) {
lastCommand.setComplete(true);
}
} else if (lastCommand.getMode() == LiftTaskModeType.MOVE.id) {
- if (liftProtocol.getLev() == lastCommand.getPut()) {
+ if (liftProtocol.getLev() == lastCommand.getPutLev()) {
lastCommand.setComplete(true);
}
}
diff --git a/src/main/java/com/zy/core/enums/RedisKeyType.java b/src/main/java/com/zy/core/enums/RedisKeyType.java
index 5724567..4b69139 100644
--- a/src/main/java/com/zy/core/enums/RedisKeyType.java
+++ b/src/main/java/com/zy/core/enums/RedisKeyType.java
@@ -24,6 +24,8 @@
//鎻愬崌鏈虹Щ鍔ㄨ嚦灏忚溅灞傞鐜�
LIFT_MOVE_TO_SHUTTLE_LIMIT("lift_move_to_shuttle_LIMIT_"),
+ //浠诲姟杩愯闄愬埗
+ TASK_RUN_LIMIT("task_run_limit_"),
//浜ょ淇℃伅
TRAFFIC_CONTROL_MAP("traffic_control_map"),
diff --git a/src/main/java/com/zy/core/model/command/LiftCommand.java b/src/main/java/com/zy/core/model/command/LiftCommand.java
index e3d5fd2..44c24a5 100644
--- a/src/main/java/com/zy/core/model/command/LiftCommand.java
+++ b/src/main/java/com/zy/core/model/command/LiftCommand.java
@@ -30,11 +30,21 @@
private Integer pick;
/**
+ * 鍙栬揣灞�
+ */
+ private Integer pickLev;
+
+ /**
* 鏀捐揣鏁版嵁
*/
private Integer put;
/**
+ * 鏀捐揣灞�
+ */
+ private Integer putLev;
+
+ /**
* 鍛戒护鏄惁瀹屾垚,榛樿false鏈畬鎴�
*/
private Boolean complete = false;
diff --git a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
index d531239..1af1ca3 100644
--- a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
@@ -3,13 +3,10 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
-import com.zy.asrs.entity.BasLift;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.DeviceDataLog;
-import com.zy.asrs.service.BasLiftService;
import com.zy.asrs.service.DeviceDataLogService;
import com.zy.asrs.utils.Utils;
import com.zy.common.ExecuteSupport;
@@ -395,6 +392,7 @@
|| this.liftProtocol.getPlcTaskNo() == null
|| this.liftProtocol.getProtocolStatus() == null
|| this.liftProtocol.getModel() == null
+ || this.liftProtocol.getDeviceStatus() == null
|| this.liftProtocol.getErrorCode() == null
|| this.liftProtocol.getExtend() == null
) {
@@ -407,6 +405,7 @@
// && this.liftProtocol.getPlcTaskNo() == 0
&& this.liftProtocol.getTaskNo() == 0
&& this.liftProtocol.getModel() == 2
+ && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id
&& this.liftProtocol.getErrorCode() == 0
&& !extend.getFrontOverrun()
&& !extend.getBackOverrun()
@@ -434,6 +433,7 @@
if (this.liftProtocol.getProtocolStatus() == null
|| this.liftProtocol.getModel() == null
+ || this.liftProtocol.getDeviceStatus() == null
|| this.liftProtocol.getErrorCode() == null
|| this.liftProtocol.getExtend() == null
) {
@@ -444,6 +444,7 @@
boolean res = this.liftProtocol.getProtocolStatus() == LiftProtocolStatusType.IDLE.id
&& this.liftProtocol.getModel() == 2
+ && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id
&& this.liftProtocol.getErrorCode() == 0
&& !extend.getFrontOverrun()
&& !extend.getBackOverrun()
@@ -495,6 +496,10 @@
command.setPick(pick);
command.setPut(put);
+ LiftStaProtocol pickSta = findSta(pick);
+ LiftStaProtocol putSta = findSta(put);
+ command.setPickLev(pickSta.getLev());
+ command.setPutLev(putSta.getLev());
return command;
}
@@ -507,6 +512,10 @@
command.setPick(pick);
command.setPut(put);
+ LiftStaProtocol pickSta = findSta(pick);
+ LiftStaProtocol putSta = findSta(put);
+ command.setPickLev(pickSta.getLev());
+ command.setPutLev(putSta.getLev());
return command;
}
@@ -519,6 +528,10 @@
command.setPick(pick);
command.setPut(put);
+ LiftStaProtocol pickSta = findSta(pick);
+ LiftStaProtocol putSta = findSta(put);
+ command.setPickLev(pickSta.getLev());
+ command.setPutLev(putSta.getLev());
return command;
}
@@ -643,6 +656,15 @@
}
}
+ private LiftStaProtocol findSta(Integer staNo) {
+ for (LiftStaProtocol liftStaProtocol : this.liftStaProtocols) {
+ if (liftStaProtocol.getSiteId().equals(staNo)) {
+ return liftStaProtocol;
+ }
+ }
+ return null;
+ }
+
/**
* 鎵╁睍瀛楁
*/
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
index 44f6187..1ac69f0 100644
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -1055,11 +1055,12 @@
Integer taskId = getTaskId();
HashMap<String, Object> body = new HashMap<>();
- if (moveIn) {
- body.put("requestType", "intoLift");//杩涙彁鍗囨満
- } else {
- body.put("requestType", "outLift");//鍑烘彁鍗囨満
- }
+// if (moveIn) {
+// body.put("requestType", "intoLift");//杩涙彁鍗囨満
+// } else {
+// body.put("requestType", "outLift");//鍑烘彁鍗囨満
+// }
+ body.put("requestType", "move");//绉诲姩鍛戒护
body.put("taskId", taskId);//TaskID闇�瑕侀殢鏈�
body.put("path", path);
request.setBody(body);
--
Gitblit v1.9.1