Compare commits

...

6 Commits

13 changed files with 241 additions and 172 deletions

View File

@ -33,10 +33,19 @@ export default class FileUtil{
let path = absolutePath
folderList.forEach((folderName=>{
path += `/${folderName}`;
try {
const isExit = fs.accessSync(path);
if(!isExit){
fs.mkdirSync(path)
}
} catch (e) {
promptAction.showToast({
message:`初始化文件夹失败`+JSON.stringify(e),
duration:4000,
})
}
}));
return path;
}

View File

@ -1,12 +1,12 @@
import systemTime from '@ohos.systemDateTime';
import { Array2Byte, fillZero, string2Bytes, stringToASC } from '../../common/utils/tools';
import { testKmItems } from '../../pages/judgeSDK/dataTest/index';
import { testKm2Items,testKm3Items } from '../../pages/judgeSDK/dataTest/index';
import { judgeConfig } from '../../pages/judgeSDK/utils/judgeConfig';
import { setJudgeUdp, setTopLineUdp } from './GlobalUdp';
import { convertGpsCoord2 } from '../utils/tools';
import common from '@ohos.app.ability.common';
export const initJudgeUdp = async () => {
globalThis.serialIndex = 0;
globalThis.udpIndex = 0;
@ -21,8 +21,6 @@ export const initJudgeUdp = async () => {
lightLineUdp.send(arrBlueBuffer);
}
globalThis.lightLineUdp = lightLineUdp
/*******************************************/
globalThis.udpClient.onMessage_1(async (msg) => {
const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD') {
@ -42,25 +40,25 @@ export const getMessageHeartbeat = async (msg) => {
const carInfo = globalThis.carInfo;
const { examSubject,plateNo } = carInfo;
const ksyh='0000000000000'
const {fourInOneScreen:{gpsDigit}} = judgeConfig
const asclshArr = stringToASC(fillZero(globalThis.lsh || 0, 13));
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
const ascsbxhArr = stringToASC('00000000')
// const ascsbxhArr = stringToASC('153216400880')
const serialIndex = globalThis.serialIndex
const tempData = await getPlcData(msg);
const examType = examSubject == 2?2:3
const {sensor,gps} = tempData;
const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs} = sensor
const {jd,wd, hxj, fyj, hbg,} = gps
const translateSignals = getTranslateSignals(
[zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, 0, 0, 0, 0, 0, 0, ygq, sensor.wd, 0]
)
console.log('jinweiduwaike',wd,jd,hxj,fyj,hbg)
const translateProject = getTranslateProject();
//@ts-ignore
const translateJd = convertGpsCoord2(wd).toFixed(7) * Math.pow(10, 7)
const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit);
//@ts-ignore
const translateWd = convertGpsCoord2(jd).toFixed(7) * Math.pow(10, 7)
const translateWd = convertGpsCoord2(jd).toFixed(gpsDigit) * Math.pow(10, gpsDigit)
//@ts-ignore
const translateProjects = translateProject.map(numStr => string2Bytes(parseInt(numStr, 2), 8)[0])
const arr = [
@ -68,20 +66,20 @@ export const getMessageHeartbeat = async (msg) => {
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
//考试员号
ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
// 科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间
string2Bytes('00000000000', 4 * 8),
//科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间
string2Bytes(`${0}${'00:00:00'}`, 4 * 8),
// 消息序号
string2Bytes(serialIndex, 2 * 8),
translateSignals,
//@ts-ignore
string2Bytes(cs, 2 * 8), string2Bytes(fdjzs / 60, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
string2Bytes(Math.floor(gps.sd*1.852) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
//GPS东向距离
string2Bytes(0, 4 * 8),
//GPS北向距离
string2Bytes(0, 4 * 8),
//航向角 俯仰角 高程(海拔)
//@ts-ignore
string2Bytes((hxj + 90) * 100, 2 * 8), string2Bytes(fyj * 100, 2 * 8), string2Bytes(hbg * 100, 4 * 8),
string2Bytes((hxj) * 100, 2 * 8), string2Bytes(fyj * 100, 2 * 8), string2Bytes(hbg * 100, 4 * 8),
//dddd
translateProjects,
//当前项目编号
@ -123,26 +121,28 @@ const getTranslateSignals = (tempItems) => {
// 中心所有项目转换
const getTranslateProject = () => {
const allKmItemsObj = {};
testKmItems.forEach(item => {
allKmItemsObj[item.code] = item;
})
const examSubject =globalThis.examSubject;
const tempItems = testKmItems.map(item => {
const current = allKmItemsObj[item.code];
const tempItems = (examSubject == 2 ? testKm2Items:testKm3Items).map(code => {
return {
code: item.code,
status: getCenterProjectStatus(current.status)
code, status:'0'
}
})
const len = Math.floor(tempItems.length / 8);
const arr = [];
for (let i = 0; i <= len; i++) {
const temp = tempItems.slice(i * 8, (i + 1) * 8);
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) {
tempArr = tempArr.concat(['00', '00'])
if (i === 4 && examSubject) {
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'])
}
arr.push(tempArr.join(''));
}
return arr.map(numStr => parseInt(numStr, 2));

View File

@ -100,6 +100,11 @@ export async function getCurrentHourTime():Promise<string> {
//@ts-ignore
s = s < 10 ? '0' + s : s;
let ss = date.getMilliseconds();
//@ts-ignore
ss = ss < 10 ? '00' + ss : ss;
//@ts-ignore
ss = ss < 100 ? '0' + ss : ss;
return `${h}${m}${s}${ss}`
}

View File

@ -43,28 +43,21 @@ struct Index {
this.startTime = time.split(' ')[1]
this.startFullTime = await getCurrentTime(1);
this.startHourTime = await getCurrentHourTime()
this.startExamTime = time
setInterval(async () => {
this.time = await getCurrentTime();
this.examTime += 1;
}, 1000);
console.log('SURENJUN_JUDGE',10)
//初始化数据库表
await this.initDb()
//断点续考
console.log('SURENJUN_JUDGE',11)
await this.goDdxkItems()
//初始化评判
console.log('SURENJUN_JUDGE',6)
const judge = await this.initJudge();
console.log('SURENJUN_JUDGE',7)
this.judge = judge
}
@ -76,6 +69,7 @@ struct Index {
const {isTrajectoryOpen,trajectoryPath} = judgeConfig
await this.initStudent();
await this.initCar();
//是否开启轨迹回放模式
if (isTrajectoryOpen) {
this.initTrajectoryParam(trajectoryPath)
@ -85,16 +79,12 @@ struct Index {
await this.initSysset();
this.singlePlay = globalThis.singlePlay
}
await this.initCDSBInfo()
// 科目三新增读取表数据
if (examSubject == 3) {
await this.initMapPoint()
await this.initMapPointItem()
//定时上传考试里程
// let mileageTimer = setInterval(()=>{
// this.uploadMileage()
@ -310,6 +300,8 @@ struct Index {
})
})
const projects = this.projects;
console.info('surenjun',JSON.stringify(this.projectsObj))
if (!projects.length) {
Prompt.showToast({
message: '读取数据库信息失败,请重新联网更新!',
@ -341,10 +333,7 @@ struct Index {
// 评判相关初始化
async initJudge() {
console.log('SURENJUN_JUDGE',0)
const judge = new Judge(this);
console.log('SURENJUN_JUDGE',30)
await judge.onJudgeFn(async (judgeData) => {
const {xmmcStr,carztStr,kfArr} = judgeData;
this.xmmcStr = xmmcStr;
@ -833,13 +822,6 @@ struct Index {
.margin({ bottom: 20 })
}.height('90%').justifyContent(FlexAlign.Start).padding({ top: 37, left: 60, bottom: 35, right: 60 })
//loading 弹窗
if (this.loadingPopupVisible) {
LoadingPopup({
title: '正在生成考试记录,请稍后...',
})
}
if (this.signDisplayComVisible) {
Column() {
SignDisplayCom({
@ -922,6 +904,13 @@ struct Index {
}
})
}
//loading 弹窗
if (this.loadingPopupVisible) {
LoadingPopup({
title: '正在生成考试记录,请稍后...',
})
}
}
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
}
@ -955,9 +944,13 @@ struct Index {
artSubject3ProjectsCodesArr,
currentXmdm,
} = this;
const projectCode = artSubject3ProjectsCodesArr[index]
const projectCode = artSubject3ProjectsCodesArr[index];
console.info('surenjun',getIsExitManualProject(index))
if (getIsExitManualProject(index)) {
// 正在进行的项目 取消项目
console.info('surenjun isManualProjectIn=>',isManualProjectIn)
console.info('surenjun projectCode=>',projectCode)
console.info('surenjun currentXmdm=>',currentXmdm)
if (isManualProjectIn && projectCode === currentXmdm) {
await this.judge.setJudgeItem(currentXmdm, 2);
Prompt.showToast({

View File

@ -17,14 +17,18 @@ import promptAction from '@ohos.promptAction';
import FilePhoto from './judgeSDK/utils/filePhoto';
import { getSyncData, upDateTableByArray } from '../common/service/initable';
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup'
import LoadingPopup from './compontents/judge/LoadingPopup';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { JudgeConfig } from '../config/judge';
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import { initJudgeUdp } from '../common/utils/UdpJudge';
@Entry
@Component
struct UserInfo {
private filePhoto: FilePhoto
private avPlayer
@State pageIndex: number = 0
@State ratio: number = 1700 / 960
@State index: number = 0
@ -43,12 +47,9 @@ struct UserInfo {
@State isBoardPrePareSetPopupOpen: boolean = false
@State isFirstBoardPrePareSetPopupBtnShow: boolean = false
@State isBoardPrePareSetPopupShow: boolean = false
@State isLoadingPopupVisible: boolean = false;
@State loadingText: string = '正在认证监管信息,请稍后...'
@State sczbkf: {
xmdm: number,
kfdm: string
}[] = []
@State isLoadingPopupVisible:boolean = false;
@State loadingText:string = '正在认证监管信息,请稍后...'
@State sczbkf:{xmdm:number,kfdm:string}[] = []
@State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = []
@State list: Array<User> = []
@ -61,7 +62,7 @@ struct UserInfo {
@State idCard: string = '';
@State grantDept: string = '';
//是否已经开始考试
@State isExamStart: boolean = false;
@State isExamStart:boolean = false;
@State effectDate: string = '';
@State interval: any = null;
@State studentRefreshStatue: string = '0';
@ -86,10 +87,7 @@ struct UserInfo {
return photoBase64
}
}
private filePhoto: FilePhoto
private avPlayer
private AccountTable = new AccountTable(() => {
}, USER);
private AccountTable = new AccountTable(() => {}, USER);
private context = getContext(this) as common.UIAbilityContext;
private labelBlocks = [
{ label: '考生姓名', key: 'xm' },
@ -514,12 +512,12 @@ struct UserInfo {
this.currentUser.id = '1'
const avPlayer = this.avPlayer;
this.isLoadingPopupVisible = true
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
avPlayer.playAudio([`voice/监管通信中.mp3`],false,async ()=>{
const code = await this.beginExam();
if (code != 1) {
promptAction.showToast({
message: '开始考试接口调用失败!',
duration: 4000
message:'开始考试接口调用失败!',
duration:4000
})
return
}
@ -543,30 +541,30 @@ struct UserInfo {
// 检测车门、熄火信号
async checkSignal(): Promise<boolean> {
const {isCheckFireOpen} = judgeConfig
return new Promise((resolve, reject) => {
if (isCheckFireOpen) {
return new Promise((resolve,reject)=>{
if(isCheckFireOpen){
resolve(true)
// return
}
console.info('socketTag[PLC.UdpClient]', '注册udp回调')
let plcValue = globalThis.udpClient.getCurrentMessage();
console.info('surenjun', plcValue)
console.info('surenjun',plcValue)
const msgArr = plcValue.split(',') || ''
const mkg = msgArr[14];
const fdjzs = msgArr[25];
if (mkg == 1) {
if(mkg == 1){
this.avPlayer.playAudio(['voice/关门.mp3'])
promptAction.showToast({
message: '请关闭车门',
duration: 4000
message:'请关闭车门',
duration:4000
})
reject(false)
}
if (fdjzs * 1 > 0) {
if(fdjzs*1 > 0){
this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({
message: '请熄火',
duration: 4000
message:'请熄火',
duration:4000
})
reject(false)
}
@ -744,6 +742,7 @@ struct UserInfo {
this.isFirstBoardPrePareSetPopupBtnShow = true;
this.stepFlag = false
this.stopDeviceById()
initJudgeUdp()
} catch (e) {
}
@ -759,11 +758,8 @@ struct UserInfo {
if (!this.currentUser.xm) {
return
}
console.info('surenjun currentUser', JSON.stringify(this.currentUser))
if (globalThis.singlePlay) {
const {examSubject} = globalThis.carInfo;
console.info('surenjun => sczbkf', JSON.stringify(this.sczbkf))
await upDateTableByArray('USER', [this.currentUser])
router.pushUrl({
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
@ -779,6 +775,7 @@ struct UserInfo {
if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true
} else {
initJudgeUdp()
this.sfbdinterfaceFn()
}
} catch (e) {
@ -845,7 +842,7 @@ struct UserInfo {
}
// loading
if (this.isLoadingPopupVisible) {
if(this.isLoadingPopupVisible){
LoadingPopup({
title: this.loadingText,
})
@ -885,7 +882,7 @@ struct CommText {
build() {
Text(this.text)
.fontSize(19.5 * this.ratio)
.fontSize(16 * this.ratio)
.lineHeight(30 * this.ratio)
.fontWeight(500)
.fontColor(this.color)
@ -911,13 +908,9 @@ struct LabelBlock {
build() {
Row() {
Text(this.label).fontSize(18 * this.ratio).fontColor('#99948A')
Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A')
Row() {
Text(decodeURIComponent(this.value))
.fontColor('#fff')
.textAlign(TextAlign.Center)
.width('100%')
.fontSize(20 * this.ratio)
Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
}
.commLabelStyle()
}.margin({ bottom: 10 * this.ratio })

View File

@ -25,10 +25,7 @@ export async function examJudgeVersion(){
* @desc
*/
export async function examJudgeSetLogCallback(level:number,handleLog:Function):Promise<string>{
console.log('SURENJUN_JUDGESDK',0)
const temp = libJudgeSdk.examJudgeSetLogCallback(level,handleLog);
console.log('SURENJUN_JUDGESDK',1)
return await handle(temp,'examJudgeSetLogCallback')
}

View File

@ -113,7 +113,6 @@ export interface EXAMDATA {
xmxh: string,
xmhg: 1 | 0
},
//扣分
kf: {
//项目代码
@ -131,7 +130,13 @@ export interface EXAMDATA {
//前进距离
qjjl: number,
//倒车距离
dcjl: number
dcjl: number,
d1: number
d2: number
d3: number
d4: number
d5: number
d6: number
},
//项目取消

View File

@ -557,42 +557,72 @@ export const testUIAllitems = [
{"name":"直角转弯","abbreviation":"直角转弯","projectCode":"6","projectCodeCenter":"20700","type":"7"},
]
//所有的科二项目
export const testKmItems = [
export const wuxiKm3Items = [
{projectCode:'1',projectCodeCenter:'40100',name:'上车准备',abbreviation:'上车准备'},
{projectCode:'2',projectCodeCenter:'40200',name:'起步',abbreviation:'起步'},
{projectCode:'3',projectCodeCenter:'40300',name:'直线行驶',abbreviation:'直线行驶'},
{projectCode:'4',projectCodeCenter:'40500',name:'变更车道',abbreviation:'变更车道'},
{projectCode:'5',projectCodeCenter:'40700',name:'直行通过路口',abbreviation:'直行通过路口'},
{projectCode:'6',projectCodeCenter:'41000',name:'通过人行横道线',abbreviation:'通过人行横道线'},
{projectCode:'7',projectCodeCenter:'41100',name:'通过学校区域',abbreviation:'通过学校区域'},
{projectCode:'8',projectCodeCenter:'41200',name:'通过公共汽车站',abbreviation:'通过公共汽车站'},
{projectCode:'9' ,projectCodeCenter:'41300',name:'会车',abbreviation:'会车'},
{projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'},
{projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'},
{projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'},
{projectCode:'13',projectCodeCenter:'41600',name:'夜间行驶',abbreviation:'夜间行驶'},
{projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'},
{projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'},
{projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'},
]
//所有的科二 科目三项目
export const testKm2Items = [
{code:'20100',status:0},
{code:'20200',status:0},
{code:'20300',status:0},
{code:'20400',status:0},
{code:'20500',status:0},
{code:'20600',status:0},
{code:'20700',status:0},
{code:'20800',status:0},
{code:'20900',status:0},
{code:'21000',status:0},
{code:'21100',status:0},
{code:'21200',status:0},
{code:'21300',status:0},
{code:'21400',status:0},
{code:'21500',status:0},
{code:'21600',status:0},
{code:'21700',status:0},
{code:'21800',status:0},
]
export const testKm3Items= [
{code:'40100',status:0},
{code:'40200',status:0},
{code:'40300',status:0},
{code:'40400',status:0},
{code:'40500',status:0},
{code:'40600',status:0},
{code:'40700',status:0},
{code:'40800',status:0},
{code:'40900',status:0},
{code:'41000',status:0},
{code:'41100',status:0},
{code:'41200',status:0},
{code:'41300',status:0},
{code:'41400',status:0},
{code:'41500',status:0},
{code:'41600',status:0},
{code:'41700',status:0},
]

View File

@ -2,7 +2,7 @@ import systemTime from '@ohos.systemDateTime';
import router from '@ohos.router';
import util from '@ohos.util';
import buffer from '@ohos.buffer';
import { testKmItems, testMarkRules } from './dataTest/index';
import { testKm2Items,testKm3Items, testMarkRules } from './dataTest/index';
import { EXAMDATA, SOUND, KSJS } from './api/judgeSDK';
import VoiceAnnounce from './utils/voiceAnnouncements';
import FileModel from './utils/fileModel';
@ -28,6 +28,7 @@ import {
import {
getCarStatus,
getCarStatusType,
getDwStatusType,
getCenterProjectStatus,
getKmProjectVoice,
getTranslateSignals,
@ -78,18 +79,19 @@ export default class Judge {
this.trajectoryPath = trajectoryPath;
this.isExam = !this.judgeUI.singlePlay;
const {projectsCenterObj} = judgeUI
const {projectsCenterObj,examSubject} = judgeUI;
//科目三待修改
testKmItems.forEach(item => {
(examSubject ==2 ? testKm2Items : testKm3Items ).forEach(item => {
this.testKmItems[item.code] = item;
//考试项目存在
if (projectsCenterObj[item.code]) {
this.testKmItems[item.code] = {
code: item.code, status: 1
}
code: item.code,
status: 1,
// status: projectsCenterObj[item.code]?.isRequired ? 1 : 0
}
})
console.info(judgeTag+'testKmItems',JSON.stringify(this.testKmItems))
this.isExamEnd = false;
}
@ -163,7 +165,7 @@ export default class Judge {
await fileLog.setExamJudgeData(beginExamInfo)
await examJudgeBeginExam(beginExamInfo);
console.info(judgeTag, '6.开始考试注册完成')
avPlayer.playAudio(['voice/ksks.WAV'])
avPlayer.playAudio([globalThis.singlePlay?'voice/ksks.WAV':'voice/监管成功.mp3'])
this.judgeUI.draw = true
// 处理轨迹plc信息
if (isTrajectoryOpen) {
@ -299,6 +301,7 @@ export default class Judge {
switch (event) {
//项目开始
case 1:
console.info(judgeTag,'项目开始开始1')
judgeUI.projectsObj[xmdm].type = '2';
if (isManualProjectIn) {
//手动项目是否在进行中
@ -310,6 +313,7 @@ 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;
@ -319,10 +323,12 @@ export default class Judge {
this.xmxh = xmxh;
this.judgeUI.isProjectIn = true
this.judgeUI.isDeductedPopShow = true
console.info(judgeTag,'项目开始开始2')
break;
//项目结束
case 2:
case 2: {
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3');
//计算项目是否全部结束
this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter(
@ -331,6 +337,7 @@ export default class Judge {
if (isManualProjectIn) {
this.judgeUI.isManualProjectIn = false
}
this.testKmItems[xmmcCode].status = 3;
//统计必考项目数量
this.xmmcStr = '无';
this.xmmcCode = '';
@ -339,7 +346,7 @@ export default class Judge {
this.judgeUI.isDeductedPopShow = false
this.judgeUI.currentXmdm = undefined;
break;
}
//扣分
case 3:
const thisKf = getKfStr(`${kf.xmdm}_${kf.kfdm}`)
@ -447,15 +454,11 @@ export default class Judge {
judgeTask.addTask(async () => {
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
await beginProject(xmdm)
}, {
isDelay: true
})
},{isDelay: true})
judgeTask.addTask(async () => {
console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
await uploadProgressPhoto(xmdm)
}, {
isDelay: true
})
},{isDelay: true})
this.judgeUI.projectsObj[xmdm].isUpload = true;
}
break;
@ -476,11 +479,8 @@ export default class Judge {
judgeTask.addTask(async () => {
console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`)
await endProject(xmdm);
}, {
isDelay: true
})
}, {isDelay: true})
}
}
judgeUI.projectsObj[xmdm].isEnd = true;
break;
@ -499,9 +499,7 @@ export default class Judge {
await judgeTask.addTask(async () => {
console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`)
await pointsDedute(currentKf.xmdm, currentKf)
}, {
isDelay: true
})
}, {isDelay: true})
}
break;
@ -524,13 +522,11 @@ export default class Judge {
}
if (event == 2 || event == 3) {
setTimeout(() => {
console.info(judgeTag,'滚动开始')
this.judgeUI.kfArrScroller.scrollTo({
yOffset: 999999, xOffset: 0
})
console.info(judgeTag,'滚动结束')
},500)
//科目三统计必考数量
//统计必考项目完成数量
await this.setCountItems();
await checkExamIsEnd()
}
@ -541,24 +537,27 @@ export default class Judge {
if(xmdm == 20){
return true
}
const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd} = this;
const {projectsObj} = this.judgeUI
console.info(judgeTag + ' projectsObj=> ',JSON.stringify(projectsObj))
const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd,totalScore} = this;
const {projectsObj,passingScore:passingGrade} = this.judgeUI
const {isUpload} = projectsObj[xmdm];
console.info(judgeTag + ' projectsObj[xmdm] => ',JSON.stringify(projectsObj[xmdm]))
//如果项目没有开始
console.info('surenjun isUpload=>',isUpload)
if(!isUpload){
console.info(judgeTag,'项目补传开始')
//项目开始补传
judgeTask.addTask(async ()=>{await beginProject(xmdm)},{isDelay:true})
judgeTask.addTask(async ()=>{await uploadProgressPhoto(xmdm)},{isDelay:true})
this.judgeUI.projectsObj[xmdm].isUpload = true;
//扣分补传
if(currentType == 2){
judgeTask.addTask(async ()=>{await pointsDedute(xmdm,kf)},{isDelay:true})
}
//扣分补传判断是否合格 不合格补传项目结束
if(currentType == 1 || (currentType == 2 && totalScore < passingGrade)){
judgeTask.addTask(async ()=>{await endProject(xmdm)},{isDelay:true})
judgeTask.addTask(async ()=>{
this.judgeUI.projectsObj[xmdm].isEnd = true;
}
judgeTask.addTask(async ()=>{
checkExamIsEnd()
})
return false;
@ -719,7 +718,7 @@ export default class Judge {
}
avPlayer.playAudio([`voice/${code}.mp3`], false, () => {
if (type == 1) {
console.info(judgeTag, '播放结束:' + code)
// console.info(judgeTag, '播放结束:' + code)
examJudgeSoundEnd({
itemno: xmdm, code, type
})
@ -832,8 +831,8 @@ export default class Judge {
try {
if (!singlePlay) {
// TODO 待验证
// const bytes = await this.getMessageHeartbeat(true);
// globalThis.judgeUdp.send(bytes)
const bytes = await this.getMessageHeartbeat(true);
globalThis.judgeUdp.send(bytes)
}
//TODO endExam函数逻辑待验证
await endExam()
@ -857,6 +856,7 @@ export default class Judge {
await uploadDisConnectData();
const time = await getCurrentTime();
const photoBase64 = await getPhoto();
const {d1,d2,d3,d4,d5} = ksjs
const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C56',
drvexam: {
@ -869,8 +869,8 @@ export default class Judge {
jssj: time,
kscj: (totalScore * 1) > 0 ? totalScore : 0,
kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100),
//TODO
dwlc: '',
// 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(';'),
}
}
const code = await writeObjectOut(data,filePath);
@ -957,8 +957,6 @@ export default class Judge {
getMessageHeartbeat = async (isEnd?: Boolean) => {
const carInfo = globalThis.carInfo;
const { examSubject,plateNo,ksyh } = carInfo;
// const ksyh='0000000000000'
// const ksyh=globalThis.ksyh ||'0000000000000'
const {
judgeUI,
isExam,
@ -974,34 +972,32 @@ export default class Judge {
getSbxh
} = this;
const {lsh,startHourTime,totalScore} = judgeUI;
const examType = isExam ? examSubject : 0;
const {fourInOneScreen:{gpsDigit}} = judgeConfig
const examType = examSubject == 2?2:3
const {sensor,gps} = tempData;
const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs} = 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 translateProject = getTranslateProject();
const sbxh = getSbxh(xmdm, xmxh)
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo;
// const asclshArr = stringToASC(lsh);
const asclshArr = stringToASC(fillZero('0000000000000' || 0, 13));
const asclshArr = stringToASC(fillZero(lsh || 0, 13));
//13不足要补0
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
const ascsbxhArr = stringToASC(sbxh)
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].concat(getDwStatusType(dw)).concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0])
)
//@ts-ignore
const translateJd = convertGpsCoord2(wd).toFixed(7) * Math.pow(10, 7);
const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit);
//@ts-ignore
const translateWd = convertGpsCoord2(jd).toFixed(7) * Math.pow(10, 7)
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,JSON.stringify(translateProject))
//@ts-ignore
// const translateProjects= translateProject.map(num => string2Bytes(p,8)[0])
const arr = [
//考生号 TODO 考试员
//考生
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
//考试员号
ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
@ -1013,13 +1009,13 @@ export default class Judge {
translateSignals,
//速度 发动机转速 GPS纬度 GPS经度 主天线位置
//@ts-ignore
string2Bytes(cs, 2 * 8), string2Bytes(fdjzs / 60, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
string2Bytes(Math.floor(gps.sd*1.852) , 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
//GPS东向距离
string2Bytes(dxjl < 0 ? (dxjl + 4294967296) : dxjl, 4 * 8),
//GPS北向距离
string2Bytes(bxjl < 0 ? (bxjl + 4294967296) : bxjl, 4 * 8),
//航向角 俯仰角 高程(海拔)
string2Bytes((hxj + 90) * 100, 2 * 8), string2Bytes(fyj * 100, 2 * 8), string2Bytes(hbg * 100, 4 * 8),
string2Bytes((hxj) * 100, 2 * 8), string2Bytes(fyj * 100, 2 * 8), string2Bytes(hbg * 100, 4 * 8),
//项目状态 parseInt('01010010',2) 二进制转成10进制
translateProjects,
//当前项目编号
@ -1036,7 +1032,6 @@ export default class Judge {
//扣分项数量
string2Bytes(kfArr.length, 8),
//n个扣分序号
kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0])
]
@ -1076,22 +1071,31 @@ export default class Judge {
}
// 中心所有项目转换
getTranslateProject = () => {
// const {testKmItems} = this;
const tempItems = testKmItems.map(item => {
const {examSubject} = this.judgeUI;
const tempItems = (examSubject == 2 ? testKm2Items:testKm3Items).map(item => {
const current = this.testKmItems[item.code];
return {
code: item.code,
status: getCenterProjectStatus(current.status)
}
})
const len = Math.floor(tempItems.length / 8);
// console.info(judgeTag+'TranslateProject',JSON.stringify(tempItems));
const arr = [];
for (let i = 0; i <= len; i++) {
const temp = tempItems.slice(i * 8, (i + 1) * 8);
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) {
tempArr = tempArr.concat(['00', '00'])
tempArr = examSubject == 2
//bit36-bit39保留
? tempArr.concat(['00', '00'])
//bit30-bit39保留
: 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));
@ -1226,7 +1230,7 @@ export default class Judge {
usbService.sendUSB(str)
}
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) + ''
await examJudgeRealExam(plcData)
const udpIndex = globalThis.udpIndex;
@ -1385,6 +1389,12 @@ export default class Judge {
qjjl: number,
// 累计倒车距离
dcjl: number
d1: number
d2: number
d3: number
d4: number
d5: number
d6: number
}
private kfArr: {
//项目名称

View File

@ -54,11 +54,11 @@ export default class FileModel{
const content = fileUtil.getFileContent(`${folderPath}/${fileName}`)
return content;
}catch (e){
console.info('surenjun',JSON.stringify(e))
promptAction.showToast({
message:"请检查模型路径是否正确!",
message:`请检查模型路径${folderPath}/${fileName}是否正确!`,
duration:4000
})
router.back()
}
}

View File

@ -38,11 +38,13 @@ export default class FilePhoto{
return ''
}else{
try {
console.info('surenjun','拍照开始')
const res = await takePhoto(params, this.context, 'pz/',2);
console.info('surenjun','拍照结束' + JSON.stringify(res))
return res.base64
} catch (e) {
promptAction.showToast({
message: JSON.stringify(e),
message: '拍照异常' + JSON.stringify(e),
duration: 2000
});
return ''

View File

@ -1,8 +1,9 @@
import {string2Bytes,Array2Byte,getCurrentTime} from '../../../common/utils/tools'
import {testMarkRules,testRealExam,testKmItems} from '../dataTest/index'
import {testMarkRules,testRealExam} from '../dataTest/index'
import promptAction from '@ohos.promptAction'
import systemTime from '@ohos.systemDateTime';
import { expect } from '@ohos/hypium';
//获取本地扣分项
export const getTestMarkRules = () =>{
@ -46,6 +47,21 @@ export function getCarStatusType(carzt){
case -1:return [1,0]
case 0: return [0,0]
case 1: return [0,1]
default :return [0,0]
}
}
// 获取档位信号
export function getDwStatusType(dw){
switch (dw){
case 0:return [0,0,0,0]
case 1: return [0,0,0,1]
case 2: return [0,0,1,0]
case 3: return [0,0,1,1]
case 4: return [0,1,0,0]
case 5: return [0,1,0,1]
case 9: return [1,0,0,1]
default :return [0,0,0,0]
}
}
@ -57,8 +73,12 @@ export function getCenterProjectStatus(status){
case 0:return '00'
//未考
case 1:return '01'
//正在考
case 2:return '11'
//已考
case 2:return '10'
case 3:return '10'
default :return '00'
}
}

View File

@ -4,7 +4,7 @@ export const judgeConfig = {
//本地目录开关
isTrajectoryOpen: false,
//是否开启拍照
isPhotoOpen: false,
isPhotoOpen: true,
//扣分语音是否强制开启
kfVoiceOpen: true,
// 是否忽略考试前熄火、车门检查
@ -14,7 +14,12 @@ export const judgeConfig = {
// 本地模型地址
modelPath: 'models/model_enc',
// 济南科目三
trajectoryPath: 'logs/2024_08_01/9999931199729_210601620482055232_蒲秀_2024_08_01_11_52_27/judge_exam_data.txt',
trajectoryPath: 'logs/2024_08_07/2024_08_07_11_35_39_0000000000001_342323199501470011_测试学员1/judge_exam_data.txt',
//四合一画面配置
fourInOneScreen:{
//gps位数
gpsDigit:6
},
// 杭州科目二
// trajectoryPath: 'logs/2024_07_19/0000000000001_342323199501470011_测试学员1_2024_07_19_06_49_12/judge_exam_data.txt',
//TODO 济南临时特殊配置