feat:更新

This commit is contained in:
surenjun 2024-08-19 10:11:22 +08:00
parent 0837bd20d8
commit 54403ef2c7
11 changed files with 119 additions and 119 deletions

View File

@ -18,7 +18,8 @@ export async function download() {
interface WR{ interface WR{
message?:string message?:string
code:number code?:number
keystr?:string
} }
// 通用监管接口 // 通用监管接口
export async function writeObjectOut(params,filePath?:string): Promise<WR> { export async function writeObjectOut(params,filePath?:string): Promise<WR> {
@ -56,7 +57,7 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> {
const fileUtil = new FileUtil(globalThis.context); const fileUtil = new FileUtil(globalThis.context);
await fileUtil.initFolder(filePath); await fileUtil.initFolder(filePath);
fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({
xtlb,jkxlh,jkid,drvexam xtlb,jkxlh,jkid,drvexam:{...drvexam,zp:''},
})); }));
} }

View File

@ -39,7 +39,11 @@ export const getMessageHeartbeat = async (msg) => {
const { examSubject,plateNo } = carInfo; const { examSubject,plateNo } = carInfo;
const ksyh='0000000000000' const ksyh='0000000000000'
const {fourInOneScreen:{gpsDigit}} = judgeConfig 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 ascksyhArr = stringToASC(fillZero('1111111111111', 13))
const ascsbxhArr = stringToASC('00000000') const ascsbxhArr = stringToASC('00000000')
// const ascsbxhArr = stringToASC('153216400880') // const ascsbxhArr = stringToASC('153216400880')
@ -70,7 +74,7 @@ export const getMessageHeartbeat = async (msg) => {
string2Bytes(serialIndex, 2 * 8), string2Bytes(serialIndex, 2 * 8),
translateSignals, translateSignals,
//@ts-ignore //@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东向距离 //GPS东向距离
string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8),
//GPS北向距离 //GPS北向距离
@ -142,20 +146,20 @@ const getTranslateProject = () => {
for (let i = 0; i <= 4; i++) { for (let i = 0; i <= 4; i++) {
const temp = tempItems.slice(i * 4, (i + 1) * 4); const temp = tempItems.slice(i * 4, (i + 1) * 4);
let tempArr = temp.map(item => item.status) let tempArr = temp.map(item => item.status)
if (i === 4 && examSubject) { if (i === 4) {
tempArr = examSubject == 2 tempArr = examSubject == 2
//bit36-bit39保留 //bit36-bit39保留
? tempArr.concat(['00', '00']) ? tempArr.concat(['00', '00'])
//bit30-bit39保留 //bit30-bit39保留
: tempArr.concat(['00', '00','00','00']) : tempArr.concat(['00', '00','00'])
}
if (i === 3 && examSubject == 3) {
tempArr = tempArr.concat(['00'])
} }
// if (i === 3 && examSubject == 3) {
// tempArr = tempArr.concat(['00'])
// }
arr.push(tempArr.join('')); arr.push(tempArr.join(''));
} }
return arr.map(numStr => parseInt(numStr, 2)); return arr
} }
// 中心实时项目状态转换 // 中心实时项目状态转换

View File

@ -152,7 +152,7 @@ function handleCenterCode(msgXml,isNewCenter){
const msg = JSON.parse(msgXml); const msg = JSON.parse(msgXml);
const result = msg?.data[0]?.result; const result = msg?.data[0]?.result;
if(result){ if(result){
const {code,message} = result const {code,message,keystr} = result
if(code != '1'){ if(code != '1'){
const rMessage = decodeURIComponent(message as string) const rMessage = decodeURIComponent(message as string)
prompt.showToast({ prompt.showToast({
@ -161,7 +161,7 @@ function handleCenterCode(msgXml,isNewCenter){
}); });
return {code,message} return {code,message}
}else{ }else{
return { code } return { code ,keystr}
} }
} }
} }

View File

