衝突解決

This commit is contained in:
lvyuankang 2024-08-19 10:19:53 +08:00
commit b021e3221e
11 changed files with 157 additions and 157 deletions

View File

@ -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<WR> {
@ -56,7 +57,7 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> {
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:''},
}));
}

View File

@ -39,8 +39,12 @@ 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(
globalThis.singlePlay
?'1111111111111'
: globalThis.lsh,
13));
const ascksyhArr = stringToASC(fillZero('1111111111111', 13))
const ascsbxhArr = stringToASC('00000000')
// const ascsbxhArr = stringToASC('153216400880')
const serialIndex = globalThis.serialIndex
@ -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
}
// 中心实时项目状态转换

View File

@ -153,7 +153,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({
@ -162,7 +162,7 @@ function handleCenterCode(msgXml,isNewCenter){
});
return {code,message}
}else{
return { code }
return { code ,keystr}
}
}
}

View File

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

View File

@ -50,7 +50,6 @@ struct Index {
this.time = await getCurrentTime();
this.examTime += 1;
}, 1000);
//初始化数据库表
await this.initDb()
//断点续考
@ -109,13 +108,14 @@ struct Index {
BK1: carInfo.bk1,
BK2: carInfo.bk2,
})
console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArrr))
}
// 获取考生信息
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;
}
@ -221,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;
//小车车型列表
@ -228,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) => {
@ -254,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 !== '')
@ -273,21 +278,31 @@ struct Index {
if (sCarTypes.includes(carType) && name === '夜间行驶') {
return
}
const currentProject = {
name,
abbreviation: decodeURI(systemParm.txt3),
projectCode: no2,
projectCodeCenter: txt2,
//是否是必考 加减档设置成非必考
isRequired: no2== 14?false:allItems.includes(no2 + ''),
isRequired: no2== 14 ? false : allItems.includes(no2 + ''),
//是否考过了
isEnd: false,
//项目开始数据是否上传过
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,
@ -457,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
@ -813,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) {
@ -856,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({
@ -990,6 +1006,9 @@ struct Index {
getProjectIsInRoad
} = this;
const projectCode = artSubject3ProjectsCodesArr[index];
if(projectsObj[projectCode] === undefined){
return false
}
const projectType = projectsObj[projectCode].type;
//不允许人工触发的项目列表,以","分隔
@ -1178,6 +1197,8 @@ struct Index {
@State kssycs: string = ''
@State ksxl: string = ''
@State kslx: string = ''
//监管线路代码
@State xldm: string = ''
//监管接口序列号
@State serialNumber: number = 0
@State carType: string = ''

View File

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

View File

@ -165,6 +165,8 @@ struct UserInfo {
this.isExamStart = false
this.sczbkf = [];
this.avPlayer = new VoiceAnnounce();
initJudgeUdp()
}
//身份证读卡器初始化
@ -206,7 +208,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
@ -289,7 +292,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
@ -558,7 +561,6 @@ struct UserInfo {
this.dataList = []
this.currentUser = EmptyCandidateObject
}
}
//身份比对
@ -582,11 +584,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
@ -600,7 +603,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()
@ -718,16 +723,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),
@ -795,10 +798,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 })
@ -885,7 +890,6 @@ struct UserInfo {
this.isFirstBoardPrePareSetPopupBtnShow = true;
this.stepFlag = false
this.stopDeviceById()
initJudgeUdp()
} catch (e) {
}
@ -909,7 +913,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()
@ -918,7 +922,6 @@ struct UserInfo {
if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true
} else {
initJudgeUdp()
this.sfbdinterfaceFn()
}
} catch (e) {

View File

@ -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:'41700',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 = [{

View File

@ -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;
@ -462,14 +457,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;
@ -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})
}
}
@ -581,7 +577,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 +591,7 @@ export default class Judge {
sfzmhm: idCard,
ksxm: project.projectCodeCenter,
sbxh,
ksxl,
ksxl:xldm,
kchp: encodeURI(plateNo),
// 开始时间
ksdd: encodeURI(ksdd),
@ -618,7 +614,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 +629,7 @@ export default class Judge {
sbxh,
//TODO 操作类型 1:正常 0:撤销该考试记录
czlx: '1',
ksxl,
ksxl:xldm,
kchp: encodeURI(plateNo),
ksdd: encodeURI(ksdd),
kslx: encodeURI(kslx) || '',
@ -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
@ -726,15 +727,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`])
@ -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,32 +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(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))
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])
)
@ -1042,15 +1030,8 @@ 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('surenjunxstartHourTime' , startHourTime)
console.info('surenjunxmmcexamTime' , examTime)
const arr = [
//考生号
//考生号
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
//考试员号
ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
@ -1079,9 +1060,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 +1070,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 设备信号状态
@ -1105,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
}
@ -1178,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
}
// 获取考试项目详情
@ -1297,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);
@ -1314,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) {
if (udpIndex % 5 === 0 && !isUdpEnd) {
const judgeUdp = globalThis.judgeUdp
const bytes = await this.getMessageHeartbeat();
console.info(judgeTag+'UDP',JSON.stringify(bytes))
@ -1374,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]);
@ -1395,8 +1362,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)
@ -1465,6 +1432,8 @@ export default class Judge {
private isExam: boolean
//考试是否结束了
private isExamEnd: boolean
// 是否发送udp
private isUdpEnd: boolean = false
//是否手动结束考试
private isManual: boolean
//UDP服务序列号

View File

@ -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位数

View File

@ -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);
})