diff --git a/Makefile b/Makefile index 3fa94dc..d16f2bc 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,2 @@ gitLog: - git log --since="2025-06-30 17:14" --until="2025-07-2 17:35" --pretty=format:"
%n %s%n [提交人]:%an
%n [提交时间]:%ad
%n [提交版本]:%h%n
%n" --date=format:"%Y-%m-%d %H:%M" > release_note.md \ No newline at end of file + git log --since="2025-06-30 17:14" --until="2025-07-15 10:00" --pretty=format:"
%n %s%n [提交人]:%an
%n [提交时间]:%ad
%n [提交版本]:%h%n
%n" --date=format:"%Y-%m-%d %H:%M" > release_note.md \ No newline at end of file diff --git a/entry/src/main/ets/model/Worker.ets b/entry/src/main/ets/model/Worker.ets index 1386300..1f6c2c0 100644 --- a/entry/src/main/ets/model/Worker.ets +++ b/entry/src/main/ets/model/Worker.ets @@ -44,8 +44,6 @@ export enum WorkerMessageType { Init = 'init', // 初始化过程数据,初始化到人员以及人员里面各个目录 ProcessDataInit = 'processDataInit', - // 打开过程数据文件 - OpenProcessDataFile = 'openProcessDataFile', // 初始化考试过程 ExamProcessInit = 'examProcessInit' } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 872a69d..8039f34 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -19,6 +19,7 @@ import Prompt from '@system.prompt'; import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker'; import { dConsole } from '../utils/LogWorker'; import CarLoadingComponent from './Index/Loading'; +import { CreateFile } from '../utils/Common'; @Entry @Component @@ -77,6 +78,7 @@ struct Index { async onPageShow(): Promise { dConsole.log("权限首页 onPageShow2") + CreateFile("/mnt/hmdfs/100/account/device_view/local/files/duolun/logs/test.text") if (!this.isPlay) { this.avPlayer.playAudio(['welcome.wav']) this.isPlay = true diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 309bd87..a39aa34 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -35,7 +35,7 @@ import { } from '../model'; import { BusinessError } from '@ohos.base'; import { GetSyncData, SqlInsertTable } from '../utils/table/Operation'; -import { GetCurrentUserKeyValue } from './UserInfo/utils'; +import { GetCurrentUserKeyValue, InitializeExamProcessData } from './UserInfo/utils'; import dayTs from '../utils/Date'; import { GetCurrentTime, NumberToByteArray } from '../utils/Common'; import DB from '../utils/DbSql'; @@ -174,10 +174,12 @@ struct UserInfoPage { } if (this.singlePlay) { this.currentUser.id = '0' - dConsole.log('开始考试') + dConsole.log('开始考试3') SqlInsertTable('USER', [this.currentUser]).catch((e: BusinessError) => { dConsole.log("error", JSON.stringify(e)) }) + // 初始化开始考试过程数据文件夹 + InitializeExamProcessData(this.currentUser) router.pushUrl({ url: this.carInfo.examSubject == '3' ? 'pages/Roads' : 'pages/Judge', params: { @@ -342,8 +344,11 @@ struct UserInfoPage { AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo) AppStorage.setOrCreate('lsh', res.lsh) // const { examSubject } = this.carInfo; + dConsole.log("开始考试2") if (this.singlePlay) { this.stopDeviceById() + // 初始化开始考试过程数据文件夹 + InitializeExamProcessData(this.currentUser) router.pushUrl({ url: this.carInfo.examSubject == "3" ? 'pages/Roads' : 'pages/Judge', params: { @@ -874,6 +879,8 @@ struct UserInfoPage { await SqlInsertTable('USER', [this.currentUser]) this.stepFlag = false this.startExamDialogController.close() + // 初始化开始考试过程数据文件夹 + InitializeExamProcessData(this.currentUser) router.pushUrl({ url: 'pages/Judge', params: { diff --git a/entry/src/main/ets/pages/UserInfo/utils.ets b/entry/src/main/ets/pages/UserInfo/utils.ets index cc4f57f..9daae01 100644 --- a/entry/src/main/ets/pages/UserInfo/utils.ets +++ b/entry/src/main/ets/pages/UserInfo/utils.ets @@ -1,4 +1,7 @@ +import { UserInfoTag } from '../../config'; import { User } from '../../model'; +import dayTs from '../../utils/Date'; +import { dConsole } from '../../utils/LogWorker'; export const GetCurrentUserKeyValue = (user: User, key: string): string => { switch (key) { @@ -51,4 +54,14 @@ export const GetCurrentUserKeyValue = (user: User, key: string): string => { default: return ''; } +} + +export const InitializeExamProcessData = (user: User) => { + // 初始化考试过程数据 + // 2025_07_04_11_35_26_0000000000000_342323199501470011_测试学员1 + let date = dayTs().format("YYYY_MM_DD_HH_mm_ss") + const examDir: string = date + "_" + user.lsh + "_" + user.sfzmhm + "_" + user.xm + dConsole.log(UserInfoTag, "过程数据文件夹名", examDir) + dConsole.initExam(examDir) + dConsole.log("开始考试1") } \ No newline at end of file diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ets b/entry/src/main/ets/pages/judgeSDK/judge.ets index 737be65..3602465 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ets +++ b/entry/src/main/ets/pages/judgeSDK/judge.ets @@ -230,37 +230,6 @@ export default class Judge { dConsole.info(JudgeTag, '过程数据文件上传 end') } private judgeTask: JudgeTask - // 处理udp plc信号 - handleUdp = async (msg: string) => { - const stachArr = msg.split(',') - if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { - return - } - const plcData = await this.getPlcData(msg); - // 4.过程数据 - await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) - //检测到有无锡所设备接入,需要发送特定的数据,供检测 - // if (this.usbService.isWXUSBDevice) { - // const str = await senorToWXDataStr(msg); - // this.usbService.sendUSB(str) - // } - const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350') - this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + '' - this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' - //TODO 暂时关闭差分检测异常 - // await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt); - if (!this.isExamEnd) { - await examJudgeRealExam(plcData) - } - // let udpIndex = AppStorage.get('udpIndex') || 0; - // if (udpIndex % 5 === 0 && !this.isUdpEnd) { - // TODO UPD缺失 - // const judgeUdp = globalThis.judgeUdp - // const bytes = await this.getMessageHeartbeat(this.isExamEnd); - // judgeUdp.send(bytes) - // } - // AppStorage.setOrCreate('udpIndex', udpIndex++) - } // 检测扣分、结束项目时该项目是否开始 checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => { if (xmdm == 20) { @@ -338,6 +307,116 @@ export default class Judge { this.prevWd = tWD; } private performInfo?: JudgePerformInfo + private ksjs?: JudgeKSJS + private kfArr?: MarkRule[] + //所有的科目考试项目(大车&小车) + private kmItems: JudgeConfigObjKmItems + private plcData?: PLCType + // 处理udp plc信号 + handleUdp = async (msg: string) => { + const stachArr = msg.split(',') + if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { + return + } + const plcData = await this.getPlcData(msg); + // 4.过程数据 + await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) + //检测到有无锡所设备接入,需要发送特定的数据,供检测 + // if (this.usbService.isWXUSBDevice) { + // const str = await senorToWXDataStr(msg); + // this.usbService.sendUSB(str) + // } + const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350') + this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + '' + this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' + //TODO 暂时关闭差分检测异常 + // await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt); + if (!this.isExamEnd) { + await examJudgeRealExam(plcData) + } + // let udpIndex = AppStorage.get('udpIndex') || 0; + // if (udpIndex % 5 === 0 && !this.isUdpEnd) { + // TODO UPD缺失 + // const judgeUdp = globalThis.judgeUdp + // const bytes = await this.getMessageHeartbeat(this.isExamEnd); + // judgeUdp.send(bytes) + // } + // AppStorage.setOrCreate('udpIndex', udpIndex++) + } + // 获取plc数据 + getPlcData = async (plc: string) => { + await this.fileLog?.setPlcProgressData(plc) + //plc字符串转化成评判初始化数据 + const tempData = await PlcStrToJson(plc); + //模拟灯光回放时刻 + tempData.sensor.rmndg = this.rmndg; + //模拟灯灯光灯光项目 + tempData.sensor.mndg = this.mndgStr || ""; + //plc字符串转化成无锡所过程数据 + const wuXiDataStr = await PlcStrToWXJson(plc) + this.plcData = tempData + await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr) + this.tempData = tempData + this.plcStr = plc; + this.mndgStr = ''; + this.rmndg = 0; + AppStorage.setOrCreate('msgStr', plc) + return tempData + } + // 处理轨迹plc信号 + handleTrajectoryUdp = async (strArr: string[]) => { + let num = 2; + const judgeTimer = setInterval(async () => { + const msgStr = strArr[num]; + if (msgStr == '') { + dConsole.info(JudgeTag, '模拟数据考试结束') + clearInterval(judgeTimer) + this.checkExamIsEnd(true) + return + } + const msg: PLCType = JSON.parse(strArr[num]); + num++ + // 4.过程数据 + this.tempData = msg + this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3); + this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + ''; + this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + '' + this.plcData = msg + // this.judgeUI.isDwztRight = msg.gps.dwzt == 4; + AppStorage.setOrCreate('msgStr', '') + if (msg.method === 'examJudgeArtificialItem') { + this.setJudgeItem(msg.itemno, msg.type) + } + if (msg.method === 'examJudgeArtificialMark') { + this.setJudgeItem(msg.itemno, msg.serial) + } + await examJudgeRealExam(msg) + // const bytes = await this.getMessageHeartbeat(); + // bytes && globalThis.judgeUdp.send(bytes) + + }, 200) + // TODO 定时器缺失 + // globalThis.judgeTimer = judgeTimer; + } + private isEndTip: boolean = false; + //本地轨迹回放地址 + private trajectoryPath: string + // private currentKm2ItemsObj: any + private isTrajectoryOpen: boolean; + // 调代理接口是否断网了 + private isJudgeDisConnect: boolean = false; + // 断网数据补传 + uploadDisConnectData = async () => { + if (!this.isJudgeDisConnect) { + return + } + 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) { + const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context); + } + } // 校验考试是否结束 checkExamIsEnd = async (isManual?: boolean) => { dConsole.log(JudgeTag, "校验考试是否结束") @@ -453,86 +532,14 @@ export default class Judge { } } } - private ksjs?: JudgeKSJS - private kfArr?: MarkRule[] - //所有的科目考试项目(大车&小车) - private kmItems: JudgeConfigObjKmItems - private plcData?: PLCType - // 获取plc数据 - getPlcData = async (plc: string) => { - await this.fileLog?.setPlcProgressData(plc) - //plc字符串转化成评判初始化数据 - const tempData = await PlcStrToJson(plc); - //模拟灯光回放时刻 - tempData.sensor.rmndg = this.rmndg; - //模拟灯灯光灯光项目 - tempData.sensor.mndg = this.mndgStr || ""; - //plc字符串转化成无锡所过程数据 - const wuXiDataStr = await PlcStrToWXJson(plc) - this.plcData = tempData - await this.fileLog?.setExamJudgeWuxiProgressData(wuXiDataStr) - this.tempData = tempData - this.plcStr = plc; - this.mndgStr = ''; - this.rmndg = 0; - AppStorage.setOrCreate('msgStr', plc) - return tempData - } - private isEndTip: boolean = false; - // 处理轨迹plc信号 - handleTrajectoryUdp = async (strArr: string[]) => { - let num = 2; - const judgeTimer = setInterval(async () => { - const msgStr = strArr[num]; - if (msgStr == '') { - dConsole.info(JudgeTag, '模拟数据考试结束') - clearInterval(judgeTimer) - this.checkExamIsEnd(true) - return - } - const msg: PLCType = JSON.parse(strArr[num]); - num++ - // 4.过程数据 - this.tempData = msg - this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3); - this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + ''; - this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + '' - this.plcData = msg - // this.judgeUI.isDwztRight = msg.gps.dwzt == 4; - AppStorage.setOrCreate('msgStr', '') - if (msg.method === 'examJudgeArtificialItem') { - this.setJudgeItem(msg.itemno, msg.type) - } - if (msg.method === 'examJudgeArtificialMark') { - this.setJudgeItem(msg.itemno, msg.serial) - } - await examJudgeRealExam(msg) - // const bytes = await this.getMessageHeartbeat(); - // bytes && globalThis.judgeUdp.send(bytes) - - }, 200) - // TODO 定时器缺失 - // globalThis.judgeTimer = judgeTimer; - } - //本地轨迹回放地址 - private trajectoryPath: string - // private currentKm2ItemsObj: any - private isTrajectoryOpen: boolean; //当前科目二的考试项目 - // 调代理接口是否断网了 - private isJudgeDisConnect: boolean = false; - // 断网数据补传 - uploadDisConnectData = async () => { - if (!this.isJudgeDisConnect) { - return - } - 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) { - const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context); - } + private deductedPopShowTimer: number = 0; + private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] + private lane: LANE = { + road: '', num: 0, count: 0 } + private videoData?: RecordHandleType + private disConnectNum: number = 0; // 项目开始接口同步 beginProject = async (ksxm: number) => { const carInfo = AppStorage.get('carInfo'); @@ -636,13 +643,6 @@ export default class Judge { UploadRegulatoryCodeConversion('17C54', temp.code || 0) dConsole.info(JudgeTag, '上传照片 end') } - private deductedPopShowTimer: number = 0; - private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] - private lane: LANE = { - road: '', num: 0, count: 0 - } - private videoData?: RecordHandleType - private disConnectNum: number = 0; //调用监管接口 sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => { const temp = await writeObjectOut(data, filePath, this.context); diff --git a/entry/src/main/ets/utils/Common.ets b/entry/src/main/ets/utils/Common.ets index b14e8d3..d70858e 100644 --- a/entry/src/main/ets/utils/Common.ets +++ b/entry/src/main/ets/utils/Common.ets @@ -222,9 +222,16 @@ export function CreateDir(path: string): Promise { * @params path 文件具体路径 * @return 返回一个Promise */ -export function CreateFile(path: string): Promise { +export function CreateFile(path: string): Promise { return new Promise((resolve, reject) => { - + try { + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.APPEND | fs.OpenMode.CREATE) + console.log(CommonFileTag, "创建文件成功", path) + resolve(file.fd) + } catch (e) { + console.log(CommonFileTag, "创建文件失败") + reject(-1) + } }) } diff --git a/entry/src/main/ets/utils/LogWorker.ets b/entry/src/main/ets/utils/LogWorker.ets index dbfe86d..6232519 100644 --- a/entry/src/main/ets/utils/LogWorker.ets +++ b/entry/src/main/ets/utils/LogWorker.ets @@ -44,7 +44,7 @@ class logWorker { console.log(`当前环境配置初始化: ${isOpenLog}`); this.isLogEnabled = isOpenLog; if (this.isLogEnabled === "1") { - this.workerInstance = new worker.ThreadWorker("entry/ets/workers/Log.ets"); + this.workerInstance = new worker.ThreadWorker("entry/ets/workers/Log.ets") let data: LogWorkerMessage = { type: WorkerMessageType.Init } @@ -52,6 +52,17 @@ class logWorker { } } + // 初始化考试过程数据文件夹以及文件 + initExam(dirName: string) { + let data: LogWorkerMessage = { + type: WorkerMessageType.ExamProcessInit, + studentDirName: dirName + } + if (this.isLogEnabled === "1") { + this.workerInstance?.postMessage(JSON.stringify(data)) + } + } + // 过程数据初始化 processDataInit(carNo: string, name: string) { let date = dayTs().format("YYYY_MM_DD_HH_mm_ss"); diff --git a/entry/src/main/ets/workers/Log.ets b/entry/src/main/ets/workers/Log.ets index a703d79..bdea06e 100644 --- a/entry/src/main/ets/workers/Log.ets +++ b/entry/src/main/ets/workers/Log.ets @@ -1,11 +1,12 @@ import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker'; import { GlobalConfig } from '../config'; import { LogFileFd, LogPathType, LogWorkerMessage, WorkerMessageType } from '../model'; -import { CreateDir, IsExit } from '../utils/Common'; +import { CreateDir, CreateFile, IsExit } from '../utils/Common'; import dayTs from '../utils/Date'; const workerPort: ThreadWorkerGlobalScope = worker.workerPort; - +const fileNameArr: string[] = ["four_one_log_byte_data.text", "four_one_log_data.txt", "judge_exam_data.txt", "judge_log_data.txt", "judge_progress_callback_data.txt", "plc_data.txt", "wuxi_exam_data.txt", "wuxi_progress_data.txt"] +let fileFdArr: number[] = [] workerPort.onmessage = (e: MessageEvents) => { console.log("日志系统worker收到消息") // 日志文件目录 @@ -18,9 +19,6 @@ workerPort.onmessage = (e: MessageEvents) => { if (result.type === WorkerMessageType.Init) { InitLog() } - if (result.type === WorkerMessageType.OpenProcessDataFile) { - OpenProcessDataFile(logPaths, logFileFd, result.data || "") - } if (result.type === WorkerMessageType.ExamProcessInit && result.studentDirName) { InitExam(result.studentDirName) } @@ -69,13 +67,14 @@ async function InitExam(dirName: string) { await CreateDir(path); } // 创建几个文件 - let fileNameArr: string[] = ["four_one_log_byte_data.text", "four_one_log_data.txt", "judge_exam_data.txt", "judge_log_data.txt", "judge_progress_callback_data.txt", "plc_data.txt", "wuxi_exam_data.txt", "wuxi_progress_data.txt"] - + fileNameArr.forEach(async (item: string, index: number) => { + let filePath = path + "/" + item + console.log("创建文件", filePath) + let result = await CreateFile(filePath) + fileFdArr[index] = result + }) } -function OpenProcessDataFile(logPaths: LogPathType, logFileFd: LogFileFd, name: string) { - -} workerPort.onmessageerror = (e: MessageEvents) => { } diff --git a/release_note.md b/release_note.md index d86fd2a..fc8d9c6 100644 --- a/release_note.md +++ b/release_note.md @@ -1,3 +1,38 @@ +
+ fix: 隐藏部分快速打印 + [提交人]:wangzhongjie
+ [提交时间]:2025-07-14 13:23
+ [提交版本]:78be17b +
+ +
+ fix: 增加request打印请求信息 + [提交人]:wangzhongjie
+ [提交时间]:2025-07-04 16:31
+ [提交版本]:8838072 +
+ +
+ fix: 后置机拿不到信号问题 + [提交人]:wangzhongjie
+ [提交时间]:2025-06-26 14:27
+ [提交版本]:a52a13e +
+ +
+ fix: 优化打印以及评判一个弹窗问题 + [提交人]:wangzhongjie
+ [提交时间]:2025-07-04 13:49
+ [提交版本]:7bd3689 +
+ +
+ fix: 增加一些日志 + [提交人]:wangzhongjie
+ [提交时间]:2025-07-04 10:50
+ [提交版本]:af8b112 +
+
fix: 优化首页获取车辆后才可以进入联网以及单机逻辑 [提交人]:wangzhongjie