From cc45bd4b1dd65cfd806ae54ddd74c165c57c1e8e Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期日, 24 十二月 2023 12:12:32 +0800
Subject: [PATCH] #提升机

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 99d6878..09a24c6 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -170,7 +170,7 @@
             OutputQueue.DEVP.offer(MessageFormat.format( "銆恵0}銆戣緭閫佺嚎plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}]  [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
             News.error("杈撻�佺嚎plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         }
-        siemensS7Net.ConnectClose();
+//        siemensS7Net.ConnectClose();
         return result;
     }
 
@@ -260,92 +260,92 @@
             }
         }
 
-        //鍑哄叆搴撶珯鐐规娴嬫姤璀︿俊鎭�
-        Thread.sleep(100);
-        for (Integer staNo : outInAlarmStaNos) {
-            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".20.0", (short) 2);
-            if (result5.IsSuccess) {
-                if (staNo == 101 || staNo == 201) {
-                    staNo--;
-                }else {
-                    staNo++;
-                }
-                StaProtocol staProtocol = station.get(staNo);
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(result5.Content, 0, 2);
-                staProtocol.setBarcodeErr(status[4]);//鎵爜澶辫触
-                staProtocol.setFrontErr(status[8]);//鍓嶈秴闄�
-                staProtocol.setBackErr(status[9]);//鍚庤秴闄�
-                staProtocol.setLeftErr(status[10]);//宸﹁秴闄�
-                staProtocol.setRightErr(status[11]);//鍙宠秴闄�
-                staProtocol.setHighErr(status[12]);//瓒呴珮
-                staProtocol.setWeightErr(status[13]);//瓒呴噸
-            }
-        }
-
-        Thread.sleep(100);
-        for (Integer staNo : staNos2) {
-            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48);
-            if (result5.IsSuccess) {
-                StaProtocol staProtocol = station.get(staNo);
-                StaProtocol staProtocol300 = station.get(300);
-                if (null == staProtocol) {
-                    staProtocol = new StaProtocol();
-                    staProtocol.setSiteId(staNo);
-                    station.put(staNo, staProtocol);
-                }
-
-                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 1, 1);
-                staProtocol.setAutoing(staProtocol300.isAutoing());  // 鑷姩
-                staProtocol.setLoading(status1[2]);  // 鏈夌墿
-
-                if (staNos3.contains(staNo) || staNos4.contains(staNo)) {
-                    continue;
-                }
-                if (staNo == 344) {
-                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 34));     // 宸ヤ綔鍙�
-                }else {
-                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 22));     // 宸ヤ綔鍙�
-                }
-            }
-        }
-
-        Thread.sleep(100);
-        for (Integer staNo : staNos3) {
-            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
-            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".218.0", (short) 2);
-            if (result5.IsSuccess && result6.IsSuccess) {
-                StaProtocol staProtocol = station.get(staNo);
-                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
-                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
-                short wrkNo = 0;
-                if (wrkNo1 != 0) {
-                    wrkNo = wrkNo1;
-                }
-                if (wrkNo2 != 0) {
-                    wrkNo = wrkNo2;
-                }
-                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
-            }
-        }
-
-        Thread.sleep(100);
-        for (Integer staNo : staNos4) {
-            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
-            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".250.0", (short) 2);
-            if (result5.IsSuccess && result6.IsSuccess) {
-                StaProtocol staProtocol = station.get(staNo);
-                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
-                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
-                short wrkNo = 0;
-                if (wrkNo1 != 0) {
-                    wrkNo = wrkNo1;
-                }
-                if (wrkNo2 != 0) {
-                    wrkNo = wrkNo2;
-                }
-                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
-            }
-        }
+//        //鍑哄叆搴撶珯鐐规娴嬫姤璀︿俊鎭�
+//        Thread.sleep(100);
+//        for (Integer staNo : outInAlarmStaNos) {
+//            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".20.0", (short) 2);
+//            if (result5.IsSuccess) {
+//                if (staNo == 101 || staNo == 201) {
+//                    staNo--;
+//                }else {
+//                    staNo++;
+//                }
+//                StaProtocol staProtocol = station.get(staNo);
+//                boolean[] status = siemensS7Net.getByteTransform().TransBool(result5.Content, 0, 2);
+//                staProtocol.setBarcodeErr(status[4]);//鎵爜澶辫触
+//                staProtocol.setFrontErr(status[8]);//鍓嶈秴闄�
+//                staProtocol.setBackErr(status[9]);//鍚庤秴闄�
+//                staProtocol.setLeftErr(status[10]);//宸﹁秴闄�
+//                staProtocol.setRightErr(status[11]);//鍙宠秴闄�
+//                staProtocol.setHighErr(status[12]);//瓒呴珮
+//                staProtocol.setWeightErr(status[13]);//瓒呴噸
+//            }
+//        }
+//
+//        Thread.sleep(100);
+//        for (Integer staNo : staNos2) {
+//            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48);
+//            if (result5.IsSuccess) {
+//                StaProtocol staProtocol = station.get(staNo);
+//                StaProtocol staProtocol300 = station.get(300);
+//                if (null == staProtocol) {
+//                    staProtocol = new StaProtocol();
+//                    staProtocol.setSiteId(staNo);
+//                    station.put(staNo, staProtocol);
+//                }
+//
+//                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 1, 1);
+//                staProtocol.setAutoing(staProtocol300.isAutoing());  // 鑷姩
+//                staProtocol.setLoading(!status1[2]);  // 鏈夌墿
+//
+//                if (staNos3.contains(staNo) || staNos4.contains(staNo)) {
+//                    continue;
+//                }
+//                if (staNo == 344) {
+//                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 34));     // 宸ヤ綔鍙�
+//                }else {
+//                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 22));     // 宸ヤ綔鍙�
+//                }
+//            }
+//        }
+//
+//        Thread.sleep(100);
+//        for (Integer staNo : staNos3) {
+//            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
+//            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".218.0", (short) 2);
+//            if (result5.IsSuccess && result6.IsSuccess) {
+//                StaProtocol staProtocol = station.get(staNo);
+//                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
+//                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
+//                short wrkNo = 0;
+//                if (wrkNo1 != 0) {
+//                    wrkNo = wrkNo1;
+//                }
+//                if (wrkNo2 != 0) {
+//                    wrkNo = wrkNo2;
+//                }
+//                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
+//            }
+//        }
+//
+//        Thread.sleep(100);
+//        for (Integer staNo : staNos4) {
+//            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
+//            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".250.0", (short) 2);
+//            if (result5.IsSuccess && result6.IsSuccess) {
+//                StaProtocol staProtocol = station.get(staNo);
+//                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
+//                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
+//                short wrkNo = 0;
+//                if (wrkNo1 != 0) {
+//                    wrkNo = wrkNo1;
+//                }
+//                if (wrkNo2 != 0) {
+//                    wrkNo = wrkNo2;
+//                }
+//                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
+//            }
+//        }
 
         if (result.IsSuccess && result1.IsSuccess) {
             OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));

--
Gitblit v1.9.1