|  |  | 
 |  |  | import com.zy.asrs.domain.enums.SiteStatusType; | 
 |  |  | import com.zy.asrs.domain.param.SystemSwitchParam; | 
 |  |  | import com.zy.asrs.domain.vo.*; | 
 |  |  | import com.zy.asrs.entity.BasCrnError; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import com.zy.asrs.entity.ChartBean; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.entity.*; | 
 |  |  | import com.zy.asrs.mapper.BasCrnErrorMapper; | 
 |  |  | import com.zy.asrs.mapper.LocMastMapper; | 
 |  |  | import com.zy.asrs.mapper.ReportQueryMapper; | 
 |  |  | import com.zy.asrs.service.BasDevpService; | 
 |  |  | import com.zy.asrs.service.DeviceErrorService; | 
 |  |  | import com.zy.asrs.service.WrkMastService; | 
 |  |  | import com.zy.common.CodeRes; | 
 |  |  | import com.zy.core.CrnThread; | 
 |  |  | 
 |  |  |     private BasCrnErrorMapper basCrnErrorMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private ReportQueryMapper reportQueryMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private DeviceErrorService deviceErrorService; | 
 |  |  |  | 
 |  |  |     @PostMapping("/system/running/status") | 
 |  |  |     @ManagerAuth(memo = "系统运行状态") | 
 |  |  | 
 |  |  |         return R.ok().add(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取设备详情 | 
 |  |  |      */ | 
 |  |  |     @GetMapping("/deviceInfo") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R getDeviceInfo() { | 
 |  |  |         ArrayList<HashMap<String, Object>> list = new ArrayList<>(); | 
 |  |  |         for (CrnSlave crn : slaveProperties.getCrn()) { | 
 |  |  |             // 获取堆垛机信息 | 
 |  |  |             CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); | 
 |  |  |             if (crnThread == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             CrnProtocol crnProtocol = crnThread.getCrnProtocol(); | 
 |  |  |             if (crnProtocol == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             HashMap<String, Object> map = new HashMap<>(); | 
 |  |  |             map.put("device", "堆垛机"); | 
 |  |  |             map.put("deviceId", crn.getId()); | 
 |  |  |             map.put("battery", ""); | 
 |  |  |             map.put("error", crnProtocol.getFault()); | 
 |  |  |             map.put("status", crnProtocol.getStatusType().desc); | 
 |  |  |             list.add(map); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             DeviceError deviceError = deviceErrorService.selectByDeviceAndDeviceId("devp", devp.getId()); | 
 |  |  |             HashMap<String, Object> map = new HashMap<>(); | 
 |  |  |             map.put("device", "输送线"); | 
 |  |  |             map.put("deviceId", devp.getId()); | 
 |  |  |             map.put("battery", ""); | 
 |  |  |             map.put("error", deviceError != null); | 
 |  |  |             map.put("status", deviceError == null ? "" : deviceError.getMsg()); | 
 |  |  |             list.add(map); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         for (Slave scale : slaveProperties.getScale()) { | 
 |  |  |             DeviceError deviceError = deviceErrorService.selectByDeviceAndDeviceId("scale", scale.getId()); | 
 |  |  |             HashMap<String, Object> map = new HashMap<>(); | 
 |  |  |             map.put("device", "磅秤"); | 
 |  |  |             map.put("deviceId", scale.getId()); | 
 |  |  |             map.put("battery", ""); | 
 |  |  |             map.put("error", deviceError != null); | 
 |  |  |             map.put("status", deviceError == null ? "" : deviceError.getMsg()); | 
 |  |  |             list.add(map); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         HashMap<String, Object> hashMap = new HashMap<>(); | 
 |  |  |         hashMap.put("records", list); | 
 |  |  |         return R.ok().add(hashMap); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /****************************************************************/ | 
 |  |  |     /************************** 详情操作 ******************************/ | 
 |  |  |     /****************************************************************/ |