Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
| | |
| | | })
|
| | | }
|
| | |
|
| | | export function UpdateTask(types,shelfrack) {
|
| | | export function UpdateTask(types,glassid,shelfrack) {
|
| | | return request({
|
| | | url: '/home/UpdateTask?types=' + types + '&shelfrack='+shelfrack,
|
| | | url: '/home/UpdateTask?types=' + types + '&glassid='+glassid+'&shelfrack='+shelfrack,
|
| | | method: 'get',
|
| | | data :""
|
| | | })
|
| | |
| | | "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": "搜索"
|
| | | } |
| | |
| | | <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;
|
| | | }
|
| | | <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: [
|
| | | { name: 'D01.SR dec', value: 0 },
|
| | | { name: "D01.SR in pos", value: 0 },
|
| | | { name: "D02.SR dec", value: 0 },
|
| | | { name: "D02.SR in pos", value: 0 },
|
| | | { name: "D03.SR into", value: 0 },
|
| | | { name: "D03.SR dec", value: 0 },
|
| | | { name: 'D03.SR in pos', value: 0 },
|
| | | { name: "D04.SR dec", value: 0 },
|
| | | { name: "D04.SR in pos", value: 0 },
|
| | | { name: "D05.SR dec", value: 0 },
|
| | | { name: "D05.SR in pos", value: 0 },
|
| | | { name: "D06.SR dec", value: 0 },
|
| | | { name: 'D06.SR in pos', value: 0 },
|
| | | { name: "B01.SR out dec", value: 0 },
|
| | | { name: "B01.SR out in pos", value: 0 },
|
| | | { name: "B01.SR in dec", value: 0 },
|
| | | { name: "B01.SR in in pos", value: 0 },
|
| | | { name: "B01.SR turn on", value: 0 },
|
| | | { name: 'B01.SR turn off', value: 0 },
|
| | | { name: "B01.SR up", value: 0 },
|
| | | { name: "B01.SR down", value: 0 },
|
| | | { name: "B02.SR out dec", value: 0 },
|
| | | { name: "B02.SR out in pos", value: 0 },
|
| | | { name: "B02.SR in dec", value: 0 },
|
| | | { name: 'B02.SR in in pos', value: 0 },
|
| | | { name: "B02.SR turn on", value: 0 },
|
| | | { name: "B02.SR turn off", value: 0 },
|
| | | { name: "B02.SR up", value: 0 },
|
| | | { name: "B02.SR down", value: 0 },
|
| | | { name: "B01.SR out safety", value: 0 },
|
| | | { name: "B01.SR in safety", value: 0 },
|
| | | { name: "B02.SR out safety", value: 0 },
|
| | | { name: "SB.start(+)", value: 0 },
|
| | | { name: "SB.stop(1)", value: 0 },
|
| | | { name: "SB.reset", value: 0 },
|
| | | { name: "SB.auto/manul", value: 0 },
|
| | | { name: "SB.pause", value: 0 },
|
| | | { name: "SB.emg", value: 0 },
|
| | | { name: "D01.SB.start", value: 0 },
|
| | | { name: "D06.SB.start", value: 0 },
|
| | | { name: "B02.SR in safety", value: 0 },
|
| | | { name: "SAFETYDOOR.requset", value: 0 },
|
| | | { name: "SAFETYDOOR.confirm", value: 0 },
|
| | | { name: "SAFETYDOOR.reset", value: 0 },
|
| | | { name: "LED.red", value: 0 },
|
| | | { name: "LED.green", value: 0 },
|
| | | { name: "LED.yellow", value: 0 },
|
| | | { name: "D01.LED.green", value: 0 },
|
| | | { name: "D06.LED.green", value: 0 },
|
| | | { name: "B01.YV.turn", value: 0 },
|
| | | { name: "B01.YV.up down", value: 0 },
|
| | | { name: "B01.YV.gassing", value: 0 },
|
| | | { name: "B02.YV.turn", value: 0 },
|
| | | { name: "B02.YV.up down", value: 0 },
|
| | | { name: "B02.YV.gassing", value: 0 },
|
| | | { name: "SAFETYDOOR.led", value: 0 },
|
| | | { name: "SAFETYDOOR.open", value: 0 },
|
| | | { name: 'D01.SR dec', value: 1 },
|
| | | { name: "D01.SR in pos", value: 1 },
|
| | | { name: "D02.SR dec", value: 1 },
|
| | | { name: "D02.SR in pos", value: 1 },
|
| | | { name: "D03.SR into", value: 1 },
|
| | | { name: "D03.SR dec", value: 1 },
|
| | | { name: 'D03.SR in pos', value: 1 },
|
| | | { name: "D04.SR dec", value: 1 },
|
| | | { name: "D04.SR in pos", value: 1 },
|
| | | { name: "D05.SR dec", value: 1 },
|
| | | { name: "D05.SR in pos", value: 1 },
|
| | | { name: "D06.SR dec", value: 1 },
|
| | | { name: 'D06.SR in pos', value: 1 },
|
| | | { name: "B01.SR out dec", value: 1 },
|
| | | { name: "B01.SR out in pos", value: 1 },
|
| | | { name: "B01.SR in dec", value: 1 },
|
| | | { name: "B01.SR in in pos", value: 1 },
|
| | | { name: "B01.SR turn on", value: 1 },
|
| | | { name: 'B01.SR turn off', value: 1 },
|
| | | { name: "B01.SR up", value: 1 },
|
| | | { name: "B01.SR down", value: 1 },
|
| | | { name: "B02.SR out dec", value: 1 },
|
| | | { name: "B02.SR out in pos", value: 1 },
|
| | | { name: "B02.SR in dec", value: 1 },
|
| | | { name: 'B02.SR in in pos', value: 1 },
|
| | | { name: "B02.SR turn on", value: 1 },
|
| | | { name: "B02.SR turn off", value: 1 },
|
| | | { name: "B02.SR up", value: 1 },
|
| | | { name: "B02.SR down", value: 1 },
|
| | | { name: "B01.SR out safety", value: 1 },
|
| | | { name: "B01.SR in safety", value: 1 },
|
| | | { name: "B02.SR out safety", value: 1 },
|
| | | { name: "SB.start(+)", value: 1 },
|
| | | { name: "SB.stop(1)", value: 1 },
|
| | | { name: "SB.reset", value: 1 },
|
| | | { name: "SB.auto/manul", value: 1 },
|
| | | { name: "SB.pause", value: 1 },
|
| | | { name: "SB.emg", value: 1 },
|
| | | { name: "D01.SB.start", value: 1 },
|
| | | { name: "D06.SB.start", value: 1 },
|
| | | { name: "B02.SR in safety", value: 1 },
|
| | | { name: "SAFETYDOOR.requset", value: 1 },
|
| | | { name: "SAFETYDOOR.confirm", value: 1 },
|
| | | { name: "SAFETYDOOR.reset", value: 1 },
|
| | | { name: "LED.red", value: 1 },
|
| | | { name: "LED.green", value: 1 },
|
| | | { name: "LED.yellow", value: 1 },
|
| | | { name: "D01.LED.green", value: 1 },
|
| | | { name: "D06.LED.green", value: 1 },
|
| | | { name: "B01.YV.turn", value: 1 },
|
| | | { name: "B01.YV.up down", value: 1 },
|
| | | { name: "B01.YV.gassing", value: 1 },
|
| | | { name: "B02.YV.turn", value: 1 },
|
| | | { name: "B02.YV.up down", value: 1 },
|
| | | { name: "B02.YV.gassing", value: 1 },
|
| | | { name: "SAFETYDOOR.led", value: 1 },
|
| | | { name: "SAFETYDOOR.open", value: 1 },
|
| | |
|
| | | ],
|
| | | // canshu: [
|
| | | // 'D01.SR dec',
|
| | | // 'D01.SR in pos',
|
| | | // 'D02.SR dec',
|
| | | // 'D02.SR in pos',
|
| | | // 'D03.SR into',
|
| | | // 'D03.SR dec',
|
| | | // 'D03.SR in pos',
|
| | | // 'D04.SR dec',
|
| | | // 'D04.SR in pos',
|
| | | // 'D05.SR dec',
|
| | | // 'D05.SR in pos',
|
| | | // 'D06.SR dec',
|
| | | // 'D06.SR in pos',
|
| | | // 'B01.SR out dec',
|
| | | // 'B01.SR out in pos',
|
| | | // 'B01.SR in dec',
|
| | | // 'B01.SR in in pos',
|
| | | // 'B01.SR turn on',
|
| | | // 'B01.SR turn off',
|
| | | // 'B01.SR up',
|
| | | // 'B01.SR down',
|
| | | // 'B02.SR out dec',
|
| | | // 'B02.SR out in pos',
|
| | | // 'B02.SR in dec',
|
| | | // 'B02.SR in in pos',
|
| | | // 'B02.SR turn on',
|
| | | // 'B02.SR turn off',
|
| | | // 'B02.SR up',
|
| | | // 'B02.SR down',
|
| | | // 'LED.red',
|
| | | // 'LED.green',
|
| | | // 'LED.yellow',
|
| | | // ],
|
| | | canshu: [
|
| | | 'D01.SR dec',
|
| | | 'D01.SR in pos',
|
| | | 'D02.SR dec',
|
| | | 'D02.SR in pos',
|
| | | 'D03.SR into',
|
| | | 'D03.SR dec',
|
| | | 'D03.SR in pos',
|
| | | 'D04.SR dec',
|
| | | 'D04.SR in pos',
|
| | | 'D05.SR dec',
|
| | | 'D05.SR in pos',
|
| | | 'D06.SR dec',
|
| | | 'D06.SR in pos',
|
| | | 'B01.SR out dec',
|
| | | 'B01.SR out in pos',
|
| | | 'B01.SR in dec',
|
| | | 'B01.SR in in pos',
|
| | | 'B01.SR turn on',
|
| | | 'B01.SR turn off',
|
| | | 'B01.SR up',
|
| | | 'B01.SR down',
|
| | | 'B02.SR out dec',
|
| | | 'B02.SR out in pos',
|
| | | 'B02.SR in dec',
|
| | | 'B02.SR in in pos',
|
| | | 'B02.SR turn on',
|
| | | 'B02.SR turn off',
|
| | | 'B02.SR up',
|
| | | 'B02.SR down',
|
| | | 'LED.red',
|
| | | 'LED.green',
|
| | | 'LED.yellow',
|
| | | ],
|
| | |
|
| | | },
|
| | |
|
| | |
| | | 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 (zhuangtai === 0) {
|
| | | return "op";
|
| | | }
|
| | | else {
|
| | | return "dow";
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | },
|
| | | init () {
|
| | |
| | |
|
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | //this.$set(this.record.params, 0, obj.params[0]);
|
| | | this.record.params[0] = obj.sig[0];
|
| | | for (let a = 0; a <= this.record.xyData[0] - 1; a++) {
|
| | | for (let a = 0; a < this.record.params[0].length; 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];
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | this.$forceUpdate();
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | send () {
|
| | | this.messagepack.data = { taskname: "前端到后台" };
|
| | | socket?.send(JSON.stringify(this.messagepack)); // 将组装好的json发送给服务端,由服务端进行转发
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | padding: 0;
|
| | | }
|
| | |
|
| | | /* .neir {
|
| | | .app {
|
| | | height: 100%;
|
| | | }
|
| | |
|
| | | .neir {
|
| | | /* height: 580px; */
|
| | | height: 90%;
|
| | | overflow-y: auto;
|
| | | } */
|
| | | }
|
| | |
|
| | | .el-input__inner {
|
| | | text-align: center;
|
| | |
| | |
|
| | | <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 v-model.number="item.value" style="width: 80px;"></el-input>
|
| | | <el-input v-model="item.value" readonly="readonly" style="width: 80px;"></el-input>
|
| | | </div>
|
| | |
|
| | |
|
| | |
| | | data () {
|
| | | return {
|
| | | record: {
|
| | | params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
|
| | | params: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1,],
|
| | | xyData: [
|
| | | { name: 'D01.State', value: 0 },
|
| | | { name: 'D02.State', value: 0 },
|
| | | { name: 'B01.State', value: 0 },
|
| | | { name: 'B02.State', value: 0 },
|
| | | { name: 'A01.State', value: 0 },
|
| | | { name: 'A02.State', value: 0 },
|
| | | { name: 'D03.State', value: 0 },
|
| | | { name: 'D04.State', value: 0 },
|
| | | { name: 'D05.State', value: 0 },
|
| | | { name: 'D06.State', value: 0 },
|
| | | { name: 'D01.State', value: "自动" },
|
| | | { name: 'D02.State', value: "自动" },
|
| | | { name: 'B01.State', value: "自动" },
|
| | | { name: 'B02.State', value: "自动" },
|
| | | { name: 'A01.State', value: "自动" },
|
| | | { name: 'A02.State', value: "自动" },
|
| | | { name: 'D03.State', value: "自动" },
|
| | | { name: 'D04.State', value: "自动" },
|
| | | { name: 'D05.State', value: "自动" },
|
| | | { name: 'D06.State', value: "自动" },
|
| | | ],
|
| | | // canshu: [
|
| | | // 'D01.State',
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.sta[0];
|
| | | for (let a = 0; a <= this.record.xyData[0].length - 1; a++) {
|
| | | console.log(this.record.params[0]);
|
| | | //将读取到的PLC的数据,与定义的xyData,组合成新的数组
|
| | | for (let a = 0; a < this.record.params[0].length; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | |
| | | console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange (index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | valuezhi (zhi) {
|
| | | if (zhi == 1) {
|
| | | return "自动";
|
| | | }
|
| | | else {
|
| | | return "手动";
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <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发送给服务端,由服务端进行转发 |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <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
|
| | | task</el-button>
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="endtask(0, scope.row.glassId, scope.row.cell)">end
|
| | | task</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | <el-table :data="this.tasklist2" border style="width: 100%">
|
| | |
| | | <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
|
| | | task</el-button>
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="endtask(1, scope.row.glassId, scope.row.cell)">end
|
| | | task</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | </div>
|
| | |
| | | <el-table-column prop="endTime" label="endTime"></el-table-column>
|
| | | </el-table>
|
| | | </el-dialog>
|
| | | <el-dialog :visible.sync="dialogFormVisible3" title="Ordering Information">
|
| | | <el-dialog :visible.sync="dialogFormVisible3" title="Cage Details">
|
| | | <el-table :data="this.cageinfo" border style="width: 100%;height: 700px;overflow: auto;">
|
| | | <el-table-column :width="150" prop="cage" label="the grille number"></el-table-column>
|
| | | <el-table-column prop="cell" label="cell"></el-table-column>
|
| | |
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="deleteglass(scope.row.glassId, scope.row.state)">delete</el-button>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | @click="outglass(scope.row.glassId,scope.row.state)">out</el-button>
|
| | | @click="outglass(scope.row.glassId, scope.row.state)">out</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
| | | url: "../../img/bigcar01.png",
|
| | | car1: 150,
|
| | | car2: 242,
|
| | | incell: "",
|
| | | outcell: "",
|
| | | cageinfo: [],
|
| | | cage: 0
|
| | | };
|
| | |
| | | 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];
|
| | |
| | | this.cagelist4 = obj.cagelist4[0];
|
| | | this.tasklist1 = obj.tasklist1[0];
|
| | | this.tasklist2 = obj.tasklist2[0];
|
| | | if (this.tasklist1.length > 0) {
|
| | | this.incell = this.tasklist1[0]['cell'];
|
| | | }
|
| | | if (this.tasklist1.length > 0) {
|
| | | this.outcell = this.tasklist2[0]['cell'];
|
| | | }
|
| | | this.alarm = obj.alarmmg[0];
|
| | |
|
| | | SelectCageInfo(this.cage).then(res => {
|
| | |
| | | if (res.data.message2 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | this.cancal();
|
| | | } else {
|
| | | } else if(res.data.message2 == 500) {
|
| | | this.$message.success("There are currently tasks");
|
| | | }
|
| | | else if(res.data.message2 == 300) {
|
| | | this.$message.success("There is no such grid");
|
| | | }
|
| | | else if(res.data.message2 == 400) {
|
| | | this.$message.success("There is no such grid");
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | this.dialogFormVisible1 = false;
|
| | | this.form1 = {};
|
| | | },
|
| | | endtask(type) {
|
| | | if (type == 0) {
|
| | | UpdateTask(type, this.incell).then(res => {
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | | });
|
| | | } else {
|
| | | UpdateTask(type, this.outcell).then(res => {
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | endtask(type, glassid, cell) {
|
| | | UpdateTask(type, glassid, cell).then(res => {
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | | });
|
| | | },
|
| | | showcageinfo(cage) {
|
| | | this.cage = cage;
|
| | |
| | | },
|
| | | deleteglass(glassid, state) {
|
| | | if (state == 1) {
|
| | | DeleteByGlassID(glassid).then(res=>{
|
| | | DeleteByGlassID(glassid).then(res => {
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | |
| | | this.$message.success("No out allowed");
|
| | | }
|
| | | },
|
| | | outglass(glassid,state){
|
| | | outglass(glassid, state) {
|
| | | if (state == 1) {
|
| | | OutByGlassID(glassid).then(res=>{
|
| | | OutByGlassID(glassid).then(res => {
|
| | | if (res.data.message3 == 200) {
|
| | | this.$message.success("Operation successful");
|
| | | }
|
| | |
| | | <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(修改用户成功); |
| | |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | |
| | | } |
| | | |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.DBx0.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, |
| | | // true, false, true, false, true, |
| | | // false, true, false, true, false, |
| | | // true, false, true, false }; |
| | | // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | if (plclist != null) { |
| | | |
| | | if(plclist==null){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | }else{ |
| | | jsonObject.append("params", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // 将获取的布尔类型转换为整数类型 |
| | | List<Integer> Intlist = new ArrayList<>(); |
| | | for (Boolean value : plclist) { |
| | | Intlist.add(value == true ? 1 : 0); |
| | | |
| | | jsonObject.append("params", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | } |
| | | // 将Intlist转换为数组 |
| | | Integer[] shuzu1 = Intlist.toArray(new Integer[0]); |
| | | |
| | | 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, |
| | | // 1, 0, 1, 0, 0, |
| | | // 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }; |
| | | |
| | | String[] shuzu = { |
| | | "D01 VFD error", |
| | | "D02 VFD error", |
| | | "D03 VFD error", |
| | | "D04 VFD error", |
| | | "D05 VFD error", |
| | | "D06 VFD error", |
| | | "B01 VFD error", |
| | | "B02 VFD error", |
| | | "A01 VFD error", |
| | | "A02 VFD error", |
| | | "A01 servo turn error", |
| | | "A02 servo turn error", |
| | | "A01 servo travel error", |
| | | "A02 servo travel error", |
| | | "B01 servo travel error", |
| | | "B02 servo travel error", |
| | | "D01 DEC error", |
| | | "D01 pos error", |
| | | "D02 DEC error", |
| | | "D02 pos error", |
| | | "D03 DEC error", |
| | | "D03 pos error", |
| | | "D04 DEC error", |
| | | "D04 pos error", |
| | | "D05 DEC error", |
| | | "D05 pos error", |
| | | "D06 DEC error", |
| | | "D06 pos error", |
| | | "A01 DEC error", |
| | | "A01 pos error", |
| | | "A02 DEC error", |
| | | "A02 pos error", |
| | | "B01 IN DEC error", |
| | | "B01 IN pos error", |
| | | "B01 OUT DEC error", |
| | | "B01 OUT pos error", |
| | | "B02 IN DEC error", |
| | | "B02 IN pos error", |
| | | "B02 OUT DEC error", |
| | | "B02 OUT pos error", |
| | | }; |
| | | alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); |
| | | for (short i = 0; i < shuzu1.length; i++) { |
| | | short result = alarmMapper.selectnullti(shuzu[i]); |
| | | if (shuzu1[i] == 1 && result == 0) { |
| | | // alarmMapper.Insertalarm(shuzu[i]); |
| | | } else if (shuzu1[i] == 0 && result > 0) { |
| | | // alarmMapper.updatealarm(shuzu[i]); |
| | | String[] shuzu = { |
| | | "D01 VFD error", |
| | | "D02 VFD error", |
| | | "D03 VFD error", |
| | | "D04 VFD error", |
| | | "D05 VFD error", |
| | | "D06 VFD error", |
| | | "B01 VFD error", |
| | | "B02 VFD error", |
| | | "A01 VFD error", |
| | | "A02 VFD error", |
| | | "A01 servo turn error", |
| | | "A02 servo turn error", |
| | | "A01 servo travel error", |
| | | "A02 servo travel error", |
| | | "B01 servo travel error", |
| | | "B02 servo travel error", |
| | | "D01 DEC error", |
| | | "D01 pos error", |
| | | "D02 DEC error", |
| | | "D02 pos error", |
| | | "D03 DEC error", |
| | | "D03 pos error", |
| | | "D04 DEC error", |
| | | "D04 pos error", |
| | | "D05 DEC error", |
| | | "D05 pos error", |
| | | "D06 DEC error", |
| | | "D06 pos error", |
| | | "A01 DEC error", |
| | | "A01 pos error", |
| | | "A02 DEC error", |
| | | "A02 pos error", |
| | | "B01 IN DEC error", |
| | | "B01 IN pos error", |
| | | "B01 OUT DEC error", |
| | | "B01 OUT pos error", |
| | | "B02 IN DEC error", |
| | | "B02 IN pos error", |
| | | "B02 OUT DEC error", |
| | | "B02 OUT pos error", |
| | | }; |
| | | alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); |
| | | for (short i = 0; i < shuzu.length; i++) { |
| | | short result = alarmMapper.selectnullti(shuzu[i]); |
| | | if (shuzu1[i] == 1 && result == 0) { |
| | | alarmMapper.Insertalarm(shuzu[i]); |
| | | } else if (shuzu1[i] == 0 && result > 0) { |
| | | alarmMapper.updatealarm(shuzu[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(5000); |
| | | Thread.sleep(10000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | //注入mapper |
| | | |
| | | // 注入mapper |
| | | homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | // 笼子使用情况 |
| | | List<StorageCage> tableData = homeMapper.selectAll(); |
| | | jsonObject.append("tableData", tableData); |
| | | //格理片笼格子状态 |
| | | // 格理片笼格子状态 |
| | | List<StorageCage> cagelist1 = homeMapper.selectRack1(); |
| | | List<StorageCage> cagelist2 = homeMapper.selectRack2(); |
| | | List<StorageCage> cagelist3 = homeMapper.selectRack3(); |
| | |
| | | jsonObject.append("cagelist2", cagelist2); |
| | | jsonObject.append("cagelist3", cagelist3); |
| | | jsonObject.append("cagelist4", cagelist4); |
| | | //进出片任务 |
| | | List<StorageCage> tasklist1=homeMapper.selectinout(2); |
| | | List<StorageCage> tasklist2=homeMapper.selectinout(3); |
| | | // 进出片任务 |
| | | List<StorageCage> tasklist1 = homeMapper.selectinout(2); |
| | | List<StorageCage> tasklist2 = homeMapper.selectinout(3); |
| | | jsonObject.append("tasklist1", tasklist1); |
| | | jsonObject.append("tasklist2", tasklist2); |
| | | //查询报警信息 |
| | | List<alarmmg> alarmmg=homeMapper.SelectAlarmmgInfo(); |
| | | // 查询报警信息 |
| | | List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo(); |
| | | jsonObject.append("alarmmg", alarmmg); |
| | | //读去Plc进片车与出片车位置W |
| | | // 读去Plc进片车与出片车位置W |
| | | List<String> addressList = new ArrayList<String>(); |
| | | addressList.add("DB105.DBW0"); |
| | | addressList.add("DB105.DBW12"); |
| | | addressList.add("DB106.0"); |
| | | addressList.add("DB106.12"); |
| | | List<Short> paramlist = S7control.getinstance().ReadWord(addressList); |
| | | //将集合转为数组 |
| | | |
| | | // List<Short> paramlists = new ArrayList<Short>(); |
| | | // short para1 = 1; |
| | | // short para2 = 2; |
| | | // paramlists.add(para1); |
| | | // paramlists.add(para2); |
| | | // System.out.println(paramlists); |
| | | |
| | | if(paramlist!=null){ |
| | | Short[] paramlists = paramlist.toArray(new Short[0]); |
| | | jsonObject.append("params", paramlists); |
| | | // Short[] paramlists = paramlist.toArray(new Short[0]); |
| | | jsonObject.append("params", paramlist); |
| | | } |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Arrays; |
| | | |
| | | public class Plcsign extends Thread { |
| | | @Override |
| | |
| | | } |
| | | |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.DBX0.0", 58); |
| | | if(plclist==null){ |
| | | // 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, |
| | | // 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, |
| | | // true, false, true, false, true, }; |
| | | // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | if (plclist != null) { |
| | | // 将获取的布尔类型转换为整数类型 |
| | | List<Integer> Intlist = new ArrayList<>(); |
| | | for (Boolean value : plclist) { |
| | | Intlist.add(value == true ? 0 : 1); |
| | | |
| | | }else{ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject3.append("sig", |
| | | // new short[] { 0, 0, 0, 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, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }); |
| | | jsonObject.append("sig", plclist); |
| | | WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign"); |
| | | if (sendwServer3 != null) { |
| | | sendwServer3.sendMessage(jsonObject.toString()); |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sig", Intlist); |
| | | WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign"); |
| | | if (sendwServer3 != null) { |
| | | sendwServer3.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Arrays; |
| | | |
| | | public class Plcstate extends Thread { |
| | | @Override |
| | |
| | | } |
| | | |
| | | List<Short> plclist = S7control.getinstance().ReadWord("DB103.DBW0", 10); |
| | | if (plclist == null) { |
| | | // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, }; |
| | | // List<Short> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | if (plclist != null) { |
| | | |
| | | } else { |
| | | List<String> Intlist = new ArrayList<>(); |
| | | for (Short value : plclist) { |
| | | Intlist.add(value == 1 ? "自动" : "手动"); |
| | | |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.append("sta", |
| | | // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); |
| | | jsonObject.append("sta", plclist); |
| | | jsonObject.append("sta", Intlist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | |
| | | // |
| | | 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); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | if (taskno > 0) { |
| | | map.put("message2", "500"); |
| | | } else { |
| | | map.put("message2", "200"); |
| | | // 调用伍上片函数 |
| | | spianService.selectAll(glassid); |
| | | short results= spianService.selectAll(glassid); |
| | | if(results==200){ |
| | | map.put("message2", "200"); |
| | | }else if(results==300){ |
| | | map.put("message2", "300"); |
| | | }else if(results==400){ |
| | | map.put("message2", "400"); |
| | | } |
| | | } |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/UpdateTask") |
| | | public Result UpdateTask(Integer types, Integer shelfrack) { |
| | | public Result UpdateTask(Integer types, Integer shelfrack, Integer glassid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | homeMapper.UpdateTask(types, shelfrack); |
| | | if (types == 0) { |
| | | homeMapper.UpdateCageTask1(shelfrack); |
| | | homeMapper.UpdateCageTask1(shelfrack,glassid); |
| | | } else { |
| | | homeMapper.UpdateCageTask2(shelfrack); |
| | | homeMapper.UpdateCageTask2(shelfrack,glassid); |
| | | } |
| | | map.put("message3", "200"); |
| | | return Result.success(map); |
| | |
| | | List<StorageCage> selectinout(@Param("task_type") Integer task_type); |
| | | |
| | | // 查询是否存在此订单 |
| | | @Select("select count(*) from storage_cage where order_id=#{orderid} and state=0") |
| | | @Select("select count(*) from storage_cage where order_id=#{orderid} and state=1") |
| | | short SelectOrder(@Param("orderid") String orderid); |
| | | |
| | | // @Insert("insert into order_out(orderid) values('#{orderid}')") |
| | | @Insert("INSERT INTO `canadames`.`order_out`( `orderid`,`mod_time`) VALUES ( #{orderid},now())") |
| | | @Insert("INSERT INTO `canadames`.`order_out`( `order_id`,`state`) VALUES ( #{orderid},0)") |
| | | void InsertOrder(String orderid); |
| | | |
| | | // 停止按当前订单出片 |
| | |
| | | void UpdateTask(@Param("task_type") Integer task_type, @Param("shelf_rack") Integer shelf_rack); |
| | | |
| | | // 手动完成进片任务修改笼子数据 |
| | | @Update("update storage_cage set state=1 where cell=#{cell} and state=2") |
| | | void UpdateCageTask1(@Param("cell") Integer cell); |
| | | @Update("update storage_cage set state=1 where cell=#{cell} and glass_id=#{glassid} and state=2") |
| | | void UpdateCageTask1(@Param("cell") Integer cell,@Param("glassid") Integer glassid); |
| | | |
| | | // 手动完成出片任务修改笼子数据 |
| | | @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where cell=#{cell} and state=2") |
| | | void UpdateCageTask2(@Param("cell") Integer cell); |
| | | @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,coating=null where cell=#{cell} and glass_id=#{glassid} and state=3") |
| | | void UpdateCageTask2(@Param("cell") Integer cell,@Param("glassid") Integer glassid); |
| | | |
| | | //获取报警信息 |
| | | @Select("select id,content,timeon as timeons,endTime from alarmmg where endTime is null") |
New file |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.DriverManager; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.example.springboot.entity.Glass; |
| | | @Component |
| | | public class JdbcConnections { |
| | | /** |
| | | * 数据库连接参数 |
| | | * driver,url,username,password |
| | | */ |
| | | private static final String DRIVER = "com.mysql.jdbc.Driver"; |
| | | private static final String URL = "jdbc:mysql://localhost:3306/canadames"; |
| | | private static final String USERNAME = "root"; |
| | | private static final String PASSWORD = "beibo.123/"; |
| | | |
| | | private static Connection conn = null; |
| | | private static PreparedStatement ps = null; |
| | | private static ResultSet rs = null; |
| | | |
| | | public Glass selectGlass(int glassid) throws SQLException { |
| | | conn = getConn(); |
| | | Glass glass=new Glass(); |
| | | String sql = "select orderid from glass where glassid=?"; |
| | | ps = conn.prepareStatement(sql); |
| | | ps.setInt(1, glassid); |
| | | rs= ps.executeQuery(); |
| | | while (rs.next()) { |
| | | glass.setOrderId(rs.getShort("orderid")); |
| | | } |
| | | |
| | | return glass; |
| | | } |
| | | /** |
| | | * 1. 加载驱动 |
| | | * 2. 获取连接 conn |
| | | * 3. 创建语句 ps |
| | | * 4. 执行语句 rs |
| | | * 5. 处理结果 |
| | | * 6. 回收资源 |
| | | * |
| | | * 实现CRUD |
| | | * 更新: |
| | | * 1增加 |
| | | * 2删除 |
| | | * 3修改 |
| | | * 查询: |
| | | * 1. 查一个,一个对象 |
| | | * 2. 查一组,做成一个对象列表,查全部 |
| | | */ |
| | | public static Connection getConn() throws SQLException { |
| | | Connection conn = null; |
| | | conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/canadames?serverTimezone=GMT%2B8&characterEncoding=utf-8", "root", "beibo.123/"); |
| | | return conn; |
| | | } |
| | | |
| | | static { |
| | | try { |
| | | Class.forName(DRIVER); |
| | | } catch (ClassNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |