| | |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.enums.WrkIoType; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.DualCrnProtocol; |
| | | import com.zy.core.model.protocol.StationProtocol; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import com.zy.core.thread.CrnThread; |
| | | import com.zy.core.thread.DualCrnThread; |
| | | import com.zy.core.thread.StationThread; |
| | | import com.zy.core.thread.RgvThread; |
| | | import com.zy.core.model.protocol.RgvProtocol; |
| | |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PostMapping("/latest/data/dualcrn") |
| | | @ManagerAuth(memo = "双工位堆垛机实时数据") |
| | | public R dualCrnLatestData() { |
| | | List<CrnLatestDataVo> vos = new ArrayList<>(); |
| | | List<DeviceConfig> dualCrnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.DualCrn))); |
| | | for (DeviceConfig deviceConfig : dualCrnList) { |
| | | DualCrnThread crnThread = (DualCrnThread) SlaveConnection.get(SlaveType.DualCrn, deviceConfig.getDeviceNo()); |
| | | if (crnThread == null) { continue; } |
| | | DualCrnProtocol p = crnThread.getStatus(); |
| | | if (p == null) { continue; } |
| | | CrnLatestDataVo vo = new CrnLatestDataVo(); |
| | | vo.setCrnId(p.getCrnNo()); |
| | | Integer bay = p.getBay() != null ? p.getBay() : p.getBayTwo(); |
| | | vo.setOffset(bay == null ? 0.0 : Double.valueOf(bay)); |
| | | vo.setBay(bay); |
| | | Integer taskNo = (p.getTaskNo() != null && p.getTaskNo() > 0) ? p.getTaskNo() |
| | | : ((p.getTaskNoTwo() != null && p.getTaskNoTwo() > 0) ? p.getTaskNoTwo() : 0); |
| | | vo.setTaskNo(taskNo); |
| | | if (p.getAlarm() != null && p.getAlarm() > 0) { |
| | | vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); |
| | | } else { |
| | | if (taskNo != null && taskNo > 0) { |
| | | vo.setCrnStatus(p.getModeType() == CrnModeType.AUTO ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } else { |
| | | vo.setCrnStatus(p.getModeType() == CrnModeType.AUTO ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } |
| | | vos.add(vo); |
| | | } |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PostMapping("/latest/data/rgv") |
| | | @ManagerAuth(memo = "RGV实时数据") |
| | | public R rgvLatestData(){ |