From a2c10587b4621e1bf9ef928dc043cf71ad84bbcf Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期二, 18 四月 2023 09:30:18 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 200 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 185 insertions(+), 15 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 136df8d..0bf23b6 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -102,29 +102,58 @@ for (DevpSlave.Sta inSta : devp.getInSta()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); - + BarcodeThread barcodeThread1 = null; + BarcodeThread barcodeThread2 = null; if (barcodeThread == null) { continue; } String barcode = barcodeThread.getBarcode(); - + String barcode1 = ""; + String barcode2 = ""; //101绔欐湁3涓壂鐮佸櫒锛屽綋0鎵爜鍣ㄦ病鏈夋暟鎹椂锛岃幏鍙�9銆�10涓や釜鎵爜鍣ㄦ暟鎹� - if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104)) && ( "NoRead".equals(barcode) || Cools.isEmpty(barcode) )){ - BarcodeThread barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode1()); + if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104))){ + barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode1()); if (barcodeThread1 != null) { - barcode = barcodeThread1.getBarcode(); + barcode1 = barcodeThread1.getBarcode(); } - if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) { - BarcodeThread barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2()); - if (barcodeThread2 != null) { - barcode = barcodeThread2.getBarcode(); + barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2()); + if (barcodeThread2 != null) { + barcode2 = barcodeThread2.getBarcode(); - } } + + Integer len1=0 , len2=0, len3=0; + if(barcode != null) { + String b[]=barcode.split(";"); + barcode=b[b.length-1]; + len1 = barcode.length(); + } + if(barcode1 != null) { + String b[]=barcode1.split(";"); + barcode1=b[b.length-1]; + len2 = barcode1.length(); + } + if(barcode2 != null) { + String b[]=barcode2.split(";"); + barcode2=b[b.length-1]; + len3 = barcode2.length(); + } + + if(len2 > len1 && len2 >= len3){ + barcode = barcode1; + } else if (len3 > len1 && len3 >= len2){ + barcode = barcode2; + } + } - + //鍒ゆ柇101鍜�104鏄惁鏄嫞鏂欍�佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱 + WrkMast wrkMast1=wrkMastMapper.selectpj(inSta.getStaNo(),barcode); + if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104)) &&!Cools.isEmpty(barcode)&&!Cools.isEmpty(wrkMast1)){ + log.error("101鎴�104鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱", wrkMast1.getWrkNo()); + continue; + } if (!Cools.isEmpty(barcode)) { log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode); @@ -224,7 +253,7 @@ param.setFull(staProtocol.isFull()); String response = new HttpHandler.Builder() .setUri(wmsUrl) - .setPath("/rpc/pakin/loc/v1") + .setPath("/rpc/ ") .setJson(JSON.toJSONString(param)) .build() .doPost(); @@ -235,6 +264,12 @@ StartupDto dto = jsonObject.getObject("data", StartupDto.class); barcodeThread.setBarcode(""); + if(barcodeThread1 !=null){ + barcodeThread1.setBarcode(""); + } + if(barcodeThread2 !=null){ + barcodeThread2.setBarcode(""); + } staProtocol.setWorkNo(dto.getWorkNo().shortValue()); staProtocol.setStaNo(dto.getStaNo().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -532,7 +567,37 @@ wrkMast.setIoTime(now); wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57 wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋 - wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯 + + Integer sourceStaNo = 0; + switch (wrkMast.getStaNo()){ + case 100: + sourceStaNo = 101; + break; + case 103: + sourceStaNo = 104; + break; + case 110: + sourceStaNo = 111; + break; + case 113: + sourceStaNo = 114; + break; + case 200: + sourceStaNo = 201; + break; + case 203: + sourceStaNo = 204; + break; + case 300: + sourceStaNo = 301; + break; + case 303: + sourceStaNo = 304; + break; + } + + wrkMast.setSourceStaNo(sourceStaNo); // 婧愮珯 +// wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯 wrkMast.setStaNo(staNo); // 鐩爣绔� wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣� wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌� @@ -888,7 +953,7 @@ List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo()); // 鑾峰彇宸ヤ綔鐘舵�佷负14鐨勫伐浣滄。 WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo()); - if ( wrkMast1 !=null && (wrkMast1.getIoType().equals(103) || wrkMast1.getIoType().equals(107)) ) { + if ( wrkMast1 !=null) { continue; } for (WrkMast wrkMast : wrkMasts) { @@ -998,7 +1063,7 @@ continue; } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")) { WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo); - if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) { + if (null != waitWrkMast && (waitWrkMast.getWrkSts() == 4 || waitWrkMast.getWrkSts() == 5)) { continue; } } @@ -1936,6 +2001,111 @@ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } } + /** + * 鍫嗗灈鏈烘紨绀� ===>> 鎵�鏈夊簱浣嶈疆璇� + */ + public synchronized void crnDemoOfLocMove2() { + try { + for (CrnSlave crn : slaveProperties.getCrn()) { + if (!crn.getDemo()) { + continue; + } // 蹇呴』涓烘紨绀虹姸鎬� + + CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); + CrnProtocol crnProtocol = crnThread.getCrnProtocol(); + if (crnProtocol == null) { + continue; + } + + // 鍙湁褰撳爢鍨涙満绌洪棽 骞朵笖 鏃犱换鍔℃椂鎵嶇户缁墽琛� + if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO) { + // 鑾峰彇绉诲簱宸ヤ綔妗d俊鎭� + WrkMast wrkMast = wrkMastMapper.selectLocMove(crn.getId()); + if (null != wrkMast) { + continue; + } + + + LocMast sourceLoc = locMastService.queryDemoSourceLoc1(crn.getId()); + if (null == sourceLoc ) { + continue; + } + LocMast loc = locMastService.queryDemoLoc2(crn.getId(),sourceLoc.getLocType1()); + if ( null == loc) { + continue; + } + + String sourceLocNo = sourceLoc.getLocNo(); + String locNo = loc.getLocNo(); + + // 鑾峰彇宸ヤ綔鍙� + int workNo = commonService.getWorkNo(0); + // 淇濆瓨宸ヤ綔妗� + wrkMast = new WrkMast(); + wrkMast.setWrkNo(workNo); + wrkMast.setIoTime(new Date()); + wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID + wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇 + wrkMast.setIoPri(13D); + wrkMast.setCrnNo(crn.getId()); + wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣� + wrkMast.setLocNo(locNo); // 鐩爣搴撲綅 + wrkMast.setFullPlt("N"); // 婊℃澘锛歒 + wrkMast.setPicking("N"); // 鎷f枡 + wrkMast.setExitMk("N"); // 閫�鍑� + wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D") ? "Y" : "N"); // 绌烘澘 + wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮� + wrkMast.setLinkMis("N"); + wrkMast.setAppeTime(new Date()); + wrkMast.setModiTime(new Date()); + int res = wrkMastMapper.insert(wrkMast); + if (res == 0) { + throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); + } + // 宸ヤ綔妗f槑缁嗕繚瀛� +// List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo)); +// for (LocDetl locDetl : locDetls) { +// WrkDetl wrkDetl = new WrkDetl(); +// wrkDetl.setWrkNo(workNo); +// wrkDetl.setIoTime(new Date()); +// wrkDetl.setAnfme(locDetl.getAnfme()); +// VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗 +// wrkDetl.setAppeTime(new Date()); +// wrkDetl.setModiTime(new Date()); +// if (!wrkDetlService.insert(wrkDetl)) { +// throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�"); +// } +// } + // 淇敼婧愬簱浣嶇姸鎬� + if (sourceLoc.getLocSts().equals("D")) { + sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害 + sourceLoc.setModiTime(new Date()); + if (!locMastService.updateById(sourceLoc)) { + throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�"); + } + } else { + throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�"); + } + // 淇敼鐩爣搴撲綅鐘舵�� + if (loc.getLocSts().equals("O")) { + loc.setLocSts("S"); // S.鍏ュ簱棰勭害 + loc.setCtnKind(1); + loc.setModiTime(new Date()); + if (!locMastService.updateById(loc)) { + throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�"); + } + } else { + throw new CoolException("绉昏浆澶辫触"); + } + + } + } + } catch (Exception e) { + log.error("鍫嗗灈鏈烘紨绀� ===>> 搴撲綅绉昏浆澶辫触", e); + e.printStackTrace(); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + } + } /** * 鍫嗗灈鏈哄懡浠や笅鍙戝悗锛屽紓姝ヤ慨鏀瑰伐浣滄。鐘舵�� -- Gitblit v1.9.1