diff --git a/.env.dev b/.env.dev index 849a6ec5..90ad311e 100644 --- a/.env.dev +++ b/.env.dev @@ -1,7 +1,7 @@ ### # @Author: Do not edit # @Date: 2023-08-29 09:40:39 - # @LastEditTime: 2023-12-29 08:57:36 + # @LastEditTime: 2024-01-09 16:27:57 # @LastEditors: zhp # @Description: ### @@ -14,6 +14,7 @@ VUE_APP_TITLE = MES系统 # 芋道管理系统/开发环境 # VUE_APP_BASE_API = 'http://100.64.0.26:48082' # VUE_APP_BASE_API = 'http://10.70.2.2:8080' +VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.4.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.1.49:48082' @@ -22,8 +23,15 @@ VUE_APP_TITLE = MES系统 # VUE_APP_BASE_API = 'http://192.168.1.104:48082' # VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082' -VUE_APP_BASE_API = 'http://192.168.1.78:48082' +# VUE_APP_BASE_API = 'http://192.168.1.78:48082' +# VUE_APP_BASE_API = 'http://192.168.1.78:48082' +# socket地址 +# dcs地址 +VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081' +# socket地址 +VUE_APP_Socket_API = 'ws://10.70.2.2:8080' +# VUE_APP_Socket_API = 'ws://192.168.0.33:48082' # 积木报表指向地址 VUE_APP_JIMU_API = 'http://10.70.2.22:8080' diff --git a/.env.stage b/.env.stage index b44437a1..ccbf9ae6 100644 --- a/.env.stage +++ b/.env.stage @@ -12,7 +12,7 @@ VUE_APP_JIMU_API = 'http://192.168.0.33:48082' # 根据服务器或域名修改 -PUBLIC_PATH = 'http://192.168.0.33:8889/' +PUBLIC_PATH = '' # 二级部署路径 # VUE_APP_APP_NAME ='yudao-admin' diff --git a/package.json b/package.json index 556024f1..c5dc2ba0 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "dependencies": { "@antv/x6": "^2.15.3", "@babel/parser": "7.18.4", + "@jiaminghi/data-view": "^2.10.0", "@riophae/vue-treeselect": "0.4.0", "axios": "0.27.2", "benz-amr-recorder": "^1.1.5", @@ -80,6 +81,7 @@ "vue-plugin-hiprint": "0.0.54-fix", "vue-quill-editor": "^3.0.6", "vue-router": "3.4.9", + "vue-seamless-scroll": "^1.1.23", "vue-video-player": "^5.0.2", "vuedraggable": "2.24.3", "vuex": "3.6.2", diff --git a/public/favicon.ico b/public/favicon.ico index 47918ab0..71ea1add 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/src/assets/img/high.png b/src/assets/img/high.png new file mode 100644 index 00000000..c1a50f3c Binary files /dev/null and b/src/assets/img/high.png differ diff --git a/src/assets/img/logo-back.png b/src/assets/img/logo-back.png new file mode 100644 index 00000000..9fdd8338 Binary files /dev/null and b/src/assets/img/logo-back.png differ diff --git a/src/assets/img/logo.png b/src/assets/img/logo.png index 9fdd8338..43aa8c93 100644 Binary files a/src/assets/img/logo.png and b/src/assets/img/logo.png differ diff --git a/src/assets/img/middle.png b/src/assets/img/middle.png new file mode 100644 index 00000000..d8694857 Binary files /dev/null and b/src/assets/img/middle.png differ diff --git a/src/assets/img/short.png b/src/assets/img/short.png new file mode 100644 index 00000000..3331add6 Binary files /dev/null and b/src/assets/img/short.png differ diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index ca436de0..913a7f6f 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -48,6 +48,7 @@ + diff --git a/src/views/OperationalOverview/components/doubleYChart .vue b/src/views/OperationalOverview/components/doubleYChart .vue index 0ad2990a..d8186bd7 100644 --- a/src/views/OperationalOverview/components/doubleYChart .vue +++ b/src/views/OperationalOverview/components/doubleYChart .vue @@ -1,7 +1,7 @@ @@ -88,11 +88,21 @@ export default { name: '产线产量', type: 'bar', yAxisIndex: 1, - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#9DD5FF' }, - { offset: 1, color: '#1295FF' } - ]) + itemStyle: { + normal: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#9DD5FF' }, + { offset: 0.3, color: '#1295FF' } + ]), + label: { + show: true, //开启显示 + position: 'top', //在上方显示 + textStyle: { //数值样式 + color: '#ced1d5', + fontSize: 12 + } + }, + } // barBorderRadius: this.borderRadius }, barWidth: 12, @@ -100,6 +110,7 @@ export default { }, { name: '产线良品率', + symbol: 'circle', //变为实心圆 type: 'line', yAxisIndex: 0, areaStyle: { @@ -126,10 +137,10 @@ export default { data: passRateList } ] - const colors = ['#5470C6', '#91CC75', '#EE6666'] + // const colors = ['#5470C6', '#91CC75', '#EE6666'] this.chart = echarts.init(document.getElementById(this.id)) this.chart.setOption({ - color: colors, + // color: colors, tooltip: { trigger: 'axis', axisPointer: { @@ -137,8 +148,8 @@ export default { } }, grid: { - left: "4%", - right: "4%", + left: "3%", + right: "5%", bottom: "3%", width: 'auto', height: "auto", @@ -187,11 +198,13 @@ export default { type: 'value', name: '良品率/%', nameTextStyle: {// y轴上方单位的颜色 - color: '#fff' + color: '#fff', + align: "left", }, position: 'right', alignTicks: true, axisLine: { + show: true, lineStyle: { type: 'solid', color: '#213259', // 左边线的颜色 @@ -227,12 +240,15 @@ export default { scale: true, type: 'value', name: '产量/㎡', // y轴上方的单位 - nameTextStyle: {// y轴上方单位的颜色 - color: '#fff' + nameTextStyle: { + color: "#fff", + // fontSize: 10, + align: "right", }, position: 'left', alignTicks: true, axisLine: { + show: true, lineStyle: { type: 'solid', color: '#213259', // 左边线的颜色 diff --git a/src/views/OperationalOverview/components/linearBarChart.vue b/src/views/OperationalOverview/components/linearBarChart.vue index a2e9f1c1..2ddb9ea3 100644 --- a/src/views/OperationalOverview/components/linearBarChart.vue +++ b/src/views/OperationalOverview/components/linearBarChart.vue @@ -142,6 +142,7 @@ export default { } }, axisLabel: { + show: true, // 是否显示 y 轴 textStyle: { color: 'rgba(255,255,255,0.5)' // 坐标值得具体的颜色 } diff --git a/src/views/OperationalOverview/processingBoard.vue b/src/views/OperationalOverview/processingBoard.vue index 96a09476..0536be0b 100644 --- a/src/views/OperationalOverview/processingBoard.vue +++ b/src/views/OperationalOverview/processingBoard.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-07-19 15:18:30 * @LastEditors: zhp - * @LastEditTime: 2023-12-29 15:15:50 + * @LastEditTime: 2024-01-08 16:06:49 * @Description: --> diff --git a/src/views/databoard/kiln/FanSequence.vue b/src/views/databoard/kiln/FanSequence.vue index ca8b8648..2af2b190 100644 --- a/src/views/databoard/kiln/FanSequence.vue +++ b/src/views/databoard/kiln/FanSequence.vue @@ -7,13 +7,13 @@ + \ No newline at end of file diff --git a/src/views/databoard/wholePlant/DefectStatistics.vue b/src/views/databoard/wholePlant/DefectStatistics.vue new file mode 100644 index 00000000..cc96c75c --- /dev/null +++ b/src/views/databoard/wholePlant/DefectStatistics.vue @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/src/views/databoard/wholePlant/LeftTwo.vue b/src/views/databoard/wholePlant/LeftTwo.vue index 0a21c83e..f3f1a075 100644 --- a/src/views/databoard/wholePlant/LeftTwo.vue +++ b/src/views/databoard/wholePlant/LeftTwo.vue @@ -4,7 +4,7 @@ style=" display: grid; gap: 16px; - grid-template-rows: 462px 462px; + grid-template-rows: 308px 616px; "> diff --git a/src/views/databoard/wholePlant/MiddleTwo.vue b/src/views/databoard/wholePlant/MiddleTwo.vue index 9a65aeba..3c974b92 100644 --- a/src/views/databoard/wholePlant/MiddleTwo.vue +++ b/src/views/databoard/wholePlant/MiddleTwo.vue @@ -4,19 +4,19 @@ style=" display: grid; gap: 16px; - grid-template-rows: 462px 462px; + grid-template-rows: 605px 320px; "> - - + + \ No newline at end of file diff --git a/src/views/databoard/wholePlant/RightTwo.vue b/src/views/databoard/wholePlant/RightTwo.vue index 0cc9ec58..3ce64ba2 100644 --- a/src/views/databoard/wholePlant/RightTwo.vue +++ b/src/views/databoard/wholePlant/RightTwo.vue @@ -6,17 +6,17 @@ gap: 16px; grid-template-rows: 462px 462px; "> - - + + \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/databoard/wholePlant/index.vue b/src/views/databoard/wholePlant/index.vue index d1941e73..dd9cdf37 100644 --- a/src/views/databoard/wholePlant/index.vue +++ b/src/views/databoard/wholePlant/index.vue @@ -8,8 +8,8 @@ position: absolute; transform-origin: 16px 8px; font-size: 16px; - top: -8px; - left: -16px; + top: 0px; + left: 0px; width: 1920px; height: 1080px; display: flex; @@ -42,7 +42,6 @@ import MiddleTwo from './MiddleTwo'; import RightTwo from './RightTwo'; import screenfull from 'screenfull' import { debounce } from '@/utils/debounce' -import { getDcsMsg, getMesMsg } from './../utils/wsInterface' export default { name: 'wholePlantBoard', @@ -77,9 +76,6 @@ export default { window.addEventListener('resize', () => { this.boxReset() }) - // closeWebsocket() - // getDcsMsg() - // getMesMsg() console.log('mounted...........') }, destroyed() { diff --git a/src/views/monitoring/equipmentFullParams/index.vue b/src/views/monitoring/equipmentFullParams/index.vue index 0601cd16..b0c76935 100644 --- a/src/views/monitoring/equipmentFullParams/index.vue +++ b/src/views/monitoring/equipmentFullParams/index.vue @@ -51,10 +51,10 @@ export default { components: {}, props: {}, data() { - const now = new Date(); + // const now = new Date().getTime(); // const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()]; const today = new Date().getTime(); - const tenminAgo = today - (10 * 60 * 1000); + const tenminAgo = new Date(today - (10 * 60 * 1000)).getTime(); return { searchBarFormConfig: [ { @@ -77,7 +77,7 @@ export default { dateType: 'datetimerange', // datetimerange format: 'yyyy-MM-dd HH:mm:ss', // valueFormat: 'yyyy-MM-dd HH:mm:ss', - valueFormat: 'timestamp', + valueFormat: 'yyyy-MM-dd HH:mm:ss', rangeSeparator: '-', startPlaceholder: '开始时间', endPlaceholder: '结束时间', @@ -94,8 +94,8 @@ export default { }, ], queryParams: { - id: null, - time: [tenminAgo, today], + equipmentId: null, + recordTime: [parseTime(tenminAgo), parseTime(today)], }, tableList: [ // { @@ -118,7 +118,7 @@ export default { beforeRouteEnter(to, from, next) { if (Object.keys(to.params).length > 0) { next((vm) => { - vm.$set(vm.queryParams, 'id', to.params.equipmentId); + vm.$set(vm.queryParams, 'equipmentId', to.params.equipmentId); vm.$set( vm.searchBarFormConfig[0], 'defaultSelect', @@ -132,7 +132,7 @@ export default { vm.$set( vm.searchBarFormConfig[2], 'defaultSelect', - vm.queryParams.time + vm.queryParams.recordTime ); vm.handleQuery(); }); @@ -167,7 +167,7 @@ export default { }, beforeRouteLeave(to, from, next) { // clean job - this.$set(this.queryParams, 'id', null); + this.$set(this.queryParams, 'equipmentId', null); this.$set(this.searchBarFormConfig[0], 'defaultSelect', null); this.$set(this.searchBarFormConfig[1], 'defaultSelect', null); this.tableList = []; @@ -204,7 +204,7 @@ export default { props.push({ label: item.name, prop: item.name, - width: 128, + // width: 128, }); firstLineData[item.name] = `${item.minValue ?? ''}-${ item.maxValue ?? '' @@ -280,14 +280,15 @@ export default { async handleSearchBarBtnClick({ btnName, timeVal }) { if (timeVal && timeVal.length > 0) { - if (timeVal[1] - timeVal[0] <= 10 * 60 * 1000) { - this.queryParams.time = timeVal; + console.log('nihc ', timeVal) + if (new Date(timeVal[1]).getTime() - new Date(timeVal[0]).getTime() <= 10 * 60 * 1000) { + this.queryParams.recordTime = timeVal; await this.handleQuery(); } else { this.$message.warning('时间范围最大一小时限制!') } } else { - this.queryParams.time = []; + this.queryParams.recordTime = []; this.$message.warning('时间段必选!') } diff --git a/src/views/quality/base/qualityHotMaterial/add-or-updata.vue b/src/views/quality/base/qualityHotMaterial/add-or-updata.vue index 774bd37f..d9575dff 100644 --- a/src/views/quality/base/qualityHotMaterial/add-or-updata.vue +++ b/src/views/quality/base/qualityHotMaterial/add-or-updata.vue @@ -1,7 +1,7 @@ @@ -455,8 +455,8 @@ export default { materialId: response.data.materialId }).then((res) => { console.log(res.data); - this.ingredientList = res.data - valueList = this.ingredientList.map((ele) => { + let arr = res.data + valueList = arr.map((ele) => { // console.log(ele) return { maxValue: ele.maxValue, @@ -466,6 +466,17 @@ export default { getQualityHotMaterialDetList({ mainId: response.data.id }).then((result) => { + this.ingredientList = result.data.map((ele) => { + return { + name: ele.checkName, + id: ele.id, + checkDetId: ele.id, + checkValue: ele.checkValue, + // isStandard: true, + // showIcon: false, + } + }) + console.log(this.ingredientList); this.dataForm.checkValueList = result.data.map((ele) => { return { mainId: ele.mainId, diff --git a/src/websocket/websocket.js b/src/websocket/websocket.js new file mode 100644 index 00000000..531abdbd --- /dev/null +++ b/src/websocket/websocket.js @@ -0,0 +1,176 @@ +/** + * 发起websocket请求函数 + * @param {string} url ws连接地址 + * @param {Object} agentData 传给后台的参数 + * @param {function} successCallback 接收到ws数据,对数据进行处理的回调函数 + * @param {function} errCallback ws连接错误的回调函数 + */ +export function WsConnect(url, agentData, successCallback, errCallback) { + this.wsUrl = url; + this.wsObj = null; + // 是否执行重连 true/不执行 ; false/执行 + this.lockReconnect = false; + // 重连定时器 + this.wsCreateHandler = null; + // 连接成功,执行回调函数 + this.messageCallback = successCallback; + // 连接失败,执行回调函数 + this.errorCallback = errCallback; + // 发送给后台的数据 + this.sendDatas = agentData; + // 创建ws函数 + this.createWebSoket = () => { + if (typeof WebSocket === "undefined") { + writeToScreen("您的浏览器不支持WebSocket,无法获取数据"); + return false; + } + try { + this.wsObj = new WebSocket(url); + initWsEventHandle(); + } catch (e) { + writeToScreen("连接异常,开始重连"); + reconnect(); + } + }; + // 手动关闭websocket (这里手动关闭会执行onclose事件) + this.closeWebsocket = () => { + if (this.wsObj) { + writeToScreen("手动关闭websocket"); + this.wsObj.close(); // 关闭websocket + // this.wsObj.onclose() // 关闭websocket(如果上面的关闭不生效就加上这一条) + // 关闭重连 + this.lockReconnect = true; + this.wsCreateHandler && clearTimeout(this.wsCreateHandler); + // 关闭心跳检查 + // heartCheck.stop(); + } + }; + const initWsEventHandle = () => { + try { + // 连接成功 + this.wsObj.onopen = (event) => { + onWsOpen(event); + // heartCheck.start(); + }; + + // 监听服务器端返回的信息 + this.wsObj.onmessage = (event) => { + onWsMessage(event); + // heartCheck.start(); + }; + + this.wsObj.onclose = (event) => { + writeToScreen("onclose执行关闭事件"); + onWsClose(event); + }; + + this.wsObj.onerror = (event) => { + writeToScreen("onerror执行error事件,开始重连"); + onWsError(event); + reconnect(); + }; + } catch (err) { + writeToScreen("绑定事件没有成功,开始重连"); + reconnect(); + } + }; + + const onWsOpen = (event) => { + writeToScreen("CONNECT"); + // // 客户端与服务器端通信 + // wsObj.send('我发送消息给服务端'); + // 添加状态判断,当为OPEN时,发送消息 + if (this.wsObj.readyState === this.wsObj.OPEN) { + // wsObj.OPEN = 1 + // 发给后端的数据需要字符串化 + this.wsObj.send(JSON.stringify(this.sendDatas)); + } + if (this.wsObj.readyState === this.wsObj.CLOSED) { + // wsObj.CLOSED = 3 + writeToScreen("wsObj.readyState=3, ws连接异常,开始重连"); + reconnect(); + this.errorCallback(event); + } + }; + const onWsMessage = (event) => { + const jsonStr = event.data; + writeToScreen("onWsMessage接收到服务器的数据: ", jsonStr); + this.messageCallback(jsonStr); + }; + const onWsClose = (event) => { + writeToScreen("DISCONNECT"); + // e.code === 1000 表示正常关闭。 无论为何目的而创建, 该链接都已成功完成任务。 + // e.code !== 1000 表示非正常关闭。 + console.log("onclose event: ", event); + if (event && event.code !== 1000) { + writeToScreen("非正常关闭"); + this.errorCallback(event); + // 如果不是手动关闭,这里的重连会执行;如果调用了手动关闭函数,这里重连不会执行 + reconnect(); + } + }; + const onWsError = (event) => { + writeToScreen("onWsError: ", event.data); + this.errorCallback(event); + }; + + const writeToScreen = (massage) => { + console.log(massage); + }; + + // 重连函数 + const reconnect = () => { + if (this.lockReconnect) { + return; + } + writeToScreen("3秒后重连"); + this.lockReconnect = true; + // 没连接上会一直重连,设置延迟避免请求过多 + this.wsCreateHandler && clearTimeout(this.wsCreateHandler); + this.wsCreateHandler = setTimeout(() => { + writeToScreen("重连..." + this.wsUrl); + this.createWebSoket(); + this.lockReconnect = false; + writeToScreen("重连完成"); + }, 3000); + }; + + // 心跳检查(看看websocket是否还在正常连接中) + // let heartCheck = { + // timeout: 15000, + // timeoutObj: null, + // serverTimeoutObj: null, + // // 重启 + // reset() { + // clearTimeout(this.timeoutObj); + // clearTimeout(this.serverTimeoutObj); + // this.start(); + // }, + // // 停止 + // stop() { + // clearTimeout(this.timeoutObj); + // clearTimeout(this.serverTimeoutObj); + // }, + // // 开启定时器 + // start() { + // this.timeoutObj && clearTimeout(this.timeoutObj); + // this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj); + // // 15s之内如果没有收到后台的消息,则认为是连接断开了,需要重连 + // this.timeoutObj = setTimeout(() => { + // writeToScreen("心跳检查,发送ping到后台"); + // try { + // const datas = { ping: true }; + // this.wsObj.send(JSON.stringify(datas)); + // } catch (err) { + // writeToScreen("发送ping异常"); + // } + // console.log("内嵌定时器this.serverTimeoutObj: ", this.serverTimeoutObj); + // // 内嵌定时器 + // this.serverTimeoutObj = setTimeout(() => { + // writeToScreen("没有收到后台的数据,重新连接"); + // reconnect(); + // }, this.timeout); + // }, this.timeout); + // }, + // }; +} diff --git a/src/websocket/wsInterface.js b/src/websocket/wsInterface.js new file mode 100644 index 00000000..355c39ae --- /dev/null +++ b/src/websocket/wsInterface.js @@ -0,0 +1,305 @@ +import { WsConnect } from './websocket' +import store from "@/store"; + +// 创建websocket链接 + +const timestr = new Date().getTime() +const dcsConn = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_Dcs_API + '/xc-screen/websocket/dcsmsg'+timestr, + // 传递给后台的数据 + '', + (data) => { + // console.log('dcs成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "FanFrequencyInfo": { + store.dispatch({type: "websocket/setFanFrequencyInfo", payload:msgData.data.FanFrequencyInfo}) + break; + } + case "KilnInfo": { + store.dispatch({type: "websocket/setKilnInfo", payload: msgData.data}) + break; + } + case "GasInfo": { + store.dispatch({type: "websocket/setGasInfo", payload: msgData.data}) + break; + } + case "SumGasInfo": { + store.dispatch({type: "websocket/setSumGasInfo", payload: msgData.data}) + break; + } + default: + } + }, + (err) => { + console.log('失败的回调函数', err) + } +) +// ISRA +const mesIsra = new WsConnect( + process.env.VUE_APP_Socket_API + '/websocket/message?userId=KILN'+timestr, + '', + (data) => { + // console.log('mes ISRA成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + // console.log(msgData) + if (msgData == null) return; + switch (msgData?.type) { + case "israKiln": { + store.dispatch({type: "websocket/setIsraKiln", payload:msgData.detData.dayStatistic}) + break; + } + default: + } + }, + (err) => { + console.log('失败的回调函数', err) + } +) + +// 原料 MA +const mesMA = new WsConnect( + process.env.VUE_APP_Socket_API + '/websocket/message?userId=MA'+timestr, + '', + (data) => { + // console.log('mes 原料成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "material": { + store.dispatch({type: "websocket/setMaterial", payload:msgData.data}) + break; + } + default: + } + }, + (err) => { + console.log('失败的回调函数', err) + } +) +// 能耗 EN +const mesEN = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=ENERGY'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 能耗成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "EnergyInfo": { + store.dispatch({type: "websocket/setEnergyInfo", payload:msgData.data}) + break; + } + case "EnergyTrend": { + store.dispatch({type: "websocket/setEnergyTrend", payload:msgData.data}) + break; + } + case "EnergyMonitoring": { + store.dispatch({type: "websocket/setEnergyMonitoring", payload:msgData.data}) + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) +// 烟气 GAS +const mesGAS = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=GAS'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 烟气成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "exhaustGas": { + store.dispatch({type: "websocket/setExhaustGasInfo", payload:msgData.realtime}) + store.dispatch({type: "websocket/setExhaustGasChart", payload:{ + dayTrend: msgData.dayTrend, + weekTrend: msgData.weekTrend, + monthTrend: msgData.monthTrend, + yearTrend: msgData.yearTrend, + }}) + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) + +// 缺陷分类/统计 IS +const mesIS = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=IS'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 缺陷成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "isra": { + store.dispatch({type: "websocket/setDefectChart", payload:{ + checkType: msgData.detData.checkType, + dayStatistic: msgData.detData.dayStatistic, + weekStatistic: msgData.detData.weekStatistic, + monthStatistic: msgData.detData.monthStatistic, + yearStatistic: msgData.detData.yearStatistic, + }}) + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) + +// 深加工生产运行驾驶舱(除能源) SJG +const mesSJG = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=SJG'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 产线产量及良品率成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "productline": { + store.dispatch({type: "websocket/setProductline", payload:msgData.detData}) + break; + } + case "equipment": { + store.dispatch({type: "websocket/setSJGEq", payload:msgData.detData}) + break; + } + case "order": { + store.dispatch({type: "websocket/setWorkOrder", payload:msgData.detData}) + break; + } + case "defectSum": { + store.dispatch({type: "websocket/setDefectSum", payload:msgData.detData}) + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) + +// 订单完成情况 OV +const mesOV = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=OV'+timestr, + // 'ws://192.168.0.33:48082/websocket/message?userId=OV'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 产线产量及良品率成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + switch (msgData?.type) { + case "order": { + store.dispatch({type: "websocket/setOrder", payload:msgData.detData}) + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) + +// 本日生产良品率 CUTTING +const mesCUTTING = new WsConnect( + // websocket地址 + process.env.VUE_APP_Socket_API + '/websocket/message?userId=CUTTING'+timestr, + // 传递给后台的数据 + '', + // 成功拿到后台返回的数据的回调函数 + (data) => { + // console.log('mes 产线产量及良品率成功的回调函数, 接收到的data数据: ', data) + let msgData = JSON.parse(data) + if (msgData == null) return; + console.log(msgData) + switch (msgData?.type) { + case "cutting": { + if (msgData?.name === 'table') { + store.dispatch({type: "websocket/setYieldRateTable", payload:msgData.data}) + return + } + if (msgData?.dateType === 'day') { + store.dispatch({type: "websocket/setCutChartDay", payload:msgData.detData}) + return + } + if (msgData?.dateType === 'weekly') { + store.dispatch({type: "websocket/setCutChartWeek", payload:msgData.detData}) + return + } + if (msgData?.dateType === 'month') { + store.dispatch({type: "websocket/setCutChartMonth", payload:msgData.detData}) + return + } + if (msgData?.dateType === 'year') { + store.dispatch({type: "websocket/setCutChartYear", payload:msgData.detData}) + return + } + break; + } + default: + } + }, + // websocket连接失败的回调函数 + (err) => { + console.log('失败的回调函数', err) + } +) + +export const getDcsMsg = () => { + dcsConn.createWebSoket() + mesIsra.createWebSoket() + mesMA.createWebSoket() + mesEN.createWebSoket() + mesGAS.createWebSoket() + mesIS.createWebSoket() + mesSJG.createWebSoket() + mesOV.createWebSoket() + mesCUTTING.createWebSoket() +} +export const closeDcsMsg = () => { + dcsConn.closeWebsocket() + mesIsra.closeWebsocket() + mesMA.closeWebsocket() + mesEN.closeWebsocket() + mesGAS.closeWebsocket() + mesIS.closeWebsocket() + mesSJG.closeWebsocket() + mesOV.closeWebsocket() + mesCUTTING.closeWebsocket() +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 031dc711..f16d0367 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1119,6 +1119,51 @@ "cssnano-preset-default" "^4.0.0" "postcss" "^7.0.0" +"@jiaminghi/bezier-curve@*": + "integrity" "sha512-u9xJPOEl6Dri2E9FfmJoGxYQY7vYJkURNX04Vj64tdi535tPrpkuf9Sm0lNr3QTKdHQh0DdNRsaa62FLQNQEEw==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/bezier-curve/-/bezier-curve-0.0.9.tgz" + "version" "0.0.9" + dependencies: + "@babel/runtime" "^7.5.5" + +"@jiaminghi/c-render@^0.4.3": + "integrity" "sha512-FJfzj5hGj7MLqqqI2D7vEzHKbQ1Ynnn7PJKgzsjXaZpJzTqs2Yw5OSeZnm6l7Qj7jyPAP53lFvEQNH4o4j6s+Q==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/c-render/-/c-render-0.4.3.tgz" + "version" "0.4.3" + dependencies: + "@babel/runtime" "^7.5.5" + "@jiaminghi/bezier-curve" "*" + "@jiaminghi/color" "*" + "@jiaminghi/transition" "*" + +"@jiaminghi/charts@*": + "integrity" "sha512-K+HXaOOeWG9OOY1VG6M4mBreeeIAPhb9X+khG651AbnwEwL6G2UtcAQ8GWCq6GzhczcLwwhIhuaHqRygwHC0sA==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/charts/-/charts-0.2.18.tgz" + "version" "0.2.18" + dependencies: + "@babel/runtime" "^7.5.5" + "@jiaminghi/c-render" "^0.4.3" + +"@jiaminghi/color@*": + "integrity" "sha512-ZY3hdorgODk4OSTbxyXBPxAxHPIVf9rPlKJyK1C1db46a50J0reFKpAvfZG8zMG3lvM60IR7Qawgcu4ZDO3+Hg==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/color/-/color-1.1.3.tgz" + "version" "1.1.3" + +"@jiaminghi/data-view@^2.10.0": + "integrity" "sha512-Cud2MTiMcqc5k2KWabR/svuVQmXHANqURo+yj40370/LdI/gyUJ6LG203hWXEnT1nMCeiv/SLVmxv3PXLScCeA==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/data-view/-/data-view-2.10.0.tgz" + "version" "2.10.0" + dependencies: + "@babel/runtime" "^7.5.5" + "@jiaminghi/charts" "*" + +"@jiaminghi/transition@*": + "integrity" "sha512-owBggipoHMikDHHDW5Gc7RZYlVuvxHADiU4bxfjBVkHDAmmck+fCkm46n2JzC3j33hWvP9nSCAeh37t6stgWeg==" + "resolved" "https://registry.npmmirror.com/@jiaminghi/transition/-/transition-1.1.11.tgz" + "version" "1.1.11" + dependencies: + "@babel/runtime" "^7.5.5" + "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": "integrity" "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==" "resolved" "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz" @@ -3507,6 +3552,11 @@ "safe-buffer" "5.1.2" "vary" "~1.1.2" +"comutils@^1.1.9": + "integrity" "sha512-JxXB67juILiwhdLwOsYyjUqwWEhHdObI0EClOPk+JDtEuTbac59s0pxGpfCBnNNQ5JommifmcMGneW/4Cg7YWw==" + "resolved" "https://registry.npmmirror.com/comutils/-/comutils-1.1.19.tgz" + "version" "1.1.19" + "concat-map@0.0.1": "integrity" "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" "resolved" "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz" @@ -11378,6 +11428,13 @@ "resolved" "https://registry.npmmirror.com/vue-router/-/vue-router-3.4.9.tgz" "version" "3.4.9" +"vue-seamless-scroll@^1.1.23": + "integrity" "sha512-HBjUub8WwsKJzbFCrwKPDrZn4e+SSbkKgwWtjKtfLwesiFGwSsVxP44/Z6d3kpXy94qIFOiflJH6l0/9pj7SGA==" + "resolved" "https://registry.npmmirror.com/vue-seamless-scroll/-/vue-seamless-scroll-1.1.23.tgz" + "version" "1.1.23" + dependencies: + "comutils" "^1.1.9" + "vue-style-loader@^4.1.0", "vue-style-loader@^4.1.2": "integrity" "sha512-sFuh0xfbtpRlKfm39ss/ikqs9AbKCoXZBpHeVZ8Tx650o0k0q/YCM7FRvigtxpACezfq6af+a7JeqVTWvncqDg==" "resolved" "https://registry.npmmirror.com/vue-style-loader/-/vue-style-loader-4.1.3.tgz"