From f7717785a510129bc81bc317b8b9f1b1534eb127 Mon Sep 17 00:00:00 2001 From: surenjun Date: Fri, 16 Aug 2024 08:52:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat=EF=BC=9A=E7=A7=91=E7=9B=AE=E4=B8=89?= =?UTF-8?q?=E8=81=94=E7=BD=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/constants/USER.ts | 4 +- entry/src/main/ets/common/utils/UdpJudge.ts | 4 +- entry/src/main/ets/pages/Judge.ets | 7 ++- .../main/ets/pages/judgeSDK/dataTest/index.ts | 8 +-- entry/src/main/ets/pages/judgeSDK/judge.ts | 59 +++++++++---------- 5 files changed, 42 insertions(+), 40 deletions(-) diff --git a/entry/src/main/ets/common/constants/USER.ts b/entry/src/main/ets/common/constants/USER.ts index e9000a73..4174c843 100644 --- a/entry/src/main/ets/common/constants/USER.ts +++ b/entry/src/main/ets/common/constants/USER.ts @@ -25,8 +25,8 @@ CommonConstants { */ static readonly ACCOUNT_TABLE = { tableName: 'USER', - sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id INTEGER PRIMARY KEY AUTOINCREMENT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT)', - columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl'] + sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id INTEGER PRIMARY KEY AUTOINCREMENT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,xldm TEXT)', + columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','xldm'] }; /** diff --git a/entry/src/main/ets/common/utils/UdpJudge.ts b/entry/src/main/ets/common/utils/UdpJudge.ts index 30569725..b0f2c043 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('0000000000000', 13)); - const ascksyhArr = stringToASC(fillZero('0000000000000', 13)) + const asclshArr = stringToASC(fillZero('1111111111111', 13)); + const ascksyhArr = stringToASC(fillZero('1111111111111', 13)) const ascsbxhArr = stringToASC('00000000') // const ascsbxhArr = stringToASC('153216400880') const serialIndex = globalThis.serialIndex diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index b1814c8b..3b5a6bab 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -115,7 +115,7 @@ struct Index { async initStudent() { const students = await getSyncData('USER') const stuInfo = students[0] || {}; - const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo; + const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl,xldm} = stuInfo; this.name = xm || '测试考生'; this.idCard = sfzmhm || '01234567891010'; this.lsh = globalThis.singlePlay?'0000000000000':lsh; @@ -124,6 +124,7 @@ struct Index { this.kssycs = kssycs; this.ksxl = ksxl; this.wayno = ksxl; + this.xldm = xldm; this.kslx = kslx; } @@ -279,7 +280,7 @@ struct Index { projectCode: no2, projectCodeCenter: txt2, //是否是必考 加减档设置成非必考 - isRequired: no2== 14?false:allItems.includes(no2 + ''), + isRequired: no2== 14 ? false : allItems.includes(no2 + ''), //是否考过了 isEnd: false, //项目开始数据是否上传过 @@ -1178,6 +1179,8 @@ struct Index { @State kssycs: string = '' @State ksxl: string = '' @State kslx: string = '' + //监管线路代码 + @State xldm: string = '' //监管接口序列号 @State serialNumber: number = 0 @State carType: string = '' diff --git a/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts b/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts index 803bef85..d47bb248 100644 --- a/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts +++ b/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts @@ -558,7 +558,7 @@ export const testUIAllitems = [ ] export const wuxiKm3Items = [ - //3,5,9,12,14,15,16, +//3,5,9,12,14,15,16, {projectCode:'1',projectCodeCenter:'40100',name:'上车准备',abbreviation:'上车准备'}, {projectCode:'2',projectCodeCenter:'40200',name:'起步',abbreviation:'起步'}, {projectCode:'3',projectCodeCenter:'40300',name:'直线行驶',abbreviation:'直线行驶'}, @@ -571,7 +571,7 @@ export const wuxiKm3Items = [ {projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'}, {projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'}, {projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'}, - {projectCode:'41',projectCodeCenter:'41600',name:'夜间行驶',abbreviation:'夜间行驶'}, + {projectCode:'41',projectCodeCenter:'41600',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'}, {projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'}, {projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'}, {projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'}, @@ -622,9 +622,9 @@ export const testKm3Items= [ {code:'41300',status:0}, {code:'41400',status:0}, {code:'41500',status:0}, - {code:'41600',status:0}, - {code:'41700',status:0}, + + {code:'41600',status:0}, ] export const testMarkRules = [{ diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 7580a79a..404e578a 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -462,14 +462,14 @@ export default class Judge { } //项目已考不上传监管信息 if (!isEnd) { - judgeTask.addTask(async () => { - console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) - await beginProject(xmdm) - },{isDelay: true}) - judgeTask.addTask(async () => { + judgeTask.addTask(async () => { + console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) + await beginProject(xmdm) + },{isDelay: true}) + judgeTask.addTask(async () => { console.info(judgeTag, `项目-${xmdm}-上传照片 start`) await uploadProgressPhoto(xmdm) - },{isDelay: true}) + },{isDelay: true}) this.judgeUI.projectsObj[xmdm].isUpload = true; } break; @@ -581,7 +581,7 @@ export default class Judge { const carInfo = globalThis.carInfo; const { examSubject,plateNo } = carInfo; const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; - const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,ksxl} = judgeUI + const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI const time = await getCurrentTime(); const project = projectsObj[ksxm] const sbxh = getSbbm(ksxm, xmxh) @@ -595,7 +595,7 @@ export default class Judge { sfzmhm: idCard, ksxm: project.projectCodeCenter, sbxh, - ksxl, + ksxl:xldm, kchp: encodeURI(plateNo), // 开始时间 ksdd: encodeURI(ksdd), @@ -618,7 +618,7 @@ export default class Judge { 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,ksxl,} = judgeUI + 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) @@ -633,7 +633,7 @@ export default class Judge { sbxh, //TODO 操作类型 1:正常 0:撤销该考试记录 czlx: '1', - ksxl, + ksxl:xldm, kchp: encodeURI(plateNo), ksdd: encodeURI(ksdd), kslx: encodeURI(kslx) || '', @@ -726,15 +726,15 @@ export default class Judge { //判断是不是模拟灯光语音 if (type == 1) { avPlayer.playAudio([`voice/${code}.mp3`], false, () => { - examJudgeSoundEnd({ - itemno: xmdm, code, type - }) - fileLog.setExamJudgeData({ - method: 'examJudgeSoundEnd', - itemno: xmdm, - code, - type, - }) + examJudgeSoundEnd({ + itemno: xmdm, code, type + }) + fileLog.setExamJudgeData({ + method: 'examJudgeSoundEnd', + itemno: xmdm, + code, + type, + }) }) }else{ avPlayer.playAudio([`voice/${code}.mp3`]) @@ -1008,6 +1008,7 @@ export default class Judge { getSbxh } = this; console.info(judgeTag,2) + const singlePlay = globalThis.singlePlay const {lsh,startHourTime,totalScore,examTime} = judgeUI; const {fourInOneScreen:{gpsDigit}} = judgeConfig @@ -1026,7 +1027,9 @@ export default class Judge { const sbxh = getSbxh(xmdm, xmxh) console.info(judgeTag,JSON.stringify(performInfo)) const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; - const asclshArr = stringToASC(fillZero(lsh || 0, 13)); + const asclshArr = stringToASC( + fillZero((singlePlay?1111111111111:lsh) || 0, 13) + ); //13不足要补0 console.info(judgeTag,6) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) @@ -1046,11 +1049,10 @@ export default class Judge { // 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]), //考试员号 ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]), @@ -1079,9 +1081,6 @@ export default class Judge { string2Bytes(Math.floor((dcjl + qjjl) / 100), 2 * 8), //扣分 string2Bytes(100 - Math.abs(totalScore), 2 * 8), - //扣分数 - //todo扣分值/扣分项 - string2Bytes(0, 2 * 8), //扣分项数量 string2Bytes(kfArr.length, 8), //n个扣分序号 @@ -1092,8 +1091,8 @@ export default class Judge { string2Bytes(0, 2 * 8), //TODO 摩托压线 Byte[20], string2Bytes(0, 20 * 8), - //TODO 考试用时 - string2Bytes(fillZero(examTime+'',4), 4 * 8), + //考试用时 + string2Bytes(examTime, 4 * 8), //TODO 项目用时 string2Bytes(fillZero(0,2), 2 * 8), //TODO 设备信号状态 @@ -1316,7 +1315,7 @@ export default class Judge { this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' await examJudgeRealExam(plcData) const udpIndex = globalThis.udpIndex; - if (udpIndex % 5 === 0) { + if (udpIndex % 5 === 0 && !isExamEnd) { const judgeUdp = globalThis.judgeUdp const bytes = await this.getMessageHeartbeat(); console.info(judgeTag+'UDP',JSON.stringify(bytes)) @@ -1395,8 +1394,8 @@ export default class Judge { setJudgeItem(msg.itemno, msg.serial) } await examJudgeRealExam(msg) - // const bytes = await this.getMessageHeartbeat(); - // bytes && globalThis.judgeUdp.send(bytes) + const bytes = await this.getMessageHeartbeat(); + bytes && globalThis.judgeUdp.send(bytes) num++ }, 200) From 0837bd20d8053f058cd1eca728aa6eeb0e13041c Mon Sep 17 00:00:00 2001 From: surenjun Date: Fri, 16 Aug 2024 08:53:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat=EF=BC=9AuserInfo=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/pages/UserInfo.ets | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 3b50ab07..8bffae57 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -666,16 +666,14 @@ struct UserInfo { const {carId,examinationRoomId} = carInfo; const { examSubject,plateNo } = carInfo; const date = new Date() - console.info('surenjun', 'photoBase64') const photoBase64 = await this.getPhoto(); - console.info('surenjun', 'photoBase64End') const drvexam = { lsh: this.currentUser.lsh || '', kskm: examSubject, ksxtbh: this.ksxtbh || '222', sfzmhm: this.currentUser.sfzmhm || '', ksysfzmhm: this.currentUser.ksy1sfzmhm || '', - ksxl: this.currentUser.ksxl, + ksxl: this.currentUser.xldm, zp: photoBase64, kssj: dateFormat(date) || '', kchp: decodeURI(plateNo), From 54403ef2c7a734b28ec575fb726a8ddfdaff391b Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 19 Aug 2024 10:11:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat=EF=BC=9A=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/api/judge.ts | 5 +- entry/src/main/ets/common/utils/UdpJudge.ts | 20 ++-- entry/src/main/ets/common/utils/request.ts | 4 +- entry/src/main/ets/pages/Index.ets | 2 +- entry/src/main/ets/pages/Judge.ets | 72 +++++++++------ entry/src/main/ets/pages/Roads.ets | 4 +- entry/src/main/ets/pages/UserInfo.ets | 27 +++--- .../main/ets/pages/judgeSDK/dataTest/index.ts | 2 +- entry/src/main/ets/pages/judgeSDK/judge.ts | 92 +++++++------------ .../ets/pages/judgeSDK/utils/judgeConfig.ts | 4 +- .../ets/pages/judgeSDK/utils/judgeTask.ts | 6 +- 11 files changed, 119 insertions(+), 119 deletions(-) diff --git a/entry/src/main/ets/api/judge.ts b/entry/src/main/ets/api/judge.ts index 8de9f556..e9cd92e8 100644 --- a/entry/src/main/ets/api/judge.ts +++ b/entry/src/main/ets/api/judge.ts @@ -18,7 +18,8 @@ export async function download() { interface WR{ message?:string - code:number + code?:number + keystr?:string } // 通用监管接口 export async function writeObjectOut(params,filePath?:string): Promise { @@ -56,7 +57,7 @@ export async function writeObjectOut(params,filePath?:string): Promise { const fileUtil = new FileUtil(globalThis.context); await fileUtil.initFolder(filePath); fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ - xtlb,jkxlh,jkid,drvexam + xtlb,jkxlh,jkid,drvexam:{...drvexam,zp:''}, })); } diff --git a/entry/src/main/ets/common/utils/UdpJudge.ts b/entry/src/main/ets/common/utils/UdpJudge.ts index b0f2c043..73d9ab70 100644 --- a/entry/src/main/ets/common/utils/UdpJudge.ts +++ b/entry/src/main/ets/common/utils/UdpJudge.ts @@ -39,7 +39,11 @@ export const getMessageHeartbeat = async (msg) => { const { examSubject,plateNo } = carInfo; const ksyh='0000000000000' const {fourInOneScreen:{gpsDigit}} = judgeConfig - const asclshArr = stringToASC(fillZero('1111111111111', 13)); + const asclshArr = stringToASC(fillZero( + globalThis.singlePlay + ?'1111111111111' + : globalThis.lsh, + 13)); const ascksyhArr = stringToASC(fillZero('1111111111111', 13)) const ascsbxhArr = stringToASC('00000000') // const ascsbxhArr = stringToASC('153216400880') @@ -70,7 +74,7 @@ export const getMessageHeartbeat = async (msg) => { string2Bytes(serialIndex, 2 * 8), translateSignals, //@ts-ignore - string2Bytes(Math.floor(gps.sd*1.852) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), + string2Bytes(Math.floor(gps.sd*1.852*100) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), //GPS东向距离 string2Bytes(0, 4 * 8), //GPS北向距离 @@ -142,20 +146,20 @@ const getTranslateProject = () => { for (let i = 0; i <= 4; i++) { const temp = tempItems.slice(i * 4, (i + 1) * 4); let tempArr = temp.map(item => item.status) - if (i === 4 && examSubject) { + if (i === 4) { tempArr = examSubject == 2 //bit36-bit39保留 ? tempArr.concat(['00', '00']) //bit30-bit39保留 - : tempArr.concat(['00', '00','00','00']) - } - if (i === 3 && examSubject == 3) { - tempArr = tempArr.concat(['00']) + : tempArr.concat(['00', '00','00']) } + // if (i === 3 && examSubject == 3) { + // tempArr = tempArr.concat(['00']) + // } arr.push(tempArr.join('')); } - return arr.map(numStr => parseInt(numStr, 2)); + return arr } // 中心实时项目状态转换 diff --git a/entry/src/main/ets/common/utils/request.ts b/entry/src/main/ets/common/utils/request.ts index f159a0e6..9b6754bd 100644 --- a/entry/src/main/ets/common/utils/request.ts +++ b/entry/src/main/ets/common/utils/request.ts @@ -152,7 +152,7 @@ function handleCenterCode(msgXml,isNewCenter){ const msg = JSON.parse(msgXml); const result = msg?.data[0]?.result; if(result){ - const {code,message} = result + const {code,message,keystr} = result if(code != '1'){ const rMessage = decodeURIComponent(message as string) prompt.showToast({ @@ -161,7 +161,7 @@ function handleCenterCode(msgXml,isNewCenter){ }); return {code,message} }else{ - return { code } + return { code ,keystr} } } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 1bbc7bf6..aaa31648 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -275,7 +275,7 @@ struct Index { this.dialogVisiable=false this.angle = 0 this.loading = false - + globalThis.lsh = '1111111111111' } async testXMLToJSONInWorker() { diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 3b5a6bab..77c1e615 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -50,7 +50,6 @@ struct Index { this.time = await getCurrentTime(); this.examTime += 1; }, 1000); - //初始化数据库表 await this.initDb() //断点续考 @@ -109,6 +108,7 @@ struct Index { BK1: carInfo.bk1, BK2: carInfo.bk2, }) + console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArrr)) } // 获取考生信息 @@ -222,6 +222,8 @@ struct Index { //初始化systemParam表 async initSystemParam(sysParam?: SYSTEMPARMARR[]) { const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM') + console.info('surenjun => systemParms',JSON.stringify(systemParms)); + let currentParams: any = router.getParams(); const {carName,carType,examSubject} = this; //小车车型列表 @@ -229,7 +231,10 @@ struct Index { if (globalThis.singlePlay) { this.wayno = currentParams.wayno || 1; } - + //真实监管下发的项目 + let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item); + console.info('surenjun kStringArr',JSON.stringify(kStringArr)) + let isInExam = kStringArr.length > 0; const {isTrajectoryOpen} = judgeConfig let carNo = '', allItems = []; systemParms.forEach((systemParm) => { @@ -255,7 +260,6 @@ struct Index { if(no1 == 3 && no3 == 3 && carNo === no2){ this.passingScore = Number(txt1) || 0; } - //获取当前考车的考试项目 if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) { allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '') @@ -274,6 +278,7 @@ struct Index { if (sCarTypes.includes(carType) && name === '夜间行驶') { return } + const currentProject = { name, abbreviation: decodeURI(systemParm.txt3), @@ -286,9 +291,18 @@ struct Index { //项目开始数据是否上传过 isUpload:false, } - this.projectsObj[no2*1] = currentProject - this.projectsCenterObj[txt2] = currentProject - this.projects.push(currentProject); + if(isInExam){ + if(kStringArr.includes(txt2)){ + this.projectsObj[no2*1] = currentProject + this.projectsCenterObj[txt2] = currentProject + this.projects.push(currentProject); + } + }else { + this.projectsObj[no2*1] = currentProject + this.projectsCenterObj[txt2] = currentProject + this.projects.push(currentProject); + } + } this.systemparmArr.push({ 'NO1': no1 * 1, @@ -458,7 +472,6 @@ struct Index { const [initData, beginData] = [strArr[0], strArr[1]]; const initDataObj = JSON.parse(initData) const beginDataObj = JSON.parse(beginData) - // initDataObj.systemparm = const examSubject = globalThis.carInfo.examSubject; this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject; globalThis.carInfo.examSubject = this.examSubject @@ -814,26 +827,6 @@ struct Index { .margin({ bottom: 20 }) }.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 }) - if (this.signDisplayComVisible) { - Column() { - SignDisplayCom({ - showBack: false, - scaleNum: 1.8, - msgStr: this.judge.plcStr || '', - }).margin({ top: 100 }) - - Row() { - } - .width(240) - .height(240) - .position({ x: '81%', y: 80 }) - .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) - .backgroundImageSize({ width: '33.33%', height: '33.33%' }) - .onClick(() => { - this.signDisplayComVisible = false - }) - }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') - } //科目三人工扣分弹窗 if (this.isDeductedPopShow && this.examSubject == 3 && this.judgeConfigObj['342'] == 0) { @@ -857,6 +850,28 @@ struct Index { }) } + if (this.signDisplayComVisible) { + Column() { + SignDisplayCom({ + showBack: false, + scaleNum: 1.8, + msgStr: this.judge.plcStr || '', + }).margin({ top: 100 }) + + Row() { + } + .width(240) + .height(240) + .position({ x: '81%', y: 80 }) + .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) + .backgroundImageSize({ width: '33.33%', height: '33.33%' }) + .onClick(() => { + this.signDisplayComVisible = false + }) + }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') + } + + //科目三人工项目确认框 if (this.isAmplifyPopShow && this.examSubject == 3) { AmplifyPopup({ @@ -991,6 +1006,9 @@ struct Index { getProjectIsInRoad } = this; const projectCode = artSubject3ProjectsCodesArr[index]; + if(projectsObj[projectCode] === undefined){ + return false + } const projectType = projectsObj[projectCode].type; //不允许人工触发的项目列表,以","分隔 diff --git a/entry/src/main/ets/pages/Roads.ets b/entry/src/main/ets/pages/Roads.ets index ee85a8ba..cb34111e 100644 --- a/entry/src/main/ets/pages/Roads.ets +++ b/entry/src/main/ets/pages/Roads.ets @@ -97,7 +97,9 @@ export default struct Index { params:{ sczb, kfdm, - wayno + wayno, + //TODO 真实监管项目 + // kString:'40300,40500,40700,40800' } }, router.RouterMode.Single); diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 8bffae57..dbad0fff 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -125,6 +125,8 @@ struct UserInfo { this.isExamStart = false this.sczbkf = []; this.avPlayer = new VoiceAnnounce(); + initJudgeUdp() + } //身份证读卡器初始化 @@ -166,7 +168,8 @@ struct UserInfo { url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', params: { sczb: Number(this.isBoardPrePareSetPopupOpen), - kfdm: this.sczbkf + kfdm: this.sczbkf, + } }, router.RouterMode.Single); return @@ -248,7 +251,7 @@ struct UserInfo { this.stepFlag = false this.faceCompareSucess = 0 this.showFaceCompare = false - this.lsh = '000000000000' + this.lsh = '1111111111111' this.callBackFlag = false globalThis.lsh = this.lsh // this.currentUser = EmptyCandidateObject @@ -507,7 +510,6 @@ struct UserInfo { this.dataList = [] this.currentUser = EmptyCandidateObject } - } //身份比对 @@ -530,11 +532,12 @@ struct UserInfo { const avPlayer = this.avPlayer; this.isLoadingPopupVisible = true avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { - const temp = await this.beginExam(); - console.info('surenjun', JSON.stringify(temp)) - if (temp.code != 1) { + //TODO 模拟 + const {code,keystr,message} = await this.beginExam(); + //@ts-ignore TODO code转换 + if (code == '' && code == undefined) { promptAction.showToast({ - message: temp.message, + message, duration: 4000 }) return @@ -548,7 +551,9 @@ struct UserInfo { params: { examItems: examItems?.getExaminationItemRsp?.body?.ykxx, sczb: Number(this.isBoardPrePareSetPopupOpen), - kfdm: this.sczbkf + kfdm: this.sczbkf, + //真实监管项目 + kString:keystr || '' } }, router.RouterMode.Single); this.stopDeviceById() @@ -741,10 +746,12 @@ struct UserInfo { .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { + globalThis.lsh = item.lsh; if (this.isExamStart&&!globalThis.singlePlay) { return } this.currentUser = item + }) }) }.width(640 * this.ratio).margin({ left: 30 * this.ratio }) @@ -830,7 +837,6 @@ struct UserInfo { this.isFirstBoardPrePareSetPopupBtnShow = true; this.stepFlag = false this.stopDeviceById() - initJudgeUdp() } catch (e) { } @@ -853,7 +859,7 @@ struct UserInfo { url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', params: { sczb: Number(this.isBoardPrePareSetPopupOpen), - kfdm: this.sczbkf + kfdm: this.sczbkf, } }, router.RouterMode.Single); this.stopDeviceById() @@ -862,7 +868,6 @@ struct UserInfo { if (this.FaceOpenStatue != '0') { this.showFaceCompare = true } else { - initJudgeUdp() this.sfbdinterfaceFn() } } catch (e) { diff --git a/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts b/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts index d47bb248..7e4f9dbe 100644 --- a/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts +++ b/entry/src/main/ets/pages/judgeSDK/dataTest/index.ts @@ -571,7 +571,7 @@ export const wuxiKm3Items = [ {projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'}, {projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'}, {projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'}, - {projectCode:'41',projectCodeCenter:'41600',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'}, + {projectCode:'41',projectCodeCenter:'41700',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'}, {projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'}, {projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'}, {projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'}, diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 404e578a..b61e0da1 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -53,7 +53,7 @@ import { } from './api/index'; const judgeTag = 'SURENJUN_JUDGE' - +import { getSyncData, upDateTableByArray } from '../../common/service/initable'; export default class Judge { constructor(judgeUI) { this.serialIndex = 1; @@ -129,15 +129,12 @@ export default class Judge { console.info(judgeTag, '2.注册日志回调完成') let initInfo = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); - + await fileLog.setExamJudgeData(initInfo) //相关评判初始化只做一次 if (!isJudgeInitBool) { - await fileLog.setExamJudgeData(initInfo) const tempJudge = await examJudgeInit(initInfo); globalThis.isJudgeInitBool = true console.info(judgeTag, '4.评判初始化完成') - } else { - await fileLog.setExamJudgeData(initInfo) } globalThis.isJudge = true @@ -315,7 +312,6 @@ export default class Judge { this.judgeUI.currentXmdm = xmdm; const xmmcStr = judgeUI.projectsObj[xmdm].name; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; - console.info(judgeTag,JSON.stringify(judgeUI.projectsObj[xmdm])) const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; this.testKmItems[xmmcCode].status = 2; this.xmmcStr = xmmcStr; @@ -344,7 +340,6 @@ export default class Judge { //统计必考项目数量 this.xmmcStr = '无'; this.xmmcCode = ''; - this.xmmcSingleCode = 0; this.xmdm = ''; this.judgeUI.isDeductedPopShow = false this.judgeUI.currentXmdm = undefined; @@ -490,6 +485,7 @@ export default class Judge { judgeTask.addTask(async () => { console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) await endProject(xmdm); + this.xmmcSingleCode = 0; }, {isDelay: true}) } } @@ -658,16 +654,19 @@ export default class Judge { const time = await getCurrentTime(); const project = getProjectInfo(ksxm); //科目三上车准备、模拟灯光、夜间行驶出现通用评判,ksxm为当前进行的项目 - const checkProjects = ['41600', '41700', '40100'] - + const checkProjects = ['1', '41', '17'] + console.info(judgeTag + 'ksxm=>',ksxm) + console.info(judgeTag + 'xmmcSingleCode=>',xmmcSingleCode) const data = { xtlb: '17', jkxlh: serialNumber, jkid: '17C53', drvexam: { lsh, kskm: examSubject, - ksxm: project - ? (checkProjects.includes(xmmcSingleCode + '') ? xmmcSingleCode : project.projectCodeCenter) - : (examSubject == 3 ? 30000 : 10000), + ksxm: project == undefined + ? (checkProjects.includes(xmmcSingleCode + '') + ? '40100' + : (examSubject == 3 ? 30000 : 10000)) + : project.projectCodeCenter , kfxm: kf.markcatalog, kfxmmx: `${ksxm},${kf.markserial}`, sfzmhm: idCard, @@ -677,6 +676,8 @@ export default class Judge { kfsj: time } } + console.info(judgeTag + 'ksxm=>',data.drvexam.ksxm) + const {code} = await writeObjectOut(data,filePath); if (code === 2300007) { this.isJudgeDisConnect = true @@ -778,7 +779,6 @@ export default class Judge { const param302 = judgeConfigObj['302']; const param342 = judgeConfigObj['342']; const param512 = (judgeConfigObj['512'] || '').split(','); - //成绩不合格 if (totalScore < passingGrade) { //科目三不合格报靠边停车 @@ -791,13 +791,15 @@ export default class Judge { return } //成绩合格 - if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) { + if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) { + //考试合格自动退出 if(examSubject == 3 && param302 == 4){ await examJudgeEndExam() this.isExamEnd = true return } + if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { if(param512[7] != 0){ avPlayer.playAudio(['voice/综合评判.mp3']) @@ -819,24 +821,19 @@ export default class Judge { this.judgeUI.loadingPopupVisible = true; this.judgeUI.endPopupVisible = false; this.judgeUI.isDeductedPopShow = false; - - console.info(judgeTag,1) const {qjjl,dcjl} = ksjs const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this; const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; //计算考试分数 - console.info(judgeTag,2) this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; const singlePlay = globalThis.singlePlay const param302 = judgeConfigObj['302']; globalThis.windowClass.setWindowSystemBarEnable(['navigation']) - console.info(judgeTag,3) //自动退出待验证并且不合格 if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { avPlayer.playAudio([`voice/考试结束.mp3`]) } - console.info(judgeTag,4) //联网模式下手动结束的直接退出 if (!singlePlay && isManual && !isAllProjectsEnd) { avPlayer.playAudio(['voice/empty.mp3'], true, () => { @@ -844,7 +841,6 @@ export default class Judge { }) return } - console.info(judgeTag,5) if (examSubject == 3) { const param302 = judgeConfigObj['302']; if (totalScore < passingScore) { @@ -856,17 +852,13 @@ export default class Judge { //考试合格 } } - console.info(judgeTag,6) await handleSEP(306); - console.info(judgeTag,7) avPlayer.playAudio(['voice/exam_waiting.mp3'], true, async () => { try { if (!singlePlay) { - // TODO 待验证 const bytes = await this.getMessageHeartbeat(true); globalThis.judgeUdp.send(bytes) } - //TODO endExam函数逻辑待验证 await endExam() } catch (e) { console.info(judgeTag,JSON.stringify(e)) @@ -903,7 +895,7 @@ export default class Judge { kscj: (totalScore * 1) > 0 ? totalScore : 0, kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), // 1,22;2,560;3,128;4,0;5,0; - dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index},${Math.floor(d /100)}`).join(';'), + dwlc: [d1,d2,d3,d4,d5].map((d,index) => `${index+1},${Math.floor(d /100)}`).join(';'), } } const temp = await writeObjectOut(data,filePath); @@ -916,7 +908,6 @@ export default class Judge { if (examSubject == 2) { voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') } - if (examSubject == 3) { if (isAllProjectsEnd) { if (totalScore < passingScore) { @@ -929,6 +920,9 @@ export default class Judge { } } + const USER = getSyncData('USER'); + await upDateTableByArray('USER', [{...USER[0],kssycs:kssycs == 2 ? 1 : 0}]) + console.info(judgeTag, `考试成绩:${totalScore}`) if(!singlePlay){ await uploadProgressData(); @@ -945,6 +939,7 @@ export default class Judge { if (score <= (examSubject == 3 ? 10 : 20)) { if (kfArr.length - 1 === index) { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { + this.isUdpEnd = true router.back(); }) throw new Error('End Loop') @@ -965,6 +960,7 @@ export default class Judge { } else { avPlayer.playAudio([voiceURL], true, () => { setTimeout(() => { + this.isUdpEnd = true router.back(); }, param302 == 8 ? 3000 : 0) }) @@ -992,7 +988,6 @@ export default class Judge { getMessageHeartbeat = async (isEnd?: Boolean) => { const carInfo = globalThis.carInfo; const { examSubject,plateNo,ksyh } = carInfo; - console.info(judgeTag,1) const { judgeUI, isExam, @@ -1007,35 +1002,25 @@ export default class Judge { getTranslateProject, getSbxh } = this; - console.info(judgeTag,2) const singlePlay = globalThis.singlePlay const {lsh,startHourTime,totalScore,examTime} = judgeUI; - const {fourInOneScreen:{gpsDigit}} = judgeConfig - console.info(judgeTag,3) const examType = examSubject == 2?2:3 const {sensor,gps} = tempData; - console.info(judgeTag,4) - console.info(judgeTag,JSON.stringify(tempData)) if(tempData.sensor === undefined){ return } const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs,dw} = sensor const {jd,wd, hxj, fyj, hbg,} = gps - console.info(judgeTag,5) const translateProject = getTranslateProject(); const sbxh = getSbxh(xmdm, xmxh) - console.info(judgeTag,JSON.stringify(performInfo)) const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; const asclshArr = stringToASC( fillZero((singlePlay?1111111111111:lsh) || 0, 13) ); //13不足要补0 - console.info(judgeTag,6) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) - console.info(judgeTag,7) const ascsbxhArr = stringToASC(sbxh) - console.info(judgeTag,8) const translateSignals = getTranslateSignals( [zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd].concat(getDwStatusType(dw)).concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0]) ) @@ -1045,12 +1030,6 @@ export default class Judge { const translateWd = convertGpsCoord2(jd).toFixed(gpsDigit) * Math.pow(10, gpsDigit) //@ts-ignore const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0]) - console.info(judgeTag,6) - // console.info(judgeTag,JSON.stringify(translateProject)) - //@ts-ignore - // const translateProjects= translateProject.map(num => string2Bytes(p,8)[0]) - console.info('surenjunxmmcexamTime' , examTime) - const arr = [ //考生号 asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), @@ -1104,30 +1083,22 @@ export default class Judge { tempArr = tempArr.concat(itemArr) }) this.serialIndex += 1; - console.info('message-judge-udp' + Array2Byte(tempArr).toString()); - return Array2Byte(tempArr) } //获取场地序号 getSbxh = (ksxm, xmxh) => { const {judgeUI} = this; - console.info(judgeTag,10) const {cdsbInfoObj,projectsObj} = judgeUI; - console.info(judgeTag,11) const project = projectsObj[ksxm] - console.info(judgeTag,12) if(project == 3){ return '0000000000' } if (project === undefined) { return '0000000000' } - console.info(judgeTag,13) const projectType = project.sbxh; const projectKey = `${ksxm}_${xmxh}`; - console.info(judgeTag,14) const currentCdsb = cdsbInfoObj[projectKey] || {}; - console.info(judgeTag,15) const sbxh = currentCdsb.sbbh || '0000000000' return sbxh } @@ -1177,8 +1148,6 @@ export default class Judge { arr.push(tempArr.join('')); } - console.info(judgeTag,JSON.stringify(arr)) - // return arr.map(numStr => parseInt(numStr, 2)); return arr } // 获取考试项目详情 @@ -1296,10 +1265,9 @@ export default class Judge { // 处理udp plc信号 handleUdp = async (msg) => { console.info('plc信号', msg) - const {fileLog,getPlcData,usbService} = this + const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd} = this const stachArr = msg.split(',') - const {isExamEnd} = this; - if (stachArr[0] != '#DN_GD' || isExamEnd) { + if (stachArr[0] != '#DN_GD' || isUdpEnd) { return } const plcData = await getPlcData(msg); @@ -1313,9 +1281,11 @@ export default class Judge { this.judgeUI.isDwztRight = plcData.gps.dwzt == 4; this.judgeUI.sd = (Math.floor(((plcData.gps.sd as number) || 0) * 1.852)) + ''; this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' - await examJudgeRealExam(plcData) + if(isExamEnd){ + await examJudgeRealExam(plcData) + } const udpIndex = globalThis.udpIndex; - if (udpIndex % 5 === 0 && !isExamEnd) { + if (udpIndex % 5 === 0 && !isUdpEnd) { const judgeUdp = globalThis.judgeUdp const bytes = await this.getMessageHeartbeat(); console.info(judgeTag+'UDP',JSON.stringify(bytes)) @@ -1373,9 +1343,7 @@ export default class Judge { console.info(judgeTag, '模拟数据考试结束') globalThis.windowClass.setWindowSystemBarEnable(['navigation']) clearInterval(judgeTimer) - await examJudgeEndExam() - this.isExamEnd = true - this.isManual = true + this.checkExamIsEnd(true) return } const msg = JSON.parse(strArr[num]); @@ -1464,6 +1432,8 @@ export default class Judge { private isExam: boolean //考试是否结束了 private isExamEnd: boolean + // 是否发送udp + private isUdpEnd: boolean = false //是否手动结束考试 private isManual: boolean //UDP服务序列号 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index 0abcc4d0..4ead1d0b 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -6,7 +6,7 @@ export const judgeConfig = { //是否开启拍照 isPhotoOpen: true, //扣分语音是否强制开启 - kfVoiceOpen: false, + kfVoiceOpen: true, //忽略的考试项目 ignoreProjects:[], // 是否忽略考试前熄火、车门检查 @@ -16,7 +16,7 @@ export const judgeConfig = { // 本地模型地址 modelPath: 'models/model_enc', // 济南科目三 - trajectoryPath: 'logs/2024_08_14/2024_08_14_11_30_20_9999805761528_344094918358022656_葛李弯/judge_exam_data.txt', + trajectoryPath: 'logs/2024_08_17/2024_08_17_16_51_24_9999282315477_203908531884520064_彭雯季/judge_exam_data.txt', //四合一画面配置 fourInOneScreen:{ //gps位数 diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts index a2b0ef5f..4dbeec8f 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeTask.ts @@ -29,12 +29,12 @@ export default class JudgeTask { await fn() res(true) } catch (e) { - console.info(TAG, JSON.stringify(e)) + console.info(TAG, '过程任务执行失败=>' + JSON.stringify(e)) Prompt.showToast({ - message: '过程数据接口解析错误', + message: '过程任务执行失败=>' + JSON.stringify(e), duration: 3000 }); - rej(false) + res(false) } }, isDelay ? delayTime : 0); })