diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index 5d48b66b..96eff603 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -39,6 +39,7 @@ export async function getTCP(flag = false) { let now = new Date() if (now.getTime() - lastTime.getTime() > (1000 * 6)) { console.log("差分tcp信号丢失") + clearInterval(tick) getTCP(true) return } @@ -47,6 +48,7 @@ export async function getTCP(flag = false) { } }, 1000 * 1.5) tcpClient?.onError(() => { + clearInterval(tick) getTCP(true) }) tcpClient?.onMessage((val) => { diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index d80d8a7b..cc269de5 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -74,6 +74,7 @@ export default class TcpClient { this.tcpSendNum++ if (this.tcpSendNum > 10) { getTCP(true) + this.tcpSendNum = 0 } }) } diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 6205345a..a461dc37 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -57,7 +57,7 @@ export default struct Index { } }); let routParam: any = router.getParams(); - this.fromIndex=routParam?.fromIndex || false + this.fromIndex = routParam?.fromIndex || false this.carConfigurationInfoFn() } @@ -109,30 +109,10 @@ export default struct Index { this.stachValue = JSON.parse(JSON.stringify(StackValueData)) this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData)) this.passArray = JSON.parse(JSON.stringify(PassData)) - // clearInterval(this.interval) - } // carConfigurationInfoFn() { - // const fileUtil = new FileUtil(context) - // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); - // if (data === '' || data === undefined) { - // promptAction.showToast({ - // message: `请先进行设备注册`, - // duration: 3000 - // }); - // globalThis.type='1' - // globalThis.title=decodeURIComponent('请先进行设备注册') - // globalThis.errorDialog.open() - // resolve('') - // } else { - // const fileData=JSON.parse(data) - // globalThis.deviceNo = fileData.deviceName - // console.log('globalThis.deviceNo', globalThis.deviceNo) - // // getCarInfo() - // resolve(fileData.deviceName) - // } if (globalThis.singlePlay) { const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5" const data = str.split(';') @@ -295,7 +275,7 @@ export default struct Index { flag: flag ? 'N' : 'Y', condition: flag ? '自检不通过' : '自检通过' } - if(!flag&&this.fromIndex||true){ + if (!flag && this.fromIndex || true) { router.pushUrl({ url: 'pages/ExaminerLogin', }, router.RouterMode.Single); @@ -306,41 +286,43 @@ export default struct Index { } }, parseInt(this.checkListCopy[0].time) * 1000) } - initfackCheck(index){ - const that=this - setTimeout(()=>{ - console.log('indexindex',index) - if(index>=3){ - this.getCheckList() - return - } - console.log('this.index',index,) - that.passArray[index]=true - if(index==2){ - let flag=false - console.log('globalThis.spzd[key]',globalThis.spzd) + initfackCheck(index) { + const that = this + setTimeout(() => { + console.log('indexindex', index) + if (index >= 3) { + this.getCheckList() + return + } - for(let key in globalThis.spzd){ - console.log('globalThis.spzd[key]',globalThis.spzd[key]) - if(globalThis.spzd[key]){ - that.warnFlag[index]='1' - flag=true - } + console.log('this.index', index,) + that.passArray[index] = true + if (index == 2) { + let flag = false + console.log('globalThis.spzd[key]', globalThis.spzd) + + for (let key in globalThis.spzd) { + console.log('globalThis.spzd[key]', globalThis.spzd[key]) + if (globalThis.spzd[key]) { + that.warnFlag[index] = '1' + flag = true } - if(!flag){ - that.warnFlag[index]='2' - } - }else{ - that.warnFlag[index]='2' } - that.passArray=JSON.parse(JSON.stringify(that.passArray)) - that.warnFlag=JSON.parse(JSON.stringify(that.warnFlag)) - index++ - this.initfackCheck(index) - },1000) + if (!flag) { + that.warnFlag[index] = '2' + } + } else { + that.warnFlag[index] = '2' + } + that.passArray = JSON.parse(JSON.stringify(that.passArray)) + that.warnFlag = JSON.parse(JSON.stringify(that.warnFlag)) + index++ + this.initfackCheck(index) + }, 1000) } + async getCheckList() { this.index = this.checkListCopy[0].key this.passArray[this.index] = true diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index c3862001..4fc55a8a 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -248,7 +248,6 @@ export default class Judge { const str = await senorToWXDataStr(msg); usbService.sendUSB(str) } - // this.judgeUI.isDwztRight = (plcData.gps.dwzt == 4 && plcData.gps.jdzt == 3); const param350 = judgeUI.judgeConfigObj['350'] //@ts-ignore this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + '' @@ -486,7 +485,7 @@ export default class Judge { } // 处理轨迹plc信号 handleTrajectoryUdp = async (strArr) => { - const {fileLog,setJudgeItem,setJudgeMark,endExam} = this; + const {setJudgeItem} = this; let num = 2; const judgeTimer = setInterval(async () => { const msgStr = strArr[num]; @@ -504,7 +503,6 @@ export default class Judge { 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; globalThis.msgStr = '' if (msg.method === 'examJudgeArtificialItem') { setJudgeItem(msg.itemno, msg.type) @@ -1730,7 +1728,6 @@ export default class Judge { // 检测差分状态 checkDwzt = async (type) => { const {avPlayer} = this; - const judgeConfig = this.judgeUI.judgeConfig; switch (type) { case 0: this.judgeUI.isDwztRight = true;