This commit is contained in:
2024-01-04 16:37:14 +08:00
parent da2999e67c
commit 6ea650e7eb
33 changed files with 1236 additions and 142 deletions

View File

@@ -37,6 +37,7 @@ const dcsConn = new WsConnect(
console.log('失败的回调函数', err)
}
)
// ISRA
const mesIsra = new WsConnect(
'ws://10.70.2.2:8080/websocket/message?userId=KILN'+timestr,
'',
@@ -106,6 +107,10 @@ const mesEN = new WsConnect(
store.dispatch({type: "websocket/setEnergyTrend", payload:msgData.data})
break;
}
case "EnergyMonitoring": {
store.dispatch({type: "websocket/setEnergyMonitoring", payload:msgData.data})
break;
}
default:
}
},
@@ -144,12 +149,72 @@ const mesGAS = new WsConnect(
console.log('失败的回调函数', err)
}
)
// 缺陷分类/统计 IS
const mesIS = new WsConnect(
// websocket地址
'ws://10.70.2.2:8080/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:{
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地址
// 'ws://10.70.2.2:8080/websocket/message?userId=SJG'+timestr,
'ws://192.168.1.104:48082/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;
}
default:
}
},
// websocket连接失败的回调函数
(err) => {
console.log('失败的回调函数', err)
}
)
export const getDcsMsg = () => {
dcsConn.createWebSoket()
mesIsra.createWebSoket()
mesMA.createWebSoket()
mesEN.createWebSoket()
mesGAS.createWebSoket()
mesIS.createWebSoket()
// mesSJG.createWebSoket()
}
export const closeDcsMsg = () => {
dcsConn.closeWebsocket()
@@ -157,4 +222,6 @@ export const closeDcsMsg = () => {
mesMA.closeWebsocket()
mesEN.closeWebsocket()
mesGAS.closeWebsocket()
mesIS.closeWebsocket()
// mesSJG.closeWebsocket()
}