dev #63

Merged
wangzhongjie merged 206 commits from dev into main 2024-12-16 10:31:20 +08:00
608 changed files with 285 additions and 118 deletions
Showing only changes of commit d842eeb7bd - Show all commits

View File

@ -4,6 +4,7 @@ import { getSyncData } from '../service/initable'
import { getChuankouFn } from '../../common/service/indexService' import { getChuankouFn } from '../../common/service/indexService'
import FileUtil from '../../common/utils/File' import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index' import { GlobalConfig } from '../../config/index'
import {Array2Byte,fillZero,string2Bytes}from './tools'
import emitter from '@ohos.events.emitter'; import emitter from '@ohos.events.emitter';
export async function sendMsg(val) { export async function sendMsg(val) {
@ -167,6 +168,7 @@ export async function getUDP2(context,errorFlag?) {
// 未绑定 // 未绑定
console.log(` getUDP2 has no udclent and bind `); console.log(` getUDP2 has no udclent and bind `);
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) const udpClient2: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
console.info('surenjun udp2=> ', globalThis.carInfo?.messagePort)
await udpClient2.bindUdp() await udpClient2.bindUdp()
await udpClient2.onError_Callback(()=>{ await udpClient2.onError_Callback(()=>{
getUDP2(context,true); getUDP2(context,true);
@ -180,17 +182,21 @@ export async function getUDP2(context,errorFlag?) {
if (val.id == '32') { if (val.id == '32') {
globalThis.signNum = val.body[1] globalThis.signNum = val.body[1]
if(val.body[0] == 5){ if(val.body[0] == 5){
console.info('surenjun', `接收到平台扣分请求,请求指令为:${val.body[1]}`)
globalThis.udpEvent.sendOnKf(val.body[1])
} }
if(val.body[0] == 11){ if(val.body[0] == 11){
console.info('surenjun','GlobalUdp收到beginExam事件') console.info('surenjun','GlobalUdp收到beginExam事件')
globalThis.udpEvent.sendBeginExam() globalThis.udpEvent.sendBeginExam(val.body[1])
} }
if(val.body[0] == 12){ if(val.body[0] == 12){
console.info('surenjun','GlobalUdp收到endExam事件') console.info('surenjun','GlobalUdp收到endExam事件')
globalThis.udpEvent.sendEndExam() globalThis.udpEvent.sendEndExam(val.body[1])
} }
}if (val.id == '36'){
//获取远程扣分内容
console.info('surenjun','考车收到远程扣分项目内容,扣分代码:' + val.body[0])
globalThis.udpEvent.sendKfContent(val.body[0])
} else if (val.id == '46') { } else if (val.id == '46') {
let tmpList = [] let tmpList = []
const str = globalThis.lsh const str = globalThis.lsh
@ -315,6 +321,7 @@ export async function setJudgeUdp() {
globalThis.carInfo?.udpAddress, globalThis.carInfo?.udpAddress,
globalThis.carInfo?.hintPort globalThis.carInfo?.hintPort
) )
console.info('surenjun hintPort=> ',globalThis.carInfo?.hintPort)
await udpClientbyCenter.onError_Callback(()=>{}) await udpClientbyCenter.onError_Callback(()=>{})
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
@ -336,16 +343,29 @@ export async function setJudgeUdp() {
} }
}, },
//远程查询扣分项 //申请远程扣分查询
//远程确认扣分 askKf(directives){
confirmKF(){ globalThis.udpClient2.sendMsgExt({
id: 35,
list: [directives],
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId,
})
console.info('surenjun', `考车查询扣分项目内容,请求指令为:${directives}`)
},
//确定远程扣分
confirmKf(directives,code){
globalThis.udpClient2.sendMsgExt({
id: 37,
list: Array2Byte([string2Bytes(directives,8),string2Bytes(code,8)]),
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId
})
console.info('surenjun', `考车发送确定扣分指令,指令为:${directives}`)
}, },
//远程开始考试
//远程结束考试
} }
} }
} }
// globalThis.udpClient.bindUdp() // globalThis.udpClient.bindUdp()

View File

