From 434b69ba26276fa37ee3fc6053b8376c2840ca37 Mon Sep 17 00:00:00 2001 From: 18516761980 <4761516tqsxp> Date: 星期二, 14 六月 2022 16:42:11 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 53 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 32 insertions(+), 21 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 3f234cf..88e49e4 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -90,8 +90,6 @@ @Value("${wms.url}") private String wmsUrl; - @Value("${crnBackHp.enable}") - private boolean crnBackHp; /** * 缁勬墭 @@ -531,6 +529,11 @@ log.error("{}鍙峰爢鍨涙満灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", crn.getId()); continue; } + + if(crnThread.isBackHpFlag()){ + continue; + } + // 鍙湁褰撳爢鍨涙満绌洪棽 骞朵笖 鏃犱换鍔℃椂鎵嶇户缁墽琛� if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO) { // 濡傛灉鏈�杩戜竴娆℃槸鍏ュ簱妯″紡 @@ -556,20 +559,15 @@ } // 搴撲綅绉昏浆 this.locToLoc(crn, crnProtocol); + this.crnRebackHp(crnProtocol, crnThread); -// if (crnBackHp) { -// -// //鍫嗗灈鏈烘病鏈夋墽琛屼腑浠诲姟锛岃澶囧瓨鍦ㄥ叆搴撲换鍔℃椂鍙洖鍘熺偣 -// this.crnRebackHp(crnProtocol); -// -// } } } /** * 鍥炲師鐐癸紝鍫嗗灈鏈烘病鏈夋墽琛屼腑浠诲姟锛岃澶囧瓨鍦ㄥ叆搴撲换鍔℃椂鍙洖鍘熺偣 */ - public synchronized void crnRebackHp(CrnProtocol crnProtocol){ + public synchronized void crnRebackHp(CrnProtocol crnProtocol, CrnThread crnThread){ // for (CrnSlave crn : slaveProperties.getCrn()) { // // 鑾峰彇鍫嗗灈鏈轰俊鎭� // CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); @@ -597,12 +595,11 @@ return; } - //杈撻�佺嚎娌℃湁鍏ュ簱浠诲姟锛岃繃婊�2 if (wrkMastMapper.selectDevWorking(crnProtocol.getCrnNo()) == null) { return; } -// log.info("鍫嗗灈鏈哄彫鍥炲師鐐�==>>" + crn.getId() + "鍙峰爢鍨涙満鏈夊叆搴撲换鍔�,鍙洖鍘熺偣"); + log.info("鍫嗗灈鏈哄彫鍥炲師鐐�==>>" + crnProtocol.getCrnNo() + "鍙峰爢鍨涙満鏈夊叆搴撲换鍔�,鍙洖鍘熺偣"); // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- CrnCommand crnCommand = new CrnCommand(); crnCommand.setCrnNo(crnProtocol.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -618,6 +615,7 @@ if (!MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(2, crnCommand))) { log.error("鍫嗗灈鏈哄洖鍘熺偣鍛戒护涓嬪彂澶辫触锛屽爢鍨涙満鍙�={}锛屼换鍔℃暟鎹�={}", crnProtocol.getCrnNo(), JSON.toJSON(crnCommand)); } + crnThread.setBackHpFlag(true); } // } } @@ -789,7 +787,6 @@ // // 鍏ュ嚭搴撴ā寮忓垽鏂� // if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; } - // 鏌ヨ绔欑偣璇︾粏淇℃伅 BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo()); if (staDetl == null) { @@ -841,6 +838,11 @@ } log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛�", wrkMast.getWrkNo()); continue; + } else if (shallowLoc.getLocSts().equals("Q") || shallowLoc.getLocSts().equals("S")){ + WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo); + if (null != waitWrkMast && waitWrkMast.getWrkSts()==4) { + continue; + } } } @@ -1516,10 +1518,11 @@ // 鑾峰彇宸ヤ綔鍙� int workNo = commonService.getWorkNo(0); + Date now = new Date(); // 淇濆瓨宸ヤ綔妗� WrkMast wrkMast = new WrkMast(); wrkMast.setWrkNo(workNo); - wrkMast.setIoTime(new Date()); + wrkMast.setIoTime(now); wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇 wrkMast.setIoPri(15D); @@ -1533,8 +1536,8 @@ wrkMast.setBarcode(shallowLoc.getBarcode()); // 鎵樼洏鐮� wrkMast.setLinkMis("N"); wrkMast.setCtnNo("Y"); // 鍏ュ簱闃诲搴撲綅绉昏浆鏍囪 - wrkMast.setAppeTime(new Date()); - wrkMast.setModiTime(new Date()); + wrkMast.setAppeTime(now); + wrkMast.setModiTime(now); int res = wrkMastMapper.insert(wrkMast); if (res == 0) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); @@ -1545,11 +1548,11 @@ for (LocDetl locDetl : locDetls) { WrkDetl wrkDetl = new WrkDetl(); wrkDetl.setWrkNo(workNo); - wrkDetl.setIoTime(new Date()); + wrkDetl.setIoTime(now); wrkDetl.setQty(locDetl.getQty()); VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗 - wrkDetl.setAppeTime(new Date()); - wrkDetl.setModiTime(new Date()); + wrkDetl.setAppeTime(now); + wrkDetl.setModiTime(now); if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�"); } @@ -1558,7 +1561,7 @@ // 淇敼婧愬簱浣嶇姸鎬� if (shallowLoc.getLocSts().equals("D") || shallowLoc.getLocSts().equals("F")) { shallowLoc.setLocSts("S"); // S.鍏ュ簱棰勭害锛屽叆搴撻樆濉炲簱浣嶇Щ杞� - shallowLoc.setModiTime(new Date()); + shallowLoc.setModiTime(now); if (!locMastService.updateById(shallowLoc)){ throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�"); } @@ -1601,8 +1604,6 @@ } } } - - if (null != loc) { break; } } } @@ -1610,10 +1611,20 @@ for (Integer row : rows) { if (Utils.isShallowLoc(slaveProperties, row)) { loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1()); + + if(null != loc){//瀵瑰簲娣卞簱浣嶉潪鍦ㄥ簱鐘舵��,涓嶈兘绉诲簱 + String deepLoc = Utils.getDeepLoc(slaveProperties,loc.getLocNo()); + LocMast deepLoc1 = locMastService.selectById(deepLoc); + if(!deepLoc1.getLocSts().equals("F") && !deepLoc1.getLocSts().equals("D")){ + loc = null; + } + } + if (null != loc) { break; } } } } + if (null == loc) { throw new CoolException("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo()); } -- Gitblit v1.9.1