feat:评判修改

This commit is contained in:
surenjun 2024-09-02 19:23:56 +08:00
parent 9e5749b296
commit 6ecddd7cbf
9 changed files with 95 additions and 42 deletions

View File

@ -24,11 +24,12 @@ export async function setCurrentTime():Promise<void> {
let times = new Date(currentTime).getTime(); let times = new Date(currentTime).getTime();
console.log('jiangsong:times==' + times); console.log('jiangsong:times==' + times);
try { try {
systemTime.setTime(times).then(() => { await systemTime.setTime(times)
console.info(`Succeeded in setting time.`); // systemTime.setTime(times).then(() => {
}).catch((error) => { // console.info(`Succeeded in setting time.`);
console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`); // }).catch((error) => {
}); // console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`);
// });
} catch(e) { } catch(e) {
console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`);
} }

View File

@ -298,7 +298,8 @@ export async function setJudgeUdp() {
if (config && config.udplocalIp) { if (config && config.udplocalIp) {
const {udplocalIp} = config; const {udplocalIp} = config;
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.udpAddress, globalThis.carInfo?.hintPort)
await udpClientbyCenter.onError_Callback(()=>{}) await udpClientbyCenter.onError_Callback(()=>{})
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_2((val) => {}) await udpClientbyCenter.onMessage_2((val) => {})

View File

@ -43,11 +43,8 @@ export const initJudgeUdp = async () => {
wd2:wd, wd2:wd,
h:msgArr[90]*1 || 1, h:msgArr[90]*1 || 1,
}) })
if(distance < 1){
return
}
//@ts-ignore //@ts-ignore
globalThis.distanceClass.setTimeData(((distance / 100).toFixed(2)) * 1) globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
} }
prevJd = jd; prevJd = jd;
preWd = wd; preWd = wd;
@ -66,7 +63,7 @@ export const getMessageHeartbeat = async (msg) => {
? '1111111111111' ? '1111111111111'
: globalThis.lsh, : globalThis.lsh,
13)); 13));
const ascksyhArr = stringToASC(fillZero('1111111111111', 13)) const ascksyhArr = stringToASC(fillZero(examSubject == 2 ? '0000000000000':'1111111111111', 13))
const ascsbxhArr = stringToASC('00000000') const ascsbxhArr = stringToASC('00000000')
// const ascsbxhArr = stringToASC('153216400880') // const ascsbxhArr = stringToASC('153216400880')
const serialIndex = globalThis.serialIndex const serialIndex = globalThis.serialIndex

View File

@ -236,4 +236,16 @@ export function convertGpsCoord2 (num){
const du = Math.floor(tempNum / 100); const du = Math.floor(tempNum / 100);
const fen = tempNum % 100 + num - tempNum; const fen = tempNum % 100 + num - tempNum;
return du + fen / 60 return du + fen / 60
} }
export function debounce(fn, delay){
// 利用闭包定义定时器id变量存储
let timer = null;
return () => {
// 如果有值就清除定时器,重新计时
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(fn, delay);
}
};

View File

@ -28,12 +28,12 @@ export default class EntryAbility extends UIAbility {
globalThis.examinerInfo = {} globalThis.examinerInfo = {}
globalThis.deviceNo = ''; globalThis.deviceNo = '';
globalThis.hasAuth = false globalThis.hasAuth = false
// globalThis.version = '2022.08.13.01'//洛阳 globalThis.version = '2022.08.13.01'//洛阳
// globalThis.judgeVersion = '2022.12.05.1' globalThis.judgeVersion = '2022.12.05.1'
// globalThis.judgeVersion = '2022.12.05.1' // globalThis.judgeVersion = '2022.12.05.1'
// globalThis.version = '2022.08.13.01' // globalThis.version = '2022.08.13.01'
globalThis.version = '2024.11.22.14'//济南 // globalThis.version = '2024.11.22.14'//济南
globalThis.judgeVersion = '2024.11.22.14' // globalThis.judgeVersion = '2024.11.22.14'
globalThis.videoVersion= '1.0' globalThis.videoVersion= '1.0'
// globalThis.version = '2023.12.13.01' // globalThis.version = '2023.12.13.01'
// globalThis.judgeVersion = '2023.09.30.1' // globalThis.judgeVersion = '2023.09.30.1'

View File

@ -9,6 +9,8 @@ import Judge from './judgeSDK/judge';
import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon'; import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon';
import {uploadExamMileage} from '../api/judge' import {uploadExamMileage} from '../api/judge'
import DwztErrorPopup from './compontents/judge/DwztErrorPopup' import DwztErrorPopup from './compontents/judge/DwztErrorPopup'
import {debounce} from '../common/utils/tools'
import { import {
CARINFO, CARINFO,
CDSBInfo, CDSBInfo,
@ -28,6 +30,7 @@ import { getSyncData } from '../common/service/initable';
import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import SignDisplayCom from './compontents/signDisplayCom'; import SignDisplayCom from './compontents/signDisplayCom';
import promptAction from '@ohos.promptAction';
@Entry @Entry
@Component @Component
@ -161,7 +164,8 @@ struct Index {
const syssetParams = sysset || await getSyncData('MA_SYSSET') const syssetParams = sysset || await getSyncData('MA_SYSSET')
//@ts-ignore //@ts-ignore
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901'); const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901');
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '123456' console.info('surenjun serialNumberArr' + JSON.stringify(serialNumberArr))
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '';
const {isTrajectoryOpen} = judgeConfig const {isTrajectoryOpen} = judgeConfig
const syssetJudgeConfigArr = [] const syssetJudgeConfigArr = []
@ -294,13 +298,15 @@ struct Index {
this.projectsObj[no2*1] = currentProject this.projectsObj[no2*1] = currentProject
this.projectsCenterObj[txt2] = currentProject this.projectsCenterObj[txt2] = currentProject
this.projects.push(currentProject); this.projects.push(currentProject);
console.info('surenjun txt2=>',txt2)
//真实监管下发考试项目 //真实监管下发考试项目
if(isInExam && !kStringArr.includes(txt2)){ if(isInExam && !kStringArr.includes(txt2)){
this.projectsObj[no2*1].type = '3' this.projectsObj[no2*1].type = '3'
this.projectsObj[no2*1].isUpload = true this.projectsObj[no2*1].isUpload = true
this.projectsObj[no2*1].isEnd = true this.projectsObj[no2*1].isEnd = true
this.projectsCenterObj[txt2].type = '3'
this.projectsCenterObj[txt2].isUpload = true
this.projectsCenterObj[txt2].isEnd = true
this.isDdxk = true this.isDdxk = true
this.ddxkKsxmArr.push(txt2) this.ddxkKsxmArr.push(txt2)
} }
@ -382,6 +388,8 @@ struct Index {
const projectCode = this.projectsCenterObj[xmdm].projectCode const projectCode = this.projectsCenterObj[xmdm].projectCode
if(this.projectsObj[projectCode]){ if(this.projectsObj[projectCode]){
this.projectsObj[projectCode].type = '3' this.projectsObj[projectCode].type = '3'
this.projectsObj[projectCode].isUpload = true
this.projectsObj[projectCode].isEnd = true
} }
}) })
this.ddxkKsxmArr = ddxkKsxmArr this.ddxkKsxmArr = ddxkKsxmArr
@ -846,10 +854,15 @@ struct Index {
this.isDeductedPopShow = false; this.isDeductedPopShow = false;
this.defaultTabIndex = 0; this.defaultTabIndex = 0;
}, },
confirmMark: async (itemno, serial) => { confirmMark: async (itemno, serial)=>{
const judge = this.judge clearTimeout(this.popTimer)
await judge.setJudgeMark(itemno, serial); this.popTimer = null
this.isDeductedPopShow = false this.popTimer = setTimeout(async ()=>{
const judge = this.judge
await judge.setJudgeMark(itemno, serial);
this.isDeductedPopShow = false
this.popTimer = null;
},500)
} }
}) })
} }
@ -879,10 +892,15 @@ struct Index {
if (this.isAmplifyPopShow && this.examSubject == 3) { if (this.isAmplifyPopShow && this.examSubject == 3) {
AmplifyPopup({ AmplifyPopup({
amplifyImgIndex: this.amplifiedImgIndex, amplifyImgIndex: this.amplifiedImgIndex,
confirmAmplify: async (amplify) => { confirmAmplify:async (amplify)=>{
const judge = this.judge clearTimeout(this.popTimer)
await judge.setJudgeItem(amplify.projectCode, 1); this.popTimer = null
this.isAmplifyPopShow = false this.popTimer = setTimeout(async ()=>{
const judge = this.judge
await judge.setJudgeItem(amplify.projectCode, 1);
this.isAmplifyPopShow = false
this.popTimer = null;
},500)
}, },
closeAmplifyPop: () => { closeAmplifyPop: () => {
this.isAmplifyPopShow = false this.isAmplifyPopShow = false
@ -1263,4 +1281,5 @@ struct Index {
@State mileageTimer: number = 0; @State mileageTimer: number = 0;
@State passingScore: number = 80 @State passingScore: number = 80
@State dwztErrorVisible: boolean = false; @State dwztErrorVisible: boolean = false;
@State popTimer:number =0;
} }

View File

@ -651,6 +651,7 @@ struct UserInfo {
duration: 4000 duration: 4000
}) })
avPlayer.playAudio(['voice/监管审核未通过.mp3']); avPlayer.playAudio(['voice/监管审核未通过.mp3']);
this.isLoadingPopupVisible = false
return return
} }
this.currentUser.id = '0' this.currentUser.id = '0'
@ -800,7 +801,7 @@ struct UserInfo {
drvexam, drvexam,
xtlb: '17', xtlb: '17',
//接口序列号 //接口序列号
jkxlh: this.jkxlh || '', jkxlh: this.jkxlh,
//接口标识 //接口标识
jkid: '17C51', jkid: '17C51',
} }

View File

@ -80,14 +80,16 @@ export default class Judge {
this.isExam = !this.judgeUI.singlePlay; this.isExam = !this.judgeUI.singlePlay;
const {projectsCenterObj,examSubject} = judgeUI; const {projectsCenterObj,examSubject} = judgeUI;
//科目三待修改
(examSubject ==2 ? testKm2Items : testKm3Items ).forEach(item => { (examSubject ==2 ? testKm2Items : testKm3Items ).forEach(item => {
const projectCenterObj = projectsCenterObj[item.code]
this.testKmItems[item.code] = item; this.testKmItems[item.code] = item;
//考试项目存在 //考试项目存在
this.testKmItems[item.code] = { this.testKmItems[item.code] = {
code: item.code, code: item.code,
status: 1, status: projectCenterObj === undefined
// status: projectsCenterObj[item.code]?.isRequired ? 1 : 0 ? 0
: ( projectCenterObj.isEnd ? 3 : 1 )
} }
}) })
console.info(judgeTag+'testKmItems',JSON.stringify(this.testKmItems)) console.info(judgeTag+'testKmItems',JSON.stringify(this.testKmItems))
@ -156,13 +158,25 @@ export default class Judge {
let beginExamInfo = isTrajectoryOpen ? { let beginExamInfo = isTrajectoryOpen ? {
...JSON.parse(strArr[1]), ...JSON.parse(strArr[1]),
replay: 1, replay: 1,
ykxm:judgeConfig.ignoreProjects
} : await getJudgeBeginData() } : await getJudgeBeginData()
await fileLog.setExamJudgeData(beginExamInfo) await fileLog.setExamJudgeData(beginExamInfo)
await examJudgeBeginExam(beginExamInfo); await examJudgeBeginExam(beginExamInfo);
console.info(judgeTag, '6.开始考试注册完成') console.info(judgeTag, '6.开始考试注册完成')
avPlayer.playAudio([globalThis.singlePlay ? 'voice/ksks.WAV' : 'voice/监管成功.mp3']) avPlayer.playAudio([globalThis.singlePlay ? 'voice/ksks.WAV' : 'voice/监管成功.mp3'])
const {examSubject,projectsObj} = this.judgeUI
if(examSubject == 3){
//不做模拟灯光,需要做上车准备 =>(请上车准备)
if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){
avPlayer.playAudio(['voice/上车准备.mp3'])
}
//不做模拟灯光,不做上车准备 =>(请起步,完成考试)
if(projectsObj[41]?.type == 3 && projectsObj[1]?.type == 3){
avPlayer.playAudio(['voice/402001.mp3'])
}
}
this.judgeUI.draw = true this.judgeUI.draw = true
// 处理轨迹plc信息 // 处理轨迹plc信息
if (isTrajectoryOpen) { if (isTrajectoryOpen) {
@ -196,7 +210,7 @@ export default class Judge {
h:hxj || 1, h:hxj || 1,
}) })
//@ts-ignore //@ts-ignore
globalThis.distanceClass.setTimeData(((distance / 100).toFixed(2)) * 1) globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
} }
this.prevJd = tJD; this.prevJd = tJD;
this.prevWd = tWD; this.prevWd = tWD;
@ -628,7 +642,6 @@ export default class Judge {
kssj: time kssj: time
} }
} }
console.info(judgeTag +'filePath' , filePath)
const {code} = await writeObjectOut(data,filePath) const {code} = await writeObjectOut(data,filePath)
console.info(judgeTag, '项目开始 end') console.info(judgeTag, '项目开始 end')
if (code === 2300007) { if (code === 2300007) {
@ -970,8 +983,13 @@ export default class Judge {
let currentKssycs =0; let currentKssycs =0;
let voiceURL = '' let voiceURL = ''
if (examSubject == 2) { if (examSubject == 2) {
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') if (isAllProjectsEnd) {
switch (voiceURL){ 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
}
switch (voiceURL){
case 'voice/unqualified_one.wav': case 'voice/unqualified_one.wav':
currentKssycs = 0; currentKssycs = 0;
break; break;
@ -1069,6 +1087,7 @@ export default class Judge {
const projectsObj = this.judgeUI.projectsObj const projectsObj = this.judgeUI.projectsObj
return projectsObj[type]?.abbreviation || '通用评判' return projectsObj[type]?.abbreviation || '通用评判'
} }
// 扣分项目转换 // 扣分项目转换
getKfStr = (code) => { getKfStr = (code) => {
const markRuleListObj = this.judgeUI.markRuleListObj; const markRuleListObj = this.judgeUI.markRuleListObj;
@ -1113,7 +1132,7 @@ export default class Judge {
const sbxh = getSbxh(xmdm, xmxh) const sbxh = getSbxh(xmdm, xmxh)
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {};
const asclshArr = stringToASC( const asclshArr = stringToASC(
fillZero((singlePlay ? 1111111111111 : lsh) || 0, 13) fillZero((singlePlay ? (examSubject == 2 ? '0000000000000':'1111111111111') : lsh) || 0, 13)
); );
//13不足要补0 //13不足要补0
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
@ -1130,7 +1149,6 @@ export default class Judge {
//@ts-ignore //@ts-ignore
let tempSd = ((judgeConfigObj['350'] ==0 ? sd : cs) * 1.852).toFixed(0) * 1 let tempSd = ((judgeConfigObj['350'] ==0 ? sd : cs) * 1.852).toFixed(0) * 1
console.info(judgeTag + "prevSD",tempSd);
if(tempSd < 1){ if(tempSd < 1){
tempSd = 0 tempSd = 0
} }
@ -1234,7 +1252,6 @@ export default class Judge {
status: getCenterProjectStatus(current.status) status: getCenterProjectStatus(current.status)
} }
}) })
// console.info(judgeTag+'TranslateProject',JSON.stringify(tempItems));
const arr = []; const arr = [];
for (let i = 0; i <= 4; i++) { for (let i = 0; i <= 4; i++) {
@ -1282,6 +1299,7 @@ export default class Judge {
} }
//人工操作项目 //人工操作项目
public setJudgeItem = async (itemno, type: 1 | 2) => { public setJudgeItem = async (itemno, type: 1 | 2) => {
console.info('surenjun','2')
const {fileLog} = this; const {fileLog} = this;
await examJudgeArtificialItem(itemno * 1, type); await examJudgeArtificialItem(itemno * 1, type);
await fileLog.setExamJudgeData({ await fileLog.setExamJudgeData({
@ -1398,7 +1416,10 @@ export default class Judge {
if (udpIndex % 5 === 0 && !isUdpEnd) { if (udpIndex % 5 === 0 && !isUdpEnd) {
const judgeUdp = globalThis.judgeUdp const judgeUdp = globalThis.judgeUdp
const bytes = await this.getMessageHeartbeat(isExamEnd); const bytes = await this.getMessageHeartbeat(isExamEnd);
console.info(judgeTag,JSON.stringify(bytes))
console.info(judgeTag,'udp-prev-send')
judgeUdp.send(bytes) judgeUdp.send(bytes)
console.info(judgeTag,'udp-prev-end')
} }
globalThis.udpIndex += 1 globalThis.udpIndex += 1
} }
@ -1450,12 +1471,13 @@ export default class Judge {
const msgStr = strArr[num]; const msgStr = strArr[num];
if(msgStr == ''){ if(msgStr == ''){
console.info(judgeTag, '模拟数据考试结束') console.info(judgeTag, '模拟数据考试结束')
// globalThis.windowClass.setWindowSystemBarEnable(['navigation']) globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
clearInterval(judgeTimer) clearInterval(judgeTimer)
this.checkExamIsEnd(true) this.checkExamIsEnd(true)
return return
} }
const msg = JSON.parse(strArr[num]); const msg = JSON.parse(strArr[num]);
num++
// 4.过程数据 // 4.过程数据
this.tempData = msg this.tempData = msg
this.judgeUI.isDwztRight = msg?.gps?.dwzt == 4; this.judgeUI.isDwztRight = msg?.gps?.dwzt == 4;
@ -1473,8 +1495,8 @@ export default class Judge {
await examJudgeRealExam(msg) await examJudgeRealExam(msg)
const bytes = await this.getMessageHeartbeat(); const bytes = await this.getMessageHeartbeat();
bytes && globalThis.judgeUdp.send(bytes) bytes && globalThis.judgeUdp.send(bytes)
num++
}, 200) }, 50)
globalThis.judgeTimer = judgeTimer; globalThis.judgeTimer = judgeTimer;
} }

View File

@ -16,7 +16,7 @@ export const judgeConfig = {
// 本地模型地址 // 本地模型地址
modelPath: 'models/model_enc', modelPath: 'models/model_enc',
// 济南科目三 // 济南科目三
trajectoryPath: 'logs/2024_08_17/2024_08_17_16_51_24_9999282315477_203908531884520064_彭雯季/judge_exam_data.txt', trajectoryPath: 'logs/2024_08_29/2024_08_29_09_48_08_2230612098578_410311200501058031_闫嘉衡/judge_exam_data.txt',
//四合一画面配置 //四合一画面配置
fourInOneScreen:{ fourInOneScreen:{
//gps位数 //gps位数