feat:科目三评判优化

This commit is contained in:
surenjun 2024-07-16 17:32:25 +08:00
parent 1a4301f424
commit 03df4becd9
3 changed files with 23 additions and 23 deletions

View File

@ -15,6 +15,7 @@ import { getliushuiNum, setliushuiNum } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker'; import worker, { MessageEvents } from '@ohos.worker';
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
@Entry @Entry
@Component @Component
@ -213,6 +214,8 @@ struct Index {
globalThis.ratio = 1700 / 960 globalThis.ratio = 1700 / 960
this.angle = 0 this.angle = 0
this.loading = false this.loading = false
const avPlayer = new VoiceAnnounce();
avPlayer.playAudio(['voice/welcome.mp3'])
} }
async testXMLToJSONInWorker() { async testXMLToJSONInWorker() {

View File

@ -436,7 +436,6 @@ struct Index {
Text(this.time).fontColor('#CCB48F').fontSize(32).padding({ left: 10, right: 5 }) Text(this.time).fontColor('#CCB48F').fontSize(32).padding({ left: 10, right: 5 })
Image($rawfile(this.isDwztRight?'judge/xh_red.png':'judge/xh_green.png')).width(50) Image($rawfile(this.isDwztRight?'judge/xh_red.png':'judge/xh_green.png')).width(50)
}.padding({ left: 20 }) }.padding({ left: 20 })
Row() { Row() {
Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32) Text(`当前项目:${this.xmmcStr || '无'} `).fontColor('#E5CCA1').fontSize(32)
} }
@ -607,9 +606,7 @@ struct Index {
List({}) { List({}) {
ForEach(this.projects, (project) => { ForEach(this.projects, (project) => {
ListItem() { ListItem() {
Text(project.name) { Text(project.name) {}
}
.fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type)) .fontColor(this.getProjectColor(this.projectsObj[project.projectCode].type))
.margin({ bottom: 5 }) .margin({ bottom: 5 })
.fontSize(26) .fontSize(26)
@ -951,18 +948,22 @@ struct Index {
if (judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2') { if (judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2') {
return false return false
} }
//不允许人工触发的项目列表 //不允许人工触发的项目列表
if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) { if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) {
return false return false
} }
//项目进行中不能人工触发 //项目进行中不能人工触发
if (isProjectIn) { if(isProjectIn) {
if (param340 == 1 && isManualProjectIn && (currentXmdm == projectCode)) { if(param340 == 1){
return true if(isManualProjectIn && (currentXmdm == projectCode)){
}else{ return true
return false }else{
return false
}
} }
return false
} }
//项目路段信息判断 //项目路段信息判断
@ -1012,6 +1013,8 @@ struct Index {
'12':judgeConfigObj['519']?.split(',') || [], '12':judgeConfigObj['519']?.split(',') || [],
}; };
console.info('surenjun',JSON.stringify(projectRoads))
//未测绘得道路上或者不在差分状态 //未测绘得道路上或者不在差分状态
if(road === ''){ if(road === ''){
return false return false
@ -1040,10 +1043,8 @@ struct Index {
if(projectCode == '10' || projectCode == '4'){ if(projectCode == '10' || projectCode == '4'){
if(count < 2){return false} if(count < 2){return false}
} }
return true return true
} }
// 获取人工项目是否已做 // 获取人工项目是否已做
getIsEndManualProject = (index: number) => { getIsEndManualProject = (index: number) => {

View File

@ -172,9 +172,8 @@ export default class Judge {
handleTrajectoryUdp(strArr); handleTrajectoryUdp(strArr);
return return
} }
// 处理实时udp里的plc信号 // 处理实时udp里的plc信号
globalThis.udpClient.onMessage(async (msg) => { globalThis.udpClient.onMessage_1(async (msg) => {
handleUdp(msg) handleUdp(msg)
}) })
} }
@ -323,8 +322,9 @@ export default class Judge {
case 2: case 2:
judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3'); judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3');
//计算项目是否全部结束 //计算项目是否全部结束
console.info(judgeTag,projects.filter(project => project.type == '2').length ) this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter(
this.judgeUI.isProjectIn = (projects.filter(project => project.type == '2').length) > 0 projectKey => judgeUI.projectsObj[projectKey].type == '2').length
) > 0;
if(isManualProjectIn){ if(isManualProjectIn){
this.judgeUI.isManualProjectIn = false this.judgeUI.isManualProjectIn = false
} }
@ -383,6 +383,7 @@ export default class Judge {
//车道和路段变化 //车道和路段变化
case 9: case 9:
this.judgeUI.lane = lane this.judgeUI.lane = lane
console.info('surenjun',JSON.stringify(lane))
break; break;
default: default:
@ -624,11 +625,10 @@ export default class Judge {
const {avPlayer,fileLog} = this; const {avPlayer,fileLog} = this;
const {xmdm,code,type} = sound; const {xmdm,code,type} = sound;
//判断是不是模拟灯光语音 //判断是不是模拟灯光语音
console.info(judgeTag,JSON.stringify(sound))
if(type == 1){ if(type == 1){
console.info(judgeTag, '模拟灯光开始播放:' + code) console.info(judgeTag, '模拟灯光开始播放:' + code)
} }
avPlayer.playAudio([`voice/${code}.mp3`], true, () => { avPlayer.playAudio([`voice/${code}.mp3`], false, () => {
if (type == 1) { if (type == 1) {
console.info(judgeTag, '播放结束:' + code) console.info(judgeTag, '播放结束:' + code)
examJudgeSoundEnd({itemno:xmdm,code,type}) examJudgeSoundEnd({itemno:xmdm,code,type})
@ -794,9 +794,7 @@ export default class Judge {
const {jd,wd, hxj, fyj, hbg,} = gps const {jd,wd, hxj, fyj, hbg,} = gps
const translateProject = getTranslateProject(); const translateProject = getTranslateProject();
const sbxh = getSbxh(xmdm, xmxh) const sbxh = getSbxh(xmdm, xmxh)
console.log('sbxhsbxh', sbxh)
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo; const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo;
console.log('performInfo', JSON.stringify(performInfo))
// const asclshArr = stringToASC(lsh); // const asclshArr = stringToASC(lsh);
const asclshArr = stringToASC(fillZero('0000000000000' || 0, 13)); const asclshArr = stringToASC(fillZero('0000000000000' || 0, 13));
@ -806,19 +804,16 @@ export default class Judge {
const translateSignals = getTranslateSignals( const translateSignals = getTranslateSignals(
[zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, 0, 0, 0, 0].concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0]) [zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, 0, 0, 0, 0].concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0])
) )
console.log('jinweidu111jdwd0')
//@ts-ignore //@ts-ignore
const translateJd = convertGpsCoord2(wd).toFixed(7) * Math.pow(10, 7); const translateJd = convertGpsCoord2(wd).toFixed(7) * Math.pow(10, 7);
//@ts-ignore //@ts-ignore
const translateWd = convertGpsCoord2(jd).toFixed(7) * Math.pow(10, 7) const translateWd = convertGpsCoord2(jd).toFixed(7) * Math.pow(10, 7)
console.log('jinweidu111jdwd')
//@ts-ignore //@ts-ignore
const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0]) const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0])
//@ts-ignore //@ts-ignore
// const translateProjects= translateProject.map(num => string2Bytes(p,8)[0]) // const translateProjects= translateProject.map(num => string2Bytes(p,8)[0])
console.log('jinweidu2222', `${examType}${startHourTime}`)
const arr = [ const arr = [
//考生号 TODO 考试员号 //考生号 TODO 考试员号
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
@ -1043,6 +1038,7 @@ export default class Judge {
const str = await senorToWXDataStr(msg); const str = await senorToWXDataStr(msg);
usbService.sendUSB(str) usbService.sendUSB(str)
} }
this.judgeUI.isDwztRight = plcData.gps.dwzt == 4;
await examJudgeRealExam(plcData) await examJudgeRealExam(plcData)
const udpIndex = globalThis.udpIndex; const udpIndex = globalThis.udpIndex;
if (udpIndex % 5 === 0) { if (udpIndex % 5 === 0) {
@ -1117,7 +1113,7 @@ export default class Judge {
} }
await examJudgeRealExam(msg) await examJudgeRealExam(msg)
num++ num++
}, 100) }, 200)
globalThis.judgeTimer = judgeTimer; globalThis.judgeTimer = judgeTimer;
} }
// 统计必考项目数量 // 统计必考项目数量