From c48d0150aa9f6b297671f28adb6b9dc95b529cfc Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期四, 05 六月 2025 16:59:39 +0800 Subject: [PATCH] 1 --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 126 ++++++++++++++++++++++++++--------------- 1 files changed, 80 insertions(+), 46 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 564d2ba..f9f9b19 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -95,6 +95,8 @@ @Autowired private WaitPakinMapper waitPakinMapper; + private Map<String, Integer> flagData = new HashMap<>(); + /** * 缁勬墭 * 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2 @@ -225,6 +227,7 @@ JSONObject jsonObject = JSON.parseObject(response); LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); Integer code = jsonObject.getInteger("code"); + Object redata = jsonObject.get("data"); if (code.equals(200)) { StartupDto dto = jsonObject.getObject("data", StartupDto.class); // plc 澶勭悊 @@ -247,19 +250,7 @@ // } // } // News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); - }else if (code == 800) { - staProtocol.setWorkNo((short) 9995); - staProtocol.setStaNo(inSta.getBackSta().shortValue()); - devpThread.setPakMk(staProtocol.getSiteId(), false); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); - - // led 寮傚父鏄剧ず - if (ledThread != null) { - String errorMsg = barcode + "娌℃湁瀵瑰簲绌哄簱浣�"; - MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); - } - } - else if (code == 700) { + } else if (code == 700) { staProtocol.setWorkNo((short) 9995); staProtocol.setStaNo(inSta.getBackSta().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -270,40 +261,82 @@ String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒"; MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); } - } else if (code == 500 || code == 1000) { - if (inSta.getStaNo().equals(103)) { - staProtocol.setWorkNo((short) 9996); - staProtocol.setStaNo((short) 203); - } - if (inSta.getStaNo().equals(203)) { - staProtocol.setWorkNo((short) 9996); - staProtocol.setStaNo((short) 103); - } - if (inSta.getStaNo().equals(113)) { - staProtocol.setWorkNo((short) 9995); - staProtocol.setStaNo((short) 114); - } else if (inSta.getStaNo().equals(213)) { - staProtocol.setWorkNo((short) 9995); - staProtocol.setStaNo((short) 214); - } + } else if (redata.toString().contains("鐗╂枡绫诲瀷鍜屽疄闄呯绫讳笉涓�鑷�")||redata.toString().contains("娣锋斁鐗╂枡绫诲瀷涓嶄竴鑷�")) { + staProtocol.setWorkNo((short) 9995); + staProtocol.setStaNo(inSta.getBackSta().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); - String data = jsonObject.getString("data"); - String msg = jsonObject.getString("msg"); - if (code == 500) { - // led 寮傚父鏄剧ず - if (ledThread != null) { - String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "妫�绱㈠簱浣嶅け璐�,璇锋鏌ュ簱瀛樺墿浣欍��===>>" + data + "--" + msg; - MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); - } - } else if (code == 1000) { - // led 寮傚父鏄剧ず - if (ledThread != null) { - String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "闇�瑕佹崲鍏ュ簱绔欍��"; - MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + + // led 寮傚父鏄剧ず + if (ledThread != null) { + String errorMsg = barcode + redata.toString(); + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + } + }else if (redata.toString().startsWith("800")){ + staProtocol.setWorkNo((short) 9995); + staProtocol.setStaNo(inSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + + // led 寮傚父鏄剧ず + if (ledThread != null) { + String errorMsg = barcode + "搴撲綅涓嶈冻"; + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + } + } else if ((code == 500 || code == 1000)) { + if (redata != null && redata.toString().startsWith("800")) { + Integer num = flagData.get(param.getBarcode()); + if (num != null) { + flagData.put(param.getBarcode(), num + 1); + } else { + flagData.put(param.getBarcode(), 1); } } + if (flagData.get(param.getBarcode()) != null && flagData.get(param.getBarcode()) >= 2) { + staProtocol.setWorkNo((short) 9995); + staProtocol.setStaNo(inSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + // led 寮傚父鏄剧ず + if (ledThread != null && redata != null) { + String errorMsg = barcode + redata.toString(); + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + } + } else { + if (inSta.getStaNo().equals(103)) { + staProtocol.setWorkNo((short) 9998); + staProtocol.setStaNo((short) 203); + } + if (inSta.getStaNo().equals(203)) { + staProtocol.setWorkNo((short) 9996); + staProtocol.setStaNo((short) 103); + } + if (inSta.getStaNo().equals(113)) { + staProtocol.setWorkNo((short) 9995); + staProtocol.setStaNo((short) 114); + } else if (inSta.getStaNo().equals(213)) { + staProtocol.setWorkNo((short) 9995); + staProtocol.setStaNo((short) 214); + } + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + String data = jsonObject.getString("data"); + String msg = jsonObject.getString("msg"); + if (code == 500) { + // led 寮傚父鏄剧ず + if (ledThread != null) { + String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "妫�绱㈠簱浣嶅け璐�,璇锋鏌ュ簱瀛樺墿浣欍��===>>" + data + "--" + msg; + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + } + } else if (code == 1000) { + // led 寮傚父鏄剧ず + if (ledThread != null) { + String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "闇�瑕佹崲鍏ュ簱绔欍��"; + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg)); + } + } + } } } catch (Exception e) { e.printStackTrace(); @@ -1207,7 +1240,8 @@ // 娌℃湁浣滀笟涓殑鍏ュ簱浠诲姟鏃讹紝鎵嶈兘鐢熸垚绉诲簱浠诲姟 WrkMast one2 = wrkMastService.selectOne(new EntityWrapper<WrkMast>() .eq("crn_no", slave.getId()) - .last(" and wrk_sts in (3,4,5,6,7,8)")); + .eq("source_loc_no", shallowLocNo)); + //.last(" and wrk_sts in (3,4,5,6,7,8)")); if (one2 == null) { moveLocForDeepLoc(slave, shallowLoc); // 缃《浠诲姟 @@ -2821,7 +2855,7 @@ /** * 璁╁皬杞︿粠 杩滅偣 ====>> 寰呮満 - * 绛夊緟鍫嗗灈鏈烘惉杩� + * 绛夊緟鍫嗗灈鏈烘惉杩� */ public synchronized void letCarBeWaiting(WrkMast wrkMast, Integer steNo, String locNo) { // 鑾峰彇绌挎杞︿俊鎭� @@ -2905,7 +2939,7 @@ /** * 璁╁皬杞︿粠 杩滅偣 ====>> 绉诲姩鍒拌繎鐐� - * 绛夊緟鍫嗗灈鏈烘惉杩� + * 绛夊緟鍫嗗灈鏈烘惉杩� */ public synchronized void letCarBeReady(WrkMast wrkMast, Integer steNo, String locNo) { // 鑾峰彇绌挎杞︿俊鎭� @@ -2949,7 +2983,7 @@ /** * 璁╁皬杞︿粠 杩滅偣 ====>> 绉诲姩鍒拌繎鐐� - * 绛夊緟鍫嗗灈鏈烘惉杩� + * 绛夊緟鍫嗗灈鏈烘惉杩� */ public synchronized void letCarBeReady(WrkCharge wrkCharge, Integer steNo) { // 鑾峰彇绌挎杞︿俊鎭� -- Gitblit v1.9.1