@ -275,7 +275,7 @@ struct Index {
this.dialogVisiable=false this.dialogVisiable=false
this.angle = 0 this.angle = 0
this.loading = false this.loading = false
globalThis.lsh = '1111111111111'
} }
async testXMLToJSONInWorker() { async testXMLToJSONInWorker() {

View File

@ -50,7 +50,6 @@ struct Index {
this.time = await getCurrentTime(); this.time = await getCurrentTime();
this.examTime += 1; this.examTime += 1;
}, 1000); }, 1000);
//初始化数据库表 //初始化数据库表
await this.initDb() await this.initDb()
//断点续考 //断点续考
@ -109,6 +108,7 @@ struct Index {
BK1: carInfo.bk1, BK1: carInfo.bk1,
BK2: carInfo.bk2, BK2: carInfo.bk2,
}) })
console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArrr))
} }
// 获取考生信息 // 获取考生信息
@ -222,6 +222,8 @@ struct Index {
//初始化systemParam表 //初始化systemParam表
async initSystemParam(sysParam?: SYSTEMPARMARR[]) { async initSystemParam(sysParam?: SYSTEMPARMARR[]) {
const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM') const systemParms: any = sysParam || await getSyncData('MA_SYSTEMPARM')
console.info('surenjun => systemParms',JSON.stringify(systemParms));
let currentParams: any = router.getParams(); let currentParams: any = router.getParams();
const {carName,carType,examSubject} = this; const {carName,carType,examSubject} = this;
//小车车型列表 //小车车型列表
@ -229,7 +231,10 @@ struct Index {
if (globalThis.singlePlay) { if (globalThis.singlePlay) {
this.wayno = currentParams.wayno || 1; 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 const {isTrajectoryOpen} = judgeConfig
let carNo = '', allItems = []; let carNo = '', allItems = [];
systemParms.forEach((systemParm) => { systemParms.forEach((systemParm) => {
@ -255,7 +260,6 @@ struct Index {
if(no1 == 3 && no3 == 3 && carNo === no2){ if(no1 == 3 && no3 == 3 && carNo === no2){
this.passingScore = Number(txt1) || 0; this.passingScore = Number(txt1) || 0;
} }
//获取当前考车的考试项目 //获取当前考车的考试项目
if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) { if (carNo !== '' && no1 == 3 && no2 == carNo && no3 == 10) {
allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '') allItems = decodeURIComponent(systemParm.txt1).split(',').filter(txt => txt !== '')
@ -274,6 +278,7 @@ struct Index {
if (sCarTypes.includes(carType) && name === '夜间行驶') { if (sCarTypes.includes(carType) && name === '夜间行驶') {
return return
} }
const currentProject = { const currentProject = {
name, name,
abbreviation: decodeURI(systemParm.txt3), abbreviation: decodeURI(systemParm.txt3),
@ -286,10 +291,19 @@ struct Index {
//项目开始数据是否上传过 //项目开始数据是否上传过
isUpload:false, isUpload:false,
} }
if(isInExam){
if(kStringArr.includes(txt2)){
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);
} }
}else {
this.projectsObj[no2*1] = currentProject
this.projectsCenterObj[txt2] = currentProject
this.projects.push(currentProject);
}
}
this.systemparmArr.push({ this.systemparmArr.push({
'NO1': no1 * 1, 'NO1': no1 * 1,
'NO2': no2 * 1, 'NO2': no2 * 1,
@ -458,7 +472,6 @@ struct Index {
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 beginDataObj = JSON.parse(beginData) const beginDataObj = JSON.parse(beginData)
// initDataObj.systemparm =
const examSubject = globalThis.carInfo.examSubject; const examSubject = globalThis.carInfo.examSubject;
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject; this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject;
globalThis.carInfo.examSubject = this.examSubject globalThis.carInfo.examSubject = this.examSubject
@ -814,26 +827,6 @@ struct Index {
.margin({ bottom: 20 }) .margin({ bottom: 20 })
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 }) }.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) { 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) { if (this.isAmplifyPopShow && this.examSubject == 3) {
AmplifyPopup({ AmplifyPopup({
@ -991,6 +1006,9 @@ struct Index {
getProjectIsInRoad getProjectIsInRoad
} = this; } = this;
const projectCode = artSubject3ProjectsCodesArr[index]; const projectCode = artSubject3ProjectsCodesArr[index];
if(projectsObj[projectCode] === undefined){
return false
}
const projectType = projectsObj[projectCode].type; const projectType = projectsObj[projectCode].type;
//不允许人工触发的项目列表,以","分隔 //不允许人工触发的项目列表,以","分隔

View File

@ -97,7 +97,9 @@ export default struct Index {
params:{ params:{
sczb, sczb,
kfdm, kfdm,
wayno wayno,
//TODO 真实监管项目
// kString:'40300,40500,40700,40800'
} }
}, router.RouterMode.Single); }, router.RouterMode.Single);

View File

@ -125,6 +125,8 @@ struct UserInfo {
this.isExamStart = false this.isExamStart = false
this.sczbkf = []; this.sczbkf = [];
this.avPlayer = new VoiceAnnounce(); this.avPlayer = new VoiceAnnounce();
initJudgeUdp()
} }
//身份证读卡器初始化 //身份证读卡器初始化
@ -166,7 +168,8 @@ struct UserInfo {
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
params: { params: {
sczb: Number(this.isBoardPrePareSetPopupOpen), sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf kfdm: this.sczbkf,
} }
}, router.RouterMode.Single); }, router.RouterMode.Single);
return return
@ -248,7 +251,7 @@ struct UserInfo {
this.stepFlag = false this.stepFlag = false
this.faceCompareSucess = 0 this.faceCompareSucess = 0
this.showFaceCompare = false this.showFaceCompare = false
this.lsh = '000000000000' this.lsh = '1111111111111'
this.callBackFlag = false this.callBackFlag = false
globalThis.lsh = this.lsh globalThis.lsh = this.lsh
// this.currentUser = EmptyCandidateObject // this.currentUser = EmptyCandidateObject
@ -507,7 +510,6 @@ struct UserInfo {
this.dataList = [] this.dataList = []
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
} }
} }
//身份比对 //身份比对
@ -530,11 +532,12 @@ struct UserInfo {
const avPlayer = this.avPlayer; const avPlayer = this.avPlayer;
this.isLoadingPopupVisible = true this.isLoadingPopupVisible = true
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
const temp = await this.beginExam(); //TODO 模拟
console.info('surenjun', JSON.stringify(temp)) const {code,keystr,message} = await this.beginExam();
if (temp.code != 1) { //@ts-ignore TODO code转换
if (code == '' && code == undefined) {
promptAction.showToast({ promptAction.showToast({
message: temp.message, message,
duration: 4000 duration: 4000
}) })
return return
@ -548,7 +551,9 @@ struct UserInfo {
params: { params: {
examItems: examItems?.getExaminationItemRsp?.body?.ykxx, examItems: examItems?.getExaminationItemRsp?.body?.ykxx,
sczb: Number(this.isBoardPrePareSetPopupOpen), sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf kfdm: this.sczbkf,
//真实监管项目
kString:keystr || ''
} }
}, router.RouterMode.Single); }, router.RouterMode.Single);
this.stopDeviceById() this.stopDeviceById()
@ -741,10 +746,12 @@ struct UserInfo {
.backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .onClick(() => {
globalThis.lsh = item.lsh;
if (this.isExamStart&&!globalThis.singlePlay) { if (this.isExamStart&&!globalThis.singlePlay) {
return return
} }
this.currentUser = item this.currentUser = item
}) })
}) })
}.width(640 * this.ratio).margin({ left: 30 * this.ratio }) }.width(640 * this.ratio).margin({ left: 30 * this.ratio })
@ -830,7 +837,6 @@ struct UserInfo {
this.isFirstBoardPrePareSetPopupBtnShow = true; this.isFirstBoardPrePareSetPopupBtnShow = true;
this.stepFlag = false this.stepFlag = false
this.stopDeviceById() this.stopDeviceById()
initJudgeUdp()
} catch (e) { } catch (e) {
} }
@ -853,7 +859,7 @@ struct UserInfo {
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
params: { params: {
sczb: Number(this.isBoardPrePareSetPopupOpen), sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf kfdm: this.sczbkf,
} }
}, router.RouterMode.Single); }, router.RouterMode.Single);
this.stopDeviceById() this.stopDeviceById()
@ -862,7 +868,6 @@ struct UserInfo {
if (this.FaceOpenStatue != '0') { if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true this.showFaceCompare = true
} else { } else {
initJudgeUdp()
this.sfbdinterfaceFn() this.sfbdinterfaceFn()
} }
} catch (e) { } catch (e) {

View File

@ -571,7 +571,7 @@ export const wuxiKm3Items = [
{projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'}, {projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'},
{projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'}, {projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'},
{projectCode:'12',projectCodeCenter:'41500',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:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'},
{projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'}, {projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'},
{projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'}, {projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'},

View File

@ -53,7 +53,7 @@ import {
} from './api/index'; } from './api/index';
const judgeTag = 'SURENJUN_JUDGE' const judgeTag = 'SURENJUN_JUDGE'
import { getSyncData, upDateTableByArray } from '../../common/service/initable';
export default class Judge { export default class Judge {
constructor(judgeUI) { constructor(judgeUI) {
this.serialIndex = 1; this.serialIndex = 1;
@ -129,15 +129,12 @@ export default class Judge {
console.info(judgeTag, '2.注册日志回调完成') console.info(judgeTag, '2.注册日志回调完成')
let initInfo = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData(); let initInfo = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData();
await fileLog.setExamJudgeData(initInfo)
//相关评判初始化只做一次 //相关评判初始化只做一次
if (!isJudgeInitBool) { if (!isJudgeInitBool) {
await fileLog.setExamJudgeData(initInfo)
const tempJudge = await examJudgeInit(initInfo); const tempJudge = await examJudgeInit(initInfo);
globalThis.isJudgeInitBool = true globalThis.isJudgeInitBool = true
console.info(judgeTag, '4.评判初始化完成') console.info(judgeTag, '4.评判初始化完成')
} else {
await fileLog.setExamJudgeData(initInfo)
} }
globalThis.isJudge = true globalThis.isJudge = true
@ -315,7 +312,6 @@ export default class Judge {
this.judgeUI.currentXmdm = xmdm; this.judgeUI.currentXmdm = xmdm;
const xmmcStr = judgeUI.projectsObj[xmdm].name; const xmmcStr = judgeUI.projectsObj[xmdm].name;
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
console.info(judgeTag,JSON.stringify(judgeUI.projectsObj[xmdm]))
const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
this.testKmItems[xmmcCode].status = 2; this.testKmItems[xmmcCode].status = 2;
this.xmmcStr = xmmcStr; this.xmmcStr = xmmcStr;
@ -344,7 +340,6 @@ export default class Judge {
//统计必考项目数量 //统计必考项目数量
this.xmmcStr = '无'; this.xmmcStr = '无';
this.xmmcCode = ''; this.xmmcCode = '';
this.xmmcSingleCode = 0;
this.xmdm = ''; this.xmdm = '';
this.judgeUI.isDeductedPopShow = false this.judgeUI.isDeductedPopShow = false
this.judgeUI.currentXmdm = undefined; this.judgeUI.currentXmdm = undefined;
@ -490,6 +485,7 @@ export default class Judge {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
await endProject(xmdm); await endProject(xmdm);
this.xmmcSingleCode = 0;
}, {isDelay: true}) }, {isDelay: true})
} }
} }
@ -658,16 +654,19 @@ export default class Judge {
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = getProjectInfo(ksxm); const project = getProjectInfo(ksxm);
//科目三上车准备、模拟灯光、夜间行驶出现通用评判ksxm为当前进行的项目 //科目三上车准备、模拟灯光、夜间行驶出现通用评判ksxm为当前进行的项目
const checkProjects = ['41600', '41700', '40100'] const checkProjects = ['1', '41', '17']
console.info(judgeTag + 'ksxm=>',ksxm)
console.info(judgeTag + 'xmmcSingleCode=>',xmmcSingleCode)
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C53', xtlb: '17', jkxlh: serialNumber, jkid: '17C53',
drvexam: { drvexam: {
lsh, lsh,
kskm: examSubject, kskm: examSubject,
ksxm: project ksxm: project == undefined
? (checkProjects.includes(xmmcSingleCode + '') ? xmmcSingleCode : project.projectCodeCenter) ? (checkProjects.includes(xmmcSingleCode + '')
: (examSubject == 3 ? 30000 : 10000), ? '40100'
: (examSubject == 3 ? 30000 : 10000))
: project.projectCodeCenter ,
kfxm: kf.markcatalog, kfxm: kf.markcatalog,
kfxmmx: `${ksxm},${kf.markserial}`, kfxmmx: `${ksxm},${kf.markserial}`,
sfzmhm: idCard, sfzmhm: idCard,
@ -677,6 +676,8 @@ export default class Judge {
kfsj: time kfsj: time
} }
} }
console.info(judgeTag + 'ksxm=>',data.drvexam.ksxm)
const {code} = await writeObjectOut(data,filePath); const {code} = await writeObjectOut(data,filePath);
if (code === 2300007) { if (code === 2300007) {
this.isJudgeDisConnect = true this.isJudgeDisConnect = true
@ -778,7 +779,6 @@ export default class Judge {
const param302 = judgeConfigObj['302']; const param302 = judgeConfigObj['302'];
const param342 = judgeConfigObj['342']; const param342 = judgeConfigObj['342'];
const param512 = (judgeConfigObj['512'] || '').split(','); const param512 = (judgeConfigObj['512'] || '').split(',');
//成绩不合格 //成绩不合格
if (totalScore < passingGrade) { if (totalScore < passingGrade) {
//科目三不合格报靠边停车 //科目三不合格报靠边停车
@ -791,13 +791,15 @@ export default class Judge {
return return
} }
//成绩合格 //成绩合格
if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) { if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) {
//考试合格自动退出 //考试合格自动退出
if(examSubject == 3 && param302 == 4){ if(examSubject == 3 && param302 == 4){
await examJudgeEndExam() await examJudgeEndExam()
this.isExamEnd = true this.isExamEnd = true
return return
} }
if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) {
if(param512[7] != 0){ if(param512[7] != 0){
avPlayer.playAudio(['voice/综合评判.mp3']) avPlayer.playAudio(['voice/综合评判.mp3'])
@ -819,24 +821,19 @@ export default class Judge {
this.judgeUI.loadingPopupVisible = true; this.judgeUI.loadingPopupVisible = true;
this.judgeUI.endPopupVisible = false; this.judgeUI.endPopupVisible = false;
this.judgeUI.isDeductedPopShow = false; this.judgeUI.isDeductedPopShow = false;
console.info(judgeTag,1)
const {qjjl,dcjl} = ksjs const {qjjl,dcjl} = ksjs
const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this; const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual} = this;
const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI;
//计算考试分数 //计算考试分数
console.info(judgeTag,2)
this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0;
const singlePlay = globalThis.singlePlay const singlePlay = globalThis.singlePlay
const param302 = judgeConfigObj['302']; const param302 = judgeConfigObj['302'];
globalThis.windowClass.setWindowSystemBarEnable(['navigation']) globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
console.info(judgeTag,3)
//自动退出待验证并且不合格 //自动退出待验证并且不合格
if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) {
avPlayer.playAudio([`voice/考试结束.mp3`]) avPlayer.playAudio([`voice/考试结束.mp3`])
} }
console.info(judgeTag,4)
//联网模式下手动结束的直接退出 //联网模式下手动结束的直接退出
if (!singlePlay && isManual && !isAllProjectsEnd) { if (!singlePlay && isManual && !isAllProjectsEnd) {
avPlayer.playAudio(['voice/empty.mp3'], true, () => { avPlayer.playAudio(['voice/empty.mp3'], true, () => {
@ -844,7 +841,6 @@ export default class Judge {
}) })
return return
} }
console.info(judgeTag,5)
if (examSubject == 3) { if (examSubject == 3) {
const param302 = judgeConfigObj['302']; const param302 = judgeConfigObj['302'];
if (totalScore < passingScore) { if (totalScore < passingScore) {
@ -856,17 +852,13 @@ export default class Judge {
//考试合格 //考试合格
} }
} }
console.info(judgeTag,6)
await handleSEP(306); await handleSEP(306);
console.info(judgeTag,7)
avPlayer.playAudio(['voice/exam_waiting.mp3'], true, async () => { avPlayer.playAudio(['voice/exam_waiting.mp3'], true, async () => {
try { try {
if (!singlePlay) { if (!singlePlay) {
// TODO 待验证
const bytes = await this.getMessageHeartbeat(true); const bytes = await this.getMessageHeartbeat(true);
globalThis.judgeUdp.send(bytes) globalThis.judgeUdp.send(bytes)
} }
//TODO endExam函数逻辑待验证
await endExam() await endExam()
} catch (e) { } catch (e) {
console.info(judgeTag,JSON.stringify(e)) console.info(judgeTag,JSON.stringify(e))
@ -903,7 +895,7 @@ export default class Judge {
kscj: (totalScore * 1) > 0 ? totalScore : 0, kscj: (totalScore * 1) > 0 ? totalScore : 0,
kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
// 1,22;2,560;3,128;4,0;5,0; // 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); const temp = await writeObjectOut(data,filePath);
@ -916,7 +908,6 @@ export default class Judge {
if (examSubject == 2) { if (examSubject == 2) {
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
} }
if (examSubject == 3) { if (examSubject == 3) {
if (isAllProjectsEnd) { if (isAllProjectsEnd) {
if (totalScore < passingScore) { 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}`) console.info(judgeTag, `考试成绩:${totalScore}`)
if(!singlePlay){ if(!singlePlay){
await uploadProgressData(); await uploadProgressData();
@ -945,6 +939,7 @@ export default class Judge {
if (score <= (examSubject == 3 ? 10 : 20)) { if (score <= (examSubject == 3 ? 10 : 20)) {
if (kfArr.length - 1 === index) { if (kfArr.length - 1 === index) {
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
this.isUdpEnd = true
router.back(); router.back();
}) })
throw new Error('End Loop') throw new Error('End Loop')
@ -965,6 +960,7 @@ export default class Judge {
} else { } else {
avPlayer.playAudio([voiceURL], true, () => { avPlayer.playAudio([voiceURL], true, () => {
setTimeout(() => { setTimeout(() => {
this.isUdpEnd = true
router.back(); router.back();
}, param302 == 8 ? 3000 : 0) }, param302 == 8 ? 3000 : 0)
}) })
@ -992,7 +988,6 @@ export default class Judge {
getMessageHeartbeat = async (isEnd?: Boolean) => { getMessageHeartbeat = async (isEnd?: Boolean) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject,plateNo,ksyh } = carInfo; const { examSubject,plateNo,ksyh } = carInfo;
console.info(judgeTag,1)
const { const {
judgeUI, judgeUI,
isExam, isExam,
@ -1007,35 +1002,25 @@ export default class Judge {
getTranslateProject, getTranslateProject,
getSbxh getSbxh
} = this; } = this;
console.info(judgeTag,2)
const singlePlay = globalThis.singlePlay const singlePlay = globalThis.singlePlay
const {lsh,startHourTime,totalScore,examTime} = judgeUI; const {lsh,startHourTime,totalScore,examTime} = judgeUI;
const {fourInOneScreen:{gpsDigit}} = judgeConfig const {fourInOneScreen:{gpsDigit}} = judgeConfig
console.info(judgeTag,3)
const examType = examSubject == 2?2:3 const examType = examSubject == 2?2:3
const {sensor,gps} = tempData; const {sensor,gps} = tempData;
console.info(judgeTag,4)
console.info(judgeTag,JSON.stringify(tempData))
if(tempData.sensor === undefined){ if(tempData.sensor === undefined){
return return
} }
const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs,dw} = sensor 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 const {jd,wd, hxj, fyj, hbg,} = gps
console.info(judgeTag,5)
const translateProject = getTranslateProject(); const translateProject = getTranslateProject();
const sbxh = getSbxh(xmdm, xmxh) const sbxh = getSbxh(xmdm, xmxh)
console.info(judgeTag,JSON.stringify(performInfo))
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?1111111111111:lsh) || 0, 13)
); );
//13不足要补0 //13不足要补0
console.info(judgeTag,6)
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
console.info(judgeTag,7)
const ascsbxhArr = stringToASC(sbxh) const ascsbxhArr = stringToASC(sbxh)
console.info(judgeTag,8)
const translateSignals = getTranslateSignals( 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]) [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) const translateWd = convertGpsCoord2(jd).toFixed(gpsDigit) * Math.pow(10, gpsDigit)
//@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])
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 = [ const arr = [
//考生号 //考生号
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
@ -1104,30 +1083,22 @@ export default class Judge {
tempArr = tempArr.concat(itemArr) tempArr = tempArr.concat(itemArr)
}) })
this.serialIndex += 1; this.serialIndex += 1;
console.info('message-judge-udp' + Array2Byte(tempArr).toString());
return Array2Byte(tempArr) return Array2Byte(tempArr)
} }
//获取场地序号 //获取场地序号
getSbxh = (ksxm, xmxh) => { getSbxh = (ksxm, xmxh) => {
const {judgeUI} = this; const {judgeUI} = this;
console.info(judgeTag,10)
const {cdsbInfoObj,projectsObj} = judgeUI; const {cdsbInfoObj,projectsObj} = judgeUI;
console.info(judgeTag,11)
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
console.info(judgeTag,12)
if(project == 3){ if(project == 3){
return '0000000000' return '0000000000'
} }
if (project === undefined) { if (project === undefined) {
return '0000000000' return '0000000000'
} }
console.info(judgeTag,13)
const projectType = project.sbxh; const projectType = project.sbxh;
const projectKey = `${ksxm}_${xmxh}`; const projectKey = `${ksxm}_${xmxh}`;
console.info(judgeTag,14)
const currentCdsb = cdsbInfoObj[projectKey] || {}; const currentCdsb = cdsbInfoObj[projectKey] || {};
console.info(judgeTag,15)
const sbxh = currentCdsb.sbbh || '0000000000' const sbxh = currentCdsb.sbbh || '0000000000'
return sbxh return sbxh
} }
@ -1177,8 +1148,6 @@ export default class Judge {
arr.push(tempArr.join('')); arr.push(tempArr.join(''));
} }
console.info(judgeTag,JSON.stringify(arr))
// return arr.map(numStr => parseInt(numStr, 2));
return arr return arr
} }
// 获取考试项目详情 // 获取考试项目详情
@ -1296,10 +1265,9 @@ export default class Judge {
// 处理udp plc信号 // 处理udp plc信号
handleUdp = async (msg) => { handleUdp = async (msg) => {
console.info('plc信号', msg) console.info('plc信号', msg)
const {fileLog,getPlcData,usbService} = this const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd} = this
const stachArr = msg.split(',') const stachArr = msg.split(',')
const {isExamEnd} = this; if (stachArr[0] != '#DN_GD' || isUdpEnd) {
if (stachArr[0] != '#DN_GD' || isExamEnd) {
return return
} }
const plcData = await getPlcData(msg); const plcData = await getPlcData(msg);
@ -1313,9 +1281,11 @@ export default class Judge {
this.judgeUI.isDwztRight = plcData.gps.dwzt == 4; this.judgeUI.isDwztRight = plcData.gps.dwzt == 4;
this.judgeUI.sd = (Math.floor(((plcData.gps.sd as number) || 0) * 1.852)) + ''; this.judgeUI.sd = (Math.floor(((plcData.gps.sd as number) || 0) * 1.852)) + '';
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
if(isExamEnd){
await examJudgeRealExam(plcData) await examJudgeRealExam(plcData)
}
const udpIndex = globalThis.udpIndex; const udpIndex = globalThis.udpIndex;
if (udpIndex % 5 === 0 && !isExamEnd) { if (udpIndex % 5 === 0 && !isUdpEnd) {
const judgeUdp = globalThis.judgeUdp const judgeUdp = globalThis.judgeUdp
const bytes = await this.getMessageHeartbeat(); const bytes = await this.getMessageHeartbeat();
console.info(judgeTag+'UDP',JSON.stringify(bytes)) console.info(judgeTag+'UDP',JSON.stringify(bytes))
@ -1373,9 +1343,7 @@ export default class Judge {
console.info(judgeTag, '模拟数据考试结束') console.info(judgeTag, '模拟数据考试结束')
globalThis.windowClass.setWindowSystemBarEnable(['navigation']) globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
clearInterval(judgeTimer) clearInterval(judgeTimer)
await examJudgeEndExam() this.checkExamIsEnd(true)
this.isExamEnd = true
this.isManual = true
return return
} }
const msg = JSON.parse(strArr[num]); const msg = JSON.parse(strArr[num]);
@ -1464,6 +1432,8 @@ export default class Judge {
private isExam: boolean private isExam: boolean
//考试是否结束了 //考试是否结束了
private isExamEnd: boolean private isExamEnd: boolean
// 是否发送udp
private isUdpEnd: boolean = false
//是否手动结束考试 //是否手动结束考试
private isManual: boolean private isManual: boolean
//UDP服务序列号 //UDP服务序列号

View File

@ -6,7 +6,7 @@ export const judgeConfig = {
//是否开启拍照 //是否开启拍照
isPhotoOpen: true, isPhotoOpen: true,
//扣分语音是否强制开启 //扣分语音是否强制开启
kfVoiceOpen: false, kfVoiceOpen: true,
//忽略的考试项目 //忽略的考试项目
ignoreProjects:[], ignoreProjects:[],
// 是否忽略考试前熄火、车门检查 // 是否忽略考试前熄火、车门检查
@ -16,7 +16,7 @@ export const judgeConfig = {
// 本地模型地址 // 本地模型地址
modelPath: 'models/model_enc', 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:{ fourInOneScreen:{
//gps位数 //gps位数

View File

@ -29,12 +29,12 @@ export default class JudgeTask {
await fn() await fn()
res(true) res(true)
} catch (e) { } catch (e) {
console.info(TAG, JSON.stringify(e)) console.info(TAG, '过程任务执行失败=>' + JSON.stringify(e))
Prompt.showToast({ Prompt.showToast({
message: '过程数据接口解析错误', message: '过程任务执行失败=>' + JSON.stringify(e),
duration: 3000 duration: 3000
}); });
rej(false) res(false)
} }
}, isDelay ? delayTime : 0); }, isDelay ? delayTime : 0);
}) })