feat_surenjun #60
| @ -26,7 +26,6 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | ||||
|   if (singlePlay) { | ||||
|     return {code:1} | ||||
|   } | ||||
| 
 | ||||
|   //获取监管接口地址路径
 | ||||
|   if (!globalThis.JGPATH) { | ||||
|     const syssetParams = await getSyncData('MA_SYSSET') || []; | ||||
| @ -47,7 +46,11 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> { | ||||
|     return await writeObjectOutNew(params,filePath) | ||||
|   } | ||||
|   drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent( drvexam.zp) | ||||
|   const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`)); | ||||
| 
 | ||||
|   const drvexamArrs = Reflect.ownKeys(drvexam) | ||||
|     .filter(dKey => drvexam[dKey] != undefined) | ||||
|     .map((key: string) => ( | ||||
|     `<${key}>${drvexam[key]}</${key}>`)); | ||||
| 
 | ||||
|   if(filePath){ | ||||
|     const fileUtil = new FileUtil(globalThis.context); | ||||
|  | ||||
| @ -291,27 +291,27 @@ export async function setJudgeUdp() { | ||||
|   let udpIndex = 0; | ||||
|   let currentUdpIndex = 0; | ||||
|   let judgeUdpTimer | ||||
|   clearInterval(judgeUdpTimer) | ||||
|   judgeUdpTimer = setInterval(() => { | ||||
|   clearInterval(globalThis.judgeUdpTimer) | ||||
|   globalThis.judgeUdpTimer = setInterval(() => { | ||||
|     udpIndex += 1; | ||||
|   }, 1000); | ||||
| 
 | ||||
|   if (config && config.udplocalIp) { | ||||
|     const {udplocalIp} = config; | ||||
|     const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) | ||||
|     await udpClientbyCenter.onError_Callback(()=>{}) | ||||
|     await udpClientbyCenter.bindUdp() | ||||
|     await udpClientbyCenter.onMessage_2((val) => { | ||||
|       console.log('valval', val) | ||||
| 
 | ||||
|     }) | ||||
|     await udpClientbyCenter.onMessage_2((val) => {}) | ||||
|     // globalThis.judgeUdpClient = udpClientbyCenter;
 | ||||
|     return { | ||||
|       send(bytes) { | ||||
|         if (udpIndex > currentUdpIndex) { | ||||
|           udpClientbyCenter.sendMsgExt({ id: 45, | ||||
|           udpClientbyCenter.sendMsgExt({ | ||||
|             id: 45, | ||||
|             list: bytes, | ||||
|             carNo: globalThis.carInfo.carNo, | ||||
|             placeId: globalThis.carInfo.examinationRoomId }) | ||||
|             placeId: globalThis.carInfo.examinationRoomId | ||||
|           }) | ||||
|           currentUdpIndex = udpIndex | ||||
|         } | ||||
|       } | ||||
|  | ||||
| @ -22,6 +22,7 @@ import { fillZero, string2Bytes } from '../utils/tools' | ||||
| const TAG = '[UdpDemo.UdpClient]' | ||||
| import hilog from '@ohos.hilog'; | ||||
| import prompt from '@ohos.prompt' | ||||
| import promptAction from '@ohos.promptAction'; | ||||
| import { getUDP } from './GlobalUdp'; | ||||
| 
 | ||||
| 
 | ||||
| @ -179,6 +180,10 @@ export default class UdpClientByCenter { | ||||
|       console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); | ||||
|     }).catch(err => { | ||||
|       console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); | ||||
|       promptAction.showToast({ | ||||
|         message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`, | ||||
|         duration:4000 | ||||
|       }) | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -39,8 +39,8 @@ export const getMessageHeartbeat = async (msg) => { | ||||
|   const { examSubject,plateNo } = carInfo; | ||||
|   const ksyh='0000000000000' | ||||
|   const {fourInOneScreen:{gpsDigit}} = judgeConfig | ||||
|   const asclshArr = stringToASC(fillZero(globalThis.lsh || 0, 13)); | ||||
|   const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) | ||||
|   const asclshArr = stringToASC(fillZero('0000000000000', 13)); | ||||
|   const ascksyhArr = stringToASC(fillZero('0000000000000', 13)) | ||||
|   const ascsbxhArr = stringToASC('00000000') | ||||
|   // const ascsbxhArr = stringToASC('153216400880')
 | ||||
