feat:科目三联网优化

This commit is contained in:
surenjun 2024-08-16 08:52:38 +08:00
parent 438e8bc278
commit f7717785a5
5 changed files with 42 additions and 40 deletions

View File

@ -25,8 +25,8 @@ CommonConstants {
*/ */
static readonly ACCOUNT_TABLE = { static readonly ACCOUNT_TABLE = {
tableName: 'USER', tableName: 'USER',
sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id INTEGER PRIMARY KEY AUTOINCREMENT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT)', sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id INTEGER PRIMARY KEY AUTOINCREMENT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,xldm TEXT)',
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl'] columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','xldm']
}; };
/** /**

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('0000000000000', 13)); const asclshArr = stringToASC(fillZero('1111111111111', 13));
const ascksyhArr = stringToASC(fillZero('0000000000000', 13)) const ascksyhArr = stringToASC(fillZero('1111111111111', 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

View File

@ -115,7 +115,7 @@ struct Index {
async initStudent() { async initStudent() {
const students = await getSyncData('USER') const students = await getSyncData('USER')
const stuInfo = students[0] || {}; const stuInfo = students[0] || {};
const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl} = stuInfo; const {xm,sfzmhm,lsh,kszp,ksdd,kssycs,kslx,ksxl,xldm} = stuInfo;
this.name = xm || '测试考生'; this.name = xm || '测试考生';
this.idCard = sfzmhm || '01234567891010'; this.idCard = sfzmhm || '01234567891010';
this.lsh = globalThis.singlePlay?'0000000000000':lsh; this.lsh = globalThis.singlePlay?'0000000000000':lsh;
@ -124,6 +124,7 @@ struct Index {
this.kssycs = kssycs; this.kssycs = kssycs;
this.ksxl = ksxl; this.ksxl = ksxl;
this.wayno = ksxl; this.wayno = ksxl;
this.xldm = xldm;
this.kslx = kslx; this.kslx = kslx;
} }
@ -279,7 +280,7 @@ struct Index {
projectCode: no2, projectCode: no2,
projectCodeCenter: txt2, projectCodeCenter: txt2,
//是否是必考 加减档设置成非必考 //是否是必考 加减档设置成非必考
isRequired: no2== 14?false:allItems.includes(no2 + ''), isRequired: no2== 14 ? false : allItems.includes(no2 + ''),
//是否考过了 //是否考过了
isEnd: false, isEnd: false,
//项目开始数据是否上传过 //项目开始数据是否上传过
@ -1178,6 +1179,8 @@ struct Index {
@State kssycs: string = '' @State kssycs: string = ''
@State ksxl: string = '' @State ksxl: string = ''
@State kslx: string = '' @State kslx: string = ''
//监管线路代码
@State xldm: string = ''
//监管接口序列号 //监管接口序列号
@State serialNumber: number = 0 @State serialNumber: number = 0
@State carType: string = '' @State carType: string = ''

View File

@ -558,7 +558,7 @@ export const testUIAllitems = [
] ]
export const wuxiKm3Items = [ export const wuxiKm3Items = [
//3,5,9,12,14,15,16, //3,5,9,12,14,15,16,
{projectCode:'1',projectCodeCenter:'40100',name:'上车准备',abbreviation:'上车准备'}, {projectCode:'1',projectCodeCenter:'40100',name:'上车准备',abbreviation:'上车准备'},
{projectCode:'2',projectCodeCenter:'40200',name:'起步',abbreviation:'起步'}, {projectCode:'2',projectCodeCenter:'40200',name:'起步',abbreviation:'起步'},
{projectCode:'3',projectCodeCenter:'40300',name:'直线行驶',abbreviation:'直线行驶'}, {projectCode:'3',projectCodeCenter:'40300',name:'直线行驶',abbreviation:'直线行驶'},
@ -571,7 +571,7 @@ export const wuxiKm3Items = [
{projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'}, {projectCode:'10',projectCodeCenter:'41400',name:'超车',abbreviation:'超车'},
{projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'}, {projectCode:'11',projectCodeCenter:'40600',name:'靠边停车',abbreviation:'靠边停车'},
{projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'}, {projectCode:'12',projectCodeCenter:'41500',name:'掉头',abbreviation:'掉头'},
{projectCode:'41',projectCodeCenter:'41600',name:'夜间行驶',abbreviation:'夜间行驶'}, {projectCode:'41',projectCodeCenter:'41600',name:'模拟夜间灯光',abbreviation:'模拟夜间灯光'},
{projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'}, {projectCode:'14',projectCodeCenter:'40400',name:'加减档位操作',abbreviation:'加减档位操作'},
{projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'}, {projectCode:'15',projectCodeCenter:'40800',name:'路口左转弯',abbreviation:'路口左转弯'},
{projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'}, {projectCode:'16',projectCodeCenter:'40900',name:'路口右转弯',abbreviation:'路口右转弯'},
@ -622,9 +622,9 @@ export const testKm3Items= [
{code:'41300',status:0}, {code:'41300',status:0},
{code:'41400',status:0}, {code:'41400',status:0},
{code:'41500',status:0}, {code:'41500',status:0},
{code:'41600',status:0},
{code:'41700',status:0}, {code:'41700',status:0},
{code:'41600',status:0},
] ]
export const testMarkRules = [{ export const testMarkRules = [{

View File

@ -462,14 +462,14 @@ export default class Judge {
} }
//项目已考不上传监管信息 //项目已考不上传监管信息
if (!isEnd) { if (!isEnd) {
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`)
await beginProject(xmdm) await beginProject(xmdm)
},{isDelay: true}) },{isDelay: true})
judgeTask.addTask(async () => { judgeTask.addTask(async () => {
console.info(judgeTag, `项目-${xmdm}-上传照片 start`) console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
await uploadProgressPhoto(xmdm) await uploadProgressPhoto(xmdm)
},{isDelay: true}) },{isDelay: true})
this.judgeUI.projectsObj[xmdm].isUpload = true; this.judgeUI.projectsObj[xmdm].isUpload = true;
} }
break; break;
@ -581,7 +581,7 @@ export default class Judge {
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,ksxl} = 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)
@ -595,7 +595,7 @@ export default class Judge {
sfzmhm: idCard, sfzmhm: idCard,
ksxm: project.projectCodeCenter, ksxm: project.projectCodeCenter,
sbxh, sbxh,
ksxl, ksxl:xldm,
kchp: encodeURI(plateNo), kchp: encodeURI(plateNo),
// 开始时间 // 开始时间
ksdd: encodeURI(ksdd), ksdd: encodeURI(ksdd),
@ -618,7 +618,7 @@ export default class Judge {
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,ksxl,} = 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)
@ -633,7 +633,7 @@ export default class Judge {
sbxh, sbxh,
//TODO 操作类型 1:正常 0:撤销该考试记录 //TODO 操作类型 1:正常 0:撤销该考试记录
czlx: '1', czlx: '1',
ksxl, ksxl:xldm,
kchp: encodeURI(plateNo), kchp: encodeURI(plateNo),
ksdd: encodeURI(ksdd), ksdd: encodeURI(ksdd),
kslx: encodeURI(kslx) || '', kslx: encodeURI(kslx) || '',
@ -726,15 +726,15 @@ export default class Judge {
//判断是不是模拟灯光语音 //判断是不是模拟灯光语音
if (type == 1) { if (type == 1) {
avPlayer.playAudio([`voice/${code}.mp3`], false, () => { avPlayer.playAudio([`voice/${code}.mp3`], false, () => {
examJudgeSoundEnd({ examJudgeSoundEnd({
itemno: xmdm, code, type itemno: xmdm, code, type
}) })
fileLog.setExamJudgeData({ fileLog.setExamJudgeData({
method: 'examJudgeSoundEnd', method: 'examJudgeSoundEnd',
itemno: xmdm, itemno: xmdm,
code, code,
type, type,
}) })
}) })
}else{ }else{
avPlayer.playAudio([`voice/${code}.mp3`]) avPlayer.playAudio([`voice/${code}.mp3`])
@ -1008,6 +1008,7 @@ export default class Judge {
getSbxh getSbxh
} = this; } = this;
console.info(judgeTag,2) console.info(judgeTag,2)
const singlePlay = globalThis.singlePlay
const {lsh,startHourTime,totalScore,examTime} = judgeUI; const {lsh,startHourTime,totalScore,examTime} = judgeUI;
const {fourInOneScreen:{gpsDigit}} = judgeConfig const {fourInOneScreen:{gpsDigit}} = judgeConfig
@ -1026,7 +1027,9 @@ export default class Judge {
const sbxh = getSbxh(xmdm, xmxh) const sbxh = getSbxh(xmdm, xmxh)
console.info(judgeTag,JSON.stringify(performInfo)) console.info(judgeTag,JSON.stringify(performInfo))
const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {};
const asclshArr = stringToASC(fillZero(lsh || 0, 13)); const asclshArr = stringToASC(
fillZero((singlePlay?1111111111111:lsh) || 0, 13)
);
//13不足要补0 //13不足要补0
console.info(judgeTag,6) console.info(judgeTag,6)
const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13))
@ -1046,11 +1049,10 @@ export default class Judge {
// 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) console.info('surenjunxmmcexamTime' , examTime)
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]),
@ -1079,9 +1081,6 @@ export default class Judge {
string2Bytes(Math.floor((dcjl + qjjl) / 100), 2 * 8), string2Bytes(Math.floor((dcjl + qjjl) / 100), 2 * 8),
//扣分 //扣分
string2Bytes(100 - Math.abs(totalScore), 2 * 8), string2Bytes(100 - Math.abs(totalScore), 2 * 8),
//扣分数
//todo扣分值/扣分项
string2Bytes(0, 2 * 8),
//扣分项数量 //扣分项数量
string2Bytes(kfArr.length, 8), string2Bytes(kfArr.length, 8),
//n个扣分序号 //n个扣分序号
@ -1092,8 +1091,8 @@ export default class Judge {
string2Bytes(0, 2 * 8), string2Bytes(0, 2 * 8),
//TODO 摩托压线 Byte[20], //TODO 摩托压线 Byte[20],
string2Bytes(0, 20 * 8), string2Bytes(0, 20 * 8),
//TODO 考试用时 //考试用时
string2Bytes(fillZero(examTime+'',4), 4 * 8), string2Bytes(examTime, 4 * 8),
//TODO 项目用时 //TODO 项目用时
string2Bytes(fillZero(0,2), 2 * 8), string2Bytes(fillZero(0,2), 2 * 8),
//TODO 设备信号状态 //TODO 设备信号状态
@ -1316,7 +1315,7 @@ export default class Judge {
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
await examJudgeRealExam(plcData) await examJudgeRealExam(plcData)
const udpIndex = globalThis.udpIndex; const udpIndex = globalThis.udpIndex;
if (udpIndex % 5 === 0) { if (udpIndex % 5 === 0 && !isExamEnd) {
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)) console.info(judgeTag+'UDP',JSON.stringify(bytes))
@ -1395,8 +1394,8 @@ 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(); const bytes = await this.getMessageHeartbeat();
// bytes && globalThis.judgeUdp.send(bytes) bytes && globalThis.judgeUdp.send(bytes)
num++ num++
}, 200) }, 200)