|  |  | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import com.zy.core.properties.SystemProperties; | 
 |  |  | import com.zy.core.thread.BarcodeThread; | 
 |  |  | import com.zy.core.thread.CrnThread; | 
 |  |  | import com.zy.core.thread.SiemensCrnThread; | 
 |  |  | import com.zy.core.thread.DevpThread; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |             vo.setSiteId(String.valueOf(entry.getKey())); // 站点编号 | 
 |  |  |             vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 | 
 |  |  |             vo.setSiteStatus(SiteStatusType.process(staProtocol));  // 状态 | 
 |  |  |             vo.setNearbySta(String.valueOf(staProtocol.getPosition())); // 台车位置 | 
 |  |  |             vos.add(vo); | 
 |  |  |         } | 
 |  |  |         return R.ok().add(vos); | 
 |  |  | 
 |  |  |         List<CrnLatestDataVo> vos = new ArrayList<>(); | 
 |  |  |         for (CrnSlave crn : slaveProperties.getCrn()) { | 
 |  |  |             // 获取堆垛机信息 | 
 |  |  |             CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); | 
 |  |  |             SiemensCrnThread crnThread = (SiemensCrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); | 
 |  |  |             if (crnThread == null) { | 
 |  |  |                 log.error("{}号堆垛机连接失败", crn.getId()); | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             CrnProtocol crnProtocol = crnThread.getCrnProtocol(); | 
 |  |  |             if (crnProtocol == null) { | 
 |  |  |                 log.error("{}号堆垛机连接失败", crn.getId()); | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             CrnLatestDataVo vo = new CrnLatestDataVo(); | 
 |  |  | 
 |  |  |             /** | 
 |  |  |              * 堆垛机状态判断 | 
 |  |  |              */ | 
 |  |  |             if (crnProtocol.getTaskNo()>0) { | 
 |  |  |                 WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); | 
 |  |  |                 if (wrkMast != null) { | 
 |  |  |                     vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType())); | 
 |  |  |             if (crnProtocol.getAlarm1() > 0) { | 
 |  |  |                 vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); | 
 |  |  |             } else { | 
 |  |  |                 if (crnProtocol.getTaskNo()>0) { | 
 |  |  |                     WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); | 
 |  |  |                     if (wrkMast != null) { | 
 |  |  |                         vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType())); | 
 |  |  |                     } else { | 
 |  |  |                         vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); | 
 |  |  |                     } | 
 |  |  |                 } else { | 
 |  |  |                     vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); | 
 |  |  |             } | 
 |  |  |             vos.add(vo); | 
 |  |  |  | 
 |  |  | 
 |  |  |         List<BarcodeDataVo> list = new ArrayList<>(); | 
 |  |  |         for (Slave barcode : slaveProperties.getBarcode()) { | 
 |  |  |             BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); | 
 |  |  |             if (null == barcodeThread) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |             BarcodeDataVo vo = new BarcodeDataVo(); | 
 |  |  |             vo.setBarcodeId(barcode.getId()); | 
 |  |  |             vo.setCodeValue(barcodeThread.getBarcode()); | 
 |  |  | 
 |  |  |         CrnDetailVo vo = new CrnDetailVo(); | 
 |  |  |         for (CrnSlave crnSlave : slaveProperties.getCrn()) { | 
 |  |  |             if (crnSlave.getId().equals(crnNo)) { | 
 |  |  |                 CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); | 
 |  |  |                 SiemensCrnThread crnThread = (SiemensCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); | 
 |  |  |                 CrnProtocol crnProtocol = crnThread.getCrnProtocol(); | 
 |  |  |                 vo.setCrnNo(crnNo); | 
 |  |  |                 vo.setWorkNo(crnProtocol.getTaskNo()); |