fix: 解决评判一个问题
This commit is contained in:
		
							parent
							
								
									ffe0dfd695
								
							
						
					
					
						commit
						c3a27f6a87
					
				| @ -22,7 +22,7 @@ export default struct BottomMessageComponent { | ||||
|       .onClick(() => { | ||||
|         //   点击五次 | ||||
|         this.count++ | ||||
|         if (this.count >= 5) { | ||||
|         if (this.count >= 3) { | ||||
|           this.versionClick && this.versionClick() | ||||
|           this.count = 0 | ||||
|         } | ||||
|  | ||||
| @ -410,7 +410,7 @@ struct JudgePage { | ||||
|       //获取当前考车的考试项目 | ||||
|       if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") { | ||||
|         allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '') | ||||
|         dConsole.info(JudgeTag, 'surenjun', JSON.stringify(allItems)) | ||||
|         dConsole.info(JudgeTag, '考试项目', allItems) | ||||
|       } | ||||
|       if ( | ||||
|       //科目二获取项目 | ||||
|  | ||||
| @ -12,15 +12,17 @@ const lBg = $rawfile('judge/km3/road/luxian_nor.png'); | ||||
| @Entry | ||||
| @Component | ||||
| struct RoadsPage { | ||||
|   @State roadObj: number[] = []; | ||||
|   @State roadArr: number[] = []; | ||||
| 
 | ||||
|   async aboutToAppear() { | ||||
|     //读取systemparam表的no1等于4的 | ||||
|     //读取MA_SYSTEMPARM表的no1等于4的 然后根据no2去重 | ||||
|     const systemParms: Array<MASYSTEMPARMType> = await GetSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[]; | ||||
|     dConsole.log(RoadsTag, systemParms) | ||||
|     systemParms.forEach((systemParm: MASYSTEMPARMType) => { | ||||
|       if (systemParm.no1.toString() === "4") { | ||||
|         this.roadObj.push(systemParm.no2) | ||||
|         if (!this.roadArr.includes(systemParm.no2)) { | ||||
|           this.roadArr.push(systemParm.no2); | ||||
|         } | ||||
|       } | ||||
|     }) | ||||
|   } | ||||
| @ -64,11 +66,11 @@ struct RoadsPage { | ||||
|           .height(220) | ||||
|           .margin({ left: 5, bottom: 10 }) | ||||
|           .onClick(async () => { | ||||
|             const wayno = this.roadObj[Math.floor(Math.random() * this.roadObj.length)]; | ||||
|             const wayno = this.roadArr[Math.floor(Math.random() * this.roadArr.length)]; | ||||
|             this.goJudge(wayno) | ||||
|           }) | ||||
| 
 | ||||
|           ForEach(this.roadObj, (item: number) => { | ||||
|           ForEach(this.roadArr, (item: number) => { | ||||
|             ListItem() { | ||||
|               Column() { | ||||
|                 Row() { | ||||
|  | ||||
| @ -50,6 +50,7 @@ import { | ||||
|   RouteParamsType, | ||||
|   TKmItem, | ||||
|   User, | ||||
|   WorkerBackMessage, | ||||
|   WR | ||||
| } from '../../model'; | ||||
| import { DrivingDataStorage } from '../../utils/business/DrivingDataStorage'; | ||||
| @ -182,6 +183,37 @@ 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 plcData = await this.getPlcData(msg); | ||||
|     // 4.过程数据 | ||||
|     await this.fileLog?.setExamJudgeData(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服务序列号 | ||||
| @ -228,60 +260,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 () => { | ||||
| @ -445,38 +423,6 @@ export default class Judge { | ||||
|     AppStorage.setOrCreate('msgStr', plc) | ||||
|     return tempData | ||||
|   } | ||||
|   // 处理udp plc信号 | ||||
|   handleUdp = async (msg: string) => { | ||||
|     dConsole.info(JudgeTag, 'plc信号', msg) | ||||
|     const stachArr = msg.split(',') | ||||
|     if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { | ||||
|       return | ||||
|     } | ||||
|     const plcData = await this.getPlcData(msg); | ||||
|     // 4.过程数据 | ||||
|     await this.fileLog?.setExamJudgeData(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[]) => { | ||||
|     // const { fileLog, setJudgeItem, setJudgeMark, endExam } = this; | ||||
| @ -515,9 +461,9 @@ export default class Judge { | ||||
|   } | ||||
|   //本地轨迹回放地址 | ||||
|   private trajectoryPath: string | ||||
|   //当前科目二的考试项目 | ||||
|   // private currentKm2ItemsObj: any | ||||
|   private isTrajectoryOpen: boolean; | ||||
|   //当前科目二的考试项目 | ||||
|   // 调代理接口是否断网了 | ||||
|   private isJudgeDisConnect: boolean = false; | ||||
|   // 断网数据补传 | ||||
| @ -532,6 +478,87 @@ export default class Judge { | ||||
|       const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context); | ||||
|     } | ||||
|   } | ||||
|   // 检测扣分、结束项目时该项目是否开始 | ||||
|   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 artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] | ||||
|   private lane: LANE = { | ||||
|     road: '', num: 0, count: 0 | ||||
|   } | ||||
|   private videoData?: RecordHandleType | ||||
|   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'); | ||||
| @ -601,33 +628,6 @@ export default class Judge { | ||||
|     dConsole.info(JudgeTag, '项目结束 end') | ||||
|     UploadRegulatoryCodeConversion('17C55', temp.code || 0) | ||||
|   } | ||||
|   private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] | ||||
|   private lane: LANE = { | ||||
|     road: '', num: 0, count: 0 | ||||
|   } | ||||
|   private videoData?: RecordHandleType | ||||
|   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 | ||||
|   } | ||||
|   // 考试过程照片 | ||||
|   uploadProgressPhoto = async (ksxm: number) => { | ||||
|     const time = GetCurrentTime(); | ||||
| @ -1056,6 +1056,7 @@ export default class Judge { | ||||
|       judgeUI.projectsObj = DeepClone(copyProjectsObj); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 更改考试状态 | ||||
|   goVoiceAnnounce = | ||||
|     async (event: number, xmdm: number, kf: MarkRule[], xmjs: JudgeXMJS, ksjs: JudgeKSJS, xmxh: string) => { | ||||
| @ -1160,7 +1161,7 @@ export default class Judge { | ||||
| 
 | ||||
|       // 扣分 | ||||
|         case 3: | ||||
|           dConsole.info('surenjun', '扣分开始') | ||||
|           dConsole.info(JudgeTag, 'surenjun', '扣分开始') | ||||
|         //扣分时实时播报语音(0-否+1-是) | ||||
|           const currentKf = kf[kfLen -1]; | ||||
|           if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') || | ||||
| @ -1950,7 +1951,10 @@ export default class Judge { | ||||
|     // 处理实时udp里的plc信号 | ||||
|     DifferentialAndSignal.onMsg((data: string) => { | ||||
|       dConsole.info(JudgeTag, 'socketTag[PLC.UdpClient]', '收到udp回调数据') | ||||
|       handleUdp(data) | ||||
|       const result: WorkerBackMessage = JSON.parse(data) | ||||
|       if (result.type === "obtainUdpData") { | ||||
|         handleUdp(result.data as string) | ||||
|       } | ||||
|       //TODO UDP修改 | ||||
|       //   const udpIndex = globalThis.udpIndex; | ||||
|       //   if (udpIndex % 5 === 0) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user