| | |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | if (wrkMast.getIoType() == 53) { |
| | | if (wrkMast.getIoType() == 53 || wrkMast.getIoType() == 57) { |
| | | //拣料再回库,重新分配设备工作号 |
| | | Random random = new Random(); |
| | | int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//获取设备工作号 |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * AGV补货(悬挂线通知AGV取货) |
| | | */ |
| | | public void agvRestockIntoByHangingWire() { |
| | | //检测350和351扫码器 |
| | | int[] barcodeStaNo = {11, 12};//11 => 350站扫码器,12 => 351站扫码器 |
| | | for (int staNo : barcodeStaNo) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, staNo); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | if (barcode.contains("NoRead")) { |
| | | continue; |
| | | } |
| | | |
| | | String agvStaNo = null; |
| | | if (staNo == 11) { |
| | | agvStaNo = "303-1"; |
| | | }else { |
| | | agvStaNo = "304-1"; |
| | | } |
| | | //通知AGV取货 |
| | | boolean result = agvRestockCall(agvStaNo, barcode); |
| | | if (result) { |
| | | barcodeThread.setBarcode(""); |
| | | } |
| | | log.info(barcodeThread.getSlave().getId() + "号扫码器,通知AGV取货,条码号:" + barcode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 300站拣料 |
| | | public void pick300() { |
| | | //检测300站是否自动、有物、工作号 |
| | |
| | | ledCommand.setLocNo(wrkMast.getLocNo()); |
| | | ledCommand.setStaNo(wrkMast.getStaNo()); |
| | | if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); |
| | | wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(),wrkDetl.getSpecs()))); |
| | | //for (WrkDetl wrkDetl : wrkDetls) { |
| | | // LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr())); |
| | | // |
| | | // locDetls.forEach(locDetl1 -> { |
| | | // //工作档中存在该物料则跳过 |
| | | // String suppCode = ""; |
| | | // |
| | | // if (wrkDetl.getMatnr().equals(locDetl1.getMatnr())) { |
| | | // Double anfme = 0D; |
| | | // if (locDetl != null) { |
| | | // anfme = locDetl.getAnfme(); |
| | | // } |
| | | // if (wrkDetl.getSuppCode() != null) { |
| | | // suppCode = wrkDetl.getSuppCode(); |
| | | // } |
| | | // ledCommand.getMatDtos() |
| | | // .add(new MatDto(wrkDetl.getMatnr() |
| | | // , wrkDetl.getMaktx() |
| | | // , wrkDetl.getAnfme() |
| | | // , (wrkDetl.getAnfme()-anfme) |
| | | // , wrkDetl.getSpecs() |
| | | // , suppCode)); |
| | | // } else { |
| | | // if (locDetl1.getSuppCode() != null) { |
| | | // suppCode = locDetl1.getSuppCode(); |
| | | // } |
| | | // ledCommand.getMatDtos() |
| | | // .add(new MatDto(locDetl1.getMatnr() |
| | | // , locDetl1.getMaktx() |
| | | // , 0D |
| | | // , locDetl1.getAnfme() |
| | | // , locDetl1.getSpecs() |
| | | // , suppCode)); |
| | | // } |
| | | // }); |
| | | // //LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr())); |
| | | //} |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | locDetls.forEach(locDetl -> { |
| | | Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no",wrkMast.getWrkNo()); |
| | | Utils.wapperSetCondition(wrapper,"batch",locDetl.getBatch()); |
| | | Utils.wapperSetCondition(wrapper,"three_code",locDetl.getThreeCode()); |
| | | Utils.wapperSetCondition(wrapper,"dead_time",locDetl.getDeadTime()); |
| | | WrkDetl detl = wrkDetlService.selectOne(wrapper); |
| | | if (Cools.isEmpty(detl)) { |
| | | String suppCode = ""; |
| | | if (locDetl.getSuppCode() != null) { |
| | | suppCode = locDetl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode)); |
| | | } else { |
| | | String suppCode = ""; |
| | | if (detl.getSuppCode() != null) { |
| | | suppCode = detl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(detl.getMatnr(), detl.getMaktx(), detl.getAnfme(), (locDetl.getAnfme() - detl.getAnfme()), detl.getSpecs(), suppCode)); |
| | | } |
| | | }); |
| | | } |
| | | commands.add(ledCommand); |
| | | } |