From e828d99f25ba6736cdb0c31128aa4d976348bcb3 Mon Sep 17 00:00:00 2001
From: tqs <56479841@qq.com>
Date: 星期三, 12 十月 2022 17:39:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'gitbit/gzynwcs' into gzynwcs

---
 src/main/webapp/views/index2.html                                |   50 ++++++++++++++++
 src/main/java/com/zy/core/thread/SiemensCrnThread.java           |    3 +
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java      |   43 ++++++++++---
 src/main/webapp/views/index.html                                 |   21 +++++++
 src/main/java/com/zy/core/MainProcess.java                       |    2 
 src/main/java/com/zy/core/netty/handle/PackageServerHandler.java |    6 +-
 6 files changed, 111 insertions(+), 14 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 adf2da1..9ad4f61 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -35,6 +35,7 @@
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.BarcodeThread;
 import com.zy.core.thread.LedThread;
+import com.zy.core.thread.SiemensCrnThread;
 import com.zy.core.thread.SiemensDevpThread;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -2022,7 +2023,7 @@
                             case 11://鍏ュ簱鍓嶅垽鏂厖鐢电嚎鏄惁鏀惧ソ
                                 olsStatus = 99;
                                 newStatus = 0;
-                                newSingle = 11;//涓嶅彉
+                                newSingle = 11;//
                                 break;
                             case 12://鍏呯數绾挎斁濂�
                                 olsStatus = 99;
@@ -2123,20 +2124,19 @@
                                 locMast.setLocSts("O");
                                 locMastService.update(locMast,new EntityWrapper<LocMast>()
                                         .eq("channel",(i+1)));
-                                //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被
-                                StaProtocol staProtocol = new StaProtocol();
-                                staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧�
-                                staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,12==>0
-                                boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
-                                if(!result){
+                            }
+                            //澶嶄綅PLC淇″彿锛屽�熺敤杈撻�佺珯鐐瑰疄浣撶被
+                            StaProtocol staProtocol = new StaProtocol();
+                            staProtocol.setSiteId(i*2);//瀵勫瓨鍣ㄥ湴鍧�
+                            staProtocol.setStaNo(newSingle);//淇敼PLC瀵勫瓨鍣ㄥ湴鍧�鍊�,12==>0
+                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+                            if(!result){
 //                                log.error("鏇存柊搴撲綅绱ф�ュ嚭搴撲俊鍙峰け璐�===>>[channel:{},locNo:{},barcode:{}]", i+1, locMast.getLocNo(), locMast.getBarcode());
 //                                throw new CoolException("鏇存柊娴嬭瘯淇″彿澶辫触===>>" + i);
-                                } else {
-                                    devpThread.startSignal[i] = newSingle;
-                                }
+                            } else {
+                                devpThread.startSignal[i] = newSingle;
                             }
                         }else { }
-
                     }
 
                 }
@@ -2149,4 +2149,25 @@
         }
     }
 
+    @Transactional
+    public void fierCrn() {
+        try {
+            for (CrnSlave crn :slaveProperties.getCrn()) {
+                // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+                CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
+                CrnProtocol crnProtocol = crnThread.getCrnProtocol();
+                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("fire_status", 1));
+                if (!Cools.isEmpty(locMast)){
+                    //xie xin h
+                } else {
+                    //fu wei h
+                }
+            }
+        } catch (Exception e) {
+            log.error("鐏  ===>> 缁欏爢鍨涙満鍙戦�佽鎶ュけ璐�", e);
+            e.printStackTrace();
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        }
+    }
+
 }
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 2060f13..52de28e 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -69,6 +69,8 @@
 
                     //鍚姩銆佸畬鎴愩�佹殏鍋滄祴璇曠郴缁熸祴璇�
                     mainService.packTest();
