From 50122609dfab86da64df82396a30a30455e5bd67 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 27 十二月 2023 08:31:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

---
 CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue                                  |   38 +-
 springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java         |   30 +
 springboot-vue3/src/main/java/com/example/springboot/component/S7control.java             |   10 
 CanadaMes-ui/src/views/Electrical/ManualonePosition.vue                                   |   53 +-
 CanadaMes-ui/src/views/Electrical/Parameter2.vue                                          |   63 ++-
 springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java              |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java               |  284 ++++++++++++-----
 CanadaMes-ui/src/layout/index.vue                                                         |  152 +++++----
 CanadaMes-ui/src/views/Electrical/Positioning1.vue                                        |   30 +
 springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java          |   36 +-
 CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue                           |  167 +++++----
 CanadaMes-ui/src/lang/locales/en-US.json                                                  |    9 
 CanadaMes-ui/src/views/Electrical/ServoManualone.vue                                      |   35 +
 14 files changed, 555 insertions(+), 356 deletions(-)

diff --git a/CanadaMes-ui/src/lang/locales/en-US.json b/CanadaMes-ui/src/lang/locales/en-US.json
index 741fc2c..54a8dee 100644
--- a/CanadaMes-ui/src/lang/locales/en-US.json
+++ b/CanadaMes-ui/src/lang/locales/en-US.json
@@ -39,6 +39,9 @@
   "exit": "exit",
   "changePassword": "changePassword",
   "resetPassword": "resetPassword",
+  "Old password":"Old password",
+  "New password":"New password",
+  "Confirm password":"Confirm password",
   "home": "Home",
   "role": "role",
   "langRoleManagement": "Role Management",
@@ -372,9 +375,9 @@
           "D01鎵嬪姩鐘舵��": "D01 Manual Status",
           "娓呴櫎ID": "Clear ID",
           "ID": "ID",
-          "A02ID": "ID",
-          "B01ID": "ID",
-          "B02ID": "ID",
+          "A02ID": "A02ID",
+          "B01ID": "B01ID",
+          "B02ID": "B02ID",
           "D02鎵嬪姩鐘舵��": "D02 Manual Status",
           "D03鎵嬪姩鐘舵��": "D03 Manual Status",
           "D04鎵嬪姩鐘舵��": "D04 Manual Status",
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index f52efa3..40fce67 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -66,23 +66,24 @@
               <el-menu-item index="1-1" @click="logout">{{ $t('exit') }}</el-menu-item>
               <el-menu-item index="1-2" @click="showChangePasswordDialog">{{ $t('changePassword') }}</el-menu-item>
             </el-submenu>
+            
           </template>
           <template>
-            <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogVisible" width="30%">
-              <el-form ref="form" :model="formData" label-width="100px">
-                <el-form-item label="鏃у瘑鐮�">
+            <el-dialog :title="$t('changePassword')" :visible.sync="dialogVisible" width="30%">
+              <el-form ref="form" :model="formData" label-width="200px">
+                <el-form-item :label="$t('Old password')">
                   <el-input v-model="formData.oldPassword" type="password" show-password></el-input>
                 </el-form-item>
-                <el-form-item label="鏂板瘑鐮�">
+                <el-form-item :label="$t('New password')">
                   <el-input v-model="formData.newPassword" type="password" show-password></el-input>
                 </el-form-item>
-                <el-form-item label="纭鏂板瘑鐮�">
+                <el-form-item :label="$t('Confirm password')">
                   <el-input v-model="formData.confirmPassword" type="password" show-password></el-input>
                 </el-form-item>
               </el-form>
               <div slot="footer" class="dialog-footer">
-                <el-button @click="dialogVisible = false">鍙栨秷</el-button>
-                <el-button type="primary" @click="savePassword">淇濆瓨</el-button>
+                <el-button @click="dialogVisible = false">{{ $t('cancel') }}</el-button>
+                <el-button type="primary" @click="savePassword">{{ $t('confirm') }}</el-button>
               </div>
             </el-dialog>
           </template>
@@ -101,12 +102,13 @@
         <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
       </el-table>
     </el-dialog>
-    <el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh">
-            <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'">
-                <!-- {{ this.CountDowns }} -->
-                {{ this.CountDowns }}
-            </div>
-        </el-dialog>
+    <el-dialog :visible.sync="dialogFormVisible3" >
+     
+      <el-button :class="{ 'blue-button': receivedData === 1 }" @click="toggleButtonValue(1)">{{ $t('A01Abort/ResumeTasks') }}</el-button>
+    <el-button :class="{ 'blue-button': receivedData2 === 1 }" @click="toggleButtonValue(2)">{{ $t('A02Abort/ResumeTasks') }}</el-button>
+      
+    </el-dialog>
+
   </el-container>
 </template>
 
@@ -115,6 +117,7 @@
 import { changePassword } from '../api/user'
 import { removeToken } from "../utils/auth";
 import LanguageMixin from '../lang/LanguageMixin'
+import { MessageBox } from 'element-ui';
 // import { mapState, mapMutations } from 'vuex';
 // import Tag from '../layout/tag.vue';
 // import store from '../store';
