From a7ab44bca33c0bfc85b301f6edc7398aecb74a81 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 14 九月 2023 17:03:13 +0800
Subject: [PATCH] 主界面添加1280*1024显示

---
 CanadaMes-ui/src/views/home/index.vue                                            |   77 ++++++++++++++++++++++++++++----------
 springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter.java |    6 +-
 springboot-vue3/src/main/java/com/example/springboot/component/S7control.java    |    9 +++-
 springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java     |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java      |    2 
 springboot-vue3/src/main/java/com/example/springboot/component/Plcaction.java    |    2 
 6 files changed, 68 insertions(+), 30 deletions(-)

diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 76653ab..72685ec 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -60,67 +60,78 @@
 
 .gezi {
     height: 35px;
-    width: 4.22px;
+    width: 3.07px;
+    /* width: 4.22px; */
 }
 
 .gezi:nth-child(22),
 .gezi:nth-child(43),
 .gezi:nth-child(64),
 .gezi:nth-child(85) {
-    margin-left: 10px;
+    margin-left: 7px;
+    /* margin-left: 10px; */
 }
 
 
 
 .blocks {
-    min-height: 55vh;
-    max-width: 100vw;
+    
+    max-width: 94vw;
     background-image: url('../../img/xmjc.png');
     margin: 0 auto;
     background-repeat: no-repeat;
-    /* background-size: 100% 100%; */
-    background-size: 1660px 560px;
     background-attachment: local;
     width: 1660px;
+    min-height: 55vh;
+    background-size: 1200px 510px;
+    /* max-width: 100vw;
+    background-size: 1660px 560px; */
+    
+    
 }
 
 .blocks-img {
     height: 100px;
     max-width: 100vw;
     background-repeat: no-repeat;
-    background-size: 46px 94px;
     background-attachment: local;
     width: 32px;
     position: absolute;
-    /* left: 116px; */
-    /* left:1060px;18.88px */
     background-image: url('../../img/bigcar01.png');
+    background-size: 40px 87px;
+    /* background-size: 46px 94px; */
 }
 
 .blocks-img2 {
     height: 100px;
     max-width: 100vw;
     background-repeat: no-repeat;
-    background-size: 85px 100px;
     background-attachment: local;
     width: 100px;
     position: absolute;
-    /* left: 116px; */
-    /* left:1060px;18.88px */
     background-image: url('../../img/dipan.png');
+    background-size: 70px 85px;
+    left: 654px;
+    top: 333px;
+    /* background-size: 85px 100px;
+    left: 912px;
+    top: 366px; */
 }
 
 .blocks-img3 {
     height: 90px;
     max-width: 100vw;
     background-repeat: no-repeat;
-    background-size: 160px 40px;
     background-attachment: local;
     width: 160px;
     position: absolute;
-    /* left: 116px; */
-    /* left:1060px;18.88px */
     background-image: url('../../img/taimian.png');
+    background-size: 120px 30px;
+    left: 630px;
+    top: 420px;
+    /* background-size: 160px 40px;
+    left: 875px;
+    top: 455px;  */
 }
 
 .el-table td,
@@ -226,7 +237,27 @@
         </el-main>
         <el-footer>
             <div class="blocks" style="position: relative;">
-                <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:237px;">
+                    <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
+                        @click="showcageinfo(item['cage'])"></div>
+                </div>
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:640px;">
+                    <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"
+                        @click="showcageinfo(item['cage'])"></div>
+                </div>
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:237px;">
+                    <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"
+                        @click="showcageinfo(item['cage'])"></div>
+                </div>
+                <div style="display:flex;position: absolute;float:left;z-index: 999;top:138px;left:640px;">
+                    <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"
+                        @click="showcageinfo(item['cage'])"></div>
+                </div>
+                <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
+                <div class="blocks-img" :style="{ left: car2 + 'px', top: '175px' }"></div>
+                <div class="blocks-img2"></div>
+                <div class="blocks-img3"></div>
+                <!-- <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:328px;">
                     <div :class="getStatusClass(item.state)" v-for="item in cagelist1" :key="item['date']"
                         @click="showcageinfo(item['cage'])"></div>
                 </div>
