From 190cc52625bea627b6266f0124bd0d638f03394c Mon Sep 17 00:00:00 2001
From: clll <1320612696@qq.com>
Date: 星期三, 06 九月 2023 17:15:56 +0800
Subject: [PATCH] 更新代码

---
 springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java             |   43 ++
 CanadaMes-ui/src/views/Electrical/Sign.vue                                           |  149 ++++--
 springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java          |   41 -
 springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java |   34 +
 CanadaMes-ui/src/views/Electrical/State.vue                                          |    2 
 CanadaMes-ui/src/api/alarm.js                                                        |   22 +
 CanadaMes-ui/src/views/Electrical/Parameter.vue                                      |   14 
 springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java         |  148 +++++++
 springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java          |   85 ++++
 springboot-vue3/src/main/java/com/example/springboot/service/AlarmService.java       |    8 
 springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java  |  198 ++++----
 springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java     |   75 +++
 springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java         |   85 ++++
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java     |   12 
 CanadaMes-ui/src/views/Electrical/alarm.vue                                          |   82 +--
 CanadaMes-ui/src/views/Electrical/Action.vue                                         |   87 ++-
 springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java         |   22 +
 springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java       |   14 
 springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java        |  120 ++--
 19 files changed, 915 insertions(+), 326 deletions(-)

diff --git a/CanadaMes-ui/src/api/alarm.js b/CanadaMes-ui/src/api/alarm.js
new file mode 100644
index 0000000..cba7528
--- /dev/null
+++ b/CanadaMes-ui/src/api/alarm.js
@@ -0,0 +1,22 @@
+import request from "../utils/request";
+
+/**
+ *鐧诲綍
+ * @param data
+ * @returns {AxiosPromise}
+ */
+export function home (data) {
+  return request({
+    url: '/home/load',
+    method: 'get',
+    data
+  })
+}
+
+export function setAll (data) {
+  return request({
+    url: '/alarm/load',
+    method: 'get',
+    data
+  })
+}
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index 48df874..42ce668 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -12,10 +12,14 @@
     </el-breadcrumb>
     <div>Action</div>
     <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }">
-      <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
+      <!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value">
         <el-input v-model="item.name" style="width: 240px;" class="in_mc"></el-input>
-        <!-- <el-input v-model="item[0]" style="width: 80px;"></el-input> -->
         <el-switch v-model="item.value" active-value="0" inactive-value="1"></el-switch>
+      </div> -->
+
+      <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
+        <el-input v-model="item.name" style="width: 240px;" class="in_mc"></el-input>
+        <el-switch v-model="item.value" active-value="1" inactive-value="0" @change="send()"></el-switch>
       </div>
     </el-form>
 
