fix: 评判日志
This commit is contained in:
		
							parent
							
								
									d21cd896c9
								
							
						
					
					
						commit
						a7bd343904
					
				| @ -44,3 +44,6 @@ export const CommonFileTag = '[CommonFile]'; | ||||
| 
 | ||||
| //首页 | ||||
| export const HomeTag = '[Home]'; | ||||
| 
 | ||||
| //judge | ||||
| export const JudgeTag = '[Judge]'; | ||||
| @ -9,7 +9,7 @@ import Judge from './judgeSDK/judge'; | ||||
| import { uploadExamMileage } from '../api/judge'; | ||||
| import DwztErrorPopup from './compontents/judge/DwztErrorPopup'; | ||||
| import MsgPopup from './compontents/judge/MsgPopup'; | ||||
| import { JudgeConfig } from '../config'; | ||||
| import { JudgeConfig, JudgeTag } from '../config'; | ||||
| 
 | ||||
| import { | ||||
|   AmplifyItem, | ||||
| @ -54,7 +54,7 @@ import { DefaultJudgeConfigData } from '../mock'; | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| struct Index { | ||||
| struct JudgePage { | ||||
|   scroller: Scroller = new Scroller() | ||||
|   //页面通用字体大小 | ||||
|   @State wayno: number = 0 | ||||
| @ -221,7 +221,7 @@ struct Index { | ||||
|     const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO") | ||||
|     const carInfo = result[0] || {}; | ||||
|     this.carName = decodeURI(carInfo.carclass!) | ||||
|     console.log("查看carType", carInfo.cartype) | ||||
|     console.log(JudgeTag, "查看carType", carInfo.cartype) | ||||
|     this.carType = carInfo.kscx! | ||||
|     this.carinfoArr.push({ | ||||
|       CARID: carInfo.carid!, | ||||
| @ -234,7 +234,7 @@ struct Index { | ||||
|       BK1: carInfo.bk1!, | ||||
|       BK2: carInfo.bk2!, | ||||
|     }) | ||||
|     console.info('surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr)) | ||||
|     console.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr)) | ||||
|   } | ||||
| 
 | ||||
|   // 获取考生信息 | ||||
| @ -285,7 +285,7 @@ struct Index { | ||||
|   async initSysset(sysset?: SYSSET[]) { | ||||
|     const syssetParams: SYSSET[] | MASYSSETTableType[] = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET') | ||||
|     const serialNumberArr = (syssetParams as SYSSET[]).filter(sys => sys.v_no === '901'); | ||||
|     console.info('surenjun serialNumberArr' + JSON.stringify(serialNumberArr)) | ||||
|     console.info(JudgeTag, 'surenjun serialNumberArr' + JSON.stringify(serialNumberArr)) | ||||
|     this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || ''; | ||||
|     // const { isTrajectoryOpen } = judgeConfig | ||||
|     const syssetJudgeConfigArr: SyssetConfig[] = [] | ||||
| @ -369,7 +369,7 @@ struct Index { | ||||
|     } | ||||
|     //真实监管下发的项目 | ||||
|     let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); | ||||
|     console.info('surenjun kStringArr', JSON.stringify(kStringArr)) | ||||
|     console.info(JudgeTag, 'surenjun kStringArr', JSON.stringify(kStringArr)) | ||||
|     let isInExam = kStringArr.length > 0; | ||||
|     // const { isTrajectoryOpen } = judgeConfig | ||||
|     let carNo = '', allItems: string[] = []; | ||||
| @ -409,7 +409,7 @@ struct Index { | ||||
|       //获取当前考车的考试项目 | ||||
|       if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") { | ||||
|         allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '') | ||||
|         console.info('surenjun', JSON.stringify(allItems)) | ||||
|         console.info(JudgeTag, 'surenjun', JSON.stringify(allItems)) | ||||
|       } | ||||
|       if ( | ||||
|       //科目二获取项目 | ||||
| @ -438,8 +438,8 @@ struct Index { | ||||
|         const no2Num = Number(systemParm.no2) | ||||
|         //真实监管下发考试项目 | ||||
|         if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) { | ||||
|           console.info('surenjun =>', txt2) | ||||
|           console.info('surenjun => no2', systemParm.no2) | ||||
|           console.info(JudgeTag, 'surenjun =>', txt2) | ||||
|           console.info(JudgeTag, 'surenjun => no2', systemParm.no2) | ||||
|           currentProject.type = '3' | ||||
|           currentProject.isUpload = true | ||||
|           currentProject.isEnd = true | ||||
| @ -460,7 +460,7 @@ struct Index { | ||||
|       }) | ||||
|     }) | ||||
|     const projects = this.projects; | ||||
|     console.info('surenjun', JSON.stringify(this.ddxkKsxmArr)) | ||||
|     console.info(JudgeTag, 'surenjun', JSON.stringify(this.ddxkKsxmArr)) | ||||
| 
 | ||||
|     if (!projects.length) { | ||||
|       Prompt.showToast({ | ||||
| @ -538,7 +538,7 @@ struct Index { | ||||
|       const examItems: string | undefined = currentParams?.examItems; | ||||
|       // 2024-01-03 16:29:26;0;20300,;2,4^2,4;null; | ||||
|       if (examItems !== '' && examItems !== undefined) { | ||||
|         console.info('surenjun examItems=>', JSON.stringify(examItems)) | ||||
|         console.info(JudgeTag, 'surenjun examItems=>', JSON.stringify(examItems)) | ||||
|         const examItemsArrs = examItems.split(';'); | ||||
|         const startTime = examItemsArrs[0] | ||||
|         const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || [] | ||||
| @ -1199,7 +1199,7 @@ struct Index { | ||||
| 
 | ||||
|     const projectCode = artSubject3ProjectsCodesArr[index] | ||||
|     if (index === 5) { | ||||
|       console.info('surenjun 靠边停车状态=> ', getIsExitManualProject(index)) | ||||
|       console.info(JudgeTag, 'surenjun 靠边停车状态=> ', getIsExitManualProject(index)) | ||||
|     } | ||||
|     const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) | ||||
|     if (getIsExitManualProject(index)) { | ||||
| @ -1222,7 +1222,7 @@ struct Index { | ||||
|         if (xmmcStr == '无' || xmmcStr == '') { | ||||
|           //512[6] 人工项目按钮放大确认 | ||||
|           const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(','); | ||||
|           console.info('surenjun', param512) | ||||
|           console.info(JudgeTag, 'surenjun', param512) | ||||
|           if (param512[6] !== '0') { | ||||
|             this.amplifiedImgIndex = index; | ||||
|             this.isAmplifyPopShow = true | ||||
| @ -1425,4 +1425,3 @@ struct Index { | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export const JudgePage = Index | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import systemTime from '@ohos.systemDateTime'; | ||||
| import { TestRealExam } from '../../mock'; | ||||
| import { CarInfoType, DefaultJudgeConfigObj, ExtendType, Gps, LANE, PLCType, Radar, Vision } from '../../model'; | ||||
| import { CarInfoType, ExtendType, Gps, LANE, PLCType, Radar, Vision } from '../../model'; | ||||
| import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common'; | ||||
| import dayTs from '../../utils/Date'; | ||||
| 
 | ||||
| @ -703,30 +703,3 @@ export function sendRed() { | ||||
|   const arrRedBuffer = ArrayToByteArray(arrRed).buffer | ||||
|   // globalThis.lightLineUdp.send(arrRedBuffer); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| export const defaultJudgeConfigObj: DefaultJudgeConfigObj = { | ||||
|   //结束考试方式 0-不合格继续 1-考试不合格报靠边停车 2-不合格不报靠边 3-训练不合格报靠边 4-自动退出 5-不合格自动退出 | ||||
|   param_302: '5', | ||||
|   param_332: '', | ||||
|   //是否能进行人工操作 0-不能人工评判 1-不能人工进项目 3-都不能 | ||||
|   param_342: '', | ||||
|   //有项目未结束时可以靠边停车 0-否 1-是 | ||||
|   param_343: '1', | ||||
|   //考试未结束且有扣分,是否可以退出 | ||||
|   param_344: '0', | ||||
|   //直线行驶中是否可以进其它项目 0-否 1-是 | ||||
|   param_348: '0', | ||||
|   //车上是否能点结束考试 0:否 1:是 | ||||
|   param_353: '0', | ||||
|   //是否启动断电续考    0:否 1:是 | ||||
|   param_369: '1', | ||||
|   //是否显示应考里程 | ||||
|   param_375: '0', | ||||
|   //里程不够允许手工点靠边停车 | ||||
|   param_387: '0', | ||||
|   //监管模式有扣分续考(0-否++1-是+把上次未考完的扣分带下来重新考试) | ||||
|   param_432: '1' | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -9,7 +9,7 @@ import FileModel from './utils/fileModel'; | ||||
| import FilePhoto from './utils/filePhoto'; | ||||
| import FileLog from './utils/fileLog'; | ||||
| import JudgeTask from './utils/judgeTask'; | ||||
| import { JudgeConfig } from '../../config'; | ||||
| import { JudgeConfig, JudgeTag } from '../../config'; | ||||
| import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation'; | ||||
| 
 | ||||
| import { uploadExamProgressData, writeObjectOut } from '../../api/judge'; | ||||
| @ -75,8 +75,6 @@ import { | ||||
|   UploadRegulatoryCodeConversion | ||||
| } from '../Judge/utils'; | ||||
| 
 | ||||
| const judgeTag = 'SURENJUN_JUDGE' | ||||
| 
 | ||||
| 
 | ||||
| type GetKm3JudgeInitConfig = () => Promise<Km3JudgeInitConfig> | ||||
| type GetgSbbm = (ksxm: number, xmxh: string) => string | ||||
| @ -105,7 +103,7 @@ export default class Judge { | ||||
|   //人工扣分 | ||||
|   public setJudgeMark = async (itemno: string, serial: string, type = 1) => { | ||||
|     await examJudgeArtificialMark(Number(itemno), serial, type); | ||||
|     console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`) | ||||
|     console.info(JudgeTag, `进入人工扣分-${itemno}-${serial}`) | ||||
|     const str = JSON.stringify({ | ||||
|       method: 'examJudgeArtificialMark', | ||||
|       itemno: Number(itemno), | ||||
| @ -113,7 +111,7 @@ export default class Judge { | ||||
|       type | ||||
|     }) | ||||
|     await this.fileLog?.setExamJudgeData(str) | ||||
|     console.info(judgeTag, `人工扣分-${itemno}-${serial}`) | ||||
|     console.info(JudgeTag, `人工扣分-${itemno}-${serial}`) | ||||
|   } | ||||
|   //人工操作项目 | ||||
|   public setJudgeItem = async (itemno: string, type: 1 | 2) => { | ||||
| @ -125,7 +123,7 @@ export default class Judge { | ||||
|       type | ||||
|     }) | ||||
|     await this.fileLog?.setExamJudgeData(str) | ||||
|     console.info(judgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`) | ||||
|     console.info(JudgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`) | ||||
|   } | ||||
|   private filePath: string = "" | ||||
|   private totalScore: number = -1 | ||||
| @ -172,7 +170,7 @@ export default class Judge { | ||||
|       return '' | ||||
|     } else { | ||||
|       const photoBase64 = await this.filePhoto?.getPhoto(); | ||||
|       console.info(judgeTag, '拍照完成') | ||||
|       console.info(JudgeTag, '拍照完成') | ||||
|       return photoBase64 | ||||
|     } | ||||
|   } | ||||
| @ -183,6 +181,38 @@ export default class Judge { | ||||
|   private isExamEnd: boolean | ||||
|   // 是否发送udp | ||||
|   private isUdpEnd: boolean = false | ||||
|   // 处理udp plc信号 | ||||
|   handleUdp = async (msg: string) => { | ||||
|     console.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++) | ||||
|   } | ||||
|   //是否手动结束考试 | ||||
|   private isManual: boolean = false | ||||
|   //UDP服务序列号 | ||||
| @ -209,9 +239,9 @@ export default class Judge { | ||||
|       let examData: Uint8Array = new Uint8Array(tempBuff.buffer) | ||||
|       examDataBase64 = base64.encodeToStringSync(examData) | ||||
|     } catch (e) { | ||||
|       console.info(judgeTag, JSON.stringify(e)) | ||||
|       console.info(JudgeTag, JSON.stringify(e)) | ||||
|     } | ||||
|     console.info(judgeTag, '过程数据文件上传 start') | ||||
|     console.info(JudgeTag, '过程数据文件上传 start') | ||||
| 
 | ||||
|     try { | ||||
|       await uploadExamProgressData({ | ||||
| @ -225,65 +255,11 @@ export default class Judge { | ||||
|         examEndTime: endTime, | ||||
|       }) | ||||
|     } catch (e) { | ||||
|       console.info(judgeTag, '过程数据文件上传失败:' + JSON.stringify(e)) | ||||
|       console.info(JudgeTag, '过程数据文件上传失败:' + JSON.stringify(e)) | ||||
|     } | ||||
|     console.info(judgeTag, '过程数据文件上传 end') | ||||
|     console.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 | ||||
| 
 | ||||
|     //如果项目没有开始 | ||||
|     console.info('surenjun isUpload=>', isUpload) | ||||
|     if (!isUpload) { | ||||
|       console.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 () => { | ||||
| @ -342,7 +318,7 @@ export default class Judge { | ||||
| 
 | ||||
|         //单机模式 | ||||
|         if (singlePlay) { | ||||
|           console.info(judgeTag + ' isAllProjectsEnd => ', isAllProjectsEnd) | ||||
|           console.info(JudgeTag + ' isAllProjectsEnd => ', isAllProjectsEnd) | ||||
|           if (isAllProjectsEnd && jl >= examMileage) { | ||||
|             //成绩合格 | ||||
|             if (totalScore >= passingGrade && !isEndTip) { | ||||
| @ -447,38 +423,6 @@ export default class Judge { | ||||
|     AppStorage.setOrCreate('msgStr', plc) | ||||
|     return tempData | ||||
|   } | ||||
|   // 处理udp plc信号 | ||||
|   handleUdp = async (msg: string) => { | ||||
|     console.info('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; | ||||
| @ -486,7 +430,7 @@ export default class Judge { | ||||
|     const judgeTimer = setInterval(async () => { | ||||
|       const msgStr = strArr[num]; | ||||
|       if (msgStr == '') { | ||||
|         console.info(judgeTag, '模拟数据考试结束') | ||||
|         console.info(JudgeTag, '模拟数据考试结束') | ||||
|         clearInterval(judgeTimer) | ||||
|         this.checkExamIsEnd(true) | ||||
|         return | ||||
| @ -517,9 +461,9 @@ export default class Judge { | ||||
|   } | ||||
|   //本地轨迹回放地址 | ||||
|   private trajectoryPath: string | ||||
|   //当前科目二的考试项目 | ||||
|   // private currentKm2ItemsObj: any | ||||
|   private isTrajectoryOpen: boolean; | ||||
|   //当前科目二的考试项目 | ||||
|   // 调代理接口是否断网了 | ||||
|   private isJudgeDisConnect: boolean = false; | ||||
|   // 断网数据补传 | ||||
| @ -534,6 +478,67 @@ export default class Judge { | ||||
|       const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context); | ||||
|     } | ||||
|   } | ||||
|   // 考试过程照片 | ||||
|   uploadProgressPhoto = async (ksxm: number) => { | ||||
|     const time = GetCurrentTime(); | ||||
|     const judgeUI = this.judgeUI | ||||
|     const plcData = this.plcData | ||||
|     const photoBase64 = await this.getPhoto(); | ||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||
| 
 | ||||
|     const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||
|     const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305') | ||||
|     const drvexam: DrvexamType = { | ||||
|       lsh: judgeUI.lsh, | ||||
|       kskm: carInfo?.examSubject || "2", | ||||
|       ksxm: project.projectCodeCenter, | ||||
|       sfzmhm: judgeUI.idCard, | ||||
|       kchp: encodeURI(carInfo?.plateNo || ""), | ||||
|       zpsj: time, | ||||
|       zp: photoBase64, | ||||
|       cs: Math.floor((judgeConfig_305 == 0 ? (plcData?.gps?.sd || 0) : (plcData?.sensor?.cs || 0)) * 1.852), | ||||
|       ksdd: encodeURI(judgeUI.ksdd) | ||||
|     } | ||||
|     const data: RegulatoryInterfaceParams = { | ||||
|       xtlb: '17', | ||||
|       jkxlh: judgeUI.serialNumber, | ||||
|       jkid: '17C54', | ||||
|       drvexam | ||||
|     }; | ||||
|     const temp: WR = await this.sendWriteObjectOut(data, this.filePath); | ||||
|     if (temp.code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     UploadRegulatoryCodeConversion('17C54', temp.code || 0) | ||||
|     console.info(JudgeTag, '上传照片 end') | ||||
|   } | ||||
|   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); | ||||
|     console.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) { | ||||
|       console.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'); | ||||
| @ -562,7 +567,7 @@ export default class Judge { | ||||
|       drvexam | ||||
|     } | ||||
|     const temp: WR = await this.sendWriteObjectOut(data, this.filePath) | ||||
|     console.info(judgeTag, '项目开始 end') | ||||
|     console.info(JudgeTag, '项目开始 end') | ||||
|     if (temp.code === 2300007) { | ||||
|       this.isJudgeDisConnect = true; | ||||
|     } | ||||
| @ -600,69 +605,62 @@ export default class Judge { | ||||
|     if (temp.code === 2300007) { | ||||
|       this.isJudgeDisConnect = true; | ||||
|     } | ||||
|     console.info(judgeTag, '项目结束 end') | ||||
|     console.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); | ||||
|     console.log("wzj", JSON.stringify(temp)) | ||||
|     //断网&网络超时次数计算 | ||||
|     if (temp.code == 2300007 || temp.code == 2300028) { | ||||
|       this.disConnectNum += 1; | ||||
|       if (this.disConnectNum < 5) { | ||||
|         return await this.sendWriteObjectOut(data, filePath) | ||||
|       } | ||||
|   // 检测扣分、结束项目时该项目是否开始 | ||||
|   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 | ||||
| 
 | ||||
|     if (this.disConnectNum >= 5) { | ||||
|       console.info('surenjun', '123') | ||||
|       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; | ||||
|       this.judgeUI.disConnectErrorOpen = true | ||||
|     //如果项目没有开始 | ||||
|     console.info(JudgeTag, 'surenjun isUpload=>', isUpload) | ||||
|     if (!isUpload) { | ||||
|       console.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 | ||||
|         }) | ||||
|       } | ||||
| 
 | ||||
|     this.disConnectNum = 0 | ||||
|     return temp | ||||
|       //扣分补传判断是否合格 不合格补传项目结束 | ||||
|       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) | ||||
|       } | ||||
|   // 考试过程照片 | ||||
|   uploadProgressPhoto = async (ksxm: number) => { | ||||
|     const time = GetCurrentTime(); | ||||
|     const judgeUI = this.judgeUI | ||||
|     const plcData = this.plcData | ||||
|     const photoBase64 = await this.getPhoto(); | ||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||
| 
 | ||||
|     const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||
|     const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305') | ||||
|     const drvexam: DrvexamType = { | ||||
|       lsh: judgeUI.lsh, | ||||
|       kskm: carInfo?.examSubject || "2", | ||||
|       ksxm: project.projectCodeCenter, | ||||
|       sfzmhm: judgeUI.idCard, | ||||
|       kchp: encodeURI(carInfo?.plateNo || ""), | ||||
|       zpsj: time, | ||||
|       zp: photoBase64, | ||||
|       cs: Math.floor((judgeConfig_305 == 0 ? (plcData?.gps?.sd || 0) : (plcData?.sensor?.cs || 0)) * 1.852), | ||||
|       ksdd: encodeURI(judgeUI.ksdd) | ||||
|       judgeTask.addTask(async () => { | ||||
|         this.checkExamIsEnd() | ||||
|       }) | ||||
|       return false; | ||||
|     } else { | ||||
|       return true | ||||
|     } | ||||
|     const data: RegulatoryInterfaceParams = { | ||||
|       xtlb: '17', | ||||
|       jkxlh: judgeUI.serialNumber, | ||||
|       jkid: '17C54', | ||||
|       drvexam | ||||
|     }; | ||||
|     const temp: WR = await this.sendWriteObjectOut(data, this.filePath); | ||||
|     if (temp.code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     UploadRegulatoryCodeConversion('17C54', temp.code || 0) | ||||
|     console.info(judgeTag, '上传照片 end') | ||||
|   } | ||||
| 
 | ||||
|   constructor(judgeUI: JudgeUI) { | ||||
| @ -698,7 +696,7 @@ export default class Judge { | ||||
|       }) | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag + 'testKmItems', JSON.stringify(this.kmItems)) | ||||
|     console.info(JudgeTag + 'testKmItems', JSON.stringify(this.kmItems)) | ||||
|     this.isExamEnd = false; | ||||
|   } | ||||
| 
 | ||||
| @ -768,7 +766,7 @@ export default class Judge { | ||||
|       initInfo.sharps = km3Config.sharps | ||||
|     } | ||||
|     // 获取科目三的评判配置 | ||||
|     console.info(judgeTag, '3.获取评判初始化数据完成') | ||||
|     console.info(JudgeTag, '3.获取评判初始化数据完成') | ||||
|     return initInfo | ||||
| 
 | ||||
|   } | ||||
| @ -848,7 +846,7 @@ export default class Judge { | ||||
|       mfxx: false, | ||||
|       mfxxn: false | ||||
|     } | ||||
|     console.info(judgeTag, '5.获取开始考试数据完成') | ||||
|     console.info(JudgeTag, '5.获取开始考试数据完成') | ||||
|     return beginInfo | ||||
|   } | ||||
|   //处理评判过程回调 | ||||
| @ -984,7 +982,7 @@ export default class Judge { | ||||
| 
 | ||||
|     //项目取消 | ||||
|       case 6: { | ||||
|         console.info(judgeTag, '项目取消'); | ||||
|         console.info(JudgeTag, '项目取消'); | ||||
|         const xmdm = xmqx.xmdm; | ||||
|         const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||
|         // const examSubject = this.judgeUI.examSubject | ||||
| @ -1110,13 +1108,13 @@ export default class Judge { | ||||
|         //项目已考不上传监管信息 | ||||
|           if (!isEnd) { | ||||
|             judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目开始-${xmdm}-${project.name}`) | ||||
|               console.info(JudgeTag, `项目开始-${xmdm}-${project.name}`) | ||||
|               await beginProject(xmdm) | ||||
|             }, { | ||||
|               isDelay: true | ||||
|             }) | ||||
|             judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目-${xmdm}-上传照片 start`) | ||||
|               console.info(JudgeTag, `项目-${xmdm}-上传照片 start`) | ||||
|               await uploadProgressPhoto(xmdm) | ||||
|             }, { | ||||
|               isDelay: true | ||||
| @ -1138,10 +1136,10 @@ export default class Judge { | ||||
|           const isStart = await this.checkProjectIsStart(xmdm, 1); | ||||
|           if (isStart) { | ||||
|             //项目结束了就不再生成数据 | ||||
|             console.info(judgeTag + ' projectIsEnd =>', projectIsEnd) | ||||
|             console.info(JudgeTag + ' projectIsEnd =>', projectIsEnd) | ||||
|             if (!projectIsEnd) { | ||||
|               judgeTask.addTask(async () => { | ||||
|                 console.info(judgeTag, `项目结束-${xmdm}-${project.name}`) | ||||
|                 console.info(JudgeTag, `项目结束-${xmdm}-${project.name}`) | ||||
|                 await endProject(xmdm); | ||||
|                 this.xmmcSingleCode = '0'; | ||||
|                 this.xmmcEndCode = undefined; | ||||
| @ -1173,7 +1171,7 @@ export default class Judge { | ||||
|           const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf); | ||||
|           if (isStart) { | ||||
|             await judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`) | ||||
|               console.info(JudgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`) | ||||
|               await pointsDedute(Number(currentKf.xmdm), currentKf) | ||||
|             }, { | ||||
|               isDelay: true | ||||
| @ -1187,14 +1185,14 @@ export default class Judge { | ||||
| 
 | ||||
|       // 考试结束 | ||||
|         case 5: | ||||
|           console.info(judgeTag, '考试结束') | ||||
|           console.info(JudgeTag, '考试结束') | ||||
|         //关闭录像 | ||||
|           const singlePlay = AppStorage.get<boolean>('singlePlay') | ||||
|           if (!singlePlay && this.videoData) { | ||||
|             await endRecordVideo(this.videoData) | ||||
|           } | ||||
|           judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, '考试结束 start') | ||||
|             console.info(JudgeTag, '考试结束 start') | ||||
|             AppStorage.setOrCreate('isJudge', false) | ||||
|             await handEndExam() | ||||
|           }) | ||||
| @ -1296,7 +1294,7 @@ export default class Judge { | ||||
|     if (temp.code == 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     console.info(judgeTag, '项目扣分 end') | ||||
|     console.info(JudgeTag, '项目扣分 end') | ||||
|     UploadRegulatoryCodeConversion('17C53', temp?.code || 0) | ||||
|   } | ||||
|   // 评判语音提示 | ||||
| @ -1379,7 +1377,7 @@ export default class Judge { | ||||
|           // TODO  globalThis.judgeUdp.send(bytes) | ||||
|         } | ||||
|       } catch (e) { | ||||
|         console.info(judgeTag, JSON.stringify(e)) | ||||
|         console.info(JudgeTag, JSON.stringify(e)) | ||||
|       } | ||||
|       await endExam() | ||||
|     }); | ||||
| @ -1455,7 +1453,7 @@ export default class Judge { | ||||
|       this.judgeUI.loadingPopupVisible = false; | ||||
|       return | ||||
|     } | ||||
|     console.info(judgeTag, '考试结束 end') | ||||
|     console.info(JudgeTag, '考试结束 end') | ||||
|     const param302: string = Reflect.get(judgeConfigObj, '302') | ||||
|     judgeUI.loadingPopupVisible = true; | ||||
|     let currentKssycs = '0'; | ||||
| @ -1515,7 +1513,7 @@ export default class Judge { | ||||
|     USER[0].kssycs = currentKssycs | ||||
|     await SqlInsertTable('USER', USER) | ||||
| 
 | ||||
|     console.info(judgeTag, `考试成绩:${totalScore}`) | ||||
|     console.info(JudgeTag, `考试成绩:${totalScore}`) | ||||
|     if (!singlePlay) { | ||||
|       // await uploadProgressData(); | ||||
|     } | ||||
| @ -1550,7 +1548,7 @@ export default class Judge { | ||||
|             } | ||||
|           }) | ||||
|         } catch (e) { | ||||
|           console.info(judgeTag, JSON.stringify(e)) | ||||
|           console.info(JudgeTag, JSON.stringify(e)) | ||||
|         } | ||||
|       }) | ||||
|     } else { | ||||
| @ -1798,10 +1796,10 @@ export default class Judge { | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj)); | ||||
|     console.info(judgeTag, '所有考试项目数量:' + allProjectNum) | ||||
|     console.info(judgeTag, '必考项目数量:' + projectNum) | ||||
|     console.info(judgeTag, '必考项目已考数量:' + endProjectsNum) | ||||
|     console.info(JudgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj)); | ||||
|     console.info(JudgeTag, '所有考试项目数量:' + allProjectNum) | ||||
|     console.info(JudgeTag, '必考项目数量:' + projectNum) | ||||
|     console.info(JudgeTag, '必考项目已考数量:' + endProjectsNum) | ||||
|     //必考项目除靠边停车是否全部完成 | ||||
|     this.judgeUI.isRequiredProjectsEnd = (projectNum - endProjectsNum === 0) | ||||
|     this.judgeUI.isAllProjectsEnd = (allProjectNum - allEndProjectsNum === 0) | ||||
| @ -1876,13 +1874,13 @@ export default class Judge { | ||||
|       strArr = str.split('\n') | ||||
|     } | ||||
|     //日志回调 | ||||
|     console.info(judgeTag, '1.进入评判入口') | ||||
|     console.info(JudgeTag, '1.进入评判入口') | ||||
|     await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => { | ||||
|       console.log('评判日志:' + info) | ||||
|       console.log(JudgeTag, '评判日志:' + info) | ||||
|       await fileLog?.setExamJudgeLogData(info); | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag, '2.注册日志回调完成') | ||||
|     console.info(JudgeTag, '2.注册日志回调完成') | ||||
| 
 | ||||
|     let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); | ||||
|     await fileLog?.setExamJudgeData(JSON.stringify(initInfo)) | ||||
| @ -1890,7 +1888,7 @@ export default class Judge { | ||||
|     if (!isJudgeInitBool) { | ||||
|       const tempJudge = await examJudgeInit(initInfo); | ||||
|       AppStorage.setOrCreate('isJudgeInitBool', true) | ||||
|       console.info(judgeTag, '4.评判初始化完成') | ||||
|       console.info(JudgeTag, '4.评判初始化完成') | ||||
|     } | ||||
|     AppStorage.setOrCreate('isJudge', true) | ||||
|     // 2.评判过程回调 | ||||
| @ -1925,7 +1923,7 @@ export default class Judge { | ||||
|     if (beginExamInfo) { | ||||
|       await examJudgeBeginExam(beginExamInfo); | ||||
|     } | ||||
|     console.info(judgeTag, '6.开始考试注册完成') | ||||
|     console.info(JudgeTag, '6.开始考试注册完成') | ||||
|     avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3']) | ||||
| 
 | ||||
|     if (!judgeUI.singlePlay) { | ||||
| @ -1968,7 +1966,7 @@ export default class Judge { | ||||
|     //   this.checkExamIsEnd(true); | ||||
|     // }) | ||||
| 
 | ||||
|     console.info(judgeTag, JSON.stringify(manualMarkRules)) | ||||
|     console.info(JudgeTag, JSON.stringify(manualMarkRules)) | ||||
|     //TODO 监听远程扣分 | ||||
|     // globalThis.udpEvent.onKfExam(async (content:JudgeUdpKf) => { | ||||
|     //   console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user