|  |  | 
 |  |  | import com.zy.asrs.domain.vo.*; | 
 |  |  | import com.zy.asrs.entity.BasDevp; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.mapper.LocMastMapper; | 
 |  |  | import com.zy.asrs.service.BasDevpService; | 
 |  |  | import com.zy.asrs.service.WrkMastService; | 
 |  |  | import com.zy.common.CodeRes; | 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     private WrkMastService wrkMastService; | 
 |  |  |     @Autowired | 
 |  |  |     private BasDevpService basDevpService; | 
 |  |  |     @Autowired | 
 |  |  |     private LocMastMapper locMastMapper; | 
 |  |  |  | 
 |  |  |     @PostMapping("/system/running/status") | 
 |  |  |     @ManagerAuth(memo = "系统运行状态") | 
 |  |  | 
 |  |  |                 return R.error("口令错误"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         Thread.sleep(2000L); | 
 |  |  |         Thread.sleep(200L); | 
 |  |  |         SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); | 
 |  |  |         return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); | 
 |  |  |     } | 
 |  |  | 
 |  |  |             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(); | 
 |  |  |             vo.setCrnId(crn.getId());   //  堆垛机编号 | 
 |  |  |  | 
 |  |  | //            Short totalBay = locMastMapper.selectTotalBay(); | 
 |  |  |  | 
 |  |  |             vo.setOffset((double) new Random().nextInt(560));     //  堆垛机偏移量 | 
 |  |  |             vo.setBay((short) (crnProtocol.getBay() - crn.getOffset()));    //  当前列 | 
 |  |  |             /** | 
 |  |  |              * 堆垛机状态判断 | 
 |  |  |              */ | 
 |  |  |             if (crnProtocol.getTaskNo()>0) { | 
 |  |  |                 WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); | 
 |  |  |                 if (wrkMast != null) { | 
 |  |  |                     vo.setCrnStatusType(CrnStatusType.process(wrkMast.getIoType())); | 
 |  |  |                 } | 
 |  |  |             if (crnProtocol.getAlarm1() > 0) { | 
 |  |  |                 vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); | 
 |  |  |             } else { | 
 |  |  |                 vo.setCrnStatusType(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.AUTO: CrnStatusType.UN_AUTO); | 
 |  |  |                 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); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             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()); |