feat:科目三洛阳修改

This commit is contained in:
surenjun 2024-08-15 09:01:09 +08:00
parent 6d7e173080
commit fd5fd39fa3
12 changed files with 210 additions and 80 deletions

View File

@ -26,7 +26,6 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> {
if (singlePlay) { if (singlePlay) {
return {code:1} return {code:1}
} }
//获取监管接口地址路径 //获取监管接口地址路径
if (!globalThis.JGPATH) { if (!globalThis.JGPATH) {
const syssetParams = await getSyncData('MA_SYSSET') || []; const syssetParams = await getSyncData('MA_SYSSET') || [];
@ -47,7 +46,11 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> {
return await writeObjectOutNew(params,filePath) return await writeObjectOutNew(params,filePath)
} }
drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent( drvexam.zp) drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent( drvexam.zp)
const drvexamArrs = Reflect.ownKeys(drvexam).map((key: string) => (`<${key}>${drvexam[key]}</${key}>`));
const drvexamArrs = Reflect.ownKeys(drvexam)
.filter(dKey => drvexam[dKey] != undefined)
.map((key: string) => (
`<${key}>${drvexam[key]}</${key}>`));
if(filePath){ if(filePath){
const fileUtil = new FileUtil(globalThis.context); const fileUtil = new FileUtil(globalThis.context);

View File

@ -289,27 +289,27 @@ export async function setJudgeUdp() {
let udpIndex = 0; let udpIndex = 0;
let currentUdpIndex = 0; let currentUdpIndex = 0;
let judgeUdpTimer let judgeUdpTimer
clearInterval(judgeUdpTimer) clearInterval(globalThis.judgeUdpTimer)
judgeUdpTimer = setInterval(() => { globalThis.judgeUdpTimer = setInterval(() => {
udpIndex += 1; udpIndex += 1;
}, 1000); }, 1000);
if (config && config.udplocalIp) { if (config && config.udplocalIp) {
const {udplocalIp} = config; const {udplocalIp} = config;
const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort) const udpClientbyCenter: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', globalThis.carInfo?.gpsAddress, globalThis.carInfo?.hintPort)
await udpClientbyCenter.onError_Callback(()=>{})
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_2((val) => { await udpClientbyCenter.onMessage_2((val) => {})
console.log('valval', val)
})
// globalThis.judgeUdpClient = udpClientbyCenter; // globalThis.judgeUdpClient = udpClientbyCenter;
return { return {
send(bytes) { send(bytes) {
if (udpIndex > currentUdpIndex) { if (udpIndex > currentUdpIndex) {
udpClientbyCenter.sendMsgExt({ id: 45, udpClientbyCenter.sendMsgExt({
id: 45,
list: bytes, list: bytes,
carNo: globalThis.carInfo.carNo, carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId }) placeId: globalThis.carInfo.examinationRoomId
})
currentUdpIndex = udpIndex currentUdpIndex = udpIndex
} }
} }

View File

@ -22,6 +22,7 @@ import { fillZero, string2Bytes } from '../utils/tools'
const TAG = '[UdpDemo.UdpClient]' const TAG = '[UdpDemo.UdpClient]'
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import promptAction from '@ohos.promptAction';
export default class UdpClientByCenter { export default class UdpClientByCenter {
@ -59,7 +60,9 @@ export default class UdpClientByCenter {
return this.isWorking return this.isWorking
} }
rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string) { rebindUdp(localIp: string, localIpPort: string, oppositeIp: string, oppositeIpPort: string)
{
console.log(`${TAG}getUDPudpCLient rebindUdp enter localIp:${localIp},localIpPort:${localIpPort},oppositeIp:${oppositeIp},oppositeIpPort:${oppositeIpPort}`);
this.localIp = localIp this.localIp = localIp
this.oppositeIp = oppositeIp this.oppositeIp = oppositeIp
this.localIpPort = localIpPort this.localIpPort = localIpPort
@ -141,9 +144,7 @@ export default class UdpClientByCenter {
setMsgBody({id,list}) { setMsgBody({id,list}) {
let tmpList = [] let tmpList = []
tmpList = list tmpList = list
return tmpList; return tmpList;
} }
sendHeadMsg(msgData) { sendHeadMsg(msgData) {
@ -175,6 +176,10 @@ export default class UdpClientByCenter {
console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
}).catch(err => { }).catch(err => {
console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
promptAction.showToast({
message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
duration:4000
})
}); });
} }
console.log('getUDPgetState success:' + JSON.stringify(data)); console.log('getUDPgetState success:' + JSON.stringify(data));

View File

@ -39,8 +39,8 @@ 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(globalThis.lsh || 0, 13)); const asclshArr = stringToASC(fillZero('0000000000000', 13));
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascksyhArr = stringToASC(fillZero('0000000000000', 13))
const ascsbxhArr = stringToASC('00000000') const ascsbxhArr = stringToASC('00000000')
// const ascsbxhArr = stringToASC('153216400880') // const ascsbxhArr = stringToASC('153216400880')
const serialIndex = globalThis.serialIndex const serialIndex = globalThis.serialIndex
@ -93,7 +93,19 @@ export const getMessageHeartbeat = async (msg) => {
//扣分项数量 //扣分项数量
string2Bytes(0, 8), string2Bytes(0, 8),
//n个扣分序号 //n个扣分序号
[].map(kf => string2Bytes(kf.markcatalog, 8)) [].map(kf => string2Bytes(kf.markcatalog, 8)),
//牵引车第二gps精度、纬度
string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8),
//牵引车第二航向角
string2Bytes(0, 2 * 8),
//摩托压线 Byte[20],
string2Bytes(0, 20 * 8),
//考试用时
string2Bytes(fillZero(0+'',4), 4 * 8),
//项目用时
string2Bytes(fillZero(0,2), 2 * 8),
//设备信号状态
string2Bytes(0, 4 * 8),
] ]
let tempArr = []; let tempArr = [];
arr.forEach(itemArr => { arr.forEach(itemArr => {

View File

@ -118,7 +118,7 @@ struct Index {
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo; const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo;
this.name = xm || '测试考生'; this.name = xm || '测试考生';
this.idCard = sfzmhm || '01234567891010'; this.idCard = sfzmhm || '01234567891010';
this.lsh = lsh; this.lsh = globalThis.singlePlay?'0000000000000':lsh;
this.kszp = kszp; this.kszp = kszp;
this.ksdd = ksdd; this.ksdd = ksdd;
this.kssycs = kssycs; this.kssycs = kssycs;

View File

@ -6,6 +6,7 @@ import { upDateTableByArray} from '../common/service/initable'
import { getSyncData} from '../common/service/initable' import { getSyncData} from '../common/service/initable'
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { GlobalConfig } from '../config';
@Entry @Entry
@ -83,7 +84,7 @@ struct Index {
const fileUtil = new FileUtil(this.context) const fileUtil = new FileUtil(this.context)
const folderPath = await fileUtil.initFolder(`/config`); const folderPath = await fileUtil.initFolder(`/config`);
const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]} const param={udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}
fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param)) fileUtil.addFile(`${folderPath}/ipConfig.txt`, JSON.stringify(param),'')
// upDateTableByArray('IpConfigTable',[]) // upDateTableByArray('IpConfigTable',[])
ethernet.setIfaceConfig("eth0", { ethernet.setIfaceConfig("eth0", {
mode: 0, mode: 0,
@ -131,27 +132,31 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
} }
aboutToAppear() { async aboutToAppear() {
getSyncData('IpConfigTable').then((result:Array<any>)=>{ const fileUtil = new FileUtil(this.context)
console.log('result222',JSON.stringify(result)) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
if(result.length){ console.log('datadata',data)
if (data === '' || data === undefined) {
}else{
const result=JSON.parse(data)
console.log('tagtag',JSON.stringify(result)) console.log('tagtag',JSON.stringify(result))
this.inputTextList1[9]=result[0].udplocalIp this.inputTextList1[9]=result.udplocalIp
this.inputTextList1[10]=result[0].udplocalIpPort this.inputTextList1[10]=result.udplocalIpPort
this.inputTextList1[7]=result[0].udpOppositeIp this.inputTextList1[7]=result.udpOppositeIp
this.inputTextList1[8]=result[0].udpOppositeIpPort this.inputTextList1[8]=result.udpOppositeIpPort
// this.inputTextList1[0]=result[0].tcplocalIp // this.inputTextList1[0]=result[0].tcplocalIp
// this.inputTextList1[13]=result[0].tcplocalIpPort // this.inputTextList1[13]=result[0].tcplocalIpPort
this.inputTextList1[0]=result[0].tcpOppositeIp this.inputTextList1[0]=result.tcpOppositeIp
this.inputTextList1[1]=result[0].tcpOppositePort this.inputTextList1[1]=result.tcpOppositePort
this.inputTextList1[5]=result[0].gateway this.inputTextList1[5]=result.gateway
this.inputTextList1[4]=result[0].netMask this.inputTextList1[4]=result.netMask
this.inputTextList1[6]=result[0].dnsServers this.inputTextList1[6]=result.dnsServers
this.inputTextList1[2]=result[0].centerIp this.inputTextList1[2]=result.centerIp
this.inputTextList1[3]=result[0].centerPort this.inputTextList1[3]=result.centerPort
} }
})
ethernet.getIfaceConfig("eth0", (error, value) => { ethernet.getIfaceConfig("eth0", (error, value) => {
if (error) { if (error) {
// that.errorMsg='error' // that.errorMsg='error'

View File

@ -163,7 +163,6 @@ struct UserInfo {
return return
} }
this.showFaceCompare = true
this.pageIndex = Math.floor(index / 4) this.pageIndex = Math.floor(index / 4)
} }
}) })
@ -238,7 +237,7 @@ struct UserInfo {
this.stepFlag = false this.stepFlag = false
this.faceCompareSucess = 0 this.faceCompareSucess = 0
this.showFaceCompare = false this.showFaceCompare = false
this.lsh = '0000000000000' this.lsh = '000000000000'
this.callBackFlag = false this.callBackFlag = false
globalThis.lsh = this.lsh globalThis.lsh = this.lsh
// this.currentUser = EmptyCandidateObject // this.currentUser = EmptyCandidateObject
@ -314,16 +313,22 @@ struct UserInfo {
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452')
that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17')
const openCheckFlag =openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0'
const faceParam = syssetParams.filter(sys => sys.v_no == '2413') const faceParam = syssetParams.filter(sys => sys.v_no == '2413')
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
that.FaceOpenStatue = '0' // that.FaceOpenStatue = '0'
console.log('that.FaceOpenStatue', that.FaceOpenStatue)
// faceParam?.[0]?.v_value || // faceParam?.[0]?.v_value ||
// 1身份证读卡器 2指纹 3人脸 // 1身份证读卡器 2指纹 3人脸
if(openCheckFlag=='1'){
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
this.faceFlag = faceParam?.[0]?.v_value || '0' this.faceFlag = faceParam?.[0]?.v_value || '0'
if (faceParam?.[0]?.v_value == '1') { if (faceParam?.[0]?.v_value == '1') {
that.openDeviceByIDCard() that.openDeviceByIDCard()
} }
}
//0不自动更新 1自动更新不限次数 2没有考生更新2次 //0不自动更新 1自动更新不限次数 2没有考生更新2次
if (that.studentRefreshStatue == '2') { if (that.studentRefreshStatue == '2') {
clearInterval(that.interval) clearInterval(that.interval)
@ -371,13 +376,6 @@ struct UserInfo {
} }
this.pageIndex--; this.pageIndex--;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
this.dataList.forEach(listData => {
for (let i in listData) {
listData[i] = decodeURI(listData[i])
}
listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp
})
} }
//获取下载考生 //获取下载考生
@ -386,7 +384,7 @@ struct UserInfo {
return return
} }
const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>` const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>`
getExaminationStudentInfo(param).then(async res => { getExaminationStudentInfo(param).then(async(res) => {
setTimeout(() => { setTimeout(() => {
this.updateTimeLimit = true this.updateTimeLimit = true
}, 30000) }, 30000)
@ -413,7 +411,15 @@ struct UserInfo {
} }
this.list = JSON.parse(JSON.stringify(dataList)) this.list = JSON.parse(JSON.stringify(dataList))
this.list.forEach(listData => {
for (let i in listData) {
listData[i] = decodeURI(listData[i])
}
listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp
})
dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list;
this.dataList = dataList this.dataList = dataList
if (this.dataList.length) { if (this.dataList.length) {
this.currentUser = this.dataList[0] this.currentUser = this.dataList[0]

View File

@ -94,8 +94,13 @@ export default struct RealTime {
.backgroundColor('#fff') .backgroundColor('#fff')
Row(){ Row(){
Image($rawfile('judge/big.png')).width(60).onClick(()=>{this.scaleFn(-10)}) Image($rawfile('judge/big.png')).width(60).onClick(()=>{
Image($rawfile('judge/small.png')).width(60).onClick(()=>{this.scaleFn(10)}).margin({left:20}) this.scaleFn( -this.getScaleNum() )
console.info('surenjun getScaleNum',-this.getScaleNum())
})
Image($rawfile('judge/small.png')).width(60).onClick(()=>{
this.scaleFn( this.getScaleNum() )
}).margin({left:20})
}.position({x:'32%',y:60}) }.position({x:'32%',y:60})
} }
.height('100%') .height('100%')
@ -112,6 +117,37 @@ export default struct RealTime {
this.timer = timer this.timer = timer
} }
getScaleNum = ()=>{
const scaleNum = this.scaleNum;
if(scaleNum < 200){
return 10
}
if(scaleNum >= 200 && scaleNum < 400){
return 30
}
if(scaleNum >= 400 && scaleNum < 600){
return 50
}
if(scaleNum >= 600 && scaleNum < 800){
return 70
}
if(scaleNum >= 800 && scaleNum < 1000){
return 100
}
if(scaleNum >= 1000 && scaleNum < 2000){
return 500
}
if(scaleNum >= 2000 && scaleNum <= 5000){
return 1000
}
return 1000
}
getValues(roadColumn) { getValues(roadColumn) {
const lane = this.lane || {}; const lane = this.lane || {};
let key = roadColumn.key; let key = roadColumn.key;
@ -148,17 +184,18 @@ export default struct RealTime {
scaleFn = async (num)=>{ scaleFn = async (num)=>{
const scaleNum = this.scaleNum const scaleNum = this.scaleNum
if(scaleNum >0 && scaleNum < 200){ console.info('surenjun getScaleNum',scaleNum)
if(scaleNum >0 && scaleNum < 5000){
this.scaleNum += num; this.scaleNum += num;
} }
if(scaleNum === 0 && num > 0){ if(scaleNum === 0 && num > 0){
this.scaleNum += num; this.scaleNum += num;
} }
if(scaleNum === 200 && num < 0){ if(scaleNum > 5000 && num < 0){
this.scaleNum += num; this.scaleNum += num;
} }
await examJudgeMapSetScaling(this.scaleNum); await examJudgeMapSetScaling(this.scaleNum);
}
}
} }

View File

@ -603,6 +603,7 @@ export default class Judge {
kssj: time kssj: time
} }
} }
console.info(judgeTag +'filePath' , filePath)
const {code} = await writeObjectOut(data,filePath) const {code} = await writeObjectOut(data,filePath)
console.info(judgeTag, '项目开始 end') console.info(judgeTag, '项目开始 end')
if (code === 2300007) { if (code === 2300007) {
@ -774,25 +775,36 @@ export default class Judge {
this.isExamEnd = true this.isExamEnd = true
} }
} else { } else {
const param302 = judgeConfigObj['302'];
const param342 = judgeConfigObj['342'];
const param512 = (judgeConfigObj['512'] || '').split(',');
//成绩不合格 //成绩不合格
if (totalScore < passingGrade) { if (totalScore < passingGrade) {
//科目三不合格报靠边停车
if(examSubject == 3 && param302 ==1){
avPlayer.playAudio([`voice/考试结束.mp3`]);
return
}
await examJudgeEndExam() await examJudgeEndExam()
this.isExamEnd = true this.isExamEnd = true
return return
} }
//成绩合格 //成绩合格
if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) { if (isAllProjectsEnd && totalScore >= passingGrade && isEndTip) {
const param302 = judgeConfigObj['302']; //考试合格自动退出
const param342 = judgeConfigObj['342']; if(examSubject == 3 && param302 == 4){
const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); await examJudgeEndExam()
if (examSubject == 3 && param342 != 0 && (param302 != 6 || param302 != 7 || param302 != 8)) { this.isExamEnd = true
return
}
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'])
this.judgeUI.isDeductedPopShow = true this.judgeUI.isDeductedPopShow = true
this.judgeUI.defaultTabIndex = 1 this.judgeUI.defaultTabIndex = 1
this.isEndTip = true this.isEndTip = true
} }
} else { } else {
await examJudgeEndExam() await examJudgeEndExam()
this.isExamEnd = true this.isExamEnd = true
@ -980,6 +992,7 @@ 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,
@ -994,19 +1007,32 @@ export default class Judge {
getTranslateProject, getTranslateProject,
getSbxh getSbxh
} = this; } = this;
const {lsh,startHourTime,totalScore} = judgeUI; console.info(judgeTag,2)
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){
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)
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo; console.info(judgeTag,JSON.stringify(performInfo))
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {};
const asclshArr = stringToASC(fillZero(lsh || 0, 13)); const asclshArr = stringToASC(fillZero(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])
) )
@ -1016,9 +1042,13 @@ 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)) // console.info(judgeTag,JSON.stringify(translateProject))
//@ts-ignore //@ts-ignore
// const translateProjects= translateProject.map(num => string2Bytes(p,8)[0]) // const translateProjects= translateProject.map(num => string2Bytes(p,8)[0])
console.info('surenjunxstartHourTime' , startHourTime)
console.info('surenjunxmmcexamTime' , examTime)
const arr = [ const arr = [
//考生号 //考生号
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
@ -1032,7 +1062,7 @@ export default class Judge {
translateSignals, translateSignals,
//速度 发动机转速 GPS纬度 GPS经度 主天线位置 //速度 发动机转速 GPS纬度 GPS经度 主天线位置
//@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(cs * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8),
//GPS东向距离 //GPS东向距离
string2Bytes(dxjl < 0 ? (dxjl + 4294967296) : dxjl, 4 * 8), string2Bytes(dxjl < 0 ? (dxjl + 4294967296) : dxjl, 4 * 8),
//GPS北向距离 //GPS北向距离
@ -1055,7 +1085,19 @@ export default class Judge {
//扣分项数量 //扣分项数量
string2Bytes(kfArr.length, 8), string2Bytes(kfArr.length, 8),
//n个扣分序号 //n个扣分序号
kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0]) kfArr.map(kf => string2Bytes(kf.kfxh, 8)[0]),
//TODO 牵引车第二gps精度、纬度
string2Bytes(0, 4 * 8), string2Bytes(0, 4 * 8),
//TODO 牵引车第二航向角
string2Bytes(0, 2 * 8),
//TODO 摩托压线 Byte[20],
string2Bytes(0, 20 * 8),
//TODO 考试用时
string2Bytes(fillZero(examTime+'',4), 4 * 8),
//TODO 项目用时
string2Bytes(fillZero(0,2), 2 * 8),
//TODO 设备信号状态
string2Bytes(0, 4 * 8),
] ]
let tempArr = []; let tempArr = [];
@ -1063,20 +1105,31 @@ 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]
if (project === undefined) { console.info(judgeTag,12)
return '00000000' if(project == 3){
return '0000000000'
} }
if (project === undefined) {
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] || {};
const sbxh = currentCdsb.sbbh || '00000000' console.info(judgeTag,15)
const sbxh = currentCdsb.sbbh || '0000000000'
return sbxh return sbxh
} }
@ -1125,7 +1178,9 @@ export default class Judge {
arr.push(tempArr.join('')); arr.push(tempArr.join(''));
} }
return arr.map(numStr => parseInt(numStr, 2)); console.info(judgeTag,JSON.stringify(arr))
// return arr.map(numStr => parseInt(numStr, 2));
return arr
} }
// 获取考试项目详情 // 获取考试项目详情
getProjectInfo = (projectCode) => { getProjectInfo = (projectCode) => {
@ -1264,6 +1319,7 @@ export default class Judge {
if (udpIndex % 5 === 0) { if (udpIndex % 5 === 0) {
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))
judgeUdp.send(bytes) judgeUdp.send(bytes)
} }
globalThis.udpIndex += 1 globalThis.udpIndex += 1
@ -1339,8 +1395,11 @@ export default class Judge {
setJudgeItem(msg.itemno, msg.serial) setJudgeItem(msg.itemno, msg.serial)
} }
await examJudgeRealExam(msg) await examJudgeRealExam(msg)
// const bytes = await this.getMessageHeartbeat();
// bytes && globalThis.judgeUdp.send(bytes)
num++ num++
}, 50) }, 200)
globalThis.judgeTimer = judgeTimer; globalThis.judgeTimer = judgeTimer;
} }
// 统计必考项目、所有项目、已考数量 // 统计必考项目、所有项目、已考数量