@ -13,6 +13,7 @@ export default class TcpClient {
private oppositeIp: string = '' private oppositeIp: string = ''
private oppositeIpPort: string = '' private oppositeIpPort: string = ''
private num: number = 0//重连次数 private num: number = 0//重连次数
private folderPath
private tcp: any = null private tcp: any = null
@ -23,6 +24,7 @@ export default class TcpClient {
this.oppositeIpPort = tcpOppositePort this.oppositeIpPort = tcpOppositePort
console.log(TAG, 'new Tcp', this.localIp, this.localIpPort, this.oppositeIp, this.oppositeIpPort) console.log(TAG, 'new Tcp', this.localIp, this.localIpPort, this.oppositeIp, this.oppositeIpPort)
this.tcp = socket.constructTCPSocketInstance(); this.tcp = socket.constructTCPSocketInstance();
this.initPath()
} }
onError(callback?) { onError(callback?) {
@ -31,6 +33,10 @@ export default class TcpClient {
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// PLC:`${TAG} tcpOnerror ${JSON.stringify(err)}`, // PLC:`${TAG} tcpOnerror ${JSON.stringify(err)}`,
// }) // })
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcponerror localIp${JSON.stringify(err)}`,
})
console.log(TAG, 'tcpOnerror', JSON.stringify(err)) console.log(TAG, 'tcpOnerror', JSON.stringify(err))
setTimeout(async () => { setTimeout(async () => {
getTCP() getTCP()
@ -52,10 +58,18 @@ export default class TcpClient {
address: this.localIp, port: parseInt(this.localIpPort), family: 1 address: this.localIp, port: parseInt(this.localIpPort), family: 1
}, err => { }, err => {
if (err) { if (err) {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcprebind tcpreBinderror${JSON.stringify(err)}`,
})
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
hilog.info(0x0000, 'testTag', "tcpreBinderror:" + JSON.stringify(err)); hilog.info(0x0000, 'testTag', "tcpreBinderror:" + JSON.stringify(err));
resolve(true) resolve(true)
} }
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcprebind success`,
})
console.log('testTag,rebindtestTag tcp bind success'); console.log('testTag,rebindtestTag tcp bind success');
globalThis.getCloseTcp = false globalThis.getCloseTcp = false
resolve(false) resolve(false)
@ -72,6 +86,10 @@ export default class TcpClient {
} }
bindTcp() { bindTcp() {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcpbind localIp${this.localIp} ${this.localIpPort}`,
})
console.log(TAG, 'tcpbind', this.localIp, 'localIp', this.localIpPort) console.log(TAG, 'tcpbind', this.localIp, 'localIp', this.localIpPort)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let promise = this.tcp.bind({ let promise = this.tcp.bind({
@ -82,6 +100,10 @@ export default class TcpClient {
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// PLC:`${TAG} testTag tcp bind faile ${JSON.stringify(err)}`, // PLC:`${TAG} testTag tcp bind faile ${JSON.stringify(err)}`,
// }) // })
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcpbind error ${JSON.stringify(err)}`,
})
console.log('testTag tcp bind faile'); console.log('testTag tcp bind faile');
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err)); hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
@ -109,6 +131,10 @@ export default class TcpClient {
} }
connectTcp() { connectTcp() {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcpConnect oppositeIp ${ this.oppositeIp} ${this.oppositeIpPort}`,
})
console.log(TAG, 'tcpConnect', this.oppositeIp, 'localIp', this.oppositeIpPort) console.log(TAG, 'tcpConnect', this.oppositeIp, 'localIp', this.oppositeIpPort)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let promise = this.tcp.connect({ let promise = this.tcp.connect({
@ -122,6 +148,10 @@ export default class TcpClient {
keepAlive: true, keepAlive: true,
}, err => { }, err => {
if (err) { if (err) {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} TCPconnect error ${JSON.stringify(err)}`,
})
// this.writeLog({ // this.writeLog({
// time:dateFormat(new Date()), // time:dateFormat(new Date()),
// PLC:`${TAG} tcp connect rebind success`, // PLC:`${TAG} tcp connect rebind success`,
@ -130,17 +160,26 @@ export default class TcpClient {
return return
} }
setTimeout(() => { setTimeout(() => {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcp重连`,
})
getTCP() getTCP()
resolve(false) resolve(false)
}, 2000) }, 2000)
return; return;
} }
}); });
console.log('testTagtestTag000,success') console.log('socketTag','success')
globalThis.getCloseTcp = false globalThis.getCloseTcp = false
resolve(true) resolve(true)
}).catch(err => { }).catch(err => {
console.log('socketTag','error')
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} TCPconnect error2 ${JSON.stringify(err)}`,
})
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
this.num++ this.num++
if(this.num>3){ if(this.num>3){
@ -167,6 +206,10 @@ export default class TcpClient {
promise.then(() => { promise.then(() => {
reslove(true) reslove(true)
}).catch(err => { }).catch(err => {
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} TCPsend error ${JSON.stringify(err)}`,
})
reslove(false) reslove(false)
}); });
}) })
@ -180,7 +223,10 @@ export default class TcpClient {
// }) // })
console.log(TAG, 'Tcponmessage', value) console.log(TAG, 'Tcponmessage', value)
globalThis.tcpUdpError = false globalThis.tcpUdpError = false
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} Tcponmessage ,${value}`,
})
// console.log('messageLengt',,value.message.length)) // console.log('messageLengt',,value.message.length))
console.log('testTagtcpmsg') console.log('testTagtcpmsg')
// console.log("on message, message:" + value.message+ ", remoteInfo:" ) // console.log("on message, message:" + value.message+ ", remoteInfo:" )
@ -195,27 +241,32 @@ export default class TcpClient {
} }
clearInterval(globalThis.intervaltcp) clearInterval(globalThis.intervaltcp)
globalThis.intervaltcp=setInterval(()=>{ globalThis.intervaltcp=setInterval(()=>{
//程序断开 //程序断开
if (globalThis.tcpUdpError) { if (globalThis.tcpUdpError) {
console.log(TAG,'tcp信号丢失') console.log(TAG,'tcp信号丢失')
getTCP() getTCP()
prompt.showToast({ prompt.showToast({
message: 'tcp信号丢失', message: 'tcp信号丢失',
duration: 2000 duration: 2000
}); });
} }
globalThis.tcpUdpError = true; this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcp信号丢失`,
})
globalThis.tcpUdpError = true;
},3000) },3000)
// callback(value.message) // callback(value.message)
}); });
} }
async writeLog(param){ async writeLog(param){
// return const fileUtil = new FileUtil(globalThis.context)
// const fileUtil = new FileUtil(globalThis.context) fileUtil.editFile(`${this.folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
// const date=dateFormat(new Date).split(' ')[0] }
// const folderPath = await fileUtil.initFolder(`/PLC/${date}`); async initPath(){
// fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) const fileUtil = new FileUtil(globalThis.context)
const date=dateFormat(new Date).split(' ')[0]
this.folderPath = await fileUtil.initFolder(`/PLC/${date}`);
} }
offTcp(callback) { offTcp(callback) {
console.log(TAG, 'tcpofff') console.log(TAG, 'tcpofff')
@ -225,17 +276,24 @@ export default class TcpClient {
} }
closeTcp(callback) { closeTcp(callback) {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
console.log(TAG, 'tcpClose') console.log(TAG, 'tcpClose')
let promise = this.tcp.close(); let promise = this.tcp.close();
promise.then(() => { promise.then(() => {
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcp closeSuccess`,
})
console.log(TAG, 'tcpCloseSuccess') console.log(TAG, 'tcpCloseSuccess')
callback() callback()
reslove(true) reslove(true)
}).catch(err => { }).catch(err => {
console.log(TAG, 'tcpClosefailed') this.writeLog({
time:dateFormat(new Date()),
message: `${TAG} tcpclose error ${JSON.stringify(err)}`,
})
reslove(false) reslove(false)
}); });
}) })

View File

@ -2,72 +2,129 @@ import emitter from '@ohos.events.emitter';
export const EVENTID = { export const EVENTID = {
//远程扣分处理 //远程扣分处理
kfEventId:35, kfEventId: 35,
//远程扣分查询 //远程扣分查询
kfAskEventId:36, kfAskEventId: 36,
//远程扣分确认 //远程扣分确认
kfConfirmEventId:37, kfConfirmEventId: 37,
//远程开始考试 //远程开始考试
beginExamEventId:11, beginExamEventId: 11,
//远程结束考试 //远程结束考试
endExamEventId:12 endExamEventId: 12
} }
export default class JudgeEmitter{ export default class JudgeEmitter {
private beginExamCallBack: Function = () => {}
private endExamCallBack: Function = () => {}
private confirmExamCallBack: Function = () => {}
private kfContent: Function = () => {}
private beginExamCallBack:Function = ()=>{} private directives: string
private endExamCallBack:Function = ()=>{}
constructor() { constructor() {
this.init() this.init()
} }
init = async ()=>{ init = async () => {
console.info('surenjun','开始注册udp事件') console.info('surenjun', '开始注册udp事件')
emitter.on({eventId:EVENTID.beginExamEventId}, () => { emitter.off(EVENTID.beginExamEventId)
emitter.off(EVENTID.endExamEventId)
emitter.off(EVENTID.kfConfirmEventId)
emitter.off(EVENTID.kfEventId)
emitter.on({
eventId: EVENTID.beginExamEventId
}, () => {
this?.beginExamCallBack() this?.beginExamCallBack()
}); });
emitter.on({eventId:EVENTID.endExamEventId}, () => {
emitter.on({
eventId: EVENTID.endExamEventId
}, () => {
this?.endExamCallBack() this?.endExamCallBack()
}); });
emitter.on({eventId:EVENTID.kfEventId}, () => {
this?.endExamCallBack() emitter.on({
eventId: EVENTID.kfEventId
}, (data) => {
console.info('surenjun EVENTID.kfEvent' + JSON.stringify(data))
this?.kfContent(data)
}); });
} }
//监听开始考试 //监听开始考试
public onBeginExam = async (callBack?:Function)=>{ public onBeginExam = async (callBack?: Function) => {
console.info('surenjun','userInfo注册onBeginExam事件') console.info('surenjun', '注册远程开始考试事件')
this.beginExamCallBack = callBack this.beginExamCallBack = callBack
} }
//监听结束考试 //监听结束考试
public onEndExam = async (callBack?:Function)=>{ public onEndExam = async (callBack?: Function) => {
console.info('surenjun', '注册远程结束考试事件')
this.endExamCallBack = callBack this.endExamCallBack = callBack
} }
//监听扣分处理 //监听扣分处理
public onKfExam= async (callBack?:Function)=>{ public onKfExam = async (callBack?: Function) => {
this.endExamCallBack = callBack console.info('surenjun', '注册远程扣分考试事件')
this.kfContent = callBack
} }
//开始考试 //开始考试
public sendBeginExam = async(content:string)=>{ public sendBeginExam = async (content: string) => {
emitter.emit({eventId:EVENTID.beginExamEventId}, { emitter.emit({
data:{ content } eventId: EVENTID.beginExamEventId
}, {
data: {
directives: content
}
}); });
} }
//结束考试 //结束考试
public sendEndExam = async(content:string)=>{ public sendEndExam = async (content: string) => {
emitter.emit({eventId:EVENTID.endExamEventId}, { emitter.emit({
data:{content} eventId: EVENTID.endExamEventId
}, {
data: {
directives: content
}
}); });
} }
//扣分
public sendKfContent = async (kfxh: string) => {
const directives = this.directives
console.info('surenjun', `udpEvent收到扣分事件。kfxh=>${kfxh};directives=>${directives}`)
emitter.emit({
eventId: EVENTID.kfEventId
}, {
data: {
directives,
kfxh
}
});
}
//监听扣分指令
public sendOnKf = async (directives: string) => {
//TODO 临时存储指令编号
this.directives = directives
globalThis.judgeUdp.askKf(directives)
}
// 获取扣分项目编号
public onConfirmKf = async (kfxh: string) => {
const directives = this.directives;
emitter.emit({
eventId: EVENTID.kfConfirmEventId
}, {
data: {
kfxh, directives
}
});
}
} }

View File

@ -62,7 +62,7 @@ export default async function request(req: any) {
//处理中心服务code //处理中心服务code
if(res.Envelope){ if(res.Envelope){
const msgXml = res.Envelope.Body.writeObjectOutResponse.return; const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
//Envelope.Body.writeObjectOutResponse.return //Envelope.Body.writeObjectOutResponse.return
const dd = handleCenterCode(msgXml,isNewCenter); const dd = handleCenterCode(msgXml,isNewCenter);
return dd return dd
} }
@ -170,7 +170,6 @@ function handleCenterCode(msgXml,isNewCenter){
const patternArr = pattern.exec(msgXml); const patternArr = pattern.exec(msgXml);
return patternArr && patternArr[1] return patternArr && patternArr[1]
}); });
console.info('surenjun =>request-prev',keystr)
if(code != '1'){ if(code != '1'){
prompt.showToast({ prompt.showToast({
@ -182,7 +181,6 @@ function handleCenterCode(msgXml,isNewCenter){
// globalThis.errorDialog.open() // globalThis.errorDialog.open()
return {code,message:decodeURIComponent(message)} return {code,message:decodeURIComponent(message)}
}else{ }else{
console.info('surenjun =>request',keystr)
return { code ,keystr, message } return { code ,keystr, message }
} }
} }

View File

@ -539,7 +539,6 @@ struct Index {
carId,examinationRoomId, carId,examinationRoomId,
lsh,kskssj,kslc lsh,kskssj,kslc
}) })
console.info('surenjun 考试里程上传成功')
} }
} }

View File

@ -23,7 +23,7 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import { initJudgeUdp } from '../common/utils/UdpJudge'; import { initJudgeUdp } from '../common/utils/UdpJudge';
import errorMsgDialog from './compontents/errorMsgDialog' import errorMsgDialog from './compontents/errorMsgDialog'
import { getCurrentHourTime } from '../common/utils/tools';
@Entry @Entry
@Component @Component
struct UserInfo { struct UserInfo {
@ -203,6 +203,16 @@ struct UserInfo {
this.avPlayer = new VoiceAnnounce(); this.avPlayer = new VoiceAnnounce();
initJudgeUdp() initJudgeUdp()
//监听远程开始考试
globalThis.udpEvent.onBeginExam(async ()=>{
console.info('surenjun','userInfo收到UdpEvent事件')
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
await this.prePareSCZB()
}else{
await this.prePareExam()
}
})
} }
//身份证读卡器初始化 //身份证读卡器初始化
@ -461,7 +471,7 @@ struct UserInfo {
//人脸比对窗口关闭 //人脸比对窗口关闭
changeFaceCompareSuccess() { changeFaceCompareSuccess() {
this.ksksLimit = false this.ksksLimit = false
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser)) console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
if (this.faceCompareSucess > 0) { if (this.faceCompareSucess > 0) {
//人脸比对通过 //人脸比对通过
@ -797,6 +807,7 @@ struct UserInfo {
const {carId,examinationRoomId} = carInfo; const {carId,examinationRoomId} = carInfo;
const { examSubject,plateNo } = carInfo; const { examSubject,plateNo } = carInfo;
const date = new Date() const date = new Date()
globalThis.startHourTime = await getCurrentHourTime()
const photoBase64 = await this.getPhoto(); const photoBase64 = await this.getPhoto();
const drvexam = { const drvexam = {
lsh: this.currentUser.lsh || '', lsh: this.currentUser.lsh || '',
@ -826,7 +837,7 @@ struct UserInfo {
} }
//开始上车准备 //开始上车准备
prePareSCZB = async () => { prePareSCZB = async () => {
try { try {
await this.checkSignal() await this.checkSignal()
this.isExamStart = true this.isExamStart = true
@ -887,15 +898,6 @@ struct UserInfo {
aboutToDisappear() { aboutToDisappear() {
this.outClick() this.outClick()
//监听远程开始考试
globalThis.udpEvent.onBeginExam(async ()=>{
console.info('surenjun','userInfo收到UdpEvent事件')
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
await this.prePareSCZB()
}else{
await this.prePareExam()
}
})
} }
outClick() { outClick() {

View File

@ -96,7 +96,6 @@ export default struct RealTime {
Row(){ Row(){
Image($rawfile('judge/big.png')).width(60).onClick(()=>{ Image($rawfile('judge/big.png')).width(60).onClick(()=>{
this.scaleFn( -this.getScaleNum() ) this.scaleFn( -this.getScaleNum() )
console.info('surenjun getScaleNum',-this.getScaleNum())
}) })
Image($rawfile('judge/small.png')).width(60).onClick(()=>{ Image($rawfile('judge/small.png')).width(60).onClick(()=>{
this.scaleFn( this.getScaleNum() ) this.scaleFn( this.getScaleNum() )
@ -184,7 +183,6 @@ export default struct RealTime {
scaleFn = async (num)=>{ scaleFn = async (num)=>{
const scaleNum = this.scaleNum const scaleNum = this.scaleNum
console.info('surenjun getScaleNum',scaleNum)
if(scaleNum >0 && scaleNum < 5000){ if(scaleNum >0 && scaleNum < 5000){
this.scaleNum += num; this.scaleNum += num;
} }

View File

@ -105,7 +105,7 @@ export default class Judge {
//开始评判 //开始评判
private async judging(callBack: Function) { private async judging(callBack: Function) {
const {judgeUI} = this; const {judgeUI} = this;
const { name, lsh, idCard,kssycs} = judgeUI; const { name, lsh, idCard,kssycs,manualMarkRules} = judgeUI;
const fileLog = new FileLog(judgeUI.context); const fileLog = new FileLog(judgeUI.context);
const filePath = await fileLog.initFileLogo({ const filePath = await fileLog.initFileLogo({
name, lsh, idCard name, lsh, idCard
@ -122,7 +122,7 @@ export default class Judge {
strArr = str.split('\n') strArr = str.split('\n')
} }
//日志回调 //日志回调
console.info(judgeTag, '1.进入评判入口') console.info(judgeTag, '1.进入评判入口1')
await examJudgeSetLogCallback(3, async (level, info, len) => { await examJudgeSetLogCallback(3, async (level, info, len) => {
console.log('评判日志:' + info) console.log('评判日志:' + info)
await fileLog.setExamJudgeLogData(info); await fileLog.setExamJudgeLogData(info);
@ -151,7 +151,11 @@ export default class Judge {
console.info('评判实时数据', info) console.info('评判实时数据', info)
const performInfo = JSON.parse(info) const performInfo = JSON.parse(info)
this.performInfo = performInfo this.performInfo = performInfo
this.judgeUI.jl = Math.floor((performInfo.qjjl + performInfo.dcjl) / 100) const jl = Math.floor((performInfo.qjjl + performInfo.dcjl) / 100);
if(jl > this.judgeUI.examMileage){
this.checkExamIsEnd()
}
this.judgeUI.jl = jl
//TODO 待优化 跨组件传值不生效 //TODO 待优化 跨组件传值不生效
globalThis.laneData = performInfo.lane; globalThis.laneData = performInfo.lane;
}) })
@ -199,10 +203,25 @@ export default class Judge {
handDistance(); handDistance();
} }
}) })
globalThis.udpEvent.onBeginExam(async ()=>{
//监听远程结束考试
globalThis.udpEvent.onEndExam(async ()=>{
this.checkExamIsEnd(true); this.checkExamIsEnd(true);
}) })
//TODO 监听远程扣分
console.info(judgeTag,JSON.stringify(manualMarkRules))
//监听远程扣分
globalThis.udpEvent.onKfExam(async (content)=>{
console.info('评判收到远程扣分项目内容' + JSON.stringify(content))
const { kfxh , directives } = content.data;
console.info(judgeTag ,'评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`)
//根据扣分序号找扣分代码
const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0];
console.info(judgeTag, '扣分项目:' + JSON.stringify(currentKf))
this.setJudgeMark(currentKf.itemno, currentKf.markserial, 2);
globalThis.judgeUdp.confirmKf(directives , 1)
})
} }
//实时计算gps经纬度距离 //实时计算gps经纬度距离
handDistance= async ()=>{ handDistance= async ()=>{
@ -413,7 +432,8 @@ export default class Judge {
}) })
this.judgeUI.totalScore += thisKf.score * 1; this.judgeUI.totalScore += thisKf.score * 1;
if(kf.xmdm != 20){ if(kf.xmdm != 20){
judgeUI.projectsObj[kf.xmdm].type = '5'; const type = judgeUI.projectsObj[kf.xmdm].type;
judgeUI.projectsObj[kf.xmdm].type = (type == 3 || type == 4) ? '4' : '5';
} }
break; break;
@ -437,7 +457,7 @@ export default class Judge {
const xmdm = xmqx.xmdm; const xmdm = xmqx.xmdm;
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
const voiceCode = getKmProjectCancelVoice(examSubject,xmmcCode); const voiceCode = getKmProjectCancelVoice(examSubject,xmmcCode);
avPlayer.playAudio([`voice/${voiceCode}.mp3`],true) // avPlayer.playAudio([`voice/${voiceCode}.mp3`],true)
this.judgeUI.projectsObj[xmdm].type = '1'; this.judgeUI.projectsObj[xmdm].type = '1';
this.testKmItems[xmmcCode].status = '1'; this.testKmItems[xmmcCode].status = '1';
break; break;
@ -466,10 +486,10 @@ export default class Judge {
const {xmdm} = precast; const {xmdm} = precast;
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){ // if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){
//倒车入库/桩考/侧方停车 // //倒车入库/桩考/侧方停车
avPlayer.playAudio([`voice/${xmmcCode}.mp3`],false) // avPlayer.playAudio([`voice/${xmmcCode}.mp3`],false)
} // }
this.testKmItems[xmmcCode].status = 2; this.testKmItems[xmmcCode].status = 2;
this.xmmcStr = xmmcStr; this.xmmcStr = xmmcStr;
this.xmmcCode = xmmcCode; this.xmmcCode = xmmcCode;
@ -528,13 +548,13 @@ export default class Judge {
const code = projectsObj[xmdm].projectCodeCenter; const code = projectsObj[xmdm].projectCodeCenter;
const isEnd = projectsObj[xmdm].isEnd; const isEnd = projectsObj[xmdm].isEnd;
const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane,xmxh) const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane,xmxh)
if (!ignoreVoiceCodeArr.includes(code)) { // if (!ignoreVoiceCodeArr.includes(code)) {
if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){
//倒出入库、桩考\进项目语音控制 // //倒出入库、桩考\进项目语音控制
}else{ // }else{
kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true)
} // }
} // }
setTimeout(()=>{if(param512[7] != 0){this.judgeUI.isDeductedPopShow = true}},200) setTimeout(()=>{if(param512[7] != 0){this.judgeUI.isDeductedPopShow = true}},200)
//项目已考不上传监管信息 //项目已考不上传监管信息
if (!isEnd) { if (!isEnd) {
@ -555,9 +575,9 @@ export default class Judge {
const endCode = projectsObj[xmdm].projectCodeCenter; const endCode = projectsObj[xmdm].projectCodeCenter;
const projectIsEnd = projectsObj[xmdm].isEnd; const projectIsEnd = projectsObj[xmdm].isEnd;
const endKmCode = getKmProjectVoice(endCode, 2, judgeConfigObj, lane,xmxh) const endKmCode = getKmProjectVoice(endCode, 2, judgeConfigObj, lane,xmxh)
if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) { // if (!ignoreVoiceCodeArr.includes(endCode) && examSubject == 3) {
endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`]) // endKmCode && avPlayer.playAudio([`voice/${endKmCode}.mp3`])
} // }
const isStart = await checkProjectIsStart(xmdm,1); const isStart = await checkProjectIsStart(xmdm,1);
if(isStart){ if(isStart){
//项目结束了就不再生成数据 //项目结束了就不再生成数据
@ -581,7 +601,6 @@ export default class Judge {
const currentKf = kf[kfLen -1]; const currentKf = kf[kfLen -1];
if (judgeConfig.kfVoiceOpen ||(examSubject == 2 && judgeConfigObj['618'] == '1') || (examSubject== 3&& judgeConfigObj['418'] == '1') ) { if (judgeConfig.kfVoiceOpen ||(examSubject == 2 && judgeConfigObj['618'] == '1') || (examSubject== 3&& judgeConfigObj['418'] == '1') ) {
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`,`voice/mark_${Math.abs(currentKf.score)}.mp3`]) avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`,`voice/mark_${Math.abs(currentKf.score)}.mp3`])
} }
const isStart = await checkProjectIsStart(currentKf.xmdm,2,currentKf); const isStart = await checkProjectIsStart(currentKf.xmdm,2,currentKf);
if(isStart){ if(isStart){
@ -815,29 +834,30 @@ export default class Judge {
goJudgeVoice = async (sound: SOUND) => { goJudgeVoice = async (sound: SOUND) => {
const {avPlayer,fileLog} = this; const {avPlayer,fileLog} = this;
const {xmdm,code,type} = sound; const {xmdm,code,type} = sound;
console.info('surenjun code=>',JSON.stringify(code))
//判断是不是模拟灯光语音 //判断是不是模拟灯光语音
if (type == 1) { if (type == 1) {
avPlayer.playAudio([`voice/${code}.mp3`], false, () => { avPlayer.playAudio([`voice/${code[0]}.mp3`], false, () => {
examJudgeSoundEnd({ examJudgeSoundEnd({
itemno: xmdm, code, type itemno: xmdm, code:code[0], type
}) })
fileLog.setExamJudgeData({ fileLog.setExamJudgeData({
method: 'examJudgeSoundEnd', method: 'examJudgeSoundEnd',
itemno: xmdm, itemno: xmdm,
code, code:code[0],
type, type,
}) })
}) })
}else{ }else{
avPlayer.playAudio([`voice/${code}.mp3`]) avPlayer.playAudio([`voice/${code[0]}.mp3`])
} }
} }
// 校验考试是否结束 // 校验考试是否结束
checkExamIsEnd = checkExamIsEnd =
async (isManual?: boolean) => { async (isManual?: boolean) => {
const {judgeUI,avPlayer,isExamEnd,isEndTip} = this; const {judgeUI,avPlayer,isExamEnd,isEndTip,ksjs} = this;
const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore} = judgeUI; const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore,examMileage,jl} = judgeUI;
if (isExamEnd) { if (isExamEnd) {
return return
@ -857,7 +877,7 @@ export default class Judge {
//单机模式 //单机模式
if (singlePlay) { if (singlePlay) {
console.info(judgeTag + ' isAllProjectsEnd => ',isAllProjectsEnd) console.info(judgeTag + ' isAllProjectsEnd => ',isAllProjectsEnd)
if (isAllProjectsEnd) { if (isAllProjectsEnd && jl >= examMileage) {
//成绩合格 //成绩合格
if(totalScore >= passingGrade && !isEndTip) { if(totalScore >= passingGrade && !isEndTip) {
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)) {
@ -874,7 +894,7 @@ export default class Judge {
return return
} }
}else{ }else{
if(examSubject == 3 && param302 == 4){ if(examSubject == 3 && (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8)){
await examJudgeEndExam() await examJudgeEndExam()
this.isExamEnd = true this.isExamEnd = true
return return
@ -895,6 +915,7 @@ export default class Judge {
this.isExamEnd = true this.isExamEnd = true
return return
} }
//成绩合格 //成绩合格
if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) { if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) {
if(examSubject == 2){ if(examSubject == 2){
@ -902,8 +923,14 @@ export default class Judge {
this.isExamEnd = true this.isExamEnd = true
return return
} }
//考试里程判断
if(examSubject == 3 && jl < examMileage){
return
}
//考试合格自动退出 //考试合格自动退出
if(examSubject == 3 && param302 == 4){ if(examSubject == 3 && (param302 == 4)){
await examJudgeEndExam() await examJudgeEndExam()
this.isExamEnd = true this.isExamEnd = true
return return
@ -1195,15 +1222,13 @@ export default class Judge {
tempSd = 0 tempSd = 0
} }
fileLog.setFourAndOneLogData(`${translateJd},${translateWd}`);
const arr = [ const arr = [
//考生号 //考生号
asclshArr.map(lsh => string2Bytes(lsh, 8)[0]), asclshArr.map(lsh => string2Bytes(lsh, 8)[0]),
//考试员号 //考试员号
ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]), ascksyhArr.map(ksyh => string2Bytes(ksyh, 8)[0]),
//科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间 //科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间
string2Bytes(`${examType}${startHourTime}`, 4 * 8), string2Bytes(`${examType}${globalThis.startHourTime || startHourTime}`, 4 * 8),
// TODO 消息序号从1开始0结束 // TODO 消息序号从1开始0结束
string2Bytes(isEnd ? 0 : serialIndex, 2 * 8), string2Bytes(isEnd ? 0 : serialIndex, 2 * 8),
/*左向灯 右向灯 双跳灯 远光灯 近光灯 视宽灯 点火1 点火2 离合器 脚刹 手刹 副刹 喇叭 门开关 安全带 档位 车辆状态 雨刮器 雾灯 0*/ /*左向灯 右向灯 双跳灯 远光灯 近光灯 视宽灯 点火1 点火2 离合器 脚刹 手刹 副刹 喇叭 门开关 安全带 档位 车辆状态 雨刮器 雾灯 0*/
@ -1250,6 +1275,9 @@ export default class Judge {
tempArr = tempArr.concat(itemArr) tempArr = tempArr.concat(itemArr)
}) })
this.serialIndex += 1; this.serialIndex += 1;
fileLog.setFourAndOneLogData(`${startHourTime},${translateJd},${translateWd}`);
fileLog.setFourAndOneLogDataBytes(tempArr.toString());
return Array2Byte(tempArr) return Array2Byte(tempArr)
} }
//获取场地序号 //获取场地序号
@ -1459,10 +1487,7 @@ export default class Judge {
if (udpIndex % 5 === 0 && !isUdpEnd) { if (udpIndex % 5 === 0 && !isUdpEnd) {
const judgeUdp = globalThis.judgeUdp const judgeUdp = globalThis.judgeUdp
const bytes = await this.getMessageHeartbeat(isExamEnd); const bytes = await this.getMessageHeartbeat(isExamEnd);
console.info(judgeTag,JSON.stringify(bytes))
console.info(judgeTag,'udp-prev-send')
judgeUdp.send(bytes) judgeUdp.send(bytes)
console.info(judgeTag,'udp-prev-end')
} }
globalThis.udpIndex += 1 globalThis.udpIndex += 1
} }
@ -1566,6 +1591,8 @@ export default class Judge {
} }
} }
}) })
console.info(judgeTag,'项目状态projectsObj:' + JSON.stringify(projectsObj));
console.info(judgeTag,'所有考试项目数量:' + allProjectNum)
console.info(judgeTag,'必考项目数量:' + projectNum) console.info(judgeTag,'必考项目数量:' + projectNum)
console.info(judgeTag,'必考项目已考数量:' + endProjectsNum) console.info(judgeTag,'必考项目已考数量:' + endProjectsNum)
//必考项目除靠边停车是否全部完成 //必考项目除靠边停车是否全部完成
@ -1581,13 +1608,17 @@ export default class Judge {
checkDwzt = async (dwzt,jdzt) => { checkDwzt = async (dwzt,jdzt) => {
const {avPlayer} = this; const {avPlayer} = this;
const judgeConfig = this.judgeUI.judgeConfig; const judgeConfig = this.judgeUI.judgeConfig;
// const param499 = judgeConfig['499'] const param499 = judgeConfig['499'] || '';
if(param499 == '' || param499 == undefined){
return
}
//10秒内dwzt不为4 //10秒内dwzt不为4
const dwztNum = this.dwztNum const dwztNum = this.dwztNum
if(dwztNum != 0 && (dwztNum % (5 * 10) == 0)){ if(dwztNum != 0 && (dwztNum % (5 * 10) == 0) && (param499 !== '' || param499 !== undefined)){
this.judgeUI.dwztErrorVisible = true; this.judgeUI.dwztErrorVisible = true;
avPlayer.playAudio([`voice/差分状态异常.mp3`],true) avPlayer.playAudio([`voice/差分状态异常.mp3`],true)
} }
if(dwzt != 4 || jdzt != 3){ if(dwzt != 4 || jdzt != 3){
this.dwztNum += 1 this.dwztNum += 1
}else{ }else{

View File

@ -98,6 +98,8 @@ export function getKmProjectVoice(
const param544Str = judgeConfig['544']?.split(',') || []; const param544Str = judgeConfig['544']?.split(',') || [];
const param405Str = judgeConfig['405'] || 0; const param405Str = judgeConfig['405'] || 0;
console.info('surenjun => param544Str.length',param544Str.length)
const {num,count,road} = lane const {num,count,road} = lane
if(examSubject == 2){ if(examSubject == 2){
return projectCode return projectCode
@ -121,10 +123,12 @@ export function getKmProjectVoice(
: undefined : undefined
//直线行驶 //直线行驶
case 40700 : return type === 1 ? 407001 : undefined case 40700 : return type === 1 ? 407001 : undefined
//通过学校 结束param544Str //通过学校 结束param544Str
case 41100 : return type === 1 case 41100 : return type === 1
? (param512Str[2] ==3 ? 411001 : undefined) ? (param512Str[2] ==3 ? 411001 : undefined)
: (param544Str.includes(xmxh) ? undefined : 411004) : (param544Str.includes(xmxh) ? undefined : (param544Str.length === 0 ? undefined : 411004))
//通过车站 //通过车站
case 41200 : return type === 1 ? (param512Str[2] ==3 ? 412001 : undefined):undefined case 41200 : return type === 1 ? (param512Str[2] ==3 ? 412001 : undefined):undefined
//通过人行横道 //通过人行横道

View File

@ -20,7 +20,7 @@ export const judgeConfig = {
//四合一画面配置 //四合一画面配置
fourInOneScreen:{ fourInOneScreen:{
//gps位数 //gps位数
gpsDigit:6 gpsDigit:7
}, },
//后置机类型 0=>三代机 1=>一体机 2=>二代机 //后置机类型 0=>三代机 1=>一体机 2=>二代机
rearEndUnitsType:0, rearEndUnitsType:0,

Some files were not shown because too many files have changed in this diff Show More