From 462065efc838cdf3c2102ccdedbf59b37576ccdc Mon Sep 17 00:00:00 2001 From: zhangchao <zc857179121@qq.com> Date: 星期日, 01 九月 2024 15:48:19 +0800 Subject: [PATCH] 对照协议调整 --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 80 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 74 insertions(+), 6 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 79ac93f..5a2499d 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -116,10 +116,7 @@ for (DevpSlave.Sta inSta : devp.getInSta()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); - if (barcodeThread == null) { - continue; - } - // 鑾峰彇鍏ュ簱绔欎俊鎭� + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); if (staProtocol == null) { @@ -128,8 +125,79 @@ staProtocol = staProtocol.clone(); } + if (barcodeThread == null) { + continue; + } + String barcode = barcodeThread.getBarcode(); + // 灏哄妫�娴嬪紓甯� + boolean back = false; + String errMsg = ""; + if (staProtocol.isFrontErr()) { + errMsg = "鍓嶈秴闄�"; + back = true; + } + if (!back && staProtocol.isBackErr()) { + errMsg = "鍚庤秴闄�"; + back = true; + } + if (!back && staProtocol.isHighErr()) { + errMsg = "楂樿秴闄�"; + back = true; + } + if (!back && staProtocol.isLeftErr()) { + errMsg = "宸﹁秴闄�"; + back = true; + } + if (!back && staProtocol.isRightErr()) { + errMsg = "鍙宠秴闄�"; + back = true; + } + if (!back && staProtocol.isWeightErr()) { + errMsg = "瓒呴噸"; + back = true; + } + if (!back && staProtocol.isBarcodeErr()) { + errMsg = "鎵爜澶辫触"; + back = true; + } + + // 閫�鍥� + if (back) { + log.info("errmsg: " + errMsg); +// News.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg); + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); + + if (!staProtocol.isLoading()) { + continue; + } + if (!staProtocol.isPakMk()) { + continue; + } + staProtocol.setWorkNo((short) 9999); + News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", inSta.getStaNo(), errMsg, (short) 9999); + staProtocol.setStaNo(inSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + log.error("杈撻�佺嚎涓嬪彂1锛�" + 9999 + "," + inSta.getBackSta()); + } + + + // 鑾峰彇鏉$爜鎵弿浠俊鎭� + //BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); + if (barcodeThread == null) { + continue; + } + // 鑾峰彇鍏ュ簱绔欎俊鎭� + //SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); + //StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); + if (staProtocol == null) { + continue; + } else { + staProtocol = staProtocol.clone(); + } + //LED - LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); + //LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); // 鍏ュ嚭搴撴ā寮忓垽鏂� // if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; } // if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) { @@ -165,7 +233,7 @@ // Thread.sleep(300); // }catch (Exception e){} - String barcode = barcodeThread.getBarcode(); + //String barcode = barcodeThread.getBarcode(); if (!Cools.isEmpty(barcode)) { News.info("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode); if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { -- Gitblit v1.9.1