From 0bf33fa68e6f7d1c2c742921db895fb8c3a53228 Mon Sep 17 00:00:00 2001 From: zhangchao <zc857179121@qq.com> Date: 星期一, 02 九月 2024 17:59:31 +0800 Subject: [PATCH] 对照协议调整 --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 189 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 141 insertions(+), 48 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 68662bd..88f77ec 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -95,7 +95,7 @@ if (bay == 2 || bay == 7) { return (short) 3; } else if (bay == 3) { - return (short) 1; + return (short) 2; } else if (bay == 4) { return (short) 2; } else if (bay == 5) { @@ -165,7 +165,7 @@ if (back) { log.info("errmsg: " + errMsg); // News.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg); - MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg)); + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg)); if (!staProtocol.isLoading()) { continue; } @@ -178,52 +178,26 @@ devpThread.setPakMk(staProtocol.getSiteId(), false); MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); log.error("杈撻�佺嚎涓嬪彂1锛�" + 9999 + "," + inSta.getBackSta()); + + // led 寮傚父鏄剧ず + if (ledThread != null) { + MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg)); + } + continue; } - - - - - //LED - //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) { -// continue; -// } - //System.out.println(staProtocol); // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢 if (!staProtocol.isLoading()) { continue; } - String barcode11 = barcodeThread.getBarcode(); - if (Cools.isEmpty(barcode11)) { - if (staProtocol.isAutoing() && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9999 && staProtocol.isPakMk() && staProtocol.getStamp() == 2) { - staProtocol.setStamp(3); - News.info("" + mark + " - 7" + " - 鎵爜澶辫触2 ===>> {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{},绔欑偣:{}", inSta.getBarcode(), barcode11, inSta.getStaNo()); - staProtocol.setWorkNo((short) 9989); - 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 = "鎵爜澶辫触锛岃閲嶈瘯"; - MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg)); - } - continue; - } - } + System.out.println(staProtocol); if (staProtocol.isAutoing() && staProtocol.isInEnable() - && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) + && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 6001) && staProtocol.isPakMk() && staProtocol.getStamp() >= 2 && staProtocol.getStamp() != 3) {// && !Cools.isEmpty(barcode)) { - News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�"); -// try { -// Thread.sleep(300); -// }catch (Exception e){} + News.warn("" + mark + " - 0" + " - 寮�濮嬫墽琛�"); - //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)) { + News.infoNoLog("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode); + if ("NG".endsWith(barcode) || barcode.equals("00000000") || "NoRead".equals(barcode) || "empty".equals(barcode)) { staProtocol.setWorkNo((short) 9999); staProtocol.setStaNo(inSta.getBackSta().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -438,10 +412,75 @@ for (DevpSlave.Sta pickSta : devp.getPickSta()) { // 鑾峰彇鏉$爜鎵弿浠俊鎭� BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); + SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); + StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo()); + if (staProtocol == null) { + continue; + } else { + 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, pickSta.getLed(), new Task(5, errMsg)); + if (!staProtocol.isLoading()) { + continue; + } + if (!staProtocol.isPakMk()) { + continue; + } + staProtocol.setWorkNo((short) 9999); + News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", pickSta.getStaNo(), errMsg, (short) 9999); + staProtocol.setStaNo(pickSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + log.error("杈撻�佺嚎涓嬪彂1锛�" + 9999 + "," + pickSta.getBackSta()); + + // led 寮傚父鏄剧ず + if (ledThread != null) { + MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errMsg)); + } + continue; + } if (!Cools.isEmpty(barcode)) { News.info("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) { @@ -452,8 +491,6 @@ } // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭� - SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); - StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo()); if (staProtocol == null) { continue; } else { @@ -498,7 +535,6 @@ devpThread.setPakMk(staProtocol.getSiteId(), false); MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); //LED - LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed()); // led 寮傚父鏄剧ず if (ledThread != null) { String errorMsg = "姝や负鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱.璇锋斁鍦�" + pickSta.getBackSta().shortValue() + "绔欑偣"; @@ -866,7 +902,6 @@ } } } - System.out.println("434323"); News.warnNoLog("" + mark + " - 1" + " - 15" + " - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}", wrkMast.getWrkNo().shortValue() , crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue() , locMast.getRow1().shortValue(), locMast.getBay1().shortValue(), locMast.getLev1().shortValue()); @@ -1503,6 +1538,8 @@ // 閬嶅巻绌烘澘鍏ュ簱鍙� for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) { // 鑾峰彇绌烘澘鍏ュ簱绔欎俊鎭� + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, emptyInSta.getBarcode()); + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed()); SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo()); if (staProtocol == null) { @@ -1511,9 +1548,65 @@ staProtocol = staProtocol.clone(); } - LedThread ledThread = null; - if (!Cools.isEmpty(emptyInSta.getLed())) { - ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed()); + 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, emptyInSta.getLed(), new Task(5, errMsg)); + if (!staProtocol.isLoading()) { + continue; + } + if (!staProtocol.isPakMk()) { + continue; + } + staProtocol.setWorkNo((short) 9999); + News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", emptyInSta.getStaNo(), errMsg, (short) 9999); + staProtocol.setStaNo(emptyInSta.getBackSta().shortValue()); + devpThread.setPakMk(staProtocol.getSiteId(), false); + MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + log.error("杈撻�佺嚎涓嬪彂1锛�" + 9999 + "," + emptyInSta.getBackSta()); + + // led 寮傚父鏄剧ず + if (ledThread != null) { + MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(5, errMsg)); + } + continue; } if (!staProtocol.isLoading()) { @@ -1524,7 +1617,7 @@ if (staProtocol.isAutoing() && staProtocol.isInEnable() && staProtocol.isEmptyMk() - && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) + && (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk() && staProtocol.getStamp() >= 2) { News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛岋細绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�"); @@ -2262,7 +2355,7 @@ if (staProtocol.isAutoing() //鑷姩 && staProtocol.isLoading() //鏈夌墿 && staProtocol.isInEnable() //鍙叆淇″彿 - && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() > 9990) //宸ヤ綔鍙蜂负0鎴栬�呭伐浣滃彿鏄�9991~9999锛堣緭閫佹満鐣欑敤锛� + && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() >= 9990) //宸ヤ綔鍙蜂负0鎴栬�呭伐浣滃彿鏄�9991~9999锛堣緭閫佹満鐣欑敤锛� ) { try { -- Gitblit v1.9.1