fix: 提交
This commit is contained in:
		
							parent
							
								
									55155a370b
								
							
						
					
					
						commit
						7df90207e8
					
				| @ -15,6 +15,7 @@ import { uploadExamProgressData, writeObjectOut } from '../../api/judge'; | ||||
| import UsbService from '../../common/service/usbService'; | ||||
| import { KF, LANE } from '../judgeSDK/api/judgeSDK.d'; | ||||
| import { endRecordVideo, saveStartRecordVideo } from '../../common/service/videoService'; | ||||
| 
 | ||||
| import { | ||||
|   Array2Byte, | ||||
|   convertGpsCoord2, | ||||
| @ -54,7 +55,7 @@ import { | ||||
|   examJudgeVersion | ||||
| } from './api/index'; | ||||
| import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | ||||
| import promptAction from '@ohos.promptAction'; | ||||
| import { GlobalConfig } from '../../config'; | ||||
| import Want from '@ohos.app.ability.Want'; | ||||
| 
 | ||||
| const judgeTag = 'SURENJUN_JUDGE' | ||||
| @ -66,7 +67,6 @@ function ifNeedRetry(code: number | string): boolean { | ||||
|   } | ||||
|   return false | ||||
| } | ||||
| 
 | ||||
| export default class Judge { | ||||
|   // 过程照片拍照
 | ||||
|   getPhoto = async (empty?: boolean) => { | ||||
| @ -168,17 +168,15 @@ export default class Judge { | ||||
|       map_point_item: mapPointItemArr, | ||||
|       //科目三暂时为空
 | ||||
|       iteminfo: [], | ||||
|       roads: getModelData('km3/Roads.txt'), | ||||
|       sharps: getModelData('km3/Sharps.txt') | ||||
|       roads: getModelData('Roads.txt'), | ||||
|       sharps: getModelData('Sharps.txt') | ||||
|     } | ||||
|   } | ||||
|   // 处理特殊参数配置
 | ||||
|   handleSEP = async (code: number) => { | ||||
|     const { | ||||
|       judgeUI:{ | ||||
|     const {judgeUI:{ | ||||
|       judgeConfigObj | ||||
|       }, avPlayer | ||||
|     } = this; | ||||
|     },avPlayer} = this; | ||||
|     const {examSubject} = globalThis.carInfo; | ||||
| 
 | ||||
|     switch (code) { | ||||
| @ -244,7 +242,6 @@ export default class Judge { | ||||
|   } | ||||
|   // 处理udp plc信号
 | ||||
|   handleUdp = async (msg) => { | ||||
|     console.info('plc信号', msg) | ||||
|     const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd,judgeUI} = this | ||||
|     const stachArr = msg.split(',') | ||||
|     if (stachArr[0] != '#DN_GD' || isUdpEnd) { | ||||
| @ -265,20 +262,23 @@ export default class Judge { | ||||
|     this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' | ||||
|     //TODO 暂时关闭差分检测异常
 | ||||
|     // await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
 | ||||
|     if (!isExamEnd) { | ||||
|       await examJudgeRealExam(plcData) | ||||
|     } | ||||
|     const udpIndex = globalThis.udpIndex; | ||||
|     let [prevJd, preWd] = [0, 0] | ||||
|     if (udpIndex % 5 === 0 && !isUdpEnd) { | ||||
|       const judgeUdp = globalThis.judgeUdp | ||||
|       const bytes = await this.getMessageHeartbeat(isExamEnd); | ||||
|       judgeUdp.send(bytes) | ||||
|     } | ||||
|     if (!isExamEnd) { | ||||
|       console.info(judgeTag, 'start examJudgeRealExam') | ||||
|       await examJudgeRealExam(plcData) | ||||
|       console.info(judgeTag, 'end examJudgeRealExam') | ||||
|     } | ||||
|     let [prevJd, preWd] = [0, 0] | ||||
|     globalThis.udpIndex += 1 | ||||
|   } | ||||
|   private fileLog | ||||
|   private filePath | ||||
|   private bklx: number = 0 | ||||
|   private totalScore: number | ||||
|   private prevJd: number = 0 | ||||
|   private prevWd: number = 0 | ||||
| @ -287,7 +287,7 @@ export default class Judge { | ||||
|   private modelPath: string | ||||
|   private avPlayer | ||||
|   private carztStr: string | ||||
|   private rmndg: 0 | 1 | ||||
|   private rmndg: 0 | 1 | 2 | ||||
|   private mndgStr: string | undefined | ||||
|   // 模拟灯光
 | ||||
|   setMndg = async (mndgStr: string) => { | ||||
| @ -321,7 +321,7 @@ export default class Judge { | ||||
|     const tJD = convertGpsCoord2(jd) | ||||
|     const tWD = convertGpsCoord2(wd) | ||||
|     const {prevJd,prevWd} = this | ||||
|     if (prevJd && dwzt == 4 && jdzt == 3) { | ||||
|     if (prevJd && dwzt == 4 && jdzt == 3 && !globalThis.singlePlay) { | ||||
|       const distance = await examCalcGpsDistance({ | ||||
|         jd1: prevJd, | ||||
|         wd1: prevWd, | ||||
| @ -330,7 +330,7 @@ export default class Judge { | ||||
|         h: hxj || 1, | ||||
|       }) | ||||
|       //@ts-ignore
 | ||||
|       globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1) | ||||
|       // globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
 | ||||
|     } | ||||
|     this.prevJd = tJD; | ||||
|     this.prevWd = tWD; | ||||
| @ -338,7 +338,7 @@ export default class Judge { | ||||
|   private performInfo: any | ||||
|   private isEndTip: boolean = false; | ||||
|   private deductedPopShowTimer: number = 0; | ||||
|   // 校验考试是否结束
 | ||||
| 
 | ||||
|   // 校验考试是否结束
 | ||||
|   checkExamIsEnd = | ||||
|     async (isManual?: boolean) => { | ||||
| @ -470,6 +470,8 @@ export default class Judge { | ||||
|   //所有的科目考试项目(大车&小车)
 | ||||
|   private testKmItems: any | ||||
|   private plcData: any | ||||
|   //特殊扣分标记
 | ||||
|   private specialkf:string = '' | ||||
|   // 获取plc数据
 | ||||
|   getPlcData = async (plc: string) => { | ||||
|     const {fileLog,mndgStr,rmndg} = this; | ||||
| @ -500,6 +502,7 @@ export default class Judge { | ||||
|       const msgStr = strArr[num]; | ||||
|       if (msgStr == '') { | ||||
|         console.info(judgeTag, '模拟数据考试结束') | ||||
|         globalThis.windowClass.setWindowSystemBarEnable(['navigation']) | ||||
|         clearInterval(judgeTimer) | ||||
|         this.checkExamIsEnd(true) | ||||
|         return | ||||
| @ -520,11 +523,14 @@ export default class Judge { | ||||
|       if (msg.method === 'examJudgeArtificialMark') { | ||||
|         setJudgeItem(msg.itemno, msg.serial) | ||||
|       } | ||||
|       msg.sensor.rmndg = this.rmndg | ||||
|       await fileLog.setExamJudgeData(msg) | ||||
|       await examJudgeRealExam(msg) | ||||
|       this.rmndg = 0 | ||||
|       const bytes = await this.getMessageHeartbeat(); | ||||
|       bytes && globalThis.judgeUdp.send(bytes) | ||||
| 
 | ||||
|     }, 200) | ||||
|     }, 1000) | ||||
| 
 | ||||
|     globalThis.judgeTimer = judgeTimer; | ||||
|   } | ||||
| @ -536,19 +542,17 @@ export default class Judge { | ||||
|   // 调代理接口是否断网了
 | ||||
|   private isJudgeDisConnect: boolean; | ||||
|   // 项目开始接口同步
 | ||||
|   beginProject = async (ksxm) => { | ||||
|   beginProject = async (ksxm,xmxh?:string) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo } = carInfo; | ||||
|     const { judgeUI, fileLog, getSbbm, xmxh, filePath } = this; | ||||
|     const {judgeUI,fileLog,getSbbm,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = projectsObj[ksxm] | ||||
|     const sbxh = getSbbm(ksxm, xmxh) | ||||
|     const sbxh = getSbbm(ksxm, xmxh || this.xmxh) | ||||
|     const data = { | ||||
|       //系统类别   接口序列号             接口标识
 | ||||
|       xtlb: '17', | ||||
|       jkxlh: serialNumber, | ||||
|       jkid: '17C52', | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C52', | ||||
|       drvexam: { | ||||
|         //   考试科目            身份证号码
 | ||||
|         lsh, | ||||
| @ -572,20 +576,18 @@ export default class Judge { | ||||
|     promptWxCode('17C52', code) | ||||
|   } | ||||
|   // 项目结束接口同步
 | ||||
|   endProject = async (ksxm) => { | ||||
|   endProject = async (ksxm,xmxh?:string) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const deviceNo = globalThis.deviceNo; | ||||
|     const { examSubject,plateNo,carNo } = carInfo; | ||||
|     const { judgeUI, fileLog, getSbxh, xmxh, getSbbm, filePath } = this; | ||||
|     const {judgeUI,fileLog,getSbxh,getSbbm,filePath} = this; | ||||
|     const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = projectsObj[ksxm] | ||||
|     const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh) | ||||
|     const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh || this.xmxh) | ||||
| 
 | ||||
|     const data = { | ||||
|       xtlb: '17', | ||||
|       jkxlh: serialNumber, | ||||
|       jkid: '17C55', | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C55', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kskm: examSubject, | ||||
| @ -602,97 +604,25 @@ export default class Judge { | ||||
|       } | ||||
|     } | ||||
|     const {code} = await this.sendWriteObjectOut(data, filePath) | ||||
| 
 | ||||
|     //科三 & 432=3
 | ||||
|     if(examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2){ | ||||
|       this.judgeUI.uploadMileage() | ||||
|     } | ||||
| 
 | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true; | ||||
|     } | ||||
|     console.info(judgeTag, '项目结束 end') | ||||
|     promptWxCode('17C55', code) | ||||
|   } | ||||
|   // 考试过程照片
 | ||||
|   uploadProgressPhoto = async (ksxm) => { | ||||
|     const time = await getCurrentTime(); | ||||
|     const { judgeUI, plcData, getPhoto, fileLog, filePath } = this; | ||||
|     const photoBase64 = await getPhoto(); | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject, plateNo, carNo } = carInfo; | ||||
|     const { lsh, idCard, serialNumber, projectsObj, ksdd, judgeConfigObj } = judgeUI; | ||||
|     const { sensor, gps } = plcData | ||||
|     const project = projectsObj[ksxm] | ||||
| 
 | ||||
|     const data = { | ||||
|       xtlb: '17', | ||||
|       jkxlh: serialNumber, | ||||
|       jkid: '17C54', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kskm: examSubject, | ||||
|         ksxm: project.projectCodeCenter, | ||||
|         sfzmhm: idCard, | ||||
|         kchp: encodeURI(plateNo), | ||||
|         zpsj: time, | ||||
|         //@ts-ignore
 | ||||
|         zp: photoBase64, | ||||
|         cs: Math.floor((judgeConfigObj['350'] == 0 ? gps.sd : sensor.cs) * 1.852), | ||||
|         ksdd: encodeURI(ksdd) | ||||
|       } | ||||
|     }; | ||||
|     const { code } = await this.sendWriteObjectOut(data, filePath); | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     promptWxCode('17C54', code) | ||||
|     console.info(judgeTag, '上传照片 end') | ||||
|   } | ||||
|   private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] | ||||
|   private lane: LANE = { | ||||
|     road: '', num: 0, count: 0 | ||||
|   } | ||||
|   private videoData: any | ||||
|   private disConnectNum: number = 0; | ||||
| 
 | ||||
|   constructor(judgeUI) { | ||||
|     this.serialIndex = 1; | ||||
|     this.judgeUI = judgeUI | ||||
|     //语音播放工具
 | ||||
|     this.avPlayer = new VoiceAnnounce(); | ||||
|     //模型工具
 | ||||
|     this.fileModel = new FileModel(judgeUI.context); | ||||
|     //文件工具
 | ||||
|     this.fileUtil = new FileUtil(judgeUI.context) | ||||
|     this.judgeTask = new JudgeTask() | ||||
|     this.usbService = new UsbService(); | ||||
|     this.filePhoto = new FilePhoto(judgeUI.context); | ||||
|     this.kfArr = judgeUI.kfArr | ||||
|     this.xmmcStr = ''; | ||||
|     this.xmmcCode = ''; | ||||
|     this.xmmcEndCode = undefined; | ||||
|     this.carztStr = ''; | ||||
|     this.testKmItems = {}; | ||||
|     // 考试回放配置
 | ||||
|     const { isTrajectoryOpen, modelPath, trajectoryPath } = judgeConfig | ||||
|     this.isTrajectoryOpen = isTrajectoryOpen; | ||||
|     this.modelPath = modelPath; | ||||
|     this.trajectoryPath = trajectoryPath; | ||||
| 
 | ||||
|     this.isExam = !this.judgeUI.singlePlay; | ||||
|     const { projectsCenterObj, examSubject } = judgeUI; | ||||
| 
 | ||||
|     (examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => { | ||||
|       const projectCenterObj = projectsCenterObj[item.code] | ||||
|       this.testKmItems[item.code] = item; | ||||
|       //考试项目存在
 | ||||
|       this.testKmItems[item.code] = { | ||||
|         code: item.code, | ||||
|         status: projectCenterObj === undefined | ||||
|           ? 0 | ||||
|           : (projectCenterObj.isEnd ? 3 : 1) | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag + 'testKmItems', JSON.stringify(this.testKmItems)) | ||||
|     this.isExamEnd = false; | ||||
|   } | ||||
| 
 | ||||
|   //调用监管接口
 | ||||
|   private externalTransmission: boolean = false | ||||
|   // 计算是否启动
 | ||||
|   private whetherToStart: boolean | ||||
| @ -748,6 +678,82 @@ export default class Judge { | ||||
|     this.disConnectNum = 0 | ||||
|     return temp | ||||
|   } | ||||
|   // 考试过程照片
 | ||||
|   uploadProgressPhoto = async (ksxm) => { | ||||
|     const time = await getCurrentTime(); | ||||
|     const {judgeUI,plcData,getPhoto,fileLog,filePath} = this; | ||||
|     const photoBase64 = await getPhoto(); | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo,carNo } = carInfo; | ||||
|     const {lsh,idCard,serialNumber,projectsObj,ksdd,judgeConfigObj} = judgeUI; | ||||
|     const {sensor,gps} = plcData | ||||
|     const project = projectsObj[ksxm] | ||||
| 
 | ||||
|     const data = { | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C54', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kskm: examSubject, | ||||
|         ksxm: project.projectCodeCenter, | ||||
|         sfzmhm: idCard, | ||||
|         kchp: encodeURI(plateNo), | ||||
|         zpsj: time, | ||||
|         //@ts-ignore
 | ||||
|         zp: photoBase64, | ||||
|         cs: Math.floor((judgeConfigObj['350'] == 0 ? gps.sd : sensor.cs) * 1.852), | ||||
|         ksdd: encodeURI(ksdd) | ||||
|       } | ||||
|     }; | ||||
|     const {code} = await this.sendWriteObjectOut(data, filePath); | ||||
|     if (code === 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
|     } | ||||
|     promptWxCode('17C54', code) | ||||
|     console.info(judgeTag, '上传照片 end') | ||||
|   } | ||||
| 
 | ||||
|   constructor(judgeUI) { | ||||
|     this.serialIndex = 1; | ||||
|     this.judgeUI = judgeUI | ||||
|     //语音播放工具
 | ||||
|     this.avPlayer = new VoiceAnnounce(); | ||||
|     //模型工具
 | ||||
|     this.fileModel = new FileModel(judgeUI.context); | ||||
|     //文件工具
 | ||||
|     this.fileUtil = new FileUtil(judgeUI.context) | ||||
|     this.judgeTask = new JudgeTask() | ||||
|     this.usbService = new UsbService(); | ||||
|     this.filePhoto = new FilePhoto(judgeUI.context); | ||||
|     this.kfArr = judgeUI.kfArr | ||||
|     this.xmmcStr = ''; | ||||
|     this.xmmcCode = ''; | ||||
|     this.xmmcEndCode = undefined; | ||||
|     this.carztStr = ''; | ||||
|     this.testKmItems = {}; | ||||
|     // 考试回放配置
 | ||||
|     const {isTrajectoryOpen,trajectoryPath} = judgeConfig | ||||
|     this.isTrajectoryOpen = isTrajectoryOpen; | ||||
|     this.modelPath = 'models'; | ||||
|     this.trajectoryPath = trajectoryPath; | ||||
| 
 | ||||
|     this.isExam = !this.judgeUI.singlePlay; | ||||
|     const {projectsCenterObj,examSubject} = judgeUI; | ||||
| 
 | ||||
|     (examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => { | ||||
|       const projectCenterObj = projectsCenterObj[item.code] | ||||
|       this.testKmItems[item.code] = item; | ||||
|       //考试项目存在
 | ||||
|       this.testKmItems[item.code] = { | ||||
|         code: item.code, | ||||
|         status: projectCenterObj === undefined | ||||
|           ? 0 | ||||
|           : (projectCenterObj.isEnd ? 3 : 1) | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag + 'testKmItems', JSON.stringify(this.testKmItems)) | ||||
|     this.isExamEnd = false; | ||||
|   } | ||||
| 
 | ||||
|   public async onJudgeFn(fn: Function) { | ||||
|     await this.judging(fn) | ||||
| @ -755,35 +761,43 @@ export default class Judge { | ||||
| 
 | ||||
|   // 获取评判初始化数据
 | ||||
|   getJudgeInitData = async () => { | ||||
|     const { getModelData, getKm3JudgeInitConfig } = this | ||||
|     const {getModelData,getKm3JudgeInitConfig,bklx} = this | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo,carId } = carInfo; | ||||
|     const judgeUI = this.judgeUI | ||||
|     const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI | ||||
|     const examType = examSubject == 2 ? 'km2' : 'km3' | ||||
|     const fileUtil = new FileUtil(globalThis.context) | ||||
|     const ipConfigStr = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); | ||||
|     const ipConfig = JSON.parse(ipConfigStr) | ||||
| 
 | ||||
|     let allitems = []; | ||||
|     if (examSubject == 2) { | ||||
|       allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { | ||||
|         const cdsb = itemInfoObj[cdsbKey]; | ||||
|         const {xmdm,xmxh,modelKey} = cdsb | ||||
|         const modelVal= getModelData(`${modelKey}.txt`) | ||||
|         if(modelVal){ | ||||
|           return { | ||||
|           xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) | ||||
|             xmdm, xmxh, model: modelVal | ||||
|           } | ||||
|       }) | ||||
|         }else{ | ||||
|           return undefined | ||||
|         } | ||||
|       }).filter(item => item !== undefined) | ||||
|     } | ||||
|     //获取版本号
 | ||||
|     const sdkver = await examJudgeVersion(); | ||||
|     const initInfo = { | ||||
|       sdkver, | ||||
|       appver: judgeConfig.version, | ||||
|       appver: globalThis.version, | ||||
|       kskm: examSubject * 1, | ||||
|       kchp: plateNo, | ||||
|       kchm: carId * 1, | ||||
|       kscx: carType, | ||||
|       cxcode: '1', | ||||
|       name: carName, | ||||
|       carmodel: getModelData(`${examType}/${carType}.txt`), | ||||
|       carmodel: getModelData(`${carType}.txt`), | ||||
|       allitems, | ||||
|       iteminfo: [], | ||||
|       systemparm: systemparmArr, | ||||
| @ -792,6 +806,8 @@ export default class Judge { | ||||
|       itemInfoObj, | ||||
|       carlist: judgeUI.carlist, | ||||
|       carinfo: carinfoArr, | ||||
|       //板卡类型
 | ||||
|       bklx, | ||||
|     }; | ||||
|     let km3Config = {} | ||||
| 
 | ||||
| @ -813,8 +829,7 @@ export default class Judge { | ||||
|     const {sczb,kfdm} = currentParams; | ||||
|     const {isExam} = this; | ||||
|     const judgeUI = this.judgeUI | ||||
|     const { projects, carType, kssycs, isDdxk, ddxkTime, projectsCenterObj, ddxkKsxmArr, ddxkKfArr, passingScore } = | ||||
|       judgeUI; | ||||
|     const {projects,carType,kssycs,isDdxk,ddxkTime,projectsCenterObj,ddxkKsxmArr,ddxkKfArr,passingScore} = judgeUI; | ||||
|     const beginInfo = { | ||||
|       kgid: '012', | ||||
|       kgxm: decodeURI(examinerName || ''), | ||||
| @ -852,16 +867,15 @@ export default class Judge { | ||||
|           xmdm: xmdm * 1, kfdm | ||||
|         } | ||||
|       })) : [], | ||||
|       //TODO 已考里程待修改
 | ||||
|       yklc: 0, | ||||
|       yklc: judgeUI.yklc, | ||||
|       special: [], | ||||
|       //TODO 科目三参数临时写死
 | ||||
|       sczb: (sczb === undefined || sczb == 0) ? 0 : 1, | ||||
|       sczbkf: kfdm, | ||||
|       dmndg: false, | ||||
|       mfxx: false, | ||||
|       mfxxn: false, | ||||
|       zeng: false | ||||
|       //科目三特殊扣分项
 | ||||
|       specialkf:judgeUI.specialkf, | ||||
|     } | ||||
|     console.info(judgeTag, '5.获取开始考试数据完成') | ||||
|     return beginInfo | ||||
| @ -969,7 +983,7 @@ export default class Judge { | ||||
|         const {examSubject} = this.judgeUI | ||||
|         const xmdm = xmqx.xmdm; | ||||
|         const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; | ||||
|         const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode); | ||||
|         // const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode);
 | ||||
|         // avPlayer.playAudio([`voice/${voiceCode}.mp3`],true)
 | ||||
|         this.judgeUI.projectsObj[xmdm].type = '1'; | ||||
|         this.testKmItems[xmmcCode].status = '1'; | ||||
| @ -1086,7 +1100,7 @@ export default class Judge { | ||||
|         if (!isEnd) { | ||||
|           judgeTask.addTask(async () => { | ||||
|             console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) | ||||
|             await beginProject(xmdm) | ||||
|             await beginProject(xmdm,xmxh) | ||||
|           }, { | ||||
|             isDelay: true | ||||
|           }) | ||||
| @ -1115,7 +1129,7 @@ export default class Judge { | ||||
|           if (!projectIsEnd) { | ||||
|             judgeTask.addTask(async () => { | ||||
|               console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) | ||||
|               await endProject(xmdm); | ||||
|               await endProject(xmdm,xmxh) | ||||
|               this.xmmcSingleCode = 0; | ||||
|               this.xmmcEndCode = undefined; | ||||
|             }, { | ||||
| @ -1137,8 +1151,7 @@ export default class Judge { | ||||
|         console.info('surenjun', '扣分开始') | ||||
|       //扣分时实时播报语音(0-否+1-是)
 | ||||
|         const currentKf = kf[kfLen -1]; | ||||
|         if (judgeConfig.kfVoiceOpen || (examSubject == 2 && judgeConfigObj['618'] == '1') || | ||||
|           (examSubject == 3 && judgeConfigObj['418'] == '1')) { | ||||
|         if (judgeConfig.kfVoiceOpen || (examSubject == 2 && judgeConfigObj['618'] == '1') || (examSubject == 3 && judgeConfigObj['418'] == '1')) { | ||||
|           avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`]) | ||||
|         } | ||||
|         const isStart = await checkProjectIsStart(currentKf.xmdm, 2, currentKf); | ||||
| @ -1194,8 +1207,8 @@ export default class Judge { | ||||
|     const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI | ||||
|     const time = await getCurrentTime(); | ||||
|     const project = getProjectInfo(ksxm); | ||||
|     //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目
 | ||||
|     const checkProjects = ['17', '41', '1']; | ||||
|     //科目三夜间行驶.模拟灯光、上车准备出现非本项目的扣分,ksxm需转换为为当前进行的项目
 | ||||
|     const checkProjects = ['1', '41', '17']; | ||||
|     //获取正在进行的项目
 | ||||
|     const inProjects = Reflect.ownKeys(projectsObj).filter(projectKey => projectsObj[projectKey].type == 2); | ||||
| 
 | ||||
| @ -1205,11 +1218,10 @@ export default class Judge { | ||||
|         commonKsxm = projectCode | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag, 'commonKsxm=>' + commonKsxm) | ||||
|     console.info(judgeTag, 'project=>' + project) | ||||
|     const data = { | ||||
|       xtlb: '17', | ||||
|       jkxlh: serialNumber, | ||||
|       jkid: '17C53', | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C53', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kskm: examSubject, | ||||
| @ -1217,7 +1229,7 @@ export default class Judge { | ||||
|           ? (commonKsxm | ||||
|             ? (projectsObj[commonKsxm].projectCodeCenter) | ||||
|             : (examSubject == 3 ? 30000 : (xmmcEndCode == undefined ? 10000 : xmmcEndCode))) | ||||
|           : project.projectCodeCenter, | ||||
|           : (projectsObj[commonKsxm]?.projectCodeCenter || project.projectCodeCenter), | ||||
|         kfxm: kf.markcatalog, | ||||
|         kfxmmx: `${ksxm},${kf.markserial}`, | ||||
|         sfzmhm: idCard, | ||||
| @ -1229,7 +1241,6 @@ export default class Judge { | ||||
|       } | ||||
|     } | ||||
|     console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm) | ||||
| 
 | ||||
|     const {code} = await this.sendWriteObjectOut(data, filePath); | ||||
|     if (code == 2300007) { | ||||
|       this.isJudgeDisConnect = true | ||||
| @ -1259,9 +1270,13 @@ export default class Judge { | ||||
|     } else { | ||||
|       //收到综合评判语音时,显示综合评判弹窗
 | ||||
|       if(code[0] == 'zhpp'){ | ||||
|         const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(','); | ||||
|         this.judgeUI.isDeductedPopShow = false | ||||
|         clearTimeout(this.deductedPopShowTimer) | ||||
|         if(param512[7] != 0){ | ||||
|           this.judgeUI.isDeductedPopShow = true | ||||
|           this.judgeUI.defaultTabIndex = 1 | ||||
|         } | ||||
|         this.isEndTip = true | ||||
|       } | ||||
|       avPlayer.playAudio([`voice/${code[0]}.mp3`]) | ||||
| @ -1280,12 +1295,13 @@ export default class Judge { | ||||
|     // this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0;
 | ||||
|     const singlePlay = globalThis.singlePlay | ||||
|     const param302 = judgeConfigObj['302']; | ||||
|     // globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
 | ||||
| 
 | ||||
|     //自动退出待验证并且不合格
 | ||||
|     if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && | ||||
|       totalScore < passingScore) { | ||||
|     if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { | ||||
|       avPlayer.playAudio([`voice/考试结束.mp3`]) | ||||
|     } | ||||
| 
 | ||||
|     //联网模式下:项目没有做完、当前分数大于及格分;手动结束直接退出
 | ||||
|     if (!singlePlay && isManual && !isAllProjectsEnd && totalScore >= passingScore) { | ||||
|       avPlayer.playAudio(['voice/empty.mp3'], true, () => { | ||||
| @ -1295,18 +1311,7 @@ export default class Judge { | ||||
|       }) | ||||
|       return | ||||
|     } | ||||
|     if (examSubject == 3) { | ||||
|       const param302 = judgeConfigObj['302']; | ||||
|       if (totalScore < passingScore) { | ||||
|         //考试不合格;考试模式,自动退出;
 | ||||
|         if (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8) { | ||||
| 
 | ||||
|         } | ||||
|       } else { | ||||
|         //考试合格
 | ||||
|       } | ||||
|     } | ||||
|     await handleSEP(306); | ||||
|     avPlayer.playAudio(['voice/exam_waiting.mp3'], globalThis.singlePlay, async () => { | ||||
|       try { | ||||
|         if (!singlePlay) { | ||||
| @ -1317,6 +1322,7 @@ export default class Judge { | ||||
|         console.info(judgeTag, JSON.stringify(e)) | ||||
|       } | ||||
|       await endExam() | ||||
| 
 | ||||
|     }); | ||||
| 
 | ||||
|   } | ||||
| @ -1330,22 +1336,22 @@ export default class Judge { | ||||
|       judgeUI, | ||||
|       ksjs, | ||||
|       getPhoto, | ||||
|       uploadProgressData, | ||||
|       uploadDisConnectData, | ||||
|       avPlayer, | ||||
|       kfArr, | ||||
|       judgeTask, | ||||
|       filePath, | ||||
|       closeAllFiles | ||||
|     } = this; | ||||
|     const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI | ||||
|     //TODO 断网考试结束补传
 | ||||
|     // await uploadDisConnectData();
 | ||||
|     try { | ||||
|     const time = await getCurrentTime(); | ||||
|     const photoBase64 = await getPhoto(); | ||||
|     const {d1,d2,d3,d4,d5} = ksjs | ||||
|     const data = { | ||||
|         xtlb: '17', | ||||
|         jkxlh: serialNumber, | ||||
|         jkid: '17C56', | ||||
|       xtlb: '17', jkxlh: serialNumber, jkid: '17C56', | ||||
|       drvexam: { | ||||
|         lsh, | ||||
|         kchp: encodeURI(plateNo), | ||||
| @ -1385,8 +1391,7 @@ export default class Judge { | ||||
|     let voiceURL = '' | ||||
|     if (examSubject == 2) { | ||||
|       if (isAllProjectsEnd) { | ||||
|           voiceURL = | ||||
|             (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') | ||||
|         voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') | ||||
|       } else { | ||||
|         voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` | ||||
|         currentKssycs = kssycs == 1 ? 0 : 1 | ||||
| @ -1488,14 +1493,6 @@ export default class Judge { | ||||
|       }) | ||||
|     } | ||||
| 
 | ||||
|     } catch (e) { | ||||
|       promptAction.showToast({ | ||||
|         message: "考试结束异常,请尝试重新结束", | ||||
|         duration: 3000 | ||||
|       }) | ||||
|       judgeUI.loadingPopupVisible = false | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   // 当前项目转换
 | ||||
| @ -1538,11 +1535,9 @@ export default class Judge { | ||||
|     } = this; | ||||
|     const singlePlay = globalThis.singlePlay | ||||
|     const {lsh,startHourTime,totalScore,examTime,judgeConfigObj} = judgeUI; | ||||
|     const { | ||||
|       fourInOneScreen:{ | ||||
|     const {fourInOneScreen:{ | ||||
|       gpsDigit | ||||
|       } | ||||
|     } = judgeConfig | ||||
|     }} = judgeConfig | ||||
|     const examType = examSubject == 2 ? 2 : 3 | ||||
|     const {sensor,gps} = tempData; | ||||
|     if (tempData.sensor === undefined) { | ||||
| @ -1559,14 +1554,15 @@ export default class Judge { | ||||
|     const sbxh = getSbxh(xmdm, xmxh) | ||||
|     const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; | ||||
|     const asclshArr = stringToASC( | ||||
|       fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13) | ||||
|       fillZero(( | ||||
|         singlePlay ? | ||||
|           (examSubject == 2 ? '0000000000000' : '0000000000000') : lsh) || 0, 13) | ||||
|     ); | ||||
|     //13不足要补0
 | ||||
|     const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) | ||||
|     const ascsbxhArr = stringToASC(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]) | ||||
|       [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]) | ||||
|     ) | ||||
|     //@ts-ignore
 | ||||
|     const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit); | ||||
| @ -1594,8 +1590,7 @@ export default class Judge { | ||||
|       translateSignals, | ||||
|       //速度                                                发动机转速                          GPS纬度                         GPS经度                         主天线位置
 | ||||
|       //@ts-ignore
 | ||||
|       string2Bytes(tempSd * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), | ||||
|       string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), | ||||
|       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北向距离
 | ||||
| @ -1714,9 +1709,8 @@ export default class Judge { | ||||
| 
 | ||||
|   // 获取模型数据
 | ||||
|   getModelData = (modelName) => { | ||||
|     const modelPath = this.modelPath | ||||
|     const fileModel = this.fileModel; | ||||
|     const modelData = fileModel.getModelContent(modelPath, modelName); | ||||
|     const modelData = fileModel.getModelContent('models', modelName); | ||||
|     return modelData | ||||
|   } | ||||
| 
 | ||||
| @ -1755,7 +1749,7 @@ export default class Judge { | ||||
|   // 检测差分状态
 | ||||
|   checkDwzt = async (type) => { | ||||
|     const {avPlayer} = this; | ||||
|     const judgeConfig = this.judgeUI.judgeConfig; | ||||
|     const config499 = this.judgeUI.judgeConfigObj['499']; | ||||
|     switch (type) { | ||||
|       case 0: | ||||
|         this.judgeUI.isDwztRight = true; | ||||
| @ -1763,10 +1757,17 @@ export default class Judge { | ||||
| 
 | ||||
|       case 1: | ||||
|         this.judgeUI.dwztErrorVisible = true; | ||||
|         clearInterval(this.judgeUI.timer); | ||||
|         clearInterval(globalThis.judgeTimer) | ||||
|         avPlayer.playAudio([`voice/差分状态异常.mp3`], true) | ||||
|         setTimeout(() => { | ||||
|           try { | ||||
|             this.checkExamIsEnd(true); | ||||
|           } catch (e) { | ||||
|             this.closeAllFiles() | ||||
|             router.back() | ||||
|         }, 3000) | ||||
|           } | ||||
|         }, config499 * 1000) | ||||
|         break; | ||||
| 
 | ||||
|       case 2: | ||||
| @ -1794,13 +1795,19 @@ export default class Judge { | ||||
|   //开始评判
 | ||||
|   private async judging(callBack: Function) { | ||||
|     const {judgeUI} = this; | ||||
|     const { name, lsh, idCard, kssycs, manualMarkRules } = judgeUI; | ||||
|     const { name, lsh, idCard,kssycs,markRules} = judgeUI; | ||||
|     const fileLog = new FileLog(judgeUI.context); | ||||
|     const filePath = await fileLog.initFileLogo({ | ||||
|       name, lsh, idCard | ||||
|     }); | ||||
| 
 | ||||
|     const ipFileUtil = new FileUtil(globalThis.context) | ||||
|     const ipConfigStr = await ipFileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); | ||||
|     const ipConfig = JSON.parse(ipConfigStr) | ||||
| 
 | ||||
|     this.fileLog = fileLog; | ||||
|     this.filePath = filePath; | ||||
|     this.bklx = Number(ipConfig.cardType) | ||||
| 
 | ||||
|     const { | ||||
|       getJudgeBeginData, | ||||
| @ -1845,6 +1852,7 @@ export default class Judge { | ||||
|       this.handleRealExam(strData, callBack) | ||||
|     }) | ||||
| 
 | ||||
| 
 | ||||
|     await examJudgeSetPerformCallback(async (info) => { | ||||
|       console.info('评判实时数据', info) | ||||
|       const performInfo = JSON.parse(info) | ||||
| @ -1856,6 +1864,11 @@ export default class Judge { | ||||
|       this.judgeUI.jl = jl | ||||
|       //TODO 待优化 跨组件传值不生效
 | ||||
|       globalThis.laneData = performInfo.lane; | ||||
|       //特殊扣分标记上传中心
 | ||||
|       if(performInfo.specialkf !== this.specialkf){ | ||||
|         this.judgeUI.uploadMileage(performInfo.specialkf) | ||||
|         this.specialkf = performInfo.specialkf | ||||
|       } | ||||
|     }) | ||||
| 
 | ||||
|     // 3.开始考试
 | ||||
| @ -1872,7 +1885,7 @@ export default class Judge { | ||||
|     if (!globalThis.singlePlay) { | ||||
|       this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) | ||||
|     } | ||||
| 
 | ||||
|     globalThis.statue = 4 | ||||
|     const {examSubject,projectsObj} = this.judgeUI | ||||
|     // if(examSubject == 3){
 | ||||
|     //   //不做模拟灯光,需要做上车准备 =>(请上车准备)
 | ||||
| @ -1901,7 +1914,8 @@ export default class Judge { | ||||
|         handDistance(); | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     //页面逻辑处理完成
 | ||||
|     this.judgeUI.isInitSuccess = true; | ||||
|     // this.checkExamIsEnd()
 | ||||
| 
 | ||||
|     //监听远程结束考试
 | ||||
| @ -1909,18 +1923,33 @@ export default class Judge { | ||||
|       this.checkExamIsEnd(true); | ||||
|     }) | ||||
| 
 | ||||
|     console.info(judgeTag, JSON.stringify(manualMarkRules)) | ||||
|     console.info(judgeTag, JSON.stringify(markRules)) | ||||
| 
 | ||||
|     //监听远程扣分
 | ||||
|     globalThis.udpEvent.onKfExam(async (content) => { | ||||
|       //为1时,所有扣分项均可远程扣分;其它,只能扣 MARKSERIAL 大于 99 的扣分项
 | ||||
|       const config810 = this.judgeUI.judgeConfigObj['810']; | ||||
|       console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) | ||||
|       const { kfxh , directives } = content.data; | ||||
|       console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`) | ||||
| 
 | ||||
|       //根据扣分序号找扣分代码
 | ||||
|       const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0]; | ||||
|       const currentKf = markRules.filter(mark => ( | ||||
|         mark.kfxh == kfxh && (config810 == 1 || mark.markserial > 99) | ||||
|       ))[0]; | ||||
| 
 | ||||
|       console.info(judgeTag, '扣分项目:' + JSON.stringify(currentKf)) | ||||
|       this.setJudgeMark(currentKf.itemno, currentKf.markserial, 2); | ||||
|       globalThis.judgeUdp.confirmKf(directives, 1) | ||||
|     }) | ||||
| 
 | ||||
|     //监听远程终止考试
 | ||||
|     globalThis.udpEvent.onStopExam(async () => { | ||||
|       const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(','); | ||||
|       console.info(judgeTag, '开始远程终止考试扣分') | ||||
|       this.setJudgeMark(config392[0]*1, config392[1], 2); | ||||
|     }) | ||||
| 
 | ||||
|     this.checkExamIsEnd(); | ||||
| 
 | ||||
|   } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user