feat_surenjun #20
@ -9,7 +9,7 @@ import Judge from './judgeSDK/judge'
|
|||||||
import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common'
|
import {defaultJudgeConfigObj} from './judgeSDK/utils//judge-common'
|
||||||
import {
|
import {
|
||||||
Project, ProjectObj, MarkRule, CDSBInfo,
|
Project, ProjectObj, MarkRule, CDSBInfo,
|
||||||
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM
|
SYSTEMPARMARR,CARINFO ,MAPPOINT ,MAPITEMPOINTITEM,SYSSET
|
||||||
} from './judgeSDK/api/judgeSDK.d'
|
} from './judgeSDK/api/judgeSDK.d'
|
||||||
import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools'
|
import { getCurrentTime, formatTime, getCurrentHourTime,chunkArr } from '../common/utils/tools'
|
||||||
import { examJudgeEndExam } from './judgeSDK/api/index'
|
import { examJudgeEndExam } from './judgeSDK/api/index'
|
||||||
@ -29,9 +29,7 @@ struct Index {
|
|||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
globalThis.windowClass.setWindowSystemBarEnable([''])
|
globalThis.windowClass.setWindowSystemBarEnable([''])
|
||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
const examSubject = globalThis.carInfo.examSubject
|
|
||||||
|
|
||||||
this.examSubject = examSubject
|
|
||||||
this.startTime = time.split(' ')[1]
|
this.startTime = time.split(' ')[1]
|
||||||
this.startFullTime = await getCurrentTime(1);
|
this.startFullTime = await getCurrentTime(1);
|
||||||
this.startHourTime = await getCurrentHourTime()
|
this.startHourTime = await getCurrentHourTime()
|
||||||
@ -67,9 +65,8 @@ struct Index {
|
|||||||
? await this.initSystemKm2Param()
|
? await this.initSystemKm2Param()
|
||||||
: await this.initSystemKm3Param()
|
: await this.initSystemKm3Param()
|
||||||
await this.initMarkRules();
|
await this.initMarkRules();
|
||||||
|
await this.initSysset();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.initSysset();
|
|
||||||
await this.initCDSBInfo()
|
await this.initCDSBInfo()
|
||||||
|
|
||||||
// 科目三新增读取表数据
|
// 科目三新增读取表数据
|
||||||
@ -140,33 +137,44 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取sysset表信息
|
// 获取sysset表信息
|
||||||
async initSysset() {
|
async initSysset(sysset?:SYSSET[]) {
|
||||||
const syssetParams = 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'
|
this.serialNumber = (serialNumberArr[0] && serialNumberArr[0].v_value) || '123456'
|
||||||
|
const {isTrajectoryOpen} = judgeConfig
|
||||||
const judgeConfig = []
|
const syssetJudgeConfigArr = []
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
syssetParams.forEach((sys) => {
|
syssetParams.forEach((sys) => {
|
||||||
|
if(isTrajectoryOpen){
|
||||||
|
sys.v_no = sys.key;
|
||||||
|
sys.v_name = sys.name;
|
||||||
|
sys.v_value = sys.value
|
||||||
|
}
|
||||||
|
|
||||||
const {v_no,v_value} = sys;
|
const {v_no,v_value} = sys;
|
||||||
const v_no_num = v_no * 1;
|
const v_no_num = v_no * 1;
|
||||||
const value = decodeURIComponent(v_value)
|
const value = decodeURIComponent(v_value)
|
||||||
if(v_no_num >= 10 &&v_no_num <= 900){
|
if(v_no_num >= 10 &&v_no_num <= 900){
|
||||||
judgeConfig.push({
|
syssetJudgeConfigArr.push({
|
||||||
key: v_no_num,value: value,
|
key: v_no_num,value: value,
|
||||||
name: decodeURI(sys.v_name)
|
name: decodeURI(sys.v_name)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//科目三应行驶距离参数
|
||||||
|
if(sys.v_no == '303'){
|
||||||
|
this.examMileage = sys.v_value + '';
|
||||||
|
}
|
||||||
|
|
||||||
this.judgeConfigObj[sys.v_no] = value
|
this.judgeConfigObj[sys.v_no] = value
|
||||||
});
|
});
|
||||||
this.judgeConfig = judgeConfig;
|
this.judgeConfig = syssetJudgeConfigArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化systemParam表
|
// 初始化systemParam表
|
||||||
async initSystemKm2Param(){
|
async initSystemKm2Param(sysParam?:SYSTEMPARMARR[]){
|
||||||
const systemParms:any = await getSyncData('MA_SYSTEMPARM')
|
const systemParms:any = sysParam || await getSyncData('MA_SYSTEMPARM')
|
||||||
const carName = this.carName;
|
const carName = this.carName;
|
||||||
|
|
||||||
let carNo2 = '',allItems = [];
|
let carNo2 = '',allItems = [];
|
||||||
@ -238,7 +246,6 @@ struct Index {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const txt2 = decodeURIComponent(systemParm.txt2)
|
const txt2 = decodeURIComponent(systemParm.txt2)
|
||||||
|
|
||||||
if (no1 == 6) {
|
if (no1 == 6) {
|
||||||
const currentProject = {
|
const currentProject = {
|
||||||
name: decodeURI(systemParm.txt1),
|
name: decodeURI(systemParm.txt1),
|
||||||
@ -250,9 +257,9 @@ struct Index {
|
|||||||
this.projectsCenterObj[txt2] = currentProject
|
this.projectsCenterObj[txt2] = currentProject
|
||||||
this.projects.push(currentProject)
|
this.projects.push(currentProject)
|
||||||
}
|
}
|
||||||
if(no1 == 3 && no2 == 1 && no3 == 15){
|
// if(no1 == 3 && no2 == 1 && no3 == 15){
|
||||||
this.examMileage = decodeURI(systemParm.txt1)
|
// this.examMileage = decodeURI(systemParm.txt1)
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
const projects = this.projects;
|
const projects = this.projects;
|
||||||
if (!projects.length) {
|
if (!projects.length) {
|
||||||
@ -382,8 +389,7 @@ struct Index {
|
|||||||
|
|
||||||
// 初始化本地systemparam表、markrule表
|
// 初始化本地systemparam表、markrule表
|
||||||
async initTrajectoryParam(trajectoryPath:string){
|
async initTrajectoryParam(trajectoryPath:string){
|
||||||
const examSubject = globalThis.carInfo.examSubject;
|
const {isTrajectoryOpen} = judgeConfig
|
||||||
|
|
||||||
//轨迹回放读取 systemparam表、markrule表
|
//轨迹回放读取 systemparam表、markrule表
|
||||||
const fileUtil = new FileUtil(this.context);
|
const fileUtil = new FileUtil(this.context);
|
||||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
||||||
@ -391,11 +397,16 @@ struct Index {
|
|||||||
const strArr = str.split('\n');
|
const strArr = str.split('\n');
|
||||||
const [initData,beginData] = [strArr[0],strArr[1]];
|
const [initData,beginData] = [strArr[0],strArr[1]];
|
||||||
const initDataObj = JSON.parse(initData)
|
const initDataObj = JSON.parse(initData)
|
||||||
|
const systemparm = initDataObj.systemparm;
|
||||||
|
const examSubject = globalThis.carInfo.examSubject;
|
||||||
|
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm*1):examSubject;
|
||||||
|
globalThis.carInfo.examSubject = this.examSubject
|
||||||
examSubject == 2
|
examSubject == 2
|
||||||
? await this.initSystemKm2Param()
|
? await this.initSystemKm2Param(systemparm)
|
||||||
: await this.initSystemKm3Param(initDataObj.systemparm)
|
: await this.initSystemKm3Param(systemparm)
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
await this.initMarkRules(testMarkRules);
|
await this.initMarkRules(testMarkRules);
|
||||||
|
await this.initSysset(initDataObj.sysset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,11 @@ export interface SOUND {
|
|||||||
//语音播放提示代码
|
//语音播放提示代码
|
||||||
code:string
|
code:string
|
||||||
}
|
}
|
||||||
|
export interface SYSSET {
|
||||||
|
v_no:string,
|
||||||
|
v_name:string,
|
||||||
|
v_value:string
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProjectObj {
|
export interface ProjectObj {
|
||||||
[k:any]:Project
|
[k:any]:Project
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {writeObjectOut,uploadExamProgressData} from '../../api/judge'
|
|||||||
import {deepClone,getCurrentTime,stringToASC,string2Bytes,fillZero,Array2Byte,convertGpsCoord2} from '../../common/utils/tools'
|
import {deepClone,getCurrentTime,stringToASC,string2Bytes,fillZero,Array2Byte,convertGpsCoord2} from '../../common/utils/tools'
|
||||||
import {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode,getKmProjectVoice} from './utils//judge-common'
|
import {getTranslateSignals,getCarStatus,getCarStatusType,getCenterProjectStatus,plcStrToJson,plcStrToWXJson,promptWxCode,getKmProjectVoice} from './utils//judge-common'
|
||||||
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem} from './api/index'
|
import {examJudgeSetLogCallback,examJudgeBeginExam,examJudgeInit,examJudgeRealExam,examJudgeSetRealExamCallback,examJudgeSetPerformCallback,examJudgeEndExam,examJudgeArtificialMark,examJudgeArtificialItem} from './api/index'
|
||||||
import Want from '@ohos.app.ability.Want';
|
|
||||||
import prompt from '@ohos.prompt';
|
import prompt from '@ohos.prompt';
|
||||||
|
|
||||||
const judgeTag = 'SURENJUN_JUDGE'
|
const judgeTag = 'SURENJUN_JUDGE'
|
||||||
@ -129,6 +129,7 @@ export default class Judge{
|
|||||||
await examJudgeBeginExam(beginExamInfo);
|
await examJudgeBeginExam(beginExamInfo);
|
||||||
console.info(judgeTag,'6.开始考试注册完成')
|
console.info(judgeTag,'6.开始考试注册完成')
|
||||||
|
|
||||||
|
avPlayer.playAudio(['voice/ksks.WAV'])
|
||||||
// 处理轨迹plc信息
|
// 处理轨迹plc信息
|
||||||
if(isTrajectoryOpen){
|
if(isTrajectoryOpen){
|
||||||
handleTrajectoryUdp(strArr);
|
handleTrajectoryUdp(strArr);
|
||||||
@ -139,7 +140,7 @@ export default class Judge{
|
|||||||
globalThis.udpClient.onMessage(async (msg) => {
|
globalThis.udpClient.onMessage(async (msg) => {
|
||||||
handleUdp(msg)
|
handleUdp(msg)
|
||||||
})
|
})
|
||||||
avPlayer.playAudio(['voice/ksks.WAV'])
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,13 @@
|
|||||||
//考试回放开关
|
//考试回放开关
|
||||||
export const judgeConfig = {
|
export const judgeConfig = {
|
||||||
//本地目录开关
|
//本地目录开关
|
||||||
isTrajectoryOpen: false,
|
isTrajectoryOpen: true,
|
||||||
//是否开启Udp
|
//是否开启Udp
|
||||||
udpOpen:false,
|
udpOpen:false,
|
||||||
// 本地模型地址
|
// 本地模型地址
|
||||||
modelPath: 'models/model_enc',
|
modelPath: 'models/model_enc',
|
||||||
trajectoryPath: 'logs/2024_05_15/0000000000001_342323199501470011_测试学员1_2024_05_15_15_30_23/judge_exam_data.txt'
|
// 轨迹回放地址
|
||||||
|
trajectoryPath: 'logs/2023_06_14/0000000000001_342323199501470011_测试学员1_2023_06_14_15_33_31/judge_exam_data.txt'
|
||||||
}
|
}
|
||||||
|
|
||||||
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
|
//0000000000001_342323199501470011_测试学员1_2024_04_28_10_59_44
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import media from '@ohos.multimedia.media';
|
import media from '@ohos.multimedia.media';
|
||||||
|
import prompt from '@ohos.prompt';
|
||||||
|
|
||||||
const TAG = 'VoiceAnnounce'
|
const TAG = 'VoiceAnnounce'
|
||||||
|
|
||||||
@ -18,7 +19,6 @@ export default class VoiceAnnounce{
|
|||||||
async playAudio(urls:string[],shit,callback:Function){
|
async playAudio(urls:string[],shit,callback:Function){
|
||||||
const {isStopped,queue} = this;
|
const {isStopped,queue} = this;
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
console.info('surenjun',JSON.stringify(callback))
|
|
||||||
if(shit){
|
if(shit){
|
||||||
//队列清空,重新初始化
|
//队列清空,重新初始化
|
||||||
this.isStopped = true;
|
this.isStopped = true;
|
||||||
@ -45,6 +45,7 @@ export default class VoiceAnnounce{
|
|||||||
await go()
|
await go()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await avPlayer.play(queue[0],callback);
|
await avPlayer.play(queue[0],callback);
|
||||||
this.queue.shift();
|
this.queue.shift();
|
||||||
console.info(TAG,JSON.stringify(this.queue),'堆栈弹出');
|
console.info(TAG,JSON.stringify(this.queue),'堆栈弹出');
|
||||||
@ -73,14 +74,22 @@ class AVPlayer {
|
|||||||
this.endCallback = callback
|
this.endCallback = callback
|
||||||
const avPlayer = await media.createAVPlayer();
|
const avPlayer = await media.createAVPlayer();
|
||||||
this.avPlayer = avPlayer;
|
this.avPlayer = avPlayer;
|
||||||
return new Promise(async (resolve)=>{
|
return new Promise(async (resolve,reject) => {
|
||||||
|
let url = ''
|
||||||
await this.setAVPlayerCallback(()=>{
|
await this.setAVPlayerCallback(()=>{
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
resolve()
|
resolve()
|
||||||
});
|
});
|
||||||
let url = await globalThis.context.resourceManager.getRawFd(name)
|
try {
|
||||||
this.avPlayer.fdSrc = url;
|
url = await globalThis.context.resourceManager.getRawFd(name);
|
||||||
|
this.avPlayer.fdSrc = url;
|
||||||
|
} catch (e) {
|
||||||
|
prompt.showToast({
|
||||||
|
message: `${name}语音文件不存在`,
|
||||||
|
duration: 4000
|
||||||
|
});
|
||||||
|
resolve(1)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//音频播放队列
|
//音频播放队列
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user