From 09c655782b6f9996bc084e6f0c9721d0f2574aa8 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期四, 14 九月 2023 16:32:11 +0800
Subject: [PATCH] 1、解决vuex切换页面样式混乱 2、修改plc地址
---
CanadaMes-ui/src/views/home/index.vue | 2
CanadaMes-ui/src/views/Electrical/Sign.vue | 2
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java | 12 +++---
CanadaMes-ui/src/views/Electrical/alarm.vue | 2
CanadaMes-ui/src/store/index.js | 6 +-
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java | 4 +-
CanadaMes-ui/src/views/Electrical/State.vue | 8 ++--
CanadaMes-ui/src/views/Electrical/Action.vue | 5 +-
CanadaMes-ui/src/views/Electrical/Parameter.vue | 22 ++++++++--
springboot-vue3/src/main/resources/sql/canadames.sql | 30 +++++++--------
springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java | 4 +-
11 files changed, 54 insertions(+), 43 deletions(-)
diff --git a/CanadaMes-ui/src/store/index.js b/CanadaMes-ui/src/store/index.js
index 9b88426..a10adaa 100644
--- a/CanadaMes-ui/src/store/index.js
+++ b/CanadaMes-ui/src/store/index.js
@@ -10,9 +10,9 @@
modules: {
tags,
},
- state: {
- tagData: {} // 瀛樺偍鏍囩鏁版嵁鐨勫璞�
- },
+ // state: {
+ // tagData: {} // 瀛樺偍鏍囩鏁版嵁鐨勫璞�
+ // },
mutations: {
// 鏇存柊鏍囩鏁版嵁
updateTagData(state, payload) {
diff --git a/CanadaMes-ui/src/views/Electrical/Action.vue b/CanadaMes-ui/src/views/Electrical/Action.vue
index fa5270b..ce204d6 100644
--- a/CanadaMes-ui/src/views/Electrical/Action.vue
+++ b/CanadaMes-ui/src/views/Electrical/Action.vue
@@ -139,6 +139,7 @@
}
let obj = JSON.parse(msg.data);
+ if (obj.params ){
this.record.params[0] = obj.params[0];
for (let a = 0; a <= this.record.params[0].length - 1; a++) {
@@ -148,7 +149,7 @@
this.record.xyData[a].value = this.record.params[0][a].toString();
}
}
-
+ }
// console.log(this.record.xyData);
this.$forceUpdate();
};
@@ -181,7 +182,7 @@
</script>
-<style>
+<style scoped>
.kuai_div {
/* width: 30%; */
margin-bottom: 30px;
diff --git a/CanadaMes-ui/src/views/Electrical/Parameter.vue b/CanadaMes-ui/src/views/Electrical/Parameter.vue
index 2d71729..40c48ee 100644
--- a/CanadaMes-ui/src/views/Electrical/Parameter.vue
+++ b/CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -102,13 +102,23 @@
}
let obj = JSON.parse(msg.data);
+
+
+ if (obj.params && obj.state){
+
+
+
+
this.record.params[0] = obj.params[0];
this.record.state = obj.state[0];
+ if (obj.state && obj.state.length > 0) {
+ let isButtonDisabled = this.record.state.includes(1);
+ this.isButtonDisabled = isButtonDisabled;
- let isButtonDisabled = this.record.state.includes(1);
+
// 鍒ゆ柇state涓槸鍚﹀瓨鍦�1
//console.log(isButtonDisabled)
- this.isButtonDisabled = isButtonDisabled; // 灏嗗垽鏂粨鏋滀繚瀛樺埌鍙橀噺isButtonDisabled涓�
+ // 灏嗗垽鏂粨鏋滀繚瀛樺埌鍙橀噺isButtonDisabled涓�
for (let a = 0; a <= this.record.params[0].length - 1; a++) {
if (!this.record.xyData[a]) {
@@ -117,7 +127,8 @@
this.record.xyData[a].value = this.record.params[0][a];
}
}
-
+ }
+ }
//console.log(this.record.xyData);
this.$forceUpdate();
};
@@ -145,7 +156,7 @@
};
</script>
-<style>
+<style scoped>
.kuai_div {
width: calc(100% / 2);
margin-bottom: 15px;
@@ -153,6 +164,7 @@
.el-input__inner {
border: 1px solid black;
+ border: none;
}
.in_mc {
@@ -162,7 +174,7 @@
.blue-button {
background-color: skyblue;
- color: #fff;
+
}
#btn_div {
width: 100%;
diff --git a/CanadaMes-ui/src/views/Electrical/Sign.vue b/CanadaMes-ui/src/views/Electrical/Sign.vue
index c73308f..11e52a9 100644
--- a/CanadaMes-ui/src/views/Electrical/Sign.vue
+++ b/CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -225,7 +225,7 @@
</script>
-<style>
+<style >
* {
margin: 0;
padding: 0;
diff --git a/CanadaMes-ui/src/views/Electrical/State.vue b/CanadaMes-ui/src/views/Electrical/State.vue
index 7098e1b..fdf7dd0 100644
--- a/CanadaMes-ui/src/views/Electrical/State.vue
+++ b/CanadaMes-ui/src/views/Electrical/State.vue
@@ -16,7 +16,7 @@
<el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
<div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
- <el-input style="width: 280px;" class="in_mc" v-model="item.name"></el-input>
+ <el-input style="width: 280px;" class="in_mc" v-model="item.name" readonly></el-input>
<el-input v-model="item.value" readonly="readonly" style="width: 90px;"></el-input>
</div>
@@ -151,11 +151,11 @@
</script>
-<style>
-* {
+<style scoped>
+/* * {
margin: 0px;
padding: 0px;
-}
+} */
.kuai_div {
width: 30%;
diff --git a/CanadaMes-ui/src/views/Electrical/alarm.vue b/CanadaMes-ui/src/views/Electrical/alarm.vue
index 378a61d..a56d009 100644
--- a/CanadaMes-ui/src/views/Electrical/alarm.vue
+++ b/CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -211,7 +211,7 @@
</script>
-<style>
+<style >
.kuai_div {
/* width: 30%; */
margin-bottom: 30px;
diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 76653ab..601989b 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -79,7 +79,7 @@
margin: 0 auto;
background-repeat: no-repeat;
/* background-size: 100% 100%; */
- background-size: 1660px 560px;
+ background-size: 1660px 560px ;
background-attachment: local;
width: 1660px;
}
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
index 865c95f..3113709 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java
@@ -15,13 +15,13 @@
e.printStackTrace();
}
- List<Short> arraylist = S7control.getinstance().ReadWord("DB100.DBW0", 12);
- List<Short> state = S7control.getinstance().ReadWord("DB103.DBW0", 10);
+ List<Short> arraylist = S7control.getinstance().ReadWord("DB100.0", 12);
+ List<Short> state = S7control.getinstance().ReadWord("DB103.0", 10);
JSONObject jsonObject = new JSONObject();
-// new short[]{65545,65545, 65545, 65545, 65545, 65545, 65545, 65545, 65545,65545, 65545, 65545}
- // new short[]{65545,65545, 65545, 65545, 65545, 65545, 65545, 65545, 65545, 65545}
+// new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
+ // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
jsonObject.append("params", arraylist );
- jsonObject.append("state", state);
+ jsonObject.append("state", state);
WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter");
if (sendwServer != null) {
sendwServer.sendMessage(jsonObject.toString());
@@ -31,7 +31,7 @@
if (webSocketServer != null) {
List<String> messages = webSocketServer.getMessages();
- String addressList = "DB100.DBW0";
+ String addressList = "DB100.0";
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负 short 绫诲瀷鐨勫垪琛�
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 cc0f805..50ab8a9 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
@@ -21,7 +21,7 @@
// 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});
- List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.DBX0.0 ", 26);
+ List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0 ", 26);
// Boolean[] values = {true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,true, true,false, true};
// List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
if (paramlist == null) {
@@ -47,7 +47,7 @@
List<String> messages = webSocketServer.getMessages();
- String addressList = "DB100.DBW0";
+ String addressList = "DB100.0";
if (!messages.isEmpty()) {
// 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛�
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 5942a98..6119fae 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
@@ -11,8 +11,8 @@
S7PLC s7PLC; // PLC閫氳绫诲疄渚�
private EPlcType plcType = EPlcType.S1200; // 瑗块棬瀛怭LC绫诲瀷
- private String ip = "127.0.0.1"; // plc ip鍦板潃
- private int port = 21; // plc 绔彛鍙�
+ private String ip = "192.168.10.1"; // plc ip鍦板潃
+ private int port = 102; // plc 绔彛鍙�
private static volatile S7control instance = null;
diff --git a/springboot-vue3/src/main/resources/sql/canadames.sql b/springboot-vue3/src/main/resources/sql/canadames.sql
index 09a2669..dadc176 100644
--- a/springboot-vue3/src/main/resources/sql/canadames.sql
+++ b/springboot-vue3/src/main/resources/sql/canadames.sql
@@ -1,17 +1,17 @@
/*
Navicat MySQL Data Transfer
- Source Server : server-150
+ Source Server : 鏈湴
Source Server Type : MySQL
- Source Server Version : 80019
- Source Host : 10.153.19.150:3306
+ Source Server Version : 80022
+ Source Host : localhost:3306
Source Schema : canadames
Target Server Type : MySQL
- Target Server Version : 80019
+ Target Server Version : 80022
File Encoding : 65001
- Date: 13/09/2023 09:48:14
+ Date: 14/09/2023 09:47:12
*/
SET NAMES utf8mb4;
@@ -27,7 +27,7 @@
`timeon` datetime(0) NULL DEFAULT NULL COMMENT '寮�濮嬫椂闂�',
`endTime` datetime(0) NULL DEFAULT NULL COMMENT '缁撴潫鏃堕棿',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1338 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 1378 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of alarmmg
@@ -150,7 +150,7 @@
`width` decimal(10, 2) NULL DEFAULT NULL,
`height` decimal(10, 2) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of glass
@@ -203,7 +203,7 @@
`order_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '璁㈠崟鍙�',
`state` int NULL DEFAULT NULL COMMENT '鐘舵��(0锛氭寜姝よ鍗曞彿鍑虹墖锛�1缁撴潫鍑虹墖)',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of order_out
@@ -394,8 +394,8 @@
INSERT INTO `role_permission` VALUES (69, 2, 26, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (70, 2, 27, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
INSERT INTO `role_permission` VALUES (71, 2, 28, 1, '2021-11-28 15:07:54', '2021-11-28 15:07:54');
-INSERT INTO `role_permission` VALUES (72, 2, 30, 0, '2023-08-24 08:55:34', '2023-08-24 08:55:34');
-INSERT INTO `role_permission` VALUES (73, 2, 29, 0, '2023-08-24 08:56:15', '2023-08-28 15:33:14');
+INSERT INTO `role_permission` VALUES (72, 2, 30, 1, '2023-08-24 08:55:34', '2023-08-24 08:55:34');
+INSERT INTO `role_permission` VALUES (73, 2, 29, 1, '2023-08-24 08:56:15', '2023-08-28 15:33:14');
INSERT INTO `role_permission` VALUES (74, 2, 1, 1, '2023-08-30 16:29:46', '2023-08-30 16:29:46');
-- ----------------------------
@@ -431,9 +431,9 @@
INSERT INTO `storage_cage` VALUES (9, NULL, NULL, 1, 5, 1, 1500.00, NULL, NULL, 1, NULL);
INSERT INTO `storage_cage` VALUES (10, NULL, NULL, 1, 5, 2, 1600.00, NULL, NULL, 0, NULL);
INSERT INTO `storage_cage` VALUES (11, NULL, NULL, 1, 6, 1, 1600.00, NULL, NULL, 0, NULL);
-INSERT INTO `storage_cage` VALUES (12, '12', 'NG2202301', 1, 6, 2, 1602.00, 0.00, 2.00, 2, '2');
+INSERT INTO `storage_cage` VALUES (12, '12', 'NG2202301', 1, 6, 2, 1602.00, 0.00, 2.00, 1, '2');
INSERT INTO `storage_cage` VALUES (13, NULL, NULL, 1, 7, 1, 1600.00, NULL, NULL, 0, NULL);
-INSERT INTO `storage_cage` VALUES (14, '122', 'NG2202302', 1, 7, 2, 1500.00, 2.00, 2.00, 3, '3');
+INSERT INTO `storage_cage` VALUES (14, NULL, NULL, 1, 7, 2, 1500.00, NULL, NULL, 0, NULL);
INSERT INTO `storage_cage` VALUES (15, NULL, NULL, 1, 8, 1, 1500.00, NULL, NULL, 0, NULL);
INSERT INTO `storage_cage` VALUES (16, NULL, NULL, 1, 8, 2, 1500.00, NULL, NULL, 0, NULL);
INSERT INTO `storage_cage` VALUES (17, NULL, NULL, 1, 9, 1, 1500.00, NULL, NULL, 1, NULL);
@@ -1323,7 +1323,7 @@
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '鍒涘缓鏃堕棿',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '鏇存柊鏃堕棿',
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of user
@@ -1331,13 +1331,11 @@
INSERT INTO `user` VALUES (1, 0, '', 0, 1, 'admin', 'b2f0c414a5ffb6944c424bc18ae3a8a0', NULL, NULL, NULL, 1, '2023-08-25 08:58:58', '2023-09-05 16:12:28');
INSERT INTO `user` VALUES (2, 1, '1-', 1, 2, 'user1', '601b99523f82de29f87771d5f95accdc', 'user1@qq.com', NULL, NULL, 1, '2021-11-28 14:31:39', '2021-11-28 15:09:36');
INSERT INTO `user` VALUES (3, 1, '1-', 1, 2, 'user2', 'f403c87893db29eb71b21905b57bbd0d', 'user2@qq.com', NULL, NULL, 1, '2021-11-28 14:31:39', '2021-11-28 15:09:36');
-INSERT INTO `user` VALUES (9, 1, '1-', 1, 1, 'yttttttttttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '666@qq.com', NULL, NULL, 1, '2023-08-23 20:35:32', '2023-08-23 20:35:32');
INSERT INTO `user` VALUES (10, 1, '1-', 1, 2, '767655555', '500637c0d48b442a3be6d4fce12e0910', NULL, NULL, NULL, 1, '2023-08-23 20:42:58', '2023-08-23 20:42:58');
INSERT INTO `user` VALUES (11, 1, '1-', 1, 5, 'uiuyiuy', 'e046c4175152aa3001d2c71c5bc1aee5', '767676767tt@qq.com', NULL, NULL, 1, '2023-08-23 20:43:42', '2023-08-23 20:43:42');
-INSERT INTO `user` VALUES (13, 1, '1-', 1, 2, 'user3', '500637c0d48b442a3be6d4fce12e0910', '2265557345@qq.com', NULL, NULL, 1, '2023-08-24 09:58:40', '2023-08-24 09:58:40');
+INSERT INTO `user` VALUES (13, 1, '1-', 1, 2, 'user3', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '2265557345@qq.com', NULL, NULL, 1, '2023-08-24 09:58:40', '2023-08-24 09:58:40');
INSERT INTO `user` VALUES (15, 1, '1-', 1, 2, '99999', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '2267666@qq.com', NULL, NULL, 1, '2023-08-25 09:37:05', '2023-08-28 14:37:27');
INSERT INTO `user` VALUES (16, 1, '1-', 1, 2, '5656tttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '5454@qq.com', NULL, NULL, 1, '2023-08-28 14:17:44', '2023-08-28 14:37:24');
-INSERT INTO `user` VALUES (17, 1, '1-', 1, 2, '6767ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '225@qq.com', NULL, NULL, 1, '2023-08-28 14:20:05', '2023-08-28 14:23:53');
INSERT INTO `user` VALUES (18, 1, '1-', 1, 2, '8989ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '224@qq.com', NULL, NULL, 1, '2023-08-28 14:26:17', '2023-08-28 14:37:22');
INSERT INTO `user` VALUES (19, 1, '1-', 1, 5, '8080ttt', 'b2f0c414a5ffb6944c424bc18ae3a8a0', '87@qq.com', NULL, NULL, 1, '2023-08-28 14:34:39', '2023-08-29 16:03:38');
--
Gitblit v1.8.0