@@ -128,6 +131,8 @@
     return {
       activeTag: '', // 褰撳墠婵�娲荤殑鏍囩
       dialogVisible: false,
+      receivedData:0,
+      receivedData2:0,
       formData: {
         oldPassword: '',
         newPassword: '',
@@ -142,19 +147,18 @@
         pageNum: -1
       },
       dialogFormVisible2: false,
-      dialogFormCountDown:false,
+      dialogFormVisible3: false,
       alarm: [],
-      alarm2: [],
-      CountDowns: "0",
-      EmergencyStop: false,
-      PromptSize:500,
-      reset:false
+      alarm2: []
     }
   },
   // components: {
   //   Tag
   // },
   created() {
+
+   
+ 
     selectList(this.menuListForm).then(res => {
       this.menuList = res.data
 
@@ -171,6 +175,48 @@
     // ...mapState('tags', ['tags'])
   },
   methods: {
+    toggleButtonValue(buttonNumber) {
+
+      MessageBox.confirm(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
+    confirmButtonText: this.$t('confirm'),
+    cancelButtonText: this.$t('cancel'),
+    type: 'warning'
+  }).then(() => {
+    // 鐐瑰嚮纭鎸夐挳鍚庢墽琛岀殑鎿嶄綔
+      if (buttonNumber === 1) {
+        this.receivedData = this.receivedData === 0 ? 1 : 0;
+      } else if (buttonNumber === 2) {
+        this.receivedData2 = this.receivedData2 === 0 ? 1 : 0;
+      }
+console.log(this.receivedData,this.receivedData2)
+
+
+        const data3 = [];
+        const resetButtonValues3 = [this.receivedData,this.receivedData2];
+
+        // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
+        data3.push(resetButtonValues3.flat());
+      
+        // 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
+
+        // 鍒涘缓 jsonObject3 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
+        const jsonObject3 = { data: data3 };
+
+        // 鎻愪氦鏁版嵁鍒板悗绔�
+        const jsonString3 = JSON.stringify(jsonObject3);
+        console.log("鎬ュ仠鍚庝腑姝�/缁х画閫夋嫨:", jsonString3);
+        socket?.send(jsonString3);
+        setTimeout(() => {
+      this.dialogFormVisible3 = false;
+    }, 1000); // 寤惰繜鏃堕棿涓�1绉掞紙1000姣锛�
+      }).catch(() => {
+    // 鐐瑰嚮鍙栨秷鎸夐挳鍚庢墽琛岀殑鎿嶄綔
+  });
+     
+      
+
+
+    },
     init() {
       let viewname = "Home";
       if (typeof (WebSocket) == "undefined") {
@@ -192,10 +238,12 @@
         socket.onmessage = function (msg) {
           //console.log("鏀跺埌鏁版嵁====" + msg.data);
           let obj = JSON.parse(msg.data);
+          if(obj.alarmmg){
 
+         
           if (obj.alarmmg[0].length > 0) {
             if (this.alarm.length > 0) {
-              if (this.alarm[this.alarm.length - 1].id != obj.alarmmg[0][obj.alarmmg[0].length - 1].id) {
+              if (this.alarm[this.alarm.length - 1].id != obj.alarmmg[0][obj.alarmmg[0].length-1].id) {
                 this.alarm = obj.alarmmg[0];
                 this.dialogFormVisible2 = true;
               }
@@ -207,24 +255,23 @@
               this.alarm = obj.alarmmg[0];
               this.dialogFormVisible2 = false;
           }
-          //鏄惁鎬ュ仠
-          if (obj.emergencystop != null) {
-            this.EmergencyStop = obj.emergencystop[0];
-          }
+        }
 
-          //澶嶄綅鍊掕鏃�
-          if (obj.countdown != null) {
-            if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) {
-              this.CountDown();
-            }
-          }
 
-          //澶嶄綅瀹屾垚淇″彿
-          if (obj.reset != null) {
-            this.reset = obj.reset[0];
-          }
 
-          this.$forceUpdate();
+          
+          
+         
+
+if(obj.Abort){
+
+          if (obj.Abort[0].length > 0) {
+            this.receivedData=obj.Abort[0][0];
+            this.receivedData2=obj.Abort[0][1];
+           this.dialogFormVisible3 = true;
+          }
+        }
+        this.$forceUpdate();
 
         }.bind(this);
         //鍏抽棴浜嬩欢
@@ -236,35 +283,6 @@
           console.log("websocket鍙戠敓浜嗛敊璇�");
         }
       }
-    },
-    //45绉掑浣嶅�掓暟璁℃椂
-    CountDown() {
-      let count = 45;
-      let timer = setInterval(
-        () => {
-          if (this.EmergencyStop == true) {
-            this.dialogFormCountDown = false;
-            clearInterval(timer);
-            this.CountDowns = "0";
-          } else {
-            if (count > 0) {
-              this.PromptSize = 500;
-              this.CountDowns = count;
-              count--;
-              this.dialogFormCountDown = true;
-            }
-            else {
-              this.PromptSize = 200;
-              this.CountDowns = "Waiting for reset";
-              if (this.reset == true) {
-                clearInterval(timer);
-                this.dialogFormCountDown = false;
-              }
-            }
-          }
-        },
-        1000
-      );
     },
     logout: function () {
       removeToken()
@@ -286,7 +304,6 @@
       //   this.$store.commit('tags/addTag', tag);
       // }
     },
-
 
     removeTag() {
       // this.$store.commit('tags/removeTag', index); // 浠� Vuex Store 涓Щ闄ゆ爣绛�
@@ -419,7 +436,10 @@
     margin-left: 10px;
   }
 }
-
+.blue-button {
+  background-color: green;
+  color: white;
+}
 .el-header {
 
   background-color: #576574;
diff --git a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
index 360f01a..c1831cb 100644
--- a/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
+++ b/CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -64,7 +64,7 @@
             v-model="item.value"
             class="input-box"
             :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"
-            @keyup.enter.native="submitDataToBackend">
+            @keyup.enter.native="submitDataToBackend($event)">
   </el-input>
 
   <!-- <el-input v-if="item.type === '0'"
@@ -114,6 +114,7 @@
 
 
   },
+ 
   methods: {
     closeSocket () {
       // 鍏抽棴 WebSocket 杩炴帴
@@ -155,7 +156,7 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
       socket?.send(jsonString);
-
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
 
     },
     initWebSocket () {
@@ -181,109 +182,117 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
   }
 
+  // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
+ 
+
   let obj = JSON.parse(msg.data);
+  
   const jsonData2 = this.jsonData;
 
   const parms = obj.params;
-      const fanzhuan = obj.fanzhuan;
-      const xiaoche = obj.xiaoche;
-      const dache = obj.dache1;
+  const fanzhuan = obj.fanzhuan;
+  const xiaoche = obj.xiaoche;
+  const dache = obj.dache1;
 
-      const parms2 = obj.params2;
-      const fanzhuan2 = obj.fanzhuan2;
-      const xiaoche2 = obj.xiaoche2;
+  const parms2 = obj.params2;
+  const fanzhuan2 = obj.fanzhuan2;
+  const xiaoche2 = obj.xiaoche2;
 
-  if(parms && !isMouseInInputBox){
-     
+  if(parms){
+    let index = 0;
+    for (let i = 0; i < jsonData2.length - 1; i++) {
+      let arr = jsonData2[i];
 
-      let index = 0;
-      for (let i = 0; i < jsonData2.length - 1; i++) {
-        let arr = jsonData2[i];
-
-        for (let j = 0; j < arr.length; j++) {
-          let obj = arr[j];
-          if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
-            if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
-              obj.value = parms[0][index];
-              index++;
-            }
+      for (let j = 0; j < arr.length; j++) {
+        let obj = arr[j];
+        if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+          if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+            obj.value = parms[0][index];
+            index++;
           }
         }
-      }
-      if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
-        jsonData2[4][0]['value'] = fanzhuan[0][0];
-      }
-      if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
-        jsonData2[3][0]['value'] = xiaoche[0][0];
-      }
-      if (Array.isArray(dache) && Array.isArray(dache[0]) && dache[0][0] !== undefined) {
-        jsonData2[2][0]['value'] = dache[0][0];
-      }
-
-      let index2 = 0;
-      for (let i = 5; i < jsonData2.length; i++) {
-        let arr2 = jsonData2[i];
-
-        for (let j = 0; j < arr2.length; j++) {
-          let obj2 = arr2[j];
-          if (obj2.type === '0' && Object.prototype.hasOwnProperty.call(obj2, 'value')) {
-            if (Array.isArray(parms2) && Array.isArray(parms2[0]) && parms2[0][index2] !== undefined) {
-              obj2.value = parms2[0][index2];
-              index2++;
-            }
-          }
-        }
-      }
-
-     
-              for (let i = 0; i < jsonData2.length; i++) {
-                let arr = jsonData2[i];
-
-                for (let j = 0; j < arr.length; j++) {
-                  let obj = arr[j];
-                  if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
-                    if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
-                      obj.value = parms[0][index];
-                      index++;
-                    }
-                  }
-                }
-              }
-      
-      if (Array.isArray(fanzhuan2) && Array.isArray(fanzhuan2[0]) && fanzhuan2[0][0] !== undefined) {
-        jsonData2[8][0]['value'] = fanzhuan2[0][0];
-      }
-
-      if (Array.isArray(xiaoche2) && Array.isArray(xiaoche2[0]) && xiaoche2[0][0] !== undefined) {
-        jsonData2[9][0]['value'] = xiaoche2[0][0];
       }
     }
