ZengTao
2024-05-06 b454340c14d789c5fe41350d092ea2f14d6454b3
添加plc连接不上时报警,主界面后端推送数据超时提示
4个文件已修改
131 ■■■■■ 已修改文件
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 94 ●●●● 补丁 | 查看 | 原始文档 | 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,52 +161,56 @@
                // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
                // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
                // 铝框线交互
                if (S7controlLK.getinstance().CheckConnected() == true) {
                    // E02玻璃id
                    String E02id = S7controlLK.getinstance().readStrings("DB17.40");
                    // log.info("E02id"+E02id);
                    outSliceServive.FrameStateUpdate(E02id);
                    if (CurrentFrame.getBarCode() != null) {
                        S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
                    }
                    String J01id = S7controlLK.getinstance().readStrings("DB17.22");
                    List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
                    Short framerequest = liststate.get(0);
                    // log.info("liststate:" + liststate);
                    if (framerequest == 1) {
                        // 铝框id
                        String position;
                        try {
                            position = dbserve.SelectPositionByFrameBarcode(J01id);
                        } catch (SQLException e) {
                            // TODO Auto-generated catch block
                            position = "0";
                            e.printStackTrace();
                        }
                        Short send;
                        if (position.equals("0")) {
                            send = 2;
                        } else {
                            send = 1;
                        }
                        if (J01id != null) {
                            int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
                            if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
                                spianMapper.DeleteQueue(J01id);
                                // log.info("deleteoutslice:" + J01id);
                            }
                        }
                        S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                    }
                    String E01id = S7controlLK.getinstance().readStrings("DB17.0");
                    // 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) {
                    // 铝框线交互
                    if (S7controlLK.getinstance().CheckConnected() == true) {
                        // E02玻璃id
                        String E02id = S7controlLK.getinstance().readStrings("DB17.40");
                        // log.info("E02id"+E02id);
                        outSliceServive.FrameStateUpdate(E02id);
                        if (CurrentFrame.getBarCode() != null) {
                            S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
                        }
                        String J01id = S7controlLK.getinstance().readStrings("DB17.22");
                        List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
                        Short framerequest = liststate.get(0);
                        // log.info("liststate:" + liststate);
                        if (framerequest == 1) {
                            // 铝框id
                            String position;
                            try {
                                position = dbserve.SelectPositionByFrameBarcode(J01id);
                            } catch (SQLException e) {
                                // TODO Auto-generated catch block
                                position = "0";
                                e.printStackTrace();
                            }
                            Short send;
                            if (position.equals("0")) {
                                send = 2;
                            } else {
                                send = 1;
                            }
                            if (J01id != null) {
                                int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
                                if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
                                    spianMapper.DeleteQueue(J01id);
                                    // log.info("deleteoutslice:" + J01id);
                                }
                            }
                            S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                        }
                        String E01id = S7controlLK.getinstance().readStrings("DB17.0");
                        // log.info("frameno:" + E01id);
                        List<Short> liststates = S7controlLK.getinstance().ReadWord("DB17.38", 1);
                        // log.info("frameflip:" + liststates);
                    }
                    // 获取当前扫码方式
                    List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
@@ -360,6 +364,8 @@
                            }
                        }
                    }
                }else{
                    jsonObject.append("Plc1", false);
                }
                jsonObject.append("zhi", zhi);