From 26784989e73fc36c6315e54939d1b13a50eb5020 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 26 三月 2026 21:03:00 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java b/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
index 2f2c744..efab225 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
@@ -10,6 +10,7 @@
import com.zy.core.enums.StationCommandType;
import com.zy.core.model.CommandResponse;
import com.zy.core.model.command.StationCommand;
+import com.zy.core.model.protocol.StationTaskBufferItem;
import com.zy.core.network.api.ZyStationConnectApi;
import com.zy.core.network.entity.ZyStationStatusEntity;
@@ -139,6 +140,35 @@
}
@Override
+ public CommandResponse clearTaskBufferSlot(Integer deviceNo, Integer stationId, Integer slotIdx) {
+ if (deviceNo == null || stationId == null || slotIdx == null || slotIdx <= 0) {
+ return new CommandResponse(false, "娓呯悊缂撳瓨鍖烘Ы浣嶅弬鏁版棤鏁�");
+ }
+ List<ZyStationStatusEntity> statusList = deviceStatusMap.get(deviceNo);
+ if (statusList == null) {
+ return new CommandResponse(false, "鏈壘鍒拌澶囩姸鎬�");
+ }
+ for (ZyStationStatusEntity status : statusList) {
+ if (status == null || !stationId.equals(status.getStationId())) {
+ continue;
+ }
+ List<StationTaskBufferItem> taskBufferItems = status.getTaskBufferItems();
+ if (taskBufferItems == null || taskBufferItems.isEmpty()) {
+ return new CommandResponse(true, "缂撳瓨鍖烘Ы浣嶅凡涓虹┖");
+ }
+ for (StationTaskBufferItem item : taskBufferItems) {
+ if (item != null && slotIdx.equals(item.getSlotIdx())) {
+ item.setTaskNo(0);
+ item.setTargetStaNo(0);
+ return new CommandResponse(true, "缂撳瓨鍖烘Ы浣嶆竻鐞嗘垚鍔�");
+ }
+ }
+ return new CommandResponse(false, "鏈壘鍒扮紦瀛樺尯妲戒綅");
+ }
+ return new CommandResponse(false, "鏈壘鍒扮珯鐐圭姸鎬�");
+ }
+
+ @Override
public byte[] readOriginCommand(String address, int length) {
return new byte[0];
}
@@ -148,8 +178,13 @@
return false;
}
List<Integer> path = command.getNavigatePath();
- return (path == null || path.isEmpty()) && command.getStationId() != null
- && command.getStationId().equals(command.getTargetStaNo());
+ if (command.getStationId() == null || !command.getStationId().equals(command.getTargetStaNo())) {
+ return false;
+ }
+ if (path == null || path.isEmpty()) {
+ return true;
+ }
+ return path.size() == 1 && command.getStationId().equals(path.get(0));
}
private void handleDirectMoveCommand(Integer deviceNo, StationCommand command) {
--
Gitblit v1.9.1