From 98e17164e10ad29f32593d0a34f540d808d09dec Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Wed, 15 Oct 2025 10:31:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=80=83=E8=AF=95=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/oh-package-lock.json5 | 2 +- entry/src/main/ets/config/LogEnum.ets | 3 + entry/src/main/ets/config/judge.ets | 2 +- entry/src/main/ets/model/Judge.ets | 2 +- entry/src/main/ets/model/ProcessData.ets | 38 +++++++++ entry/src/main/ets/model/index.ets | 4 +- entry/src/main/ets/pages/Judge.ets | 2 +- .../ets/pages/Judge/BaseJudgeBussines.ets | 83 ++++++++----------- .../ets/pages/Judge/ProcessDataProcessing.ets | 42 ++++++++-- .../ets/pages/Judge/ProcessDataTaskPool.ets | 71 ++++++---------- entry/src/main/ets/utils/UdpUtils.ets | 2 +- .../business/DifferentialAndSignalWorker.ets | 4 +- .../ets/utils/business/DifferentialSignal.ets | 4 +- .../ets/workers/DifferentialCorrection.ets | 10 +-- entry/src/main/ets/workers/Log.ets | 2 +- oh-package-lock.json5 | 18 ++-- 16 files changed, 163 insertions(+), 126 deletions(-) create mode 100644 entry/src/main/ets/model/ProcessData.ets diff --git a/entry/oh-package-lock.json5 b/entry/oh-package-lock.json5 index d5892e3..3f4c904 100644 --- a/entry/oh-package-lock.json5 +++ b/entry/oh-package-lock.json5 @@ -1,5 +1,5 @@ { - "lockfileVersion": 1, + "lockfileVersion": 2, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": {}, "packages": {} diff --git a/entry/src/main/ets/config/LogEnum.ets b/entry/src/main/ets/config/LogEnum.ets index 7c46ca2..0407a07 100644 --- a/entry/src/main/ets/config/LogEnum.ets +++ b/entry/src/main/ets/config/LogEnum.ets @@ -84,3 +84,6 @@ export const StartEndExamTag = '[StartEndExam]'; // Queue export const QueueTag = '[Queue]' +// 考试过程数据 +export const ExamProcessDataTag = '[ExamProcessData]'; + diff --git a/entry/src/main/ets/config/judge.ets b/entry/src/main/ets/config/judge.ets index c022cf8..bbf2a18 100644 --- a/entry/src/main/ets/config/judge.ets +++ b/entry/src/main/ets/config/judge.ets @@ -16,7 +16,7 @@ export const JudgeConfig: JudgeConfigType = { //是否开启拍照 isPhotoOpen: true, //扣分语音是否强制开启 - kfVoiceOpen: true, + kfVoiceOpen: false, //忽略的考试项目 ignoreProjects: [], // 是否忽略考试前熄火、车门检查 diff --git a/entry/src/main/ets/model/Judge.ets b/entry/src/main/ets/model/Judge.ets index 9152da8..0a55b2c 100644 --- a/entry/src/main/ets/model/Judge.ets +++ b/entry/src/main/ets/model/Judge.ets @@ -818,7 +818,7 @@ export interface DistanceClass { export interface WR { message?: string - code?: string + code: string keystr?: string } diff --git a/entry/src/main/ets/model/ProcessData.ets b/entry/src/main/ets/model/ProcessData.ets new file mode 100644 index 0000000..dbe24a7 --- /dev/null +++ b/entry/src/main/ets/model/ProcessData.ets @@ -0,0 +1,38 @@ +/** + * 定义批次进度更新时的回调函数类型 + * @param totalTasks 本批次总任务数 + * @param completedTasks 已完成任务数 (成功 + 失败) + * @param successfulTasks 成功完成的任务数 + * @param failedTasks 失败的任务数 + * @param progressPercentage 当前进度百分比 (0-100) + */ +import { RegulatoryInterfaceParams, WR } from '.'; + +export type OnBatchProgressUpdateCallback = ( + totalTasks: number, + completedTasks: number, + successfulTasks: number, + failedTasks: number, + progressPercentage: number +) => void; + +/** + * 定义所有任务完成时的回调函数类型 + * @param totalTasks 本批次总任务数 + * @param completedTasks 已完成任务数 (成功 + 失败) + * @param successfulTasks 成功完成的任务数 + * @param failedTasks 失败的任务数 + */ +export type OnAllTasksCompletedCallback = ( + totalTasks: number, + completedTasks: number, + successfulTasks: number, + failedTasks: number +) => void; + +export type ProgressCallback = (data: WR) => void; + +export interface QueueTask { + data: RegulatoryInterfaceParams; + callback?: ProgressCallback; +} \ No newline at end of file diff --git a/entry/src/main/ets/model/index.ets b/entry/src/main/ets/model/index.ets index d60d364..620bdf1 100644 --- a/entry/src/main/ets/model/index.ets +++ b/entry/src/main/ets/model/index.ets @@ -20,4 +20,6 @@ export * from "./TableColumn" export * from "./Other" -export * from "./Worker" \ No newline at end of file +export * from "./Worker" + +export * from "./ProcessData" \ No newline at end of file diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 6329bf4..9629a0d 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -196,7 +196,7 @@ export struct JudgePage { }) laneSignalChange() { - dConsole.log("车道信号变化1", this.laneSignal) + // dConsole.log("车道信号变化1", this.laneSignal) } async aboutToDisappear() { diff --git a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets index 8b509e0..fd4a8a1 100644 --- a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets +++ b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets @@ -1,5 +1,4 @@ import { - CarInfoType, JudgeBeginObj, JudgeCallBackData, JudgeConfigObj, @@ -12,13 +11,14 @@ import { ProjectInfo, ProjectInfos, SYSTEM_PARAM, - User + User, + WR } from '../../model' import JudgeBusiness from './JudgeBusiness' import { JudgePage } from '../Judge' import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements' import { dConsole } from '../../utils/LogWorker' -import { JudgeConfig, JudgeTag } from '../../config' +import { ExamProcessDataTag, JudgeConfig, JudgeTag, QueueTag } from '../../config' import { examJudgeArtificialItem, examJudgeBeginExam, @@ -29,12 +29,11 @@ import { examJudgeSetRealExamCallback, examJudgeSoundEnd } from './JudgeSDKUtils' -import { DeductPoints, ProjectEnd, ProjectStart, UploadProgressPhoto } from './ProcessDataProcessing' +import { DeductPoints, ProjectEnd, ProjectStart, TheExamIsOver, UploadProgressPhoto } from './ProcessDataProcessing' import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video' import router from '@ohos.router' import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation' import { CurrentProjectConversion, DeductionProjectConversion, DetectingDifferences, GetCarStatus } from './utils' -import { ProcessDataTaskPoolInstance } from './ProcessDataTaskPool' export interface GetSysSetResult { @@ -129,13 +128,13 @@ export class BaseJudge { break; } case 2: { - dConsole.log(JudgeTag, "项目结束判定1") + dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定1") const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) const isStart = await this.checkProjectIsStart(xmdm, 2, judgeUI, that) if (isStart) { // 项目结束了就不再生成数据 - dConsole.info(JudgeTag + ' projectIsEnd =>', project.isEnd) + dConsole.info(JudgeTag, ExamProcessDataTag, ' 项目是否结束 =>', project.isEnd) if (!project.isEnd) { // judgeTask.addTask(async () => { // dConsole.info(JudgeTag, `项目结束-${xmdm}-${project.name}`) @@ -148,7 +147,7 @@ export class BaseJudge { ProjectEnd(xmdm, that.xmxh, judgeUI) } } - dConsole.log(JudgeTag, "项目结束判定3") + dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定3") try { const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); if (!judgeUI.isProjectIn) { @@ -183,16 +182,19 @@ export class BaseJudge { break } case 5: { - dConsole.log(JudgeTag, "考试结束") + dConsole.log(JudgeTag, QueueTag, "考试结束") const singlePlay = AppStorage.get('singlePlay') // 关闭录像 if (!singlePlay && that.videoData) { await endRecordVideo(that.videoData) } // TODO - ProcessDataTaskPoolInstance.setOnAllTasksCompletedCallback((data) => { - dConsole.log(JudgeTag, "考试结束判断", data) - }) + // ProcessDataTaskPoolInstance.setOnAllTasksCompletedCallback((data) => { + // if (event === 5) { + // dConsole.log(JudgeTag, QueueTag, "这才是考试结束判定") + // } + // dConsole.log(JudgeTag, QueueTag, "考试结束判断", data) + // }) // judgeTask.addTask(async () => { // dConsole.info(JudgeTag, '考试结束 start') // AppStorage.setOrCreate('isJudge', false) @@ -375,51 +377,36 @@ export class BaseJudge { } catch (e) { console.info(JudgeTag, JSON.stringify(e)) } + TheExamIsOver(judgeUI, that, async (res: WR) => { + dConsole.log(JudgeTag, ExamProcessDataTag, "考试结束接口完成", res) + const code = res.code!.toString() + if (code !== "1") { + that?.avPlayer?.playAudio(['voice/监管失败.mp3']) + judgeUI.errorMsg = decodeURIComponent(res?.message || "") + + if (code.toString() === "2300028" || code.toString() === "2300007") { + judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' + } + judgeUI.generateExamRecordsDialogController.close(); + return + } else { + await this.endExam(judgeUI, that) + } + }) await this.endExam(judgeUI, that) }) } // 考试结束 Todo async endExam(judgeUI: JudgePage, that: JudgeBusiness) { - const carInfo: CarInfoType = AppStorage.get("carInfo")! const singlePlay = judgeUI.singlePlay //TODO 断网考试结束补传 // await uploadDisConnectData(); - // const time = GetCurrentTime(); - // const photoBase64 = await getPhoto(); - // const {d1,d2,d3,d4,d5} = that.ksjs - // const data = { - // xtlb: '17', jkxlh: serialNumber, jkid: '17C56', - // drvexam: { - // lsh, - // kchp: encodeURI(plateNo), - // kskm: examSubject, - // sfzmhm: idCard, - // //@ts-ignore - // zp: photoBase64, - // jssj: time, - // kscj: (totalScore * 1) > 0 ? totalScore : 0, - // kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), - // // 1,22;2,560;3,128;4,0;5,0; - // dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'), - // } - // } + let backTimeOut = setTimeout(() => { router.back() }, 90 * 1000) - // const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath); - // promptWxCode('17C56', code) - // if (code != 1) { - // that.avPlayer.playAudio(['voice/监管失败.mp3']) - // judgeUI.errorMsg = decodeURIComponent(message) - // - // if (code == 2300028 || code == 2300007) { - // judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' - // } - // judgeUI.generateExamRecordsDialogController.close(); - // return - // } console.info(JudgeTag, '考试结束 end') const param302 = judgeUI.judgeConfigObj.param_302; let currentKssycs = 0; @@ -470,7 +457,6 @@ export class BaseJudge { case 'voice/exam_pass.mp3': currentKssycs = 0; break; - } } @@ -589,7 +575,7 @@ export class BaseJudge { } //日志回调 dConsole.info(JudgeTag, '1.进入评判入口') - await examJudgeSetLogCallback(6, async (level: number, info: string, len: number) => { + await examJudgeSetLogCallback(1, async (level: number, info: string, len: number) => { dConsole.log(JudgeTag, '评判日志:' + info) dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info) }) @@ -612,7 +598,7 @@ export class BaseJudge { await this.judging(strData, callBack, judgeUI, that) }) await examJudgeSetPerformCallback(async (info: string) => { - dConsole.info('评判实时数据', info) + // dConsole.info('评判实时数据', info) that.performInfo = JSON.parse(info) const jl = Math.floor((that.performInfo!.qjjl + that.performInfo!.dcjl) / 100); if (jl > Number(judgeUI.examMileage)) { @@ -754,9 +740,6 @@ export class BaseJudge { case 5: { dConsole.info(JudgeTag, "考试结束") that.ksjs = ksjs; - // await fileLog?.setExamJudgeData(JSON.stringify({ - // method: 'examJudgeEndExam' - // })) dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ method: 'examJudgeEndExam' })) diff --git a/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets b/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets index 8de966d..603e0cf 100644 --- a/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets +++ b/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets @@ -1,7 +1,7 @@ /** * 过程数据处理 */ -import { ProcessDataTag, QueueTag } from '../../config'; +import { ExamProcessDataTag, ProcessDataTag, QueueTag } from '../../config'; import { CarInfoType, CDSBInfo, @@ -9,6 +9,7 @@ import { DrvexamType, MarkRule, PLCType, + ProgressCallback, ProjectInfo, RegulatoryInterfaceParams } from '../../model'; @@ -16,6 +17,7 @@ import { GetPhotoBase64 } from '../../utils/Common'; import dayTs from '../../utils/Date'; import { dConsole } from '../../utils/LogWorker'; import { JudgePage } from '../Judge'; +import JudgeBusiness from './JudgeBusiness'; import { ProcessDataTaskPoolInstance } from './ProcessDataTaskPool'; /** @@ -45,7 +47,7 @@ export const ProjectStart = (ksxm: number, xmxh: string, judgeUI: JudgePage) => jkid: '17C52', drvexam } - dConsole.log(ProcessDataTag, QueueTag, "项目开始数据处理", data) + dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "项目开始数据处理", data) ProcessDataTaskPoolInstance.addTask(data) } @@ -75,7 +77,7 @@ export const UploadProgressPhoto = async (ksxm: number, plcData: PLCType, judgeU jkid: '17C54', drvexam }; - dConsole.log(ProcessDataTag, QueueTag, "上传过程照片数据处理", data); + dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "上传过程照片数据处理", data); ProcessDataTaskPoolInstance.addTask(data) } @@ -138,7 +140,7 @@ export const DeductPoints = (ksxm: number, kf: MarkRule, xmmcEndCode: string, ju jkid: '17C53', drvexam } - dConsole.log(ProcessDataTag, QueueTag, "扣分上传数据", data) + dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "扣分上传数据", data) ProcessDataTaskPoolInstance.addTask(data) } @@ -170,10 +172,40 @@ export const ProjectEnd = (ksxm: number, xmxh: string, judgeUI: JudgePage) => { jkid: '17C55', drvexam } - dConsole.log(ProcessDataTag, QueueTag, "结束项目数据", data) + dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "结束项目数据", data) ProcessDataTaskPoolInstance.addTask(data) } +/** + * 考试结束接口 + * @returns + */ +export const TheExamIsOver = async (judgeUI: JudgePage, that: JudgeBusiness, callback: ProgressCallback) => { + const carInfo: CarInfoType = AppStorage.get("carInfo")! + const photoBase64 = await GetPhotoBase64(judgeUI.context); + const ksjs = that.ksjs! + const data: RegulatoryInterfaceParams = { + JGHOST: AppStorage.get("JGHOST") || "", + xtlb: '17', + jkxlh: judgeUI.serialNumber, + jkid: '17C56', + drvexam: { + lsh: judgeUI.lsh, + kchp: encodeURI(carInfo?.plateNo || ""), + kskm: carInfo?.examSubject || "2", + sfzmhm: judgeUI.idCard, + zp: photoBase64, + jssj: dayTs().format("YYYY-MM-DD HH:mm:ss"), + kscj: (judgeUI.totalScore * 1) > 0 ? judgeUI.totalScore : 0, + kslc: Math.ceil(((ksjs?.qjjl! + ksjs?.dcjl!) || 0) / 100), + dwlc: [ksjs.d1, ksjs.d2, ksjs.d3, ksjs.d4, ksjs!.d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`) + .join(';'), + } + } + dConsole.log(ProcessDataTag, QueueTag, ExamProcessDataTag, "考试结束数据", data) + ProcessDataTaskPoolInstance.addTask(data, callback) +} + const getSBXH = (ksxm: number, xmxh: string, cdsbInfoObj: CDSBInfos, projectsObj: object, examSubject: string): string => { const project: ProjectInfo = Reflect.get(projectsObj, ksxm); diff --git a/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets b/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets index 230edcd..bc46dfa 100644 --- a/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets +++ b/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets @@ -1,42 +1,22 @@ -import { RegulatoryInterfaceParams, WR, WuxiExamType } from '../../model'; +import { + OnAllTasksCompletedCallback, + OnBatchProgressUpdateCallback, + ProcessDataEnumType, + ProgressCallback, + QueueTask, + RegulatoryInterfaceParams, + WR, + WuxiExamType +} from '../../model'; import taskpool from '@ohos.taskpool'; import { QueueTag } from '../../config'; import http from '@ohos.net.http'; import Request from '../../utils/Request'; - -/** - * 定义批次进度更新时的回调函数类型 - * @param totalTasks 本批次总任务数 - * @param completedTasks 已完成任务数 (成功 + 失败) - * @param successfulTasks 成功完成的任务数 - * @param failedTasks 失败的任务数 - * @param progressPercentage 当前进度百分比 (0-100) - */ -export type OnBatchProgressUpdateCallback = ( - totalTasks: number, - completedTasks: number, - successfulTasks: number, - failedTasks: number, - progressPercentage: number -) => void; - -/** - * 定义所有任务完成时的回调函数类型 - * @param totalTasks 本批次总任务数 - * @param completedTasks 已完成任务数 (成功 + 失败) - * @param successfulTasks 成功完成的任务数 - * @param failedTasks 失败的任务数 - */ -export type OnAllTasksCompletedCallback = ( - totalTasks: number, - completedTasks: number, - successfulTasks: number, - failedTasks: number -) => void; +import { dConsole } from '../../utils/LogWorker'; export class ProcessDataTaskPool { - private queue: RegulatoryInterfaceParams[] = []; + private queue: QueueTask[] = []; private isProcessing: boolean = false; /** 最大重试次数。1次初次尝试 + 5次重试 = 总共6次尝试。 */ private readonly maxRetries = 5; @@ -77,9 +57,9 @@ export class ProcessDataTaskPool { * 进而影响 `onAllTasksCompletedCallback` 的触发时机和进度计算。 * @param dataItem 任务数据 */ - public addTask(dataItem: RegulatoryInterfaceParams): void { + public addTask(dataItem: RegulatoryInterfaceParams, callback?: ProgressCallback): void { console.info(QueueTag, `新任务已添加: ${JSON.stringify(dataItem)},当前队列长度: ${this.queue.length + 1}`); - this.queue.push(dataItem); // 将任务添加到队尾 + this.queue.push({ data: dataItem, callback: callback }); // 将任务添加到队尾 // 每次添加任务,增加当前批次的总任务数 this.totalTasksInCurrentBatch++; @@ -103,7 +83,9 @@ export class ProcessDataTaskPool { console.log(QueueTag, `启动处理器... 待处理任务数: ${this.queue.length}`); while (this.queue.length > 0) { - const taskData = this.queue[0]; // 查看队首任务 + const taskData = this.queue[0].data; // 查看队首任务 + const callback = this.queue[0].callback || (() => { + }); this.taskStartTime = Date.now(); // 记录任务开始时间 try { @@ -117,9 +99,9 @@ export class ProcessDataTaskPool { zp: "", }, }; - // dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(obj)); + dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(obj)); - await this.processSingleTaskWithRetries(taskData); + await this.processSingleTaskWithRetries(taskData, callback); // 任务成功 this.queue.shift(); @@ -140,7 +122,7 @@ export class ProcessDataTaskPool { // 检查是否所有任务都已处理完 if (this.queue.length === 0 && this.completedTasksInCurrentBatch === this.totalTasksInCurrentBatch) { - console.log(QueueTag, ' 所有任务处理完毕!'); + console.log(QueueTag, ' 所有任务处理完毕!"总数', this.totalTasksInCurrentBatch, "完成的"); this.onAllTasksCompletedCallback?.( this.totalTasksInCurrentBatch, this.completedTasksInCurrentBatch, @@ -199,20 +181,15 @@ export class ProcessDataTaskPool { return new Promise(resolve => setTimeout(resolve, ms)); } - private async processSingleTaskWithRetries(taskData: RegulatoryInterfaceParams): Promise { + private async processSingleTaskWithRetries(taskData: RegulatoryInterfaceParams, callback: ProgressCallback): Promise { for (let attempt = 0; attempt <= this.maxRetries; attempt++) { const attemptNum = attempt + 1; try { const attemptType = attempt === 0 ? '初次尝试' : `重试 ${attempt}`; console.log(QueueTag, `开始上传 (${attemptType}, 总共第 ${attemptNum} 次)`); - // dConsole.log(QueueTag, "需要上传的数据", taskData) - let data: RegulatoryInterfaceParams = { - JGHOST: "http://192.168.36.2:8081", - xtlb: "17" - } const result: WR = (await taskpool.execute(uploadWorkerTask, taskData)) as WR; - - // dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result)); + callback(result) + dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(result)); if (result.code === "1") { console.log(QueueTag, ` ✔️ 上传成功 (在第 ${attemptNum} 次尝试)`); return; // 成功,立即返回 @@ -259,7 +236,7 @@ export async function uploadWorkerTask(data: RegulatoryInterfaceParams): Promise data: ` ${data.xtlb} ${data.jkxlh} ${data.jkid} ${drvexamArr.join('')} ]]> `, method: http.RequestMethod.POST, xml: true - }) + }) as WR } const response = await sendProcessData(data, singlePlay, isJGNew); return response; diff --git a/entry/src/main/ets/utils/UdpUtils.ets b/entry/src/main/ets/utils/UdpUtils.ets index 348ed8a..35e7a1a 100644 --- a/entry/src/main/ets/utils/UdpUtils.ets +++ b/entry/src/main/ets/utils/UdpUtils.ets @@ -144,7 +144,7 @@ export default class UdpClient { private bindEvent() { this.udp?.on("message", value => { let result = this.dealMethod?.(value.message) - console.log(UDPTag, "udp获取消息", result) + // console.log(UDPTag, "udp获取消息", result) this.messageEvents.forEach(cb => { cb(result) }) diff --git a/entry/src/main/ets/utils/business/DifferentialAndSignalWorker.ets b/entry/src/main/ets/utils/business/DifferentialAndSignalWorker.ets index de8b6fd..d60780b 100644 --- a/entry/src/main/ets/utils/business/DifferentialAndSignalWorker.ets +++ b/entry/src/main/ets/utils/business/DifferentialAndSignalWorker.ets @@ -72,8 +72,8 @@ class differentialAndSignal { getMessage() { this.workerInstance.onmessage = (e: MessageEvents): void => { if (e.data) { - console.log(WorkerTag, "Worker 收到消息: " + e.data); - console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString()); + // console.log(WorkerTag, "Worker 收到消息: " + e.data); + // console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString()); this.events.forEach((callback) => { callback(e.data); }); diff --git a/entry/src/main/ets/utils/business/DifferentialSignal.ets b/entry/src/main/ets/utils/business/DifferentialSignal.ets index 058586c..5576c3f 100644 --- a/entry/src/main/ets/utils/business/DifferentialSignal.ets +++ b/entry/src/main/ets/utils/business/DifferentialSignal.ets @@ -31,7 +31,7 @@ class differentialSignal { // 组装消息,一秒发送五次 let data = "1"; this.timer = setInterval(() => { - dConsole.low(TCPTag, "发送给中心消息") + // dConsole.low(TCPTag, "发送给中心消息") this.differentialSignalTcp.sendMsg(data); }, 200); @@ -40,7 +40,7 @@ class differentialSignal { // 获取消息 getData(callback: (data: ArrayBuffer) => void) { this.differentialSignalTcp.onMsg((data: ArrayBuffer) => { - dConsole.low(TCPTag, "获取TCP消息", data); + // dConsole.low(TCPTag, "获取TCP消息", data); callback(data); }); } diff --git a/entry/src/main/ets/workers/DifferentialCorrection.ets b/entry/src/main/ets/workers/DifferentialCorrection.ets index ebb20ce..6eca20c 100644 --- a/entry/src/main/ets/workers/DifferentialCorrection.ets +++ b/entry/src/main/ets/workers/DifferentialCorrection.ets @@ -1,6 +1,6 @@ // 处理worker线程的消息tcp拿差分改正数,udp给后置机 import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker'; -import { SerialPortTag, WorkerTag } from '../config'; +import { WorkerTag } from '../config'; import { CenterCallBackMsgType, EnvironmentConfigurationType, @@ -68,17 +68,17 @@ function getDataFn(config: EnvironmentConfigurationType) { if (data !== "" && config.carType !== "2") { // TODO // 需要观察 - console.log(WorkerTag, "后置机消息", data) + // console.log(WorkerTag, "后置机消息", data) const res = await SerialPortService.getData() - console.log(SerialPortTag, "档位原始数据", res) + // console.log(SerialPortTag, "档位原始数据", res) if (res.length > 0) { const dataArray = data.split(","); // 替换data的第28位 dataArray[28] = res[9].toString(); data = dataArray.join(","); - console.log(SerialPortTag, "档位", res[9].toString()) + // console.log(SerialPortTag, "档位", res[9].toString()) } - console.log(SerialPortTag, "处理完的档位信号", data) + // console.log(SerialPortTag, "处理完的档位信号", data) workerPort.postMessage( JSON.stringify({ type: WorkerBackMessageType.ObtainUdpData, diff --git a/entry/src/main/ets/workers/Log.ets b/entry/src/main/ets/workers/Log.ets index 6597d54..ea336e7 100644 --- a/entry/src/main/ets/workers/Log.ets +++ b/entry/src/main/ets/workers/Log.ets @@ -13,7 +13,7 @@ let fileFdArr: number[] = [] let writeQueue: Array = []; let isProcessing = false; workerPort.onmessage = (e: MessageEvents) => { - console.log(LogTag, "日志系统worker收到消息") + // console.log(LogTag, "日志系统worker收到消息") // 日志文件目录 let logPaths: LogPathType = { log: `${GlobalConfig.commonFileWriteAddress}/logs/${dayTs().format("YYYY_MM_DD")}/log/log.log`, diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index f76874c..b959024 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -1,18 +1,20 @@ { - "lockfileVersion": 1, + "lockfileVersion": 2, "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" + "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", + "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3" }, "packages": { - "@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": { "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", - "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" + "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", + "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==", + "registryType": "ohpm" } } } \ No newline at end of file