From f420a9512fbea37f92dbf7da49337f3e17a6259e Mon Sep 17 00:00:00 2001 From: lv <1344032923@qq.com> Date: Wed, 25 Jun 2025 10:19:26 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=87=8D=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/GlobalTcp.ts | 22 ++++++++++++++----- entry/src/main/ets/common/utils/TcpClient.ts | 4 ++-- .../src/main/ets/entryability/EntryAbility.ts | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index eec03438..4c414ee6 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -3,7 +3,7 @@ import { getSyncData } from '../service/initable'; import hilog from '@ohos.hilog'; import FileUtil from '../../common/utils/File' import { GlobalConfig } from '../../config/index' - +const TAG = 'socketTag[TcpDemo.TcpClient]' export async function getTCP(flag=false) { globalThis.getCloseTcp=true const fileUtil = new FileUtil(globalThis.context) @@ -35,10 +35,16 @@ export async function getTCP(flag=false) { console.log('ttttttt00') clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ + globalThis.intervalSendmsg=setInterval(async()=>{ console.log('getCloseTcp',globalThis.carInfo.carNo) if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + globalThis.tcpStep+=1 + if(globalThis.tcpStep>30){ + console.log(TAG,'tcp重连开始') + globalThis.tcpStep=0 + getTCP() + } } },1000/3) globalThis.TcpClient.onError((val) => { @@ -68,10 +74,16 @@ export async function getTCP(flag=false) { console.log('ttttttt12') clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ + globalThis.intervalSendmsg=setInterval(async()=>{ // console.log('getCloseTcp',globalThis.getCloseTcp) if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + globalThis.tcpStep+=1 + if(globalThis.tcpStep>30){ + console.log(TAG,'tcp重连开始') + globalThis.tcpStep=0 + getTCP() + } } },1000/3) globalThis.TcpClient.onError((val) => { diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index f14066b8..043d40c1 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -148,13 +148,12 @@ export default class TcpClient { this.tcpSendNum=0 return } - globalThis.getCloseTcp=true console.log(`${TAG} TCPsend error ${JSON.stringify(err)}`) // this.writeLog({ // time:dateFormat(new Date()), // message: `${TAG} TCPsend error ${JSON.stringify(err)}`, // }) - reslove(false) + reject(false) }); }) } @@ -165,6 +164,7 @@ export default class TcpClient { // time:dateFormat(new Date()), // PLC:`${TAG} Tcponmessage`, // }) + globalThis.tcpStep=0 globalThis.tcpUdpError = false if (value) { callback && callback(value.message) diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts index 9e7393e9..ae3360a5 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -38,7 +38,7 @@ export default class EntryAbility extends UIAbility { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); await tcpUtil.init() - + globalThis.tcpStep=0 globalThis.carInfo = {} globalThis.examinerInfo = {} From e36b0f018b9824c963963389280df0557bc6343e Mon Sep 17 00:00:00 2001 From: surenjun Date: Sat, 28 Jun 2025 09:52:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix=EF=BC=9A=201.499=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9;=202.=E7=A7=91=E7=9B=AE=E4=BA=8Csbbm?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=AF=BB=E5=8F=96=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/judgeSDK/judge.ts | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 0766fafe..47d458ad 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -538,14 +538,14 @@ export default class Judge { // 调代理接口是否断网了 private isJudgeDisConnect: boolean; // 项目开始接口同步 - beginProject = async (ksxm) => { + beginProject = async (ksxm,xmxh?:string) => { const carInfo = globalThis.carInfo; const { examSubject,plateNo } = carInfo; - const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; + const {judgeUI,fileLog,getSbbm,filePath} = this; const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI const time = await getCurrentTime(); const project = projectsObj[ksxm] - const sbxh = getSbbm(ksxm, xmxh) + const sbxh = getSbbm(ksxm, xmxh || this.xmxh) const data = { //系统类别 接口序列号 接口标识 xtlb: '17', jkxlh: serialNumber, jkid: '17C52', @@ -572,15 +572,15 @@ export default class Judge { promptWxCode('17C52', code) } // 项目结束接口同步 - endProject = async (ksxm) => { + endProject = async (ksxm,xmxh?:string) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; const { examSubject,plateNo,carNo } = carInfo; - const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; + const {judgeUI,fileLog,getSbxh,getSbbm,filePath} = this; const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI const time = await getCurrentTime(); const project = projectsObj[ksxm] - const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh) + const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh || this.xmxh) const data = { xtlb: '17', jkxlh: serialNumber, jkid: '17C55', @@ -1066,7 +1066,7 @@ export default class Judge { if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) - await beginProject(xmdm) + await beginProject(xmdm,xmxh) }, { isDelay: true }) @@ -1095,7 +1095,7 @@ export default class Judge { if (!projectIsEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) - await endProject(xmdm); + await endProject(xmdm,xmxh) this.xmmcSingleCode = 0; this.xmmcEndCode = undefined; }, { @@ -1714,7 +1714,7 @@ export default class Judge { // 检测差分状态 checkDwzt = async (type) => { const {avPlayer} = this; - const judgeConfig = this.judgeUI.judgeConfig; + const config499 = this.judgeUI.judgeConfigObj['499']; switch (type) { case 0: this.judgeUI.isDwztRight = true; @@ -1722,10 +1722,17 @@ export default class Judge { case 1: this.judgeUI.dwztErrorVisible = true; + clearInterval(this.judgeUI.timer); + clearInterval(globalThis.judgeTimer) avPlayer.playAudio([`voice/差分状态异常.mp3`], true) setTimeout(() => { - router.back() - }, 3000) + try { + this.checkExamIsEnd(true); + } catch (e) { + this.closeAllFiles() + router.back() + } + }, config499 * 1000) break; case 2: From 448a16fab9e4bf6b6849d9400c5e821ef591b64d Mon Sep 17 00:00:00 2001 From: surenjun Date: Sat, 28 Jun 2025 09:54:28 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix=EF=BC=9A=20=E6=A1=A3=E4=BD=8D=E4=B8=B2?= =?UTF-8?q?=E5=8F=A3=E8=AF=BB=E5=8F=96=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/common/service/indexService.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 0aa2410d..e2f937e3 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -433,19 +433,21 @@ let fd const devPath = "/dev/ttyS3" function openChuankouFn(callback) { - console.log('SerialOpen in indexservice, path=' + devPath) - - //自动挡车不读取串口 - if(globalThis.carInfo && globalThis.carInfo.kscx == 'C1'){ - testNapi.SerialOpenAsync(devPath, (fd) => { - globalThis.fd = fd; - globalThis.num = 0 - let parity = 0x4e; // 'N' - let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => { - callback() + getSyncData('ES_CARINFO').then(result => { + const carInfo = result[0] || {}; + globalThis.carInfo.kscx = carInfo.kscx + console.info('srj ES_CARINFO=>',JSON.stringify(carInfo)) + if(carInfo.kscx == 'C1'){ + testNapi.SerialOpenAsync(devPath, (fd) => { + globalThis.fd = fd; + globalThis.num = 0 + let parity = 0x4e; // 'N' + let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => { + callback() + }); }); - }); - } + } + }) } function getChuankouFnMsg() { From addf143396b30a4b348dcf1830e0da3d4800163b Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 30 Jun 2025 19:22:21 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix=EF=BC=9A=E6=96=B0=E5=A2=9E503=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/UserInfo.ets | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 16f2a14a..eaf86da7 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -91,6 +91,7 @@ struct UserInfo { 'Param398': '0', //考前上车准备 'Param835': '0', //考前上车准备 'Param850': '0', //考前上车准备 + 'Param853': '0', //未熄火不能开始考试 } @State startExam: boolean = false // 过程照片拍照 @@ -537,6 +538,9 @@ struct UserInfo { if (sys.v_no === '770') { that.systemParam.Param770Str = sys.v_value; } + if(sys.v_no === '853'){ + that.systemParam.Param853 = sys.v_value; + } if (sys.v_no === '835') { that.systemParam.Param835 = sys.v_value; } @@ -946,7 +950,8 @@ struct UserInfo { const {isCheckFireOpen} = judgeConfig const {systemParam,isBoardPrePareSetPopupOpen} = this; const Param803Str = systemParam.Param803Str - if (Param803Str === '') { + const Param853Str = systemParam.Param853 + if (Param803Str === '' && Param853Str != '1') { return true } return new Promise((resolve, reject) => { @@ -963,6 +968,14 @@ struct UserInfo { const ygd = msgArr[8]; const ssc = msgArr[13]; const dw = msgArr[28]; + if(Param853Str == '1'){ + this.avPlayer.playAudio(['voice/熄火.mp3']) + promptAction.showToast({ + message: '请熄火', + duration: 4000 + }) + reject(false) + } // 开始考试信号检测 if (Param803Str !== '') { //安全带 @@ -1482,4 +1495,5 @@ type systemParam = { 'Param398': string, //考前上车准备 'Param835': string, //考前上车准备 'Param850': string, //考前上车准备 + 'Param853': string, //未熄火不能开始考试 } \ No newline at end of file From 6de9d4bdcb42c67f9533b693f3d70a04b0e8391d Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 30 Jun 2025 19:26:56 +0800 Subject: [PATCH 5/7] =?UTF-8?q?Revert=20"fix=EF=BC=9A=E6=96=B0=E5=A2=9E503?= =?UTF-8?q?=E5=8F=82=E6=95=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit addf143396b30a4b348dcf1830e0da3d4800163b. --- entry/src/main/ets/pages/UserInfo.ets | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index eaf86da7..16f2a14a 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -91,7 +91,6 @@ struct UserInfo { 'Param398': '0', //考前上车准备 'Param835': '0', //考前上车准备 'Param850': '0', //考前上车准备 - 'Param853': '0', //未熄火不能开始考试 } @State startExam: boolean = false // 过程照片拍照 @@ -538,9 +537,6 @@ struct UserInfo { if (sys.v_no === '770') { that.systemParam.Param770Str = sys.v_value; } - if(sys.v_no === '853'){ - that.systemParam.Param853 = sys.v_value; - } if (sys.v_no === '835') { that.systemParam.Param835 = sys.v_value; } @@ -950,8 +946,7 @@ struct UserInfo { const {isCheckFireOpen} = judgeConfig const {systemParam,isBoardPrePareSetPopupOpen} = this; const Param803Str = systemParam.Param803Str - const Param853Str = systemParam.Param853 - if (Param803Str === '' && Param853Str != '1') { + if (Param803Str === '') { return true } return new Promise((resolve, reject) => { @@ -968,14 +963,6 @@ struct UserInfo { const ygd = msgArr[8]; const ssc = msgArr[13]; const dw = msgArr[28]; - if(Param853Str == '1'){ - this.avPlayer.playAudio(['voice/熄火.mp3']) - promptAction.showToast({ - message: '请熄火', - duration: 4000 - }) - reject(false) - } // 开始考试信号检测 if (Param803Str !== '') { //安全带 @@ -1495,5 +1482,4 @@ type systemParam = { 'Param398': string, //考前上车准备 'Param835': string, //考前上车准备 'Param850': string, //考前上车准备 - 'Param853': string, //未熄火不能开始考试 } \ No newline at end of file From 6b54e9da5c84eeca1522e5750416888d318fbea9 Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 30 Jun 2025 19:27:41 +0800 Subject: [PATCH 6/7] =?UTF-8?q?Revert=20"Revert=20"fix=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E503=E5=8F=82=E6=95=B0""?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6de9d4bdcb42c67f9533b693f3d70a04b0e8391d. --- entry/src/main/ets/pages/UserInfo.ets | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 16f2a14a..eaf86da7 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -91,6 +91,7 @@ struct UserInfo { 'Param398': '0', //考前上车准备 'Param835': '0', //考前上车准备 'Param850': '0', //考前上车准备 + 'Param853': '0', //未熄火不能开始考试 } @State startExam: boolean = false // 过程照片拍照 @@ -537,6 +538,9 @@ struct UserInfo { if (sys.v_no === '770') { that.systemParam.Param770Str = sys.v_value; } + if(sys.v_no === '853'){ + that.systemParam.Param853 = sys.v_value; + } if (sys.v_no === '835') { that.systemParam.Param835 = sys.v_value; } @@ -946,7 +950,8 @@ struct UserInfo { const {isCheckFireOpen} = judgeConfig const {systemParam,isBoardPrePareSetPopupOpen} = this; const Param803Str = systemParam.Param803Str - if (Param803Str === '') { + const Param853Str = systemParam.Param853 + if (Param803Str === '' && Param853Str != '1') { return true } return new Promise((resolve, reject) => { @@ -963,6 +968,14 @@ struct UserInfo { const ygd = msgArr[8]; const ssc = msgArr[13]; const dw = msgArr[28]; + if(Param853Str == '1'){ + this.avPlayer.playAudio(['voice/熄火.mp3']) + promptAction.showToast({ + message: '请熄火', + duration: 4000 + }) + reject(false) + } // 开始考试信号检测 if (Param803Str !== '') { //安全带 @@ -1482,4 +1495,5 @@ type systemParam = { 'Param398': string, //考前上车准备 'Param835': string, //考前上车准备 'Param850': string, //考前上车准备 + 'Param853': string, //未熄火不能开始考试 } \ No newline at end of file From 0832262cd7bef5407ac9f7746a26074962eeca98 Mon Sep 17 00:00:00 2001 From: surenjun Date: Mon, 30 Jun 2025 19:28:17 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix=EF=BC=9A=E6=96=B0=E5=A2=9E853=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/UserInfo.ets | 1 + oh-package-lock.json5 | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index eaf86da7..4c96617a 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -953,6 +953,7 @@ struct UserInfo { const Param853Str = systemParam.Param853 if (Param803Str === '' && Param853Str != '1') { return true + } return new Promise((resolve, reject) => { if (isCheckFireOpen) { diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index 1f023b33..bc40219d 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -1,15 +1,13 @@ { - "lockfileVersion": 2, + "lockfileVersion": 1, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" }, "packages": { "@ohos/hypium@1.0.6": { - "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", - "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", - "registryType": "ohpm", - "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1" + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", + "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==" } } } \ No newline at end of file