From fd5fd39fa37a099edff61d9806eb15f759bc5100 Mon Sep 17 00:00:00 2001 From: surenjun Date: Thu, 15 Aug 2024 09:01:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E7=A7=91=E7=9B=AE=E4=B8=89?= =?UTF-8?q?=E6=B4=9B=E9=98=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/api/judge.ts | 7 +- entry/src/main/ets/common/utils/GlobalUdp.ts | 16 ++-- .../ets/common/utils/UdpClientByCenter.ts | 11 ++- entry/src/main/ets/common/utils/UdpJudge.ts | 18 +++- entry/src/main/ets/pages/Judge.ets | 2 +- entry/src/main/ets/pages/TerminalInfos.ets | 41 +++++---- entry/src/main/ets/pages/UserInfo.ets | 38 ++++---- .../ets/pages/compontents/judge/RealTime.ets | 47 ++++++++-- entry/src/main/ets/pages/judgeSDK/judge.ts | 87 ++++++++++++++++--- .../main/ets/pages/judgeSDK/utils/fileLog.ts | 1 + .../ets/pages/judgeSDK/utils/judgeCommon.ts | 8 +- .../ets/pages/judgeSDK/utils/judgeConfig.ts | 14 +-- 12 files changed, 210 insertions(+), 80 deletions(-) diff --git a/entry/src/main/ets/api/judge.ts b/entry/src/main/ets/api/judge.ts index 25a27c3d..8de9f556 100644 --- a/entry/src/main/ets/api/judge.ts +++ b/entry/src/main/ets/api/judge.ts @@ -26,7 +26,6 @@ export async function writeObjectOut(params,filePath?:string): Promise { 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 { 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]}`)); + + const drvexamArrs = Reflect.ownKeys(drvexam) + .filter(dKey => drvexam[dKey] != undefined) + .map((key: string) => ( + `<${key}>${drvexam[key]}`)); if(filePath){ const fileUtil = new FileUtil(globalThis.context); diff --git a/entry/src/main/ets/common/utils/GlobalUdp.ts b/entry/src/main/ets/common/utils/GlobalUdp.ts index a1342b01..9799d36a 100644 --- a/entry/src/main/ets/common/utils/GlobalUdp.ts +++ b/entry/src/main/ets/common/utils/GlobalUdp.ts @@ -289,27 +289,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 } } diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index cb4667b3..25659e50 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -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'; export default class UdpClientByCenter { @@ -59,7 +60,9 @@ export default class UdpClientByCenter { return this.isWorking } - rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string) { + rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string) + { + console.log(`${TAG}getUDPudpCLient rebindUdp enter localIp:${localIp},localIpPort:${localIpPort},oppositeIp:${oppositeIp},oppositeIpPort:${oppositeIpPort}`); this.localIp = localIp this.oppositeIp = oppositeIp this.localIpPort = localIpPort @@ -141,9 +144,7 @@ export default class UdpClientByCenter { setMsgBody({id,list}) { let tmpList = [] tmpList = list - return tmpList; - } sendHeadMsg(msgData) { @@ -175,6 +176,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 + }) }); } console.log('getUDPgetState success:' + JSON.stringify(data)); diff --git a/entry/src/main/ets/common/utils/UdpJudge.ts b/entry/src/main/ets/common/utils/UdpJudge.ts index d4dbc772..30569725 100644 --- a/entry/src/main/ets/common/utils/UdpJudge.ts +++ b/entry/src/main/ets/common/utils/UdpJudge.ts @@ -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 => { diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 7567ef81..b1814c8b 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -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; diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index b8a73366..0c6907d9 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -6,6 +6,7 @@ import { upDateTableByArray} from '../common/service/initable' import { getSyncData} from '../common/service/initable' import FileUtil from '../common/utils/File'; import common from '@ohos.app.ability.common'; +import { GlobalConfig } from '../config'; @Entry @@ -83,7 +84,7 @@ struct Index { const fileUtil = new FileUtil(this.context) const folderPath = await fileUtil.initFolder(`/config`); const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]} - fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param)) + fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param),'') // upDateTableByArray('IpConfigTable',[]) ethernet.setIfaceConfig("eth0", { mode: 0, @@ -131,27 +132,31 @@ struct Index { .backgroundImageSize({ width: '100%', height: '100%' }) } - aboutToAppear() { - getSyncData('IpConfigTable').then((result:Array)=>{ - console.log('result222',JSON.stringify(result)) - if(result.length){ + async aboutToAppear() { + const fileUtil = new FileUtil(this.context) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); + console.log('datadata',data) + if (data === '' || data === undefined) { + }else{ + const result=JSON.parse(data) console.log('tagtag',JSON.stringify(result)) - this.inputTextList1[9]=result[0].udplocalIp - this.inputTextList1[10]=result[0].udplocalIpPort - this.inputTextList1[7]=result[0].udpOppositeIp - this.inputTextList1[8]=result[0].udpOppositeIpPort + this.inputTextList1[9]=result.udplocalIp + this.inputTextList1[10]=result.udplocalIpPort + this.inputTextList1[7]=result.udpOppositeIp + this.inputTextList1[8]=result.udpOppositeIpPort // this.inputTextList1[0]=result[0].tcplocalIp // this.inputTextList1[13]=result[0].tcplocalIpPort - this.inputTextList1[0]=result[0].tcpOppositeIp - this.inputTextList1[1]=result[0].tcpOppositePort - this.inputTextList1[5]=result[0].gateway - this.inputTextList1[4]=result[0].netMask - this.inputTextList1[6]=result[0].dnsServers - this.inputTextList1[2]=result[0].centerIp - this.inputTextList1[3]=result[0].centerPort - } - }) + this.inputTextList1[0]=result.tcpOppositeIp + this.inputTextList1[1]=result.tcpOppositePort + this.inputTextList1[5]=result.gateway + this.inputTextList1[4]=result.netMask + this.inputTextList1[6]=result.dnsServers + this.inputTextList1[2]=result.centerIp + this.inputTextList1[3]=result.centerPort + } + + ethernet.getIfaceConfig("eth0", (error, value) => { if (error) { // that.errorMsg='error' diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 87eb6829..fa4b41bf 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -163,7 +163,6 @@ struct UserInfo { return } - this.showFaceCompare = true this.pageIndex = Math.floor(index / 4) } }) @@ -238,7 +237,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 @@ -314,16 +313,22 @@ struct UserInfo { that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' + const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') + const openCheckFlag =openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' + const faceParam = syssetParams.filter(sys => sys.v_no == '2413') - that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' - that.FaceOpenStatue = '0' - console.log('that.FaceOpenStatue', that.FaceOpenStatue) + + // that.FaceOpenStatue = '0' // faceParam?.[0]?.v_value || // 1身份证读卡器 2指纹 3人脸 - this.faceFlag = faceParam?.[0]?.v_value || '0' - if (faceParam?.[0]?.v_value == '1') { - that.openDeviceByIDCard() + if(openCheckFlag=='1'){ + that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' + this.faceFlag = faceParam?.[0]?.v_value || '0' + if (faceParam?.[0]?.v_value == '1') { + that.openDeviceByIDCard() + } } + //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 if (that.studentRefreshStatue == '2') { clearInterval(that.interval) @@ -371,13 +376,6 @@ 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 - }) } //获取下载考生 @@ -386,7 +384,7 @@ struct UserInfo { return } const param = `${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}${globalThis.carInfo.carId}${globalThis.carInfo.examinationRoomId}${globalThis.username}` - getExaminationStudentInfo(param).then(async res => { + getExaminationStudentInfo(param).then(async(res) => { setTimeout(() => { this.updateTimeLimit = true }, 30000) @@ -413,7 +411,15 @@ struct UserInfo { } this.list = JSON.parse(JSON.stringify(dataList)) + this.list.forEach(listData => { + for (let i in listData) { + listData[i] = decodeURI(listData[i]) + } + listData.kszp = this.photo + listData.kszp + listData.ksmjzp = this.photo + listData.ksmjzp + }) dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; + this.dataList = dataList if (this.dataList.length) { this.currentUser = this.dataList[0] diff --git a/entry/src/main/ets/pages/compontents/judge/RealTime.ets b/entry/src/main/ets/pages/compontents/judge/RealTime.ets index 7ab9c45f..a00d9ae9 100644 --- a/entry/src/main/ets/pages/compontents/judge/RealTime.ets +++ b/entry/src/main/ets/pages/compontents/judge/RealTime.ets @@ -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); - } + } diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index d6db1422..7580a79a 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -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; } // 统计必考项目、所有项目、已考数量 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts b/entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts index a16f5796..f804608a 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/fileLog.ts @@ -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 } // 过程文件数据 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts index ba97bb3c..48549a08 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeCommon.ts @@ -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) diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index 4a861d1f..60fc434a 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -2,21 +2,21 @@ //考试回放开关 export const judgeConfig = { //本地目录开关 - isTrajectoryOpen: false, + isTrajectoryOpen: true, //是否开启拍照 - isPhotoOpen: true, + isPhotoOpen: false, //扣分语音是否强制开启 - 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位数