Merge remote-tracking branch 'outer/代理服务方案' into 代理服务方案

This commit is contained in:
lixiao 2025-03-28 17:54:00 +08:00
commit 23f58579c2
2 changed files with 177 additions and 170 deletions

View File

@ -21,10 +21,10 @@ interface WR {
export default async function writeObjectOutNew(data, filePath): Promise<WR> { export default async function writeObjectOutNew(data, filePath): Promise<WR> {
const fileUtil = new FileUtil(globalThis.context); const fileUtil = new FileUtil(globalThis.context);
const {jkid , drvexam} = data; const { jkid, drvexam } = data;
const basic = await getBasicConfig(jkid); const basic = await getBasicConfig(jkid);
const params = await getParams(jkid, drvexam); const params = await getParams(jkid, drvexam);
const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; const { wglb, jkxlh, glbm, jgbh, sjbs } = basic;
if (filePath) { if (filePath) {
await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({
@ -79,7 +79,7 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> {
globalThis.serviceExtProxy.processData("1", (errorCode: number, retVal: string) => { globalThis.serviceExtProxy.processData("1", (errorCode: number, retVal: string) => {
console.log("lixiao result", errorCode, JSON.stringify(retVal)) console.log("lixiao result", errorCode, JSON.stringify(retVal))
let result = JSON.parse(retVal) let result = JSON.parse(retVal)
if (result.code === 0 ) { if (result.code === 0) {
resolve(result.data) resolve(result.data)
} else { } else {
emitter.emit({ emitter.emit({
@ -92,33 +92,6 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> {
}) })
} }
temp = await fn() temp = await fn()
// temp = await request({
// host: globalThis.JGHOST,
// method: 'post',
// //是否是新中心
// isNewCenter: true,
// xml: true,
// url: '/dems_ws/services/TmriOutAccess?wsdl',
// data: `<?xml version="1.0"?>
// <SOAP-ENV:Envelope
// xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
// xmlns:xsd="http://www.w3.org/2001/XMLSchema"
// xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
// >
// <SOAP-ENV:Body>
// <writeObjectOut xmlns="http://service.es.doron">
// <wglb>${wglb}</wglb>
// <jkxlh>${jkxlh}</jkxlh>
// <glbm>${glbm}</glbm>
// <jgbh>${jgbh}</jgbh>
// <sjbs>${sjbs}</sjbs>
// <data>${JSON.stringify(params.data)}</data>
// <file>${JSON.stringify(params.file)}</file>
// </writeObjectOut>
// </SOAP-ENV:Body>
// </SOAP-ENV:Envelope>`,
// })
} catch (e) { } catch (e) {
console.log("新监管错误") console.log("新监管错误")
temp = e temp = e

View File

@ -65,7 +65,7 @@ export default class Judge {
if (singlePlay) { if (singlePlay) {
return '' return ''
} else { } else {
const {filePhoto} = this; const { filePhoto } = this;
const photoBase64 = await filePhoto.getPhoto(); const photoBase64 = await filePhoto.getPhoto();
console.info(judgeTag, '拍照完成') console.info(judgeTag, '拍照完成')
return photoBase64 return photoBase64
@ -73,7 +73,7 @@ export default class Judge {
} }
//人工操作项目 //人工操作项目
public setJudgeItem = async (itemno, type: 1 | 2) => { public setJudgeItem = async (itemno, type: 1 | 2) => {
const {fileLog} = this; const { fileLog } = this;
await examJudgeArtificialItem(itemno * 1, type); await examJudgeArtificialItem(itemno * 1, type);
await fileLog.setExamJudgeData({ await fileLog.setExamJudgeData({
method: 'examJudgeArtificialItem', method: 'examJudgeArtificialItem',
@ -84,7 +84,7 @@ export default class Judge {
} }
//人工扣分 //人工扣分
public setJudgeMark = async (itemno, serial, type = 1) => { public setJudgeMark = async (itemno, serial, type = 1) => {
const {fileLog} = this const { fileLog } = this
await examJudgeArtificialMark(itemno * 1, serial, type); await examJudgeArtificialMark(itemno * 1, serial, type);
console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`) console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`)
await fileLog.setExamJudgeData({ await fileLog.setExamJudgeData({
@ -98,7 +98,7 @@ export default class Judge {
} }
// 断网数据补传 // 断网数据补传
uploadDisConnectData = async () => { uploadDisConnectData = async () => {
const {isJudgeDisConnect,fileLog,fileUtil} = this; const { isJudgeDisConnect, fileLog, fileUtil } = this;
if (!isJudgeDisConnect) { if (!isJudgeDisConnect) {
return return
} }
@ -112,10 +112,10 @@ export default class Judge {
} }
//上传无锡所过程数据 //上传无锡所过程数据
uploadProgressData = async () => { uploadProgressData = async () => {
const {judgeUI,fileUtil,fileLog} = this; const { judgeUI, fileUtil, fileLog } = this;
const {idCard,startFullTime} = judgeUI const { idCard, startFullTime } = judgeUI
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const {carId,examinationRoomId} = carInfo const { carId, examinationRoomId } = carInfo
const folderPath = fileLog.folderPath const folderPath = fileLog.folderPath
const base64 = new util.Base64(); const base64 = new util.Base64();
const time = await getCurrentTime(); const time = await getCurrentTime();
@ -151,8 +151,8 @@ export default class Judge {
} }
//获取科目三的评判初始化配置 //获取科目三的评判初始化配置
getKm3JudgeInitConfig = async () => { getKm3JudgeInitConfig = async () => {
const {judgeUI,getModelData} = this; const { judgeUI, getModelData } = this;
const {mapPointArr,mapPointItemArr} = judgeUI; const { mapPointArr, mapPointItemArr } = judgeUI;
return { return {
map_point: mapPointArr, map_point: mapPointArr,
map_point_item: mapPointItemArr, map_point_item: mapPointItemArr,
@ -164,10 +164,12 @@ export default class Judge {
} }
// 处理特殊参数配置 // 处理特殊参数配置
handleSEP = async (code: number) => { handleSEP = async (code: number) => {
const {judgeUI:{ const {
judgeUI:{
judgeConfigObj judgeConfigObj
},avPlayer} = this; }, avPlayer
const {examSubject} = globalThis.carInfo; } = this;
const { examSubject } = globalThis.carInfo;
switch (code) { switch (code) {
//结束考试方式 //结束考试方式
@ -186,9 +188,9 @@ export default class Judge {
if (xmdm == 20) { if (xmdm == 20) {
return true return true
} }
const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd,totalScore} = this; const { judgeTask, beginProject, pointsDedute, uploadProgressPhoto, endProject, checkExamIsEnd, totalScore } = this;
const {projectsObj,passingScore:passingGrade} = this.judgeUI const { projectsObj, passingScore:passingGrade } = this.judgeUI
const {isUpload} = projectsObj[xmdm]; const { isUpload } = projectsObj[xmdm];
//如果项目没有开始 //如果项目没有开始
console.info('surenjun isUpload=>', isUpload) console.info('surenjun isUpload=>', isUpload)
if (!isUpload) { if (!isUpload) {
@ -233,7 +235,7 @@ export default class Judge {
// 处理udp plc信号 // 处理udp plc信号
handleUdp = async (msg) => { handleUdp = async (msg) => {
console.info('plc信号', msg) console.info('plc信号', msg)
const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd,judgeUI} = this const { fileLog, getPlcData, usbService, isUdpEnd, isExamEnd, judgeUI } = this
const stachArr = msg.split(',') const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || isUdpEnd) { if (stachArr[0] != '#DN_GD' || isUdpEnd) {
return return
@ -305,10 +307,10 @@ export default class Judge {
private tempData: any private tempData: any
//实时计算gps经纬度距离 //实时计算gps经纬度距离
handDistance = async () => { handDistance = async () => {
const {jd,wd,hxj,dwzt,jdzt} = this.tempData.gps; const { jd, wd, hxj, dwzt, jdzt } = this.tempData.gps;
const tJD = convertGpsCoord2(jd) const tJD = convertGpsCoord2(jd)
const tWD = convertGpsCoord2(wd) const tWD = convertGpsCoord2(wd)
const {prevJd,prevWd} = this const { prevJd, prevWd } = this
if (prevJd && dwzt == 4 && jdzt == 3) { if (prevJd && dwzt == 4 && jdzt == 3) {
const distance = await examCalcGpsDistance({ const distance = await examCalcGpsDistance({
jd1: prevJd, jd1: prevJd,
@ -329,8 +331,9 @@ export default class Judge {
// 校验考试是否结束 // 校验考试是否结束
checkExamIsEnd = checkExamIsEnd =
async (isManual?: boolean) => { async (isManual?: boolean) => {
const {judgeUI,avPlayer,isExamEnd,isEndTip,ksjs} = this; const { judgeUI, avPlayer, isExamEnd, isEndTip, ksjs } = this;
const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore,examMileage,jl} = judgeUI; const { isAllProjectsEnd, examSubject, singlePlay, totalScore, judgeConfigObj, passingScore, examMileage, jl } =
judgeUI;
if (isExamEnd) { if (isExamEnd) {
return return
@ -353,7 +356,8 @@ export default class Judge {
if (isAllProjectsEnd && jl >= examMileage) { 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)) {
if (param512[7] != 0) { if (param512[7] != 0) {
clearTimeout(this.deductedPopShowTimer) clearTimeout(this.deductedPopShowTimer)
avPlayer.playAudio(['voice/综合评判.mp3']) avPlayer.playAudio(['voice/综合评判.mp3'])
@ -410,7 +414,8 @@ export default class Judge {
return return
} }
if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { if (examSubject == 3 && (param342 == 0 || param342 == 2) &&
(param302 != 6 || param302 != 7 || param302 != 8)) {
if (param512[7] != 0) { if (param512[7] != 0) {
clearTimeout(this.deductedPopShowTimer) clearTimeout(this.deductedPopShowTimer)
this.judgeUI.isDeductedPopShow = false this.judgeUI.isDeductedPopShow = false
@ -459,7 +464,7 @@ export default class Judge {
private plcData: any private plcData: any
// 获取plc数据 // 获取plc数据
getPlcData = async (plc: string) => { getPlcData = async (plc: string) => {
const {fileLog,mndgStr,rmndg} = this; const { fileLog, mndgStr, rmndg } = this;
await fileLog.setPlcProgressData(plc) await fileLog.setPlcProgressData(plc)
//plc字符串转化成评判初始化数据 //plc字符串转化成评判初始化数据
const tempData = await plcStrToJson(plc); const tempData = await plcStrToJson(plc);
@ -481,7 +486,7 @@ export default class Judge {
} }
// 处理轨迹plc信号 // 处理轨迹plc信号
handleTrajectoryUdp = async (strArr) => { handleTrajectoryUdp = async (strArr) => {
const {fileLog,setJudgeItem,setJudgeMark,endExam} = this; const { fileLog, setJudgeItem, setJudgeMark, endExam } = this;
let num = 2; let num = 2;
const judgeTimer = setInterval(async () => { const judgeTimer = setInterval(async () => {
const msgStr = strArr[num]; const msgStr = strArr[num];
@ -526,15 +531,17 @@ export default class Judge {
// 项目开始接口同步 // 项目开始接口同步
beginProject = async (ksxm) => { beginProject = async (ksxm) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject,plateNo } = carInfo; const { examSubject, plateNo } = carInfo;
const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; const { judgeUI, fileLog, getSbbm, xmxh, filePath } = this;
const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI const { lsh, idCard, serialNumber, projectsObj, ksdd, kslx, xldm } = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
const sbxh = getSbbm(ksxm, xmxh) const sbxh = getSbbm(ksxm, xmxh)
const data = { const data = {
//系统类别 接口序列号 接口标识 //系统类别 接口序列号 接口标识
xtlb: '17', jkxlh: serialNumber, jkid: '17C52', xtlb: '17',
jkxlh: serialNumber,
jkid: '17C52',
drvexam: { drvexam: {
// 考试科目 身份证号码 // 考试科目 身份证号码
lsh, lsh,
@ -550,7 +557,7 @@ export default class Judge {
kssj: time kssj: time
} }
} }
const {code} = await this.sendWriteObjectOut(data, filePath) const { code } = await this.sendWriteObjectOut(data, filePath)
console.info(judgeTag, '项目开始 end') console.info(judgeTag, '项目开始 end')
if (code === 2300007) { if (code === 2300007) {
this.isJudgeDisConnect = true; this.isJudgeDisConnect = true;
@ -561,15 +568,17 @@ export default class Judge {
endProject = async (ksxm) => { endProject = async (ksxm) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const deviceNo = globalThis.deviceNo; const deviceNo = globalThis.deviceNo;
const { examSubject,plateNo,carNo } = carInfo; const { examSubject, plateNo, carNo } = carInfo;
const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; const { judgeUI, fileLog, getSbxh, xmxh, getSbbm, filePath } = this;
const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI const { lsh, idCard, serialNumber, projectsObj, cdsbInfoObj, ksdd, kslx, xldm, } = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh) const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh)
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C55', xtlb: '17',
jkxlh: serialNumber,
jkid: '17C55',
drvexam: { drvexam: {
lsh, lsh,
kskm: examSubject, kskm: examSubject,
@ -585,53 +594,28 @@ export default class Judge {
jssj: time jssj: time
} }
} }
const {code} = await this.sendWriteObjectOut(data, filePath) const { code } = await this.sendWriteObjectOut(data, filePath)
if (code === 2300007) { if (code === 2300007) {
this.isJudgeDisConnect = true; this.isJudgeDisConnect = true;
} }
console.info(judgeTag, '项目结束 end') console.info(judgeTag, '项目结束 end')
promptWxCode('17C55', code) promptWxCode('17C55', code)
} }
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
private lane: LANE = {
road: '', num: 0, count: 0
}
private videoData: any
private disConnectNum: number = 0;
//调用监管接口
sendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath);
console.log("wzj", JSON.stringify(temp))
//断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1;
if (this.disConnectNum < 5) {
return await this.sendWriteObjectOut(data, filePath)
}
}
if (this.disConnectNum >= 5) {
console.info('surenjun', '123')
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
this.judgeUI.disConnectErrorOpen = true
}
this.disConnectNum = 0
return temp
}
// 考试过程照片 // 考试过程照片
uploadProgressPhoto = async (ksxm) => { uploadProgressPhoto = async (ksxm) => {
const time = await getCurrentTime(); const time = await getCurrentTime();
const {judgeUI,plcData,getPhoto,fileLog,filePath} = this; const { judgeUI, plcData, getPhoto, fileLog, filePath } = this;
const photoBase64 = await getPhoto(); const photoBase64 = await getPhoto();
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject,plateNo,carNo } = carInfo; const { examSubject, plateNo, carNo } = carInfo;
const {lsh,idCard,serialNumber,projectsObj,ksdd,judgeConfigObj} = judgeUI; const { lsh, idCard, serialNumber, projectsObj, ksdd, judgeConfigObj } = judgeUI;
const {sensor,gps} = plcData const { sensor, gps } = plcData
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C54', xtlb: '17',
jkxlh: serialNumber,
jkid: '17C54',
drvexam: { drvexam: {
lsh, lsh,
kskm: examSubject, kskm: examSubject,
@ -645,13 +629,19 @@ export default class Judge {
ksdd: encodeURI(ksdd) ksdd: encodeURI(ksdd)
} }
}; };
const {code} = await this.sendWriteObjectOut(data, filePath); const { code } = await this.sendWriteObjectOut(data, filePath);
if (code === 2300007) { if (code === 2300007) {
this.isJudgeDisConnect = true this.isJudgeDisConnect = true
} }
promptWxCode('17C54', code) promptWxCode('17C54', code)
console.info(judgeTag, '上传照片 end') console.info(judgeTag, '上传照片 end')
} }
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
private lane: LANE = {
road: '', num: 0, count: 0
}
private videoData: any
private disConnectNum: number = 0;
constructor(judgeUI) { constructor(judgeUI) {
this.serialIndex = 1; this.serialIndex = 1;
@ -672,13 +662,13 @@ export default class Judge {
this.carztStr = ''; this.carztStr = '';
this.testKmItems = {}; this.testKmItems = {};
// 考试回放配置 // 考试回放配置
const {isTrajectoryOpen,modelPath,trajectoryPath} = judgeConfig const { isTrajectoryOpen, modelPath, trajectoryPath } = judgeConfig
this.isTrajectoryOpen = isTrajectoryOpen; this.isTrajectoryOpen = isTrajectoryOpen;
this.modelPath = modelPath; this.modelPath = modelPath;
this.trajectoryPath = trajectoryPath; this.trajectoryPath = trajectoryPath;
this.isExam = !this.judgeUI.singlePlay; this.isExam = !this.judgeUI.singlePlay;
const {projectsCenterObj,examSubject} = judgeUI; const { projectsCenterObj, examSubject } = judgeUI;
(examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => { (examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => {
const projectCenterObj = projectsCenterObj[item.code] const projectCenterObj = projectsCenterObj[item.code]
@ -696,24 +686,56 @@ export default class Judge {
this.isExamEnd = false; this.isExamEnd = false;
} }
//调用监管接口
sendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath);
console.log("wzj", JSON.stringify(temp))
if (this.disConnectNum == 0) {
console.log("wzj", "第一次发送", JSON.stringify(data))
}
if (this.disConnectNum < 5 && this.disConnectNum > 0) {
console.log("wzj", "第" + this.disConnectNum + "次重新发送", JSON.stringify(data))
}
//断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1;
if (this.disConnectNum < 5) {
if (temp.code == 2300028) {
await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟1秒
} else {
return await this.sendWriteObjectOut(data, filePath)
}
}
}
if (this.disConnectNum >= 5) {
console.info('surenjun', '123')
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
this.judgeUI.disConnectErrorOpen = true
}
this.disConnectNum = 0
return temp
}
public async onJudgeFn(fn: Function) { public async onJudgeFn(fn: Function) {
await this.judging(fn) await this.judging(fn)
} }
// 获取评判初始化数据 // 获取评判初始化数据
getJudgeInitData = async () => { getJudgeInitData = async () => {
const {getModelData,getKm3JudgeInitConfig} = this const { getModelData, getKm3JudgeInitConfig } = this
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject,plateNo,carId } = carInfo; const { examSubject, plateNo, carId } = carInfo;
const judgeUI = this.judgeUI const judgeUI = this.judgeUI
const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI const { projectsObj, itemInfoObj, markRuleListObj, carType, carName, systemparmArr, carinfoArr } = judgeUI
const examType = examSubject == 2 ? 'km2' : 'km3' const examType = examSubject == 2 ? 'km2' : 'km3'
let allitems = []; let allitems = [];
if (examSubject == 2) { if (examSubject == 2) {
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
const cdsb = itemInfoObj[cdsbKey]; const cdsb = itemInfoObj[cdsbKey];
const {xmdm,xmxh,modelKey} = cdsb const { xmdm, xmxh, modelKey } = cdsb
return { return {
xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`)
} }
@ -755,12 +777,13 @@ export default class Judge {
// 获取开始考试数据 // 获取开始考试数据
getJudgeBeginData = async () => { getJudgeBeginData = async () => {
const {code,name:examinerName} = globalThis.examinerInfo; const { code, name:examinerName } = globalThis.examinerInfo;
let currentParams: any = router.getParams(); let currentParams: any = router.getParams();
const {sczb,kfdm} = currentParams; const { sczb, kfdm } = currentParams;
const {isExam} = this; const { isExam } = this;
const judgeUI = this.judgeUI const judgeUI = this.judgeUI
const {projects,carType,kssycs,isDdxk,ddxkTime,projectsCenterObj,ddxkKsxmArr,ddxkKfArr,passingScore} = judgeUI; const { projects, carType, kssycs, isDdxk, ddxkTime, projectsCenterObj, ddxkKsxmArr, ddxkKfArr, passingScore } =
judgeUI;
const beginInfo = { const beginInfo = {
kgid: '012', kgid: '012',
kgxm: decodeURI(examinerName || ''), kgxm: decodeURI(examinerName || ''),
@ -816,14 +839,14 @@ export default class Judge {
//处理评判过程回调 //处理评判过程回调
handleRealExam = async (strData, callBack) => { handleRealExam = async (strData, callBack) => {
let examData: EXAMDATA = JSON.parse(strData); let examData: EXAMDATA = JSON.parse(strData);
const {getDqxmStr,getKfStr,goJudgeVoice,setMndg,avPlayer,fileLog,judgeUI} = this; const { getDqxmStr, getKfStr, goJudgeVoice, setMndg, avPlayer, fileLog, judgeUI } = this;
const {carzt,xmks,kf,event,xmjs,xmqx,ksjs,sound,mndg,lane,precast,nongps} = examData const { carzt, xmks, kf, event, xmjs, xmqx, ksjs, sound, mndg, lane, precast, nongps } = examData
const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); const param512 = (judgeUI.judgeConfigObj['512'] || '').split(',');
//获取项目结束、项目开始代码 //获取项目结束、项目开始代码
const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm
const xmxh = event == 2 ? xmjs.xmxh : xmks.xmxh; const xmxh = event == 2 ? xmjs.xmxh : xmks.xmxh;
const isManualProjectIn = this.artSubject3ProjectsCodesArr.includes(xmdm); const isManualProjectIn = this.artSubject3ProjectsCodesArr.includes(xmdm);
const {examSubject,projects,judgeConfigObj} = this.judgeUI; const { examSubject, projects, judgeConfigObj } = this.judgeUI;
const param611 = judgeConfigObj['611'] || ''; const param611 = judgeConfigObj['611'] || '';
switch (event) { switch (event) {
//项目开始 //项目开始
@ -912,7 +935,7 @@ export default class Judge {
//项目取消 //项目取消
case 6: { case 6: {
console.info(judgeTag, '项目取消'); console.info(judgeTag, '项目取消');
const {examSubject} = this.judgeUI const { examSubject } = this.judgeUI
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);
@ -942,7 +965,7 @@ export default class Judge {
case 10: { case 10: {
const param611 = judgeConfigObj['611'] || ''; const param611 = judgeConfigObj['611'] || '';
const [f, s] = param611.split('/') const [f, s] = param611.split('/')
const {xmdm,xmxh} = precast; const { xmdm, xmxh } = 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)){
@ -961,7 +984,7 @@ export default class Judge {
//差分事件 //差分事件
case 11: { case 11: {
const {type} = nongps const { type } = nongps
this.checkDwzt(type) this.checkDwzt(type)
} }
default: default:
@ -969,7 +992,7 @@ export default class Judge {
} }
const {xmmcStr,carztStr,kfArr} = this; const { xmmcStr, carztStr, kfArr } = this;
await callBack({ await callBack({
//项目名称 考车状态 扣分arr //项目名称 考车状态 扣分arr
@ -1002,7 +1025,7 @@ export default class Judge {
closeAllFiles closeAllFiles
} = this; } = this;
const {projectsObj,judgeConfigObj,examSubject,examMileage,jl,isAllProjectsEnd} = judgeUI; const { projectsObj, judgeConfigObj, examSubject, examMileage, jl, isAllProjectsEnd } = judgeUI;
const kfLen = kf.length; const kfLen = kf.length;
//不报语音的项目列表 //不报语音的项目列表
const ignoreVoiceCodeArr = (judgeConfigObj['312'] || '').split(',') const ignoreVoiceCodeArr = (judgeConfigObj['312'] || '').split(',')
@ -1083,7 +1106,8 @@ export default class Judge {
console.info('surenjun', '扣分开始') console.info('surenjun', '扣分开始')
//扣分时实时播报语音0-否+1-是) //扣分时实时播报语音0-否+1-是)
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);
@ -1134,9 +1158,9 @@ export default class Judge {
pointsDedute = async (ksxm, kf) => { pointsDedute = async (ksxm, kf) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const deviceNo = globalThis.deviceNo; const deviceNo = globalThis.deviceNo;
const { examSubject,plateNo,carNo } = carInfo; const { examSubject, plateNo, carNo } = carInfo;
const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,xmmcEndCode,filePath} = this; const { judgeUI, getProjectInfo, fileLog, xmmcSingleCode, xmmcEndCode, filePath } = this;
const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI const { lsh, idCard, serialNumber, ksdd, projectsObj } = judgeUI
const time = await getCurrentTime(); const time = await getCurrentTime();
const project = getProjectInfo(ksxm); const project = getProjectInfo(ksxm);
//科目三夜间行驶.模拟灯光、上车准备出现通用评判ksxm为当前进行的项目 //科目三夜间行驶.模拟灯光、上车准备出现通用评判ksxm为当前进行的项目
@ -1152,7 +1176,9 @@ export default class Judge {
}) })
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C53', xtlb: '17',
jkxlh: serialNumber,
jkid: '17C53',
drvexam: { drvexam: {
lsh, lsh,
kskm: examSubject, kskm: examSubject,
@ -1173,7 +1199,7 @@ export default class Judge {
} }
console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm) console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
const {code} = await this.sendWriteObjectOut(data, filePath); const { code } = await this.sendWriteObjectOut(data, filePath);
if (code == 2300007) { if (code == 2300007) {
this.isJudgeDisConnect = true this.isJudgeDisConnect = true
} }
@ -1183,8 +1209,8 @@ 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)) console.info('surenjun code=>', JSON.stringify(code))
//判断是不是模拟灯光语音 //判断是不是模拟灯光语音
if (type == 1) { if (type == 1) {
@ -1209,9 +1235,9 @@ export default class Judge {
this.judgeUI.loadingPopupVisible = true; this.judgeUI.loadingPopupVisible = true;
this.judgeUI.endPopupVisible = false; this.judgeUI.endPopupVisible = false;
this.judgeUI.isDeductedPopShow = false; this.judgeUI.isDeductedPopShow = false;
const {qjjl,dcjl} = ksjs const { qjjl, dcjl } = ksjs
const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual,closeAllFiles} = this; const { judgeUI, endExam, handleSEP, kfArr, avPlayer, judgeTask, isManual, closeAllFiles } = this;
const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; const { judgeConfigObj, examSubject, isAllProjectsEnd, totalScore, passingScore } = judgeUI;
//计算考试分数 //计算考试分数
// this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; // this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0;
const singlePlay = globalThis.singlePlay const singlePlay = globalThis.singlePlay
@ -1219,7 +1245,8 @@ export default class Judge {
// globalThis.windowClass.setWindowSystemBarEnable(['navigation']) // globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
//自动退出待验证并且不合格 //自动退出待验证并且不合格
if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) &&
totalScore < passingScore) {
avPlayer.playAudio([`voice/考试结束.mp3`]) avPlayer.playAudio([`voice/考试结束.mp3`])
} }
//联网模式下手动结束的直接退出 //联网模式下手动结束的直接退出
@ -1261,7 +1288,7 @@ export default class Judge {
public endExam = async (isManual?: Boolean) => { public endExam = async (isManual?: Boolean) => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const singlePlay = globalThis.singlePlay const singlePlay = globalThis.singlePlay
const { examSubject ,plateNo} = carInfo; const { examSubject, plateNo } = carInfo;
const { const {
judgeUI, judgeUI,
ksjs, ksjs,
@ -1274,14 +1301,16 @@ export default class Judge {
filePath, filePath,
closeAllFiles closeAllFiles
} = this; } = this;
const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI const { lsh, idCard, serialNumber, kssycs, totalScore, judgeConfigObj, isAllProjectsEnd, passingScore } = judgeUI
//TODO 断网考试结束补传 //TODO 断网考试结束补传
// await uploadDisConnectData(); // await uploadDisConnectData();
const time = await getCurrentTime(); const time = await getCurrentTime();
const photoBase64 = await getPhoto(); const photoBase64 = await getPhoto();
const {d1,d2,d3,d4,d5} = ksjs const { d1, d2, d3, d4, d5 } = ksjs
const data = { const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C56', xtlb: '17',
jkxlh: serialNumber,
jkid: '17C56',
drvexam: { drvexam: {
lsh, lsh,
kchp: encodeURI(plateNo), kchp: encodeURI(plateNo),
@ -1299,7 +1328,7 @@ export default class Judge {
let backTimeOut = setTimeout(() => { let backTimeOut = setTimeout(() => {
router.back() router.back()
}, 90 * 1000) }, 90 * 1000)
const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath); const { code, keystr, message } = await this.sendWriteObjectOut(data, filePath);
promptWxCode('17C56', code) promptWxCode('17C56', code)
if (code != 1) { if (code != 1) {
@ -1321,7 +1350,8 @@ export default class Judge {
let voiceURL = '' let voiceURL = ''
if (examSubject == 2) { if (examSubject == 2) {
if (isAllProjectsEnd) { if (isAllProjectsEnd) {
voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') voiceURL =
(totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3')
} else { } else {
voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav`
currentKssycs = kssycs == 1 ? 0 : 1 currentKssycs = kssycs == 1 ? 0 : 1
@ -1447,7 +1477,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;
const { const {
judgeUI, judgeUI,
isExam, isExam,
@ -1464,17 +1494,19 @@ export default class Judge {
fileLog, fileLog,
} = this; } = this;
const singlePlay = globalThis.singlePlay const singlePlay = globalThis.singlePlay
const {lsh,startHourTime,totalScore,examTime,judgeConfigObj} = judgeUI; const { lsh, startHourTime, totalScore, examTime, judgeConfigObj } = judgeUI;
const {fourInOneScreen:{ const {
fourInOneScreen:{
gpsDigit gpsDigit
}} = judgeConfig }
} = judgeConfig
const examType = examSubject == 2 ? 2 : 3 const examType = examSubject == 2 ? 2 : 3
const {sensor,gps} = tempData; const { sensor, gps } = tempData;
if (tempData.sensor === undefined) { if (tempData.sensor === undefined) {
return return
} }
const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs,dw} = sensor const { zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, ygq, cs, fdjzs, dw } = sensor
const {jd,wd, hxj, fyj, hbg,sd} = gps; const { jd, wd, hxj, fyj, hbg, sd } = gps;
//过滤错误数据 //过滤错误数据
if (jd == 0) { if (jd == 0) {
@ -1482,7 +1514,7 @@ export default class Judge {
} }
const translateProject = getTranslateProject(); const translateProject = getTranslateProject();
const sbxh = getSbxh(xmdm, xmxh) const sbxh = getSbxh(xmdm, xmxh)
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; const { carzt, dcjl, qjjl, dxjl, bxjl } = performInfo || {};
const asclshArr = stringToASC( const asclshArr = stringToASC(
fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13) fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13)
); );
@ -1490,7 +1522,8 @@ export default class Judge {
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
const ascsbxhArr = stringToASC(sbxh) const ascsbxhArr = stringToASC(sbxh)
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])
) )
//@ts-ignore //@ts-ignore
const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit); const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit);
@ -1518,7 +1551,8 @@ export default class Judge {
translateSignals, translateSignals,
//速度 发动机转速 GPS纬度 GPS经度 主天线位置 //速度 发动机转速 GPS纬度 GPS经度 主天线位置
//@ts-ignore //@ts-ignore
string2Bytes(tempSd * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), string2Bytes(tempSd * 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北向距离
@ -1565,8 +1599,8 @@ export default class Judge {
//获取场地序号 //获取场地序号
getSbxh = (ksxm, xmxh) => { getSbxh = (ksxm, xmxh) => {
const {judgeUI} = this; const { judgeUI } = this;
const {cdsbInfoObj,projectsObj} = judgeUI; const { cdsbInfoObj, projectsObj } = judgeUI;
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
if (project == 3) { if (project == 3) {
return '0000000000' return '0000000000'
@ -1582,8 +1616,8 @@ export default class Judge {
} }
getSbbm = (ksxm, xmxh) => { getSbbm = (ksxm, xmxh) => {
const {judgeUI} = this; const { judgeUI } = this;
const {cdsbInfoObj,projectsObj,examSubject} = judgeUI; const { cdsbInfoObj, projectsObj, examSubject } = judgeUI;
const project = projectsObj[ksxm] const project = projectsObj[ksxm]
//科目三不需要 //科目三不需要
if (examSubject == 3) { if (examSubject == 3) {
@ -1600,7 +1634,7 @@ export default class Judge {
// 中心所有项目转换 // 中心所有项目转换
getTranslateProject = () => { getTranslateProject = () => {
const {examSubject} = this.judgeUI; const { examSubject } = this.judgeUI;
const tempItems = (examSubject == 2 ? testKm2Items : testKm3Items).map(item => { const tempItems = (examSubject == 2 ? testKm2Items : testKm3Items).map(item => {
const current = this.testKmItems[item.code]; const current = this.testKmItems[item.code];
return { return {
@ -1646,14 +1680,14 @@ export default class Judge {
// 统计必考项目、所有项目、已考数量 // 统计必考项目、所有项目、已考数量
setCountItems = async () => { setCountItems = async () => {
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const { examSubject} = carInfo; const { examSubject } = carInfo;
const {projectsObj} = this.judgeUI; const { projectsObj } = this.judgeUI;
//必考项目数量 必考项目已考数量 //必考项目数量 必考项目已考数量
let projectNum = 0, endProjectsNum = 0; let projectNum = 0, endProjectsNum = 0;
// 所有考试项目数量 项目已考项目数量 // 所有考试项目数量 项目已考项目数量
let allProjectNum = 0, allEndProjectsNum = 0; let allProjectNum = 0, allEndProjectsNum = 0;
Reflect.ownKeys(projectsObj).forEach(projectKey => { Reflect.ownKeys(projectsObj).forEach(projectKey => {
const {type,isRequired} = projectsObj[projectKey]; const { type, isRequired } = projectsObj[projectKey];
allProjectNum += 1; allProjectNum += 1;
if (type == 3 || type == 4) { if (type == 3 || type == 4) {
allEndProjectsNum += 1; allEndProjectsNum += 1;
@ -1677,7 +1711,7 @@ export default class Judge {
// 检测差分状态 // 检测差分状态
checkDwzt = async (type) => { checkDwzt = async (type) => {
const {avPlayer} = this; const { avPlayer } = this;
const judgeConfig = this.judgeUI.judgeConfig; const judgeConfig = this.judgeUI.judgeConfig;
switch (type) { switch (type) {
case 0: case 0:
@ -1716,8 +1750,8 @@ 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,manualMarkRules} = 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
@ -1796,7 +1830,7 @@ export default class Judge {
this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`)
} }
const {examSubject,projectsObj} = this.judgeUI const { examSubject, projectsObj } = this.judgeUI
// if(examSubject == 3){ // if(examSubject == 3){
// //不做模拟灯光,需要做上车准备 =>(请上车准备) // //不做模拟灯光,需要做上车准备 =>(请上车准备)
// if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){ // if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){
@ -1836,7 +1870,7 @@ export default class Judge {
//监听远程扣分 //监听远程扣分
globalThis.udpEvent.onKfExam(async (content) => { globalThis.udpEvent.onKfExam(async (content) => {
console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) console.info('评判收到远程扣分项目内容' + JSON.stringify(content))
const { kfxh , directives } = content.data; const { kfxh, directives } = content.data;
console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`) console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`)
//根据扣分序号找扣分代码 //根据扣分序号找扣分代码
const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0]; const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0];