From f619c9d1736a3690382b58316183cee4f7dc67e6 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期六, 04 十一月 2023 13:58:15 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 404 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 259 insertions(+), 145 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 443f207..f8b2e5d 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -108,6 +108,8 @@ private BasLiftOptService basLiftOptService; @Autowired private ConfigService configService; + @Autowired + private NavigateMapUtils navigateMapUtils; /** @@ -471,117 +473,155 @@ continue; } - try { - // 璁块棶 WMS 鑾峰彇鍏ュ簱搴撲綅 - LocTypeDto locTypeDto = new LocTypeDto(staProtocol); - SearchLocParam param = new SearchLocParam(); - param.setWrkNo(wrkMast.getWrkNo()); - param.setIoType(wrkMast.getIoType()); - param.setSourceStaNo(pickSta.getStaNo()); -// param.setLocType1(locTypeDto.getLocType1()); - String response = new HttpHandler.Builder() - .setUri(wmsUrl) - .setPath("/rpc/pakin/loc/v1") - .setJson(JSON.toJSONString(param)) - .build() - .doPost(); - JSONObject jsonObject = JSON.parseObject(response); - LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); - Integer code = jsonObject.getInteger("code"); - if (code.equals(200)) { - StartupDto dto = jsonObject.getObject("data", StartupDto.class); + // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� + if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { + throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�"); + } -// // 鑾峰彇鐩爣绔� -// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() -// .eq("type_no", wrkMast.getIoType() - 50) -// .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯 -// .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿 -// StaDesc staDesc = staDescService.selectOne(wrapper); -// if (Cools.isEmpty(staDesc)) { -// News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); -// continue; -// } -// // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�) -// Integer staNo = staDesc.getCrnStn(); + String sourceLocNo = wrkMast.getSourceLocNo().trim(); + LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯 + if (liftStaProtocol == null) { + continue; + } - // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。 -// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { -// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触"); -// } - // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� - if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { - throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�"); - } - - 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.getStaNo()); // 婧愮珯 + // 鏇存柊宸ヤ綔妗f暟鎹姸鎬� + wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57 + wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋 + wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯 // 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) { - throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); - } - if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) { - throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); - } - - // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴� - LocMast locMast = locMastService.selectById(sourceLocNo); - locMast.setLocSts("Q"); - locMast.setModiTime(new Date()); - if (!locMastService.updateById(locMast)) { - throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�"); - } - -// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 -// staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); -// staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); -// devpThread.setPakMk(staProtocol.getSiteId(), false); -// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); -// if (!result) { -// News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId()); -// } - - barcodeThread.setBarcode("");//娓呯悊鏉$爜 - - } else if (code == 500){ - if (ledThread != null) { - String errorMsg = jsonObject.getString("msg"); - if (!Cools.isEmpty(errorMsg)) { - MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg)); - } - } - News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); - } else { -// staProtocol.setWorkNo((short) 32002); -// staProtocol.setStaNo(pickSta.getBackSta().shortValue()); -// devpThread.setPakMk(staProtocol.getSiteId(), false); -// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); - - // led 寮傚父鏄剧ず - if (ledThread != null) { - String errorMsg = jsonObject.getString("msg"); -// String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒"; - MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg)); - } - } - - } catch (Exception e) { - e.printStackTrace(); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔� + wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣� + wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌� + wrkMast.setLiftNo(null);// 鎻愬崌鏈烘竻绌� + wrkMast.setModiTime(new Date()); + if (wrkMastMapper.updateById(wrkMast) == 0) { + throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); } + if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) { + throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); + } + + // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴� + LocMast locMast = locMastService.selectById(sourceLocNo); + locMast.setLocSts("Q"); + locMast.setModiTime(new Date()); + if (!locMastService.updateById(locMast)) { + throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�"); + } + barcodeThread.setBarcode("");//娓呯悊鏉$爜 + +// try { +// // 璁块棶 WMS 鑾峰彇鍏ュ簱搴撲綅 +// LocTypeDto locTypeDto = new LocTypeDto(staProtocol); +// SearchLocParam param = new SearchLocParam(); +// param.setWrkNo(wrkMast.getWrkNo()); +// param.setIoType(wrkMast.getIoType()); +// param.setSourceStaNo(pickSta.getStaNo()); +//// param.setLocType1(locTypeDto.getLocType1()); +// String response = new HttpHandler.Builder() +// .setUri(wmsUrl) +// .setPath("/rpc/pakin/loc/v1") +// .setJson(JSON.toJSONString(param)) +// .build() +// .doPost(); +// JSONObject jsonObject = JSON.parseObject(response); +// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); +// Integer code = jsonObject.getInteger("code"); +// if (code.equals(200)) { +// StartupDto dto = jsonObject.getObject("data", StartupDto.class); +// +//// // 鑾峰彇鐩爣绔� +//// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() +//// .eq("type_no", wrkMast.getIoType() - 50) +//// .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯 +//// .eq("crn_no", dto.getCrnNo()); // 鍫嗗灈鏈哄彿 +//// StaDesc staDesc = staDescService.selectOne(wrapper); +//// if (Cools.isEmpty(staDesc)) { +//// News.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); +//// continue; +//// } +//// // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�) +//// Integer staNo = staDesc.getCrnStn(); +// +// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。 +//// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { +//// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触"); +//// } +// // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗� +// if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { +// throw new CoolException(wrkMast.getWrkNo() + "淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�"); +// } +// +// 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.getStaNo()); // 婧愮珯 +//// 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) { +// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); +// } +// if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) { +// throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); +// } +// +// // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴� +// LocMast locMast = locMastService.selectById(sourceLocNo); +// locMast.setLocSts("Q"); +// locMast.setModiTime(new Date()); +// if (!locMastService.updateById(locMast)) { +// throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�"); +// } +// +//// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护 +//// staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); +//// staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); +//// devpThread.setPakMk(staProtocol.getSiteId(), false); +//// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); +//// if (!result) { +//// News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId()); +//// } +// +// barcodeThread.setBarcode("");//娓呯悊鏉$爜 +// +// } else if (code == 500){ +// if (ledThread != null) { +// String errorMsg = jsonObject.getString("msg"); +// if (!Cools.isEmpty(errorMsg)) { +// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg)); +// } +// } +// News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); +// } else { +//// staProtocol.setWorkNo((short) 32002); +//// staProtocol.setStaNo(pickSta.getBackSta().shortValue()); +//// devpThread.setPakMk(staProtocol.getSiteId(), false); +//// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); +// +// // led 寮傚父鏄剧ず +// if (ledThread != null) { +// String errorMsg = jsonObject.getString("msg"); +//// String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒"; +// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg)); +// } +// } +// +// } catch (Exception e) { +// e.printStackTrace(); +// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); +// } } } @@ -861,6 +901,12 @@ return false;//鍑哄簱绔欑偣涓嶅彲鍑� } + Integer liftNo = basDevp.getLiftNo();//鎼滅储鍑哄簱鎻愬崌鏈烘槸鍚﹀瓨鍦ㄥ叆搴撲换鍔★紝濡傚瓨鍦ㄧ姝㈠嚭搴� + List<WrkMast> liftWrkMasts = wrkMastMapper.selectInWrkMastByLiftNo(liftNo); + if (!liftWrkMasts.isEmpty()) { + return false;//瀛樺湪鍏ュ簱浠诲姟锛岀姝㈠嚭搴� + } + //鑾峰彇婧愮珯 LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(basDevp.getLiftNo(), Utils.getLev(wrkMast.getSourceLocNo())); if (liftStaProtocol == null) { @@ -1105,6 +1151,18 @@ if (!sourceBasDevp.getInEnable().equals("Y")) { return false;//绔欑偣涓嶅彲鍏� + } + + //鍒ゆ柇鎻愬崌鏈烘暣涓笁妤兼槸鍚﹂兘澶勪簬鍏ュ簱妯″紡 + Integer outInModel1 = Utils.getOutInModelByLift(sourceBasDevp.getLiftNo(), 1); + Integer outInModel2 = Utils.getOutInModelByLift(sourceBasDevp.getLiftNo(), 5); + Integer outInModel3 = Utils.getOutInModelByLift(sourceBasDevp.getLiftNo(), 8); + if (outInModel1 == null || outInModel2 == null || outInModel3 == null) { + return false;//涓嶅瓨鍦ㄥ嚭鍏ュ簱妯″紡 + } + + if (outInModel1 == 2 || outInModel2 == 2 && outInModel3 == 2) { + return false;//鍙鏈変竴涓浜庡嚭搴撴ā寮忥紝绂佹鍏ュ簱 } LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, sourceBasDevp.getLiftNo()); @@ -2013,10 +2071,10 @@ } /** - * AGV琛ヨ揣 => 鏈烘鑷傛嫞鏂� + * AGV琛ヨ揣 => 鐢熸垚鍏ュ簱閫氱煡妗� */ - public void agvRestockByRobot() { - //妫�娴�300绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗┿�佸伐浣滃彿 + public void robotGenerateAgvTask() { +//妫�娴�300绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗┿�佸伐浣滃彿 for (DevpSlave devp : slaveProperties.getDevp()) { // 鑾峰彇鍏ュ簱绔欎俊鎭� DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); @@ -2046,7 +2104,7 @@ } else if (staProtocol317.isAutoing() && !staProtocol317.isLoading()) { //鑷姩銆佹棤鐗� targetSta = (short) 317; - }else { + } else { continue;//娌℃湁绌洪棽绔欑偣 } @@ -2067,6 +2125,7 @@ //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 wrkMast.setStaNo(targetSta.intValue()); wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 + wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈� if (wrkMastMapper.updateById(wrkMast) > 0) { //鍚�300绔欏啓鍏ョ洰鏍囩珯 staProtocol = staProtocol.clone(); @@ -2088,6 +2147,7 @@ // //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 // wrkMast.setStaNo(targetSta.intValue()); // wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 +// wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈� // if (wrkMastMapper.updateById(wrkMast) > 0) { // //鍚�300绔欏啓鍏ョ洰鏍囩珯 // staProtocol = staProtocol.clone(); @@ -2103,9 +2163,23 @@ } } } + } + } + /** + * AGV琛ヨ揣 => 鏈烘鑷傛嫞鏂� + */ + public void agvRestockByRobot() { + //妫�娴�300绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗┿�佸伐浣滃彿 + for (DevpSlave devp : slaveProperties.getDevp()) { + // 鑾峰彇鍏ュ簱绔欎俊鎭� + DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol303 = devpThread.getStation().get(303); StaProtocol staProtocol317 = devpThread.getStation().get(317); + if (staProtocol303 == null || staProtocol317 == null) { + continue; + } + if (staProtocol303.isAutoing() && staProtocol303.isLoading() && staProtocol303.getWorkNo() != 0) { //璋冨害鏈烘鑷� //鏌ヨ鏄惁鏈夊伐浣滄。 @@ -2159,27 +2233,31 @@ continue; } - if (staProtocol309.isAutoing() && staProtocol309.isLoading()) { + if (staProtocol309.isAutoing() && staProtocol309.isLoading() && staProtocol309.isInEnable()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� - BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11);//308绔欐潯鐮佸櫒 + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 9);//308绔欐潯鐮佸櫒 if (barcodeThread == null) { continue; } String barcode = barcodeThread.getBarcode(); if(!Cools.isEmpty(barcode)) { //閫氱煡AGV鍙栬揣 - agvRestockCall("CS-301-001-01@3", barcode); + agvRestockCall("301-1", barcode); + log.info("閫氱煡AGV鍙栬揣锛屾潯鐮佸彿锛�" + barcode); } - } else if (staProtocol312.isAutoing() && staProtocol312.isLoading()) { + } + + if (staProtocol312.isAutoing() && staProtocol312.isLoading() && staProtocol312.isInEnable()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� - BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 12);//311绔欐潯鐮佸櫒 + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 10);//311绔欐潯鐮佸櫒 if (barcodeThread == null) { continue; } String barcode = barcodeThread.getBarcode(); if(!Cools.isEmpty(barcode)) { //閫氱煡AGV鍙栬揣 - agvRestockCall("CS-302-001-01@3", barcode); + agvRestockCall("302-1", barcode); + log.info("閫氱煡AGV鍙栬揣锛屾潯鐮佸彿锛�" + barcode); } } } @@ -2320,20 +2398,11 @@ } // 鍛戒护涓嬪彂 ------------------------------------------------------------------------------- if (!commands.isEmpty()) { - if (led.getId()>3){ - if (!MessageQueue.offer(SlaveType.Led, led.getId()-3, new Task(1, commands))) { - log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId()-3, led.getIp(), led.getPort()); - continue; - }else { - ledThread.setLedMk(false); - } + if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { + log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); + continue; }else { - if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { - log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); - continue; - }else { - ledThread.setLedMk(false); - } + ledThread.setLedMk(false); } } @@ -2698,6 +2767,22 @@ return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇� } + //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�*************** + List<NavigateNode> targetNodes = NyLiftUtils.getLiftStaNodes(wrkMast.getStaNo()); + if (targetNodes == null) { + return false;//鏈幏鍙栧埌鑺傜偣 + } + boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(targetNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(wrkMast.getLocNo()), null); + if (!checkPathIsAvailable) { + return false;//妫�娴嬬洰鏍囩珯鐐硅矾寰勬槸鍚︽湭琚崰鐢� + } + //灏濊瘯閿佸畾鐩爣绔欒矾寰� + boolean result2 = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), targetNodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢� + if (!result2) { + return false;//璺緞閿佸畾澶辫触 + } + //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�*************** + //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠� NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id); List<NyShuttleHttpCommand> commands = result.getCommands(); @@ -3053,6 +3138,7 @@ if (basLift.getPoint() == null) { return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍� } + NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY()); liftNode.setZ(liftSta.getLev()); @@ -3117,22 +3203,26 @@ return false; } -// //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐� -// BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), wrkMast.getLiftNo()); -// if (targetBasDevp == null) { -// return false;//缂哄皯绔欑偣淇℃伅 -// } +// //璺ㄦゼ灞傜Щ鍔ㄤ换鍔� +// if (Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(wrkMast.getLocNo())) { +// //鑾峰彇鐩爣绔� +// LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo()); +// if (liftSta == null) { +// return false;//鎵句笉鍒扮珯鐐� +// } // -// //鑾峰彇鎻愬崌鏈烘暟鎹� -// BasLift basLift = basLiftService.selectById(targetBasDevp.getLiftNo()); -// if (basLift == null) { -// return false;//娌℃湁鎻愬崌鏈烘暟鎹� +// //*************灏濊瘯瑙i攣鐩爣绔欒矾寰�*************** +// List<NavigateNode> targetNodes = NyLiftUtils.getLiftStaNodes(liftSta.getStaNo()); +// if (targetNodes == null) { +// return false;//鏈幏鍙栧埌鑺傜偣 +// } +// //灏濊瘯瑙i攣鐩爣绔欒矾寰� +// boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), targetNodes, false);//鎵�浣跨敤鐨勮矾寰勮繘琛岃В閿� +// if (!result) { +// return false;//璺緞瑙i攣澶辫触 +// } +// //*************灏濊瘯瑙i攣鐩爣绔欒矾寰�*************** // } -// if (basLift.getPoint() == null) { -// return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍� -// } -// NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY()); -// liftNode.setZ(basLift.getPoint$().getZ()); //灏忚溅宸茬粡鍦ㄧ洰鏍囧簱浣嶏紝鐩存帴璁ゅ畾灏忚溅绉诲姩浠诲姟瀹屾垚 if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) { @@ -3161,8 +3251,32 @@ return false; } - //鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠� - NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id); + NyShuttleOperaResult result = null; + //璺ㄦゼ灞傜Щ鍔ㄤ换鍔� + if (Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(wrkMast.getLocNo())) { + //闇�瑕佸皢鍓嶄袱涓妭鐐逛綔涓虹櫧鍚嶅崟鑺傜偣浼犲叆 + //鑾峰彇鐩爣绔� + LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo()); + if (liftSta == null) { + return false;//鎵句笉鍒扮珯鐐� + } + + List<NavigateNode> targetNodes = NyLiftUtils.getLiftStaNodes(liftSta.getStaNo()); + if (targetNodes == null) { + return false;//鏈幏鍙栧埌鑺傜偣 + } + + //璁剧疆璁$畻鑺傜偣鐨勭櫧鍚嶅崟 + ArrayList<int[]> whiteList = new ArrayList<>();//璁剧疆璁$畻鑺傜偣鐨勭櫧鍚嶅崟 + for (NavigateNode node : targetNodes) { + whiteList.add(new int[]{node.getX(), node.getY()}); + } + result = NyShuttleOperaUtils.getStartToTargetCommandsByWhites(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id, whiteList); + }else { + //鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠� + result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id); + } + if (result == null) { return false;//璺緞璁$畻澶辫触 } -- Gitblit v1.9.1