正式检测-预检测阶段错误码处理、频率、三项电压不平衡表头修改

This commit is contained in:
caozehui
2025-01-20 15:24:29 +08:00
parent 6f97c48226
commit c6ef54f7d3
4 changed files with 112 additions and 100 deletions

View File

@@ -322,11 +322,70 @@ watch(testStatus, function (newValue, oldValue) {
})
watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10550) {
// ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
// confirmButtonText: '确定',
// type: 'error',
// })
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}报文解析异常!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10521) {
ElMessageBox.alert('程控源參数有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}程控源參数有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10522) {
ElMessageBox.alert('测试项解析有误!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}测试项解析有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10523) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源连接失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10524) {
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}获取源控制权失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10525) {
ElMessageBox.alert('重置源失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}重置源失败!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10527) {
ElMessageBox.alert('源未进行初始化!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源未进行初始化!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10528) {
ElMessageBox.alert('目标源有误(该用户已控制其他源,在关闭前无法操作新的源)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}目标源有误(该用户已控制其他源,在关闭前无法操作新的源)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10529) {
ElMessageBox.alert('源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10550) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备连接异常!`})
// emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) {
@@ -431,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 25001) {
ElMessage.success('初始化成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
timeDifference.value = + new Date().getTime() - startData.value.getTime();
timeDifference.value = +new Date().getTime() - startData.value.getTime();
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
percentage.value = 3
@@ -445,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'preStopTest':
if(newValue.operateCode == 'stop'){
if (newValue.operateCode == 'stop') {
ElMessage.success('暂停成功')
emit('update:testStatus', 'paused')
pauseSuccessCallback()
@@ -542,20 +601,20 @@ watch(webMsgSend, function (newValue, oldValue) {
}, {deep: true})
const handleStartItem = (code: string, desc: string|undefined) => {
const handleStartItem = (code: string, desc: string | undefined) => {
if (desc === undefined) {
activeIndex = getActiveIndex(code)
updateCheckResultView(code, true)
updateLog(true)
} else {
if(desc.length>60){
desc = desc.substring(0,60) + '...'
if (desc.length > 60) {
desc = desc.substring(0, 60) + '...'
}
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`})
}
}
const handleEndItem = (code: string, desc: string|undefined, devices: CheckData.DeviceCheckResult[] = []) => {
const handleEndItem = (code: string, desc: string | undefined, devices: CheckData.DeviceCheckResult[] = []) => {
if (desc === undefined) {
updatePercentage()
updateCheckResultView(code, false, devices)
@@ -566,16 +625,16 @@ const handleEndItem = (code: string, desc: string|undefined, devices: CheckData.
}
} else {
let result = getResult(devices)
if(desc.length>60){
desc = desc.substring(0,60) + '...'
if (desc.length > 60) {
desc = desc.substring(0, 60) + '...'
}
if(result === 1){
if (result === 1) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`})
}
if(result === 2){
if (result === 2) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${desc}检测结束:不符合`})
}
if(result === 4){
if (result === 4) {
testLogList.push({type: 'warning', log: `${new Date().toLocaleString()}${desc}检测结束:数据异常`})
}
}
@@ -719,6 +778,7 @@ function getTimeDifference(timeDifference: number): string {
return `: ${minutes} 分钟, ${seconds}`
}
}
watch(testLogList, () => {
scrollToBottom();
}, {deep: true})
@@ -957,7 +1017,7 @@ const getCheckResult = (scriptType: string) => {
return tempScriptChnItem
}
const getResult=(devices: CheckData.DeviceCheckResult[] = [])=>{
const getResult = (devices: CheckData.DeviceCheckResult[] = []) => {
let type = 1
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
for (let i = 0; i < devices.length; i++) {
@@ -1062,93 +1122,27 @@ const startTimer = () => {
break;
case 1:
todoItem('V')
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_Start'
// })
// }, 1000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_End'
// })
// }, 2000);
break;
case 2:
todoItem('I')
// emit('update:webMsgSend', {
// requestId: 'V_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'V_End'
// })
// }, 2000);
break;
case 3:
todoItem('IMBV')
// emit('update:webMsgSend', {
// requestId: 'HV_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HV_End'
// })
// }, 2000)
break;
case 4:
todoItem('FREQ')
// emit('update:webMsgSend', {
// requestId: 'HI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HI_End'
// })
// }, 2000)
break;
case 5:
todoItem('HV')
// emit('update:webMsgSend', {
// requestId: 'HP_Start',
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HP_End'
// })
// }, 2000)
break;
case 6:
todoItem('HI')
// emit('update:webMsgSend', {
// requestId: 'HSV_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSV_End'
// })
// }, 2000)
break;
case 7:
todoItem('HSV')
// emit('update:webMsgSend', {
// requestId: 'HSI_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'HSI_End'
// })
// }, 2000)
break;
case 8:
todoItem('HSI')
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_Start'
// })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'VOLTAGE_End'
// })
// }, 2000)
break;
// case 9:
// emit('update:webMsgSend', {
@@ -1214,12 +1208,12 @@ const pauseSuccessCallback = () => {
console.log('暂停中')
};
const todoItem = (code:string) => {
const todoItem = (code: string) => {
emit('update:webMsgSend', {
requestId: `${code}_Start`
})
setTimeout(() => {
if(testStatus.value !== 'paused'){
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=42.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
@@ -1261,7 +1255,7 @@ const todoItem = (code:string) => {
}
}, 5000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_Start`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° '
@@ -1269,7 +1263,7 @@ const todoItem = (code:string) => {
}
}, 6000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
desc: '输入频率t=50.5Hz Ua=57.74%Un,相角=0.0° Ub=57.74%Un,相角=-120.0° Uc=57.74%Un,相角=120.0° Ia=0.0%In,相角=0.0° Ib=0.0%In,相角=0.0° Ic=0.0%In,相角=0.0° ',
@@ -1282,7 +1276,7 @@ const todoItem = (code:string) => {
}
}, 8000)
setTimeout(() => {
if(testStatus.value !== 'paused'){
if (testStatus.value !== 'paused') {
emit('update:webMsgSend', {
requestId: `${code}_End`,
data: [{