From c946b206b0923e8b9567a529b8fd5d2d684c8265 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期六, 17 五月 2025 20:03:42 +0800
Subject: [PATCH] 完成调试

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 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 4c738c0..a47497c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -309,6 +309,10 @@
             if (wrkMast == null) {
                 return;
             }
+            if (wrkMast.getPltType().shortValue() != staProtocol.getFinishWorkNo()) {
+                log.info("宸ヤ綔妗e拰瀹岀粨宸ヤ綔鍙蜂笉鍖归厤锛寋}锛寋}", wrkMast.getPltType(), staProtocol.getFinishWorkNo());
+                return;
+            }
             Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "2.5F_Mode"));
             if (Cools.isEmpty(config) || config.getValue().equals("false")) {
                 return;
@@ -352,11 +356,19 @@
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickSta()) {
                 // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                if (barcodeThread == null) {
+//                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+//                if (barcodeThread == null) {
+//                    continue;
+//                }
+                // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+                StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
+                if (staProtocol == null) {
                     continue;
+                } else {
+                    staProtocol = staProtocol.clone();
                 }
-                String barcode = barcodeThread.getBarcode();
+                String barcode = staProtocol.getBarcode();
                 if (!Cools.isEmpty(barcode)) {
 //                    News.info(""+mark+" - 1"+" - {}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
                     if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
@@ -366,14 +378,6 @@
                     continue;
                 }
 
-                // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
-                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 (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
@@ -465,7 +469,7 @@
 
                     // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                     staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
-                    staProtocol.setStaNo((short) 161);
+                    staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                     devpThread.setPakMk(staProtocol.getSiteId(), false);
                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                     log.error("杈撻�佺嚎涓嬪彂5锛�" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo());
@@ -506,11 +510,8 @@
                         && staProtocol.isPakMk()) {
 
                     // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-                    if (barcodeThread == null) {
-                        continue;
-                    }
-                    String barcode = barcodeThread.getBarcode();
+
+                    String barcode = staProtocol.getBarcode();
                     if (!Cools.isEmpty(barcode)) {
 //                        log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
                         if ("00000000".equals(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
@@ -604,7 +605,7 @@
                                 try {
                                     // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
                                     staProtocol.setWorkNo(dto.getWorkNo().shortValue());
-                                    staProtocol.setStaNo((short) 161);
+                                    staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                                     devpThread.setPakMk(staProtocol.getSiteId(), false);
 
                                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
@@ -753,6 +754,9 @@
                     if (wrkMast == null) {
                         continue;
                     }
+                    if (wrkMast.getWrkNo().shortValue() != staProtocol.getFinishWorkNo()) {
+                        continue;
+                    }
                     // 鍒ゆ柇宸ヤ綔妗f潯浠�
                     if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                         continue;
@@ -760,7 +764,7 @@
 
                     // 涓嬪彂绔欑偣淇℃伅
                     staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
-                    staProtocol.setStaNo(RouteUtils.CrnStaEnd(1031, 1135));
+                    staProtocol.setStaNo((short) 1031);
                     if (!MessageQueue.offer(SlaveType.Devp, devpSlave.getId(), new Task(2, staProtocol))) {
                         log.info(staProtocol.getWorkNo() + "," + staProtocol.getStaNo() + "杈撻�佺嚎鍑哄簱鍛戒护涓嬪彂澶辫触222");
                         continue;

--
Gitblit v1.9.1