View File

@ -36,6 +36,7 @@ export default class FileLog {
const hourTime = time.split(' ')[1].split(':').join('_') const hourTime = time.split(' ')[1].split(':').join('_')
const folderPath = await fileUtil.initFolder(`/logs/${date}/${date}_${hourTime}_${lsh}_${idCard}_${name}`); const folderPath = await fileUtil.initFolder(`/logs/${date}/${date}_${hourTime}_${lsh}_${idCard}_${name}`);
this.folderPath = folderPath; this.folderPath = folderPath;
return folderPath
} }
// 过程文件数据 // 过程文件数据

View File

@ -74,9 +74,9 @@ export function getCenterProjectStatus(status){
//未考 //未考
case 1:return '01' case 1:return '01'
//正在考 //正在考
case 2:return '11' case 2:return '10'
//已考 //已考
case 3:return '10' case 3:return '11'
default :return '00' default :return '00'
} }
@ -111,7 +111,9 @@ export function getKmProjectVoice(
//右转 //右转
case 40900 : return type === 1 ? 409001 : undefined case 40900 : return type === 1 ? 409001 : undefined
//会车 506-6为1都报 //会车 506-6为1都报
case 41300 : return type === 1 ? 413001: (param506Str[5]===1?413002:undefined) case 41300 : return type === 1
? 413001
: (param506Str[5] == 1 ? undefined : 413002)
//超车 //超车
case 41400 : return type === 1 case 41400 : return type === 1
? (param405Str == 1 && (num == count)?undefined:414001) ? (param405Str == 1 && (num == count)?undefined:414001)

View File

@ -2,21 +2,21 @@
//考试回放开关 //考试回放开关
export const judgeConfig = { export const judgeConfig = {
//本地目录开关 //本地目录开关
isTrajectoryOpen: false, isTrajectoryOpen: true,
//是否开启拍照 //是否开启拍照
isPhotoOpen: true, isPhotoOpen: false,
//扣分语音是否强制开启 //扣分语音是否强制开启
kfVoiceOpen: true, kfVoiceOpen: false,
//忽略的考试项目 //忽略的考试项目
ignoreProjects:[41], ignoreProjects:[],
// 是否忽略考试前熄火、车门检查 // 是否忽略考试前熄火、车门检查
isCheckFireOpen: true, isCheckFireOpen: true,
//是否开启Udp //轨迹回放是否开启Udp
udpOpen:false, udpOpen:true,
// 本地模型地址 // 本地模型地址
modelPath: 'models/model_enc', modelPath: 'models/model_enc',
// 济南科目三 // 济南科目三
trajectoryPath: 'logs/2024_08_10/2024_08_10_14_24_20_0000000000001_342323199501470011_测试学员1/judge_exam_data.txt', trajectoryPath: 'logs/2024_08_14/2024_08_14_11_30_20_9999805761528_344094918358022656_葛李弯/judge_exam_data.txt',
//四合一画面配置 //四合一画面配置
fourInOneScreen:{ fourInOneScreen:{
//gps位数 //gps位数