refactor: 更新类型定义,优化代码可读性
This commit is contained in:
parent
2d98914122
commit
323f3447e7
@ -1,6 +1,18 @@
|
||||
{
|
||||
"lockfileVersion": 2,
|
||||
"meta": {
|
||||
"stableOrder": true
|
||||
},
|
||||
"lockfileVersion": 3,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {},
|
||||
"packages": {}
|
||||
"specifiers": {
|
||||
"libjudgesdk.so@src/cpp/libJudgeSdk": "libjudgesdk.so@src/cpp/libJudgeSdk"
|
||||
},
|
||||
"packages": {
|
||||
"libjudgesdk.so@src/cpp/libJudgeSdk": {
|
||||
"name": "libjudgesdk.so",
|
||||
"version": "1.0.0",
|
||||
"resolved": "src/cpp/libJudgeSdk",
|
||||
"registryType": "local"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ export interface CarInfoType {
|
||||
examinationRoomId?: string;
|
||||
plateNo?: string;
|
||||
carNo?: string;
|
||||
examSubject?: string;
|
||||
examSubject: string;
|
||||
isNeedCheck?: string;
|
||||
udpAddress?: string
|
||||
messagePort?: string
|
||||
|
||||
@ -320,49 +320,49 @@ export type Km3WxXmdmEnum = 40100 | 40200 | 40300 | 40500 | 40700 | 41000
|
||||
|
||||
|
||||
/** 考试过程中所有项目信息**/
|
||||
// export interface ProjectInfos {
|
||||
// 0?: ProjectInfo
|
||||
// 2?: ProjectInfo
|
||||
// 3?: ProjectInfo
|
||||
// 5?: ProjectInfo
|
||||
// 6?: ProjectInfo
|
||||
// 1?: ProjectInfo
|
||||
// 4?: ProjectInfo
|
||||
// 7?: ProjectInfo
|
||||
// 8?: ProjectInfo
|
||||
// 9?: ProjectInfo
|
||||
// 10?: ProjectInfo
|
||||
// 11?: ProjectInfo
|
||||
// 12?: ProjectInfo
|
||||
// 14?: ProjectInfo
|
||||
// 15?: ProjectInfo
|
||||
// 16?: ProjectInfo
|
||||
// 41?: ProjectInfo
|
||||
// }
|
||||
export interface ProjectInfos {
|
||||
0?: ProjectInfo
|
||||
2?: ProjectInfo
|
||||
3?: ProjectInfo
|
||||
5?: ProjectInfo
|
||||
6?: ProjectInfo
|
||||
1?: ProjectInfo
|
||||
4?: ProjectInfo
|
||||
7?: ProjectInfo
|
||||
8?: ProjectInfo
|
||||
9?: ProjectInfo
|
||||
10?: ProjectInfo
|
||||
11?: ProjectInfo
|
||||
12?: ProjectInfo
|
||||
14?: ProjectInfo
|
||||
15?: ProjectInfo
|
||||
16?: ProjectInfo
|
||||
41?: ProjectInfo
|
||||
}
|
||||
|
||||
// export interface ProjectCenterInfos {
|
||||
// 20100?: ProjectInfo
|
||||
// 20300?: ProjectInfo
|
||||
// 20400?: ProjectInfo
|
||||
// 20600?: ProjectInfo
|
||||
// 20700?: ProjectInfo
|
||||
// 40100?: ProjectInfo
|
||||
// 40200?: ProjectInfo
|
||||
// 40300?: ProjectInfo
|
||||
// 40500?: ProjectInfo
|
||||
// 40700?: ProjectInfo
|
||||
// 41000?: ProjectInfo
|
||||
// 41100?: ProjectInfo
|
||||
// 41200?: ProjectInfo
|
||||
// 41300?: ProjectInfo
|
||||
// 41400?: ProjectInfo
|
||||
// 40600?: ProjectInfo
|
||||
// 41500?: ProjectInfo
|
||||
// 41700?: ProjectInfo
|
||||
// 40400?: ProjectInfo
|
||||
// 40800?: ProjectInfo
|
||||
// 40900?: ProjectInfo
|
||||
// }
|
||||
export interface ProjectCenterInfos {
|
||||
20100?: ProjectInfo
|
||||
20300?: ProjectInfo
|
||||
20400?: ProjectInfo
|
||||
20600?: ProjectInfo
|
||||
20700?: ProjectInfo
|
||||
40100?: ProjectInfo
|
||||
40200?: ProjectInfo
|
||||
40300?: ProjectInfo
|
||||
40500?: ProjectInfo
|
||||
40700?: ProjectInfo
|
||||
41000?: ProjectInfo
|
||||
41100?: ProjectInfo
|
||||
41200?: ProjectInfo
|
||||
41300?: ProjectInfo
|
||||
41400?: ProjectInfo
|
||||
40600?: ProjectInfo
|
||||
41500?: ProjectInfo
|
||||
41700?: ProjectInfo
|
||||
40400?: ProjectInfo
|
||||
40800?: ProjectInfo
|
||||
40900?: ProjectInfo
|
||||
}
|
||||
|
||||
export interface MarkRule {
|
||||
itemno?: number
|
||||
|
||||
@ -96,8 +96,8 @@ export default class Judge {
|
||||
sharps: this.getModelData('km3/Sharps.txt')
|
||||
}
|
||||
}
|
||||
private context: common.UIAbilityContext
|
||||
private fileLog: FileLog
|
||||
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||
private fileLog?: FileLog
|
||||
//人工扣分
|
||||
public setJudgeMark = async (itemno: string, serial: string, type = 1) => {
|
||||
await examJudgeArtificialMark(Number(itemno), serial, type);
|
||||
@ -108,7 +108,7 @@ export default class Judge {
|
||||
serial,
|
||||
type
|
||||
})
|
||||
await this.fileLog.setExamJudgeData(str)
|
||||
await this.fileLog?.setExamJudgeData(str)
|
||||
console.info(judgeTag, `人工扣分-${itemno}-${serial}`)
|
||||
}
|
||||
//人工操作项目
|
||||
@ -120,17 +120,17 @@ export default class Judge {
|
||||
itemno: Number(itemno),
|
||||
type
|
||||
})
|
||||
await this.fileLog.setExamJudgeData(str)
|
||||
await this.fileLog?.setExamJudgeData(str)
|
||||
console.info(judgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`)
|
||||
}
|
||||
private filePath: string
|
||||
private totalScore: number
|
||||
private filePath: string = ""
|
||||
private totalScore: number = -1
|
||||
private prevJd: number = 0
|
||||
private prevWd: number = 0
|
||||
private dwztNum: number = 0
|
||||
private folderPath: string
|
||||
private modelPath: string
|
||||
private avPlayer: VoiceAnnounce
|
||||
private folderPath: string = ""
|
||||
private modelPath: string = ""
|
||||
private avPlayer?: VoiceAnnounce
|
||||
// 处理特殊参数配置
|
||||
handleSEP = async (code: number) => {
|
||||
const judgeConfigObj = this.judgeUI.judgeConfigObj
|
||||
@ -140,34 +140,34 @@ export default class Judge {
|
||||
case 306:
|
||||
if (judgeConfigObj[code] == 5) {
|
||||
//靠边停车
|
||||
avPlayer.playAudio(['voice/406001.mp3'])
|
||||
avPlayer?.playAudio(['voice/406001.mp3'])
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
private carztStr: string
|
||||
private rmndg: 0 | 1
|
||||
private rmndg: 0 | 1 = 0
|
||||
private mndgStr: string | undefined
|
||||
// 模拟灯光
|
||||
setMndg = async (mndgStr: string) => {
|
||||
this.mndgStr = mndgStr
|
||||
}
|
||||
private xmmcStr: string
|
||||
private xmmcCode: string
|
||||
private xmmcSingleCode: string
|
||||
private xmmcStr: string = ""
|
||||
private xmmcCode: string = ""
|
||||
private xmmcSingleCode: string = ""
|
||||
private xmmcEndCode?: string
|
||||
private xmdm: string | number
|
||||
private xmxh: string
|
||||
private fileModel: FileModel
|
||||
private filePhoto: FilePhoto
|
||||
private xmdm: string | number = ""
|
||||
private xmxh: string = ""
|
||||
private fileModel?: FileModel
|
||||
private filePhoto?: FilePhoto
|
||||
// 过程照片拍照
|
||||
getPhoto = async (empty?: boolean) => {
|
||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||
//单机模式返回空照片
|
||||
if (singlePlay) {
|
||||
return ''
|
||||
} else {
|
||||
const photoBase64 = await this.filePhoto.getPhoto();
|
||||
const photoBase64 = await this.filePhoto?.getPhoto();
|
||||
console.info(judgeTag, '拍照完成')
|
||||
return photoBase64
|
||||
}
|
||||
@ -188,7 +188,7 @@ export default class Judge {
|
||||
}
|
||||
const plcData = await this.getPlcData(msg);
|
||||
// 4.过程数据
|
||||
await this.fileLog.setExamJudgeData(JSON.stringify(plcData))
|
||||
await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
|
||||
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
||||
// if (this.usbService.isWXUSBDevice) {
|
||||
// const str = await senorToWXDataStr(msg);
|
||||
@ -202,7 +202,7 @@ export default class Judge {
|
||||
if (!this.isExamEnd) {
|
||||
await examJudgeRealExam(plcData)
|
||||
}
|
||||
let udpIndex = AppStorage.get<number>('udpIndex');
|
||||
let udpIndex = AppStorage.get<number>('udpIndex') || 0;
|
||||
if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
||||
// TODO UPD缺失
|
||||
// const judgeUdp = globalThis.judgeUdp
|
||||
@ -212,7 +212,7 @@ export default class Judge {
|
||||
AppStorage.setOrCreate('udpIndex', udpIndex++)
|
||||
}
|
||||
//是否手动结束考试
|
||||
private isManual: boolean
|
||||
private isManual: boolean = false
|
||||
//UDP服务序列号
|
||||
private serialIndex: number
|
||||
private fileUtil: FileUtils
|
||||
@ -222,10 +222,10 @@ export default class Judge {
|
||||
const judgeUI = this.judgeUI
|
||||
const fileUtil = this.fileUtil
|
||||
const fileLog = this.fileLog
|
||||
const carId = carInfo.carId
|
||||
const examinationRoomId = carInfo.examinationRoomId
|
||||
const carId = carInfo?.carId || ""
|
||||
const examinationRoomId = carInfo?.examinationRoomId || ""
|
||||
|
||||
const folderPath = fileLog.folderPath
|
||||
const folderPath = fileLog?.folderPath
|
||||
const base64 = new util.Base64();
|
||||
const time = GetCurrentTime();
|
||||
const endTime = GetCurrentTime(1)
|
||||
@ -258,20 +258,20 @@ export default class Judge {
|
||||
console.info(judgeTag, '过程数据文件上传 end')
|
||||
}
|
||||
private judgeTask: JudgeTask
|
||||
private tempData: Plc
|
||||
private tempData?: Plc
|
||||
//实时计算gps经纬度距离
|
||||
handDistance = async () => {
|
||||
const dwzt = this.tempData.gps.dwzt;
|
||||
const jdzt = this.tempData.gps.jdzt;
|
||||
const tJD = convertGpsCoord2(this.tempData.gps.jd)
|
||||
const tWD = convertGpsCoord2(this.tempData.gps.wd)
|
||||
const dwzt = this.tempData?.gps?.dwzt || "";
|
||||
const jdzt = this.tempData?.gps?.jdzt || "";
|
||||
const tJD = convertGpsCoord2(this.tempData?.gps?.jd || 0)
|
||||
const tWD = convertGpsCoord2(this.tempData?.gps?.wd || 0)
|
||||
if (this.prevJd && dwzt == 4 && jdzt == 3) {
|
||||
const distance = await examCalcGpsDistance({
|
||||
jd1: this.prevJd,
|
||||
wd1: this.prevWd,
|
||||
jd2: tJD,
|
||||
wd2: tWD,
|
||||
h: (this.tempData.gps.hxj) || 1,
|
||||
h: this.tempData?.gps?.hxj || 1,
|
||||
})
|
||||
// const distanceClass = AppStorage.get<DistanceClass>('distanceClass')
|
||||
// distanceClass?.setTimeData(Number(((distance / 100).toFixed(2))))
|
||||
@ -324,7 +324,7 @@ export default class Judge {
|
||||
(param302 != 6 && param302 != 7 && param302 != 8)) {
|
||||
if (param512[7] != 0) {
|
||||
clearTimeout(this.deductedPopShowTimer)
|
||||
avPlayer.playAudio(['voice/综合评判.mp3'])
|
||||
avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.judgeUI.isDeductedPopShow = true
|
||||
this.judgeUI.defaultTabIndex = 1
|
||||
this.isEndTip = true
|
||||
@ -350,7 +350,7 @@ export default class Judge {
|
||||
if (totalScore < passingGrade) {
|
||||
//科目三不合格报靠边停车
|
||||
if (examSubject == '3' && param302 == 1) {
|
||||
avPlayer.playAudio([`voice/考试结束.mp3`]);
|
||||
avPlayer?.playAudio([`voice/考试结束.mp3`]);
|
||||
return
|
||||
}
|
||||
await examJudgeEndExam()
|
||||
@ -383,7 +383,7 @@ export default class Judge {
|
||||
if (param512[7] != 0) {
|
||||
clearTimeout(this.deductedPopShowTimer)
|
||||
this.judgeUI.isDeductedPopShow = false
|
||||
avPlayer.playAudio(['voice/综合评判.mp3'])
|
||||
avPlayer?.playAudio(['voice/综合评判.mp3'])
|
||||
this.judgeUI.isDeductedPopShow = true
|
||||
this.judgeUI.defaultTabIndex = 1
|
||||
this.isEndTip = true
|
||||
@ -396,24 +396,24 @@ export default class Judge {
|
||||
}
|
||||
}
|
||||
}
|
||||
private ksjs: JudgeKSJS
|
||||
private kfArr: JudgeEventKf[]
|
||||
private ksjs?: JudgeKSJS
|
||||
private kfArr?: JudgeEventKf[]
|
||||
//所有的科目考试项目(大车&小车)
|
||||
private kmItems: JudgeConfigObjKmItems
|
||||
private plcData: Plc
|
||||
private plcData?: Plc
|
||||
// 获取plc数据
|
||||
getPlcData = async (plc: string) => {
|
||||
await this.fileLog.setPlcProgressData(plc)
|
||||
await this.fileLog?.setPlcProgressData(plc)
|
||||
//plc字符串转化成评判初始化数据
|
||||
const tempData = await plcStrToJson(plc);
|
||||
//模拟灯光回放时刻
|
||||
tempData.sensor.rmndg = this.rmndg;
|
||||
//模拟灯灯光灯光项目
|
||||
tempData.sensor.mndg = this.mndgStr;
|
||||
tempData.sensor.mndg = this.mndgStr || "";
|
||||
//plc字符串转化成无锡所过程数据
|
||||
const wuXiDataStr = await plcStrToWXJson(plc)
|
||||
this.plcData = tempData
|
||||
await this.fileLog.setExamJudgeWuxiProgressData(wuXiDataStr)
|
||||
await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr)
|
||||
this.tempData = tempData
|
||||
this.plcStr = plc;
|
||||
this.mndgStr = '';
|
||||
@ -463,13 +463,13 @@ export default class Judge {
|
||||
private isTrajectoryOpen: boolean;
|
||||
//当前科目二的考试项目
|
||||
// 调代理接口是否断网了
|
||||
private isJudgeDisConnect: boolean;
|
||||
private isJudgeDisConnect: boolean = false;
|
||||
// 断网数据补传
|
||||
uploadDisConnectData = async () => {
|
||||
if (!this.isJudgeDisConnect) {
|
||||
return
|
||||
}
|
||||
const folderPath = this.fileLog.folderPath
|
||||
const folderPath = this.fileLog?.folderPath
|
||||
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
|
||||
const examDataArr = examDataStr.split('\n');
|
||||
for (let examDataStr of examDataArr) {
|
||||
@ -488,13 +488,13 @@ export default class Judge {
|
||||
const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305')
|
||||
const drvexam: DrvexamType = {
|
||||
lsh: judgeUI.lsh,
|
||||
kskm: carInfo.examSubject,
|
||||
kskm: carInfo?.examSubject || "2",
|
||||
ksxm: project.projectCodeCenter,
|
||||
sfzmhm: judgeUI.idCard,
|
||||
kchp: encodeURI(carInfo.plateNo),
|
||||
kchp: encodeURI(carInfo?.plateNo || ""),
|
||||
zpsj: time,
|
||||
zp: photoBase64,
|
||||
cs: Math.floor((judgeConfig_305 == 0 ? plcData.gps.sd : plcData.sensor.cs) * 1.852),
|
||||
cs: Math.floor((judgeConfig_305 == 0 ? (plcData?.gps?.sd || 0) : (plcData?.sensor?.cs || 0)) * 1.852),
|
||||
ksdd: encodeURI(judgeUI.ksdd)
|
||||
}
|
||||
const data: RegulatoryInterfaceParams = {
|
||||
@ -507,14 +507,14 @@ export default class Judge {
|
||||
if (temp.code === 2300007) {
|
||||
this.isJudgeDisConnect = true
|
||||
}
|
||||
promptWxCode('17C54', temp.code)
|
||||
promptWxCode('17C54', temp.code || 0)
|
||||
console.info(judgeTag, '上传照片 end')
|
||||
}
|
||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||
private lane: LANE = {
|
||||
road: '', num: 0, count: 0
|
||||
}
|
||||
private videoData: RecordHandleType
|
||||
private videoData?: RecordHandleType
|
||||
private disConnectNum: number = 0;
|
||||
//调用监管接口
|
||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||
@ -547,12 +547,12 @@ export default class Judge {
|
||||
|
||||
const drvexam: DrvexamType = {
|
||||
lsh: judgeUI.lsh,
|
||||
kskm: carInfo.examSubject,
|
||||
kskm: carInfo?.examSubject || "2",
|
||||
sfzmhm: judgeUI.idCard,
|
||||
ksxm: project.projectCodeCenter,
|
||||
sbxh,
|
||||
ksxl: judgeUI.xldm,
|
||||
kchp: encodeURI(carInfo.plateNo),
|
||||
kchp: encodeURI(carInfo?.plateNo || ""),
|
||||
ksdd: encodeURI(judgeUI.ksdd),
|
||||
kslx: encodeURI(judgeUI.kslx) || '',
|
||||
kssj: time
|
||||
@ -569,7 +569,7 @@ export default class Judge {
|
||||
if (temp.code === 2300007) {
|
||||
this.isJudgeDisConnect = true;
|
||||
}
|
||||
promptWxCode('17C52', temp.code)
|
||||
promptWxCode('17C52', temp.code || 0)
|
||||
}
|
||||
// 项目结束接口同步
|
||||
endProject = async (ksxm: number) => {
|
||||
@ -581,14 +581,14 @@ export default class Judge {
|
||||
|
||||
const drvexam: DrvexamType = {
|
||||
lsh: judgeUI.lsh,
|
||||
kskm: carInfo.examSubject,
|
||||
kskm: carInfo?.examSubject || "2",
|
||||
sfzmhm: judgeUI.idCard,
|
||||
ksxm: project.projectCodeCenter,
|
||||
sbxh,
|
||||
//TODO 操作类型 1:正常 0:撤销该考试记录
|
||||
czlx: '1',
|
||||
ksxl: judgeUI.xldm,
|
||||
kchp: encodeURI(carInfo.plateNo),
|
||||
kchp: encodeURI(carInfo?.plateNo || ""),
|
||||
ksdd: encodeURI(judgeUI.ksdd),
|
||||
kslx: encodeURI(judgeUI.kslx) || '',
|
||||
jssj: time
|
||||
@ -604,7 +604,7 @@ export default class Judge {
|
||||
this.isJudgeDisConnect = true;
|
||||
}
|
||||
console.info(judgeTag, '项目结束 end')
|
||||
promptWxCode('17C55', temp.code)
|
||||
promptWxCode('17C55', temp.code || 0)
|
||||
}
|
||||
// 检测扣分、结束项目时该项目是否开始
|
||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
|
||||
@ -613,7 +613,7 @@ export default class Judge {
|
||||
}
|
||||
const judgeUI = this.judgeUI;
|
||||
const judgeTask = this.judgeTask;
|
||||
const projectsObj = this.judgeUI.projectsObj
|
||||
const projectsObj: object = this.judgeUI.projectsObj
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const isUpload = currentProject.isUpload
|
||||
|
||||
@ -637,7 +637,7 @@ export default class Judge {
|
||||
//扣分补传
|
||||
if (currentType == 2) {
|
||||
judgeTask.addTask(async () => {
|
||||
await this.pointsDedute(xmdm, kf)
|
||||
await this.pointsDedute(xmdm, kf!)
|
||||
}, {
|
||||
isDelay: true
|
||||
})
|
||||
@ -713,15 +713,17 @@ export default class Judge {
|
||||
const carName = judgeUI.carName
|
||||
const systemparmArr = judgeUI.systemparmArr
|
||||
const carinfoArr = judgeUI.carinfoArr
|
||||
const examType = carInfo.examSubject == '2' ? 'km2' : 'km3'
|
||||
const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3'
|
||||
|
||||
let allitems: ItemInfo[] = [];
|
||||
if (judgeUI.examSubject == '2') {
|
||||
if (judgeUI.examSubject == '2' && itemInfoObj) {
|
||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
||||
const model = this.getModelData(`${examType}/${cdsb.modelKey}.txt`)
|
||||
const temp: ItemInfo = {
|
||||
xmdm: cdsb.xmdm, xmxh: cdsb.xmxh, model
|
||||
xmdm: cdsb?.xmdm||0,
|
||||
xmxh: cdsb?.xmxh||"",
|
||||
model:model||""
|
||||
}
|
||||
return temp
|
||||
})
|
||||
@ -734,14 +736,14 @@ export default class Judge {
|
||||
})
|
||||
const initInfo: JudgeInitObj = {
|
||||
sdkver: await examJudgeVersion(),
|
||||
appver: AppStorage.get<BaseInfoType>('baseInfo').version,
|
||||
kskm: Number(carInfo.examSubject),
|
||||
kchp: carInfo.plateNo,
|
||||
kchm: Number(carInfo.carId),
|
||||
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version||"",
|
||||
kskm: Number(carInfo?.examSubject||"2"),
|
||||
kchp: carInfo?.plateNo||"",
|
||||
kchm: Number(carInfo?.carId||""),
|
||||
kscx: carType,
|
||||
cxcode: '1',
|
||||
name: carName,
|
||||
carmodel: this.getModelData(`${examType}/${carType}.txt`),
|
||||
carmodel: this.getModelData(`${examType}/${carType}.txt`)||"",
|
||||
allitems,
|
||||
iteminfo: [],
|
||||
systemparm: systemparmArr,
|
||||
@ -769,8 +771,8 @@ export default class Judge {
|
||||
// 获取开始考试数据
|
||||
getJudgeBeginData = async () => {
|
||||
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
||||
const code = examinerInfo.code
|
||||
const examinerName = examinerInfo.name
|
||||
// const code = examinerInfo.code
|
||||
const examinerName = examinerInfo?.name||""
|
||||
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
const sczb = currentParams.sczb;
|
||||
@ -891,9 +893,9 @@ export default class Judge {
|
||||
this.rmndg = 1
|
||||
}
|
||||
this.judgeUI.currentXmdm = xmdm;
|
||||
const xmmcStr = project.name;
|
||||
const xmmcCode = project.projectCodeCenter;
|
||||
const xmmcSingleCode = project.projectCode;
|
||||
const xmmcStr = project.name||"";
|
||||
const xmmcCode = project.projectCodeCenter||"";
|
||||
const xmmcSingleCode = project.projectCode||"";
|
||||
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
||||
kmItem.status = 2;
|
||||
this.xmmcStr = xmmcStr;
|
||||
@ -904,13 +906,13 @@ export default class Judge {
|
||||
this.xmxh = xmxh;
|
||||
this.judgeUI.isProjectIn = true
|
||||
Reflect.set(this.judgeUI.projectsObj, xmdm, project)
|
||||
Reflect.set(this.kmItems, xmmcCode, kmItem)
|
||||
Reflect.set(this.kmItems, xmmcCode||0, kmItem)
|
||||
break;
|
||||
|
||||
//项目结束
|
||||
case 2: {
|
||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||
const xmmcCode = project.projectCodeCenter;
|
||||
const xmmcCode = project.projectCodeCenter||"";
|
||||
project.type = (xmjs.xmhg === 0 ? '4' : '3')
|
||||
|
||||
//计算项目是否全部结束
|
||||
@ -971,7 +973,7 @@ export default class Judge {
|
||||
//考试结束
|
||||
case 5:
|
||||
this.ksjs = ksjs;
|
||||
await fileLog.setExamJudgeData(JSON.stringify({
|
||||
await fileLog?.setExamJudgeData(JSON.stringify({
|
||||
method: 'examJudgeEndExam'
|
||||
}))
|
||||
break;
|
||||
@ -982,7 +984,7 @@ export default class Judge {
|
||||
const xmdm = xmqx.xmdm;
|
||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||
// const examSubject = this.judgeUI.examSubject
|
||||
const xmmcCode = project.projectCodeCenter;
|
||||
const xmmcCode = project.projectCodeCenter||"";
|
||||
// const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode);
|
||||
// avPlayer.playAudio([`voice/${voiceCode}.mp3`],true)
|
||||
project.type = '1'
|
||||
@ -1015,7 +1017,7 @@ export default class Judge {
|
||||
const xmdm = precast.xmdm
|
||||
const xmxh = precast.xmxh
|
||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||
const xmmcCode = project.projectCodeCenter
|
||||
const xmmcCode = project.projectCodeCenter||""
|
||||
const projectCode = project.projectCode
|
||||
// const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
|
||||
// const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode;
|
||||
|
||||
@ -23,7 +23,7 @@ export function deepClone<T>(target: T): T {
|
||||
const result: ESObject = Array.isArray(target) ? [] : {};
|
||||
const keys = Object.keys(target) as Array<keyof T>; //注解二
|
||||
keys.forEach(key => {
|
||||
// Reflect.set(result, key, deepClone(Reflect.get(target, key)));
|
||||
Reflect.set(result, key, deepClone(Reflect.get(target, key)));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -453,58 +453,60 @@ export const plcStrToJson = async (plc: string) => {
|
||||
const plcArr = plc.split(',')
|
||||
const p = plcArr.map((val, key) => {
|
||||
if (key !== 27 && key !== 92) {
|
||||
return Number(val)
|
||||
return Number(val);
|
||||
} else {
|
||||
return 0; // 或者返回 undefined,根据需求选择
|
||||
}
|
||||
});
|
||||
const time = await systemTime.getCurrentTime()
|
||||
|
||||
|
||||
const sensor: Sensor = {
|
||||
//安全带 车门门开关 手刹 脚刹 副刹 离合器 喇叭 示宽灯 近光灯 远光灯
|
||||
aqd: p[19],
|
||||
mkg: p[14],
|
||||
ssc: p[13],
|
||||
jsc: p[12],
|
||||
fsc: p[18],
|
||||
lhq: p[17],
|
||||
lb: p[4],
|
||||
skd: p[9],
|
||||
jgd: p[7],
|
||||
ygd: p[8],
|
||||
//左方向灯 右方向灯 双跳灯 雾灯 雨刮器 点火1 点火2 发动机转速 档位 车速
|
||||
zfxd: p[2],
|
||||
yfxd: p[3],
|
||||
shtd: p[20],
|
||||
wd: p[10],
|
||||
ygq: p[11],
|
||||
dh1: p[5],
|
||||
dh2: p[6],
|
||||
fdjzs: p[25],
|
||||
dw: p[28],
|
||||
cs: p[23],
|
||||
// 方向盘
|
||||
fxp: Number(plcArr[27].split('_')[0]),
|
||||
//累计脉冲 溜车脉冲 超声波左后 超声波右后 超声波右前 超声波左前 座椅 仪表盘 后视镜 倒车镜 光照 雨量
|
||||
ljmc: p[24],
|
||||
lcmc: 0,
|
||||
csbzh: p[32],
|
||||
csbyh: p[30],
|
||||
csbyq: p[31],
|
||||
csbzq: p[29],
|
||||
zy: 0,
|
||||
tbp: 0,
|
||||
hsj: 0,
|
||||
dcj: 0,
|
||||
gx: 0,
|
||||
yl: 0,
|
||||
//TODO 数据待替换 油压 闪灯 信号灯
|
||||
yy: 0,
|
||||
sde: 0,
|
||||
xhd: '',
|
||||
rmndg: 0,
|
||||
wav: 0,
|
||||
mndg: ''
|
||||
}
|
||||
// const sensor: Sensor = {
|
||||
// //安全带 车门门开关 手刹 脚刹 副刹 离合器 喇叭 示宽灯 近光灯 远光灯
|
||||
// aqd: p[19],
|
||||
// mkg: p[14],
|
||||
// ssc: p[13],
|
||||
// jsc: p[12],
|
||||
// fsc: p[18],
|
||||
// lhq: p[17],
|
||||
// lb: p[4],
|
||||
// skd: p[9],
|
||||
// jgd: p[7],
|
||||
// ygd: p[8],
|
||||
// //左方向灯 右方向灯 双跳灯 雾灯 雨刮器 点火1 点火2 发动机转速 档位 车速
|
||||
// zfxd: p[2],
|
||||
// yfxd: p[3],
|
||||
// shtd: p[20],
|
||||
// wd: p[10],
|
||||
// ygq: p[11],
|
||||
// dh1: p[5],
|
||||
// dh2: p[6],
|
||||
// fdjzs: p[25],
|
||||
// dw: p[28],
|
||||
// cs: p[23],
|
||||
// // 方向盘
|
||||
// fxp: Number(plcArr[27].split('_')[0]),
|
||||
// //累计脉冲 溜车脉冲 超声波左后 超声波右后 超声波右前 超声波左前 座椅 仪表盘 后视镜 倒车镜 光照 雨量
|
||||
// ljmc: p[24],
|
||||
// lcmc: 0,
|
||||
// csbzh: p[32],
|
||||
// csbyh: p[30],
|
||||
// csbyq: p[31],
|
||||
// csbzq: p[29],
|
||||
// zy: 0,
|
||||
// tbp: 0,
|
||||
// hsj: 0,
|
||||
// dcj: 0,
|
||||
// gx: 0,
|
||||
// yl: 0,
|
||||
// //TODO 数据待替换 油压 闪灯 信号灯
|
||||
// yy: 0,
|
||||
// sde: 0,
|
||||
// xhd: '',
|
||||
// rmndg: 0,
|
||||
// wav: 0,
|
||||
// mndg: ''
|
||||
// }
|
||||
const gps2: Gps = testRealExam.gps2
|
||||
const radar: Radar = testRealExam.radar
|
||||
const vision: Vision = testRealExam.vision
|
||||
@ -593,6 +595,8 @@ export const plcStrToWXJson = async (plc: string) => {
|
||||
const p = plc.split(',').map((val, key) => {
|
||||
if (key !== 27 && key !== 92) {
|
||||
return Number(val)
|
||||
}else{
|
||||
return 0
|
||||
}
|
||||
});
|
||||
const timeStr = p[93] + '' + p[94];
|
||||
|
||||
@ -41,8 +41,8 @@ function plcStrToWXCodeArr(wuXiDataStr: string) {
|
||||
|
||||
export default class UsbService {
|
||||
public isWXUSBDevice: Boolean
|
||||
private devicepipe: usb.USBDevicePipe
|
||||
private outEndpoint: usb.USBEndpoint
|
||||
private devicepipe?: usb.USBDevicePipe
|
||||
private outEndpoint?: usb.USBEndpoint
|
||||
sendUSB = async (wuXiDataStr: string) => {
|
||||
console.info(UsbTag, '正在发送数据')
|
||||
console.info(UsbTag, '正在发送数据')
|
||||
@ -110,7 +110,7 @@ export default class UsbService {
|
||||
constructor() {
|
||||
//是否是无锡检测设备
|
||||
this.isWXUSBDevice = false
|
||||
this.devicepipe
|
||||
// this.devicepipe
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
"hvigorVersion": "3.2.4",
|
||||
"modelVersion": "5.0.0",
|
||||
"dependencies": {
|
||||
"@ohos/hvigor-ohos-plugin": "3.2.4"
|
||||
},
|
||||
"execution": {
|
||||
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,19 +1,26 @@
|
||||
{
|
||||
"lockfileVersion": 2,
|
||||
"meta": {
|
||||
"stableOrder": true
|
||||
},
|
||||
"lockfileVersion": 3,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {
|
||||
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3",
|
||||
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19"
|
||||
},
|
||||
"packages": {
|
||||
"@ohos/hypium@1.0.19": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
|
||||
"@ohos/crypto-js@2.0.3": {
|
||||
"name": "@ohos/crypto-js",
|
||||
"version": "2.0.3",
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
|
||||
"registryType": "ohpm"
|
||||
},
|
||||
"@ohos/crypto-js@2.0.3": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
|
||||
"@ohos/hypium@1.0.19": {
|
||||
"name": "@ohos/hypium",
|
||||
"version": "1.0.19",
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
|
||||
"registryType": "ohpm"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user