From 3f5607d4b5b6c9f4e2b5d27bb40c2bd0e440d903 Mon Sep 17 00:00:00 2001
From: dubin <dubin>
Date: 星期四, 21 八月 2025 09:49:48 +0800
Subject: [PATCH] 联调

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  197 +++++++++++++++++++++++++------------------------
 1 files changed, 100 insertions(+), 97 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 2d1f0c6..cbc9ff9 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -194,7 +194,8 @@
                         && staProtocol.isLoading()
                         && staProtocol.isInEnable()
                         && !staProtocol.isEmptyMk()
-                        && staProtocol.isPakMk()) {
+                        && staProtocol.isPakMk()
+                        && staProtocol.getWorkNo()==9999) {
                     if (Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                         News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
 
@@ -412,11 +413,11 @@
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickSta()) {
                 // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                if (barcodeThread == null) {
-                    continue;
-                }
-                String barcode = barcodeThread.getBarcode();
+//                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+//                if (barcodeThread == null) {
+//                    continue;
+//                }
+//                String barcode = barcodeThread.getBarcode();
                 // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
 
@@ -427,87 +428,87 @@
                     continue;
                 }
                 // 灏哄妫�娴嬪紓甯�
-                boolean back = false;
-                String errMsg = "";
-                if (!back && 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(staProtocol.getSiteId() > 400){
-                    back = false;
-                }
+//                boolean back = false;
+//                String errMsg = "";
+//                if (!back && 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(staProtocol.getSiteId() > 400){
+//                    back = false;
+//                }
 
                 // 閫�鍥�
-                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(wrkNo);
-                    News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", pickSta.getStaNo(), errMsg, wrkNo);
-                    wrkNo++;
-                    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());
-                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
-
-                    // led 寮傚父鏄剧ず
-                    if (ledThread != null) {
-                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errMsg));
-                    }
-                    continue;
-                }
-                if(staProtocol.getSiteId() < 400){
-                    if (!Cools.isEmpty(barcode)) {
-                        News.infoNoLog("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-                            continue;
-                        }
-                    } else {
-                        continue;
-                    }
-
-
-                    if (!Cools.isEmpty(barcode)) {
-//                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-                            continue;
-                        }
-                    } else {
-                        continue;
-                    }
-
-                }
+//                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(wrkNo);
+//                    News.info("{}鍏ュ簱鍥為��锛歿}锛屼换鍔″彿锛歿}", pickSta.getStaNo(), errMsg, wrkNo);
+//                    wrkNo++;
+//                    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());
+//                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
+//
+//                    // led 寮傚父鏄剧ず
+//                    if (ledThread != null) {
+//                        MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(5, errMsg));
+//                    }
+//                    continue;
+//                }
+//                if(staProtocol.getSiteId() < 400){
+//                    if (!Cools.isEmpty(barcode)) {
+//                        News.infoNoLog("" + mark + " - 1" + " - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                            continue;
+//                        }
+//                    } else {
+//                        continue;
+//                    }
+//
+//
+//                    if (!Cools.isEmpty(barcode)) {
+////                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+//                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+//                            continue;
+//                        }
+//                    } else {
+//                        continue;
+//                    }
+//
+//                }
 
 
                 if (staProtocol == null) {
@@ -519,12 +520,14 @@
 //                // 鍏ュ嚭搴撴ā寮忓垽鏂�
 //                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
 
-                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
+//                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
+                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk()) {
                     News.warnNoLog("" + mark + " - 0" + " - 寮�濮嬫墽琛�");
-                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
-                    if(staProtocol.getSiteId() > 400){
-                        wrkMast = wrkMastMapper.selectPickStep3(staProtocol.getWorkNo());
-                    }
+//                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
+                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+//                    if(staProtocol.getSiteId() > 400){
+//                        wrkMast = wrkMastMapper.selectPickStep3(staProtocol.getWorkNo());
+//                    }
 //                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                     if (wrkMast == null) {
                         // 鏃犳嫞鏂欐暟鎹�
@@ -551,12 +554,12 @@
                             .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
                     StaDesc staDesc = staDescService.selectOne(wrapper);
                     if (Cools.isEmpty(staDesc)) {
-                        News.error("" + mark + " - 2" + " - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
-                        staProtocol.setWorkNo(wrkNo++);
-                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue() - (short) 1));
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        log.error("杈撻�佺嚎涓嬪彂4锛�" + 9989 + "," + (pickSta.getStaNo().shortValue() - (short) 1));
+//                        News.error("" + mark + " - 2" + " - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+//                        staProtocol.setWorkNo(wrkNo++);
+//                        staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue() - (short) 1));
+//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
+//                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+//                        log.error("杈撻�佺嚎涓嬪彂4锛�" + 9989 + "," + (pickSta.getStaNo().shortValue() - (short) 1));
                         //LED
                         LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
                         // led 寮傚父鏄剧ず
@@ -627,7 +630,7 @@
             }
 
         }
-//        News.infoNoLog(""+mark+" - 0"+" - 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱  ===銆嬫墽琛屽畬鎴�");
+        News.infoNoLog(""+mark+" - 0"+" - 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱  ===銆嬫墽琛屽畬鎴�");
     }
 
 

--
Gitblit v1.9.1