Merge branch 'master' of http://10.153.19.150:10101/r/CanadaMes
# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
| | |
| | | "Sign": "Sign",
|
| | | "State": "State",
|
| | | "Alarm": "Alarm",
|
| | | "Distribute": "Distribute"
|
| | | "Distribute": "Distribute",
|
| | | "Search": "Search"
|
| | | } |
| | |
| | | "exit": "退出",
|
| | | "changePassword": "修改密码",
|
| | | "resetPassword": "重置密码",
|
| | |
|
| | | "home": "主页",
|
| | | "role": "角色",
|
| | | "langRoleManagement": "角色管理",
|
| | |
| | | "Sign": "IO状态",
|
| | | "State": "State",
|
| | | "Alarm": "报警信息",
|
| | | "Distribute": "下发"
|
| | | }
|
| | |
|
| | | "Distribute": "下发",
|
| | | "Search": "搜索"
|
| | | } |
New file |
| | |
| | | <template> |
| | | <div class="app"> |
| | | <!--面包屑导航区域--> |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link> |
| | | <el-button type="text">Electrical</el-button> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link> |
| | | </el-breadcrumb> |
| | | <div>Action</div> |
| | | <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }"> |
| | | <!-- <div class="kuai_div" v-for="item in record.xyData" :key="item.value"> |
| | | <el-input v-model="item.name" style="width: 240px;" class="in_mc"></el-input> |
| | | <el-switch v-model="item.value" active-value="0" inactive-value="1"></el-switch> |
| | | </div> --> |
| | | |
| | | <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index"> |
| | | <el-input v-model="item.name" style="width: 240px;" class="in_mc" readonly></el-input> |
| | | <el-switch v-model="item.value" active-value="1" inactive-value="0" @change="send()"></el-switch> |
| | | </div> |
| | | </el-form> |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script > |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | let socket; |
| | | export default { |
| | | name: "action", |
| | | mixins: [LanguageMixin], |
| | | data () { |
| | | return { |
| | | record: { |
| | | params: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], |
| | | canshu: [ |
| | | 'D01 VFD conveyor', |
| | | 'D02 VFD conveyor', |
| | | 'D03 VFD conveyor', |
| | | 'D04 VFD conveyor', |
| | | 'D05 VFD conveyor', |
| | | 'D06 VFD conveyor', |
| | | 'A01 VFD conveyor', |
| | | 'A02 VFD conveyor', |
| | | 'B01 VFD conveyor', |
| | | 'B02 VFD conveyor', |
| | | 'A01 SERVE TURN JOG+', |
| | | 'A02 SERVE TURN JOG-', |
| | | 'A01 SERVE TRAVEL JOG+', |
| | | 'A02 SERVE TRAVEL JOG-', |
| | | 'B01 SERVE TRAVEL JOG+', |
| | | 'B02 SERVE TRAVEL JOG-', |
| | | 'A01 SERVE TURN POS', |
| | | 'A02 SERVE TURN POS', |
| | | 'A01 SERVE TRAVEL POS', |
| | | 'A02 SERVE TRAVEL POS', |
| | | 'B01 SERVE TRAVEL POS', |
| | | 'B02 SERVE TRAVEL POS', |
| | | 'B01 YV TURN', |
| | | 'B01 YV UP DOWN', |
| | | 'B02 YV TURN', |
| | | 'B02 YV UP DOWN', |
| | | ], |
| | | xyData: [ |
| | | { name: 'D01 VFD conveyor', value: "0" }, |
| | | { name: 'D02 VFD conveyor', value: "0" }, |
| | | { name: 'D03 VFD conveyor', value: "1" }, |
| | | { name: 'D04 VFD conveyor', value: "0" }, |
| | | { name: 'D05 VFD conveyor', value: "0" }, |
| | | { name: 'D06 VFD conveyor', value: "0" }, |
| | | { name: 'A01 VFD conveyor', value: "0" }, |
| | | { name: 'A02 VFD conveyor', value: "0" }, |
| | | { name: 'B01 VFD conveyor', value: "0" }, |
| | | { name: 'B02 VFD conveyor', value: "0" }, |
| | | { name: 'A01 SERVE TURN JOG+', value: "0" }, |
| | | { name: 'A02 SERVE TURN JOG-', value: "0" }, |
| | | { name: 'A01 SERVE TRAVEL JOG+', value: "0" }, |
| | | { name: 'A02 SERVE TRAVEL JOG-', value: "0" }, |
| | | { name: 'B01 SERVE TRAVEL JOG+', value: "0" }, |
| | | { name: 'B02 SERVE TRAVEL JOG-', value: "0" }, |
| | | { name: 'A01 SERVE TURN POS', value: "0" }, |
| | | { name: 'A02 SERVE TURN POS', value: "0" }, |
| | | { name: 'A01 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'A02 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B01 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B02 SERVE TRAVEL POS', value: "0" }, |
| | | { name: 'B01 YV TURN', value: "0" }, |
| | | { name: 'B01 YV UP DOWN', value: "0" }, |
| | | { name: 'B02 YV TURN', value: "0" }, |
| | | { name: 'B02 YV UP DOWN', value: "0" }, |
| | | ] |
| | | , |
| | | }, |
| | | |
| | | |
| | | messagepack: { |
| | | data: { taskname: "" } |
| | | }, |
| | | queryInfo: { |
| | | data: "1", |
| | | pageSize: 10 |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | created () { |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | | init () { |
| | | let viewname = "action"; |
| | | |
| | | if (typeof (WebSocket) == "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | //console.log("您的浏览器支持WebSocket"); |
| | | |
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname; |
| | | if (socket != null) { |
| | | socket.close(); |
| | | socket = null; |
| | | } |
| | | // 开启一个websocket服务 |
| | | socket = new WebSocket(socketUrl); |
| | | //打开事件 |
| | | socket.onopen = function () { |
| | | console.log("websocket已打开"); |
| | | }; |
| | | // 浏览器端收消息,获得从服务端发送过来的文本消息 |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | this.record.params[0] = obj.params[0]; |
| | | |
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) { |
| | | if (!this.record.xyData[a]) { |
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a].toString() }; |
| | | } else { |
| | | this.record.xyData[a].value = this.record.params[0][a].toString(); |
| | | } |
| | | } |
| | | |
| | | // console.log(this.record.xyData); |
| | | this.$forceUpdate(); |
| | | }; |
| | | |
| | | //关闭事件 |
| | | socket.onclose = function () { |
| | | console.log("websocket已关闭"); |
| | | }; |
| | | //发生了错误事件 |
| | | socket.onerror = function () { |
| | | console.log("websocket发生了错误"); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | send () { |
| | | this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组 |
| | | //console.log(this.messagepack); |
| | | socket?.send(JSON.stringify(this.messagepack)); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | |
| | | <style> |
| | | .kuai_div { |
| | | /* width: 30%; */ |
| | | margin-bottom: 30px; |
| | | } |
| | | |
| | | .el-input { |
| | | border: none; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | .el-input__inner { |
| | | border: 1 solid black; |
| | | } |
| | | |
| | | .in_mc {} |
| | | |
| | | .el-input__inner { |
| | | border: none; |
| | | } |
| | | </style> |
| | |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | </el-breadcrumb>
|
| | | |
| | |
|
| | | <div>Parameter</div>
|
| | | |
| | |
|
| | | <el-form label-width="100px" style="display: flex; flex-wrap: wrap;" :model="messagepack.data">
|
| | | <div id="btn_div">
|
| | | <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">下发参数</el-button>
|
| | | |
| | | <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">下发参数</el-button>
|
| | |
|
| | | </div>
|
| | | <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
|
| | | <el-input style="width: 280px; border:none;" class="in_mc" v-model="item.name" readonly></el-input> |
| | | <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
|
| | | <span style="margin-right: 5px; font-size: 14px;">|</span>
|
| | | <input v-model="item.value2" type="number" style="width: 30px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
|
| | | </div>
|
| | | <el-input style="width: 280px; border:none;" class="in_mc" v-model="item.name" readonly></el-input>
|
| | | <span style="margin-right: 5px; width: 50px;">{{ item.value }}</span>
|
| | | <span style="margin-right: 5px; font-size: 14px;">|</span>
|
| | | <input v-model="item.value2" type="number"
|
| | | style="width: 30px; margin-right: 5px; margin-top: 5px; font-size: 16px;">
|
| | | </div>
|
| | | </el-form>
|
| | | </div>
|
| | | </template>
|
| | |
| | |
|
| | | export default {
|
| | | name: "Parameter",
|
| | | data() {
|
| | | data () {
|
| | | return {
|
| | | record: {
|
| | | params: [100, 200, 10, 10, 10, 10],
|
| | | xyData: [
|
| | | { name: "conveyor Velocity(Auto FAST)", value: 0, value2: 0 },
|
| | | { name: "conveyor Velocity(Auto SLOW)", value: 0, value2: 0 },
|
| | | { name: "conveyor Velocity(Manual)", value: 0 ,value2: 0 },
|
| | | { name: "conveyor Velocity(Manual)", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TURN JOG Velocity", value: 0, value2: 0 },
|
| | | { name: "A01 A02 TRAVEL JOG Velocity", value: 0, value2: 0 },
|
| | | { name: "B01 B02 TRAVEL JOG Velocity", value: 0, value2: 0 },
|
| | |
| | | }
|
| | | };
|
| | | },
|
| | | |
| | | |
| | | created() {
|
| | |
|
| | |
|
| | | created () {
|
| | | this.initWebSocket();
|
| | | this.isButtonDisabled = true;
|
| | | },
|
| | | methods: {
|
| | | initWebSocket() {
|
| | | initWebSocket () {
|
| | | let viewname = "Parameter";
|
| | | |
| | |
|
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | |
| | |
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | | socket = null;
|
| | | }
|
| | | |
| | |
|
| | | // 开启一个websocket服务
|
| | | socket = new WebSocket(socketUrl);
|
| | | |
| | |
|
| | | // 打开事件
|
| | | socket.onopen = function () {
|
| | | console.log("websocket已打开");
|
| | | };
|
| | | |
| | |
|
| | | // 收到消息
|
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | | if (!msg.data) {
|
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑
|
| | | }
|
| | |
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.params[0];
|
| | | this.record.state = obj.state[0];
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.params[0];
|
| | | this.record.state = obj.state[0];
|
| | |
|
| | | let isButtonDisabled = this.record.state.includes(1); |
| | | // 判断state中是否存在1
|
| | | console.log(isButtonDisabled)
|
| | | this.isButtonDisabled = isButtonDisabled; // 将判断结果保存到变量isButtonDisabled中
|
| | | let isButtonDisabled = this.record.state.includes(1);
|
| | | // 判断state中是否存在1
|
| | | //console.log(isButtonDisabled)
|
| | | this.isButtonDisabled = isButtonDisabled; // 将判断结果保存到变量isButtonDisabled中
|
| | |
|
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | | }
|
| | | for (let a = 0; a <= this.record.params[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | | }
|
| | |
|
| | | console.log(this.record.xyData);
|
| | | this.$forceUpdate();
|
| | | };
|
| | | |
| | | //console.log(this.record.xyData);
|
| | | this.$forceUpdate();
|
| | | };
|
| | |
|
| | | // 关闭事件
|
| | | socket.onclose = function () {
|
| | | console.log("websocket已关闭");
|
| | | };
|
| | | |
| | |
|
| | | // 发生错误事件
|
| | | socket.onerror = function () {
|
| | | console.log("websocket发生了错误");
|
| | | };
|
| | | }
|
| | | },
|
| | | send() {
|
| | | send () {
|
| | | this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value2)); // 转换为整数数组
|
| | | console.log(this.messagepack);
|
| | | //console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange(index, value) {
|
| | | handleChange (index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | }
|
| | | }
|
| | |
| | | .el-input__inner {
|
| | | border: 1px solid black;
|
| | | }
|
| | | .in_mc{
|
| | |
|
| | | border:none;
|
| | | .in_mc {
|
| | |
|
| | | border: none;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | #btn_div .el-button {
|
| | | float: right;
|
| | | }
|
| | | input[type="number"]::-webkit-inner-spin-button,
|
| | | input[type="number"]::-webkit-outer-spin-button {
|
| | | -webkit-appearance: none;
|
| | | margin: 0;
|
| | | }
|
| | |
|
| | | input[type="number"] {
|
| | | -moz-appearance: textfield; /* Firefox中禁用上下箭头 */
|
| | | }
|
| | | input[type="number"]::-webkit-inner-spin-button,
|
| | | input[type="number"]::-webkit-outer-spin-button {
|
| | | -webkit-appearance: none;
|
| | | margin: 0;
|
| | | }
|
| | |
|
| | | input[type="number"] {
|
| | | -moz-appearance: textfield;
|
| | | /* Firefox中禁用上下箭头 */
|
| | | }
|
| | | </style>
|
| | |
| | | <div>Sign</div>
|
| | | <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
|
| | | <div class="kuai_sb" v-for="item in record.xyData" :key="item.name">
|
| | | <el-col class="deng" :class="getStatusClass(item.value, item.name)">
|
| | | <!-- <el-input v-model="item.value" style="width: 280px;" class="in_mc"></el-input> -->
|
| | | <el-col class="deng" :class="getStatusClass(item.value)">
|
| | | </el-col>
|
| | | <el-input v-model="item.name" style="width: 280px;" class="in_mc"></el-input>
|
| | |
|
| | |
| | | data () {
|
| | | return {
|
| | | record: {
|
| | | //定义数组,并添加默认值
|
| | | params: [1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,],
|
| | | xyData: [
|
| | |
| | | this.init();
|
| | | },
|
| | | methods: {
|
| | | getStatusClass (zhuangtai, mc) {
|
| | |
|
| | |
|
| | | if (mc === "LED.green" && zhuangtai === 0) {
|
| | | return "green";
|
| | | }
|
| | | if (mc === "LED.red" && zhuangtai === 0) {
|
| | | return "red";
|
| | | }
|
| | | if (mc === "LED.yellow" && zhuangtai === 0) {
|
| | | return "yellow"
|
| | | }
|
| | | //根据读取PLC的值,根据名称改变颜色
|
| | | getStatusClass (zhuangtai) {
|
| | | // if (mc === "LED.green" && zhuangtai === 0) {
|
| | | // return "green";
|
| | | // }
|
| | | // if (mc === "LED.red" && zhuangtai === 0) {
|
| | | // return "red";
|
| | | // }
|
| | | // if (mc === "LED.yellow" && zhuangtai === 0) {
|
| | | // return "yellow"
|
| | | // }
|
| | |
|
| | |
|
| | | if (zhuangtai === 0) {
|
| | |
| | | padding: 0;
|
| | | }
|
| | |
|
| | | /* .neir {
|
| | | .app {
|
| | | height: 100%;
|
| | | }
|
| | |
|
| | | .neir {
|
| | | /* height: 580px; */
|
| | | height: 90%;
|
| | | overflow-y: auto;
|
| | | } */
|
| | | }
|
| | |
|
| | | .el-input__inner {
|
| | | text-align: center;
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.sta[0];
|
| | | //将读取到的PLC的数据,与定义的xyData,组合成新的数组
|
| | | for (let a = 0; a <= this.record.xyData[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | |
| | | console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange (index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | <el-date-picker v-model="shijian2" type="datetime" placeholder="选择日期时间" align="right" |
| | | :picker-options="pickerOptions"> |
| | | </el-date-picker> |
| | | <el-button type="primary" @click="selectTime()">查询</el-button> |
| | | |
| | | <el-button type="primary" @click="selectTime()">{{ $t('Search') }}</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="550"> |
| | |
| | | |
| | | |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | //查询当天报警信息 |
| | | this.load(); |
| | | } |
| | | else { |
| | | //根据时间查询报警信息 |
| | | this.selectTime(); |
| | | } |
| | | |
| | |
| | | |
| | | }, |
| | | selectTime () { |
| | | //moment需要单独安转依赖,npm install moment |
| | | let sj1 = moment(this.shijian1).format('YYYY-MM-DD%20HH:mm'); |
| | | let sj2 = moment(this.shijian2).format('YYYY-MM-DD%20HH:mm') |
| | | |
| | | //调用setTime方法给roles赋值 |
| | | setTime(sj1, sj2).then(res => { |
| | | this.roles = res.data.list; |
| | | //table中的内容进行语言转换 |
| | | const language = this.$i18n.locale; |
| | | if (language === 'zh-CN') { |
| | | this.replaceChineseWithEnglish(); |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //语言转换 |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('translation'); |
| | | this.localizedRoles = this.roles.map(role => ({ |
| | |
| | | }; |
| | | // 浏览器端收消息,获得从服务端发送过来的文本消息 |
| | | socket.onmessage = function (msg) { |
| | | |
| | | //console.log("收到数据====" + msg.data); |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | this.record.params[0] = obj.arm; |
| | |
| | | } |
| | | |
| | | }, |
| | | send () { |
| | | this.messagepack.data = { taskname: "前端到后台" }; |
| | | socket?.send(JSON.stringify(this.messagepack)); // 将组装好的json发送给服务端,由服务端进行转发 |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | }
|
| | |
|
| | | .gezi {
|
| | | height: 25px;
|
| | | width: 3.25px;
|
| | | height: 35px;
|
| | | width: 4.22px;
|
| | | }
|
| | |
|
| | | .gezi:nth-child(22),
|
| | | .gezi:nth-child(43),
|
| | | .gezi:nth-child(64),
|
| | | .gezi:nth-child(85) {
|
| | | margin-left: 7.7px;
|
| | | margin-left: 10px;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | .blocks {
|
| | | min-height: 49vh;
|
| | | min-height: 55vh;
|
| | | max-width: 100vw;
|
| | | background-image: url('../../img/xmjc.png');
|
| | | margin: 0 auto;
|
| | | background-repeat: no-repeat;
|
| | | /* background-size: 100% 100%; */
|
| | | background-size: 1280px 377px;
|
| | | background-size: 1660px 560px;
|
| | | background-attachment: local;
|
| | | width: 1280px;
|
| | | width: 1660px;
|
| | | }
|
| | |
|
| | | .blocks-img {
|
| | | height: 100px;
|
| | | max-width: 100vw;
|
| | | background-repeat: no-repeat;
|
| | | background-size: 32px 66px;
|
| | | background-size: 46px 94px;
|
| | | background-attachment: local;
|
| | | width: 32px;
|
| | |
|
| | |
| | | <el-container>
|
| | | <!-- <el-header style="padding: 10px;"></el-header> -->
|
| | | <el-main>
|
| | | <div class="box">
|
| | | <div class="box" @click="dialogFormVisible2 = true">
|
| | | <div class="text">
|
| | | Alarm:
|
| | | <label v-for="item in this.alarm" :key="item['id']">
|
| | |
| | | <el-table-column prop="glassId" label="Coming out glass ID"></el-table-column>
|
| | | <el-table-column :width="250" prop="cell" label="The Grille number being used"></el-table-column>
|
| | | <el-table-column prop="orderId" label="Order Nmuber"></el-table-column>
|
| | | <el-table-column prop="lengthwidth" label="Length and width"></el-table-column>
|
| | | <el-table-column prop="lengthWidth" label="Length and width"></el-table-column>
|
| | | <el-table-column prop="coating" label="coating"></el-table-column>
|
| | | <el-table-column label="Operate">
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" @click="endtask(0)">end
|
| | |
| | | <el-table-column prop="glassId" label="Incoming glass ID"></el-table-column>
|
| | | <el-table-column :width="250" prop="cell" label="The Grille number being used"></el-table-column>
|
| | | <el-table-column prop="orderId" label="Order Nmuber"></el-table-column>
|
| | | <el-table-column prop="lengthwidth" label="Length and width"></el-table-column>
|
| | | <el-table-column prop="lengthWidth" label="Length and width"></el-table-column>
|
| | | <el-table-column prop="coating" label="coating"></el-table-column>
|
| | | <el-table-column label="Operate">
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" @click="endtask(1)">end
|
| | |
| | | </el-main>
|
| | | <el-footer>
|
| | | <div class="blocks" style="position: relative;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:76px;left:253px;">
|
| | | <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']"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:76px;left:682.5px;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:112px;left:885px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist2" :key="item['date']"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:253px;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:328px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist3" :key="item['date']"></div>
|
| | | </div>
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:102px;left:682.5px;">
|
| | | <div style="display:flex;position: absolute;float:left;z-index: 999;top:154px;left:885px;">
|
| | | <div :class="getStatusClass(item.state)" v-for="item in cagelist4" :key="item['date']"></div>
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '10px' }">
|
| | | <div class="blocks-img" :style="{ left: car1 + 'px', top: '16px' }">
|
| | |
|
| | | </div>
|
| | | <div class="blocks-img" :style="{ left: car2 + 'px', top: '129px' }">
|
| | | <div class="blocks-img" :style="{ left: car2 + 'px', top: '194px' }">
|
| | |
|
| | | </div>
|
| | | </div>
|
| | |
| | | </span>
|
| | | </template>
|
| | | </el-dialog>
|
| | | <el-dialog :visible.sync="dialogFormVisible2" title="Ordering Information">
|
| | | <el-table :data="this.alarm" border style="width: 100%;">
|
| | | <el-table-column prop="id" label="id"></el-table-column>
|
| | | <el-table-column prop="content" label="content"></el-table-column>
|
| | | <el-table-column prop="timeons" label="timeon"></el-table-column>
|
| | |
|
| | | <el-table-column prop="endTime" label="endTime"></el-table-column>
|
| | | </el-table>
|
| | | </el-dialog>
|
| | | </el-container>
|
| | | </template>
|
| | |
|
| | |
| | |
|
| | | import { home, home2, loadtask, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo } from "../../api/home";
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | | export default {
|
| | | name: "Home",
|
| | | data() {
|
| | | return {
|
| | | mixins: [LanguageMixin],
|
| | | dialogFormVisible: false,
|
| | | dialogFormVisible1: false,
|
| | | dialogFormVisible2: false,
|
| | | form: {
|
| | | orderno: "NG2210210",
|
| | | length: 800,
|
| | |
| | | order: "",
|
| | | glassid: "",
|
| | | url: "../../img/bigcar01.png",
|
| | | car1: 116,
|
| | | car2: 187,
|
| | | car1: 150,
|
| | | car2: 242,
|
| | | incell: "",
|
| | | outcell: ""
|
| | | };
|
| | |
| | | console.log("您的浏览器不支持WebSocket");
|
| | | } else {
|
| | | //console.log("您的浏览器支持WebSocket");
|
| | |
|
| | | let socketUrl = "ws://" + "localhost:8888" + "/springboot-vue3/api/talk/" + viewname;
|
| | | if (socket != null) {
|
| | | socket.close();
|
| | |
| | |
|
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | //this.$set(this.record.params, 0, obj.params[0]);
|
| | |
|
| | | this.car1 = 116 + 18.88 * obj.params[0][0];
|
| | | this.car2 = 187 + 18.8 * 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];
|
| | | this.cagelist2 = obj.cagelist2[0];
|
| | |
| | | //根据格子状态修改颜色
|
| | | getStatusClass(state) {
|
| | | if (state == 0) {
|
| | | return "green gezi";
|
| | | return "gezi";
|
| | | } else if (state == 1) {
|
| | | return "blue gezi";
|
| | | } else if (state == 2) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | },
|
| | | formatDate(timestamp) {
|
| | | const date = new Date(timestamp);
|
| | | const year = date.getFullYear();
|
| | | const month = date.getMonth() + 1;
|
| | | const day = date.getDate();
|
| | | const hours = date.getHours();
|
| | | const minutes = date.getMinutes();
|
| | | const seconds = date.getSeconds();
|
| | | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <el-row :gutter="20"> |
| | | <!--搜索与添加区域--> |
| | | <el-col :span="6"> |
| | | <el-input :placeholder= "$t('langUsernamePlaceholder')" v-model="queryInfo.username" clearable @clear="getUserList"> |
| | | <el-input :placeholder="$t('langUsernamePlaceholder')" v-model="queryInfo.username" clearable |
| | | @clear="getUserList"> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-input :placeholder="$t('langEmailPlaceholder')" v-model="queryInfo.email" clearable @clear="getUserList"> |
| | | <el-input :placeholder="$t('langEmailPlaceholder')" v-model="queryInfo.email" clearable @clear="getUserList"> |
| | | </el-input> |
| | | </el-col> |
| | | <!--搜索按钮--> |
| | |
| | | <el-table-column :label="$t('langCreateTime')" prop="createTime"></el-table-column> |
| | | <el-table-column :label="$t('langDisabled')"> |
| | | <template slot-scope="scope"> |
| | | <el-switch |
| | | :active-value="0" |
| | | :inactive-value="1" |
| | | v-model="scope.row.state" |
| | | @change="stateChange(scope.row)"> |
| | | <el-switch :active-value="0" :inactive-value="1" v-model="scope.row.state" @change="stateChange(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" icon="el-icon-refresh" @click="resetPassword(scope.row)"> |
| | | |
| | | {{ $t('resetPassword') }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" icon="el-icon-refresh" @click="resetPassword(scope.row)"> |
| | | |
| | | {{ $t('resetPassword') }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :label="$t('langAction')"> |
| | | <template slot-scope="scope"> |
| | | <!--修改--> |
| | | <el-tooltip effect="dark" :content="$t('langEdit')" placement="top" :enterable="false"> |
| | | <el-button type="primary" icon="el-icon-edit" size="mini" |
| | | @click="showEditDialog(scope.row.id)"></el-button> |
| | | <el-button type="primary" icon="el-icon-edit" size="mini" @click="showEditDialog(scope.row.id)"></el-button> |
| | | </el-tooltip> |
| | | <!--删除--> |
| | | <el-tooltip effect="dark" :content="$t('langDelete')" placement="top" :enterable="false"> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" |
| | | @click="removeUserById(scope.row)"></el-button> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" @click="removeUserById(scope.row)"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页区域--> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageNum" |
| | | :page-sizes="[6, 12, 18, 24]" |
| | | :page-size="queryInfo.pageSize" |
| | | :total="userList.total" |
| | | |
| | | :pager-count="7" |
| | | :layout="layout" |
| | | > |
| | | </el-pagination> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageNum" :page-sizes="[6, 12, 18, 24]" :page-size="queryInfo.pageSize" |
| | | :total="userList.total" :pager-count="7" :layout="layout"> |
| | | </el-pagination> |
| | | </el-card> |
| | | <!--添加用户的对话框--> |
| | | <el-dialog |
| | | :title="$t('langAddUserTitle')" |
| | | :visible.sync="addDialogVisible" |
| | | width="50%" |
| | | @close="addDialogClosed"> |
| | | <el-dialog :title="$t('langAddUserTitle')" :visible.sync="addDialogVisible" width="50%" @close="addDialogClosed"> |
| | | <!--内容主体区域--> |
| | | <el-form :model="addUserForm" :rules="addUserRules" ref="addUserRef" label-width="100px"> |
| | | <el-form-item :label="$t('langUsername')" prop="username" > |
| | | <el-input v-model="addUserForm.username" ></el-input> |
| | | <el-form-item :label="$t('langUsername')" prop="username"> |
| | | <el-input v-model="addUserForm.username"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langPassword')" prop="password" > |
| | | <el-form-item :label="$t('langPassword')" prop="password"> |
| | | <el-input v-model="addUserForm.password" type="password"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langEmail')" prop="email"> |
| | | <el-input v-model="addUserForm.email"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | |
| | | <el-form-item :label="$t('langState')" prop="state"> |
| | | <el-select v-model="addUserForm.state" > |
| | | <el-option v-for="(item,index) in options" |
| | | :key="index" |
| | | :value="item.value" |
| | | :label="item.label"> |
| | | <el-select v-model="addUserForm.state"> |
| | | <el-option v-for="(item, index) in options" :key="index" :value="item.value" :label="item.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item :label="$t('role')" prop="roleId"> |
| | | <el-select filterable v-model="addUserForm.roleId" :placeholder="$t('langSelect')" > |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.name"> |
| | | <el-select filterable v-model="addUserForm.roleId" :placeholder="$t('langSelect')"> |
| | | <el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.name"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <!--修改用户的对话框--> |
| | | <el-dialog |
| | | :title="$t('langEditUserTitle')" |
| | | :visible.sync="editDialogVisible" |
| | | width="50%"> |
| | | <el-dialog :title="$t('langEditUserTitle')" :visible.sync="editDialogVisible" width="50%"> |
| | | <!--内容主体区域--> |
| | | <el-form :model="editUserForm" :rules="addUserRules" ref="addCategoryRef" label-width="100px"> |
| | | <el-form-item :label="$t('langUsername')" prop="username"> |
| | | <el-input v-model="editUserForm.username" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('role')" prop="roleId"> |
| | | <el-select filterable v-model="editUserForm.roleId" :placeholder="$t('langSelect')" > |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.name"> |
| | | <el-select filterable v-model="editUserForm.roleId" :placeholder="$t('langSelect')"> |
| | | <el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.name"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-input v-model="editUserForm.email"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langDisabled')" prop="state"> |
| | | <el-select v-model="editUserForm.state" > |
| | | <el-option v-for="(item,index) in options" |
| | | :key="index" |
| | | :value="item.value" |
| | | :label="item.label"> |
| | | <el-select v-model="editUserForm.state"> |
| | | <el-option v-for="(item, index) in options" :key="index" :value="item.value" :label="item.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | |
| | | |
| | | <script> |
| | | import {getById, removeById, saveOrUpdate, selectPage,resetPass} from "../../api/user"; |
| | | import {select} from "../../api/role"; |
| | | import { getById, removeById, saveOrUpdate, selectPage, resetPass } from "../../api/user"; |
| | | import { select } from "../../api/role"; |
| | | |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | export default { |
| | | name: "User", |
| | | mixins: [LanguageMixin], |
| | | |
| | | data() { |
| | | data () { |
| | | return { |
| | | layout: 'total, sizes, prev, pager, next, jumper', |
| | | queryInfo: { |
| | |
| | | editUserForm: { |
| | | |
| | | roleId: null, |
| | | name:null, |
| | | roleid:null, |
| | | name: null, |
| | | roleid: null, |
| | | }, |
| | | // 添加分类的验证规则 |
| | | addUserRules: { |
| | | roleId: null, |
| | | username: [ |
| | | {required: true, message: '请输入用户名', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | { required: true, message: '请输入用户名', trigger: 'blur' }, |
| | | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } |
| | | ], |
| | | password: [ |
| | | {required: true, message: '请输入密码', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | { required: true, message: '请输入密码', trigger: 'blur' }, |
| | | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } |
| | | ], |
| | | email: [ |
| | | {required: true, message: '请输入邮箱', trigger: 'blur'}, |
| | | {type: 'email', message: '请输入正确格式的邮箱地址', trigger: 'blur'} |
| | | { required: true, message: '请输入邮箱', trigger: 'blur' }, |
| | | { type: 'email', message: '请输入正确格式的邮箱地址', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 控制添加用户弹框的显示和隐藏 |
| | |
| | | // 控制修改用户弹框的显示和隐藏 |
| | | editDialogVisible: false, |
| | | options: [ |
| | | {label: '正常', value: 1}, |
| | | {label: '禁用', value: 0} |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 } |
| | | ], |
| | | roleList: [], |
| | | } |
| | | }, |
| | | created() { |
| | | created () { |
| | | this.getUserList(); |
| | | }, |
| | | methods: { |
| | | getUserList() { |
| | | getUserList () { |
| | | selectPage(this.queryInfo).then(res => { |
| | | this.userList.records = res.data.records; |
| | | this.userList.total = res.data.total |
| | | }); |
| | | |
| | | // test().then(res => { |
| | | // console.log(res.data) |
| | | // }); |
| | | // const data6 = [ |
| | | // { id: 32, deviceName: 'Device 7', address: 'Address 1' }, |
| | | // { id: 33, deviceName: 'Device 8', address: 'Address 2' }, |
| | | |
| | | // ]; |
| | | // test().then(res => { |
| | | // console.log(res.data) |
| | | // }); |
| | | // const data6 = [ |
| | | // { id: 32, deviceName: 'Device 7', address: 'Address 1' }, |
| | | // { id: 33, deviceName: 'Device 8', address: 'Address 2' }, |
| | | |
| | | // testup(data6).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | // call({ |
| | | // id: 1, |
| | | // name: 12345 |
| | | // }).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | // ]; |
| | | |
| | | // testup(data6).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | // call({ |
| | | // id: 1, |
| | | // name: 12345 |
| | | // }).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | }, |
| | | |
| | | showAddDialog() { |
| | | |
| | | showAddDialog () { |
| | | this.addDialogVisible = true; |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | }, |
| | | // stateChange(info) { |
| | | // saveOrUpdate(info).then(() => { |
| | | // this.$message.success("更新状态成功") |
| | | // }); |
| | | // }, |
| | | stateChange(info) { |
| | | saveOrUpdate(info).then(() => { |
| | | const successMessage = this.$t('updateSuccessMessage'); |
| | | this.$message.success(successMessage); |
| | | }); |
| | | }, |
| | | resetPassword(info) { |
| | | this.$confirm('确认重置密码为默认值吗?', '重置密码', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | resetPass(info).then(() => { |
| | | this.$message.success('密码已重置为默认值'); |
| | | stateChange (info) { |
| | | saveOrUpdate(info).then(() => { |
| | | const successMessage = this.$t('updateSuccessMessage'); |
| | | this.$message.success(successMessage); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | // 用户取消重置密码操作 |
| | | }); |
| | | }, |
| | | showEditDialog(id) { |
| | | getById({id: id}).then(res => { |
| | | }, |
| | | resetPassword (info) { |
| | | this.$confirm('确认重置密码为默认值吗?', '重置密码', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | resetPass(info).then(() => { |
| | | this.$message.success('密码已重置为默认值'); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | // 用户取消重置密码操作 |
| | | }); |
| | | }, |
| | | showEditDialog (id) { |
| | | getById({ id: id }).then(res => { |
| | | this.editUserForm = res.data; |
| | | this.editDialogVisible = true; |
| | | }); |
| | | |
| | | |
| | | |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | this.roleList = res.data; |
| | | }); |
| | | }, |
| | | removeUserById(user) { |
| | | removeUserById (user) { |
| | | // 弹框询问用户是否删除分类 |
| | | this.$confirm('此操作将永久删除该分类, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | removeById({id: user.id}).then(() => { |
| | | removeById({ id: user.id }).then(() => { |
| | | // 重新获取分类列表 |
| | | this.getUserList(); |
| | | this.$message.success("删除用户成功"); |
| | |
| | | this.$message.info('已取消删除'); |
| | | }); |
| | | }, |
| | | handleSizeChange(newSize) { |
| | | handleSizeChange (newSize) { |
| | | this.queryInfo.pageSize = newSize; |
| | | this.getUserList() |
| | | }, |
| | | handleCurrentChange(newPage) { |
| | | handleCurrentChange (newPage) { |
| | | this.queryInfo.pageNum = newPage; |
| | | this.getUserList() |
| | | }, |
| | | addDialogClosed() { |
| | | addDialogClosed () { |
| | | this.$refs['addUserRef'].resetFields(); |
| | | }, |
| | | addUser() { |
| | | addUser () { |
| | | this.$refs.addUserRef.validate(async valid => { |
| | | if (!valid) return; |
| | | saveOrUpdate(this.addUserForm).then(() => { |
| | |
| | | }); |
| | | }) |
| | | }, |
| | | editUserInfo() { |
| | | editUserInfo () { |
| | | this.$refs.addCategoryRef.validate(async valid => { |
| | | if (!valid) return; |
| | | |
| | | |
| | | saveOrUpdate(this.editUserForm).then(() => { |
| | | const 修改用户成功 = this.$t('修改用户成功'); |
| | | this.$message.success(修改用户成功); |
| | |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | // 将读取到的plclist转为数组 |
| | | Short[] shuzu1 = plclist.toArray(new Short[0]); |
| | | // Short[] shuzu1 = { |
| | | // 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | |
| | | }; |
| | | alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); |
| | | for (short i = 0; i < shuzu1.length; i++) { |
| | | // 查询结束时间为null的个数 |
| | | short result = alarmMapper.selectnullti(shuzu[i]); |
| | | // 读取PLC对应地址的值为1并且该地址没有结束时间为null的数据,添加一条新的报警信息 |
| | | if (shuzu1[i] == 1 && result == 0) { |
| | | // alarmMapper.Insertalarm(shuzu[i]); |
| | | } else if (shuzu1[i] == 0 && result > 0) { |
| | | alarmMapper.Insertalarm(shuzu[i]); |
| | | } |
| | | // 读取PLC对应地址的值为0并且该地址有结束时间为null的数据,修改该条数据的结束时间 |
| | | else if (shuzu1[i] == 0 && result > 0) { |
| | | alarmMapper.updatealarm(shuzu[i]); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | //注入mapper |
| | | homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | // 笼子使用情况 |
| | | List<StorageCage> tableData = homeMapper.selectAll(); |
| | |
| | | //查询报警信息 |
| | | List<alarmmg> alarmmg=homeMapper.SelectAlarmmgInfo(); |
| | | jsonObject.append("alarmmg", alarmmg); |
| | | //读去Plc进片车与出片车位置 |
| | | // List<String> addressList = new ArrayList<>(); |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | // jsonObject.append("params", paramlist); |
| | | |
| | | jsonObject.append("params", new short[] { 30, 40, }); |
| | | //读去Plc进片车与出片车位置W |
| | | List<String> addressList = new ArrayList<String>(); |
| | | addressList.add("DB100.DBW0"); |
| | | addressList.add("DB100.DBW12"); |
| | | List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | //将集合转为数组 |
| | | Short[] paramlists = paramlist.toArray(new Short[0]); |
| | | jsonObject.append("params", paramlists); |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | |
| | | if (sendwServer != null) { |
| | |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | new PlcHold().start(); |
| | | // new PlcHold().start(); |
| | | new Plcaction().start(); |
| | | new PlcParameter().start(); |
| | | |
| | |
| | | |
| | | @GetMapping("/stTime") |
| | | public Result selecttime(String shijian1, String shijian2) { |
| | | System.out.println("++++++"); |
| | | System.out.println(shijian1); |
| | | |
| | | if (shijian1 != "" || shijian2 != "") { |
| | | String sj1 = shijian1.replace("#20", " "); |
| | | String sj2 = shijian2.replace("#20", " "); |
| | | List<alarmmg> storageCagelist = alarmMapper.selecttime(sj1, sj2); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } else { |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | // if (shijian1 != "" || shijian2 != "") { |
| | | // 将get方法传过来的参数中"#20"替换为" " |
| | | String sj1 = shijian1.replace("#20", " "); |
| | | String sj2 = shijian2.replace("#20", " "); |
| | | List<alarmmg> storageCagelist = alarmMapper.selecttime(sj1, sj2); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | // } else { |
| | | // List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("list", storageCagelist); |
| | | // return Result.success(map); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.service.HomeService; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | |
| | | |
| | | @Autowired |
| | | HomeService storageRackService; |
| | | |
| | | @Autowired |
| | | SpianService spianService; |
| | | |
| | | @GetMapping("/load") |
| | | public Result selectAll(){ |
| | |
| | | } |
| | | |
| | | @GetMapping("/Addglassid") |
| | | public Result Addglassid(Integer glassid){ |
| | | public Result Addglassid(short glassid){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | short taskno=homeMapper.SelectOutTask(); |
| | | if(taskno>0){ |
| | |
| | | }else{ |
| | | map.put("message2","200"); |
| | | //调用伍上片函数 |
| | | |
| | | spianService.selectAll(glassid); |
| | | } |
| | | return Result.success(map); |
| | | } |
| | |
| | | private Integer tier; |
| | | private String orderId; |
| | | private String coating; |
| | | private String lengthwidth; |
| | | private String lengthWidth; |
| | | |
| | | public Integer id() { |
| | | return id; |
| | |
| | | } |
| | | |
| | | public String getLengthWidth() { |
| | | return lengthwidth; |
| | | return lengthWidth; |
| | | } |
| | | |
| | | public void setLengthWidth(String lengthwidth) { |
| | | this.lengthwidth = lengthwidth; |
| | | public void setLengthWidth(String lengthWidth) { |
| | | this.lengthWidth = lengthWidth; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | public class alarmmg { |
| | | private Integer id; |
| | | private String content; |
| | | private Date timeon; |
| | | private Date endTime; |
| | | |
| | | private String timeons; |
| | | |
| | | public void setid(Integer id) { |
| | | this.id = id; |
| | |
| | | return endTime; |
| | | } |
| | | |
| | | public void settimeons(String timeons) { |
| | | this.timeons = timeons; |
| | | } |
| | | |
| | | public String gettimeons() { |
| | | return timeons; |
| | | } |
| | | |
| | | } |
| | |
| | | @Mapper |
| | | public interface HomeMapper { |
| | | //查询每个笼子的使用情况 |
| | | @Select("SELECT cage,round(round(sum(state)/42,2)*100) as cell,42-sum(state) as state FROM storage_cage group by cage") |
| | | @Select("SELECT cage,ROUND(sum(case when state=1 or state=2 or state=3 then 1 else 0 end)/42*100) as cell,42-sum(case when state=1 or state=2 or state=3 then 1 else 0 end) as state FROM `storage_cage` group by cage") |
| | | List<StorageCage> selectAll(); |
| | | |
| | | // 查询1-5笼内层格子状态 |
| | |
| | | void UpdateCageTask2(@Param("cell") Integer cell); |
| | | |
| | | //获取报警信息 |
| | | @Select("select * from alarmmg where endTime is null") |
| | | @Select("select id,content,timeon as timeons,endTime from alarmmg where endTime is null") |
| | | List<alarmmg> SelectAlarmmgInfo(); |
| | | } |