From 98e6dd8f3597a36512699151a7f74b6cf733268f Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期五, 19 九月 2025 14:06:03 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/OpenController.java | 88 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 85 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java index a207073..fd3e4f6 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,7 +233,7 @@ return R.error("浠诲姟鍙栨秷澶辫触"); } - @PostMapping("/deviceStatus") + @RequestMapping("/deviceStatus") @OpenApiLog(memo = "鑾峰彇璁惧鐘舵��") public R getDeviceStatus() { HashMap<String, Object> map = new HashMap<>(); @@ -269,13 +271,68 @@ 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") + @OpenApiLog(memo = "鑾峰彇鎻愬崌鏈哄師濮嬫暟鎹�") + 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()); + } + + apiLogService.insert(new ApiLog( + null + , "鑾峰彇鎻愬崌鏈哄師濮嬫暟鎹�" + , "/liftDeviceOriginData" , null , null , null @@ -375,7 +432,7 @@ , null , null , null - , null + , JSON.toJSONString(param) , JSON.toJSONString(shuttleGather) , null , null @@ -386,6 +443,31 @@ )); return R.ok().add(shuttleGather); + } + + @PostMapping("/shuttleDemo") + @OpenApiLog(memo = "灏忚溅婕旂ず") + public R shuttleDemo(@RequestBody ShuttleDemoParam param) { + shuttleDispatchUtils.shuttleDemo(param); + + apiLogService.insert(new ApiLog( + null + , "灏忚溅婕旂ず" + , "/shuttleDemo" + , null + , null + , null + , JSON.toJSONString(param) + , null + , null + , null + , 1 + , new Date() + , null + , null + )); + + return R.ok(); } @PostMapping("/queryTask") @@ -411,7 +493,7 @@ , null , null , null - , null + , JSON.toJSONString(param) , JSON.toJSONString(wrkMasts) , null , null -- Gitblit v1.9.1