| | |
| | | @Transactional |
| | | public class MainServiceImpl { |
| | | |
| | | |
| | | public static final long COMMAND_TIMEOUT = 5 * 1000; |
| | | |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode); |
| | |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999) |
| | | && staProtocol.isPakMk()) { |
| | | // 判断重复工作档 |
| | |
| | | } |
| | | } |
| | | } |
| | | try { |
| | | Thread.sleep(1500L); |
| | | } catch (InterruptedException ignore) {} |
| | | // 库位移转 |
| | | this.locToLoc(crn, crnProtocol); |
| | | } |
| | |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | |
| | | // long startTime = System.currentTimeMillis(); |
| | | // while ((System.currentTimeMillis() - startTime) < COMMAND_TIMEOUT) { |
| | | // |
| | | // if (true) { |
| | | // break; |
| | | // } |
| | | // |
| | | // try{ |
| | | // Thread.sleep(500); |
| | | // }catch(Exception ignore){} |
| | | // } |
| | | |
| | | // 修改工作档状态 2.设备上走 => 3.吊车入库中 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(3L); |