From 99d58fae5474c23d03194f90d801545aa3e085a6 Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Thu, 30 Oct 2025 17:24:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=9B=9B=E5=90=88?= =?UTF-8?q?=E4=B8=80=E8=A7=86=E9=A2=91=E4=B8=A2=E5=A4=B1=E5=87=A0=E7=A7=92?= =?UTF-8?q?=E9=92=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets | 12 +++++++++--- entry/src/main/ets/pages/Judge/JudgeBusiness.ets | 1 + entry/src/main/ets/pages/TerminalInfo.ets | 4 ++-- .../src/main/ets/utils/business/JudgeUdpBusiness.ets | 11 ++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets index fd5ed69..8d81952 100644 --- a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets +++ b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets @@ -378,7 +378,11 @@ export class BaseJudge { let user = USER[0] user.kssycs = currentKssycs.toString() dConsole.info(JudgeTag, `更新后学员信息`, user) - await UpdateTableByArray('USER', [user]) + try { + await UpdateTableByArray('USER', [user]) + } catch (e) { + dConsole.error(JudgeTag, `更新学员信息失败`, e) + } dConsole.info(JudgeTag, `考试成绩:${judgeUI.totalScore}`) if (!singlePlay) { // await uploadProgressData(); @@ -401,7 +405,7 @@ export class BaseJudge { dConsole.log(JudgeTag, "考试结束自动退出2") router.back(); }) - throw new Error('End Loop') + // throw new Error('End Loop') } that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`]) } else { @@ -410,12 +414,13 @@ export class BaseJudge { dConsole.log(JudgeTag, "考试结束自动退出3") router.back(); }) - throw new Error('End Loop') + // throw new Error('End Loop') } }) this.isUdpEnd = true try { if (!judgeUI.singlePlay) { + console.log("四合一结束1") let startTime: Date = AppStorage.get("startTime") || new Date() DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { judgeUdpEnd: this.isUdpEnd, @@ -446,6 +451,7 @@ export class BaseJudge { this.isUdpEnd = true try { if (!judgeUI.singlePlay) { + console.log("四合一结束2") let startTime: Date = AppStorage.get("startTime") || new Date() DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { judgeUdpEnd: this.isUdpEnd, diff --git a/entry/src/main/ets/pages/Judge/JudgeBusiness.ets b/entry/src/main/ets/pages/Judge/JudgeBusiness.ets index 6c7a688..90267d3 100644 --- a/entry/src/main/ets/pages/Judge/JudgeBusiness.ets +++ b/entry/src/main/ets/pages/Judge/JudgeBusiness.ets @@ -140,6 +140,7 @@ export default class JudgeBusiness { } private onUdpMessageCallback = (data: string) => { + dConsole.log(JudgeTag, '收到UDP数据', data) const result: WorkerBackMessage = JSON.parse(data) if (result.type === WorkerBackMessageType.ObtainUdpData) { this.HandlePLCData(result.data as string) diff --git a/entry/src/main/ets/pages/TerminalInfo.ets b/entry/src/main/ets/pages/TerminalInfo.ets index 185228c..d23d2cf 100644 --- a/entry/src/main/ets/pages/TerminalInfo.ets +++ b/entry/src/main/ets/pages/TerminalInfo.ets @@ -15,7 +15,7 @@ import { OverWriteFile, ReadFileContent } from '../utils/Common'; struct TerminalInfoPage { @State config: EnvironmentConfigurationType = { version: "2024.08.21.01", - judgeVersion: "2024.08.1" + judgeVersion: "2024.08.24.1" } @State isProcessing: boolean = false; @State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt' @@ -30,7 +30,7 @@ struct TerminalInfoPage { this.config.version = "2024.08.21.01" } if (!this.config.judgeVersion) { - this.config.judgeVersion = "2024.08.1" + this.config.judgeVersion = "2024.08.24.1" } AppStorage.setOrCreate("EnvironmentConfiguration", this.config) } diff --git a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets index f3d4426..460f8cd 100644 --- a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets +++ b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets @@ -59,7 +59,12 @@ class JudgeUdpBusiness { const ascsbxhArr = StringToASCII(this.getSbxh(this.business.xmdm, this.business.xmxh)) const plcData = await this.getPlcData(msg); - const plc2Data = await this.getPlcData(gps2 || "") + let plc2Data: PLCDataType | undefined = undefined; + try { + plc2Data = await this.getPlcData(gps2 || "") + } catch (e) { + console.log(JSON.stringify(e)) + } let param: number[] = [plcData.sensor.zfxd, plcData.sensor.yfxd, plcData.sensor.shtd, plcData.sensor.ygd, plcData.sensor.jgd, plcData.sensor.skd, plcData.sensor.dh1, plcData.sensor.dh2, plcData.sensor.lhq, plcData.sensor.jsc, plcData.sensor.ssc, plcData.sensor.fsc, plcData.sensor.lb, plcData.sensor.mkg, plcData.sensor.aqd] .concat(GetDwStatusType(plcData.sensor.dw)) .concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0]) @@ -70,8 +75,8 @@ class JudgeUdpBusiness { let translateGps2Jd: number = 0 let translateGps2Wd: number = 0 if (gps2) { - translateGps2Jd = Number(this.convertGpsCoord2(plc2Data.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit); - translateGps2Wd = Number(this.convertGpsCoord2(plc2Data.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit) + translateGps2Jd = Number(this.convertGpsCoord2(plc2Data!.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit); + translateGps2Wd = Number(this.convertGpsCoord2(plc2Data!.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit) } const translateProjects = translateProject.map(numStr => NumberToByteArray(parseInt(numStr, 2), 8)[0])