ZengTao
2024-05-06 b454340c14d789c5fe41350d092ea2f14d6454b3
添加plc连接不上时报警,主界面后端推送数据超时提示
4个文件已修改
47 ■■■■ 已修改文件
CanadaMes-ui/src/lang/locales/en-US.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json
@@ -1,6 +1,9 @@
{
  "Clear":"Clear",
  "ip":"localhost",
  "Mes Connection failed":"Mes Connection failed",
  "Plc1 Connection failed":"Plc1 Connection failed",
  "Plc2 Connection failed":"Plc2 Connection failed",
  "Remaining width:":"Remaining width:",
  "systemTitle": "Login System",
  "usernamePlaceholder": "Please enter username",
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -1,6 +1,9 @@
{
  "Clear":"清除",
  "ip":"localhost",
  "Mes Connection failed":"Mes连接失败",
  "Plc1 Connection failed":"Plc1连接失败",
  "Plc2 Connection failed":"Plc2连接失败",
  "Remaining width:":"剩余宽度:",
  "systemTitle": "登录系统",
  "usernamePlaceholder": "请输入用户名",
CanadaMes-ui/src/views/home/index.vue
@@ -235,6 +235,7 @@
    height: 15px;
    position: absolute;
}
</style>
<template>
    <el-container>
@@ -243,7 +244,7 @@
            <div class="box" @click="dialogFormVisible2 = true">
                <div class="text">
                    <!-- Alarm: -->
                    {{ this.text }}
                    {{ this.text }}{{this.plc1}}{{this.plc2}}
                    <label v-for="item in this.alarm" :key="item['id']">
                        {{ item['content'] }}
                    </label>
@@ -1013,20 +1014,22 @@
            count2: 1,
            loadname: "",
            form6state:0,
            StateColor:"green"
            StateColor:"green",
            plc1:"",
            plc2:""
        };
    },
    created() {
        this.load();
        // setInterval(() => {
        //     if(this.count1<this.count2){
        //         this.count1=this.count2;
        //     }else{
        //         const now = new Date();
        //         console.log(now);
        //         alert("websocket停止"+now);
        //     }
        // }, 3000);
        setInterval(() => {
            if(this.count1<this.count2){
                this.count1=this.count2;
            }else{
                const now = new Date();
                console.log(this.count1,this.count2);
                alert(this.$t('Mes Connection failed')+now);
            }
        }, 30000);
    },
    activated() {
        this.init();
@@ -1063,6 +1066,12 @@
                        // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                        // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                    }
                    if (obj.Plc1 != null) {
                        this.plc1=this.$t('Plc1 Connection failed');
                    }
                    if (obj.Plc2 != null) {
                        this.plc2=this.$t('Plc2 Connection failed');
                    }
                    this.tableData = obj.tableData[0];
                    this.cagelist1 = obj.cagelist1[0];
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -161,8 +161,6 @@
                // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
                // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
                if (S7control.getinstance().CheckConnected() == true) {
                    // 铝框线交互
                    if (S7controlLK.getinstance().CheckConnected() == true) {
                        // E02玻璃id
@@ -206,7 +204,13 @@
                        // log.info("frameno:" + E01id);
                        List<Short> liststates = S7controlLK.getinstance().ReadWord("DB17.38", 1);
                        // log.info("frameflip:" + liststates);
                }else{
                    jsonObject.append("Plc2", false);
                    }
                if (S7control.getinstance().CheckConnected() == true) {
                    // 获取当前扫码方式
                    List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
@@ -360,6 +364,8 @@
                            }
                        }
                    }
                }else{
                    jsonObject.append("Plc1", false);
                }
                jsonObject.append("zhi", zhi);