From bbc298ef75c0eef33d8eded259749b3b5993ccd7 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期二, 29 十一月 2022 19:15:37 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   37 ++++++++++--------
 src/main/java/com/zy/core/thread/SiemensDevpThread.java     |   30 +++++++++++----
 src/main/resources/application.yml                          |   24 ++++++------
 3 files changed, 54 insertions(+), 37 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 fbf93d9..5572d00 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -325,20 +325,20 @@
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickSta()) {
-//                // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-//                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-//                if (barcodeThread == null) {
-//                    continue;
-//                }
-//                String barcode = barcodeThread.getBarcode();
-//                if(!Cools.isEmpty(barcode)) {
-//                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-//                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-//                        continue;
-//                    }
-//                } else {
-//                    continue;
-//                }
+               // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+               BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+               if (barcodeThread == null) {
+                   continue;
+               }
+               String barcode = barcodeThread.getBarcode();
+               if(!Cools.isEmpty(barcode)) {
+                   log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+                   if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                       continue;
+                   }
+               } else {
+                   continue;
+               }
 
                 // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -353,14 +353,17 @@
 //                if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
 
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
-//                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
-                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+                   WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+//                     WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+                    if(wrkMast == null){
+                        wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+                    }
                     if (wrkMast == null) {
                         // 鏃犳嫞鏂欐暟鎹�
                         continue;
                     }
                     if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
-                        || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
+                            || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
                         continue;
                     }
 
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index afc84f3..955f1b5 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -250,16 +250,30 @@
         }
 
         Thread.sleep(200);
-        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.150",(short)(barcodeSize*8));
-        if (result2.IsSuccess) {
-            for (int i = 0; i < barcodeSize; i++) {
-                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8");
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
-                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
-                    barcodeThread.setBarcode(barcode);
+        if(slave.getId()==1) {
+            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.150", (short) (barcodeSize * 8));
+            if (result2.IsSuccess) {
+                for (int i = 0; i < barcodeSize; i++) {
+                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
+                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+                        barcodeThread.setBarcode(barcode);
+                    }
                 }
-            }
 
+            }
+        } else if(slave.getId()==2) {
+            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.150", (short) (1 * 8));
+            if (result2.IsSuccess) {
+                for (int i = 0; i < 1; i++) {
+                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 4);
+                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
+                        barcodeThread.setBarcode(barcode);
+                    }
+                }
+
+            }
         }
 
 //        OperateResultExOne<Short> result2 = siemensS7Net.ReadInt16("DB200.0");
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 3735333..0f4f3f3 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -34,7 +34,7 @@
   enable: false
 
 wms:
-  url: 10.10.10.210:8080/lywms
+  url: 127.0.0.1:8080/lywms
 
 # 涓嬩綅鏈洪厤缃�
 wcs-slave:
@@ -146,7 +146,7 @@
   # 鍫嗗灈鏈�4
   crn[3]:
     id: 4
-    ip: 10.10.10.200
+    ip: 10.10.10.130
     port: 102
     rack: 0
     slot: 0
@@ -155,22 +155,22 @@
     demo: false
     # 鍫嗗灈鏈哄叆搴撶珯鐐�
     crnInStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 401
+      devpPlcId: ${wcs-slave.devp[1].id}
+      staNo: 402
       row: 14
       bay: 1
       lev: 1
     # 鍫嗗灈鏈哄叆搴撶珯鐐�
     crnInStn[1]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 401
+      devpPlcId: ${wcs-slave.devp[1].id}
+      staNo: 402
       row: 14
       bay: 1
       lev: 1
     # 鍫嗗灈鏈哄嚭搴撶珯鐐�
     crnOutStn[0]:
-      devpPlcId: ${wcs-slave.devp[0].id}
-      staNo: 401
+      devpPlcId: ${wcs-slave.devp[1].id}
+      staNo: 402
       row: 14
       bay: 1
       lev: 1
@@ -232,14 +232,14 @@
     slot: 0
     # 鍏ュ簱鍙�1
     inSta[0]:
-      staNo: 401
+      staNo: 402
       barcode: ${wcs-slave.barcode[3].id}
     # 绌烘澘鍏ュ簱鍙�1
     emptyInSta[0]:
-      staNo: 401
+      staNo: 402
     # 鍑哄簱鍙�1
     outSta[0]:
-      staNo: 402
+      staNo: 401
     # 鎷f枡鍏ュ簱鍙�1
     pickSta[0]:
       staNo: 402
@@ -260,7 +260,7 @@
     port: 51236
   barcode[3]:
     id: 4
-    ip: 10.10.10.94
+    ip: 10.10.10.95
     port: 51236
    # LED1
   led[0]:

--
Gitblit v1.9.1