-  
 
+    if (Array.isArray(fanzhuan) && Array.isArray(fanzhuan[0]) && fanzhuan[0][0] !== undefined) {
+      jsonData2[4][0]['value'] = fanzhuan[0][0];
+    }
+    if (Array.isArray(xiaoche) && Array.isArray(xiaoche[0]) && xiaoche[0][0] !== undefined) {
+      jsonData2[3][0]['value'] = xiaoche[0][0];
+    }
+    if (Array.isArray(dache) && Array.isArray(dache[0]) && dache[0][0] !== undefined) {
+      jsonData2[2][0]['value'] = dache[0][0];
+    }
 
+    let index2 = 0;
+    for (let i = 5; i < jsonData2.length; i++) {
+      let arr2 = jsonData2[i];
+
+      for (let j = 0; j < arr2.length; j++) {
+        let obj2 = arr2[j];
+        if (obj2.type === '0' && Object.prototype.hasOwnProperty.call(obj2, 'value')) {
+          if (Array.isArray(parms2) && Array.isArray(parms2[0]) && parms2[0][index2] !== undefined) {
+            obj2.value = parms2[0][index2];
+            index2++;
+          }
+        }
+      }
+    }
+
+    // // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+    // if (document.activeElement.tagName.toLowerCase() === 'input') {
+    //   return;
+    // }
+
+    for (let i = 0; i < jsonData2.length; i++) {
+      let arr = jsonData2[i];
+
+      for (let j = 0; j < arr.length; j++) {
+        let obj = arr[j];
+        if (obj.type === '0' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
+          if (Array.isArray(parms) && Array.isArray(parms[0]) && parms[0][index] !== undefined) {
+            obj.value = parms[0][index];
+            index++;
+          }
+        }
+      }
+    }
+
+    if (Array.isArray(fanzhuan2) && Array.isArray(fanzhuan2[0]) && fanzhuan2[0][0] !== undefined) {
+      jsonData2[8][0]['value'] = fanzhuan2[0][0];
+    }
+
+    if (Array.isArray(xiaoche2) && Array.isArray(xiaoche2[0]) && xiaoche2[0][0] !== undefined) {
+      jsonData2[9][0]['value'] = xiaoche2[0][0];
+    }
+  }
 };
 
 
 
 
 
