fix:过程数据方法补全部分

This commit is contained in:
wangzhongjie 2025-07-16 11:28:44 +08:00
parent 4832904345
commit 5bf2990a2c

View File

@ -230,60 +230,6 @@ 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 () => {
@ -312,6 +258,26 @@ export default class Judge {
//所有的科目考试项目(大车&小车)
private kmItems: JudgeConfigObjKmItems
private plcData?: PLCType
// 获取plc数据
getPlcData = async (plc: string) => {
await this.fileLog?.setPlcProgressData(plc)
//plc字符串转化成评判初始化数据
const tempData = await PlcStrToJson(plc);
//模拟灯光回放时刻
tempData.sensor.rmndg = this.rmndg;
//模拟灯灯光灯光项目
tempData.sensor.mndg = this.mndgStr || "";
//plc字符串转化成无锡所过程数据
const wuXiDataStr = await PlcStrToWXJson(plc)
this.plcData = tempData
await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr)
this.tempData = tempData
this.plcStr = plc;
this.mndgStr = '';
this.rmndg = 0;
AppStorage.setOrCreate('msgStr', plc)
return tempData
}
// 处理udp plc信号
handleUdp = async (msg: string) => {
const stachArr = msg.split(',')
@ -343,25 +309,24 @@ export default class Judge {
// }
// AppStorage.setOrCreate('udpIndex', udpIndex++)
}
// 获取plc数据
getPlcData = async (plc: string) => {
await this.fileLog?.setPlcProgressData(plc)
//plc字符串转化成评判初始化数据
const tempData = await PlcStrToJson(plc);
//模拟灯光回放时刻
tempData.sensor.rmndg = this.rmndg;
//模拟灯灯光灯光项目
tempData.sensor.mndg = this.mndgStr || "";
//plc字符串转化成无锡所过程数据
const wuXiDataStr = await PlcStrToWXJson(plc)
this.plcData = tempData
await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr)
this.tempData = tempData
this.plcStr = plc;
this.mndgStr = '';
this.rmndg = 0;
AppStorage.setOrCreate('msgStr', plc)
return tempData
private isEndTip: boolean = false;
//本地轨迹回放地址
private trajectoryPath: string
// private currentKm2ItemsObj: any
private isTrajectoryOpen: boolean;
// 调代理接口是否断网了
private isJudgeDisConnect: boolean = false;
// 断网数据补传
uploadDisConnectData = async () => {
if (!this.isJudgeDisConnect) {
return
}
const folderPath = this.fileLog?.folderPath
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
const examDataArr = examDataStr.split('\n');
for (let examDataStr of examDataArr) {
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
}
}
// 处理轨迹plc信号
handleTrajectoryUdp = async (strArr: string[]) => {
@ -398,25 +363,6 @@ export default class Judge {
// TODO 定时器缺失
// globalThis.judgeTimer = judgeTimer;
}
private isEndTip: boolean = false;
//本地轨迹回放地址
private trajectoryPath: string
// private currentKm2ItemsObj: any
private isTrajectoryOpen: boolean;
// 调代理接口是否断网了
private isJudgeDisConnect: boolean = false;
// 断网数据补传
uploadDisConnectData = async () => {
if (!this.isJudgeDisConnect) {
return
}
const folderPath = this.fileLog?.folderPath
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
const examDataArr = examDataStr.split('\n');
for (let examDataStr of examDataArr) {
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
}
}
// 校验考试是否结束
checkExamIsEnd = async (isManual?: boolean) => {
dConsole.log(JudgeTag, "校验考试是否结束")
@ -532,14 +478,87 @@ export default class Judge {
}
}
}
//当前科目二的考试项目
private deductedPopShowTimer: 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 artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
private lane: LANE = {
road: '', num: 0, count: 0
}
private videoData?: RecordHandleType
private disConnectNum: number = 0;
// 检测扣分、结束项目时该项目是否开始
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
}
}
// 项目开始接口同步
beginProject = async (ksxm: number) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo');
@ -643,27 +662,8 @@ export default class Judge {
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
dConsole.info(JudgeTag, '上传照片 end')
}
//调用监管接口
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 deductedPopShowTimer: number = 0;
constructor(judgeUI: JudgeUI) {
this.serialIndex = 1;