From 584ce9e811602b984a91c6f895347cf9a0ca5974 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 03 六月 2023 15:46:12 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 9614269..afeead4 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -47,29 +47,18 @@
 //
 //    }};
     public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
-        add(100);add(101);add(102);add(103);
-        add(104);add(105);add(106);add(107);
-        add(108);add(109);add(110);add(111);
-        add(112);add(113);add(114);add(115);
-        add(116);add(117);add(118);add(119);
-        add(120);add(121);add(122);add(123);
-        add(124);add(125);add(126);add(127);
-        add(128);add(129);add(130);add(131);
-        add(132);add(133);add(134);add(135);
-        add(136);add(137);add(138);add(139);
-        add(140);add(141);add(142);add(143);
-        add(144);add(145);add(146);add(147);
-        add(148);add(149);add(150);add(151);
-        add(152);add(153);add(154);add(155);
-        add(156);add(157);add(158);
+        add(101);add(102);add(103);
+        add(104);add(105);add(106);
     }};
 
     public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
-        add(200);add(201);add(202);add(203);
-        add(204);add(205);add(206);add(207);
-        add(208);add(209);add(210);add(211);
-        add(212);add(213);add(214);add(215);
-        add(216);add(217);
+        add(201);add(202);add(203);
+        add(204);add(205);add(206);
+    }};
+
+    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
+        add(301);add(302);add(303);
+        add(304);add(305);add(306);
     }};
 
 
@@ -103,6 +92,8 @@
                 return staNos1;
             case 2:
                 return staNos2;
+            case 3:
+                return staNos3;
             default:
                 throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
         }
@@ -200,7 +191,7 @@
         ArrayList<Integer> staNos = getStaNo();
         int staNoSize = staNos.size();
         OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*2));
-        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2));
+        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.0", (short) (staNoSize*2));
         if (result.IsSuccess && result4.IsSuccess) {
             for (int i = 0; i < staNoSize; i++) {
                 Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
@@ -231,10 +222,10 @@
 //        }
         //鏉$爜鎵弿鍣�
         Thread.sleep(200);
-        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize/2*8));
-        if (result2.IsSuccess) {
+        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.0",(short)(barcodeSize/3*8));
+        if (result2.IsSuccess && 1!=1) {
             if (slave.getId()==1){
-                for (int i = 0; i < barcodeSize/2; i++) {
+                for (int i = 0; i < barcodeSize/3; 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)){
@@ -243,8 +234,17 @@
                     }
                 }
             }else if (slave.getId()==2){
-                for (int i = barcodeSize/2; i < barcodeSize; i++) {
-                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,(i-barcodeSize/2)*8,8, "UTF-8");
+                for (int i = barcodeSize/3; i < barcodeSize; i++) {
+                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,(i-barcodeSize/3)*8,8, "UTF-8");
+                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
+                    if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)){
+//                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
+                        barcodeThread.setBarcode(barcode);
+                    }
+                }
+            }else if (slave.getId()==3){
+                for (int i = barcodeSize/3+1; i < barcodeSize; i++) {
+                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,(i-(barcodeSize/3)*2)*8,8, "UTF-8");
                     BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                     if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)){
 //                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
@@ -255,7 +255,7 @@
         }
 
         Thread.sleep(200);
-        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB102.100", (short) (staNoSize * 2));
+        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.0", (short) (staNoSize * 2));
         if (result1.IsSuccess) {
             for (int i = 0; i < staNoSize; i++) {
                 Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
@@ -280,59 +280,8 @@
                     //lfd鍏ュ簱鍗拌  褰搒tamp>=2鏃舵墠鍏ュ簱
                     staProtocol.setStamp(staProtocol.getStamp()+1);
                 }
-
-//                //20230110锛屾棩蹇楁墦鍗帮紝纭鏀跺埌鍏ュ簱绔欏彲鍏ヤ俊鍙锋椂锛屽搴旀潯鐮佹暟鎹槸鍚﹀凡鏈�
-//                if ((siteId==101 || siteId==109 || siteId==117 || siteId==201 || siteId==207 || siteId==213)
-//                        && staProtocol.isInEnable()){
-//                    Integer barcodeId = 0;
-//                    switch (siteId){
-//                        case 101:
-//                            barcodeId=1;
-//                            break;
-//                        case 109:
-//                            barcodeId=2;
-//                            break;
-//                        case 117:
-//                            barcodeId=3;
-//                            break;
-//                        case 201:
-//                            barcodeId=4;
-//                            break;
-//                        case 207:
-//                            barcodeId=5;
-//                            break;
-//                        case 213:
-//                            barcodeId=6;
-//                            break;
-//                    }
-//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId);
-//                    if(barcodeThread!=null){
-//                        //lfd鍏ュ簱鍗拌  褰搒tamp>=2鏃舵墠鍏ュ簱
-//                        staProtocol.setStamp(staProtocol.getStamp()+1);
-//                        News.info("{}绔欐湁鍙叆淇″彿鏃讹紝鏉$爜鍊间负{}", siteId, barcodeThread.getBarcode());
-//                        if(Cools.isEmpty(barcodeThread.getBarcode())){
-//                            staProtocol.setInEnable(false);//鏉$爜鏁版嵁涓虹┖鏃讹紝鍏堟竻涓�娆″唴瀛樼殑绔欑偣鍙叆淇″彿锛岀瓑寰呬笅涓�娆¤幏鍙栧彲鍏ヤ俊鍙�
-//                        }
-//                    }
-//                }
             }
         }
-
-//        //RGV灏忚溅
-//        Thread.sleep(200);
-//        OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.160",(short)2);
-//        if (result3.IsSuccess) {
-//            Integer siteId = 16;
-//            StaProtocol staProtocol = station.get(siteId);
-//            if (null == staProtocol) {
-//                staProtocol = new StaProtocol();
-//                staProtocol.setSiteId(siteId);
-//                station.put(siteId, staProtocol);
-//            }
-//            staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0)));
-//        }
-
-
 
         if (result.IsSuccess && result1.IsSuccess) {
 

--
Gitblit v1.9.1