#
Junjie
7 小时以前 26784989e73fc36c6315e54939d1b13a50eb5020
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) {