@@ -31,7 +35,7 @@
   data () {
     return {
       record: {
-        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+        params: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         canshu: [
           'D01 VFD conveyor',
           'D02 VFD conveyor',
@@ -61,13 +65,34 @@
           'B02 YV UP DOWN',
         ],
         xyData: [
-          { name: 'D01 VFD conveyor', value: 0 },
-          { name: "D02 VFD conveyor", value: 0 },
-          { name: "D03 VFD conveyor", value: 0 },
-          { name: "D04 VFD conveyor", value: 0 },
-          { name: "B01 B02 TRAVEL JOG Velocity", value: 0 },
-          { name: "conveyor Velocity(Manual)", value: 0 },
-        ],
+          { name: 'D01 VFD conveyor', value: "0" },
+          { name: 'D02 VFD conveyor', value: "0" },
+          { name: 'D03 VFD conveyor', value: "1" },
+          { name: 'D04 VFD conveyor', value: "0" },
+          { name: 'D05 VFD conveyor', value: "0" },
+          { name: 'D06 VFD conveyor', value: "0" },
+          { name: 'A01 VFD conveyor', value: "0" },
+          { name: 'A02 VFD conveyor', value: "0" },
+          { name: 'B01 VFD conveyor', value: "0" },
+          { name: 'B02 VFD conveyor', value: "0" },
+          { name: 'A01 SERVE TURN JOG+', value: "0" },
+          { name: 'A02 SERVE TURN JOG-', value: "0" },
+          { name: 'A01 SERVE TRAVEL JOG+', value: "0" },
+          { name: 'A02 SERVE TRAVEL JOG-', value: "0" },
+          { name: 'B01 SERVE TRAVEL JOG+', value: "0" },
+          { name: 'B02 SERVE TRAVEL JOG-', value: "0" },
+          { name: 'A01 SERVE TURN POS', value: "0" },
+          { name: 'A02 SERVE TURN POS', value: "0" },
+          { name: 'A01 SERVE TRAVEL POS', value: "0" },
+          { name: 'A02 SERVE TRAVEL POS', value: "0" },
+          { name: 'B01 SERVE TRAVEL POS', value: "0" },
+          { name: 'B02 SERVE TRAVEL POS', value: "0" },
+          { name: 'B01 YV TURN', value: "0" },
+          { name: 'B01 YV UP DOWN', value: "0" },
+          { name: 'B02 YV TURN', value: "0" },
+          { name: 'B02 YV UP DOWN', value: "0" },
+        ]
+        ,
       },
 
 
@@ -86,7 +111,7 @@
   },
   methods: {
     init () {
-      let viewname = "Action";
+      let viewname = "action";
 
       if (typeof (WebSocket) == "undefined") {
         console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
@@ -105,25 +130,26 @@
           console.log("websocket宸叉墦寮�");
         };
         //  娴忚鍣ㄧ鏀舵秷鎭紝鑾峰緱浠庢湇鍔$鍙戦�佽繃鏉ョ殑鏂囨湰娑堟伅
-        socket.onmessage = function (msg) {
-
-          //console.log("鏀跺埌鏁版嵁====" + msg.data);
-          let obj = JSON.parse(msg.data);
-
-          this.record.params[0] = obj.acion[0].join(",");
-          this.record.params[0] = this.record.params[0].split(",");
-
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
-            // if (!this.record.xyData[a]) {
-            //   this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
-            // } else {
-            //   this.record.xyData[a].value = this.record.params[0][a];
-            // }
-            this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+        socket.onmessage = (msg) => {
+          if (!msg.data) {
+            return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
           }
-          console.log(this.record.xyData)
+
+          let obj = JSON.parse(msg.data);
+          this.record.params[0] = obj.params[0];
+
+          for (let a = 0; a <= this.record.params[0].length; a++) {
+            if (!this.record.xyData[a]) {
+              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a].toString() };
+            } else {
+              this.record.xyData[a].value = this.record.params[0][a].toString();
+            }
+          }
+
+          console.log(this.record.xyData);
           this.$forceUpdate();
-        }.bind(this);
+        };
+
         //鍏抽棴浜嬩欢
         socket.onclose = function () {
           console.log("websocket宸插叧闂�");
@@ -136,8 +162,9 @@
 
     },
     send () {
-      this.messagepack.data = { taskname: "鍓嶇鍒板悗鍙�" };
-      socket?.send(JSON.stringify(this.messagepack));  // 灏嗙粍瑁呭ソ鐨刯son鍙戦�佺粰鏈嶅姟绔紝鐢辨湇鍔$杩涜杞彂
+      this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 杞崲涓烘暣鏁版暟缁�
+      console.log(this.messagepack);
+      socket?.send(JSON.stringify(this.messagepack));
     }
 
   }
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index 12506fb..6fb4783 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -44,12 +44,14 @@
         params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         xyData: [
           { name: 'conveyor Velocity(Auto FAST)', value: 0 },
+          { name: 'conveyor Velocity(Auto SLOW)', value: 0 },
           { name: 'conveyor Velocity(Manual)', value: 0 },
           { name: 'A01 A02 TURN JOG Velocity', value: 0 },
           { name: 'A01 A02 TRAVEL JOG Velocity', value: 0 },
+          { name: 'B01 B02 TRAVEL JOG Velocity', value: 0 },
           { name: 'A01 A02 TURN POS Velocity AUTO', value: 0 },
           { name: 'A01 A02 TURN POS Velocity manual', value: 0 },
-          { name: '01 A02 TRAVEL POS Velocity AUTO', value: 0 },
+          { name: 'A01 A02 TRAVEL POS Velocity AUTO', value: 0 },
           { name: 'A01 A02 TRAVEL POS Velocity manual', value: 0 },
           { name: 'B01 B02 TRAVEL POS Velocity AUTO', value: 0 },
           { name: 'B01 B02 TRAVEL POS Velocity manual', value: 0 },
@@ -57,6 +59,10 @@
         ],
         canshu: [
           'conveyor Velocity(Auto FAST)',
+          'conveyor Velocity(Auto SLOW)',
+          'conveyor Velocity(Manual)',
+          'A01 A02 TURN JOG Velocity',
+          'A01 A02 TRAVEL JOG Velocity',
           'B01 B02 TRAVEL JOG Velocity',
           'A01 A02 TURN POS Velocity AUTO',
           'A01 A02 TURN POS Velocity manual',
@@ -109,10 +115,10 @@
           let obj = JSON.parse(msg.data);
           //this.$set(this.record.params, 0, obj.params[0]);
           this.record.params[0] = obj.params[0];
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
+          for (let a = 0; a <= this.record.params.length; a++) {
             // this.record.xyData[a] = [this.record.canshu[a], this.record.params[0][a]];
-            // this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
-            this.record.xyData[a].value = this.record.params[0][a];
+            this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+            // this.record.xyData[a].value = this.record.params[0][a];
           }
           this.$forceUpdate();
 
diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index a3ef53f..454bd45 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -14,12 +14,10 @@
     <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
       <div class="kuai_sb" v-for="item in record.xyData" :key="item.name">
         <el-col class="deng" :class="getStatusClass(item.value, item.name)">
-          <!-- <el-input v-model="item.zhuangtai" style="width: 280px;display: none;"
-            class="in_mc"></el-input>-->
+          <!-- <el-input v-model="item.value" style="width: 280px;" class="in_mc"></el-input> -->
         </el-col>
         <el-input v-model="item.name" style="width: 280px;" class="in_mc"></el-input>
 
-        <!-- <el-switch v-model="item.zhuangtai" active-color="#13ce66" active-value="1" inactive-value="2"></el-switch> -->
       </div>
 
     </div>
@@ -34,49 +32,102 @@
   data () {
     return {
       record: {
-        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
+        params: [1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+          1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,],
         xyData: [
           { name: 'D01.SR dec', value: 0 },
           { name: "D01.SR in pos", value: 0 },
           { name: "D02.SR dec", value: 0 },
           { name: "D02.SR in pos", value: 0 },
+          { name: "D03.SR into", value: 0 },
           { name: "D03.SR dec", value: 0 },
-          { name: "D03.SR in pos", value: 0 },
+          { name: 'D03.SR in pos', value: 0 },
+          { name: "D04.SR dec", value: 0 },
+          { name: "D04.SR in pos", value: 0 },
+          { name: "D05.SR dec", value: 0 },
+          { name: "D05.SR in pos", value: 0 },
+          { name: "D06.SR dec", value: 0 },
+          { name: 'D06.SR in pos', value: 0 },
+          { name: "B01.SR out dec", value: 0 },
+          { name: "B01.SR out in pos", value: 0 },
+          { name: "B01.SR in dec", value: 0 },
+          { name: "B01.SR in in pos", value: 0 },
+          { name: "B01.SR turn on", value: 0 },
+          { name: 'B01.SR turn off', value: 0 },
+          { name: "B01.SR up", value: 0 },
+          { name: "B01.SR down", value: 0 },
+          { name: "B02.SR out dec", value: 0 },
+          { name: "B02.SR out in pos", value: 0 },
+          { name: "B02.SR in dec", value: 0 },
+          { name: 'B02.SR in in pos', value: 0 },
+          { name: "B02.SR turn on", value: 0 },
+          { name: "B02.SR turn off", value: 0 },
+          { name: "B02.SR up", value: 0 },
+          { name: "B02.SR down", value: 0 },
+          { name: "B01.SR out safety", value: 0 },
+          { name: "B01.SR in safety", value: 0 },
+          { name: "B02.SR out safety", value: 0 },
+          { name: "SB.start(+)", value: 0 },
+          { name: "SB.stop(1)", value: 0 },
+          { name: "SB.reset", value: 0 },
+          { name: "SB.auto/manul", value: 0 },
+          { name: "SB.pause", value: 0 },
+          { name: "SB.emg", value: 0 },
+          { name: "D01.SB.start", value: 0 },
+          { name: "D06.SB.start", value: 0 },
+          { name: "B02.SR in safety", value: 0 },
+          { name: "SAFETYDOOR.requset", value: 0 },
+          { name: "SAFETYDOOR.confirm", value: 0 },
+          { name: "SAFETYDOOR.reset", value: 0 },
+          { name: "LED.red", value: 0 },
+          { name: "LED.green", value: 0 },
+          { name: "LED.yellow", value: 0 },
+          { name: "D01.LED.green", value: 0 },
+          { name: "D06.LED.green", value: 0 },
+          { name: "B01.YV.turn", value: 0 },
+          { name: "B01.YV.up down", value: 0 },
+          { name: "B01.YV.gassing", value: 0 },
+          { name: "B02.YV.turn", value: 0 },
+          { name: "B02.YV.up down", value: 0 },
+          { name: "B02.YV.gassing", value: 0 },
+          { name: "SAFETYDOOR.led", value: 0 },
+          { name: "SAFETYDOOR.open", value: 0 },
+
         ],
-        canshu: [
-          'D01.SR dec',
-          'D01.SR in pos',
-          'D02.SR dec',
-          'D02.SR in pos',
-          'D03.SR into',
-          'D03.SR dec',
-          'D03.SR in pos',
-          'D04.SR dec',
-          'D04.SR in pos',
-          'D05.SR dec',
-          'D05.SR in pos',
-          'D06.SR dec',
-          'D06.SR in pos',
-          'B01.SR out dec',
-          'B01.SR out in pos',
-          'B01.SR in dec',
-          'B01.SR in in pos',
-          'B01.SR turn on',
-          'B01.SR turn off',
-          'B01.SR up',
-          'B01.SR down',
-          'B02.SR out dec',
-          'B02.SR out in pos',
-          'B02.SR in dec',
-          'B02.SR in in pos',
-          'B02.SR turn on',
-          'B02.SR turn off',
-          'B02.SR up',
-          'B02.SR down',
-          'LED.red',
-          'LED.green',
-          'LED.yellow',
-        ],
+        // canshu: [
+        //   'D01.SR dec',
+        //   'D01.SR in pos',
+        //   'D02.SR dec',
+        //   'D02.SR in pos',
+        //   'D03.SR into',
+        //   'D03.SR dec',
+        //   'D03.SR in pos',
+        //   'D04.SR dec',
+        //   'D04.SR in pos',
+        //   'D05.SR dec',
+        //   'D05.SR in pos',
+        //   'D06.SR dec',
+        //   'D06.SR in pos',
+        //   'B01.SR out dec',
+        //   'B01.SR out in pos',
+        //   'B01.SR in dec',
+        //   'B01.SR in in pos',
+        //   'B01.SR turn on',
+        //   'B01.SR turn off',
+        //   'B01.SR up',
+        //   'B01.SR down',
+        //   'B02.SR out dec',
+        //   'B02.SR out in pos',
+        //   'B02.SR in dec',
+        //   'B02.SR in in pos',
+        //   'B02.SR turn on',
+        //   'B02.SR turn off',
+        //   'B02.SR up',
+        //   'B02.SR down',
+        //   'LED.red',
+        //   'LED.green',
+        //   'LED.yellow',
+        // ],
 
       },
 
@@ -97,15 +148,18 @@
   methods: {
     getStatusClass (zhuangtai, mc) {
 
-      if (mc === "LED.red" && zhuangtai === 0) {
-        return "red";
-      }
+
       if (mc === "LED.green" && zhuangtai === 0) {
         return "green";
+      }
+      if (mc === "LED.red" && zhuangtai === 0) {
+        return "red";
       }
       if (mc === "LED.yellow" && zhuangtai === 0) {
         return "yellow"
       }
+
+
       if (zhuangtai === 0) {
         return "op";
       }
@@ -144,9 +198,12 @@
           let obj = JSON.parse(msg.data);
           //this.$set(this.record.params, 0, obj.params[0]);
           this.record.params[0] = obj.sig[0];
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
-            //this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
-            this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+          for (let a = 0; a <= this.record.params.length; a++) {
+            if (!this.record.xyData[a]) {
+              this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
+            } else {
+              this.record.xyData[a].value = this.record.params[0][a];
+            }
 
           }
           this.$forceUpdate();
@@ -236,7 +293,7 @@
   background-color: red;
 }
 
-.geeen {
+.green {
   background-color: #00ff22;
 }
 
diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index 65003de..403650a 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -109,7 +109,7 @@
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
           this.record.params[0] = obj.sta[0];
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
+          for (let a = 0; a <= this.record.params.length; a++) {
             //this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
             this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
           }
diff --git a/CanadaMes-ui/src/views/Electrical/alarm.vue b/CanadaMes-ui/src/views/Electrical/alarm.vue
index fa6f8c3..db22d18 100644
--- a/CanadaMes-ui/src/views/Electrical/alarm.vue
+++ b/CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -18,65 +18,33 @@
         </div>
       </el-form> -->
 
-    <el-table :data="record.xyData" style="width: 100%">
-      <el-table-column prop="xyData[1]" label="content" width="180">
+    <el-table :data="tableData" style="width: 100%;" height="590">
+      <el-table-column prop="id" label="id" width="80">
       </el-table-column>
-      <el-table-column prop="name" label="time-on" width="180">
+      <el-table-column prop="content" label="content">
       </el-table-column>
-      <el-table-column prop="address" label="End Time">
+      <el-table-column prop="timeon" label="time-on">
+      </el-table-column>
+      <el-table-column prop="endTime" label="End Time">
       </el-table-column>
     </el-table>
   </div>
 </template>
 
 <script >
-
+import { setAll } from "../../api/alarm";
 let socket;
 export default {
   name: "alarm",
   data () {
     return {
       record: {
-        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
-        canshu: [
-          'D01 VFD error',
-          'D02 VFD error',
-          'D03 VFD error',
-          'D04 VFD conveyor',
-          'D05 VFD conveyor',
-          'D06 VFD conveyor',
-          'A01 VFD conveyor',
-          'A02 VFD conveyor',
-          'B01 VFD conveyor',
-          'B02 VFD conveyor',
-          'A01 SERVE TURN JOG+',
-          'A02 SERVE TURN JOG-',
-          'A01 SERVE TRAVEL JOG+',
-          'A02 SERVE TRAVEL JOG-',
-          'B01 SERVE TRAVEL JOG+',
-          'B02 SERVE TRAVEL JOG-',
-          'A01 SERVE TURN POS',
-          'A02 SERVE TURN POS',
-          'A01 SERVE TRAVEL POS',
-          'A02 SERVE TRAVEL POS',
-          'B01 SERVE TRAVEL POS',
-          'B02 SERVE TRAVEL POS',
-          'B01 YV TURN',
-          'B01 YV UP DOWN',
-          'B02 YV TURN',
-          'B02 YV UP DOWN',
-        ],
-        // canshu: [
-        //   '1',
-        //   '1',
-        //   '0',
-        //   '0',
-        //   '0',
-        //   '0'
-        // ],
-        xyData: [],
-      },
+        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 
+        // xyData: [],
+
+      },
+      tableData: [],
 
       messagepack: {
         data: { taskname: "" }
@@ -90,10 +58,18 @@
   },
   created () {
     this.init();
+    this.load();
   },
   methods: {
+    load () {
+      setAll().then(res => {
+        this.tableData = res.data.list;
+        //console.log(this.tableData);
+
+      });
+    },
     init () {
-      let viewname = "Action";
+      let viewname = "alarm";
 
       if (typeof (WebSocket) == "undefined") {
         console.log("鎮ㄧ殑娴忚鍣ㄤ笉鏀寔WebSocket");
@@ -117,14 +93,9 @@
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
 
-          this.record.params[0] = obj.acion[0].join(",");
-          this.record.params[0] = this.record.params[0].split(",");
-
-          for (let a = 0; a <= this.record.params.length - 1; a++) {
-            this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
-          }
-          //console.log(this.record.params[0]);
-          //console.log(this.record.xyData);
+          this.record.params[0] = obj.arm;
+          //姣忔璇锋眰鏇存柊鏁版嵁
+          this.load();
           this.$forceUpdate();
         }.bind(this);
         //鍏抽棴浜嬩欢
@@ -176,4 +147,9 @@
     border: none;
   }
 }
+
+td div,
+th div {
+  text-align: center;
+}
 </style>
\ No newline at end of file
diff --git a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
index ac10b17..b28c2d4 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/AuthorityApplication.java
@@ -2,12 +2,20 @@
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ConfigurableApplicationContext;
+
+import com.example.springboot.component.WebSocketServer;
 
 @SpringBootApplication
 public class AuthorityApplication {
 
-    public static void main(String[] args) {
-        SpringApplication.run(AuthorityApplication.class, args);
-    }
+  public static void main(String[] args) {
+
+    // SpringApplication.run(AuthorityApplication.class, args);
+
+    SpringApplication springApplication = new SpringApplication(AuthorityApplication.class);
+    ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
+    WebSocketServer.setApplicationContext(configurableApplicationContext);
+  }
 
 }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
index b8382f2..5e776f9 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -4,10 +4,15 @@
 
 import javax.websocket.Session;
 
+import com.example.springboot.mapper.AlarmMapper;
+
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 
 public class PlcHold extends Thread {
+
+  private AlarmMapper alarmMapper;
+
   @Override
   public void run() {
     while (this != null) {
@@ -24,42 +29,6 @@
 
       // 鏌ヨ鏁版嵁搴�
       // 鎺ㄩ�佸埌鍓嶇
-
-      // Parameter
-      JSONObject jsonObject = new JSONObject();
-      jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, });
-      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
-      if (sendwServer != null) {
-        sendwServer.sendMessage(jsonObject.toString());
-      }
-
-      // Action
-      // JSONObject jsonObject2 = new JSONObject();
-      // jsonObject2.append("acion",
-      // new short[] { 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-      // 1, 1, 1, 0, 0, });
-      // WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("Action");
-      // if (sendwServer2 != null) {
-      // sendwServer2.sendMessage(jsonObject2.toString());
-      // }
-
-      // Sign
-      JSONObject jsonObject3 = new JSONObject();
-      jsonObject3.append("sig",
-          new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
-              1, });
-      WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
-      if (sendwServer3 != null) {
-        sendwServer3.sendMessage(jsonObject3.toString());
-      }
-
-      // State
-      JSONObject jsonObject4 = new JSONObject();
-      jsonObject4.append("sta", new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, });
-      WebSocketServer sendwServer4 = WebSocketServer.sessionMap.get("State");
-      if (sendwServer4 != null) {
-        sendwServer4.sendMessage(jsonObject4.toString());
-      }
 
     }
   }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
new file mode 100644
index 0000000..47fd8f5
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
@@ -0,0 +1,75 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlcParameter extends Thread {
+  @Override
+  public void run() {
+    while (this != null) {
+      try {
+        Thread.sleep(10000);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+
+      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+      JSONObject jsonObject = new JSONObject();
+      // jsonObject.append("params", paramlist);
+      jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, });
+      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+      if (sendwServer != null) {
+        sendwServer.sendMessage(jsonObject.toString());
+      }
+
+      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
+      if (webSocketServer != null) {
+        List<String> messages = webSocketServer.getMessages();
+
+        String addressList = "DB100.DBW0";
+        // addressList.add("DB100.DBW0");
+        // addressList.add("DB100.DBW2");
+        // addressList.add("DB100.DBW4");
+        // addressList.add("DB100.DBW6");
+        // addressList.add("DB100.DBW8");
+        // addressList.add("DB100.DBW10");
+        // addressList.add("DB100.DBW12");
+        // addressList.add("DB100.DBW14");
+        // addressList.add("DB100.DBW16");
+        // addressList.add("DB100.DBW18");
+        // addressList.add("DB100.DBW20");
+        // addressList.add("DB100.DBW22");
+
+        if (!messages.isEmpty()) {
+          // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+          String lastMessage = messages.get(messages.size() - 1);
+          System.out.println("messages锛�" + messages);
+          String[] parts = lastMessage.split(",");
+          List<Short> messageValues = new ArrayList<>();
+          for (String part : parts) {
+            try {
+              // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+              String cleanedPart = part.replaceAll("[^0-9-]", "");
+              short value = Short.parseShort(cleanedPart.trim());
+              messageValues.add(value);
+            } catch (NumberFormatException e) {
+              // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+              e.printStackTrace();
+            }
+          }
+
+          // 灏嗘秷鎭�煎啓鍏� PLC
+          // S7control.getinstance().WriteWord(addressList, messageValues);
+          System.out.println("messageValues锛�" + messageValues);
+          System.out.println("addressList锛�" + addressList);
+          // 娓呯┖娑堟伅鍒楄〃
+          webSocketServer.clearMessages();
+        }
+      }
+    }
+  }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
index 2437cd4..c64dcaf 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java
@@ -6,68 +6,70 @@
 import java.util.List;
 
 public class Plcaction extends Thread {
-    @Override
-    public void run() {
-        while (this != null) {
+  @Override
+  public void run() {
+    while (this != null) {
+      try {
+        Thread.sleep(10000);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+
+      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+      JSONObject jsonObject = new JSONObject();
+      jsonObject.append("params", new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
+      });
+      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
+      if (sendwServer != null) {
+        sendwServer.sendMessage(jsonObject.toString());
+      }
+
+      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
+      if (webSocketServer != null) {
+        List<String> messages = webSocketServer.getMessages();
+
+        String addressList = "DB100.DBW0";
+        // addressList.add("DB100.DBW0");
+        // addressList.add("DB100.DBW2");
+        // addressList.add("DB100.DBW4");
+        // addressList.add("DB100.DBW6");
+        // addressList.add("DB100.DBW8");
+        // addressList.add("DB100.DBW10");
+        // addressList.add("DB100.DBW12");
+        // addressList.add("DB100.DBW14");
+        // addressList.add("DB100.DBW16");
+        // addressList.add("DB100.DBW18");
+        // addressList.add("DB100.DBW20");
+        // addressList.add("DB100.DBW22");
+
+        if (!messages.isEmpty()) {
+          // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+          String lastMessage = messages.get(messages.size() - 1);
+          System.out.println("messages锛�" + messages);
+          String[] parts = lastMessage.split(",");
+          List<Short> messageValues = new ArrayList<>();
+          for (String part : parts) {
             try {
-                Thread.sleep(10000);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
+              // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+              String cleanedPart = part.replaceAll("[^0-9-]", "");
+              short value = Short.parseShort(cleanedPart.trim());
+              messageValues.add(value);
+            } catch (NumberFormatException e) {
+              // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+              e.printStackTrace();
             }
+          }
 
-            List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
-
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.append("params", paramlist);
-            WebSocketServer sendwServer = WebSocketServer.sessionMap.get("action");
-            if (sendwServer != null) {
-                sendwServer.sendMessage(jsonObject.toString());
-            }
-
-            WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("action");
-            if (webSocketServer != null) {
-                List<String> messages = webSocketServer.getMessages();
-
-                List<String> addressList = new ArrayList<>();
-                addressList.add("DB100.DBW0");
-                addressList.add("DB100.DBW2");
-                addressList.add("DB100.DBW4");
-                addressList.add("DB100.DBW6");
-                addressList.add("DB100.DBW8");
-                addressList.add("DB100.DBW10");
-                addressList.add("DB100.DBW12");
-                addressList.add("DB100.DBW14");
-                addressList.add("DB100.DBW16");
-                addressList.add("DB100.DBW18");
-                addressList.add("DB100.DBW20");
-                addressList.add("DB100.DBW22");
-
-                if (!messages.isEmpty()) {
-                    // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
-                    String lastMessage = messages.get(messages.size() - 1);
-                    System.out.println("messages锛�" + messages);
-                    String[] parts = lastMessage.split(",");
-                    List<Short> messageValues = new ArrayList<>();
-                    for (String part : parts) {
-                        try {
-                            // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
-                            String cleanedPart = part.replaceAll("[^0-9-]", "");
-                            short value = Short.parseShort(cleanedPart.trim());
-                            messageValues.add(value);
-                        } catch (NumberFormatException e) {
-                            // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
-
-                            e.printStackTrace();
-                        }
-                    }
-
-                    // 灏嗘秷鎭�煎啓鍏� PLC
-//                    S7control.getinstance().WriteWord(addressList, messageValues);
-                    System.out.println("messageValues锛�" + messageValues);
-                    // 娓呯┖娑堟伅鍒楄〃
-                    messages.clear();
-                }
-            }
+          // 灏嗘秷鎭�煎啓鍏� PLC
+          // S7control.getinstance().WriteWord(addressList, messageValues);
+          System.out.println("messageValues锛�" + messageValues);
+          System.out.println("addressList锛�" + addressList);
+          // 娓呯┖娑堟伅鍒楄〃
+          webSocketServer.clearMessages();
         }
+      }
     }
+  }
 }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
new file mode 100644
index 0000000..6ccc626
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -0,0 +1,148 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.example.springboot.mapper.AlarmMapper;
+
+public class Plcalarm extends Thread {
+  private AlarmMapper alarmMapper;
+
+  @Override
+  public void run() {
+    while (this != null) {
+      try {
+        Thread.sleep(10000);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+
+      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+      // JSONObject jsonObject = new JSONObject();
+      // // jsonObject.append("params", paramlist);
+      // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+      // 11, });
+      // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+      // if (sendwServer != null) {
+      // sendwServer.sendMessage(jsonObject.toString());
+      // }
+
+      JSONObject jsonObject = new JSONObject();
+
+      jsonObject.append("arm",
+          new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
+              1, 0, 1, 0, 1, 0, 1, 0, 1, });
+      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm");
+      if (sendwServer != null) {
+        sendwServer.sendMessage(jsonObject.toString());
+      }
+
+      Short[] shuzu1 = {
+          1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
+          1, 0, 1, 0, 1, 0, 1, 0, 1,
+      };
+
+      String[] shuzu = {
+          "D01 VFD error",
+          "D02 VFD error",
+          "D03 VFD error",
+          "D04 VFD error",
+          "D05 VFD error",
+          "D06 VFD error",
+          "B01 VFD error",
+          "B02 VFD error",
+          "A01 VFD error",
+          "A02 VFD error",
+          "A01 servo turn error",
+          "A02 servo turn error",
+          "A01 servo travel error",
+          "A02 servo travel error",
+          "B01 servo travel error",
+          "B02 servo travel error",
+          "D01 DEC error",
+          "D01 pos error",
+          "D02 DEC error",
+          "D02 pos error",
+          "D03 DEC error",
+          "D03 pos error",
+          "D04 DEC error",
+          "D04 pos error",
+          "D05 DEC error",
+          "D05 pos error",
+          "D06 DEC error",
+          "D06 pos error",
+          "A01 DEC error",
+          "A01 pos error",
+          "A02 DEC error",
+          "A02 pos error",
+          "B01 IN DEC error",
+          "B01 IN pos error",
+          "B01 OUT DEC error",
+          "B01 OUT pos error",
+          "B02 IN DEC error",
+          "B02 IN pos error",
+          "B02 OUT DEC error",
+          "B02 OUT pos error",
+      };
+      alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class);
+      for (short i = 0; i < shuzu1.length; i++) {
+        short result = alarmMapper.selectnullti(shuzu[i]);
+        if (shuzu1[i] == 1 && result == 0) {
+          alarmMapper.Insertalarm(shuzu[i]);
+        } else if (shuzu1[i] == 0 && result > 0) {
+          alarmMapper.updatealarm(shuzu[i]);
+        }
+      }
+
+      // 鍐�
+      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter");
+      if (webSocketServer != null) {
+        List<String> messages = webSocketServer.getMessages();
+
+        String addressList = "DB100.DBW0";
+        // addressList.add("DB100.DBW0");
+        // addressList.add("DB100.DBW2");
+        // addressList.add("DB100.DBW4");
+        // addressList.add("DB100.DBW6");
+        // addressList.add("DB100.DBW8");
+        // addressList.add("DB100.DBW10");
+        // addressList.add("DB100.DBW12");
+        // addressList.add("DB100.DBW14");
+        // addressList.add("DB100.DBW16");
+        // addressList.add("DB100.DBW18");
+        // addressList.add("DB100.DBW20");
+        // addressList.add("DB100.DBW22");
+
+        if (!messages.isEmpty()) {
+          // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+          String lastMessage = messages.get(messages.size() - 1);
+          System.out.println("messages锛�" + messages);
+          String[] parts = lastMessage.split(",");
+          List<Short> messageValues = new ArrayList<>();
+          for (String part : parts) {
+            try {
+              // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+              String cleanedPart = part.replaceAll("[^0-9-]", "");
+              short value = Short.parseShort(cleanedPart.trim());
+              messageValues.add(value);
+            } catch (NumberFormatException e) {
+              // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+              e.printStackTrace();
+            }
+          }
+
+          // 灏嗘秷鎭�煎啓鍏� PLC
+          // S7control.getinstance().WriteWord(addressList, messageValues);
+          System.out.println("messageValues锛�" + messageValues);
+          System.out.println("addressList锛�" + addressList);
+          // 娓呯┖娑堟伅鍒楄〃
+          webSocketServer.clearMessages();
+        }
+      }
+    }
+  }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
new file mode 100644
index 0000000..7c9c446
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -0,0 +1,85 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Plcsign extends Thread {
+  @Override
+  public void run() {
+    while (this != null) {
+      try {
+        Thread.sleep(10000);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+
+      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+      // JSONObject jsonObject = new JSONObject();
+      // // jsonObject.append("params", paramlist);
+      // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+      // 11, });
+      // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+      // if (sendwServer != null) {
+      // sendwServer.sendMessage(jsonObject.toString());
+      // }
+
+      JSONObject jsonObject3 = new JSONObject();
+      jsonObject3.append("sig",
+          new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
+              1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, });
+      WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign");
+      if (sendwServer3 != null) {
+        sendwServer3.sendMessage(jsonObject3.toString());
+      }
+
+      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Sign");
+      if (webSocketServer != null) {
+        List<String> messages = webSocketServer.getMessages();
+
+        String addressList = "DB100.DBW0";
+        // addressList.add("DB100.DBW0");
+        // addressList.add("DB100.DBW2");
+        // addressList.add("DB100.DBW4");
+        // addressList.add("DB100.DBW6");
+        // addressList.add("DB100.DBW8");
+        // addressList.add("DB100.DBW10");
+        // addressList.add("DB100.DBW12");
+        // addressList.add("DB100.DBW14");
+        // addressList.add("DB100.DBW16");
+        // addressList.add("DB100.DBW18");
+        // addressList.add("DB100.DBW20");
+        // addressList.add("DB100.DBW22");
+
+        if (!messages.isEmpty()) {
+          // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+          String lastMessage = messages.get(messages.size() - 1);
+          System.out.println("messages锛�" + messages);
+          String[] parts = lastMessage.split(",");
+          List<Short> messageValues = new ArrayList<>();
+          for (String part : parts) {
+            try {
+              // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+              String cleanedPart = part.replaceAll("[^0-9-]", "");
+              short value = Short.parseShort(cleanedPart.trim());
+              messageValues.add(value);
+            } catch (NumberFormatException e) {
+              // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+              e.printStackTrace();
+            }
+          }
+
+          // 灏嗘秷鎭�煎啓鍏� PLC
+          // S7control.getinstance().WriteWord(addressList, messageValues);
+          System.out.println("messageValues锛�" + messageValues);
+          System.out.println("addressList锛�" + addressList);
+          // 娓呯┖娑堟伅鍒楄〃
+          webSocketServer.clearMessages();
+        }
+      }
+    }
+  }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
new file mode 100644
index 0000000..9596db9
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcstate.java
@@ -0,0 +1,85 @@
+package com.example.springboot.component;
+
+import cn.hutool.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Plcstate extends Thread {
+  @Override
+  public void run() {
+    while (this != null) {
+      try {
+        Thread.sleep(10000);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
+
+      List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12);
+
+      // JSONObject jsonObject = new JSONObject();
+      // // jsonObject.append("params", paramlist);
+      // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+      // 11, });
+      // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
+      // if (sendwServer != null) {
+      // sendwServer.sendMessage(jsonObject.toString());
+      // }
+
+      JSONObject jsonObject = new JSONObject();
+      jsonObject.append("sta",
+          new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
+              1, });
+      WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State");
+      if (sendwServer != null) {
+        sendwServer.sendMessage(jsonObject.toString());
+      }
+
+      WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("State");
+      if (webSocketServer != null) {
+        List<String> messages = webSocketServer.getMessages();
+
+        String addressList = "DB100.DBW0";
+        // addressList.add("DB100.DBW0");
+        // addressList.add("DB100.DBW2");
+        // addressList.add("DB100.DBW4");
+        // addressList.add("DB100.DBW6");
+        // addressList.add("DB100.DBW8");
+        // addressList.add("DB100.DBW10");
+        // addressList.add("DB100.DBW12");
+        // addressList.add("DB100.DBW14");
+        // addressList.add("DB100.DBW16");
+        // addressList.add("DB100.DBW18");
+        // addressList.add("DB100.DBW20");
+        // addressList.add("DB100.DBW22");
+
+        if (!messages.isEmpty()) {
+          // 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
+          String lastMessage = messages.get(messages.size() - 1);
+          System.out.println("messages锛�" + messages);
+          String[] parts = lastMessage.split(",");
+          List<Short> messageValues = new ArrayList<>();
+          for (String part : parts) {
+            try {
+              // 浣跨敤姝e垯琛ㄨ揪寮忔竻闄ら潪鏁板瓧瀛楃
+              String cleanedPart = part.replaceAll("[^0-9-]", "");
+              short value = Short.parseShort(cleanedPart.trim());
+              messageValues.add(value);
+            } catch (NumberFormatException e) {
+              // 濡傛灉鏃犳硶瑙f瀽涓� short 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+
+              e.printStackTrace();
+            }
+          }
+
+          // 灏嗘秷鎭�煎啓鍏� PLC
+          // S7control.getinstance().WriteWord(addressList, messageValues);
+          System.out.println("messageValues锛�" + messageValues);
+          System.out.println("addressList锛�" + addressList);
+          // 娓呯┖娑堟伅鍒楄〃
+          webSocketServer.clearMessages();
+        }
+      }
+    }
+  }
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
index 697d697..3302c9b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
@@ -7,7 +7,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 import javax.websocket.OnClose;
 import javax.websocket.OnError;
 import javax.websocket.OnMessage;
@@ -16,8 +15,8 @@
 import javax.websocket.server.PathParam;
 import javax.websocket.server.ServerEndpoint;
 
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.stereotype.Component;
-
 
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -26,105 +25,116 @@
 @Component
 public class WebSocketServer {
 
-   private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
-    private List<String> messages;
-    /**
-     * 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
-     */
-    public static final Map<String, WebSocketServer> sessionMap = new ConcurrentHashMap<>();
-    
-    String username;
-    Session session;
-    public WebSocketServer() {
-        this.messages = new ArrayList<>();
-    }
-    /**
-     * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
-     */
-    @OnOpen
-    public void onOpen(Session session, @PathParam("username") String username) {
-        this.username=username;
-        this.session=session;
-        sessionMap.put(username, this);
-        log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.size());
-       
-        // JSONObject result = new JSONObject();
-        // JSONArray array = new JSONArray();
-        // result.set("users", array);
-        // for (Object key : sessionMap.keySet()) {
-        //     JSONObject jsonObject = new JSONObject();
-        //     jsonObject.set("username", key); 
-        //     array.add(jsonObject);
-        // }
-   
-        //sendAllMessage(JSONUtil.toJsonStr(result));  // 鍚庡彴鍙戦�佹秷鎭粰鎵�鏈夌殑瀹㈡埛绔�
-    }
+  static ConfigurableApplicationContext applicationContext;
+  // 瑙e喅鏃犳硶娉ㄥ叆mapper闂 聽//浣跨敤鏂规硶
+  // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
 
-    /**
-     * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉�
-     */
-    @OnClose
-    public void onClose(Session session, @PathParam("username") String username) {
-        sessionMap.remove(username);
-        log.info("鏈変竴杩炴帴鍏抽棴锛岀Щ闄sername={}鐨勭敤鎴穝ession, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.size());
-    }
+  public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
+    WebSocketServer.applicationContext = configurableApplicationContext;
+  }
 
-    /**
-     * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉�
-     * 鍚庡彴鏀跺埌瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
-     * onMessage 鏄竴涓秷鎭殑涓浆绔�
-     * 鎺ュ彈 娴忚鍣ㄧ socket.send 鍙戦�佽繃鏉ョ殑 json鏁版嵁
-     * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
-     */
-    @OnMessage
-    public void onMessage(String message, Session session, @PathParam("username") String username) {
-        log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
-        JSONObject obj = JSONUtil.parseObj(message);
-         String text = obj.getStr("data"); 
+  private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
+  private List<String> messages;
+  /**
+   * 璁板綍褰撳墠鍦ㄧ嚎杩炴帴鏁�
+   */
+  public static final Map<String, WebSocketServer> sessionMap = new ConcurrentHashMap<>();
 
-         JSONObject jsonObject = new JSONObject();
-         jsonObject.set("message", text);
-        this.messages.add(text);
-         this.sendMessage(jsonObject.toString()); //JSONUtil.toJsonStr(jsonObject)
-    }
+  String username;
+  Session session;
 
-    @OnError
-    public void onError(Session session, Throwable error) {
-        log.error("鍙戠敓閿欒");
-        error.printStackTrace();
-    }
+  public WebSocketServer() {
+    this.messages = new ArrayList<>();
+  }
 
-    /**
-     * 鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔�
-     */
-    public void sendMessage(String message) {
-        try {
-            log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
-            this.session.getBasicRemote().sendText(message);
-        } catch (Exception e) {
-            log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
-        }
-    }
+  /**
+   * 杩炴帴寤虹珛鎴愬姛璋冪敤鐨勬柟娉�
+   */
+  @OnOpen
+  public void onOpen(Session session, @PathParam("username") String username) {
+    this.username = username;
+    this.session = session;
+    sessionMap.put(username, this);
+    log.info("鏈夋柊鐢ㄦ埛鍔犲叆锛寀sername={}, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.size());
 
-    /**
-     * 鏈嶅姟绔彂閫佹秷鎭粰鎵�鏈夊鎴风
-     */
-    public void sendAllMessage(String message) {
-        try {
-            for (WebSocketServer webSocketServer : sessionMap.values()) {
-                log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
-                webSocketServer.sendMessage(message);
-            }
-        } catch (Exception e) {
-            log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
-        }
-    }
+    // JSONObject result = new JSONObject();
+    // JSONArray array = new JSONArray();
+    // result.set("users", array);
+    // for (Object key : sessionMap.keySet()) {
+    // JSONObject jsonObject = new JSONObject();
+    // jsonObject.set("username", key);
+    // array.add(jsonObject);
+    // }
 
-    public List<String> getMessages() {
-        return messages;
-    }
+    // sendAllMessage(JSONUtil.toJsonStr(result)); // 鍚庡彴鍙戦�佹秷鎭粰鎵�鏈夌殑瀹㈡埛绔�
+  }
 
-    public void clearMessages() {
-        messages.clear();
+  /**
+   * 杩炴帴鍏抽棴璋冪敤鐨勬柟娉�
+   */
+  @OnClose
+  public void onClose(Session session, @PathParam("username") String username) {
+    sessionMap.remove(username);
+    log.info("鏈変竴杩炴帴鍏抽棴锛岀Щ闄sername={}鐨勭敤鎴穝ession, 褰撳墠鍦ㄧ嚎浜烘暟涓猴細{}", username, sessionMap.size());
+  }
+
+  /**
+   * 鏀跺埌瀹㈡埛绔秷鎭悗璋冪敤鐨勬柟娉�
+   * 鍚庡彴鏀跺埌瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
+   * onMessage 鏄竴涓秷鎭殑涓浆绔�
+   * 鎺ュ彈 娴忚鍣ㄧ socket.send 鍙戦�佽繃鏉ョ殑 json鏁版嵁
+   * 
+   * @param message 瀹㈡埛绔彂閫佽繃鏉ョ殑娑堟伅
+   */
+  @OnMessage
+  public void onMessage(String message, Session session, @PathParam("username") String username) {
+    log.info("鏈嶅姟绔敹鍒扮敤鎴穟sername={}鐨勬秷鎭�:{}", username, message);
+    JSONObject obj = JSONUtil.parseObj(message);
+    String text = obj.getStr("data");
+
+    JSONObject jsonObject = new JSONObject();
+    jsonObject.set("message", text);
+    this.messages.add(text);
+    this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
+  }
+
+  @OnError
+  public void onError(Session session, Throwable error) {
+    log.error("鍙戠敓閿欒");
+    error.printStackTrace();
+  }
+
+  /**
+   * 鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔�
+   */
+  public void sendMessage(String message) {
+    try {
+      log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
+      this.session.getBasicRemote().sendText(message);
+    } catch (Exception e) {
+      log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
     }
+  }
+
+  /**
+   * 鏈嶅姟绔彂閫佹秷鎭粰鎵�鏈夊鎴风
+   */
+  public void sendAllMessage(String message) {
+    try {
+      for (WebSocketServer webSocketServer : sessionMap.values()) {
+        log.info("鏈嶅姟绔粰瀹㈡埛绔痆{}]鍙戦�佹秷鎭瘂}", this.session.getId(), message);
+        webSocketServer.sendMessage(message);
+      }
+    } catch (Exception e) {
+      log.error("鏈嶅姟绔彂閫佹秷鎭粰瀹㈡埛绔け璐�", e);
+    }
+  }
+
+  public List<String> getMessages() {
+    return messages;
+  }
+
+  public void clearMessages() {
+    messages.clear();
+  }
 }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
index 3e48672..311081c 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -6,7 +6,11 @@
 import org.springframework.stereotype.Component;
 
 import com.example.springboot.component.PlcHold;
+import com.example.springboot.component.PlcParameter;
 import com.example.springboot.component.Plcaction;
+import com.example.springboot.component.Plcalarm;
+import com.example.springboot.component.Plcsign;
+import com.example.springboot.component.Plcstate;
 
 @Component
 @Order(1)
@@ -20,5 +24,13 @@
     new PlcHold().start();
 
     new Plcaction().start();
+
+    new PlcParameter().start();
+
+    new Plcalarm().start();
+
+    new Plcsign().start();
+
+    new Plcstate().start();
   }
 }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
new file mode 100644
index 0000000..43aeeb4
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/AlarmController.java
@@ -0,0 +1,34 @@
+package com.example.springboot.controller;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.example.springboot.common.Result;
+import com.example.springboot.entity.alarmmg;
+import com.example.springboot.mapper.AlarmMapper;
+import com.example.springboot.service.AlarmService;
+
+@RestController
+@RequestMapping("/alarm")
+public class AlarmController {
+  @Autowired
+  AlarmMapper alarmMapper;
+
+  @Autowired
+  AlarmService alarmService;
+
+  @GetMapping("/load")
+  public Result selectAll() {
+    List<alarmmg> storageCagelist = alarmMapper.selectAll();
+    Map<String, Object> map = new HashMap<>();
+    map.put("list", storageCagelist);
+    return Result.success(map);
+  }
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java b/springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java
new file mode 100644
index 0000000..3ddeac5
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/alarmmg.java
@@ -0,0 +1,43 @@
+package com.example.springboot.entity;
+
+import java.util.Date;
+
+public class alarmmg {
+  private Integer id;
+  private String content;
+  private Date timeon;
+  private Date endTime;
+
+  public void setid(Integer id) {
+    this.id = id;
+  }
+
+  public Integer getid() {
+    return id;
+  }
+
+  public void setontent(String content) {
+    this.content = content;
+  }
+
+  public String getcontent() {
+    return content;
+  }
+
+  public void settimeon(Date timeon) {
+    this.timeon = timeon;
+  }
+
+  public Date gettimeon() {
+    return timeon;
+  }
+
+  public void setendTime(Date endTime) {
+    this.endTime = endTime;
+  }
+
+  public Date getendTime() {
+    return endTime;
+  }
+
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java
new file mode 100644
index 0000000..13238e9
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlarmMapper.java
@@ -0,0 +1,22 @@
+package com.example.springboot.mapper;
+
+import org.apache.ibatis.annotations.*;
+
+import com.example.springboot.entity.alarmmg;
+
+import java.util.List;
+
+@Mapper
+public interface AlarmMapper {
+  @Select("SELECT * FROM alarmmg")
+  List<alarmmg> selectAll();
+
+  @Select("SELECT count(*) FROM alarmmg where endTime is null and content=#{content}")
+  short selectnullti(String content);
+
+  @Insert("INSERT INTO `canadames`.`alarmmg`( `content`,`timeon`) VALUES ( #{content},now())")
+  void Insertalarm(String content);
+
+  @Insert("UPDATE  `canadames`.`alarmmg` set endTime= now() where endTime is null and content=#{content}")
+  void updatealarm(String content);
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/AlarmService.java b/springboot-vue3/src/main/java/com/example/springboot/service/AlarmService.java
new file mode 100644
index 0000000..6e62ec4
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/AlarmService.java
@@ -0,0 +1,8 @@
+package com.example.springboot.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class AlarmService {
+
+}

--
Gitblit v1.8.0