| | |
| | | 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; |
| | |
| | | return R.error("任务取消失败"); |
| | | } |
| | | |
| | | @PostMapping("/deviceStatus") |
| | | @RequestMapping("/deviceStatus") |
| | | @OpenApiLog(memo = "获取设备状态") |
| | | public R getDeviceStatus() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | 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 |
| | |
| | | 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 |
| | | , null |
| | | , JSON.toJSONString(map) |
| | | , null |
| | | , null |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | @PostMapping("/getLocInformation") |
| | | @OpenApiLog(memo = "获取指定库位信息") |
| | | public R getLocInformation(@RequestBody GetLocInformationParam param) { |