From e43ada57f7ffdaf570c54b19316a7f0cacfaec1f Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 27 三月 2026 12:21:59 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/StationController.java |   34 ++++++++++++++++++++++++++++++----
 1 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/StationController.java b/src/main/java/com/zy/asrs/controller/StationController.java
index 75a7367..1d3b63d 100644
--- a/src/main/java/com/zy/asrs/controller/StationController.java
+++ b/src/main/java/com/zy/asrs/controller/StationController.java
@@ -1,6 +1,6 @@
 package com.zy.asrs.controller;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zy.asrs.domain.param.StationCommandBarcodeParam;
 import com.zy.asrs.entity.BasDevp;
 import com.zy.asrs.entity.DeviceConfig;
@@ -70,6 +70,9 @@
         }
 
         StationCommand command = stationThread.getCommand(StationCommandType.MOVE, taskNo, stationId, targetStationId, 0);
+        if (command == null) {
+            return R.error("鐢熸垚杈撻�佸懡浠ゅけ璐ワ紝璺緞涓虹┖鎴栦笉鍙揪");
+        }
         MessageQueue.offer(SlaveType.Devp, devpNo, new Task(2, command));
         return R.ok();
     }
@@ -84,7 +87,7 @@
             return R.error("褰撳墠绯荤粺鏈惎鐢ㄤ豢鐪熸彃浠�");
         }
 
-        Config enableFakeConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake"));
+        Config enableFakeConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "enableFake"));
         if (enableFakeConfig == null || !"Y".equals(enableFakeConfig.getValue())) {
             return R.error("褰撳墠闈炰豢鐪熻繍琛屾ā寮忥紝绂佹淇敼鏉$爜");
         }
@@ -96,7 +99,7 @@
         }
 
         Integer devpNo = finalStation.getDeviceNo();
-        DeviceConfig deviceConfig = deviceConfigService.selectOne(new EntityWrapper<DeviceConfig>()
+        DeviceConfig deviceConfig = deviceConfigService.getOne(new QueryWrapper<DeviceConfig>()
                 .eq("device_no", devpNo)
                 .eq("device_type", String.valueOf(SlaveType.Devp)));
         if (deviceConfig == null || deviceConfig.getFake() == null || deviceConfig.getFake() != 1) {
@@ -130,12 +133,35 @@
         return R.ok();
     }
 
+    @PostMapping("/command/clearPath")
+    public R commandClearPath(@RequestBody StationCommandMoveParam param) {
+        if (Cools.isEmpty(param) || Cools.isEmpty(param.getStationId()) || Cools.isEmpty(param.getTaskNo())) {
+            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.clearPath(param.getTaskNo());
+        if (!cleared) {
+            return R.error("鏈尮閰嶅埌鍙竻鐞嗚矾寰勬垨娓呯悊澶辫触");
+        }
+        return R.ok("娓呯悊璺緞鎴愬姛");
+    }
+
     private StationObjModel findStation(Integer stationId) {
         if (Cools.isEmpty(stationId)) {
             return null;
         }
 
-        List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>());
+        List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<BasDevp>());
         for (BasDevp basDevp : basDevps) {
             List<StationObjModel> list = basDevp.getStationList$();
             for (StationObjModel entity : list) {

--
Gitblit v1.9.1