+                    //鐏锛岀粰鍫嗗灈鏈哄彂閫佺伀璀﹁鎶�
+                    mainService.fierCrn();
 
                 } catch (Exception e) {
                     e.printStackTrace();
diff --git a/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java b/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
index 73ea874..8db7df1 100644
--- a/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
+++ b/src/main/java/com/zy/core/netty/handle/PackageServerHandler.java
@@ -45,11 +45,11 @@
                 ChannelCache.setChannel(String.valueOf(fire3030.getNo()), ctx.channel());
                 Constant.errorMap.remove(fire3030.getNo());
                 LocMastService locMastService2 = SpringUtils.getBean(LocMastService.class);
-                LocMast locMast2 = locMastService2.selectOne(new EntityWrapper<LocMast>().eq("loc_no","01001804"));
+                LocMast locMast2 = locMastService2.selectOne(new EntityWrapper<LocMast>().eq("loc_no","0101804"));
                 if(null != locMast2) {
-                    locMast2.setChannel(1000);
+                    locMast2.setChannel(10000);
                     locMast2.setModiTime(new Date());
-                    locMastService2.update(locMast2, new EntityWrapper<LocMast>().eq("loc_no", "01001804"));
+                    locMastService2.update(locMast2, new EntityWrapper<LocMast>().eq("loc_no", "0101804"));
                 }
                 break;
             case FIRE_ALARM:
diff --git a/src/main/java/com/zy/core/thread/SiemensCrnThread.java b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
index d5828c2..abc0bb2 100644
--- a/src/main/java/com/zy/core/thread/SiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -85,6 +85,9 @@
                         command.setDestinationPosZ((short)0);     // 鐩爣搴撲綅灞�
                         write(command);
                         break;
+                    case 4:
+//                        siemensNet.Write("DB102.0" + staProtocol.getSiteId(), staProtocol.getStaNo());
+                        break;
                     default:
                         break;
                 }
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index d0eaa3e..69e2a39 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -23,6 +23,7 @@
 <div class="sidebar">
     <div class="nav">
         <ul class="cl-effect-4">
+            <li><button id="fire" style="background-color: #00FF00;border-radius: 30px">娑堥槻</button></li>
             <li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">涓绘帶鍥�</a></li>
             <li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">杈撻�佽澶�</a></li>
             <li><a id="crn" onclick="nav(this.id)" class="nav-unselect" href="#">鍫嗗灈鏈�</a></li>
@@ -50,7 +51,27 @@
         localStorage.removeItem("token");
         window.location.href = baseUrl + "/login";
     }
+    $.ajax({
+        url: baseUrl + "/console/crn/detail",
+        headers: {
+            'token': localStorage.getItem('token')
+        },
+        data: {
+            crnNo: id
+        },
+        method: 'post',
+        success: function (res) {
+            for (var val in res.data) {
+                var find = $("#crnWindow").find(":input[name='" + val + "']");
+                if (find[0].type === 'text') {
+                    find.val(res.data[val]);
+                } else if (find[0].type === 'checkbox') {
+                    find.attr("checked", res.data[val] === 'Y');
+                }
+            }
+        }
 
+    })
     // 绯荤粺杩愯鐘舵��
     var systemRunning = true;
 </script>
diff --git a/src/main/webapp/views/index2.html b/src/main/webapp/views/index2.html
new file mode 100644
index 0000000..d9d215c
--- /dev/null
+++ b/src/main/webapp/views/index2.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>鑷姩浠撳簱WCS绯荤粺</title>
+    <link rel="stylesheet" href="../static/css/index.css">
+    <script src="../static/js/jquery/jquery-3.3.1.min.js"></script>
+    <style>
+    </style>
+</head>
+<body>
+<!-- 瀵艰埅鏍� -->
+<!--		<div class="nav">-->
+<!--			<li class="right">娉ㄩ攢<a id="about" class="nav-unselect" onclick="logout()" href="#"></a></li>-->
+<!--		</div>-->
+<div class="sidebar">
+    <div class="nav">
+        <ul class="cl-effect-4">
+            <li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">涓绘帶鍥�</a></li>
+            <li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">杈撻�佽澶�</a></li>
+            <li><a id="crn" onclick="nav(this.id)" class="nav-unselect" href="#">鍫嗗灈鏈�</a></li>
+        </ul>
+    </div>
+</div>
+<!--<div style="z-index: 999; position: absolute; top: 250px; left: 900px; width: 200px; height: 200px; opacity: 0.5;background-color: #0000FF">-->
+
+<!--</div>-->
+<!-- 涓讳綋鍐呭 -->
+<iframe id="content" src="console.html"></iframe>
+<footer class="footer">
+    Copyright 漏 2022 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">绔嬪簱wcs鎿嶄綔骞冲彴</a>
+</footer>
+</body>
+<script>
+    // 瀵艰埅鏍�
+    function nav(id) {
+        $('.nav-select').attr("class", "nav-unselect");
+        $('#'+id).attr("class", "nav-select");
+        $('#content').attr("src", id+".html");
+    }
+
+    function logout() {
+        localStorage.removeItem("token");
+        window.location.href = baseUrl + "/login";
+    }
+
+    // 绯荤粺杩愯鐘舵��
+    var systemRunning = true;
+</script>
+</html>

--
Gitblit v1.9.1