Junjie
昨天 5a2bd164d3a831e39bf0defaddf181a97de36993
#缓存数据清理
5个文件已修改
77 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/StationController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/param/StationCommandMoveParam.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/StationThread.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/ZyStationV5Thread.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/components/DevpCard.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/StationController.java
@@ -166,6 +166,29 @@
        return R.ok("清理路径成功");
    }
    @PostMapping("/command/clearPathBySlot")
    public R commandClearPathBySlot(@RequestBody StationCommandMoveParam param) {
        if (param == null || Cools.isEmpty(param.getStationId()) || param.getSlotIdx() == null) {
            return R.error("缺少参数");
        }
        StationObjModel finalStation = findStation(param.getStationId());
        if (finalStation == null) {
            return R.error("站点不存在");
        }
        StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, finalStation.getDeviceNo());
        if (stationThread == null) {
            return R.error("线程不存在");
        }
        boolean cleared = stationThread.clearPathByStationSlot(param.getStationId(), param.getSlotIdx());
        if (!cleared) {
            return R.error("未匹配到可清理槽位或清理失败");
        }
        return R.ok("清理路径成功");
    }
    private StationObjModel findStation(Integer stationId) {
        if (Cools.isEmpty(stationId)) {
            return null;
src/main/java/com/zy/asrs/domain/param/StationCommandMoveParam.java
@@ -14,4 +14,7 @@
    // 任务编号
    private Integer taskNo;
    // 缓存区槽位编号
    private Integer slotIdx;
}
src/main/java/com/zy/core/thread/StationThread.java
@@ -46,6 +46,10 @@
    boolean clearPath(Integer taskNo);
    default boolean clearPathByStationSlot(Integer stationId, Integer slotIdx) {
        return false;
    }
    CommandResponse sendCommand(StationCommand command);
    CommandResponse sendOriginCommand(String address, short[] data);
src/main/java/com/zy/core/thread/impl/ZyStationV5Thread.java
@@ -306,6 +306,40 @@
    }
    @Override
    public boolean clearPathByStationSlot(Integer stationId, Integer slotIdx) {
        if (stationId == null || slotIdx == null || zyStationConnectDriver == null) {
            return false;
        }
        List<StationProtocol> status = getStatus();
        if (status == null || status.isEmpty()) {
            return false;
        }
        for (StationProtocol stationProtocol : status) {
            if (stationProtocol == null || !Objects.equals(stationId, stationProtocol.getStationId())) {
                continue;
            }
            if (!zyStationConnectDriver.clearTaskBufferSlot(stationId, slotIdx)) {
                log.warn("输送站缓存区残留路径按站点槽位清理失败。stationId={}, slotIdx={}", stationId, slotIdx);
                return false;
            }
            List<StationTaskBufferItem> taskBufferItems = stationProtocol.getTaskBufferItems();
            if (taskBufferItems != null) {
                for (StationTaskBufferItem item : taskBufferItems) {
                    if (item != null && Objects.equals(slotIdx, item.getSlotIdx())) {
                        item.setTaskNo(0);
                        item.setTargetStaNo(0);
                        break;
                    }
                }
            }
            log.warn("输送站缓存区残留路径按站点槽位清理成功。stationId={}, slotIdx={}", stationId, slotIdx);
            return true;
        }
        return false;
    }
    @Override
    public CommandResponse sendCommand(StationCommand command) {
        CommandResponse commandResponse = null;
        try {
src/main/webapp/components/DevpCard.js
@@ -27,13 +27,18 @@
            <span class="mc-field-label">工作号</span>
            <input class="mc-input" v-model="controlParam.taskNo" placeholder="输入工作号" />
          </label>
          <label class="mc-field">
            <span class="mc-field-label">slotIdx</span>
            <input class="mc-input" v-model="controlParam.slotIdx" placeholder="输入缓存索引" />
          </label>
          <label class="mc-field mc-span-2">
            <span class="mc-field-label">目标站</span>
            <input class="mc-input" v-model="controlParam.targetStationId" placeholder="输入目标站号" />
          </label>
          <div class="mc-action-row">
            <button type="button" class="mc-btn" @click="controlCommand">下发</button>
            <button type="button" class="mc-btn mc-btn-soft" @click="clearPathCommand">清路径</button>
            <button type="button" class="mc-btn mc-btn-soft" @click="clearPathByTaskNoCommand">工作号清路径</button>
            <button type="button" class="mc-btn mc-btn-soft" @click="clearPathBySlotCommand">站点清路径</button>
            <button type="button" class="mc-btn mc-btn-soft" @click="resetCommand">复位</button>
            <button type="button" class="mc-btn mc-btn-ghost" @click="openStationTracePage">运行轨迹</button>
            <button v-if="showFakeTraceEntry" type="button" class="mc-btn mc-btn-ghost" @click="openFakeTracePage">仿真轨迹</button>
@@ -115,6 +120,7 @@
      controlParam: {
        stationId: "",
        taskNo: "",
        slotIdx: "",
        targetStationId: ""
      },
      barcodePreviewCache: {},
@@ -495,9 +501,12 @@
    controlCommand: function () {
      this.postControl("/station/command/move", this.controlParam);
    },
    clearPathCommand: function () {
    clearPathByTaskNoCommand: function () {
      this.postControl("/station/command/clearPath", this.controlParam);
    },
    clearPathBySlotCommand: function () {
      this.postControl("/station/command/clearPathBySlot", this.controlParam);
    },
    resetCommand: function () {
      this.postControl("/station/command/reset", this.controlParam);
    }