From 9e7a6d4a099f039319c9a3647957fe6d4aa4ca21 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 09 四月 2026 22:52:10 +0800
Subject: [PATCH] #退回优化
---
src/main/java/com/zy/core/plugin/GslProcess.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/zy/core/plugin/GslProcess.java b/src/main/java/com/zy/core/plugin/GslProcess.java
index 51553df..257c0af 100644
--- a/src/main/java/com/zy/core/plugin/GslProcess.java
+++ b/src/main/java/com/zy/core/plugin/GslProcess.java
@@ -3,9 +3,11 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.core.common.Cools;
+import com.zy.asrs.entity.WrkLastno;
import com.zy.asrs.utils.Utils;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.service.BasDevpService;
+import com.zy.asrs.service.WrkLastnoService;
import com.zy.common.service.CommonService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
@@ -49,6 +51,8 @@
private BasDevpService basDevpService;
@Autowired
private RedisUtil redisUtil;
+ @Autowired
+ private WrkLastnoService wrkLastnoService;
@Autowired
private StoreInTaskGenerationService storeInTaskGenerationService;
@Autowired
@@ -186,6 +190,10 @@
StationThread stationThread,
StationObjModel stationObjModel,
StationProtocol stationProtocol) {
+ if (stationProtocol == null) {
+ return false;
+ }
+
if (!stationProtocol.isAutoing()) {
return false;
}
@@ -195,15 +203,54 @@
}
if (stationProtocol.getError() <= 0) {
- return true;
+ return true;//绔欑偣鏃犳晠闅�
}
- Object lock = redisUtil.get(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId());
- if (lock != null) {
+ if (!stationProtocol.isInBarcodeError()) {
+ return true;//绔欑偣鏃犲紓甯�
+ }
+
+ WrkLastno stationBackTaskRange = wrkLastnoService.getById(WrkIoType.STATION_BACK.id);
+ Integer currentTaskNo = stationProtocol.getTaskNo();
+ if (currentTaskNo != null
+ && currentTaskNo > 0
+ && stationBackTaskRange != null
+ && stationBackTaskRange.getsNo() != null
+ && stationBackTaskRange.geteNo() != null
+ && currentTaskNo >= stationBackTaskRange.getsNo()
+ && currentTaskNo <= stationBackTaskRange.geteNo()) {
+ News.info("鏉$爜绔欏凡澶勪簬閫�鍥炲伐浣滃彿鑼冨洿锛岃烦杩囬噸澶嶇敓鎴愰��鍥炲懡浠ゃ�俿tationId={}锛宼askNo={}锛宺ange=[{}, {}]",
+ stationProtocol.getStationId(),
+ currentTaskNo,
+ stationBackTaskRange.getsNo(),
+ stationBackTaskRange.geteNo());
return false;
}
StationObjModel backStation = stationObjModel.getBackStation();
+ if (backStation == null || backStation.getStationId() == null) {
+ News.warn("鏉$爜绔欓��鍥炲け璐ワ紝閫�鍥炵珯鏈厤缃�俤eviceNo={}锛宻tationId={}",
+ basDevp == null ? null : basDevp.getDevpNo(),
+ stationProtocol.getStationId());
+ return false;
+ }
+
+ // 褰撳墠绔欑偣宸茬粡鎸傜潃閫�鍥炵洰鏍囨椂锛屼笉鍐嶉噸澶嶇敓鎴愭柊鐨勯��鍥炲伐浣滃彿銆�
+ if (stationProtocol.getTaskNo() != null
+ && stationProtocol.getTaskNo() > 0
+ && backStation.getStationId().equals(stationProtocol.getTargetStaNo())) {
+ return false;
+ }
+
+ Integer lockTaskNo = stationProtocol.getTaskNo();
+ String lockKey = (lockTaskNo != null && lockTaskNo > 0)
+ ? RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + lockTaskNo
+ : RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + "station_" + stationProtocol.getStationId();
+ Object lock = redisUtil.get(lockKey);
+ if (lock != null) {
+ return false;
+ }
+
StationCommand command = stationThread.getCommand(StationCommandType.MOVE,
commonService.getWorkNo(WrkIoType.STATION_BACK.id),
stationObjModel.getStationId(),
@@ -213,8 +260,8 @@
return false;
}
stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "gsl-process", "station-back");
- News.taskInfo(stationProtocol.getTaskNo(), "{}鎵爜寮傚父锛屽凡閫�鍥炶嚦{}", backStation.getStationId());
- redisUtil.set(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId(), "lock", 10);
+ News.taskInfo(stationProtocol.getTaskNo(), "鎵爜寮傚父锛屽凡閫�鍥炶嚦{}", backStation.getStationId());
+ redisUtil.set(lockKey, "lock", 10);
return false;
}
--
Gitblit v1.9.1