fix: 优化评判一些代码结构
This commit is contained in:
parent
59a54c0ec7
commit
2fed7549d6
@ -262,11 +262,6 @@ struct JudgePage {
|
||||
if (this.examSubject == '3') {
|
||||
this.mapPointArr = await InitMapPoint()
|
||||
this.mapPointItemArr = await InitMapPointItem()
|
||||
//定时上传考试里程
|
||||
// let mileageTimer = setInterval(()=>{
|
||||
// this.uploadMileage()
|
||||
// },5000)
|
||||
// this.mileageTimer = mileageTimer
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,12 +514,11 @@ struct JudgePage {
|
||||
async initCDSBInfo() {
|
||||
const cdsbParams: MA_CDSBINFOType[] = await GetSyncData<MA_CDSBINFOType>('MA_CDSBINFO')
|
||||
//只记录考试项目的模型
|
||||
const projectsObj = this.projectsObj
|
||||
cdsbParams.forEach((cdsb) => {
|
||||
const key = decodeURI(cdsb.itemsno || "")
|
||||
const newKey = key.split('~').join('_')
|
||||
const xmdm = Number(key.split('~')[0])
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const currentProject: ProjectInfo = Reflect.get(this.projectsObj, xmdm)
|
||||
if (currentProject) {
|
||||
const cdsbInfo: CDSBInfo = {
|
||||
kdid: cdsb.kdid,
|
||||
@ -543,15 +537,13 @@ struct JudgePage {
|
||||
// 获取itemInfo表信息
|
||||
async initItemInfo() {
|
||||
const infoParams: MA_ITEMINFOType[] = await GetSyncData<MA_ITEMINFOType>('MA_ITEMINFO');
|
||||
const carlist = this.carlist;
|
||||
const projectsObj = this.projectsObj
|
||||
infoParams.forEach((info) => {
|
||||
const key = decodeURI(info.itemsno || "");
|
||||
const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist || "").split(',') || []);
|
||||
const newKey = key.split('~').join('_')
|
||||
const xmdm = Number(key.split('~')[0])
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
if (currentProject && (carlistArr.length == 0 || carlistArr.includes(carlist))) {
|
||||
const currentProject: ProjectInfo = Reflect.get(this.projectsObj, xmdm)
|
||||
if (currentProject && (carlistArr.length == 0 || carlistArr.includes(this.carlist))) {
|
||||
Reflect.set(this.itemInfoObj!, newKey, {
|
||||
modelKey: newKey,
|
||||
xmdm,
|
||||
|
||||
@ -170,6 +170,48 @@ export default class Judge {
|
||||
private isExamEnd: boolean
|
||||
// 是否发送udp
|
||||
private isUdpEnd: boolean = false
|
||||
// 处理udp plc信号
|
||||
handleUdp = async (msg: string) => {
|
||||
const stachArr = msg.split(',')
|
||||
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
||||
return
|
||||
}
|
||||
const gpsPart = msg.split("#END$GPS,")[1];
|
||||
const gpsStatus = gpsPart.split(",")[0];
|
||||
if (gpsStatus === "4") {
|
||||
dConsole.log(JudgeTag, "差分状态正常", gpsStatus)
|
||||
this.judgeUI.isDwztRight = true
|
||||
} else {
|
||||
dConsole.log(JudgeTag, "差分状态异常", gpsStatus)
|
||||
this.judgeUI.isDwztRight = false
|
||||
}
|
||||
this.judgeUI.isDwztRight
|
||||
const plcData = await this.getPlcData(msg);
|
||||
// 4.过程数据
|
||||
// await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(plcData))
|
||||
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
||||
// if (this.usbService.isWXUSBDevice) {
|
||||
// const str = await senorToWXDataStr(msg);
|
||||
// this.usbService.sendUSB(str)
|
||||
// }
|
||||
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
|
||||
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
|
||||
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
||||
//TODO 暂时关闭差分检测异常
|
||||
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
||||
if (!this.isExamEnd) {
|
||||
await examJudgeRealExam(plcData)
|
||||
}
|
||||
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
|
||||
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
||||
// TODO UPD缺失
|
||||
// const judgeUdp = globalThis.judgeUdp
|
||||
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
||||
// judgeUdp.send(bytes)
|
||||
// }
|
||||
// AppStorage.setOrCreate('udpIndex', udpIndex++)
|
||||
}
|
||||
//是否手动结束考试
|
||||
private isManual: boolean = false
|
||||
//UDP服务序列号
|
||||
@ -214,6 +256,60 @@ export default class Judge {
|
||||
dConsole.info(JudgeTag, '过程数据文件上传 end')
|
||||
}
|
||||
private judgeTask: JudgeTask
|
||||
// 检测扣分、结束项目时该项目是否开始
|
||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
||||
if (xmdm == 20) {
|
||||
return true
|
||||
}
|
||||
const judgeUI = this.judgeUI;
|
||||
const judgeTask = this.judgeTask;
|
||||
const projectsObj: object = this.judgeUI.projectsObj
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const isUpload = currentProject.isUpload
|
||||
|
||||
//如果项目没有开始
|
||||
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
||||
if (!isUpload) {
|
||||
dConsole.info(JudgeTag, '项目补传开始')
|
||||
//项目开始补传
|
||||
judgeTask.addTask(async () => {
|
||||
await this.beginProject(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
judgeTask.addTask(async () => {
|
||||
await this.uploadProgressPhoto(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
currentProject.isUpload = true;
|
||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||
//扣分补传
|
||||
if (currentType == 2) {
|
||||
judgeTask.addTask(async () => {
|
||||
await this.pointsDedute(xmdm, kf!)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
}
|
||||
//扣分补传判断是否合格 不合格补传项目结束
|
||||
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
||||
judgeTask.addTask(async () => {
|
||||
await this.endProject(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
currentProject.isEnd = true;
|
||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||
}
|
||||
judgeTask.addTask(async () => {
|
||||
this.checkExamIsEnd()
|
||||
})
|
||||
return false;
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
private tempData?: PLCType
|
||||
//实时计算gps经纬度距离
|
||||
handDistance = async () => {
|
||||
@ -264,47 +360,40 @@ export default class Judge {
|
||||
AppStorage.setOrCreate('msgStr', plc)
|
||||
return tempData
|
||||
}
|
||||
// 处理udp plc信号
|
||||
handleUdp = async (msg: string) => {
|
||||
const stachArr = msg.split(',')
|
||||
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
||||
return
|
||||
}
|
||||
const gpsPart = msg.split("#END$GPS,")[1];
|
||||
const gpsStatus = gpsPart.split(",")[0];
|
||||
if (gpsStatus === "4") {
|
||||
dConsole.log(JudgeTag, "差分状态正常", gpsStatus)
|
||||
this.judgeUI.isDwztRight = true
|
||||
} else {
|
||||
dConsole.log(JudgeTag, "差分状态异常", gpsStatus)
|
||||
this.judgeUI.isDwztRight = false
|
||||
}
|
||||
this.judgeUI.isDwztRight
|
||||
const plcData = await this.getPlcData(msg);
|
||||
// 4.过程数据
|
||||
// await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(plcData))
|
||||
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
||||
// if (this.usbService.isWXUSBDevice) {
|
||||
// const str = await senorToWXDataStr(msg);
|
||||
// this.usbService.sendUSB(str)
|
||||
// }
|
||||
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
|
||||
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
|
||||
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
||||
//TODO 暂时关闭差分检测异常
|
||||
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
||||
if (!this.isExamEnd) {
|
||||
await examJudgeRealExam(plcData)
|
||||
}
|
||||
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
|
||||
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
||||
// TODO UPD缺失
|
||||
// const judgeUdp = globalThis.judgeUdp
|
||||
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
||||
// judgeUdp.send(bytes)
|
||||
// }
|
||||
// AppStorage.setOrCreate('udpIndex', udpIndex++)
|
||||
// 处理轨迹plc信号
|
||||
handleTrajectoryUdp = async (strArr: string[]) => {
|
||||
let num = 2;
|
||||
const judgeTimer = setInterval(async () => {
|
||||
const msgStr = strArr[num];
|
||||
if (msgStr == '') {
|
||||
dConsole.info(JudgeTag, '模拟数据考试结束')
|
||||
clearInterval(judgeTimer)
|
||||
this.checkExamIsEnd(true)
|
||||
return
|
||||
}
|
||||
const msg: PLCType = JSON.parse(strArr[num]);
|
||||
num++
|
||||
// 4.过程数据
|
||||
this.tempData = msg
|
||||
// this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
|
||||
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
|
||||
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
||||
this.plcData = msg
|
||||
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
||||
AppStorage.setOrCreate('msgStr', '')
|
||||
if (msg.method === 'examJudgeArtificialItem') {
|
||||
this.setJudgeItem(msg.itemno, msg.type)
|
||||
}
|
||||
if (msg.method === 'examJudgeArtificialMark') {
|
||||
this.setJudgeItem(msg.itemno, msg.serial)
|
||||
}
|
||||
await examJudgeRealExam(msg)
|
||||
// const bytes = await this.getMessageHeartbeat();
|
||||
// bytes && globalThis.judgeUdp.send(bytes)
|
||||
|
||||
}, 200)
|
||||
// TODO 定时器缺失
|
||||
// globalThis.judgeTimer = judgeTimer;
|
||||
}
|
||||
private isEndTip: boolean = false;
|
||||
//本地轨迹回放地址
|
||||
@ -324,32 +413,6 @@ export default class Judge {
|
||||
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
|
||||
}
|
||||
}
|
||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||
private lane: LANE = {
|
||||
road: '', num: 0, count: 0
|
||||
}
|
||||
private disConnectNum: number = 0;
|
||||
//调用监管接口
|
||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||
const temp = await writeObjectOut(data, filePath, this.context);
|
||||
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
|
||||
//断网&网络超时次数计算
|
||||
if (temp.code == 2300007 || temp.code == 2300028) {
|
||||
this.disConnectNum += 1;
|
||||
if (this.disConnectNum < 5) {
|
||||
return await this.sendWriteObjectOut(data, filePath)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.disConnectNum >= 5) {
|
||||
dConsole.info('surenjun', '123')
|
||||
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
||||
this.judgeUI.disConnectErrorOpen = true
|
||||
}
|
||||
|
||||
this.disConnectNum = 0
|
||||
return temp
|
||||
}
|
||||
// 项目开始接口同步
|
||||
beginProject = async (ksxm: number) => {
|
||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||
@ -453,6 +516,32 @@ export default class Judge {
|
||||
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
|
||||
dConsole.info(JudgeTag, '上传照片 end')
|
||||
}
|
||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||
private lane: LANE = {
|
||||
road: '', num: 0, count: 0
|
||||
}
|
||||
private disConnectNum: number = 0;
|
||||
//调用监管接口
|
||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||
const temp = await writeObjectOut(data, filePath, this.context);
|
||||
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
|
||||
//断网&网络超时次数计算
|
||||
if (temp.code == 2300007 || temp.code == 2300028) {
|
||||
this.disConnectNum += 1;
|
||||
if (this.disConnectNum < 5) {
|
||||
return await this.sendWriteObjectOut(data, filePath)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.disConnectNum >= 5) {
|
||||
dConsole.info('surenjun', '123')
|
||||
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
||||
this.judgeUI.disConnectErrorOpen = true
|
||||
}
|
||||
|
||||
this.disConnectNum = 0
|
||||
return temp
|
||||
}
|
||||
private videoData?: RecordHandleType
|
||||
//当前科目二的考试项目
|
||||
private deductedPopShowTimer: number = 0;
|
||||
@ -460,9 +549,6 @@ export default class Judge {
|
||||
checkExamIsEnd = async (isManual?: boolean) => {
|
||||
dConsole.log(JudgeTag, "校验考试是否结束")
|
||||
const judgeUI = this.judgeUI
|
||||
const avPlayer = this.avPlayer
|
||||
const isExamEnd = this.isExamEnd
|
||||
const isEndTip = this.isEndTip
|
||||
const isAllProjectsEnd = judgeUI.isAllProjectsEnd
|
||||
const examSubject = judgeUI.examSubject
|
||||
const singlePlay = judgeUI.singlePlay
|
||||
@ -472,8 +558,7 @@ export default class Judge {
|
||||
const passingScore = Number(judgeUI.passingScore)
|
||||
const jl = judgeUI.jl
|
||||
|
||||
if (isExamEnd) {
|
||||
|
||||
if (this.isExamEnd) {
|
||||
return
|
||||
}
|
||||
//及格分
|
||||
@ -493,12 +578,12 @@ export default class Judge {
|
||||
dConsole.info(JudgeTag + ' 单机模式结束 => ', isAllProjectsEnd)
|
||||
if (isAllProjectsEnd && jl >= examMileage) {
|
||||
//成绩合格
|
||||
if (totalScore >= passingGrade && !isEndTip) {
|
||||
if (totalScore >= passingGrade && !this.isEndTip) {
|
||||
if (examSubject == '3' && (param342 == 0 || param342 == 2) &&
|
||||
(param302 != 6 && param302 != 7 && param302 != 8)) {
|
||||
if (param512[7] != 0) {
|
||||
clearTimeout(this.deductedPopShowTimer)
|
||||
avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.judgeUI.isDeductedPopShow = true
|
||||
this.judgeUI.defaultTabIndex = 1
|
||||
this.isEndTip = true
|
||||
@ -520,12 +605,11 @@ export default class Judge {
|
||||
this.isExamEnd = true
|
||||
}
|
||||
} else {
|
||||
|
||||
//成绩不合格
|
||||
if (totalScore < passingGrade) {
|
||||
//科目三不合格报靠边停车
|
||||
if (examSubject == '3' && param302 == 1) {
|
||||
avPlayer?.playAudio([`voice/考试结束.mp3`]);
|
||||
this.avPlayer?.playAudio([`voice/考试结束.mp3`]);
|
||||
return
|
||||
}
|
||||
await examJudgeEndExam()
|
||||
@ -534,7 +618,7 @@ export default class Judge {
|
||||
}
|
||||
|
||||
//成绩合格
|
||||
if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) {
|
||||
if (isAllProjectsEnd && totalScore >= passingGrade && !this.isEndTip) {
|
||||
if (examSubject == '2') {
|
||||
await examJudgeEndExam()
|
||||
this.isExamEnd = true
|
||||
@ -558,7 +642,7 @@ export default class Judge {
|
||||
if (param512[7] != 0) {
|
||||
clearTimeout(this.deductedPopShowTimer)
|
||||
this.judgeUI.isDeductedPopShow = false
|
||||
avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.judgeUI.isDeductedPopShow = true
|
||||
this.judgeUI.defaultTabIndex = 1
|
||||
this.isEndTip = true
|
||||
@ -571,95 +655,6 @@ export default class Judge {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 检测扣分、结束项目时该项目是否开始
|
||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
||||
if (xmdm == 20) {
|
||||
return true
|
||||
}
|
||||
const judgeUI = this.judgeUI;
|
||||
const judgeTask = this.judgeTask;
|
||||
const projectsObj: object = this.judgeUI.projectsObj
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const isUpload = currentProject.isUpload
|
||||
|
||||
//如果项目没有开始
|
||||
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
||||
if (!isUpload) {
|
||||
dConsole.info(JudgeTag, '项目补传开始')
|
||||
//项目开始补传
|
||||
judgeTask.addTask(async () => {
|
||||
await this.beginProject(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
judgeTask.addTask(async () => {
|
||||
await this.uploadProgressPhoto(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
currentProject.isUpload = true;
|
||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||
//扣分补传
|
||||
if (currentType == 2) {
|
||||
judgeTask.addTask(async () => {
|
||||
await this.pointsDedute(xmdm, kf!)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
}
|
||||
//扣分补传判断是否合格 不合格补传项目结束
|
||||
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
||||
judgeTask.addTask(async () => {
|
||||
await this.endProject(xmdm)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
currentProject.isEnd = true;
|
||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||
}
|
||||
judgeTask.addTask(async () => {
|
||||
this.checkExamIsEnd()
|
||||
})
|
||||
return false;
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// 处理轨迹plc信号
|
||||
handleTrajectoryUdp = async (strArr: string[]) => {
|
||||
let num = 2;
|
||||
const judgeTimer = setInterval(async () => {
|
||||
const msgStr = strArr[num];
|
||||
if (msgStr == '') {
|
||||
dConsole.info(JudgeTag, '模拟数据考试结束')
|
||||
clearInterval(judgeTimer)
|
||||
this.checkExamIsEnd(true)
|
||||
return
|
||||
}
|
||||
const msg: PLCType = JSON.parse(strArr[num]);
|
||||
num++
|
||||
// 4.过程数据
|
||||
this.tempData = msg
|
||||
// this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
|
||||
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
|
||||
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
||||
this.plcData = msg
|
||||
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
||||
AppStorage.setOrCreate('msgStr', '')
|
||||
if (msg.method === 'examJudgeArtificialItem') {
|
||||
this.setJudgeItem(msg.itemno, msg.type)
|
||||
}
|
||||
if (msg.method === 'examJudgeArtificialMark') {
|
||||
this.setJudgeItem(msg.itemno, msg.serial)
|
||||
}
|
||||
await examJudgeRealExam(msg)
|
||||
// const bytes = await this.getMessageHeartbeat();
|
||||
// bytes && globalThis.judgeUdp.send(bytes)
|
||||
|
||||
}, 200)
|
||||
// TODO 定时器缺失
|
||||
// globalThis.judgeTimer = judgeTimer;
|
||||
}
|
||||
|
||||
constructor(judgeUI: JudgeUI) {
|
||||
this.serialIndex = 1;
|
||||
@ -775,7 +770,6 @@ export default class Judge {
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
const sczb = currentParams.sczb;
|
||||
const kfdm = currentParams.kfdm;
|
||||
const isExam = this.isExam;
|
||||
const judgeUI = this.judgeUI
|
||||
|
||||
const projects = judgeUI.projects
|
||||
@ -809,7 +803,7 @@ export default class Judge {
|
||||
const beginInfo: JudgeBeginObj = {
|
||||
kgid: '012',
|
||||
kgxm: decodeURI(examinerName || ''),
|
||||
exam: isExam ? 1 : 0,
|
||||
exam: this.isExam ? 1 : 0,
|
||||
//是否回放
|
||||
replay: 0,
|
||||
//生成的轨迹文件
|
||||
@ -848,14 +842,7 @@ export default class Judge {
|
||||
//处理评判过程回调
|
||||
handleRealExam = async (strData: string, callBack: Function) => {
|
||||
let examData: JudgeCallBackData = JSON.parse(strData);
|
||||
|
||||
const getDqxmStr = this.getDqxmStr;
|
||||
const getKfStr = this.getKfStr;
|
||||
const goJudgeVoice = this.goJudgeVoice;
|
||||
const setMndg = this.setMndg;
|
||||
const avPlayer = this.avPlayer;
|
||||
const judgeUI = this.judgeUI;
|
||||
|
||||
const carzt = examData.carzt
|
||||
const xmks = examData.xmks
|
||||
const kf = examData.kf
|
||||
@ -1020,7 +1007,6 @@ export default class Judge {
|
||||
const xmxh = precast.xmxh
|
||||
|
||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||
// const projectCode = project.projectCode
|
||||
const xmmcCode: string = judgeUI.projectsObj[xmdm].projectCodeCenter;
|
||||
const xmmcSingleCode: string = judgeUI.projectsObj[xmdm].projectCode;
|
||||
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
||||
@ -1058,7 +1044,6 @@ export default class Judge {
|
||||
}
|
||||
// 更改考试状态
|
||||
goVoiceAnnounce = async (event: number, xmdm: number, kf: MarkRule[], xmjs: JudgeXMJS, ksjs: JudgeKSJS, xmxh: string) => {
|
||||
|
||||
const beginProject = this.beginProject
|
||||
const pointsDedute = this.pointsDedute
|
||||
const endProject = this.endProject
|
||||
@ -1069,13 +1054,10 @@ export default class Judge {
|
||||
const judgeUI = this.judgeUI
|
||||
const checkExamIsEnd = this.checkExamIsEnd
|
||||
const checkProjectIsStart = this.checkProjectIsStart
|
||||
const lane = this.lane
|
||||
|
||||
const projectsObj: object = judgeUI.projectsObj
|
||||
const judgeConfigObj: object = judgeUI.judgeConfigObj
|
||||
const examSubject = judgeUI.examSubject
|
||||
const jl = judgeUI.jl
|
||||
const isAllProjectsEnd = judgeUI.isAllProjectsEnd
|
||||
|
||||
const kfLen = kf.length;
|
||||
//不报语音的项目列表
|
||||
@ -1117,12 +1099,7 @@ export default class Judge {
|
||||
// 项目结束
|
||||
case 2: {
|
||||
const project: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const endCode = project.projectCodeCenter;
|
||||
const projectIsEnd = project.isEnd;
|
||||
// const endKmCode = getKmProjectVoice(endCode, 2, judgeConfigObj, lane, xmxh)
|
||||
// if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) {
|
||||
// endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`])
|
||||
// }
|
||||
const isStart = await this.checkProjectIsStart(xmdm, 1);
|
||||
if (isStart) {
|
||||
//项目结束了就不再生成数据
|
||||
@ -1207,13 +1184,8 @@ export default class Judge {
|
||||
pointsDedute = async (ksxm: number, kf: MarkRule) => {
|
||||
const carInfo = AppStorage.get<CarInfoType>('carInfo')!;
|
||||
const examSubject = carInfo.examSubject
|
||||
// const plateNo = carInfo.plateNo
|
||||
// const carNo = carInfo.carNo
|
||||
|
||||
const judgeUI = this.judgeUI
|
||||
// const getProjectInfo = this.getProjectInfo
|
||||
// const fileLog = this.fileLog
|
||||
// const xmmcSingleCode = this.xmmcSingleCode
|
||||
const xmmcEndCode = this.xmmcEndCode
|
||||
const filePath = this.filePath
|
||||
|
||||
@ -1289,12 +1261,11 @@ export default class Judge {
|
||||
}
|
||||
// 评判语音提示
|
||||
goJudgeVoice = async (sound: JudgeSound) => {
|
||||
const avPlayer = this.avPlayer
|
||||
// const fileLog = this.fileLog
|
||||
dConsole.info('surenjun code=>', JSON.stringify(sound.code))
|
||||
//判断是不是模拟灯光语音
|
||||
if (sound.type == 1) {
|
||||
avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => {
|
||||
this.avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => {
|
||||
examJudgeSoundEnd({
|
||||
xmdm: sound.xmdm, code: sound.code[0], type: sound.type
|
||||
})
|
||||
@ -1312,7 +1283,7 @@ export default class Judge {
|
||||
}))
|
||||
})
|
||||
} else {
|
||||
avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`])
|
||||
this.avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`])
|
||||
}
|
||||
}
|
||||
// 处理考试结束
|
||||
@ -1328,9 +1299,7 @@ export default class Judge {
|
||||
const judgeUI = this.judgeUI
|
||||
const endExam = this.endExam
|
||||
const handleSEP = this.handleSEP
|
||||
const kfArr = this.kfArr
|
||||
const avPlayer = this.avPlayer
|
||||
const judgeTask = this.judgeTask
|
||||
const isManual = this.isManual
|
||||
|
||||
const judgeConfigObj = judgeUI.judgeConfigObj
|
||||
@ -1583,123 +1552,6 @@ export default class Judge {
|
||||
kfxh: thisMark.kfxh
|
||||
}
|
||||
}
|
||||
// 消息心跳发送
|
||||
// getMessageHeartbeat = async (isEnd?: Boolean) => {
|
||||
// const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||
// const { examSubject, plateNo, ksyh } = carInfo;
|
||||
// const {
|
||||
// judgeUI,
|
||||
// isExam,
|
||||
// serialIndex,
|
||||
// tempData,
|
||||
// xmmcCode,
|
||||
// xmxh,
|
||||
// xmmcSingleCode,
|
||||
// xmdm,
|
||||
// performInfo,
|
||||
// kfArr,
|
||||
// getTranslateProject,
|
||||
// getSbxh,
|
||||
// fileLog,
|
||||
// } = this;
|
||||
// const singlePlay = AppStorage.get<boolean>('singlePlay')
|
||||
// const { lsh, startHourTime, totalScore, examTime, judgeConfigObj } = judgeUI;
|
||||
// const {
|
||||
// fourInOneScreen:{
|
||||
// gpsDigit
|
||||
// }
|
||||
// } = judgeConfig
|
||||
// const examType = examSubject == 2 ? 2 : 3
|
||||
// const { sensor, gps } = tempData;
|
||||
// if (tempData.sensor === undefined) {
|
||||
// return
|
||||
// }
|
||||
// const { zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, ygq, cs, fdjzs, dw } = sensor
|
||||
// const { jd, wd, hxj, fyj, hbg, sd } = gps;
|
||||
//
|
||||
// //过滤错误数据
|
||||
// if (jd == 0) {
|
||||
// return
|
||||
// }
|
||||
// const translateProject = getTranslateProject();
|
||||
// const sbxh = getSbxh(xmdm, xmxh)
|
||||
// const { carzt, dcjl, qjjl, dxjl, bxjl } = performInfo || {};
|
||||
// const asclshArr = StringToASCII(
|
||||
// fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13)
|
||||
// );
|
||||
// //13不足要补0
|
||||
// const ascksyhArr = StringToASCII(fillZero(ksyh || 0, 13))
|
||||
// const ascsbxhArr = StringToASCII(sbxh)
|
||||
// const translateSignals = getTranslateSignals(
|
||||
// [zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd].concat(getDwStatusType(dw))
|
||||
// .concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0])
|
||||
// )
|
||||
// const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit);
|
||||
// const translateWd = convertGpsCoord2(jd).toFixed(gpsDigit) * Math.pow(10, gpsDigit)
|
||||
// const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0])
|
||||
//
|
||||
// let tempSd = ((judgeConfigObj['350'] == 0 ? sd : cs) * 1.852).toFixed(0) * 1
|
||||
// if (tempSd < 1) {
|
||||
// tempSd = 0
|
||||
// }
|
||||
//
|
||||
// const arr = [
|
||||
// //考生号
|
||||
// asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
|
||||
// //考试员号
|
||||
// ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
|
||||
// //科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间
|
||||
// string2Bytes(`${examType}${AppStorage.get('startHourTime') || startHourTime}`, 4 * 8),
|
||||
// // TODO 消息序号从1开始,0结束
|
||||
// string2Bytes(isEnd ? 0 : serialIndex, 2 * 8),
|
||||
// /*左向灯 右向灯 双跳灯 远光灯 近光灯 视宽灯 点火1 点火2 离合器 脚刹 手刹 副刹 喇叭 门开关 安全带 档位 车辆状态 雨刮器 雾灯 0*/
|
||||
// translateSignals,
|
||||
// //速度 发动机转速 GPS纬度 GPS经度 主天线位置
|
||||
// string2Bytes(tempSd * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8),
|
||||
// string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
|
||||
// //GPS东向距离
|
||||
// string2Bytes(dxjl < 0 ? (dxjl + 4294967296) : dxjl, 4 * 8),
|
||||
// //GPS北向距离
|
||||
// string2Bytes(bxjl < 0 ? (bxjl + 4294967296) : bxjl, 4 * 8),
|
||||
// //航向角 俯仰角 高程(海拔)
|
||||
// string2Bytes((hxj) * 100, 2 * 8), string2Bytes(fyj * 100, 2 * 8), string2Bytes(hbg * 100, 4 * 8),
|
||||
// //项目状态 parseInt('01010010',2) 二进制转成10进制
|
||||
// translateProjects,
|
||||
// //当前项目编号
|
||||
// string2Bytes(xmmcSingleCode ? (xmmcSingleCode * 1 + 1) : 0, 8),
|
||||
// //场地设备编号
|
||||
// ascsbxhArr.map(sbxh => string2Bytes(sbxh, 8)[0]),
|
||||
// //本次考试行驶距离
|
||||
// string2Bytes(Math.floor((dcjl + qjjl) / 100), 2 * 8),
|
||||
// //扣分
|
||||
// string2Bytes(100 - Math.abs(totalScore), 2 * 8),
|
||||
// //扣分项数量
|
||||
// string2Bytes(kfArr.length, 8),
|
||||
// //n个扣分序号
|
||||
// kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0]),
|
||||
// //TODO 牵引车第二gps精度、纬度
|
||||
// string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8),
|
||||
// //TODO 牵引车第二航向角
|
||||
// string2Bytes(0, 2 * 8),
|
||||
// //TODO 摩托压线 Byte[20],
|
||||
// string2Bytes(0, 20 * 8),
|
||||
// //考试用时
|
||||
// string2Bytes(examTime, 4 * 8),
|
||||
// //TODO 项目用时
|
||||
// string2Bytes(fillZero(0, 2), 2 * 8),
|
||||
// //TODO 设备信号状态
|
||||
// string2Bytes(0, 4 * 8),
|
||||
// ]
|
||||
//
|
||||
// let tempArr = [];
|
||||
// arr.forEach(itemArr => {
|
||||
// tempArr = tempArr.concat(itemArr)
|
||||
// })
|
||||
// this.serialIndex += 1;
|
||||
// fileLog.setFourAndOneLogData(`${lsh},${ksyh},${examType}${AppStorage.get('startHourTime') || startHourTime},`);
|
||||
// fileLog.setFourAndOneLogDataBytes(tempArr.toString());
|
||||
// return Array2Byte(tempArr)
|
||||
// }
|
||||
//获取场地序号
|
||||
getSbxh: GetgSbbm = (ksxm, xmxh) => {
|
||||
const judgeUI = this.judgeUI;
|
||||
@ -1713,7 +1565,6 @@ export default class Judge {
|
||||
return '0000000000'
|
||||
}
|
||||
const projectKey = `${ksxm}_${xmxh}`;
|
||||
// const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) || {}
|
||||
const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj, projectKey) ?? {} as CDSBInfo;
|
||||
const sbxh: string = currentCdsb.sbbh || '0000000000'
|
||||
return sbxh
|
||||
@ -1927,17 +1778,6 @@ export default class Judge {
|
||||
this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, this.context)
|
||||
}
|
||||
|
||||
// if(examSubject == 3){
|
||||
// //不做模拟灯光,需要做上车准备 =>(请上车准备)
|
||||
// if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){
|
||||
// avPlayer.playAudio(['voice/上车准备.mp3'])
|
||||
// }
|
||||
// //不做模拟灯光,不做上车准备 =>(请起步,完成考试)
|
||||
// if(projectsObj[41]?.type == 3 && projectsObj[1]?.type == 3){
|
||||
// avPlayer.playAudio(['voice/402001.mp3'])
|
||||
// }
|
||||
// }
|
||||
|
||||
this.judgeUI.draw = true
|
||||
// 处理轨迹plc信息
|
||||
if (isTrajectoryOpen) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user