From 352c66676507d76fedb6f7332a138391baf85937 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 03 六月 2023 14:56:52 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensCrnThread.java  |    2 
 src/main/webapp/views/crn.html                          |   26 ++------
 src/main/webapp/static/js/console.map.js                |    2 
 src/main/webapp/static/js/common.js                     |    2 
 src/main/java/com/zy/core/enums/CrnModeType.java        |    1 
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   86 +++++++---------------------
 src/main/resources/application.yml                      |   10 +-
 7 files changed, 37 insertions(+), 92 deletions(-)

diff --git a/src/main/java/com/zy/core/enums/CrnModeType.java b/src/main/java/com/zy/core/enums/CrnModeType.java
index 7f2d84a..f585ff8 100644
--- a/src/main/java/com/zy/core/enums/CrnModeType.java
+++ b/src/main/java/com/zy/core/enums/CrnModeType.java
@@ -7,6 +7,7 @@
     HAND(1, "鎵嬪姩"),
     HALF_AUTO(2, "鍗婅嚜鍔�"),
     AUTO(3, "鑷姩"),
+    AUTO2(100, "寮傚父"),
     ;
 
     public Integer id;
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index ac81663..3d75e9b 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -149,7 +149,7 @@
      */
     private void readStatus(){
         try {
-            OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56);
+            OperateResultExOne<byte[]> result = siemensNet.Read("DB100.0", (short) 56);
             if (result.IsSuccess) {
                 if (null == crnProtocol) {
                     crnProtocol = new CrnProtocol();
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 96b194f..afeead4 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -47,18 +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(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(201);add(202);add(203);
+        add(204);add(205);add(206);
     }};
 
     public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
-        add(300);add(301);add(302);add(303);
-        add(304);add(305);add(306);add(307);
+        add(301);add(302);add(303);
+        add(304);add(305);add(306);
     }};
 
 
@@ -191,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); // 绔欑偣缂栧彿
@@ -222,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)){
@@ -234,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())) {
@@ -246,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); // 绔欑偣缂栧彿
@@ -271,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) {
 
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 0d20903..8f43631 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -34,21 +34,21 @@
   enable: false
 
 wms:
-  url: 192.168.0.17:8080/lktwms
+  url: 127.0.0.1:8080/lktwms
 
 # 涓嬩綅鏈洪厤缃�
 wcs-slave:
   # 鍙屾繁
   doubleDeep: true
   # 鍙屾繁搴撲綅鎺掑彿
-  doubleLocs: 9,12,15,18
+  doubleLocs: 1,4,11,14,21,24
   # 涓�涓爢鍨涙満璐熻矗鐨勮揣鏋舵帓鏁�
   groupCount: 4
   # 鍫嗗灈鏈�1
   crn[0]:
     id: 1
     ip: 192.168.4.250
-    port: 6000
+    port: 102
     rack: 0
     slot: 0
     # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
@@ -72,7 +72,7 @@
   crn[1]:
     id: 2
     ip: 192.168.4.250
-    port: 6000
+    port: 102
     rack: 0
     slot: 0
     # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
@@ -96,7 +96,7 @@
   crn[2]:
     id: 3
     ip: 192.168.4.250
-    port: 6000
+    port: 102
     rack: 0
     slot: 0
     # 鍋忕Щ閲忥紝褰撳爢鍨涙満绔欑偣鍒楀彿=1鏃讹紝鍋忕Щ閲�=2
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index be24a86..822e150 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -1,4 +1,4 @@
-var baseUrl = "/lfdwcs";
+var baseUrl = "/lktwcs";
 
 // 璧嬪��
 function setVal(el, val) {
diff --git a/src/main/webapp/static/js/console.map.js b/src/main/webapp/static/js/console.map.js
index f07ace5..c84b19f 100644
--- a/src/main/webapp/static/js/console.map.js
+++ b/src/main/webapp/static/js/console.map.js
@@ -1,5 +1,5 @@
 mapInfo = {
-    "mapName": "LFDWCS",
+    "mapName": "LKTWCS",
     "rackCount": 18,
     "crnCount": 7,
     "stbCount": 77,
diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html
index c1012c7..7a75854 100644
--- a/src/main/webapp/views/crn.html
+++ b/src/main/webapp/views/crn.html
@@ -71,18 +71,6 @@
                     <!--            <span>&nbsp;</span>-->
                     <input id="crn3" disabled="disabled">
                 </div>
-                <div class="crn-command-item">
-                    <label>4#</label>
-                    <button id="demoBtn-4" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
-                    <!--            <span>&nbsp;</span>-->
-                    <input id="crn4" disabled="disabled">
-                </div>
-                <div class="crn-command-item">
-                    <label>5#</label>
-                    <button id="demoBtn-5" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
-                    <!--            <span>&nbsp;</span>-->
-                    <input id="crn5" disabled="disabled">
-                </div>
             </div>
             <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
             <div class="crn-state">
@@ -151,8 +139,6 @@
                         <label><input type="radio" name="crnSelect" value="1" checked>&nbsp;1鍙峰爢鍨涙満</label>
                         <label><input type="radio" name="crnSelect" value="2">&nbsp;2鍙峰爢鍨涙満</label>
                         <label><input type="radio" name="crnSelect" value="3">&nbsp;3鍙峰爢鍨涙満</label>
-                        <label><input type="radio" name="crnSelect" value="4">&nbsp;4鍙峰爢鍨涙満</label>
-                        <label><input type="radio" name="crnSelect" value="5">&nbsp;5鍙峰爢鍨涙満</label>
                     </div>
                 </div>
                 <!-- 婧愮珯/婧愬簱浣� 閫夋嫨 -->
@@ -206,18 +192,18 @@
                 <fieldset>
                     <legend>鎵嬪姩鎿嶄綔</legend>
                     <div class="button-group">
-                        <button class="item" onclick="put()">鍏ュ簱</button>
-                        <button class="item" onclick="take()">鍑哄簱</button>
-                        <button class="item" onclick="stockMove()">搴撲綅杞Щ</button>
-                        <button class="item" onclick="siteMove()">绔欏埌绔�</button>
+<!--                        <button class="item" onclick="put()">鍏ュ簱</button>-->
+<!--                        <button class="item" onclick="take()">鍑哄簱</button>-->
+<!--                        <button class="item" onclick="stockMove()">搴撲綅杞Щ</button>-->
+<!--                        <button class="item" onclick="siteMove()">绔欏埌绔�</button>-->
                         <!--                <button class="item" onclick="bacOrigin()">鍥炲師鐐�</button>-->
                         <!--                <button class="item" onclick="reverseOrigin()">鍙嶅師鐐�</button>-->
                         <!--                <button class="item" onclick="coorMove()">鍧愭爣绉昏</button>-->
                         <button class="item" onclick="taskComplete()">浠诲姟瀹屾垚</button>
                         <!--                <button class="item" onclick="pause()">鏆傚仠</button>-->
                         <!--                <button class="item" onclick="boot()">鍚姩</button>-->
-                        <button class="item" onclick="clearCommand()">娓呴櫎鍛戒护</button>
-                        <button class="item" onclick="handleReset()">澶嶄綅</button>
+<!--                        <button class="item" onclick="clearCommand()">娓呴櫎鍛戒护</button>-->
+<!--                        <button class="item" onclick="handleReset()">澶嶄綅</button>-->
                     </div>
                 </fieldset>
             </div>

--
Gitblit v1.9.1