From 8c4537b96ee0fad740770fc044e02251d080b101 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期四, 04 一月 2024 14:51:05 +0800
Subject: [PATCH] 增加翻译
---
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java | 116 ++++++++----------
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java | 34 ++--
springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java | 11 +
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 2
springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java | 1
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java | 2
CanadaMes-ui/src/layout/index.vue | 161 ++++++++++++++++++--------
CanadaMes-ui/src/lang/locales/zh-CN.json | 9 +
8 files changed, 201 insertions(+), 135 deletions(-)
diff --git a/CanadaMes-ui/src/lang/locales/zh-CN.json b/CanadaMes-ui/src/lang/locales/zh-CN.json
index 0c9eb7e..8694b98 100644
--- a/CanadaMes-ui/src/lang/locales/zh-CN.json
+++ b/CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -442,5 +442,12 @@
"D04.State": "D04.鐘舵��",
"D05.State": "D05.鐘舵��",
"D06.State": "D06.鐘舵��"
- }
+ },
+ "Automatic State":"鑷姩鐘舵��",
+ "ManualJog":"寮�鍏虫帶鍒�",
+ "ManualonePosition":"鎵嬪姩瀹氫綅",
+ "Servomanualone":"鍗婅嚜鍔�",
+ "Address parameter settings":"鍦板潃鍙傛暟璁剧疆",
+ "Speed parameter settings":"閫熷害鍙傛暟璁剧疆"
+
}
\ No newline at end of file
diff --git a/CanadaMes-ui/src/layout/index.vue b/CanadaMes-ui/src/layout/index.vue
index 40fce67..bdba144 100644
--- a/CanadaMes-ui/src/layout/index.vue
+++ b/CanadaMes-ui/src/layout/index.vue
@@ -66,7 +66,7 @@
<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="$t('changePassword')" :visible.sync="dialogVisible" width="30%">
@@ -102,11 +102,19 @@
<el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
</el-table>
</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 :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>
@@ -131,8 +139,8 @@
return {
activeTag: '', // 褰撳墠婵�娲荤殑鏍囩
dialogVisible: false,
- receivedData:0,
- receivedData2:0,
+ receivedData: 0,
+ receivedData2: 0,
formData: {
oldPassword: '',
newPassword: '',
@@ -149,7 +157,12 @@
dialogFormVisible2: false,
dialogFormVisible3: false,
alarm: [],
- alarm2: []
+ alarm2: [],
+ CountDowns: "0",
+ EmergencyStop: false,
+ PromptSize: 250,
+ dialogFormCountDown:false
+
}
},
// components: {
@@ -157,8 +170,8 @@
// },
created() {
-
-
+
+
selectList(this.menuListForm).then(res => {
this.menuList = res.data
@@ -178,25 +191,25 @@
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)
+ 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];
+ const resetButtonValues3 = [this.receivedData, this.receivedData2];
// 灏嗗緱鍒扮殑鍊兼坊鍔犲埌 data 鏁扮粍涓�
data3.push(resetButtonValues3.flat());
-
+
// 鍦� data3 鏁扮粍鍓嶉潰娣诲姞涓や釜绌烘暟缁�
// 鍒涘缓 jsonObject3 瀵硅薄锛屽苟娣诲姞 data3 灞炴��
@@ -207,13 +220,13 @@
console.log("鎬ュ仠鍚庝腑姝�/缁х画閫夋嫨:", jsonString3);
socket?.send(jsonString3);
setTimeout(() => {
- this.dialogFormVisible3 = false;
- }, 1000); // 寤惰繜鏃堕棿涓�1绉掞紙1000姣锛�
+ this.dialogFormVisible3 = false;
+ }, 1000); // 寤惰繜鏃堕棿涓�1绉掞紙1000姣锛�
}).catch(() => {
- // 鐐瑰嚮鍙栨秷鎸夐挳鍚庢墽琛岀殑鎿嶄綔
- });
-
-
+ // 鐐瑰嚮鍙栨秷鎸夐挳鍚庢墽琛岀殑鎿嶄綔
+ });
+
+
},
@@ -238,40 +251,56 @@
socket.onmessage = function (msg) {
//console.log("鏀跺埌鏁版嵁====" + msg.data);
let obj = JSON.parse(msg.data);
- if(obj.alarmmg){
+ 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 (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) {
+ this.alarm = obj.alarmmg[0];
+ this.dialogFormVisible2 = true;
+ }
+ } else {
this.alarm = obj.alarmmg[0];
this.dialogFormVisible2 = true;
}
} else {
this.alarm = obj.alarmmg[0];
- this.dialogFormVisible2 = true;
- }
- }else{
- 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];
+ }
}
- }
-
-
-
-if(obj.Abort){
- if (obj.Abort[0].length > 0) {
- this.receivedData=obj.Abort[0][0];
- this.receivedData2=obj.Abort[0][1];
- this.dialogFormVisible3 = true;
+
+
+ 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();
+ this.$forceUpdate();
}.bind(this);
//鍏抽棴浜嬩欢
@@ -283,6 +312,36 @@
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()
@@ -436,10 +495,12 @@
margin-left: 10px;
}
}
+
.blue-button {
background-color: green;
color: white;
}
+
.el-header {
background-color: #576574;
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java b/springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java
index 1661078..36e26f5 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java
@@ -204,6 +204,17 @@
+ public short[] convertBooleanListToShortArray(List<Boolean> booleanList) {
+ short[] shortArray = new short[booleanList.size()];
+ for (int i = 0; i < booleanList.size(); i++) {
+ boolean value = booleanList.get(i);
+ shortArray[i] = value ? (short) 1 : (short) 0;
+ }
+ return shortArray;
+ }
+
+
+
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
index 3284110..6247785 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
@@ -206,7 +206,6 @@
// 鍐欏叆A02
customS7Control.WriteWordToPLC(messageArray, addresses2, 1);
-
// 鍐欏叆B01
customS7Control.WriteWordToPLC(messageArray, addresses3, 2);
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 e48d3c0..379ec1b 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
@@ -15,20 +15,13 @@
import java.util.List;
-
-
-
-
public class PlcParameter2 extends Thread {
@Autowired
StorageCageService storageCageService;
-
-
- // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
- private Configuration config;
-
// 鍒涘缓涓�涓嚜瀹氫箟鐨� S7 鎺у埗鍣ㄦ秷鎭鐞嗗櫒瀵硅薄
MessageHandler customS7Control = new MessageHandler();
+ // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭�
+ private Configuration config;
public PlcParameter2() throws IOException {
@@ -44,12 +37,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);
+ // System.out.println(paramlist);
//鎵嬪姩鐘舵��
List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(","));
@@ -82,7 +75,7 @@
List<Short> data4 = S7control.getinstance().readWords(addresses4);
-
+ //System.out.println(data);
// List<Long> TIME2 = Collections.singletonList(S7control.getinstance().readtime("DB100.194"));
// System.out.println("addressList锛�" + TIME2);
@@ -104,19 +97,22 @@
// List<Short> data4 = new ArrayList<>(Arrays.asList(values4));
//
//
+// JSONObject jsonObject = new JSONObject();
+// short[] params = new short[data2.size()];
+// for (int i = 0; i < data2.size(); i++) {
+// boolean value = data2.get(i);
+// params[i] = value ? (short) 1 : (short) 0;
+// }
+////
+// 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;
+// }
+ //boolean杞负0 1
+ short[] params = customS7Control.convertBooleanListToShortArray(data2);
+ short[] anniuparams = customS7Control.convertBooleanListToShortArray(anniuread);
JSONObject jsonObject = new JSONObject();
- short[] params = new short[data2.size()];
- for (int i = 0; i < data2.size(); i++) {
- boolean value = data2.get(i);
- params[i] = value ? (short) 1 : (short) 0;
- }
-//
- 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;
- }
-
jsonObject.append("params", params);
jsonObject.append("params", paramlist);
jsonObject.append("params", data);
@@ -142,16 +138,15 @@
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);
//娓呴櫎ID
- // customS7Control.writeBitToPLC(messageArray, addressList0, 0);
+ // customS7Control.writeBitToPLC(messageArray, addressList0, 0);
try {
@@ -177,10 +172,6 @@
System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
-
-
-
-
} catch (NumberFormatException e) {
// 濡傛灉鏃犳硶瑙f瀽涓� boolean 绫诲瀷锛屽垯蹇界暐璇ラ儴鍒�
System.err.println("Could not parse value: " + value);
@@ -191,47 +182,44 @@
boolean containsOne = data.stream().anyMatch(number -> number == 1);
for (int i = 1; i <= 5; i++) {
boolean value = sValue.get(i);
- String id=paramlist.get(i);
+ 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));
- break;
- case 2:
- case 3:
- case 4:
- case 5:
- storageCageService.UpdateTask(3, 0, paramlist.get(i));
- break;
- default:
- // 澶勭悊绱㈠紩鍊间笉鍦ㄨ寖鍥村唴鐨勬儏鍐�
- break;
+ 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));
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ storageCageService.UpdateTask(3, 0, paramlist.get(i));
+ break;
+ default:
+ // 澶勭悊绱㈠紩鍊间笉鍦ㄨ寖鍥村唴鐨勬儏鍐�
+ break;
+ }
+ }
}
+
}
- }
+ // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
+ if (!sValue.isEmpty()) {
- }
- // 妫�鏌ュ竷灏斿�煎垪琛ㄦ槸鍚︿负绌�
- 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 鏂规硶灏嗗竷灏斿�煎垪琛ㄥ啓鍏ュ湴鍧�鍒楄〃
+ S7control.getinstance().WriteBit(addressList0, sValue);
+ System.out.println("Values " + sValue + " written to PLC at address " + addressList0);
+ }
}
}
} catch (Exception e) {
System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
}
-
-
-
//鎬ュ仠
@@ -289,8 +277,6 @@
} catch (Exception e) {
System.err.println("An error occurred while writing bit to PLC: " + e.getMessage());
}
-
-
//瀛樼墖绛夊緟寤惰繜
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 75fcb53..e0a5353 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
@@ -353,7 +353,7 @@
try {
return s7PLC.readTime(address);
} catch (Exception e) {
- e.printStackTrace();
+ 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 8fc312a..a7a0260 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
@@ -19,22 +19,22 @@
//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
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 262fa57..37045fe 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -35,6 +35,8 @@
@Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage<=5 group by cage,cell order by cage desc,cell desc")
List<StorageCage> selectRack4();
+
+
// 鏍规嵁浠诲姟绫诲瀷鏌ヨ褰撳墠姝e湪鍑虹墖锛岃繘鐗囩殑鐜荤拑淇℃伅
@Select("select * from storage_cage where state=#{task_type}")
List<StorageCage> selectinout(@Param("task_type") Integer task_type);
--
Gitblit v1.8.0