| | |
| | | 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; |