+
         // 鍏抽棴浜嬩欢
         socket.onclose = function () {
           console.log("websocket宸插叧闂�");
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
index b43fd36..8d15a80 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -58,16 +58,16 @@
                 <el-input style="width:250px;"  v-if="item.state != 0 && item.type === '0' && groupIndex === 0 && (itemIndex === 2)"  readonly v-model="item.value"  
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"   ></el-input>
 
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "  v-model="item.value"  @keyup.enter.native="A01start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "  v-model="item.value"  @keyup.enter.native="A01start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
                 <el-input style="width: 250px;" v-else-if="(item.state !== 0) && (item.type === '0') && (itemIndex === 2)" v-model="item.value" readonly class="input-box"   ></el-input>
 
                 
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value"  @keyup.enter.native="A02start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1" v-model="item.value"  @keyup.enter.native="A02start($event)"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value"  @keyup.enter.native="B01start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 2" v-model="item.value"  @keyup.enter.native="B01start($event)"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"  ></el-input>
-                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value"  @keyup.enter.native="B02start"
+                <el-input style="width:250px;"  v-else-if="item.state != 0 && item.type === '0' && groupIndex === 3" v-model="item.value"  @keyup.enter.native="B02start($event)"
                 class="input-box"    :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
                 <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0'" v-model="item.value"
                 class="input-box"    :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`" ></el-input>
@@ -151,7 +151,7 @@
 
 
     },
-    A01start(){
+    A01start(event){
 
       const data = [];
 
@@ -190,9 +190,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    A02start(){
+    A02start(event){
       const data = [];
 
 for (let i = 1; i < 2; i++) {
@@ -223,9 +223,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    B01start(){
+    B01start(event){
       const data = [];
 
 for (let i = 2; i < 3; i++) {
@@ -248,9 +248,9 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    B02start(){
+    B02start(event){
       const data = [];
 
 for (let i = 3; i < 4; i++) {
@@ -283,7 +283,7 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     submitDataToBackend (currentButtonName) {
       if (currentButtonName === 'A01鍚姩' || currentButtonName === 'A01 Start') {
@@ -440,7 +440,7 @@
       }
 
 
-
+    
 
     },
 
@@ -467,21 +467,26 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+  }
+
+   // 娣诲姞鍒ゆ柇鏉′欢锛氬鏋滃厜鏍囧湪杈撳叆妗嗗唴锛屽垯涓嶆墽琛屽悗缁�昏緫
+   if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
   }
 
           let obj = JSON.parse(msg.data);
@@ -489,7 +494,7 @@
           const weihuiling = obj.weihuiling;
 
 
-  if(obj.zuhe1&& !isMouseInInputBox){
+  if(obj.zuhe1){
 
 // console.log(obj);
   
diff --git a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
index 938c04f..636b9d0 100644
--- a/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
+++ b/CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -51,11 +51,11 @@
                 <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 && (itemIndex === 2)"  readonly v-model="item.value"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
-                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "   v-model="item.value"  @keyup.enter.native="A01start"
+                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 0 "   v-model="item.value"  @keyup.enter.native="A01start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
 
-                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 "  v-model="item.value" @keyup.enter.native="A02start"
+                <el-input style="width:250px;" v-else-if="item.state != 0 && item.type === '0' && groupIndex === 1 "  v-model="item.value" @keyup.enter.native="A02start($event)"
                 class="input-box"   :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"></el-input>
 
 
@@ -133,7 +133,7 @@
     },
 
 
-    A01start(){
+    A01start(event){
       const data = [];
 
 for (let i = 0; i < 1; i++) {
@@ -155,10 +155,10 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
-
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
 
     },
-    A02start(){
+    A02start(event){
 
       const data = [];
 
@@ -180,6 +180,7 @@
 const jsonString = JSON.stringify(jsonObject);
 console.log('鎵�鏈塗ype涓�0鐨剉alue:', jsonString);
 socket?.send(jsonString);
+event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     //鎻愪氦鏂规硶
     submitDataToBackend (currentButtonName) {
@@ -318,22 +319,27 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
   }
+
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
+
 
           let obj = JSON.parse(msg.data);
           // console.log(obj)
@@ -343,7 +349,7 @@
 
 
             
-            if (obj.zuhe1&& !isMouseInInputBox ) {
+            if (obj.zuhe1 ) {
               // 鎵ц鏇存柊閫昏緫
               for (let i = 0; i < 2; i++) {
                 jsonData2[i].forEach((item, index) => {
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter2.vue b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
index 2c426cf..5542c24 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter2.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -186,7 +186,7 @@
   <el-input
                 v-if="item.type === '0' && groupIndex==15"
                 v-model="item.value"
-                @keyup.enter.native="timeout"
+                @keyup.enter.native="timeout($event)"
                 style="width: 300px"
                 class="input-box2"
               ></el-input>
@@ -265,16 +265,16 @@
     },
 
     updateButtonValue(dataGroup, itemIndex) {
-      if (dataGroup[itemIndex].button.value === 1) {
+      if (dataGroup[itemIndex].button.value2 === 1) {
         // 濡傛灉褰撳墠鎸夐挳鐨勫�兼槸 0锛屽皢鍏惰涓� 1
-        this.$set(dataGroup[itemIndex].button, "value", 0);
+        this.$set(dataGroup[itemIndex].button, "value2", 0);
       } else {
         // 鍚﹀垯灏嗗叾璁句负 0
-        this.$set(dataGroup[itemIndex].button, "value", 1);
+        this.$set(dataGroup[itemIndex].button, "value2", 1);
       }
     },
     //鑼冨洿 0-100
-    timeout(){
+    timeout(event){
 
     
         const data3 = [];
@@ -306,7 +306,7 @@
         // setTimeout(()=>
         //   window.location.reload(),2000
         // )
-      
+        event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
 
 
@@ -322,13 +322,13 @@
                 ["娓呴櫎ID", "Clear ID"].includes(subItem.button.name)
             );
 
-            return buttonItem ? buttonItem.button.value : null;
+            return buttonItem ? buttonItem.button.value2 : null;
           })
-          .filter((value) => value !== null);
+          .filter((value2) => value2 !== null);
 
         // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
         data2.push(resetButtonValues.flat());
-        data2.push([]);
+        data2.push([],[]);
         // 鍦� data2 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
 
         // 鍒涘缓 jsonObject2 瀵硅薄锛屽苟娣诲姞 data2 灞炴��
@@ -347,11 +347,12 @@
         currentButtonName === "A02缁堟/缁х画"
       ) {
         const data3 = [];
-        const resetButtonValues3 = [this.jsonData[13][0].button.value,this.jsonData[14][0].button.value];
+        const resetButtonValues3 = [this.jsonData[13][0].button.value2,this.jsonData[14][0].button.value2];
 
         // 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
         data3.push(resetButtonValues3.flat());
         data3.unshift([]);
+        data3.push([]);
         // 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
 
         // 鍒涘缓 jsonObject3 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
@@ -395,22 +396,25 @@
         socket.onopen = function () {
           console.log("websocket宸叉墦寮�");
         };
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
-
-const inputBox = document.querySelectorAll('.input-box2');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+        let isUpdated = false;  // 瀹氫箟鏍囧織鍙橀噺
+// const inputBox = document.querySelectorAll('.input-box2');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
         // 鏀跺埌娑堟伅
         socket.onmessage = (msg) => {
           if (!msg.data) {
             return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
           }
+          if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
 
           let obj = JSON.parse(msg.data);
 
@@ -424,7 +428,7 @@
           // const inputBox = document.querySelectorAll('.id');
           // const target = event.target;
 
-          if (parms && !isMouseInInputBox) {
+          if (parms ) {
             //鎬ュ仠鎸夐挳
             jsonData2[13][0].button.value = obj.jiting[0][0];
             jsonData2[14][0].button.value = obj.jiting[0][1];
@@ -504,6 +508,8 @@
                 }
               }
             }
+            this.$forceUpdate();
+
             //鎵弿鏋壂鐮佺殑ID
 
             jsonData2.forEach((item) => {
@@ -542,7 +548,18 @@
              
              jsonData2[15][0].value =  obj.timeout[0];
 
-           
+             if (!isUpdated) {
+      for (let i = 0; i < jsonData2.length; i++) {
+        for (let j = 0; j < jsonData2[i].length; j++) {
+          if(jsonData2[i][j].button){
+
+          
+          jsonData2[i][j].button.value2 = jsonData2[i][j].button.value;
+        }
+        }
+      }
+      isUpdated = true;  // 鏇存柊鏍囧織鍙橀噺鐨勫��
+    }
                  
 
           }
diff --git a/CanadaMes-ui/src/views/Electrical/Positioning1.vue b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
index 85e73be..7b46cad 100644
--- a/CanadaMes-ui/src/views/Electrical/Positioning1.vue
+++ b/CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -137,7 +137,7 @@
                 v-if="item.type === '0'"
                 v-model="item.value"
                 class="input-box"  :oninput="`value=value.replace(/^0|[^0-9]/g,'');if(value<`+item.min+`){value=`+item.value+`}else if(value>`+item.max+`){value=`+item.value+`}`"
-                @keyup.enter.native="submitDataToBackend"
+                @keyup.enter.native="submitDataToBackend($event)"
               ></el-input>
               <span v-if="item.unit" :name="item.unit">{{ item.unit }}</span>
 
@@ -180,7 +180,7 @@
       this.$set(dataGroup[itemIndex].button, "value", 1); // 鐐瑰嚮鎸夐挳鍚庡皢鍊兼敼涓�1
     },
     //鎻愪氦鏁版嵁鍒板悗绔�
-    submitDataToBackend() {
+    submitDataToBackend(event) {
       const inputData = this.jsonData.map((dataGroup) => {
         return dataGroup.map((item) => {
           if (item.type === "0") {
@@ -208,6 +208,7 @@
       const jsonString = JSON.stringify(jsonObject);
        console.log('鎻愪氦浠ヤ笅鏁版嵁鍒板悗绔�:', jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     initWebSocket() {
       let viewname = "Positioning1";
@@ -236,21 +237,24 @@
         };
 
         // 鏀跺埌娑堟伅
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+//         let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-const inputBox = document.querySelectorAll('.input-box');
-inputBox.forEach(box => {
-  box.addEventListener('mouseenter', () => {
-    isMouseInInputBox = true;
-  });
-  box.addEventListener('mouseleave', () => {
-    isMouseInInputBox = false;
-  });
-});
+// const inputBox = document.querySelectorAll('.input-box');
+// inputBox.forEach(box => {
+//   box.addEventListener('mouseenter', () => {
+//     isMouseInInputBox = true;
+//   });
+//   box.addEventListener('mouseleave', () => {
+//     isMouseInInputBox = false;
+//   });
+// });
 
 socket.onmessage = (msg) => {
   if (!msg.data) {
     return; // 濡傛灉鏀跺埌绌烘暟鎹紝鍒欑洿鎺ヨ繑鍥烇紝涓嶆墽琛屽悗缁�昏緫
+  }
+  if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
   }
 
   let obj = JSON.parse(msg.data);
@@ -258,7 +262,7 @@
 
   const parms = obj.params;
 
-  if(parms && !isMouseInInputBox){ // 鍙湁鍦ㄩ紶鏍囦笉鍦ㄨ緭鍏ユ鍐呮椂鎵嶆洿鏂版暟鎹�
+  if(parms ){ // 鍙湁鍦ㄩ紶鏍囦笉鍦ㄨ緭鍏ユ鍐呮椂鎵嶆洿鏂版暟鎹�
   //  console.log(parms)
    
     let index = 0;
diff --git a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
index 8eb562a..e2acb21 100644
--- a/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
+++ b/CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -116,7 +116,7 @@
                   <el-input
                     v-if="item.type === '0' && groupIndex === 0"
                     v-model="item.value"
-                    @keyup.enter.native="zuhe1"
+                    @keyup.enter.native="zuhe1($event)"
                     class="input-box"
                     :class="{
                       'special-class': groupIndex === 0,
@@ -127,7 +127,7 @@
                   <el-input
                     v-else-if="item.type === '0' && groupIndex === 1"
                     v-model="item.value"
-                    @keyup.enter.native="zuhe2"
+                    @keyup.enter.native="zuhe2($event)"
                     class="input-box"
                     :class="{
                       'special-class': groupIndex === 0,
@@ -317,7 +317,7 @@
         this.$set(dataGroup[itemIndex].button, "value", 1);
       }
     },
-    zuhe1() {
+    zuhe1(event) {
       const data = [];
 
       for (let i = 0; i < 1; i++) {
@@ -387,8 +387,9 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log("鎵�鏈塗ype涓�0鐨剉alue:", jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
-    zuhe2() {
+    zuhe2(event) {
       const data2 = [];
 
       for (let i = 1; i < 2; i++) {
@@ -453,6 +454,7 @@
       const jsonString = JSON.stringify(jsonObject);
       console.log("鎵�鏈塗ype涓�0鐨剉alue:", jsonString);
       socket?.send(jsonString);
+      event.target.blur(); // 鍙栨秷杈撳叆妗嗙劍鐐�
     },
     submitDataToBackend(currentButtonName) {
       const data = [];
@@ -682,17 +684,17 @@
           console.log("websocket宸叉墦寮�");
         };
 
-        let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
+        // let isMouseInInputBox = false; // 鏍囪榧犳爣鏄惁鍦ㄨ緭鍏ユ鍐�
 
-        const inputBox = document.querySelectorAll(".input-box");
-        inputBox.forEach((box) => {
-          box.addEventListener("mouseenter", () => {
-            isMouseInInputBox = true;
-          });
-          box.addEventListener("mouseleave", () => {
-            isMouseInInputBox = false;
-          });
-        });
+        // const inputBox = document.querySelectorAll(".input-box");
+        // inputBox.forEach((box) => {
+        //   box.addEventListener("mouseenter", () => {
+        //     isMouseInInputBox = true;
+        //   });
+        //   box.addEventListener("mouseleave", () => {
+        //     isMouseInInputBox = false;
+        //   });
+        // });
 
         socket.onmessage = (msg) => {
           if (!msg.data) {
@@ -703,8 +705,11 @@
           // console.log(obj)
           const weihuiling = obj.weihuiling;
           const jsonData2 = this.jsonData;
+          if (document.activeElement.tagName.toLowerCase() === 'input') {
+    return;
+  }
 
-          if (obj.zuhe1 && !isMouseInInputBox) {
+          if (obj.zuhe1 ) {
             //鍚姩鎸夐挳
 
             // 鎵ц鏇存柊閫昏緫
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
index 0d5816b..458ccf8 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition2.java
@@ -72,7 +72,7 @@
             addresses2.add("DB100.118");
             addresses2.add("DB100.192");
 
-            addresses2.add("DB103.22");
+            addresses2.add("DB106.14");
             List<Short> arraylist2 = S7control.getinstance().readWords(addresses2);
 
             List<String> addresses9 = new ArrayList<>();
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
index 9d37a13..e48d3c0 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -21,7 +21,7 @@
 
 public class PlcParameter2 extends Thread {
     @Autowired
-    StorageCageService StorageCageService  ;
+    StorageCageService storageCageService;
 
 
     // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
@@ -44,12 +44,12 @@
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
-            StorageCageService = WebSocketServer.applicationContext.getBean(StorageCageService .class);
+            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService .class);
             //  id
             List<String> addressList1 = Arrays.asList(config.getProperty("Parameter2.id").split(","));
 
             List<String> paramlist = S7control.getinstance().readStrings(addressList1);
-
+           // System.out.println("addressList锛�" + paramlist);
 
             //鎵嬪姩鐘舵��
             List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(","));
@@ -188,18 +188,26 @@
                                         }
                                     }
 //瀹屾垚鍑虹墖
+                                    boolean containsOne = data.stream().anyMatch(number -> number == 1);
                                     for (int i = 1; i <= 5; i++) {
                                         boolean value = sValue.get(i);
-                                        if (value) {
+                                        String id=paramlist.get(i);
+                                        //鍒ゆ柇鏄惁鑷姩鐘舵��
+                                       if(!containsOne) {
+                                     //鍒ゆ柇id鏄惁鍖呭惈鏁板瓧
+                                      if(id.matches(".*\\d.*")){
+                                          //鍒ゆ柇娓呮id鏄惁true
+                                          if (value) {
+                                           System.out.println(id);
                                             switch (i) {
                                                 case 1:
-                                                    StorageCageService.UpdateTask(2, 0, paramlist.get(i));
+                                                    storageCageService.UpdateTask(2, 0, paramlist.get(i));
                                                     break;
                                                 case 2:
                                                 case 3:
                                                 case 4:
                                                 case 5:
-                                                    StorageCageService.UpdateTask(3, 0, paramlist.get(i));
+                                                    storageCageService.UpdateTask(3, 0, paramlist.get(i));
                                                     break;
                                                 default:
                                                     // 澶勭悊绱㈠紩鍊间笉鍦ㄨ寖鍥村唴鐨勬儏鍐�
@@ -208,12 +216,14 @@
                                         }
                                     }
 
+                                    }
                                     // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
                                     if (!sValue.isEmpty()) {
 
                                         // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
                                         S7control.getinstance().WriteBit(addressList0, sValue);
                                         System.out.println("Values " + sValue + " written to PLC at address " + addressList0);
+                                    }
                                     }
                                 }
                             } catch (Exception e) {
@@ -261,19 +271,19 @@
                                     boolean Value2 = sValue.get(1);
 
                                     if (Value1) {
-                                        StorageCageService.EndTask(0);
+                                        storageCageService.EndTask(0);
 
                                     }
                                     if (Value2) {
-                                        StorageCageService.EndTask(1);
+                                        storageCageService.EndTask(1);
 
                                     }
                                     // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
                                     if (!sValue.isEmpty()) {
 
                                         // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
-                                        S7control.getinstance().WriteBit(addressList0, sValue);
-                                        System.out.println("Values " + sValue + " written to PLC at address " + addressList0);
+                                        S7control.getinstance().WriteBit(niuanaddressList3, sValue);
+                                        System.out.println("Values " + sValue + " written to PLC at address " + niuanaddressList3);
                                     }
                                 }
                             } catch (Exception e) {
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
index fca4eb9..2d0c98d 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -28,7 +28,7 @@
     FileInputStream fileInputStream;
     try {
       // 浠庢枃浠朵腑璇诲彇瀛楄妭鏁版嵁瀛樺叆 fileInputStream
-      fileInputStream = new FileInputStream("D:/Code/canadames/Alarm.json");
+      fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
       // 璇诲彇 fileInputStream 涓瓧鑺傚苟灏嗗叾瑙g爜涓哄瓧绗�
       InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
       // 鎻愰珮璇诲彇鏁堢巼锛屽湪 BufferedReader 鍐呭寘瑁� InputStreamReader
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
index 4a80ecd..bbff53e 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -1,11 +1,15 @@
 package com.example.springboot.component;
 
+import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 
+import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
+import com.example.springboot.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.example.springboot.entity.Out_slice;
@@ -14,10 +18,7 @@
 import com.example.springboot.entity.alarmmg;
 import com.example.springboot.mapper.HomeMapper;
 import com.example.springboot.mapper.SpianMapper;
-import com.example.springboot.service.JdbcConnections;
-import com.example.springboot.service.North_Glass_Buffer1Service;
-import com.example.springboot.service.OutSliceServive;
-import com.example.springboot.service.SpianService;
+import com.example.springboot.service.StorageCageService;
 
 public class Plchome extends Thread {
 
@@ -36,6 +37,17 @@
     // 鏄惁闇�瑕佹墜鍔ㄧ‘璁ょ幓鐠�
     public static Boolean isConfirm = false;
 
+    private Configuration config;
+
+
+
+    private  StorageCageService storageCageService;
+
+
+    public Plchome() throws IOException {
+        config = new Configuration("config.properties");
+    }
+
     // public static Map b=new HashMap<>();
     // b.put()
     @Override
@@ -50,6 +62,7 @@
             JSONObject jsonObject = new JSONObject();
 
             // 娉ㄥ叆mapper
+
             homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
             spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
             spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
@@ -100,91 +113,120 @@
             // 鏄惁闇�瑕佷汉宸ョ‘璁や笂鐗囩幓鐠�
             jsonObject.append("isConfirm", isConfirm);
 
-            if (S7control.getinstance().CheckConnected() == true) {
-                // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
-                List<String> addressList = new ArrayList<String>();
-                addressList.add("DB106.12");
-                addressList.add("DB106.0");
-                List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
-                if (paramlist != null) {
+            // 璇诲幓Plc杩涚墖杞︿笌鍑虹墖杞︿綅缃甒
+            List<String> addressList = new ArrayList<String>();
+            addressList.add("DB106.12");
+            addressList.add("DB106.0");
+            List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
+            if (paramlist != null) {
                 jsonObject.append("params", paramlist);
-                }
-                // 鑾峰彇杩涚墖杞︾姸鎬�
-                List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
-                1);// 鑾峰彇杩涚墖杞︾姸鎬�
-                boolean exist1 = datas1ListState.contains((short) 0);
-                jsonObject.append("zhuangtai", exist1);
-                // 鑾峰彇杩涚墖鐜荤拑淇℃伅
-                List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
-                if (inglassInfo != null) {
+            }
+            // 鑾峰彇杩涚墖杞︾姸鎬�
+            List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
+                    1);// 鑾峰彇杩涚墖杞︾姸鎬�
+            boolean exist1 = datas1ListState.contains((short) 0);
+            jsonObject.append("zhuangtai", exist1);
+            // 鑾峰彇杩涚墖鐜荤拑淇℃伅
+            List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
+            if (inglassInfo != null) {
                 if (inglassInfo.size() > 0)
-                jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
-                }
-
-                // 鑾峰彇閾濇idDB106.DBW64
-                String frameno = spianService.queGlassid("DB103.270", 14).toString();
-                // String frameno="X12345611002GV";
-                if (!frameno.equals(Plchome.FrameNo)) {
-                Plchome.FrameNo = frameno;
-                try {
-                north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
-                } catch (SQLException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-                }
-                }
-
-                // 鑾峰彇杩涚墖璇锋眰鐘舵��
-                List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
-                boolean D01RequestState = D01Request.contains((short) 1);
-                // boolean D01RequestState =true;
-                jsonObject.append("D01RequestState", D01RequestState);
-
-                // 澶嶄綅鍊掕鏃�
-                // 鍦板潃104.9.6
-                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
-                for (Boolean countdowns : countdown) {
-                jsonObject.append("countdown", countdowns);
-                }
-                // jsonObject.append("countdown", true);
-                // 澶嶄綅瀹屾垚淇″彿
-                List<Boolean> resets = S7control.getinstance().ReadBits("DB103.284", 1);
-                for (Boolean reset : resets) {
-                jsonObject.append("reset", reset);
-                }
-
-                // 鏄惁鎬ュ仠
-                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1",
-                1);
-                for (Boolean emergencystop : emergencystops) {
-                jsonObject.append("emergencystop", emergencystop);
-                }
-
-                // 閾濇绾夸氦浜�
-
-                // //閾濇id璇锋眰瀛�
-                // List<Short> framerequest = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
-                // if(framerequest!=null){
-                // //閾濇id
-                // String franmeno= spianService.queGlassid("閾濇id鍦板潃", 14).toString();
-                // String position;
-                // try {
-                // position=dbserve.SelectPositionByFrameBarcode(franmeno);
-                // } catch (SQLException e) {
-                // // TODO Auto-generated catch block
-                // position="0";
-                // e.printStackTrace();
-                // }
-                // Short send;
-                // if(position=="0"){
-                // send=0;
-                // }else{
-                // send=1;
-                // }
-                // S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short)send);
-                // }
+                    jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
             }
 
+            // 鑾峰彇閾濇idDB106.DBW64
+            String frameno = spianService.queGlassid("DB103.270", 14).toString();
+            // String frameno="X12345611002GV";
+            if (!frameno.equals(Plchome.FrameNo)) {
+                Plchome.FrameNo = frameno;
+                try {
+                    north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
+                } catch (SQLException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+
+            // 鑾峰彇杩涚墖璇锋眰鐘舵��
+            List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
+            boolean D01RequestState = D01Request.contains((short) 1);
+            // boolean D01RequestState =true;
+            jsonObject.append("D01RequestState", D01RequestState);
+
+            // 澶嶄綅鍊掕鏃�
+            // 鍦板潃104.9.6
+            List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
+            for (Boolean countdowns : countdown) {
+                jsonObject.append("countdown", countdowns);
+            }
+            // jsonObject.append("countdown", true);
+            // 澶嶄綅瀹屾垚淇″彿
+            List<Boolean> resets = S7control.getinstance().ReadBits("DB103.284", 1);
+            for (Boolean reset : resets) {
+                jsonObject.append("reset", reset);
+            }
+
+            // 鏄惁鎬ュ仠
+            List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
+            for (Boolean emergencystop : emergencystops) {
+                jsonObject.append("emergencystop", emergencystop);
+            }
+
+            //缁堟缁х画鎸夐挳
+            List<String> niuanaddressList3 = Arrays.asList(config.getProperty("Parameter2.stop").split(","));
+            List<Boolean> anniuread = S7control.getinstance().readBits(niuanaddressList3);
+//            Boolean[] value4 = { false, false};
+//    List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
+//            Boolean[] value5 = { true};
+//            List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
+            short[] anniuparams = new short[anniuread.size()];
+            for (int i = 0; i < anniuread.size(); i++) {
+                boolean value = anniuread.get(i);
+                anniuparams[i] = value ? (short) 1 : (short) 0;
+            }
+
+
+            short[] resets2 = new short[resets.size()];
+            for (int i = 0; i < resets.size(); i++) {
+                boolean value = resets.get(i);
+                resets2[i] = value ? (short) 1 : (short) 0;
+            }
+
+           System.out.println(resets);
+            for (short number : resets2) {
+
+                if (number == 1) {
+                    System.out.println(resets);
+                    jsonObject.append("Abort", anniuparams);
+
+                }
+
+            }
+
+
+            // 閾濇绾夸氦浜�
+
+            // //閾濇id璇锋眰瀛�
+            // List<Short> framerequest = S7control.getinstance().ReadWord("閾濇id璇锋眰瀛楀湴鍧�", 1);
+            // if(framerequest!=null){
+            // //閾濇id
+            // String franmeno= spianService.queGlassid("閾濇id鍦板潃", 14).toString();
+            // String position;
+            // try {
+            // position=dbserve.SelectPositionByFrameBarcode(franmeno);
+            // } catch (SQLException e) {
+            // // TODO Auto-generated catch block
+            // position="0";
+            // e.printStackTrace();
+            // }
+            // Short send;
+            // if(position=="0"){
+            // send=0;
+            // }else{
+            // send=1;
+            // }
+            // S7control.getinstance().WriteWord("閾濇缈昏浆鍙戦�佸湴鍧�", (short)send);
+            // }
+            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
             dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
             boolean dbconnected = false;
             try {
@@ -200,9 +242,79 @@
             if (sendwServer != null) {
                 for (WebSocketServer webserver : sendwServer) {
                     webserver.sendMessage(jsonObject.toString());
+
+                    if (webserver != null) {
+
+
+                        List<String> messages = webserver.getMessages();
+
+                        if (!messages.isEmpty()) {
+                            // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
+                            String lastMessage = messages.get(messages.size() - 1);
+//        System.out.println("lastMessage锛�" + lastMessage);
+                            JSONArray messageArray = new JSONArray(lastMessage);
+
+
+                            try {
+                                // 妫�鏌ョ储寮曟槸鍚︽湁鏁�
+                                if (messageArray.getJSONArray(0).size() > 0) {
+                                    // 鑾峰彇娑堟伅鏁扮粍
+                                    JSONArray jsonArray = messageArray.getJSONArray(0);
+                                    // 鍒涘缓涓�涓竷灏斿�煎垪琛�
+                                    List<Boolean> sValue = new ArrayList<>();
+                                    // 閬嶅巻娑堟伅鏁扮粍
+                                    for (int i = 0; i < jsonArray.size(); i++) {
+                                        // 鑾峰彇娑堟伅鏁扮粍涓殑鍊�
+                                        Object value = jsonArray.get(i);
+                                        // 妫�鏌ュ�兼槸鍚︽湁鏁�
+                                        if (value != null && !value.toString().equals("null")) {
+                                            try {
+                                                // 绉婚櫎闈炴暟瀛楀拰鏁板瓧瀛楃
+                                                String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
+                                                // 瑙f瀽涓哄竷灏斿��
+                                                boolean val = "1".equals(cleanedValue.trim());
+                                                // 灏嗗竷灏斿�兼坊鍔犲埌甯冨皵鍊煎垪琛ㄤ腑
+                                                sValue.add(val);
+                                                System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
+
+
+                                            } catch (NumberFormatException e) {
+                                                // 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
+                                                System.err.println("Could not parse value: " + value);
+                                            }
+                                        }
+                                    }
+// 缁堟杩涚墖浠诲姟
+                                    boolean Value1 = sValue.get(0);
+                                    boolean Value2 = sValue.get(1);
+
+                                    if (Value1) {
+                                        storageCageService.EndTask(0);
+
+                                    }
+                                    if (Value2) {
+                                        storageCageService.EndTask(1);
+
+                                    }
+                                    // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
+                                    if (!sValue.isEmpty()) {
+
+                                        // 璋冪敤 S7control.getinstance().WriteBit 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
+                                        S7control.getinstance().WriteBit(niuanaddressList3, sValue);
+                                        System.out.println("Values " + sValue + " written to PLC at address " + niuanaddressList3);
+                                    }
+                                }
+                            } catch (Exception e) {
+                                System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
+                            }
+                            webserver.clearMessages();
+                        }
+
+
+                    }
+
                 }
             }
-
         }
     }
 }
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
index 0eb3b69..75fcb53 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -223,7 +223,15 @@
         if (s7PLC==null)
              return null;
        // List<String> addresslist = GetAddressList(address, count, 16);
-        return s7PLC.readByte(address,count);
+
+        try {
+            return s7PLC.readByte(address, count);
+        }catch (Exception e) {
+            // 澶勭悊寮傚父
+            System.out.println("璇诲彇 " + address + " 澶辫触锛�" + e.getMessage());
+            return null;
+        }
+
     }
 
     /**
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 9e6010b..8fc312a 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
@@ -17,24 +17,24 @@
         //
         System.out.println("鍚姩瀹屾垚");
 
-        // new PlcHold().start();
+ //new PlcHold().start();
 
-        new Plchome().start();
-
-        // new Plcalarm().start();
-
-        // new Plcsign().start();
-
-        // new Plcstate().start();
-        // new PlcPositioning1().start();
-
-        // new PlcParameter2().start();
-
-        // new PLCAutomaticParameterSetting().start();
-
-        // new PlcManualonePosition().start();
-        // new PlcManualonePosition2().start();
-        // new PlcServoManualone().start();
-        // new PLCManualJog().start();
+//        new Plchome().start();
+//
+//           new Plcalarm().start();
+//
+//           new Plcsign().start();
+//
+//
+//           new Plcstate().start();
+//           new PlcPositioning1().start();
+//
+//          new PlcParameter2().start();
+//
+//           new PLCAutomaticParameterSetting().start();
+//           new PlcManualonePosition().start();
+//           new PlcManualonePosition2().start();
+//           new PlcServoManualone().start();
+//           new PLCManualJog().start();
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0