|   const serialIndex = globalThis.serialIndex | ||||
| @ -93,7 +93,19 @@ export const getMessageHeartbeat = async (msg) => { | ||||
|     //扣分项数量
 | ||||
|     string2Bytes(0, 8), | ||||
|     //n个扣分序号
 | ||||
|     [].map(kf => string2Bytes(kf.markcatalog, 8)) | ||||
|     [].map(kf => string2Bytes(kf.markcatalog, 8)), | ||||
|     //牵引车第二gps精度、纬度
 | ||||
|     string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8), | ||||
|     //牵引车第二航向角
 | ||||
|     string2Bytes(0, 2 * 8), | ||||
|     //摩托压线 Byte[20],
 | ||||
|     string2Bytes(0, 20 * 8), | ||||
|     //考试用时
 | ||||
|     string2Bytes(fillZero(0+'',4), 4 * 8), | ||||
|     //项目用时
 | ||||
|     string2Bytes(fillZero(0,2), 2 * 8), | ||||
|     //设备信号状态
 | ||||
|     string2Bytes(0, 4 * 8), | ||||
|   ] | ||||
|   let tempArr = []; | ||||
|   arr.forEach(itemArr => { | ||||
|  | ||||
| @ -118,7 +118,7 @@ struct Index { | ||||
|     const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo; | ||||
|     this.name = xm || '测试考生'; | ||||
|     this.idCard = sfzmhm || '01234567891010'; | ||||
|     this.lsh = lsh; | ||||
|     this.lsh = globalThis.singlePlay?'0000000000000':lsh; | ||||
|     this.kszp = kszp; | ||||
|     this.ksdd = ksdd; | ||||
|     this.kssycs = kssycs; | ||||
|  | ||||
| @ -239,7 +239,7 @@ struct UserInfo { | ||||
|     this.stepFlag = false | ||||
|     this.faceCompareSucess = 0 | ||||
|     this.showFaceCompare = false | ||||
|     this.lsh = '0000000000000' | ||||
|     this.lsh = '000000000000' | ||||
|     this.callBackFlag = false | ||||
|     globalThis.lsh = this.lsh | ||||
|     // this.currentUser = EmptyCandidateObject | ||||
| @ -329,8 +329,6 @@ struct UserInfo { | ||||
|             that.openDeviceByIDCard() | ||||
|           } | ||||
|         } | ||||
|         // that.FaceOpenStatue =  '0' | ||||
| 
 | ||||
|         //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 | ||||
|         if (that.studentRefreshStatue == '2') { | ||||
|           clearInterval(that.interval) | ||||
| @ -378,6 +376,13 @@ struct UserInfo { | ||||
|     } | ||||
|     this.pageIndex--; | ||||
|     this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) | ||||
|     this.dataList.forEach(listData => { | ||||
|       for (let i in listData) { | ||||
|         listData[i] = decodeURI(listData[i]) | ||||
|       } | ||||
|       listData.kszp = this.photo + listData.kszp | ||||
|       listData.ksmjzp = this.photo + listData.ksmjzp | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   //获取下载考生 | ||||
|  | ||||
| @ -94,8 +94,13 @@ export default struct RealTime { | ||||
|       .backgroundColor('#fff') | ||||
| 
 | ||||
|       Row(){ | ||||
|         Image($rawfile('judge/big.png')).width(60).onClick(()=>{this.scaleFn(-10)}) | ||||
|         Image($rawfile('judge/small.png')).width(60).onClick(()=>{this.scaleFn(10)}).margin({left:20}) | ||||
|         Image($rawfile('judge/big.png')).width(60).onClick(()=>{ | ||||
|           this.scaleFn( -this.getScaleNum() ) | ||||
|           console.info('surenjun getScaleNum',-this.getScaleNum()) | ||||
|         }) | ||||
|         Image($rawfile('judge/small.png')).width(60).onClick(()=>{ | ||||
|           this.scaleFn( this.getScaleNum() ) | ||||
|         }).margin({left:20}) | ||||
|       }.position({x:'32%',y:60}) | ||||
|     } | ||||
|     .height('100%') | ||||
| @ -112,6 +117,37 @@ export default struct RealTime { | ||||
|     this.timer = timer | ||||
|   } | ||||
| 
 | ||||
|   getScaleNum = ()=>{ | ||||
|     const scaleNum = this.scaleNum; | ||||
|     if(scaleNum < 200){ | ||||
|       return 10 | ||||
|     } | ||||
|     if(scaleNum >= 200 && scaleNum < 400){ | ||||
|       return 30 | ||||
|     } | ||||
| 
 | ||||
|     if(scaleNum >= 400 && scaleNum < 600){ | ||||
|       return 50 | ||||
|     } | ||||
| 
 | ||||
|     if(scaleNum >= 600 && scaleNum < 800){ | ||||
|       return 70 | ||||
|     } | ||||
| 
 | ||||
|     if(scaleNum >= 800 && scaleNum < 1000){ | ||||
|       return 100 | ||||
|     } | ||||
| 
 | ||||
|     if(scaleNum >= 1000 && scaleNum < 2000){ | ||||
|       return 500 | ||||
|     } | ||||
|     if(scaleNum >= 2000 && scaleNum <= 5000){ | ||||
|       return 1000 | ||||
|     } | ||||
| 
 | ||||
|     return 1000 | ||||
|   } | ||||
| 
 | ||||
|   getValues(roadColumn) { | ||||
|     const lane = this.lane || {}; | ||||
|     let key = roadColumn.key; | ||||
| @ -148,17 +184,18 @@ export default struct RealTime { | ||||
| 
 | ||||
|   scaleFn = async (num)=>{ | ||||
|     const scaleNum = this.scaleNum | ||||
|     if(scaleNum >0 && scaleNum < 200){ | ||||
|     console.info('surenjun getScaleNum',scaleNum) | ||||
|     if(scaleNum >0 && scaleNum < 5000){ | ||||
|       this.scaleNum += num; | ||||
|     } | ||||
|     if(scaleNum === 0 && num > 0){ | ||||
|       this.scaleNum += num; | ||||
|     } | ||||
|     if(scaleNum === 200 && num < 0){ | ||||
|     if(scaleNum > 5000 && num < 0){ | ||||
|       this.scaleNum += num; | ||||
|     } | ||||
|     await examJudgeMapSetScaling(this.scaleNum); | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -1,25 +0,0 @@ | ||||
| 
 | ||||
| @Component | ||||
| export default struct EndPopup { | ||||
|   constructor() { | ||||
|     super() | ||||
|   } | ||||
| 
 | ||||
|   private title:string = '' | ||||
|   private cancelFn:(event?: ClickEvent) => void | ||||
|   private confirmFn:(event?: ClickEvent) => void | ||||
| 
 | ||||
|   build(){ | ||||
|     Column(){ | ||||
|       Column(){ | ||||
|         Text(this.title).fontSize(38).margin({bottom:20}) | ||||
|         Row(){}.height(50) | ||||
|         Row(){ | ||||
|           Text('取消').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).onClick(this.cancelFn) | ||||
|           Text('确定').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(100).fontSize(30).fontColor('#FFF').textAlign(TextAlign.Center).margin({left:45}).onClick(this.confirmFn) | ||||
|         } | ||||
|       }.width('80%').height('70%').backgroundColor('#E6E3DF').borderRadius(38).position({y:'12%',x:'10%'}).justifyContent(FlexAlign.Center) | ||||
| 
 | ||||
|     }.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)') | ||||
|   } | ||||
| } | ||||
| @ -603,6 +603,7 @@ export default class Judge { | ||||
|         kssj: time | ||||
|       } | ||||
|     } | ||||
|     console.info(judgeTag +'filePath' , filePath) | ||||
|     const {code} = await writeObjectOut(data,filePath) | ||||
|     console.info(judgeTag, '项目开始 end') | ||||
|     if (code === 2300007) { | ||||
| @ -774,25 +775,36 @@ export default class Judge { | ||||
|           this.isExamEnd = true | ||||
|         } | ||||
|       } else { | ||||
|         const param302 = judgeConfigObj['302']; | ||||
|         const param342 = judgeConfigObj['342']; | ||||
|         const param512 = (judgeConfigObj['512'] || '').split(','); | ||||
| 
 | ||||
|         //成绩不合格
 | ||||
|         if (totalScore < passingGrade) { | ||||
|           //科目三不合格报靠边停车
 | ||||
|           if(examSubject == 3 && param302 ==1){ | ||||
|             avPlayer.playAudio([`voice/考试结束.mp3`]); | ||||
|             return | ||||
|           } | ||||
|           await examJudgeEndExam() | ||||
|           this.isExamEnd = true | ||||
|           return | ||||
|         } | ||||
|         //成绩合格
 | ||||
|         if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) { | ||||
|           const param302 = judgeConfigObj['302']; | ||||
|           const param342 = judgeConfigObj['342']; | ||||
|           const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); | ||||
|           if (examSubject == 3 && param342 != 0 && (param302 != 6 || param302 != 7 || param302 != 8)) { | ||||
|           //考试合格自动退出
 | ||||
|           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']) | ||||
|               this.judgeUI.isDeductedPopShow = true | ||||
|               this.judgeUI.defaultTabIndex = 1 | ||||
|               this.isEndTip = true | ||||
|             } | ||||
| 
 | ||||
|           } else { | ||||
|             await examJudgeEndExam() | ||||
|             this.isExamEnd = true | ||||
| @ -980,6 +992,7 @@ export default class Judge { | ||||
|   getMessageHeartbeat = async (isEnd?: Boolean) => { | ||||
|     const carInfo = globalThis.carInfo; | ||||
|     const { examSubject,plateNo,ksyh } = carInfo; | ||||
|     console.info(judgeTag,1) | ||||
|     const { | ||||
|       judgeUI, | ||||
|       isExam, | ||||
| @ -994,19 +1007,32 @@ export default class Judge { | ||||
|       getTranslateProject, | ||||
|       getSbxh | ||||
|     } = this; | ||||
|     const {lsh,startHourTime,totalScore} = judgeUI; | ||||
|     console.info(judgeTag,2) | ||||
|     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) | ||||
|     const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo; | ||||
|     console.info(judgeTag,JSON.stringify(performInfo)) | ||||
|     const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; | ||||
|     const asclshArr = stringToASC(fillZero(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]) | ||||
|     ) | ||||
| @ -1016,9 +1042,13 @@ 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('surenjunxstartHourTime' , startHourTime) | ||||
|     console.info('surenjunxmmcexamTime' , examTime) | ||||
| 
 | ||||
|     const arr = [ | ||||
|       //考生号
 | ||||
|       asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), | ||||
| @ -1032,7 +1062,7 @@ export default class Judge { | ||||
|       translateSignals, | ||||
|       //速度                                                发动机转速                          GPS纬度                         GPS经度                         主天线位置
 | ||||
|       //@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(cs * 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北向距离
 | ||||
| @ -1055,7 +1085,19 @@ export default class Judge { | ||||
|       //扣分项数量
 | ||||
|       string2Bytes(kfArr.length, 8), | ||||
|       //n个扣分序号
 | ||||
|       kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0]) | ||||
|       kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0]), | ||||
|       //TODO 牵引车第二gps精度、纬度
 | ||||
|       string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8), | ||||
|       //TODO 牵引车第二航向角
 | ||||
|       string2Bytes(0, 2 * 8), | ||||
|       //TODO 摩托压线 Byte[20],
 | ||||
|       string2Bytes(0, 20 * 8), | ||||
|       //TODO 考试用时
 | ||||
|       string2Bytes(fillZero(examTime+'',4), 4 * 8), | ||||
|       //TODO 项目用时
 | ||||
|       string2Bytes(fillZero(0,2), 2 * 8), | ||||
|       //TODO 设备信号状态
 | ||||
|       string2Bytes(0, 4 * 8), | ||||
|     ] | ||||
| 
 | ||||
|     let tempArr = []; | ||||
| @ -1063,20 +1105,31 @@ 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] | ||||
|     if (project === undefined) { | ||||
|       return '00000000' | ||||
|     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] || {}; | ||||
|     const sbxh = currentCdsb.sbbh || '00000000' | ||||
|     console.info(judgeTag,15) | ||||
|     const sbxh = currentCdsb.sbbh || '0000000000' | ||||
|     return sbxh | ||||
|   } | ||||
| 
 | ||||
| @ -1125,7 +1178,9 @@ export default class Judge { | ||||
| 
 | ||||
|       arr.push(tempArr.join('')); | ||||
|     } | ||||
|     return arr.map(numStr => parseInt(numStr, 2)); | ||||
|     console.info(judgeTag,JSON.stringify(arr)) | ||||
|     // return arr.map(numStr => parseInt(numStr, 2));
 | ||||
|     return arr | ||||
|   } | ||||
|   // 获取考试项目详情
 | ||||
|   getProjectInfo = (projectCode) => { | ||||
| @ -1264,6 +1319,7 @@ export default class Judge { | ||||
|     if (udpIndex % 5 === 0) { | ||||
|       const judgeUdp = globalThis.judgeUdp | ||||
|       const bytes = await this.getMessageHeartbeat(); | ||||
|       console.info(judgeTag+'UDP',JSON.stringify(bytes)) | ||||
|       judgeUdp.send(bytes) | ||||
|     } | ||||
|     globalThis.udpIndex += 1 | ||||
| @ -1339,8 +1395,11 @@ export default class Judge { | ||||
|         setJudgeItem(msg.itemno, msg.serial) | ||||
|       } | ||||
|       await examJudgeRealExam(msg) | ||||
|       // const bytes = await this.getMessageHeartbeat();
 | ||||
|       // bytes && globalThis.judgeUdp.send(bytes)
 | ||||
|       num++ | ||||
|     }, 50) | ||||
|     }, 200) | ||||
| 
 | ||||
