feat:更新
This commit is contained in:
		
							parent
							
								
									0837bd20d8
								
							
						
					
					
						commit
						54403ef2c7
					
				| @ -18,7 +18,8 @@ export async function download() { | ||||
| 
 | ||||
| interface WR{ | ||||
|   message?:string | ||||
|   code:number | ||||
|   code?:number | ||||
|   keystr?:string | ||||
| } | ||||
| // 通用监管接口
 | ||||
| export async function writeObjectOut(params,filePath?:string): Promise<WR> { | ||||
| @ -56,7 +57,7 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | ||||
|     const fileUtil = new FileUtil(globalThis.context); | ||||
|     await fileUtil.initFolder(filePath); | ||||
|     fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ | ||||
|       xtlb,jkxlh,jkid,drvexam | ||||
|       xtlb,jkxlh,jkid,drvexam:{...drvexam,zp:''}, | ||||
|     })); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -39,7 +39,11 @@ export const getMessageHeartbeat = async (msg) => { | ||||
|   const { examSubject,plateNo } = carInfo; | ||||
|   const ksyh='0000000000000' | ||||
|   const {fourInOneScreen:{gpsDigit}} = judgeConfig | ||||
|   const asclshArr = stringToASC(fillZero('1111111111111', 13)); | ||||
|   const asclshArr = stringToASC(fillZero( | ||||
|     globalThis.singlePlay | ||||
|       ?'1111111111111' | ||||
|       : globalThis.lsh, | ||||
|     13)); | ||||
|   const ascksyhArr = stringToASC(fillZero('1111111111111', 13)) | ||||
|   const ascsbxhArr = stringToASC('00000000') | ||||
|   // const ascsbxhArr = stringToASC('153216400880')
 | ||||
| @ -70,7 +74,7 @@ export const getMessageHeartbeat = async (msg) => { | ||||
|     string2Bytes(serialIndex, 2 * 8), | ||||
|     translateSignals, | ||||
|     //@ts-ignore
 | ||||
|     string2Bytes(Math.floor(gps.sd*1.852) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), | ||||
|     string2Bytes(Math.floor(gps.sd*1.852*100) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), | ||||
|     //GPS东向距离
 | ||||
|     string2Bytes(0, 4 * 8), | ||||
|     //GPS北向距离
 | ||||
| @ -142,20 +146,20 @@ const getTranslateProject = () => { | ||||
|   for (let i = 0; i <= 4; i++) { | ||||
|     const temp = tempItems.slice(i * 4, (i + 1) * 4); | ||||
|     let tempArr = temp.map(item => item.status) | ||||
|     if (i === 4 && examSubject) { | ||||
|     if (i === 4) { | ||||
|       tempArr = examSubject == 2 | ||||
|         //bit36-bit39保留
 | ||||
|         ? tempArr.concat(['00', '00']) | ||||
|         //bit30-bit39保留
 | ||||
|         : tempArr.concat(['00', '00','00','00']) | ||||
|     } | ||||
|     if (i === 3 && examSubject == 3) { | ||||
|       tempArr = tempArr.concat(['00']) | ||||
|         : tempArr.concat(['00', '00','00']) | ||||
|     } | ||||
|     // if (i === 3 && examSubject == 3) {
 | ||||
|     //   tempArr = tempArr.concat(['00'])
 | ||||
|     // }
 | ||||
| 
 | ||||
|     arr.push(tempArr.join('')); | ||||
|   } | ||||
|   return arr.map(numStr => parseInt(numStr, 2)); | ||||
|   return arr | ||||
| } | ||||
| 
 | ||||
| // 中心实时项目状态转换
 | ||||
|  | ||||
| @ -152,7 +152,7 @@ function handleCenterCode(msgXml,isNewCenter){ | ||||
|         const msg = JSON.parse(msgXml); | ||||
|         const result = msg?.data[0]?.result; | ||||
|         if(result){ | ||||
|             const {code,message} = result | ||||
|             const {code,message,keystr} = result | ||||
|             if(code != '1'){ | ||||
|                 const rMessage = decodeURIComponent(message as string) | ||||
|                 prompt.showToast({ | ||||
| @ -161,7 +161,7 @@ function handleCenterCode(msgXml,isNewCenter){ | ||||
|                 }); | ||||
|                 return {code,message} | ||||
|             }else{ | ||||
|                 return { code } | ||||
|                 return { code ,keystr} | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -275,7 +275,7 @@ struct Index { | ||||
|     this.dialogVisiable=false | ||||
|     this.angle = 0 | ||||
|     this.loading = false | ||||
| 
 | ||||
|     globalThis.lsh = '1111111111111' | ||||
|   } | ||||
| 
 | ||||
|   async testXMLToJSONInWorker() { | ||||
|  | ||||
| @ -50,7 +50,6 @@ struct Index { | ||||
|       this.time = await getCurrentTime(); | ||||
|       this.examTime += 1; | ||||
|     }, 1000); | ||||
| 
 | ||||
|     //初始化数据库表 | ||||
|     await this.initDb() | ||||
|     //断点续考 | ||||
| @ -109,6 +108,7 @@ struct Index { | ||||
|       BK1: carInfo.bk1, | ||||
|       BK2: carInfo.bk2, | ||||
|     }) | ||||
|     console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArrr)) | ||||
|   } | ||||
| 
 | ||||
|   // 获取考生信息 | ||||
| @ -222,6 +222,8 @@ struct Index { | ||||
|   //初始化systemParam表 | ||||
|   async initSystemParam(sysParam?: SYSTEMPARMARR[]) { | ||||
|     const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM') | ||||
|     console.info('surenjun => systemParms',JSON.stringify(systemParms)); | ||||
| 
 | ||||
|     let currentParams: any = router.getParams(); | ||||
|     const {carName,carType,examSubject} = this; | ||||
|     //小车车型列表 | ||||
| @ -229,7 +231,10 @@ struct Index { | ||||
|     if (globalThis.singlePlay) { | ||||
|       this.wayno = currentParams.wayno || 1; | ||||
|     } | ||||
| 
 | ||||
|     //真实监管下发的项目 | ||||
|     let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); | ||||
|     console.info('surenjun kStringArr',JSON.stringify(kStringArr)) | ||||
|     let isInExam = kStringArr.length > 0; | ||||
|     const {isTrajectoryOpen} = judgeConfig | ||||
|     let carNo = '', allItems = []; | ||||
|     systemParms.forEach((systemParm) => { | ||||
| @ -255,7 +260,6 @@ struct Index { | ||||
|       if(no1 == 3 && no3 == 3 && carNo === no2){ | ||||
|         this.passingScore = Number(txt1) || 0; | ||||
|       } | ||||
| 
 | ||||
|       //获取当前考车的考试项目 | ||||
|       if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) { | ||||
|         allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '') | ||||
| @ -274,6 +278,7 @@ struct Index { | ||||
|         if (sCarTypes.includes(carType) && name === '夜间行驶') { | ||||
|           return | ||||
|         } | ||||
| 
 | ||||
|         const currentProject = { | ||||
|           name, | ||||
|           abbreviation: decodeURI(systemParm.txt3), | ||||
| @ -286,9 +291,18 @@ struct Index { | ||||
|           //项目开始数据是否上传过 | ||||
|           isUpload:false, | ||||
|         } | ||||
|         this.projectsObj[no2*1] = currentProject | ||||
|         this.projectsCenterObj[txt2] = currentProject | ||||
|         this.projects.push(currentProject); | ||||
|         if(isInExam){ | ||||
|           if(kStringArr.includes(txt2)){ | ||||
|             this.projectsObj[no2*1] = currentProject | ||||
|             this.projectsCenterObj[txt2] = currentProject | ||||
|             this.projects.push(currentProject); | ||||
|           } | ||||
|         }else { | ||||
|           this.projectsObj[no2*1] = currentProject | ||||
|           this.projectsCenterObj[txt2] = currentProject | ||||
|           this.projects.push(currentProject); | ||||
|         } | ||||
| 
 | ||||
|       } | ||||
|       this.systemparmArr.push({ | ||||
|         'NO1': no1 * 1, | ||||
| @ -458,7 +472,6 @@ struct Index { | ||||
|     const [initData, beginData] = [strArr[0], strArr[1]]; | ||||
|     const initDataObj = JSON.parse(initData) | ||||
|     const beginDataObj = JSON.parse(beginData) | ||||
|     // initDataObj.systemparm = | ||||
|     const examSubject = globalThis.carInfo.examSubject; | ||||
|     this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject; | ||||
|     globalThis.carInfo.examSubject = this.examSubject | ||||
| @ -814,26 +827,6 @@ struct Index { | ||||
|         .margin({ bottom: 20 }) | ||||
|       }.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 }) | ||||
| 
 | ||||
|       if (this.signDisplayComVisible) { | ||||
|         Column() { | ||||
|           SignDisplayCom({ | ||||
|             showBack: false, | ||||
|             scaleNum: 1.8, | ||||
|             msgStr: this.judge.plcStr || '', | ||||
|           }).margin({ top: 100 }) | ||||
| 
 | ||||
|           Row() { | ||||
|           } | ||||
|           .width(240) | ||||
|           .height(240) | ||||
|           .position({ x: '81%', y: 80 }) | ||||
|           .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) | ||||
|           .backgroundImageSize({ width: '33.33%', height: '33.33%' }) | ||||
|           .onClick(() => { | ||||
|             this.signDisplayComVisible = false | ||||
|           }) | ||||
|         }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') | ||||
|       } | ||||
| 
 | ||||
|       //科目三人工扣分弹窗 | ||||
|       if (this.isDeductedPopShow && this.examSubject == 3 && this.judgeConfigObj['342'] == 0) { | ||||
| @ -857,6 +850,28 @@ struct Index { | ||||
|         }) | ||||
|       } | ||||
| 
 | ||||
|       if (this.signDisplayComVisible) { | ||||
|         Column() { | ||||
|           SignDisplayCom({ | ||||
|             showBack: false, | ||||
|             scaleNum: 1.8, | ||||
|             msgStr: this.judge.plcStr || '', | ||||
|           }).margin({ top: 100 }) | ||||
| 
 | ||||
|           Row() { | ||||
|           } | ||||
|           .width(240) | ||||
|           .height(240) | ||||
|           .position({ x: '81%', y: 80 }) | ||||
|           .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) | ||||
|           .backgroundImageSize({ width: '33.33%', height: '33.33%' }) | ||||
|           .onClick(() => { | ||||
|             this.signDisplayComVisible = false | ||||
|           }) | ||||
|         }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') | ||||
|       } | ||||
| 
 | ||||
| 
 | ||||
|       //科目三人工项目确认框 | ||||
|       if (this.isAmplifyPopShow && this.examSubject == 3) { | ||||
|         AmplifyPopup({ | ||||
| @ -991,6 +1006,9 @@ struct Index { | ||||
|       getProjectIsInRoad | ||||
|     } = this; | ||||
|     const projectCode = artSubject3ProjectsCodesArr[index]; | ||||
|     if(projectsObj[projectCode] === undefined){ | ||||
|       return false | ||||
|     } | ||||
|     const projectType = projectsObj[projectCode].type; | ||||
| 
 | ||||
|     //不允许人工触发的项目列表,以","分隔 | ||||
|  | ||||
| @ -97,7 +97,9 @@ export default struct Index { | ||||
|       params:{ | ||||
|         sczb, | ||||
|         kfdm, | ||||
|         wayno | ||||
|         wayno, | ||||
|         //TODO 真实监管项目 | ||||
|         // kString:'40300,40500,40700,40800' | ||||
|       } | ||||
|     }, router.RouterMode.Single); | ||||
| 
 | ||||
|  | ||||
| @ -125,6 +125,8 @@ struct UserInfo { | ||||
|     this.isExamStart = false | ||||
|     this.sczbkf = []; | ||||
|     this.avPlayer = new VoiceAnnounce(); | ||||
|     initJudgeUdp() | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   //身份证读卡器初始化 | ||||
| @ -166,7 +168,8 @@ struct UserInfo { | ||||
|             url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', | ||||
|             params: { | ||||
|               sczb: Number(this.isBoardPrePareSetPopupOpen), | ||||
|               kfdm: this.sczbkf | ||||
|               kfdm: this.sczbkf, | ||||
| 
 | ||||
|             } | ||||
|           }, router.RouterMode.Single); | ||||
|           return | ||||
| @ -248,7 +251,7 @@ struct UserInfo { | ||||
|     this.stepFlag = false | ||||
|     this.faceCompareSucess = 0 | ||||
|     this.showFaceCompare = false | ||||
|     this.lsh = '000000000000' | ||||
|     this.lsh = '1111111111111' | ||||
|     this.callBackFlag = false | ||||
|     globalThis.lsh = this.lsh | ||||
|     // this.currentUser = EmptyCandidateObject | ||||
| @ -507,7 +510,6 @@ struct UserInfo { | ||||
|       this.dataList = [] | ||||
|       this.currentUser = EmptyCandidateObject | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   //身份比对 | ||||
| @ -530,11 +532,12 @@ struct UserInfo { | ||||
|     const avPlayer = this.avPlayer; | ||||
|     this.isLoadingPopupVisible = true | ||||
|     avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { | ||||
|       const temp = await this.beginExam(); | ||||
|       console.info('surenjun', JSON.stringify(temp)) | ||||
|       if (temp.code != 1) { | ||||
|       //TODO 模拟 | ||||
|       const {code,keystr,message} = await this.beginExam(); | ||||
|       //@ts-ignore TODO code转换 | ||||
|       if (code == '' && code == undefined) { | ||||
|         promptAction.showToast({ | ||||
|           message: temp.message, | ||||
|           message, | ||||
|           duration: 4000 | ||||
|         }) | ||||
|         return | ||||
| @ -548,7 +551,9 @@ struct UserInfo { | ||||
|         params: { | ||||
|           examItems: examItems?.getExaminationItemRsp?.body?.ykxx, | ||||
|           sczb: Number(this.isBoardPrePareSetPopupOpen), | ||||
|           kfdm: this.sczbkf | ||||
|           kfdm: this.sczbkf, | ||||
|           //真实监管项目 | ||||
|           kString:keystr || '' | ||||
|         } | ||||
|       }, router.RouterMode.Single); | ||||
|       this.stopDeviceById() | ||||
| @ -741,10 +746,12 @@ struct UserInfo { | ||||
|             .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) | ||||
|             .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|             .onClick(() => { | ||||
|               globalThis.lsh = item.lsh; | ||||
|               if (this.isExamStart&&!globalThis.singlePlay) { | ||||
|                 return | ||||
|               } | ||||
|               this.currentUser = item | ||||
| 
 | ||||
|             }) | ||||
|           }) | ||||
|         }.width(640 * this.ratio).margin({ left: 30 * this.ratio }) | ||||
| @ -830,7 +837,6 @@ struct UserInfo { | ||||
|                 this.isFirstBoardPrePareSetPopupBtnShow = true; | ||||
|                 this.stepFlag = false | ||||
|                 this.stopDeviceById() | ||||
|                 initJudgeUdp() | ||||
|               } catch (e) { | ||||
| 
 | ||||
|               } | ||||
| @ -853,7 +859,7 @@ struct UserInfo { | ||||
|                       url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', | ||||
|                       params: { | ||||
|                         sczb: Number(this.isBoardPrePareSetPopupOpen), | ||||
|                         kfdm: this.sczbkf | ||||
|                         kfdm: this.sczbkf, | ||||
|                       } | ||||
|                     }, router.RouterMode.Single); | ||||
|                     this.stopDeviceById() | ||||
| @ -862,7 +868,6 @@ struct UserInfo { | ||||
|                   if (this.FaceOpenStatue != '0') { | ||||
|                     this.showFaceCompare = true | ||||
|                   } else { | ||||
|                     initJudgeUdp() | ||||
|                     this.sfbdinterfaceFn() | ||||
|                   } | ||||
|                 } catch (e) { | ||||
|  | ||||
| @ -571,7 +571,7 @@ export const wuxiKm3Items = [ | ||||
|     {projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'}, | ||||
|     {projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'}, | ||||
|     {projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'}, | ||||
|     {projectCode:'41',projectCodeCenter:'41600',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'}, | ||||
|     {projectCode:'41',projectCodeCenter:'41700',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'}, | ||||
|     {projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'}, | ||||
|     {projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'}, | ||||
|     {projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'}, | ||||
|  | ||||
| @ -53,7 +53,7 @@ import { | ||||
| } from './api/index'; | ||||
| 
 | ||||
| const judgeTag = 'SURENJUN_JUDGE' | ||||
| 
 | ||||
| import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | ||||
| export default class Judge { | ||||
|   constructor(judgeUI) { | ||||
|     this.serialIndex = 1; | ||||
| @ -129,15 +129,12 @@ export default class Judge { | ||||
|     console.info(judgeTag, '2.注册日志回调完成') | ||||
| 
 | ||||
|     let initInfo = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); | ||||
| 
 | ||||
|     await fileLog.setExamJudgeData(initInfo) | ||||
|     //相关评判初始化只做一次
 | ||||
|     if (!isJudgeInitBool) { | ||||
|       await fileLog.setExamJudgeData(initInfo) | ||||
|       const tempJudge = await examJudgeInit(initInfo); | ||||
|       globalThis.isJudgeInitBool = true | ||||
|       console.info(judgeTag, '4.评判初始化完成') | ||||
|     } else { | ||||
|       await fileLog.setExamJudgeData(initInfo) | ||||
|     } | ||||
| 
 | ||||
|     globalThis.isJudge = true | ||||
| @ -315,7 +312,6 @@ export default class Judge { | ||||
|         this.judgeUI.currentXmdm = xmdm; | ||||
|         const xmmcStr = judgeUI.projectsObj[xmdm].name; | ||||
|         const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; | ||||
|         console.info(judgeTag,JSON.stringify(judgeUI.projectsObj[xmdm])) | ||||
|         const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; | ||||
|         this.testKmItems[xmmcCode].status = 2; | ||||
|         this.xmmcStr = xmmcStr; | ||||
| @ -344,7 +340,6 @@ export default class Judge { | ||||
|         //统计必考项目数量
 | ||||
|         this.xmmcStr = '无'; | ||||
|         this.xmmcCode = ''; | ||||
|         this.xmmcSingleCode = 0; | ||||
|         this.xmdm = ''; | ||||
|         this.judgeUI.isDeductedPopShow = false | ||||
|         this.judgeUI.currentXmdm = undefined; | ||||
| @ -490,6 +485,7 @@ export default class Judge { | ||||
|             judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) | ||||
|               await endProject(xmdm); | ||||
|               this.xmmcSingleCode = 0; | ||||
|             }, {isDelay: true}) | ||||
|           } | ||||
|         } | ||||
| @ -658,16 +654,19 @@ export default class Judge { | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = getProjectInfo(ksxm); | ||||
|     //科目三上车准备、模拟灯光、夜间行驶出现通用评判,ksxm为当前进行的项目
 | ||||
|     const checkProjects = ['41600', '41700', '40100'] | ||||
| 
 | ||||
|     const checkProjects = ['1', '41', '17'] | ||||
|     console.info(judgeTag + 'ksxm=>',ksxm) | ||||
|     console.info(judgeTag + 'xmmcSingleCode=>',xmmcSingleCode) | ||||
|     const data = { | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C53', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kskm: examSubject, | ||||
|         ksxm: project | ||||
|           ? (checkProjects.includes(xmmcSingleCode + '') ? xmmcSingleCode : project.projectCodeCenter) | ||||
|           : (examSubject == 3 ? 30000 : 10000), | ||||
|         ksxm: project == undefined | ||||
|           ? (checkProjects.includes(xmmcSingleCode + '') | ||||
|             ? '40100' | ||||
|             : (examSubject == 3 ? 30000 : 10000)) | ||||
|           : project.projectCodeCenter , | ||||
|         kfxm: kf.markcatalog, | ||||
|         kfxmmx: `${ksxm},${kf.markserial}`, | ||||
|         sfzmhm: idCard, | ||||
| @ -677,6 +676,8 @@ export default class Judge { | ||||
|         kfsj: time | ||||
|       } | ||||
|     } | ||||
|     console.info(judgeTag + 'ksxm=>',data.drvexam.ksxm) | ||||
| 
 | ||||
|     const {code} = await writeObjectOut(data,filePath); | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
| @ -778,7 +779,6 @@ export default class Judge { | ||||
|         const param302 = judgeConfigObj['302']; | ||||
|         const param342 = judgeConfigObj['342']; | ||||
|         const param512 = (judgeConfigObj['512'] || '').split(','); | ||||
| 
 | ||||
|         //成绩不合格
 | ||||
|         if (totalScore < passingGrade) { | ||||
|           //科目三不合格报靠边停车
 | ||||
| @ -791,13 +791,15 @@ export default class Judge { | ||||
|           return | ||||
|         } | ||||
|         //成绩合格
 | ||||
|         if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) { | ||||
|         if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) { | ||||
| 
 | ||||
|           //考试合格自动退出
 | ||||
|           if(examSubject == 3 && param302 == 4){ | ||||
|             await examJudgeEndExam() | ||||
|             this.isExamEnd = true | ||||
|             return | ||||
|           } | ||||
| 
 | ||||
|           if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { | ||||
|             if(param512[7] != 0){ | ||||
|               avPlayer.playAudio(['voice/综合评判.mp3']) | ||||
| @ -819,24 +821,19 @@ export default class Judge { | ||||
|     this.judgeUI.loadingPopupVisible = true; | ||||
|     this.judgeUI.endPopupVisible = false; | ||||
|     this.judgeUI.isDeductedPopShow = false; | ||||
| 
 | ||||
|     console.info(judgeTag,1) | ||||
|     const {qjjl,dcjl} = ksjs | ||||
|     const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this; | ||||
|     const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; | ||||
|     //计算考试分数
 | ||||
|     console.info(judgeTag,2) | ||||
|     this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; | ||||
|     const singlePlay = globalThis.singlePlay | ||||
|     const param302 = judgeConfigObj['302']; | ||||
|     globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
| 
 | ||||
|     console.info(judgeTag,3) | ||||
|     //自动退出待验证并且不合格
 | ||||
|     if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { | ||||
|       avPlayer.playAudio([`voice/考试结束.mp3`]) | ||||
|     } | ||||
|     console.info(judgeTag,4) | ||||
|     //联网模式下手动结束的直接退出
 | ||||
|     if (!singlePlay && isManual && !isAllProjectsEnd) { | ||||
|       avPlayer.playAudio(['voice/empty.mp3'], true, () => { | ||||
| @ -844,7 +841,6 @@ export default class Judge { | ||||
|       }) | ||||
|       return | ||||
|     } | ||||
|     console.info(judgeTag,5) | ||||
|     if (examSubject == 3) { | ||||
|       const param302 = judgeConfigObj['302']; | ||||
|       if (totalScore < passingScore) { | ||||
| @ -856,17 +852,13 @@ export default class Judge { | ||||
|         //考试合格
 | ||||
|       } | ||||
|     } | ||||
|     console.info(judgeTag,6) | ||||
|     await handleSEP(306); | ||||
|     console.info(judgeTag,7) | ||||
|     avPlayer.playAudio(['voice/exam_waiting.mp3'], true, async () => { | ||||
|       try { | ||||
|         if (!singlePlay) { | ||||
|           // TODO 待验证
 | ||||
|           const bytes = await this.getMessageHeartbeat(true); | ||||
|           globalThis.judgeUdp.send(bytes) | ||||
|         } | ||||
|         //TODO endExam函数逻辑待验证
 | ||||
|         await endExam() | ||||
|       } catch (e) { | ||||
|         console.info(judgeTag,JSON.stringify(e)) | ||||
| @ -903,7 +895,7 @@ export default class Judge { | ||||
|         kscj: (totalScore * 1) > 0 ? totalScore : 0, | ||||
|         kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), | ||||
|         // 1,22;2,560;3,128;4,0;5,0;
 | ||||
|         dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index},${Math.floor(d /100)}`).join(';'), | ||||
|         dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index+1},${Math.floor(d /100)}`).join(';'), | ||||
|       } | ||||
|     } | ||||
|     const temp = await writeObjectOut(data,filePath); | ||||
| @ -916,7 +908,6 @@ export default class Judge { | ||||
|     if (examSubject == 2) { | ||||
|       voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') | ||||
|     } | ||||
| 
 | ||||
|     if (examSubject == 3) { | ||||
|       if (isAllProjectsEnd) { | ||||
|         if (totalScore < passingScore) { | ||||
| @ -929,6 +920,9 @@ export default class Judge { | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     const USER = getSyncData('USER'); | ||||
|     await upDateTableByArray('USER', [{...USER[0],kssycs:kssycs == 2 ? 1 : 0}]) | ||||
| 
 | ||||
|     console.info(judgeTag, `考试成绩:${totalScore}`) | ||||
|     if(!singlePlay){ | ||||
|       await uploadProgressData(); | ||||
| @ -945,6 +939,7 @@ export default class Judge { | ||||
|             if (score <= (examSubject == 3 ? 10 : 20)) { | ||||
|               if (kfArr.length - 1 === index) { | ||||
|                 avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { | ||||
|                   this.isUdpEnd = true | ||||
|                   router.back(); | ||||
|                 }) | ||||
|                 throw new Error('End Loop') | ||||
| @ -965,6 +960,7 @@ export default class Judge { | ||||
|     } else { | ||||
|       avPlayer.playAudio([voiceURL], true, () => { | ||||
|         setTimeout(() => { | ||||
|           this.isUdpEnd = true | ||||
|           router.back(); | ||||
|         }, param302 == 8 ? 3000 : 0) | ||||
|       }) | ||||
| @ -992,7 +988,6 @@ export default class Judge { | ||||
|   getMessageHeartbeat = async (isEnd?: Boolean) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo,ksyh } = carInfo; | ||||
|     console.info(judgeTag,1) | ||||
|     const { | ||||
|       judgeUI, | ||||
|       isExam, | ||||
| @ -1007,35 +1002,25 @@ export default class Judge { | ||||
|       getTranslateProject, | ||||
|       getSbxh | ||||
|     } = this; | ||||
|     console.info(judgeTag,2) | ||||
|     const singlePlay = globalThis.singlePlay | ||||
|     const {lsh,startHourTime,totalScore,examTime} = judgeUI; | ||||
| 
 | ||||
|     const {fourInOneScreen:{gpsDigit}} = judgeConfig | ||||
|     console.info(judgeTag,3) | ||||
|     const examType = examSubject == 2?2:3 | ||||
|     const {sensor,gps} = tempData; | ||||
|     console.info(judgeTag,4) | ||||
|     console.info(judgeTag,JSON.stringify(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,} = gps | ||||
|     console.info(judgeTag,5) | ||||
|     const translateProject = getTranslateProject(); | ||||
|     const sbxh = getSbxh(xmdm, xmxh) | ||||
|     console.info(judgeTag,JSON.stringify(performInfo)) | ||||
|     const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; | ||||
|     const asclshArr = stringToASC( | ||||
|       fillZero((singlePlay?1111111111111:lsh) || 0, 13) | ||||
|     ); | ||||
|     //13不足要补0
 | ||||
|     console.info(judgeTag,6) | ||||
|     const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) | ||||
|     console.info(judgeTag,7) | ||||
|     const ascsbxhArr = stringToASC(sbxh) | ||||
|     console.info(judgeTag,8) | ||||
|     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]) | ||||
|     ) | ||||
| @ -1045,12 +1030,6 @@ export default class Judge { | ||||
|     const translateWd = convertGpsCoord2(jd).toFixed(gpsDigit) * Math.pow(10, gpsDigit) | ||||
|     //@ts-ignore
 | ||||
|     const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0]) | ||||
|     console.info(judgeTag,6) | ||||
|     // console.info(judgeTag,JSON.stringify(translateProject))
 | ||||
|     //@ts-ignore
 | ||||
|     // const translateProjects= translateProject.map(num => string2Bytes(p,8)[0])
 | ||||
|     console.info('surenjunxmmcexamTime' , examTime) | ||||
| 
 | ||||
|     const arr = [ | ||||
|     //考生号
 | ||||
|       asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), | ||||
| @ -1104,30 +1083,22 @@ export default class Judge { | ||||
|       tempArr = tempArr.concat(itemArr) | ||||
|     }) | ||||
|     this.serialIndex += 1; | ||||
|     console.info('message-judge-udp' + Array2Byte(tempArr).toString()); | ||||
| 
 | ||||
|     return Array2Byte(tempArr) | ||||
|   } | ||||
|   //获取场地序号
 | ||||
|   getSbxh = (ksxm, xmxh) => { | ||||
|     const {judgeUI} = this; | ||||
|     console.info(judgeTag,10) | ||||
|     const {cdsbInfoObj,projectsObj} = judgeUI; | ||||
|     console.info(judgeTag,11) | ||||
|     const project = projectsObj[ksxm] | ||||
|     console.info(judgeTag,12) | ||||
|     if(project == 3){ | ||||
|       return '0000000000' | ||||
|     } | ||||
|     if (project === undefined) { | ||||
|       return '0000000000' | ||||
|     } | ||||
|     console.info(judgeTag,13) | ||||
|     const projectType = project.sbxh; | ||||
|     const projectKey = `${ksxm}_${xmxh}`; | ||||
|     console.info(judgeTag,14) | ||||
|     const currentCdsb = cdsbInfoObj[projectKey] || {}; | ||||
|     console.info(judgeTag,15) | ||||
|     const sbxh = currentCdsb.sbbh || '0000000000' | ||||
|     return sbxh | ||||
|   } | ||||
| @ -1177,8 +1148,6 @@ export default class Judge { | ||||
| 
 | ||||
|       arr.push(tempArr.join('')); | ||||
|     } | ||||
|     console.info(judgeTag,JSON.stringify(arr)) | ||||
|     // return arr.map(numStr => parseInt(numStr, 2));
 | ||||
|     return arr | ||||
|   } | ||||
|   // 获取考试项目详情
 | ||||
| @ -1296,10 +1265,9 @@ export default class Judge { | ||||
|   // 处理udp plc信号
 | ||||
|   handleUdp = async (msg) => { | ||||
|     console.info('plc信号', msg) | ||||
|     const {fileLog,getPlcData,usbService} = this | ||||
|     const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd} = this | ||||
|     const stachArr = msg.split(',') | ||||
|     const {isExamEnd} = this; | ||||
|     if (stachArr[0] != '#DN_GD' || isExamEnd) { | ||||
|     if (stachArr[0] != '#DN_GD' || isUdpEnd) { | ||||
|       return | ||||
|     } | ||||
|     const plcData = await getPlcData(msg); | ||||
| @ -1313,9 +1281,11 @@ export default class Judge { | ||||
|     this.judgeUI.isDwztRight = plcData.gps.dwzt == 4; | ||||
|     this.judgeUI.sd = (Math.floor(((plcData.gps.sd as number) || 0) * 1.852))  + ''; | ||||
|     this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' | ||||
|     await examJudgeRealExam(plcData) | ||||
|     if(isExamEnd){ | ||||
|       await examJudgeRealExam(plcData) | ||||
|     } | ||||
|     const udpIndex = globalThis.udpIndex; | ||||
|     if (udpIndex % 5 === 0 && !isExamEnd) { | ||||
|     if (udpIndex % 5 === 0 && !isUdpEnd) { | ||||
|       const judgeUdp = globalThis.judgeUdp | ||||
|       const bytes = await this.getMessageHeartbeat(); | ||||
|       console.info(judgeTag+'UDP',JSON.stringify(bytes)) | ||||
| @ -1373,9 +1343,7 @@ export default class Judge { | ||||
|         console.info(judgeTag, '模拟数据考试结束') | ||||
|         globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
|         clearInterval(judgeTimer) | ||||
|         await examJudgeEndExam() | ||||
|         this.isExamEnd = true | ||||
|         this.isManual = true | ||||
|         this.checkExamIsEnd(true) | ||||
|         return | ||||
|       } | ||||
|       const msg = JSON.parse(strArr[num]); | ||||
| @ -1464,6 +1432,8 @@ export default class Judge { | ||||
|   private isExam: boolean | ||||
|   //考试是否结束了
 | ||||
|   private isExamEnd: boolean | ||||
|   // 是否发送udp
 | ||||
|   private isUdpEnd: boolean = false | ||||
|   //是否手动结束考试
 | ||||
|   private isManual: boolean | ||||
|   //UDP服务序列号
 | ||||
|  | ||||
| @ -6,7 +6,7 @@ export const judgeConfig = { | ||||
|   //是否开启拍照
 | ||||
|   isPhotoOpen: true, | ||||
|   //扣分语音是否强制开启
 | ||||
|   kfVoiceOpen: false, | ||||
|   kfVoiceOpen: true, | ||||
|   //忽略的考试项目
 | ||||
|   ignoreProjects:[], | ||||
|   // 是否忽略考试前熄火、车门检查
 | ||||
| @ -16,7 +16,7 @@ export const judgeConfig = { | ||||
|   // 本地模型地址
 | ||||
|   modelPath: 'models/model_enc', | ||||
|   // 济南科目三
 | ||||
|   trajectoryPath: 'logs/2024_08_14/2024_08_14_11_30_20_9999805761528_344094918358022656_葛李弯/judge_exam_data.txt', | ||||
|   trajectoryPath: 'logs/2024_08_17/2024_08_17_16_51_24_9999282315477_203908531884520064_彭雯季/judge_exam_data.txt', | ||||
|   //四合一画面配置
 | ||||
|   fourInOneScreen:{ | ||||
|     //gps位数
 | ||||
|  | ||||
| @ -29,12 +29,12 @@ export default class JudgeTask { | ||||
|           await fn() | ||||
|           res(true) | ||||
|         } catch (e) { | ||||
|           console.info(TAG, JSON.stringify(e)) | ||||
|           console.info(TAG, '过程任务执行失败=>' + JSON.stringify(e)) | ||||
|           Prompt.showToast({ | ||||
|             message: '过程数据接口解析错误', | ||||
|             message: '过程任务执行失败=>' + JSON.stringify(e), | ||||
|             duration: 3000 | ||||
|           }); | ||||
|           rej(false) | ||||
|           res(false) | ||||
|         } | ||||
|       }, isDelay ? delayTime : 0); | ||||
|     }) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user