From f476e954748057e93b967a9326db1113c6432eaf Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期日, 12 十月 2025 08:24:29 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/OpenController.java | 97 ++++++++++++++++++++++-------------------------- 1 files changed, 45 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java index 17b89b6..77fd9cb 100644 --- a/src/main/java/com/zy/asrs/controller/OpenController.java +++ b/src/main/java/com/zy/asrs/controller/OpenController.java @@ -22,8 +22,10 @@ import com.zy.core.enums.SlaveType; import com.zy.core.enums.WrkIoType; import com.zy.core.model.protocol.ForkLiftProtocol; +import com.zy.core.model.protocol.LiftProtocol; import com.zy.core.model.protocol.ShuttleProtocol; import com.zy.core.thread.ForkLiftThread; +import com.zy.core.thread.LiftThread; import com.zy.core.thread.ShuttleThread; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -231,8 +233,8 @@ return R.error("浠诲姟鍙栨秷澶辫触"); } - @PostMapping("/deviceStatus") - @OpenApiLog(memo = "鑾峰彇璁惧鐘舵��") + @RequestMapping("/deviceStatus") +// @OpenApiLog(memo = "鑾峰彇璁惧鐘舵��") public R getDeviceStatus() { HashMap<String, Object> map = new HashMap<>(); //鑾峰彇灏忚溅鏁版嵁 @@ -269,25 +271,45 @@ forkLiftProtocols.add(forkLiftProtocol); } + //鑾峰彇鎻愬崌鏈烘暟鎹� + ArrayList<LiftProtocol> liftProtocols = new ArrayList<>(); + List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Lift))); + for (DeviceConfig device : liftList) { + LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getDeviceNo()); + if (liftThread == null) { + continue; + } + + LiftProtocol liftProtocol = liftThread.getStatus(); + if (liftProtocol == null) { + continue; + } + liftProtocols.add(liftProtocol); + } + map.put("shuttle", shuttleProtocols); map.put("forkLift", forkLiftProtocols); + map.put("lift", liftProtocols); - apiLogService.insert(new ApiLog( - null - , "鑾峰彇璁惧鐘舵��" - , "/deviceStatus" - , null - , null - , null - , null - , JSON.toJSONString(map) - , null - , null - , 1 - , new Date() - , null - , null - )); + return R.ok().add(map); + } + + @RequestMapping("/liftDeviceOriginData") + public R getLiftDeviceOriginData() { + HashMap<Integer, String> map = new HashMap<>(); + + //鑾峰彇鎻愬崌鏈烘暟鎹� + List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Lift))); + for (DeviceConfig device : liftList) { + LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getDeviceNo()); + if (liftThread == null) { + continue; + } + + map.put(device.getDeviceNo(), liftThread.getRealtimeOriginData()); + } return R.ok().add(map); } @@ -307,23 +329,6 @@ map.put("locNo", locMast.getLocNo()); map.put("locSts", locMast.getLocSts()); - apiLogService.insert(new ApiLog( - null - , "鑾峰彇鎸囧畾搴撲綅淇℃伅" - , "/getLocInformation" - , null - , null - , null - , JSON.toJSONString(param) - , JSON.toJSONString(map) - , null - , null - , 1 - , new Date() - , null - , null - )); - return R.ok().add(map); } @@ -342,23 +347,6 @@ map.put("locSts", locMast.getLocSts()); list.add(map); } - - apiLogService.insert(new ApiLog( - null - , "鑾峰彇鍏ㄩ儴搴撲綅淇℃伅" - , "/getAllLocInformation" - , null - , null - , null - , null - , JSON.toJSONString(list) - , null - , null - , 1 - , new Date() - , null - , null - )); return R.ok().add(list); } @@ -449,6 +437,11 @@ return R.ok().add(wrkMasts); } + @GetMapping("/systemStatus") + public R systemStatus() { + return R.ok(); + } + @GetMapping("/test") public R test() { notifyUtils.notify("task", 1, "9999", "W9999", NotifyMsgType.SHUTTLE_MOVING, "data"); -- Gitblit v1.9.1