From fefdabbcd1504a55d8ad10ecf6cfc36cc7b1b1b6 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 21 三月 2026 15:36:26 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java | 52 +++++++++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
index a7c3712..485ef91 100644
--- a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -36,7 +36,7 @@
@Component
public class StationOperateProcessUtils {
private static final int LOOP_LOAD_RESERVE_EXPIRE_SECONDS = 120;
- private static final int OUT_ORDER_DISPATCH_LIMIT_SECONDS = 10;
+ private static final int OUT_ORDER_DISPATCH_LIMIT_SECONDS = 2;
private static final int STATION_IDLE_RECOVER_SECONDS = 10;
private static final int STATION_IDLE_RECOVER_LIMIT_SECONDS = 10;
private static final int STATION_IDLE_TRACK_EXPIRE_SECONDS = 60 * 60;
@@ -312,34 +312,27 @@
for (WrkMast wrkMast : wrkMasts) {
Integer wrkNo = wrkMast.getWrkNo();
Integer targetStaNo = wrkMast.getStaNo();
+ if (wrkNo == null || targetStaNo == null) {
+ continue;
+ }
boolean complete = false;
+ Integer targetDeviceNo = null;
BasStation basStation = basStationService.getOne(new QueryWrapper<BasStation>().eq("station_id", targetStaNo));
- if (basStation == null) {
- continue;
- }
-
- StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
- if (stationThread == null) {
- continue;
- }
-
- Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
- StationProtocol stationProtocol = statusMap.get(basStation.getStationId());
- if (stationProtocol == null) {
- continue;
- }
-
- if (stationProtocol.getTaskNo().equals(wrkNo)) {
- complete = true;
+ if (basStation != null) {
+ targetDeviceNo = basStation.getDeviceNo();
+ StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
+ if (stationThread != null) {
+ Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
+ StationProtocol stationProtocol = statusMap.get(basStation.getStationId());
+ if (stationProtocol != null && wrkNo.equals(stationProtocol.getTaskNo())) {
+ complete = true;
+ }
+ }
}
if (complete) {
- wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
- wrkMast.setIoTime(new Date());
- wrkMastService.updateById(wrkMast);
- notifyUtils.notify(String.valueOf(SlaveType.Devp), basStation.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
- redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
+ completeStationRunTask(wrkMast, targetDeviceNo);
}
}
} catch (Exception e) {
@@ -347,6 +340,19 @@
}
}
+ private void completeStationRunTask(WrkMast wrkMast, Integer deviceNo) {
+ if (wrkMast == null || wrkMast.getWrkNo() == null) {
+ return;
+ }
+ wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
+ wrkMast.setIoTime(new Date());
+ wrkMastService.updateById(wrkMast);
+ if (deviceNo != null) {
+ notifyUtils.notify(String.valueOf(SlaveType.Devp), deviceNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
+ }
+ redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
+ }
+
// 妫�娴嬩换鍔¤浆瀹屾垚
public synchronized void checkTaskToComplete() {
try {
--
Gitblit v1.9.1