From f033da325dd16825bbca0d1ac71cc76420dfc8a2 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期五, 09 一月 2026 11:14:36 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java | 68 +++++++++++++++++++++++----------
1 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java b/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
index dbb8346..99d4dd9 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
@@ -3,12 +3,15 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasStation;
import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.service.BasStationService;
import com.zy.common.model.NavigateNode;
import com.zy.common.utils.NavigateUtils;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.enums.RedisKeyType;
+import com.zy.core.enums.StationCommandType;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.command.StationCommand;
import com.zy.core.network.api.ZyStationConnectApi;
@@ -99,29 +102,44 @@
return new CommandResponse(true, "鍛戒护宸插彈鐞嗭紙寮傛鎵ц锛�");
}
+ @Override
+ public CommandResponse sendOriginCommand(String address, short[] data) {
+ return new CommandResponse(true, "鍘熷鍛戒护宸插彈鐞嗭紙寮傛鎵ц锛�");
+ }
+
+ @Override
+ public byte[] readOriginCommand(String address, int length) {
+ return new byte[0];
+ }
+
private void handleCommand(Integer deviceNo, StationCommand command) {
News.info("[WCS Debug] 绔欑偣浠跨湡妯℃嫙宸插惎鍔紝鍛戒护鏁版嵁={}", JSON.toJSONString(command));
Integer taskNo = command.getTaskNo();
Integer stationId = command.getStationId();
Integer targetStationId = command.getTargetStaNo();
+ StationCommandType commandType = command.getCommandType();
boolean generateBarcode = false;
- if(taskNo == 0 && targetStationId == 0){
- //娓呯┖绔欑偣
- resetStation(deviceNo, stationId);
- return;
+ if(commandType == StationCommandType.RESET){
+ if(taskNo == 0 && targetStationId == 0){
+ //娓呯┖绔欑偣
+ resetStation(deviceNo, stationId);
+ return;
+ }
+ }
+
+ if(commandType == StationCommandType.WRITE_INFO){
+ if (taskNo == 9998 && targetStationId == 0) {
+ //鐢熸垚鍑哄簱绔欑偣浠跨湡鏁版嵁
+ generateFakeOutStationData(deviceNo, stationId);
+ return;
+ }
}
//浠诲姟鍙峰睘浜庝豢鐪熷叆搴撲换鍔″彿
if (checkTaskNoInArea(taskNo)) {
//鐢熸垚浠跨湡鏁版嵁
generateBarcode = true;
- }
-
- if (taskNo == 9998 && targetStationId == 0) {
- //鐢熸垚鍑哄簱绔欑偣浠跨湡鏁版嵁
- generateFakeOutStationData(deviceNo, stationId);
- return;
}
if (taskNo > 0 && taskNo != 9999 && taskNo != 9998 && stationId == targetStationId) {
@@ -191,12 +209,9 @@
Integer stationId = command.getStationId();
Integer targetStationId = command.getTargetStaNo();
- String startLev = String.valueOf(stationId).substring(0, 1);
-
List<NavigateNode> navigateNodes = null;
-
try {
- navigateNodes = navigateUtils.calcByStationId(Integer.parseInt(startLev), stationId, targetStationId);
+ navigateNodes = navigateUtils.calcByStationId(stationId, targetStationId);
} catch (Exception e) {
e.printStackTrace();
}
@@ -209,6 +224,10 @@
}
private void diffLevCommand(StationCommand command, boolean generateBarcode) {
+ BasStationService basStationService = SpringUtils.getBean(BasStationService.class);
+ if (basStationService == null) {
+ return;
+ }
NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
if (navigateUtils == null) {
return;
@@ -218,20 +237,27 @@
Integer stationId = command.getStationId();
Integer targetStationId = command.getTargetStaNo();
- String startLev = String.valueOf(stationId).substring(0, 1);
- String endLev = String.valueOf(targetStationId).substring(0, 1);
-
List<NavigateNode> navigateNodes = null;
List<NavigateNode> targetNavigateNodes = null;
try {
- List<NavigateNode> liftStationList = navigateUtils.findLiftStationList(Integer.parseInt(startLev));
+ BasStation startStation = basStationService.selectById(stationId);
+ if (startStation == null) {
+ return;
+ }
+
+ BasStation targetStation = basStationService.selectById(targetStationId);
+ if (targetStation == null) {
+ return;
+ }
+
+ List<NavigateNode> liftStationList = navigateUtils.findLiftStationList(startStation.getStationLev());
if(liftStationList.isEmpty()){
//鏈壘鍒版彁鍗囨満鑺傜偣
return;
}
- List<NavigateNode> targetLiftStationList = navigateUtils.findLiftStationList(Integer.parseInt(endLev));
+ List<NavigateNode> targetLiftStationList = navigateUtils.findLiftStationList(targetStation.getStationLev());
if(targetLiftStationList.isEmpty()){
//鏈壘鍒版彁鍗囨満鑺傜偣
return;
@@ -261,13 +287,13 @@
continue;
}
- navigateNodes = navigateUtils.calcByStationId(Integer.parseInt(startLev), stationId, liftStationId);
+ navigateNodes = navigateUtils.calcByStationId(stationId, liftStationId);
if(navigateNodes == null){
continue;
}
//璁$畻鎻愬崌鏈哄埌鐩爣绔欑殑璺緞
- targetNavigateNodes = navigateUtils.calcByStationId(Integer.parseInt(endLev), targetLiftStationId, targetStationId);
+ targetNavigateNodes = navigateUtils.calcByStationId(targetLiftStationId, targetStationId);
if(targetNavigateNodes == null) {
continue;
}
--
Gitblit v1.9.1