From b9927bd58cdc940069c7640f3cc04a60dd37ef87 Mon Sep 17 00:00:00 2001
From: lsh <1>
Date: 星期四, 21 三月 2024 10:05:49 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 52c745a..f03b158 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -262,6 +262,34 @@
             }
         }
 
+        OperateResultExOne<byte[]> resultAgvAndPlcOk = siemensS7Net.Read("DB102.0", (short) 30);
+        if (resultAgvAndPlcOk.IsSuccess) {
+            for (int i = 0; i < staNoSize; i++) {
+                int sign =(i+2)/2-1;
+                if ((i+2)%2!=0){
+                    Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                    StaProtocol staProtocol = station.get(siteId);
+                    if (null == staProtocol) {
+                        staProtocol = new StaProtocol();
+                        staProtocol.setSiteId(siteId);
+                        station.put(siteId, staProtocol);
+                    }
+                    staProtocol.setAgvTargetPick(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6+4));     // 鍏佽鍙栬揣
+                    staProtocol.setAgvTargetPlace((short)0);   // 鍏佽鏀捐揣
+                    continue;
+                }
+                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                StaProtocol staProtocol = station.get(siteId);
+                if (null == staProtocol) {
+                    staProtocol = new StaProtocol();
+                    staProtocol.setSiteId(siteId);
+                    station.put(siteId, staProtocol);
+                }
+                staProtocol.setAgvTargetPick(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6));     // 鍏佽鍙栬揣
+                staProtocol.setAgvTargetPlace(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6 + 2));   // 鍏佽鏀捐揣
+            }
+        }
+
 
         if (slave.getId() == 1) {
             //鏉$爜
@@ -363,7 +391,7 @@
         }
         ArrayList<Integer> staNos = getStaNo();
         int index = staNos.indexOf(staProtocol.getSiteId());
-        if (staProtocol.getAgvTypeSign()==0){  //0鍙栬揣
+        if (staProtocol.getAgvTypeSign()==0 || staProtocol.getAgvTypeSign()==2 ){  //0鍙栬揣
             switch (staProtocol.getSiteId()){
                 case 100:
                     index=32;
@@ -415,7 +443,11 @@
         //浠诲姟涓嬪彂娆℃暟
         int writeCount = 0;
         do {
-            write = siemensS7Net.Write("DB102." + index, true);    // 浠诲姟瀹屾垚
+            short textWrite = 1;// 浠诲姟瀹屾垚
+            if (staProtocol.getAgvTypeSign()>1){
+                textWrite = 0;// 浠诲姟澶嶄綅
+            }
+            write = siemensS7Net.Write("DB102." + index, textWrite);
             if(write.IsSuccess){
                 writeCount=6;
             }else {
@@ -461,7 +493,8 @@
                 taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//鏇存柊鎸囦护姝ュ簭
                 taskWrkService.updateById(taskWrk);
             }else{
-                log.error("杈撻�佺嚎鍐欏叆澶辫触"+staProtocol+"++++++++++++++++++++++++++++++++++++++");
+                log.error(staProtocol+"++++++++++++++++++++++++++++++++++++++");
+//                log.error("杈撻�佺嚎鍐欏叆澶辫触"+staProtocol+"++++++++++++++++++++++++++++++++++++++");
             }
         }
 

--
Gitblit v1.9.1