From c88c8381441298cd209a5e41222f2011f911511b Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期六, 14 十月 2023 08:56:15 +0800 Subject: [PATCH] #AGV补货 --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 132 ++++++++++++++++++++++---------------------- 1 files changed, 66 insertions(+), 66 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 d516740..db387a9 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -1196,6 +1196,23 @@ return false;//鍑哄簱绔欑偣涓嶅瓨鍦� } + //鑾峰彇婧愮珯瀵瑰簲鐨勭墰鐪兼彁鍗囨満绔欑偣缂栧彿(璧风偣缂栧彿) + LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(basDevp.getLiftNo(), Utils.getLev(wrkMast.getSourceLocNo())); + if (liftStaProtocol == null) { + return false;//鎵句笉鍒扮珯鐐� + } + Integer startSta = liftStaProtocol.getStaNo(); + + NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); + if (shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) { + //灏忚溅杩樺湪杈撻�佺珯鐐� + //璋冨害灏忚溅閬胯 + boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread); + if (!result) { + return false; + } + } + if (!basDevp.getOutEnable().equals("Y")) { return false;//鍑哄簱绔欑偣涓嶅彲鍑� } @@ -1220,23 +1237,6 @@ WrkMast liftWrkMast = wrkMastMapper.selectLiftWrkMast(liftThread.getSlave().getId()); if (liftWrkMast != null) { return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇� - } - - //鑾峰彇婧愮珯瀵瑰簲鐨勭墰鐪兼彁鍗囨満绔欑偣缂栧彿(璧风偣缂栧彿) - LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(liftThread.getSlave().getId(), Utils.getLev(wrkMast.getSourceLocNo())); - if (liftStaProtocol == null) { - return false;//鎵句笉鍒扮珯鐐� - } - Integer startSta = liftStaProtocol.getStaNo(); - - NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); - if (shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) { - //灏忚溅杩樺湪杈撻�佺珯鐐� - //璋冨害灏忚溅閬胯 - boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread); - if (!result) { - return false; - } } //鑾风洰鏍囩珯婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐� @@ -2005,54 +2005,54 @@ if (wrkMast.getStaNo() != 303 && wrkMast.getStaNo() != 317) { //鍚慉GV鍙戣捣缁勬墭璇锋眰 -// try { -// HashMap<String, Object> param = new HashMap<>(); -// param.put("wrkNo", wrkMast.getWrkNo()); -// String response = new HttpHandler.Builder() -// .setUri(wmsUrl) -// .setPath("/openAGV") -// .setJson(JSON.toJSONString(param)) -// .build() -// .doPost(); -// JSONObject jsonObject = JSON.parseObject(response); -// Integer code = jsonObject.getInteger("code"); -// if (code.equals(200)) {//AGV缁勬墭鎴愬姛 -// //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 -// wrkMast.setStaNo(targetSta.intValue()); -// wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 -// if (wrkMastMapper.updateById(wrkMast) > 0) { -// //鍚�300绔欏啓鍏ョ洰鏍囩珯 -// staProtocol = staProtocol.clone(); -// staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯 -// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); -// try { -// Thread.sleep(500); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// continue; -// } -// } -// } catch (Exception e) { -// e.printStackTrace(); -// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); -// } - - //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 - wrkMast.setStaNo(targetSta.intValue()); - wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 - if (wrkMastMapper.updateById(wrkMast) > 0) { - //鍚�300绔欏啓鍏ョ洰鏍囩珯 - staProtocol = staProtocol.clone(); - staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯 - boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); - try { - Thread.sleep(500); - } catch (Exception e) { - e.printStackTrace(); + try { + HashMap<String, Object> param = new HashMap<>(); + param.put("wrkNo", wrkMast.getWrkNo()); + String response = new HttpHandler.Builder() + .setUri(wmsUrl) + .setPath("/rpc/replenishment") + .setJson(JSON.toJSONString(param)) + .build() + .doPost(); + JSONObject jsonObject = JSON.parseObject(response); + Integer code = jsonObject.getInteger("code"); + if (code.equals(200)) {//AGV缁勬墭鎴愬姛 + //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 + wrkMast.setStaNo(targetSta.intValue()); + wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 + if (wrkMastMapper.updateById(wrkMast) > 0) { + //鍚�300绔欏啓鍏ョ洰鏍囩珯 + staProtocol = staProtocol.clone(); + staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯 + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + try { + Thread.sleep(500); + } catch (Exception e) { + e.printStackTrace(); + } + continue; + } } - continue; + } catch (Exception e) { + e.printStackTrace(); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } + +// //瑕嗙洊宸ヤ綔妗g洰鏍囩珯 +// wrkMast.setStaNo(targetSta.intValue()); +// wrkMast.setShuttleNo(null);//閲婃斁灏忚溅 +// if (wrkMastMapper.updateById(wrkMast) > 0) { +// //鍚�300绔欏啓鍏ョ洰鏍囩珯 +// staProtocol = staProtocol.clone(); +// staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯 +// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); +// try { +// Thread.sleep(500); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// continue; +// } } } } @@ -2142,11 +2142,11 @@ private boolean agvRestockCall(String staNo, String barcode) { try { HashMap<String, Object> param = new HashMap<>(); - param.put("staNo", staNo); - param.put("barcode", barcode); + param.put("devNo", staNo); + param.put("containerCode", barcode); String response = new HttpHandler.Builder() .setUri(wmsUrl) - .setPath("/callAGV") + .setPath("/rpc/start") .setJson(JSON.toJSONString(param)) .build() .doPost(); -- Gitblit v1.9.1