@@ -245,7 +276,7 @@
                 <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }"></div>
                 <div class="blocks-img" :style="{ left: car2 + 'px', top: '194px' }"></div>
                 <div class="blocks-img2" :style="{ left: '912px', top: '366px' }"></div>
-                <div class="blocks-img3" :style="{ left: '875px', top: '455px' }"></div>
+                <div class="blocks-img3" :style="{ left: '875px', top: '455px' }"></div> -->
             </div>
         </el-footer>
         <el-dialog :visible.sync="dialogFormVisible" :title="$t('Please confirm the glass information')">
@@ -356,8 +387,10 @@
             order: "",
             glassid: "",
             url: "../../img/bigcar01.png",
-            car1: 150,
-            car2: 242,
+            car1: 107,
+            car2: 175,
+            // car1: 150,
+            // car2: 242,
             cageinfo: [],
             cage: 0
         };
@@ -391,8 +424,10 @@
                     //console.log("鏀跺埌鏁版嵁====" + msg.data);
                     let obj = JSON.parse(msg.data);
                     if (obj.params != null) {
-                        this.car1 = 150 + 24.6 * obj.params[0][0];
-                        this.car2 = 242 + 24.6 * obj.params[0][1];
+                        this.car1 = 107 + 17.62 * obj.params[0][0];
+                        this.car2 = 175 + 17.62 * obj.params[0][1];
+                        // this.car1 = 150 + 24.6 * obj.params[0][0];
+                        // this.car2 = 242 + 24.6 * obj.params[0][1];
                     }
                     this.tableData = obj.tableData[0];
                     this.cagelist1 = obj.cagelist1[0];
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..b954640 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,8 +15,8 @@
                 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}
@@ -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..72d5cc8 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) {
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 f45650a..0d03879 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
@@ -20,7 +20,7 @@
         e.printStackTrace();
       }
 
-      List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.DBx0.0", 40);
+      List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 40);
       // Boolean[] values = { true, false, true, false, true, false, true, false,
       // true, false, true, false, true, false,
       // true, false, true, false, true, false, true, false, true, false, true, false,
diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
index e702b5b..cd0375b 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/component/Plcsign.java
@@ -16,7 +16,7 @@
         e.printStackTrace();
       }
 
-      List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.DBX0.0", 58);
+      List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 58);
       // Boolean[] values = { true, false, true, false, true, false, true, false,
       // true, false, true, false, true, false,
       // true, false, true, false, true, false, true, false, true, false, true, false,
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..dca9e9c 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
@@ -10,15 +10,17 @@
 public class S7control {
 
     S7PLC s7PLC; // PLC閫氳绫诲疄渚�
-    private EPlcType plcType = EPlcType.S1200; // 瑗块棬瀛怭LC绫诲瀷
-    private String ip = "127.0.0.1"; // plc ip鍦板潃
-    private int port = 21; // plc 绔彛鍙�
+    private EPlcType plcType = EPlcType.S1500; // 瑗块棬瀛怭LC绫诲瀷
+    private String ip = "192.168.10.1"; // plc ip鍦板潃
+    private int port = 102; // plc 绔彛鍙�
 
     private static volatile S7control instance = null;
 
     private S7control() {
         if (s7PLC == null)
             s7PLC = new S7PLC(plcType, ip, port);
+           s7PLC.connect();
+            System.out.println(ip);
     }
 
     // 鍗曚緥妯″紡 鑾峰彇绫荤殑鍞竴瀹炰緥
@@ -145,6 +147,7 @@
     public List<Short> ReadWord(List<String> address) {
         if (!s7PLC.checkConnected())
             return null;
+            
         return s7PLC.readInt16(address);
     }
 

--
Gitblit v1.8.0