From af6fed7d45038a8696ecaa41e8b9a509df68e63e Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期一, 04 十二月 2023 13:37:11 +0800 Subject: [PATCH] #redis 同步set --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 156 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index 071aa78..40645e0 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -405,6 +405,126 @@ for (DevpSlave devp : slaveProperties.getDevp()) { // 閬嶅巻鎷f枡鍏ュ簱鍙� for (DevpSlave.Sta pickSta : devp.getPickInSta()) { + if (pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339) { + continue; + } + + // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭� + DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); + StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo()); + if (staProtocol == null) { + continue; + } else { + staProtocol = staProtocol.clone(); + } + if (staProtocol.isAutoing() + && staProtocol.isLoading() + && staProtocol.isInEnable() +// && (staProtocol.getWorkNo() > 0) + && staProtocol.isPakMk()){ + + // 鑾峰彇鏉$爜鎵弿浠俊鎭� + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); + if (barcodeThread == null) { + continue; + } + String barcode = barcodeThread.getBarcode(); + if(Cools.isEmpty(barcode)) { + continue; + } + if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { + continue; + } + + WrkMast wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode); + if (wrkMast == null) {//鎵句笉鍒板伐浣滄。 + continue; + } + + if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) + || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) { + continue; + } + + //*********************鍚屽簱浣嶇粍鏍¢獙********************* + boolean flag = false; + String th = ""; + List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo()); + for (String loc : innerLoc) { + LocMast locMast = locMastService.selectById(loc); + if (locMast == null) { + continue; + } + + if (!locMast.getLocSts().equals("F")) { + flag = true; + th = loc + "搴撲綅瀛樺湪鏈洖搴撲换鍔�"; + break; + } + } + if (flag) { + News.info(th); + continue; + } + //*********************鍚屽簱浣嶇粍鏍¢獙********************* + + // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� + if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { + News.info(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�"); + continue; + } + + String sourceLocNo = wrkMast.getSourceLocNo().trim(); + LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯 + if (liftStaProtocol == null) { + continue; + } + + // 鏇存柊宸ヤ綔妗f暟鎹姸鎬� + wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57 + wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋 + wrkMast.setSourceStaNo(pickSta.getBackSta()); // 婧愮珯 +// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔� +// wrkMast.setCrnNo(dto.getCrnNo()); + wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔� + wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣� + wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌� + wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌� + wrkMast.setModiTime(new Date()); + if (wrkMastMapper.updateById(wrkMast) == 0) { + News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); + continue; + } + if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) { + News.info(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); + continue; + } + + // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴� + LocMast locMast = locMastService.selectById(sourceLocNo); + locMast.setLocSts("Q"); + locMast.setModiTime(new Date()); + if (!locMastService.updateById(locMast)) { + News.info("淇敼搴撲綅鐘舵�佸け璐�"); + continue; + } + } + } + + } + } + + /** + * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱(325銆�331銆�333銆�339) + */ + @Transactional + public synchronized void stnToCrnStnPick2(){ + for (DevpSlave devp : slaveProperties.getDevp()) { + // 閬嶅巻鎷f枡鍏ュ簱鍙� + for (DevpSlave.Sta pickSta : devp.getPickInSta()) { + if (!(pickSta.getStaNo() == 325 || pickSta.getStaNo() == 331 || pickSta.getStaNo() == 333 || pickSta.getStaNo() == 339)) { + continue; + } // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭� DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); @@ -493,7 +613,6 @@ continue; } - staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());//鍐欏叆宸ヤ綔鍙� staProtocol.setStaNo(pickSta.getBackSta().shortValue());//鍐欏叆鐩爣绔� MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); } @@ -1285,6 +1404,28 @@ if (!sourceBasDevp.getInEnable().equals("Y")) { News.info("{}浠诲姟锛寋}婧愮珯锛屾病鏈夊彲鍏ヤ俊鍙�", wrkMast.getWrkNo(), sourceBasDevp.getDevNo()); return false;//绔欑偣涓嶅彲鍏� + } + + Integer barcodeId = Utils.getBarcodeIdByStaNo(wrkMast.getSourceStaNo()); + if (barcodeId == null) { + News.info("{}浠诲姟锛寋}婧愮珯锛屾壘涓嶅埌鍙敤鏉$爜鍣↖D", wrkMast.getWrkNo(), sourceBasDevp.getDevNo()); + return false;//绔欑偣涓嶅彲鍏� + } + + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId); + if (barcodeThread == null) { + News.info("{}浠诲姟锛寋}婧愮珯锛屾潯鐮佸櫒{}绾跨▼涓虹┖", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId); + return false;//绔欑偣涓嶅彲鍏� + } + String barcode = barcodeThread.getBarcode(); + if(!Cools.isEmpty(barcode)) { + if(!("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode))) { + //瀛樺湪鏉$爜鍊硷紝鍒ゆ柇鏄惁鍜屽綋鍓嶅伐浣滄。涓�鑷� + if (!barcode.equals(wrkMast.getBarcode())) { + News.info("{}浠诲姟锛屾潯鐮佸櫒{}鍊納}涓庡伐浣滄。鏉$爜鍊间笉涓�鑷达紝绯荤粺璺宠繃鎵ц", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId, barcode); + return false;//绔欑偣涓嶅彲鍏� + } + } } //鍒ゆ柇鎻愬崌鏈烘暣涓笁妤兼槸鍚﹂兘澶勪簬鍏ュ簱妯″紡 @@ -2348,7 +2489,9 @@ RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303"); } } - }else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) { + } + + if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) { //璋冨害鏈烘鑷� //鏌ヨ鏄惁鏈夊伐浣滄。 WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue()); @@ -2876,9 +3019,18 @@ continue; } - if (shuttleProtocol.getVoltage() < 5630) { - continue;//鐢靛帇涓嶅缁х画鍏呯數 + //***************鍒ゆ柇鏄惁婊″厖鏍″噯*************** + EntityWrapper<Config> wrapper1 = new EntityWrapper<>(); + wrapper.eq("code", "shuttleMaxPowerVerify"); + Config config1 = configService.selectOne(wrapper1); + if (config1 != null) { + if (config1.getValue().equals("true")) { + if (shuttleProtocol.getVoltage() < 5630) { + continue;//鐢靛帇涓嶅缁х画鍏呯數 + } + } } + //***************鍒ゆ柇鏄惁婊″厖鏍″噯*************** //灏忚溅婊$數锛岀粨鏉熷厖鐢典换鍔� NyShuttleHttpCommand chargeCommand = NyHttpUtils.getChargeCommand(shuttle.getId(), wrkCharge.getWrkNo(), false); -- Gitblit v1.9.1