diff --git a/entry/src/main/ets/api/judgeNew.ts b/entry/src/main/ets/api/judgeNew.ts index 13900b72..63497b1f 100644 --- a/entry/src/main/ets/api/judgeNew.ts +++ b/entry/src/main/ets/api/judgeNew.ts @@ -21,10 +21,10 @@ interface WR { export default async function writeObjectOutNew(data, filePath): Promise { const fileUtil = new FileUtil(globalThis.context); - const {jkid , drvexam} = data; + const { jkid, drvexam } = data; const basic = await getBasicConfig(jkid); const params = await getParams(jkid, drvexam); - const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; + const { wglb, jkxlh, glbm, jgbh, sjbs } = basic; if (filePath) { await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ @@ -79,7 +79,7 @@ export default async function writeObjectOutNew(data, filePath): Promise { globalThis.serviceExtProxy.processData("1", (errorCode: number, retVal: string) => { console.log("lixiao result", errorCode, JSON.stringify(retVal)) let result = JSON.parse(retVal) - if (result.code === 0 ) { + if (result.code === 0) { resolve(result.data) } else { emitter.emit({ @@ -92,33 +92,6 @@ export default async function writeObjectOutNew(data, filePath): Promise { }) } temp = await fn() - - // temp = await request({ - // host: globalThis.JGHOST, - // method: 'post', - // //是否是新中心 - // isNewCenter: true, - // xml: true, - // url: '/dems_ws/services/TmriOutAccess?wsdl', - // data: ` - // - // - // - // ${wglb} - // ${jkxlh} - // ${glbm} - // ${jgbh} - // ${sjbs} - // ${JSON.stringify(params.data)} - // ${JSON.stringify(params.file)} - // - // - // `, - // }) } catch (e) { console.log("新监管错误") temp = e diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 7a989cf2..fce50bc6 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -65,7 +65,7 @@ export default class Judge { if (singlePlay) { return '' } else { - const {filePhoto} = this; + const { filePhoto } = this; const photoBase64 = await filePhoto.getPhoto(); console.info(judgeTag, '拍照完成') return photoBase64 @@ -73,7 +73,7 @@ export default class Judge { } //人工操作项目 public setJudgeItem = async (itemno, type: 1 | 2) => { - const {fileLog} = this; + const { fileLog } = this; await examJudgeArtificialItem(itemno * 1, type); await fileLog.setExamJudgeData({ method: 'examJudgeArtificialItem', @@ -84,7 +84,7 @@ export default class Judge { } //人工扣分 public setJudgeMark = async (itemno, serial, type = 1) => { - const {fileLog} = this + const { fileLog } = this await examJudgeArtificialMark(itemno * 1, serial, type); console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`) await fileLog.setExamJudgeData({ @@ -98,7 +98,7 @@ export default class Judge { } // 断网数据补传 uploadDisConnectData = async () => { - const {isJudgeDisConnect,fileLog,fileUtil} = this; + const { isJudgeDisConnect, fileLog, fileUtil } = this; if (!isJudgeDisConnect) { return } @@ -112,10 +112,10 @@ export default class Judge { } //上传无锡所过程数据 uploadProgressData = async () => { - const {judgeUI,fileUtil,fileLog} = this; - const {idCard,startFullTime} = judgeUI + const { judgeUI, fileUtil, fileLog } = this; + const { idCard, startFullTime } = judgeUI const carInfo = globalThis.carInfo; - const {carId,examinationRoomId} = carInfo + const { carId, examinationRoomId } = carInfo const folderPath = fileLog.folderPath const base64 = new util.Base64(); const time = await getCurrentTime(); @@ -151,8 +151,8 @@ export default class Judge { } //获取科目三的评判初始化配置 getKm3JudgeInitConfig = async () => { - const {judgeUI,getModelData} = this; - const {mapPointArr,mapPointItemArr} = judgeUI; + const { judgeUI, getModelData } = this; + const { mapPointArr, mapPointItemArr } = judgeUI; return { map_point: mapPointArr, map_point_item: mapPointItemArr, @@ -164,10 +164,12 @@ export default class Judge { } // 处理特殊参数配置 handleSEP = async (code: number) => { - const {judgeUI:{ - judgeConfigObj - },avPlayer} = this; - const {examSubject} = globalThis.carInfo; + const { + judgeUI:{ + judgeConfigObj + }, avPlayer + } = this; + const { examSubject } = globalThis.carInfo; switch (code) { //结束考试方式 @@ -186,9 +188,9 @@ export default class Judge { if (xmdm == 20) { return true } - const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd,totalScore} = this; - const {projectsObj,passingScore:passingGrade} = this.judgeUI - const {isUpload} = projectsObj[xmdm]; + const { judgeTask, beginProject, pointsDedute, uploadProgressPhoto, endProject, checkExamIsEnd, totalScore } = this; + const { projectsObj, passingScore:passingGrade } = this.judgeUI + const { isUpload } = projectsObj[xmdm]; //如果项目没有开始 console.info('surenjun isUpload=>', isUpload) if (!isUpload) { @@ -233,7 +235,7 @@ export default class Judge { // 处理udp plc信号 handleUdp = async (msg) => { console.info('plc信号', msg) - const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd,judgeUI} = this + const { fileLog, getPlcData, usbService, isUdpEnd, isExamEnd, judgeUI } = this const stachArr = msg.split(',') if (stachArr[0] != '#DN_GD' || isUdpEnd) { return @@ -305,10 +307,10 @@ export default class Judge { private tempData: any //实时计算gps经纬度距离 handDistance = async () => { - const {jd,wd,hxj,dwzt,jdzt} = this.tempData.gps; + const { jd, wd, hxj, dwzt, jdzt } = this.tempData.gps; const tJD = convertGpsCoord2(jd) const tWD = convertGpsCoord2(wd) - const {prevJd,prevWd} = this + const { prevJd, prevWd } = this if (prevJd && dwzt == 4 && jdzt == 3) { const distance = await examCalcGpsDistance({ jd1: prevJd, @@ -329,8 +331,9 @@ export default class Judge { // 校验考试是否结束 checkExamIsEnd = async (isManual?: boolean) => { - const {judgeUI,avPlayer,isExamEnd,isEndTip,ksjs} = this; - const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore,examMileage,jl} = judgeUI; + const { judgeUI, avPlayer, isExamEnd, isEndTip, ksjs } = this; + const { isAllProjectsEnd, examSubject, singlePlay, totalScore, judgeConfigObj, passingScore, examMileage, jl } = + judgeUI; if (isExamEnd) { return @@ -353,7 +356,8 @@ export default class Judge { if (isAllProjectsEnd && jl >= examMileage) { //成绩合格 if (totalScore >= passingGrade && !isEndTip) { - if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { + if (examSubject == 3 && (param342 == 0 || param342 == 2) && + (param302 != 6 || param302 != 7 || param302 != 8)) { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) avPlayer.playAudio(['voice/综合评判.mp3']) @@ -410,7 +414,8 @@ export default class Judge { return } - if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { + if (examSubject == 3 && (param342 == 0 || param342 == 2) && + (param302 != 6 || param302 != 7 || param302 != 8)) { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = false @@ -459,7 +464,7 @@ export default class Judge { private plcData: any // 获取plc数据 getPlcData = async (plc: string) => { - const {fileLog,mndgStr,rmndg} = this; + const { fileLog, mndgStr, rmndg } = this; await fileLog.setPlcProgressData(plc) //plc字符串转化成评判初始化数据 const tempData = await plcStrToJson(plc); @@ -481,7 +486,7 @@ export default class Judge { } // 处理轨迹plc信号 handleTrajectoryUdp = async (strArr) => { - const {fileLog,setJudgeItem,setJudgeMark,endExam} = this; + const { fileLog, setJudgeItem, setJudgeMark, endExam } = this; let num = 2; const judgeTimer = setInterval(async () => { const msgStr = strArr[num]; @@ -526,15 +531,17 @@ export default class Judge { // 项目开始接口同步 beginProject = async (ksxm) => { const carInfo = globalThis.carInfo; - const { examSubject,plateNo } = carInfo; - const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; - const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI + const { examSubject, plateNo } = carInfo; + const { judgeUI, fileLog, getSbbm, xmxh, 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 data = { //系统类别 接口序列号 接口标识 - xtlb: '17', jkxlh: serialNumber, jkid: '17C52', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C52', drvexam: { // 考试科目 身份证号码 lsh, @@ -550,7 +557,7 @@ export default class Judge { kssj: time } } - const {code} = await this.sendWriteObjectOut(data, filePath) + const { code } = await this.sendWriteObjectOut(data, filePath) console.info(judgeTag, '项目开始 end') if (code === 2300007) { this.isJudgeDisConnect = true; @@ -561,15 +568,17 @@ export default class Judge { endProject = async (ksxm) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; - const { examSubject,plateNo,carNo } = carInfo; - const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; - const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI + const { examSubject, plateNo, carNo } = carInfo; + const { judgeUI, fileLog, getSbxh, xmxh, 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 data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C55', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C55', drvexam: { lsh, kskm: examSubject, @@ -585,53 +594,28 @@ export default class Judge { jssj: time } } - const {code} = await this.sendWriteObjectOut(data, filePath) + const { code } = await this.sendWriteObjectOut(data, filePath) if (code === 2300007) { this.isJudgeDisConnect = true; } console.info(judgeTag, '项目结束 end') promptWxCode('17C55', code) } - private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] - private lane: LANE = { - road: '', num: 0, count: 0 - } - private videoData: any - private disConnectNum: number = 0; - //调用监管接口 - sendWriteObjectOut = async (data, filePath) => { - const temp = await writeObjectOut(data, filePath); - 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) - } - } - - if (this.disConnectNum >= 5) { - console.info('surenjun', '123') - this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; - this.judgeUI.disConnectErrorOpen = true - } - - this.disConnectNum = 0 - return temp - } // 考试过程照片 uploadProgressPhoto = async (ksxm) => { const time = await getCurrentTime(); - const {judgeUI,plcData,getPhoto,fileLog,filePath} = this; + 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 { 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', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C54', drvexam: { lsh, kskm: examSubject, @@ -645,13 +629,19 @@ export default class Judge { ksdd: encodeURI(ksdd) } }; - const {code} = await this.sendWriteObjectOut(data, filePath); + 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; @@ -672,13 +662,13 @@ export default class Judge { this.carztStr = ''; this.testKmItems = {}; // 考试回放配置 - const {isTrajectoryOpen,modelPath,trajectoryPath} = judgeConfig + const { isTrajectoryOpen, modelPath, trajectoryPath } = judgeConfig this.isTrajectoryOpen = isTrajectoryOpen; this.modelPath = modelPath; this.trajectoryPath = trajectoryPath; this.isExam = !this.judgeUI.singlePlay; - const {projectsCenterObj,examSubject} = judgeUI; + const { projectsCenterObj, examSubject } = judgeUI; (examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => { const projectCenterObj = projectsCenterObj[item.code] @@ -696,24 +686,56 @@ export default class Judge { this.isExamEnd = false; } + //调用监管接口 + sendWriteObjectOut = async (data, filePath) => { + const temp = await writeObjectOut(data, filePath); + console.log("wzj", JSON.stringify(temp)) + if (this.disConnectNum == 0) { + console.log("wzj", "第一次发送", JSON.stringify(data)) + } + if (this.disConnectNum < 5 && this.disConnectNum > 0) { + console.log("wzj", "第" + this.disConnectNum + "次重新发送", JSON.stringify(data)) + } + //断网&网络超时次数计算 + if (temp.code == 2300007 || temp.code == 2300028) { + this.disConnectNum += 1; + if (this.disConnectNum < 5) { + if (temp.code == 2300028) { + await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟1秒 + } else { + 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 + } + public async onJudgeFn(fn: Function) { await this.judging(fn) } // 获取评判初始化数据 getJudgeInitData = async () => { - const {getModelData,getKm3JudgeInitConfig} = this + const { getModelData, getKm3JudgeInitConfig } = this const carInfo = globalThis.carInfo; - const { examSubject,plateNo,carId } = carInfo; + const { examSubject, plateNo, carId } = carInfo; const judgeUI = this.judgeUI - const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI + const { projectsObj, itemInfoObj, markRuleListObj, carType, carName, systemparmArr, carinfoArr } = judgeUI const examType = examSubject == 2 ? 'km2' : 'km3' let allitems = []; if (examSubject == 2) { allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { const cdsb = itemInfoObj[cdsbKey]; - const {xmdm,xmxh,modelKey} = cdsb + const { xmdm, xmxh, modelKey } = cdsb return { xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) } @@ -755,12 +777,13 @@ export default class Judge { // 获取开始考试数据 getJudgeBeginData = async () => { - const {code,name:examinerName} = globalThis.examinerInfo; + const { code, name:examinerName } = globalThis.examinerInfo; let currentParams: any = router.getParams(); - const {sczb,kfdm} = currentParams; - const {isExam} = this; + 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 || ''), @@ -816,14 +839,14 @@ export default class Judge { //处理评判过程回调 handleRealExam = async (strData, callBack) => { let examData: EXAMDATA = JSON.parse(strData); - const {getDqxmStr,getKfStr,goJudgeVoice,setMndg,avPlayer,fileLog,judgeUI} = this; - const {carzt,xmks,kf,event,xmjs,xmqx,ksjs,sound,mndg,lane,precast,nongps} = examData + const { getDqxmStr, getKfStr, goJudgeVoice, setMndg, avPlayer, fileLog, judgeUI } = this; + const { carzt, xmks, kf, event, xmjs, xmqx, ksjs, sound, mndg, lane, precast, nongps } = examData const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); //获取项目结束、项目开始代码 const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm const xmxh = event == 2 ? xmjs.xmxh : xmks.xmxh; const isManualProjectIn = this.artSubject3ProjectsCodesArr.includes(xmdm); - const {examSubject,projects,judgeConfigObj} = this.judgeUI; + const { examSubject, projects, judgeConfigObj } = this.judgeUI; const param611 = judgeConfigObj['611'] || ''; switch (event) { //项目开始 @@ -873,7 +896,7 @@ export default class Judge { //扣分 case 3: const thisKf = getKfStr(`${kf.xmdm}_${kf.kfdm}`) - //扣分信息 + //扣分信息 this.kfArr.push({ //扣分项目名称 xmmcStr: getDqxmStr(kf.xmdm), @@ -912,7 +935,7 @@ export default class Judge { //项目取消 case 6: { console.info(judgeTag, '项目取消'); - const {examSubject} = this.judgeUI + const { examSubject } = this.judgeUI const xmdm = xmqx.xmdm; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode); @@ -942,7 +965,7 @@ export default class Judge { case 10: { const param611 = judgeConfigObj['611'] || ''; const [f, s] = param611.split('/') - const {xmdm,xmxh} = precast; + const { xmdm, xmxh } = precast; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; // if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){ @@ -961,7 +984,7 @@ export default class Judge { //差分事件 case 11: { - const {type} = nongps + const { type } = nongps this.checkDwzt(type) } default: @@ -969,7 +992,7 @@ export default class Judge { } - const {xmmcStr,carztStr,kfArr} = this; + const { xmmcStr, carztStr, kfArr } = this; await callBack({ //项目名称 考车状态 扣分arr @@ -1002,7 +1025,7 @@ export default class Judge { closeAllFiles } = this; - const {projectsObj,judgeConfigObj,examSubject,examMileage,jl,isAllProjectsEnd} = judgeUI; + const { projectsObj, judgeConfigObj, examSubject, examMileage, jl, isAllProjectsEnd } = judgeUI; const kfLen = kf.length; //不报语音的项目列表 const ignoreVoiceCodeArr = (judgeConfigObj['312'] || '').split(',') @@ -1015,20 +1038,20 @@ export default class Judge { const code = projectsObj[xmdm].projectCodeCenter; const isEnd = projectsObj[xmdm].isEnd; const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane, xmxh) - // if (!ignoreVoiceCodeArr.includes(code)) { - // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ - // //倒出入库、桩考\进项目语音控制 - // }else{ - // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) - // } - // } + // if (!ignoreVoiceCodeArr.includes(code)) { + // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ + // //倒出入库、桩考\进项目语音控制 + // }else{ + // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) + // } + // } setTimeout(() => { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = true } }, 200) - //项目已考不上传监管信息 + //项目已考不上传监管信息 if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) @@ -1081,9 +1104,10 @@ export default class Judge { // 扣分 case 3: console.info('surenjun', '扣分开始') - //扣分时实时播报语音(0-否+1-是) + //扣分时实时播报语音(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); @@ -1104,7 +1128,7 @@ export default class Judge { // 考试结束 case 5: console.info(judgeTag, '考试结束') - //关闭录像 + //关闭录像 if (!globalThis.singlePlay) { await endRecordVideo(this.videoData) } @@ -1134,9 +1158,9 @@ export default class Judge { pointsDedute = async (ksxm, kf) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; - const { examSubject,plateNo,carNo } = carInfo; - const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,xmmcEndCode,filePath} = this; - const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI + const { examSubject, plateNo, carNo } = carInfo; + const { judgeUI, getProjectInfo, fileLog, xmmcSingleCode, xmmcEndCode, filePath } = this; + const { lsh, idCard, serialNumber, ksdd, projectsObj } = judgeUI const time = await getCurrentTime(); const project = getProjectInfo(ksxm); //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目 @@ -1152,7 +1176,9 @@ export default class Judge { }) const data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C53', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C53', drvexam: { lsh, kskm: examSubject, @@ -1173,7 +1199,7 @@ export default class Judge { } console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm) - const {code} = await this.sendWriteObjectOut(data, filePath); + const { code } = await this.sendWriteObjectOut(data, filePath); if (code == 2300007) { this.isJudgeDisConnect = true } @@ -1183,8 +1209,8 @@ export default class Judge { // 评判语音提示 goJudgeVoice = async (sound: SOUND) => { - const {avPlayer,fileLog} = this; - const {xmdm,code,type} = sound; + const { avPlayer, fileLog } = this; + const { xmdm, code, type } = sound; console.info('surenjun code=>', JSON.stringify(code)) //判断是不是模拟灯光语音 if (type == 1) { @@ -1209,9 +1235,9 @@ export default class Judge { this.judgeUI.loadingPopupVisible = true; this.judgeUI.endPopupVisible = false; this.judgeUI.isDeductedPopShow = false; - const {qjjl,dcjl} = ksjs - const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual,closeAllFiles} = this; - const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; + const { qjjl, dcjl } = ksjs + const { judgeUI, endExam, handleSEP, kfArr, avPlayer, judgeTask, isManual, closeAllFiles } = this; + const { judgeConfigObj, examSubject, isAllProjectsEnd, totalScore, passingScore } = judgeUI; //计算考试分数 // this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; const singlePlay = globalThis.singlePlay @@ -1219,7 +1245,8 @@ export default class Judge { // 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`]) } //联网模式下手动结束的直接退出 @@ -1261,7 +1288,7 @@ export default class Judge { public endExam = async (isManual?: Boolean) => { const carInfo = globalThis.carInfo; const singlePlay = globalThis.singlePlay - const { examSubject ,plateNo} = carInfo; + const { examSubject, plateNo } = carInfo; const { judgeUI, ksjs, @@ -1274,14 +1301,16 @@ export default class Judge { filePath, closeAllFiles } = this; - const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI + const { lsh, idCard, serialNumber, kssycs, totalScore, judgeConfigObj, isAllProjectsEnd, passingScore } = judgeUI //TODO 断网考试结束补传 // await uploadDisConnectData(); const time = await getCurrentTime(); const photoBase64 = await getPhoto(); - const {d1,d2,d3,d4,d5} = ksjs + 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), @@ -1299,7 +1328,7 @@ export default class Judge { let backTimeOut = setTimeout(() => { router.back() }, 90 * 1000) - const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath); + const { code, keystr, message } = await this.sendWriteObjectOut(data, filePath); promptWxCode('17C56', code) if (code != 1) { @@ -1321,7 +1350,8 @@ 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 @@ -1447,7 +1477,7 @@ export default class Judge { // 消息心跳发送 getMessageHeartbeat = async (isEnd?: Boolean) => { const carInfo = globalThis.carInfo; - const { examSubject,plateNo,ksyh } = carInfo; + const { examSubject, plateNo, ksyh } = carInfo; const { judgeUI, isExam, @@ -1464,17 +1494,19 @@ export default class Judge { fileLog, } = this; const singlePlay = globalThis.singlePlay - const {lsh,startHourTime,totalScore,examTime,judgeConfigObj} = judgeUI; - const {fourInOneScreen:{ - gpsDigit - }} = judgeConfig + const { lsh, startHourTime, totalScore, examTime, judgeConfigObj } = judgeUI; + const { + fourInOneScreen:{ + gpsDigit + } + } = judgeConfig const examType = examSubject == 2 ? 2 : 3 - const {sensor,gps} = tempData; + const { sensor, gps } = 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,sd} = gps; + 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, sd } = gps; //过滤错误数据 if (jd == 0) { @@ -1482,7 +1514,7 @@ export default class Judge { } const translateProject = getTranslateProject(); const sbxh = getSbxh(xmdm, xmxh) - const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; + const { carzt, dcjl, qjjl, dxjl, bxjl } = performInfo || {}; const asclshArr = stringToASC( fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13) ); @@ -1490,7 +1522,8 @@ export default class Judge { 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); @@ -1518,7 +1551,8 @@ 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北向距离 @@ -1565,8 +1599,8 @@ export default class Judge { //获取场地序号 getSbxh = (ksxm, xmxh) => { - const {judgeUI} = this; - const {cdsbInfoObj,projectsObj} = judgeUI; + const { judgeUI } = this; + const { cdsbInfoObj, projectsObj } = judgeUI; const project = projectsObj[ksxm] if (project == 3) { return '0000000000' @@ -1582,8 +1616,8 @@ export default class Judge { } getSbbm = (ksxm, xmxh) => { - const {judgeUI} = this; - const {cdsbInfoObj,projectsObj,examSubject} = judgeUI; + const { judgeUI } = this; + const { cdsbInfoObj, projectsObj, examSubject } = judgeUI; const project = projectsObj[ksxm] //科目三不需要 if (examSubject == 3) { @@ -1600,7 +1634,7 @@ export default class Judge { // 中心所有项目转换 getTranslateProject = () => { - const {examSubject} = this.judgeUI; + const { examSubject } = this.judgeUI; const tempItems = (examSubject == 2 ? testKm2Items : testKm3Items).map(item => { const current = this.testKmItems[item.code]; return { @@ -1646,14 +1680,14 @@ export default class Judge { // 统计必考项目、所有项目、已考数量 setCountItems = async () => { const carInfo = globalThis.carInfo; - const { examSubject} = carInfo; - const {projectsObj} = this.judgeUI; + const { examSubject } = carInfo; + const { projectsObj } = this.judgeUI; //必考项目数量 必考项目已考数量 let projectNum = 0, endProjectsNum = 0; // 所有考试项目数量 项目已考项目数量 let allProjectNum = 0, allEndProjectsNum = 0; Reflect.ownKeys(projectsObj).forEach(projectKey => { - const {type,isRequired} = projectsObj[projectKey]; + const { type, isRequired } = projectsObj[projectKey]; allProjectNum += 1; if (type == 3 || type == 4) { allEndProjectsNum += 1; @@ -1677,7 +1711,7 @@ export default class Judge { // 检测差分状态 checkDwzt = async (type) => { - const {avPlayer} = this; + const { avPlayer } = this; const judgeConfig = this.judgeUI.judgeConfig; switch (type) { case 0: @@ -1703,7 +1737,7 @@ export default class Judge { case 4: this.judgeUI.isDwztRight = false; - //差分异常上报 + //差分异常上报 break; } } @@ -1716,8 +1750,8 @@ export default class Judge { //开始评判 private async judging(callBack: Function) { - const {judgeUI} = this; - const { name, lsh, idCard,kssycs,manualMarkRules} = judgeUI; + const { judgeUI } = this; + const { name, lsh, idCard, kssycs, manualMarkRules } = judgeUI; const fileLog = new FileLog(judgeUI.context); const filePath = await fileLog.initFileLogo({ name, lsh, idCard @@ -1796,7 +1830,7 @@ export default class Judge { this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) } - const {examSubject,projectsObj} = this.judgeUI + const { examSubject, projectsObj } = this.judgeUI // if(examSubject == 3){ // //不做模拟灯光,需要做上车准备 =>(请上车准备) // if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){ @@ -1836,7 +1870,7 @@ export default class Judge { //监听远程扣分 globalThis.udpEvent.onKfExam(async (content) => { console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) - const { kfxh , directives } = content.data; + const { kfxh, directives } = content.data; console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`) //根据扣分序号找扣分代码 const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0];