|     globalThis.judgeTimer = judgeTimer; | ||||
|   } | ||||
|   // 统计必考项目、所有项目、已考数量
 | ||||
|  | ||||
| @ -36,6 +36,7 @@ export default class FileLog { | ||||
|     const hourTime = time.split(' ')[1].split(':').join('_') | ||||
|     const folderPath = await fileUtil.initFolder(`/logs/${date}/${date}_${hourTime}_${lsh}_${idCard}_${name}`); | ||||
|     this.folderPath = folderPath; | ||||
|     return folderPath | ||||
|   } | ||||
| 
 | ||||
|   // 过程文件数据
 | ||||
|  | ||||
| @ -74,9 +74,9 @@ export function getCenterProjectStatus(status){ | ||||
|     //未考
 | ||||
|     case 1:return '01' | ||||
|     //正在考
 | ||||
|     case 2:return '11' | ||||
|     case 2:return '10' | ||||
|     //已考
 | ||||
|     case 3:return '10' | ||||
|     case 3:return '11' | ||||
| 
 | ||||
|     default :return '00' | ||||
|   } | ||||
| @ -111,7 +111,9 @@ export function getKmProjectVoice( | ||||
|     //右转
 | ||||
|     case 40900 : return type === 1 ? 409001 : undefined | ||||
|     //会车 506-6为1都报
 | ||||
|     case 41300 : return type === 1 ? 413001: (param506Str[5]===1?413002:undefined) | ||||
|     case 41300 : return type === 1 | ||||
|       ? 413001 | ||||
|       : (param506Str[5] == 1 ? undefined : 413002) | ||||
|     //超车
 | ||||
|     case 41400 : return type === 1 | ||||
|       ? (param405Str == 1 && (num == count)?undefined:414001) | ||||
|  | ||||
| @ -6,17 +6,17 @@ export const judgeConfig = { | ||||
|   //是否开启拍照
 | ||||
|   isPhotoOpen: true, | ||||
|   //扣分语音是否强制开启
 | ||||
|   kfVoiceOpen: true, | ||||
|   kfVoiceOpen: false, | ||||
|   //忽略的考试项目
 | ||||
|   ignoreProjects:[41], | ||||
|   ignoreProjects:[], | ||||
|   // 是否忽略考试前熄火、车门检查
 | ||||
|   isCheckFireOpen: true, | ||||
|   //是否开启Udp
 | ||||
|   udpOpen:false, | ||||
|   //轨迹回放是否开启Udp
 | ||||
|   udpOpen:true, | ||||
|   // 本地模型地址
 | ||||
|   modelPath: 'models/model_enc', | ||||
|   // 济南科目三
 | ||||
|   trajectoryPath: 'logs/2024_08_10/2024_08_10_14_24_20_0000000000001_342323199501470011_测试学员1/judge_exam_data.txt', | ||||
|   trajectoryPath: 'logs/2024_08_14/2024_08_14_11_30_20_9999805761528_344094918358022656_葛李弯/judge_exam_data.txt', | ||||
|   //四合一画面配置
 | ||||
|   fourInOneScreen:{ | ||||
|     //gps位数
 | ||||
|  | ||||
| @ -1,58 +0,0 @@ | ||||
| import Prompt from '@system.prompt' | ||||
| 
 | ||||
| const TAG = 'SURENJUN_JUDGE' | ||||
| interface QUEUE{ | ||||
|   fn:Function, | ||||
|   config?:{ | ||||
|     isDelay:boolean | ||||
|     delayTime:number | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| export default class JudgeTask{ | ||||
|   private queue = [] | ||||
|   private status:string | ||||
|   constructor() { | ||||
|     this.queue = [] | ||||
|     this.status = 'end' | ||||
|   } | ||||
| 
 | ||||
|   executeQueue = async ()=>{ | ||||
|     const {queue,executeQueue} = this | ||||
|     if(queue.length){ | ||||
|       for (const currentTask of queue) { | ||||
|         const {fn,delayConfig:{ | ||||
|           isDelay = false, | ||||
|           delayTime = 1000 | ||||
|         }} = currentTask; | ||||
|         const {status} = this | ||||
|         try { | ||||
|           isDelay | ||||
|             ?setTimeout(async ()=>{await fn()}) | ||||
|             :await fn(); | ||||
|         }catch (e){ | ||||
|           // console.info(TAG,'过程数据接口解析错误')
 | ||||
|           Prompt.showToast({ | ||||
|             message: '过程数据接口解析错误', | ||||
|             duration: 3000 | ||||
|           }); | ||||
|         } | ||||
|         this.queue.shift() | ||||
|         await executeQueue() | ||||
|       } | ||||
|     }else{ | ||||
|       this.status = 'end' | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   addTask = async (fn,delayConfig?:{ | ||||
|     isDelay:Boolean, | ||||
|     delayTime:Number | ||||
|   }) =>{ | ||||
|     this.queue.push({fn,delayConfig}); | ||||
|     if(this.status == 'end' && this.queue.length === 1){ | ||||
|       await this.executeQueue(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user