From bfe18b8eaa127d34286ef29b89066f5053cb3aee Mon Sep 17 00:00:00 2001
From: lsh <1>
Date: 星期五, 26 一月 2024 09:52:53 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/model/protocol/StaProtocol.java   |   23 +++++++++++
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   56 +++++++++++++++++++++++++---
 src/main/java/com/zy/core/MainProcess.java                  |   11 ++++-
 src/main/java/com/zy/core/thread/SiemensDevpThread.java     |   23 +++++++++++
 src/main/resources/application.yml                          |    4 +-
 5 files changed, 106 insertions(+), 11 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 db7b609..5b1ac38a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -140,6 +140,47 @@
                     staProtocol = staProtocol.clone();
                 }
 
+                // 灏哄妫�娴嬪紓甯�
+                boolean back = false;
+                String errMsg = "寮傚父锛�";
+                if (staProtocol.isFrontErr()) {
+                    errMsg = errMsg+"鍓嶈秴闄愶紱";
+                    back = true;
+                }
+                if (staProtocol.isBackErr()) {
+                    errMsg = errMsg+"鍚庤秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isHighErr()) {
+                    errMsg = errMsg+"楂樿秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isLeftErr()) {
+                    errMsg = errMsg+"宸﹁秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isRightErr()) {
+                    errMsg = errMsg+"鍙宠秴闄�";
+                    back = true;
+                }
+                if (staProtocol.isWeightErr()) {
+                    errMsg = errMsg+"瓒呴噸";
+                    back = true;
+                }
+                if (staProtocol.isBarcodeErr()) {
+                    errMsg = errMsg+"鎵爜澶辫触";
+                    back = true;
+                }
+                // 閫�鍥�
+                if (back) {
+                    // led 寮傚父鏄剧ず
+                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                    if (ledThread != null) {
+                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+                    }
+                    continue;
+                }
+
                 // 鍏ュ嚭搴撴ā寮忓垽鏂�
 //                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
 //                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
@@ -3084,7 +3125,8 @@
                     if (!result) {
                         throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
                     }
-                    wrkMast.setWrkSts(52L);
+//                    wrkMast.setWrkSts(52L);
+                    wrkMast.setWrkSts(57L);
                     wrkMastMapper.updateById(wrkMast);
                     Thread.sleep(100);
 
@@ -3548,6 +3590,8 @@
                         default:
                             break;
                     }
+                }else {
+
                 }
                 for (int signCount = 1;!signWork && signCount<7;signCount++){
                     switch (signCount){
@@ -3577,11 +3621,11 @@
                     rgvIoExecuteSign = signWork;
                 }
             }
-            if (!rgvIoExecuteSign){
-                if (sign>6){
-                    rgvRunWrkMastEmptyStaAvoidance();//閬胯
-                }
-            }
+//            if (!rgvIoExecuteSign){
+//                if (sign>6){
+//
+//                }
+//            }
         }catch (Exception e){
             log.error("RGV灏忚溅浠诲姟涓嬪彂鎶ラ敊"+e);
         }
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 7a41bfb..e86a7d6 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -27,6 +27,7 @@
     // 棰戠巼
     private int i = 0;
     private int j = 0;
+    private int k = 0;
 
     /**
      * =====>>  寮�濮嬪伐浣�
@@ -74,12 +75,16 @@
 
                     /////////////////////////////////////RGV璋冨害/////////////////////////////////////
                     i++;
-                    if (i<8) {
+                    k++;
+                    if (i<7) {
                         // RGV  ===>>  灏忚溅浠诲姟浣滀笟涓嬪彂
                         try{
                             boolean rgvIoExecuteSign = mainService.rgvIoExecute(i);
-                            if (rgvIoExecuteSign && (i==6)){
-                                i = 0;
+                            if (rgvIoExecuteSign){
+                                k = 0;
+                            } else if (k>7){
+                                k = 0;
+                                mainService.rgvRunWrkMastEmptyStaAvoidance();//閬胯
                             }
                         }catch (Exception e){
                             log.error("RGV  ===>>  灏忚溅浠诲姟浣滀笟涓嬪彂寮傚父"+e);
diff --git a/src/main/java/com/zy/core/model/protocol/StaProtocol.java b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
index 2cff7fb..1fb2cc4 100644
--- a/src/main/java/com/zy/core/model/protocol/StaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -55,6 +55,29 @@
     // 闅斿绔欑偣锛堝彴杞︿綅缃級
     private String nearbySta;
 
+    // 澶栧舰妫�娴� ------------------------------------------------------------------------
+
+    // 鍓嶈秴闄�
+    private boolean frontErr;
+
+    // 鍚庤秴闄�
+    private boolean backErr;
+
+    // 楂樿秴闄�
+    private boolean highErr;
+
+    // 宸﹁秴闄�
+    private boolean leftErr;
+
+    // 鍙宠秴闄�
+    private boolean rightErr;
+
+    // 瓒呴噸
+    private boolean weightErr;
+
+    // 鎵爜澶辫触
+    private boolean barcodeErr;
+
     public BasDevp toSqlModel(){
         BasDevp basDevp = new BasDevp();
         basDevp.setDevNo(siteId);
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 124dc9e..7d28ca9 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -209,6 +209,29 @@
                 }
             }
         }
+
+        Thread.sleep(200);
+        OperateResultExOne<byte[]> resultError = siemensS7Net.Read("DB101.800", (short) (8));
+        if (resultError.IsSuccess && staNoSize==staNos2.size()) {
+            ArrayList<Integer> staNoError = new ArrayList<Integer>() {{ add(217);add(221); }};
+            for (int i = 0; i < staNoError.size(); i++) {
+                Integer siteId = staNoError.get(i); // 绔欑偣缂栧彿
+                StaProtocol staProtocol = station.get(siteId);
+                if (null == staProtocol) {
+                    staProtocol = new StaProtocol();
+                    staProtocol.setSiteId(siteId);
+                    station.put(siteId, staProtocol);
+                }
+                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultError.Content, i*4 + 2, 1);
+                staProtocol.setFrontErr(status[0]);// 鍓嶈秴闄�
+                staProtocol.setBackErr(status[1]);// 鍚庤秴闄�
+                staProtocol.setHighErr(status[2]);// 楂樿秴闄�
+                staProtocol.setLeftErr(status[3]);// 宸﹁秴闄�
+                staProtocol.setRightErr(status[4]);// 鍙宠秴闄�
+                staProtocol.setWeightErr(status[5]); // 瓒呴噸
+                staProtocol.setBarcodeErr(status[6]);// 鎵爜澶辫触
+            }
+        }
 //        Thread.sleep(200);
 //        OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186);
 //        if (result0.IsSuccess) {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 8569c31..eebedc9 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -423,12 +423,12 @@
     inSta[0]:
       staNo: 217
       barcode: ${wcs-slave.barcode[0].id}
-      led: ${wcs-slave.led[1].id}
+      led: ${wcs-slave.led[2].id}
     # 鍏ュ簱鍙�1
     inSta[1]:
       staNo: 221
       barcode: ${wcs-slave.barcode[1].id}
-      led: ${wcs-slave.led[2].id}
+      led: ${wcs-slave.led[1].id}
     # WMS鍏ュ簱鍙�1
     inWmsSta[0]:
       staNo: 212

--
Gitblit v1.9.1