diff --git a/entry/src/main/ets/common/constants/IpConfigTable.ts b/entry/src/main/ets/common/constants/IpConfigTable.ts index 2fb324db..1ea7e836 100644 --- a/entry/src/main/ets/common/constants/IpConfigTable.ts +++ b/entry/src/main/ets/common/constants/IpConfigTable.ts @@ -25,8 +25,8 @@ CommonConstants { */ static readonly ACCOUNT_TABLE = { tableName: 'IpConfigTable', - sqlCreate: 'CREATE TABLE IF NOT EXISTS IpConfigTable(id INTEGER PRIMARY KEY AUTOINCREMENT,udplocalIp TEXT,udplocalIpPort TEXT, udpOppositeIp TEXT, udpOppositeIpPort TEXT,tcplocalIp TEXT,tcplocalIpPort TEXT,tcpOppositeIp TEXT,tcpOppositePort TEXT,gateway TEXT,netMask TEXT,dnsServers TEXT,centerIp TEXT,heartPort TEXT,gpsPort TEXT)', - columns: ['id','udplocalIp', 'udplocalIpPort', 'udpOppositeIp','udpOppositeIpPort','tcplocalIp','tcplocalIpPort','tcpOppositeIp','tcpOppositePort','gateway','netMask','dnsServers','centerIp','heartPort','gpsPort'] + sqlCreate: 'CREATE TABLE IF NOT EXISTS IpConfigTable(id INTEGER PRIMARY KEY AUTOINCREMENT,udplocalIp TEXT,udplocalIpPort TEXT, udpOppositeIp TEXT, udpOppositeIpPort TEXT,tcplocalIp TEXT,tcplocalIpPort TEXT,tcpOppositeIp TEXT,tcpOppositePort TEXT,gateway TEXT,netMask TEXT,dnsServers TEXT)', + columns: ['id','udplocalIp', 'udplocalIpPort', 'udpOppositeIp','udpOppositeIpPort','tcplocalIp','tcplocalIpPort','tcpOppositeIp','tcpOppositePort','gateway','netMask','dnsServers'] }; /** diff --git a/entry/src/main/ets/common/utils/GlobleUdp.ts b/entry/src/main/ets/common/utils/GlobleUdp.ts index c9a8f7e4..1ae677ac 100644 --- a/entry/src/main/ets/common/utils/GlobleUdp.ts +++ b/entry/src/main/ets/common/utils/GlobleUdp.ts @@ -1,88 +1,59 @@ import UdpClient from './UdpClient'; import UdpClientByCenter from './UdpClientByCenter'; -import { getSyncData } from '../service/initable' +import { getSyncData} from '../service/initable' import { dateFormat } from '../../common/utils/tools' import prompt from '@ohos.prompt' import TcpClient from './TcpClient'; - -// getSyncData('IpConfigTable').then((result)=>{ -// console.log('result222',result) -// if(result){ -// if(globalThis.udpClient){ -// globalThis.udpClient.closeUdp() -// setTimeout(()=>{ -// const udpClient: UdpClient =new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort) -// udpClient.bindUdp() -// udpClient.sendMsg('111') -// globalThis.udpClient = udpClient -// },1000) -// }else{ -// const udpClient: UdpClient =new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort) -// udpClient.bindUdp() -// udpClient.sendMsg('111') -// globalThis.udpClient = udpClient -// } -// // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort) -// -// } -// }) - -export async function sendMsg(val) { - globalThis.udpClient1 && globalThis.udpClient1.sendMsg(val) +export async function sendMsg(val){ + globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val) } - export async function getUDP() { - getSyncData('IpConfigTable').then((result: Array) => { - console.log('result222', JSON.stringify(result)) - if (result.length) { - if (globalThis.udpClient && globalThis.udpClient.closeUdp) { - globalThis.udpClient.closeUdp(() => { + getSyncData('IpConfigTable').then((result:Array)=>{ + console.log('result222',JSON.stringify(result)) + if(result.length){ + if(globalThis.udpClient&&globalThis.udpClient.closeUdp){ + globalThis.udpClient.closeUdp(()=>{ + + globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort) - globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) - // globalThis.udpClient.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022') - // setInterval(()=>{ - // globalThis.udpClient.sendMsg('111') - // },1000) globalThis.udpClient.sendMsg('111') // globalThis.udpClient = udpClient }) - } else { + }else{ - const udpClient: UdpClient = new UdpClient(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) + const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udplocalIpPort,result[0].udpOppositeIp,result[0].udpOppositeIpPort) udpClient.bindUdp() udpClient.sendMsg('111') globalThis.udpClient = udpClient } // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort) - } else { - globalThis.udpClient = {} - globalThis.udpClient.onMessage = () => { - } + }else{ + globalThis.udpClient={} + globalThis.udpClient.onMessage=()=>{} } }) } export async function getUDP2() { - getSyncData('IpConfigTable').then(async (result: Array) => { - console.log('result222', JSON.stringify(result)) - if (result.length) { - if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) { - globalThis.udpClient2.closeUdp(async () => { + getSyncData('IpConfigTable').then(async (result:Array)=>{ + if(result.length){ + if(globalThis.udpClient2&&globalThis.udpClient2.closeUdp){ + globalThis.udpClient2.closeUdp(async ()=>{ // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800','112.80.35.83','11056') - globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', result[0].centerIp, result[0].heartPort) + globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort) // globalThis.udpClient2.rebindUdp(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) // globalThis.udpClient2.rebindUdp(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS) - globalThis.udpClient2.onMessage((val) => { + globalThis.udpClient2.onMessage((val)=>{ // globalThis.udpClnt2.sendMsg(heartMsg(context)) }) }) - } else { + }else{ // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, result[0].udpLocalIpByGPS,result[0].udpOppositeIp,result[0].udpOppositeIpPortByGPS) - const udpClient: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', result[0].centerIp, result[0].heartPort) + const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800',globalThis.carInfo?.udpAddress,globalThis.carInfo?.messagePort) // const udpClient: UdpClientByCenter =new UdpClientByCenter(result[0].udplocalIp, '8800','112.80.35.83','11056') // const udpClient: UdpClient =new UdpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) @@ -91,25 +62,20 @@ export async function getUDP2() { // globalThis.udpClient2.sendMsg(heartMsg(context)) - globalThis.udpClient2.onMessage((val) => { + globalThis.udpClient2.onMessage((val)=>{ - if (val.id == '32') { - globalThis.signNum = val.body[1] - } else if (val.id == '46') { + if(val.id=='32'){ + globalThis.signNum=val.body[1] + }else if(val.id=='46'){ let tmpList = [] - console.log('lsh', globalThis.lsh) + console.log('lsh',globalThis.lsh) const str = globalThis.lsh - for (let i = 0; i < str.length; i++) { + for (let i = 0;i < str.length; i++) { tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) } - const param = { - id: 47, - list: tmpList, - carNo: globalThis.carInfo.carNo, - placeId: globalThis.carInfo.examinationRoomId - } + const param = { id: 47, list: tmpList, carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId } globalThis.udpClient2.send(param) } @@ -120,74 +86,23 @@ export async function getUDP2() { // },1000) }) } - } else { - globalThis.udpClient2 = {} - globalThis.udpClient2.onMessage = () => { - } + }else{ + globalThis.udpClient2={} + globalThis.udpClient2.onMessage=()=>{} } }) } -function fillZero(str, len) { - str = str + ''; - if (str.length > len || !len) { - return str - } - - let num = len - str.length; - let zeroStr = ''; - for (var i = 0; i < num; i++) { - zeroStr = zeroStr + '0' - } - - return zeroStr + str; -} - -// function getByteToInt(arr){ -// let a = list[0]; -// let b = list[1]; -// let c = '0x' + fillZero(b.toString(16),2) + fillZero(a.toString(16),2) ; -// let id = Math.floor(+c/1000) -// } -export async function getUDPByTopLine() { - getSyncData('IpConfigTable').then((result: Array) => { - if (result.length) { - if (globalThis.udpClientByTopLine && globalThis.udpClientByTopLine.closeUdp) { - globalThis.udpClientByTopLine.closeUdp(() => { - - globalThis.udpClientByTopLine.rebindUdp(result[0].udplocalIp, '5509', result[0].udpOppositeIp, result[0].udpOppositeIpPort) - // globalThis.udpClient.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022') - }) - } else { - - const udpClient: UdpClient = new UdpClient(result[0].udplocalIp, '55509', result[0].udpOppositeIp, result[0].udpOppositeIpPort) - // const udpClient: UdpClient =new UdpClient(result[0].udplocalIp, '8800','192.168.36.9','11111') - // const udpClient: UdpClient =new UdpClient('192.168.7.170', '20122','192.168.7.124','20022') - // globalThis.udpClient2.rebindUdp('192.168.7.170', '20122','192.168.7.124','20022') - - udpClient.bindUdp() - globalThis.udpClientByTopLine = udpClient - } - // globalThis.udpClient = new UdpClient(result[0].localIp, result[0].localIpPort,result[0].oppositeIp,result[0].oppositeIpPort) - - } else { - globalThis.udpClientByTopLine = {} - globalThis.udpClientByTopLine.onMessage = () => { - } - } - }) -} - -export async function setTopLineUdp() { +export async function setTopLineUdp(){ const config = await getSyncData('IpConfigTable'); - if (config && config[0] && config[0].udplocalIp) { + if(config && config[0] && config[0].udplocalIp){ const {udplocalIp,udpOppositeIp,udpOppositeIpPort} = config[0]; - const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509', udpOppositeIp, udpOppositeIpPort) + const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '55509',udpOppositeIp,udpOppositeIpPort) // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333') udpClient.bindUdp() return { - send(bytes) { + send(bytes){ udpClient.sendHeadMsg(bytes) } } @@ -195,26 +110,21 @@ export async function setTopLineUdp() { } -export async function setJudgeUdp() { +export async function setJudgeUdp(){ const config = await getSyncData('IpConfigTable'); - if (config && config[0] && config[0].udplocalIp) { - const {udplocalIp,centerIp,gpsPort} = config[0]; + if(config && config[0] && config[0].udplocalIp){ + const {udplocalIp} = config[0]; // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080','192.168.32.167','33333') - const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080', centerIp, gpsPort) + const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8080',globalThis.carInfo?.gpsAddress,globalThis.carInfo?.hintPort) // const udpClient: UdpClientByCenter = new UdpClientByCenter(udplocalIp, '8800','192.168.36.4','33333') udpClient.bindUdp() - udpClient.onMessage((val) => { + udpClient.onMessage((val)=>{ }) globalThis.judgeUdpClient = udpClient; return { - send(bytes) { - console.log('carInfo111', JSON.stringify(globalThis.carInfo)) - udpClient.sendMsg({ - id: 45, - list: bytes, - carNo: globalThis.carInfo.carNo, - placeId: globalThis.carInfo.examinationRoomId - }) + send(bytes){ + console.log('carInfo111',JSON.stringify(globalThis.carInfo)) + udpClient.sendMsg({id:45,list:bytes,carNo:globalThis.carInfo.carNo,placeId:globalThis.carInfo.examinationRoomId}) } } } diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 4f649bbb..e1c47885 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -1,12 +1,7 @@ - import UdpClient from '../common/utils/UdpClient'; import { voiceService } from '../common/service/voiceService' -//import { resolveIP } from '../common/utils/SocketUtil' -import prompt from '@ohos.prompt' import router from '@ohos.router' -import { carConfigurationInfo,uploadExamCarCheckResult } from '../api/checkCar' -// import CommonConstants from '../common/constants/CommonConstants'; -// import AccountTable from '../common/database/tables/AccountTable'; +import { carConfigurationInfo, uploadExamCarCheckResult } from '../api/checkCar' import TopLogo from './compontents/topLogo' import testNapi from '@ohos.hiserialsdk' import { dateFormat } from '../common/utils/tools'; @@ -15,7 +10,7 @@ import { dateFormat } from '../common/utils/tools'; @Component struct Index { @State angle: number = 0 - @State ratio: number = 850/960 + @State ratio: number = 850 / 960 @State index: number = -1 @State time: string = '' @State msg: string = '' @@ -24,161 +19,189 @@ struct Index { @State loading: boolean = false @State breakFlag: boolean = false @State checkFlag: boolean = false - // @State errorMsg: string = false @State msgFlag: boolean = false @State confimDialogFlag: boolean = false - private udpClient: UdpClient = null - private localIp: string = null private vocObj = null; @State checkList: Array = [] @State subFlag: boolean = true @State signArr: Array = [] @State checkListCopy: Array = [] @State warnFlag: object = { - 1:false, - 2:false, - 3:false, - 4:false, - 5:false, - 6:false, - 7:false, - 8:false, - 9:false, - 10:false, - 11:false, - 12:false, - 13:false, - 14:false, - 15:false, - 16:false, - 17:false, - 18:false, - 19:false, - 20:false, - 21:false, - 22:false, - 23:false, - 24:false, - 25:false, - 26:false, - 27:false, - 28:false, - 29:false, + 1: false, + 2: false, + 3: false, + 4: false, + 5: false, + 6: false, + 7: false, + 8: false, + 9: false, + 10: false, + 11: false, + 12: false, + 13: false, + 14: false, + 15: false, + 16: false, + 17: false, + 18: false, + 19: false, + 20: false, + 21: false, + 22: false, + 23: false, + 24: false, + 25: false, + 26: false, + 27: false, + 28: false, + 29: false, } @State @Watch('outClick') outFlag: boolean = false; @State passArray: object = { - 1:false, - 2:false, - 3:false, - 4:false, - 5:false, - 6:false, - 7:false, - 8:false, - 9:false, - 10:false, - 11:false, - 12:false, - 13:false, - 14:false, - 15:false, - 16:false, - 17:false, - 18:false, - 19:false, - 20:false, - 21:false, - 22:false, - 23:false, - 24:false, - 25:false, - 26:false, - 27:false, - 28:false, - 29:false, + 1: false, + 2: false, + 3: false, + 4: false, + 5: false, + 6: false, + 7: false, + 8: false, + 9: false, + 10: false, + 11: false, + 12: false, + 13: false, + 14: false, + 15: false, + 16: false, + 17: false, + 18: false, + 19: false, + 20: false, + 21: false, + 22: false, + 23: false, + 24: false, + 25: false, + 26: false, + 27: false, + 28: false, + 29: false, } @State stachValue: object = { - 1:'', - 2:"", - 3:"", - 4:"", - 5:"", - 6:"", - 7:"", - 8:"", - 9:"", - 10:"", - 11:"", - 12:"", - 13:"", - 14:"", - 15:"", - 16:"", - 17:"", - 18:"", - 19:"", - 20:"", - 21:"", - 22:"", - 23:"", - 24:"", - 25:"", - 26:"", - 27:"", - 28:"", - 29:"", + 1: '', + 2: "", + 3: "", + 4: "", + 5: "", + 6: "", + 7: "", + 8: "", + 9: "", + 10: "", + 11: "", + 12: "", + 13: "", + 14: "", + 15: "", + 16: "", + 17: "", + 18: "", + 19: "", + 20: "", + 21: "", + 22: "", + 23: "", + 24: "", + 25: "", + 26: "", + 27: "", + 28: "", + 29: "", } @State warnFlagTip: object = { - 0:false, - 1:false, - 2:false, - 3:['check1.wav','check2.wav'], - 4:['check3.wav','check4.wav'], - 5:['check5.wav','check6.wav'], - 6:['check7.wav','check8.wav'], - 7:['check9.wav','check10.wav'], - 8:['check26.wav','check27.wav'], - 9:['dianhuoVideo.wav','xihuoVideo.wav'], - 10:['check31.wav'], - 11:['check30.wav'], - 12:['check28.wav'], - 13:['check29.wav'], - 14:['check11.wav'], - 15:['check12.wav'], - 16:['check13.wav'], - 17:['check14.wav'], - 18:['check15.wav'], - 19:['check16.wav'], - 20:['check17.wav'], - 21:['check18.wav'], - 22:['check19.wav'], - 23:['check22.wav'], - 24:['check23.wav'], - 25:['check20.wav','check21.wav'], - 26:['check24.wav'], + 0: false, + 1: false, + 2: false, + 3: ['check1.wav', 'check2.wav'], + 4: ['check3.wav', 'check4.wav'], + 5: ['check5.wav', 'check6.wav'], + 6: ['check7.wav', 'check8.wav'], + 7: ['check9.wav', 'check10.wav'], + 8: ['check26.wav', 'check27.wav'], + 9: ['dianhuoVideo.wav', 'xihuoVideo.wav'], + 10: ['check31.wav'], + 11: ['check30.wav'], + 12: ['check28.wav'], + 13: ['check29.wav'], + 14: ['check11.wav'], + 15: ['check12.wav'], + 16: ['check13.wav'], + 17: ['check14.wav'], + 18: ['check15.wav'], + 19: ['check16.wav'], + 20: ['check17.wav'], + 21: ['check18.wav'], + 22: ['check19.wav'], + 23: ['check22.wav'], + 24: ['check23.wav'], + 25: ['check20.wav', 'check21.wav'], + 26: ['check24.wav'], // 27:[], // 28:[], // 29:[], } - @State len:any='' + @State realNum: object = { + 3: 19, + 4: 17, + 5: 13, + 6: 12, + 7: 14, + 8: 18, + 9: 5, + 10: 29, + 11: 30, + 12: 31, + 13: 32, + 14: 28, + 15: 28, + 16: 28, + 17: 28, + 18: 28, + 19: 28, + 20: 28, + 21: 2, //左方向灯, + 22: 3, + 23: 7, + 24: 8, + 25: 20, + 26: '' + } + @State dwMap: object = { + 14: '1', + 15: '2', + 16: '3', + 17: '4', + 18: '5', + 19: '9', + 20: '0' + } + @State len: any = '' @State fd: number = -1; @State devPath: string = "/dev/ttyS5" // private AccountTable = new AccountTable(()=>{},CommonConstants); onPageShow() { - const that=this - this.vocObj = new voiceService(async (status,val,next) => { - if(!that.breakFlag){ + const that = this + this.vocObj = new voiceService(async (status, val, next) => { + if (!that.breakFlag) { return } if (status == 'idle') { - if(val=='kszj.wav'){ - // this.startCheck() - // setTimeout(()=>{ - this.getCheckList() - // },1000) - // that.udpClient.sendMsg('111') - }else { - this.subFlag=false + if (val == 'kszj.wav') { + this.getCheckList() + } else { + this.subFlag = false this.getNextNode() } } @@ -188,42 +211,6 @@ struct Index { //todo串口 // this.openChuankouFn() // setInterval(()=>{ - // const realNum = { - // 3: 19, - // 4: 17, - // 5: 13, - // 6: 12, - // 7: 14, - // 8: 18, - // 9: 5, - // 10: 29, - // 11: 30, - // 12: 31, - // 13: 32, - // 14: 28, - // 15: 28, - // 16: 28, - // 17: 28, - // 18: 28, - // 19: 28, - // 20: 28, - // 21: 2, //左方向灯, - // 22: 3, - // 23: 7, - // 24: 8, - // 25: 20, - // 26: '' - // } - // const dw = [14, 15, 16, 17, 18, 19, 20]; - // const dwMap = { - // 14: '1', - // 15: '2', - // 16: '3', - // 17: '4', - // 18: '5', - // 19: '9', - // 20: '0' - // } // const dwArr=[14,15,16,17,18,19,20] // if(dwArr.indexOf(this.index)>=0){ // this.getChuankouFn() @@ -231,78 +218,46 @@ struct Index { // } // },1000) } - aboutToDisappear(){ - // this.udpClient.closeUdp() - } - openChuankouFn(){ + + openChuankouFn() { this.fd = testNapi.SerialOpen(this.devPath); let parity = 0x4e; // 'N' let ret = testNapi.SerialSet(this.fd, 115200, 0, 8, 1, parity); } - getChuankouFn(){ + + getChuankouFn() { let timeout = 2000000; // 2秒超时 - let databuff = [0x61,0xAA,0x0A,0X15,0X00]; // send ABCDE + let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE let ret = testNapi.SerialSend(this.fd, databuff); let revTestInfo = testNapi.SerialRecv(this.fd, timeout); //let revTestInfo = testNapi.SerialRecv(this.fd, timeout, 6); - const message=revTestInfo.recevedBuf.toString() - if(message==''){ + const message = revTestInfo.recevedBuf.toString() + if (message == '') { return } - const msg=message.split(',') - const dwMap = { - 14: '1', - 15: '2', - 16: '3', - 17: '4', - 18: '5', - 19: '9', - 20: '0' - } - - if(msg[0]!='98'||msg[1]!='85'||msg.length<9){ + const msg = message.split(',') + if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) { return } - console.log('msgmsg',msg[9],'this.index',this.index) - if(msg[9] == dwMap[this.index]){ - this.warnFlag[this.index]='2' + if (msg[9] == this.dwMap[this.index]) { + this.warnFlag[this.index] = '2' } } - deCode(ArrayBuffer) { - var utf8 = new Uint8Array(ArrayBuffer); - var decodedString = String.fromCharCode.apply(null, utf8); - return decodedString; - } + async xhxs() { this.vocObj.avPlayerStop() this.vocObj.releasePlayer() - // this.udpClient.closeUdp(()=>{ - router.pushUrl({ - url: 'pages/signDisplay', - },router.RouterMode.Single); - // }) + router.pushUrl({ + url: 'pages/signDisplay', + }, router.RouterMode.Single); } - format(dat) { - //获取年月日,时间 - var year = dat.getFullYear(); - var mon = (dat.getMonth() + 1) < 10 ? "0" + (dat.getMonth() + 1) : dat.getMonth() + 1; - var data = dat.getDate() < 10 ? "0" + (dat.getDate()) : dat.getDate(); - var hour = dat.getHours() < 10 ? "0" + (dat.getHours()) : dat.getHours(); - var min = dat.getMinutes() < 10 ? "0" + (dat.getMinutes()) : dat.getMinutes(); - var seon = dat.getSeconds() < 10 ? "0" + (dat.getSeconds()) : dat.getSeconds(); - var newDate = year + "-" + mon + "-" + data + " " + hour + ":" + min + ":" + seon; - return newDate; - } carConfigurationInfoFn() { - // 1:5;2:5;3:5;4:5;5:5;8:5;9:5;10:5;11:5; - //16:5;17:5;18:5;19:5;20:5;21:5;22:5;23:5;24:5 - // 12:5;13:5;14:5;15:5; - if(globalThis.singlePlay){ - const str="1:5;2:5;3:5;4:5;5:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5" + if (globalThis.singlePlay) { + const str = "1:5;2:5;3:5;4:5;5:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5" const data = str.split(';') this.checkList = [] const list = data @@ -316,125 +271,126 @@ struct Index { return } //模拟真实数据 - const param = { - "body": - { - "carIdString": globalThis.carInfo.carId, //考车ID - "deviceNo": globalThis.deviceNo - } - } + const param = { + "body": + { + "carIdString": globalThis.carInfo.carId, //考车ID + "deviceNo": globalThis.deviceNo + } + } - carConfigurationInfo(param).then(res => { - const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';') - this.checkList = [] - const list = data - list.map(res => { - const arr = res.split(':') - this.checkList.push({ - 'key': parseInt(arr[0]) + 2, 'time': arr[1] - }) - }) - this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) - // this.checkList = JSON.parse(res).body.ES_CHECK_CAR_ITEM[0].split(';') - console.log('this.checkList' + this.checkList) - }).catch((error) => { - console.log('error12error' + error) - }) + carConfigurationInfo(param).then(res => { + const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';') + this.checkList = [] + const list = data + list.map(res => { + const arr = res.split(':') + this.checkList.push({ + 'key': parseInt(arr[0]) + 2, 'time': arr[1] + }) + }) + this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) + // this.checkList = JSON.parse(res).body.ES_CHECK_CAR_ITEM[0].split(';') + console.log('this.checkList' + this.checkList) + }).catch((error) => { + console.log('error12error' + error) + }) } + async kszj() { - this.breakFlag=true - this.stachValue={ - 1:'', - 2:"", - 3:"", - 4:"", - 5:"", - 6:"", - 7:"", - 8:"", - 9:"", - 10:"", - 11:"", - 12:"", - 13:"", - 14:"", - 15:"", - 16:"", - 17:"", - 18:"", - 19:"", - 20:"", - 21:"", - 22:"", - 23:"", - 24:"", - 25:"", - 26:"", - 27:"", - 28:"", - 29:"", + this.breakFlag = true + this.stachValue = { + 1: '', + 2: "", + 3: "", + 4: "", + 5: "", + 6: "", + 7: "", + 8: "", + 9: "", + 10: "", + 11: "", + 12: "", + 13: "", + 14: "", + 15: "", + 16: "", + 17: "", + 18: "", + 19: "", + 20: "", + 21: "", + 22: "", + 23: "", + 24: "", + 25: "", + 26: "", + 27: "", + 28: "", + 29: "", } - this.warnFlag={ - 1:0, - 2:0, - 3:0, - 4:0, - 5:0, - 6:0, - 7:0, - 8:0, - 9:0, - 10:0, - 11:0, - 12:0, - 13:0, - 14:0, - 15:0, - 16:0, - 17:0, - 18:0, - 19:0, - 20:0, - 21:0, - 22:0, - 23:0, - 24:0, - 25:0, - 26:0, - 27:0, - 28:0, - 29:0, + this.warnFlag = { + 1: 0, + 2: 0, + 3: 0, + 4: 0, + 5: 0, + 6: 0, + 7: 0, + 8: 0, + 9: 0, + 10: 0, + 11: 0, + 12: 0, + 13: 0, + 14: 0, + 15: 0, + 16: 0, + 17: 0, + 18: 0, + 19: 0, + 20: 0, + 21: 0, + 22: 0, + 23: 0, + 24: 0, + 25: 0, + 26: 0, + 27: 0, + 28: 0, + 29: 0, } - this.passArray={ - 1:false, - 2:false, - 3:false, - 4:false, - 5:false, - 6:false, - 7:false, - 8:false, - 9:false, - 10:false, - 11:false, - 12:false, - 13:false, - 14:false, - 15:false, - 16:false, - 17:false, - 18:false, - 19:false, - 20:false, - 21:false, - 22:false, - 23:false, - 24:false, - 25:false, - 26:false, - 27:false, - 28:false, - 29:false, + this.passArray = { + 1: false, + 2: false, + 3: false, + 4: false, + 5: false, + 6: false, + 7: false, + 8: false, + 9: false, + 10: false, + 11: false, + 12: false, + 13: false, + 14: false, + 15: false, + 16: false, + 17: false, + 18: false, + 19: false, + 20: false, + 21: false, + 22: false, + 23: false, + 24: false, + 25: false, + 26: false, + 27: false, + 28: false, + 29: false, } this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) this.index = this.checkListCopy[0].key @@ -443,16 +399,75 @@ struct Index { name: 'kszj.wav' }) } - stopCheck(){ - this.breakFlag=false + getPLCInfo(){ + const that=this + globalThis.udpClient.onMessage((msg) => { + if (!this.breakFlag) { + return + } + const stachArr = msg.split(',') + if (stachArr[0] != '#DN_GD') { + return + } + this.signArr = stachArr + const dw = [14, 15, 16, 17, 18, 19, 20]; + const dwArr = [14, 15, 16, 17, 18, 19, 20] + if (dwArr.indexOf(this.index) >= 0) { + return + } + if (this.subFlag) { + //进项目 + that.stachValue[that.index] = that.signArr[that.realNum[that.index]] + + return + } + if (this.index == 26) { + //关闭所有灯光 + if (that.signArr[2] != '0' || that.signArr[3] != '0' || that.signArr[7] != '0' || that.signArr[8] != '0') { + } else { + this.warnFlag[26] = '2' + } + } + + if (that.index == 10 || that.index == 11 || that.index == 12 || that.index == 13) { + if (that.signArr[that.realNum[that.index]] != '1200') { + that.warnFlag[that.index] = '2' + } else { + } + return + } + + if (this.warnFlagTip[that.index].length > 1) { + if (that.stachValue[that.index] != that.signArr[that.realNum[that.index]]) { + that.warnFlag[that.index] = '2' + } + return + } + if (!Array.isArray(that.realNum[that.index])) { + if (dw.indexOf(that.index) >= 0) { + that.warnFlag[that.index] = (that.signArr[28] == that.dwMap[that.index] ? '2' : '0') + return + } + if (that.signArr[that.realNum[that.index]] !== '0') { + that.warnFlag[that.index] = '2' + } else { + + } + + } + }) } - getNextNode(){ + stopCheck() { + this.breakFlag = false + } + + getNextNode() { setTimeout(() => { - if(this.warnFlag[this.index]!='2'){ - this.warnFlag[this.index]='1' + if (this.warnFlag[this.index] != '2') { + this.warnFlag[this.index] = '1' } - if(!this.breakFlag){ + if (!this.breakFlag) { return } this.checkListCopy.splice(0, 1) @@ -461,82 +476,55 @@ struct Index { } else { this.zjFlag = true - let flag=false - for(let item in this.warnFlag){ - if(this.warnFlag[item]=='1'){ - flag=true + let flag = false + for (let item in this.warnFlag) { + if (this.warnFlag[item] == '1') { + flag = true } } this.vocObj.playAudio({ type: 1, - name: flag?'zjwtg.wav':'zjtg.wav' + name: flag ? 'zjwtg.wav' : 'zjtg.wav' }) - if(globalThis.singlePlay){ + if (globalThis.singlePlay) { return } let date = new Date(); - const data={ - time:dateFormat(date), - carId:globalThis.carInfo.carId, - examinationRoomId:globalThis.carInfo.examinationRoomId, - plateNo:globalThis.carInfo.plateNo, - flag:flag?'N':'Y', - condition:flag?'自检不通过':'自检通过' + const data = { + time: dateFormat(date), + carId: globalThis.carInfo.carId, + examinationRoomId: globalThis.carInfo.examinationRoomId, + plateNo: globalThis.carInfo.plateNo, + flag: flag ? 'N' : 'Y', + condition: flag ? '自检不通过' : '自检通过' } this.stopCheck() - uploadExamCarCheckResult(data).then((res)=>{ + uploadExamCarCheckResult(data).then((res) => { }) } }, parseInt(this.checkListCopy[0].time) * 1000) } getCheckList() { - // this.warnFlag[Math.ceil(this.index/2)]=!this.warnFlagTip[Math.ceil(this.index/2)] - if(!this.breakFlag){ + if (!this.breakFlag) { return } this.index = this.checkListCopy[0].key - this.passArray[this.index]=true - this.subFlag=true - const realNum = { - 3: 19, - 4: 17, - 5: 13, - 6: 12, - 7: 14, - 8: 18, - 9: 5, - 10: 29, - 11: 30, - 12: 31, - 13: 32, - 14: 27, - 15: 27, - 16: 27, - 17: 27, - 18: 27, - 19: 27, - 20: 27, - 21: 2, //左方向灯, - 22: 3, - 23: 7, - 24: 8, - 25: 20, - 26: '' - } - if(this.warnFlagTip[this.index].length==1){ + this.passArray[this.index] = true + this.subFlag = true + if (this.warnFlagTip[this.index].length == 1) { this.vocObj.playAudio({ type: 1, name: this.warnFlagTip[this.index][0], }) - }else if(this.warnFlagTip[this.index].length==2){ - if(this.signArr[realNum[this.index]]&&this.signArr[realNum[this.index]]!='0'){ + } else if (this.warnFlagTip[this.index].length == 2) { + if (this.signArr[this.realNum[this.index]] && this.signArr[this.realNum[this.index]] != '0') { this.vocObj.playAudio({ type: 1, name: this.warnFlagTip[this.index][1], }) - }else{ + } else { this.vocObj.playAudio({ type: 1, name: this.warnFlagTip[this.index][0], @@ -544,312 +532,235 @@ struct Index { } } - // this.index = (this.checkListCopy[0].key-4)*2+4 - // if(this.warnFlagTip[this.index].length==1){ - // this.vocObj.playAudio({ - // type: 1, - // name: this.warnFlagTip[this.index][0], - // }) - // } + } - playVideo(name){ - this.vocObj.playAudio({ - type: 1, - name: name, - nextName: '' - }) - } - outClick(){ - if(this.vocObj){ - this.vocObj.avPlayerStop() - this.vocObj.releasePlayer() - } - this.breakFlag=false + + outClick() { + this.vocObj&& this.vocObj.releasePlayer() + this.breakFlag = false } + build() { Column() { - TopLogo({outFlag:$outFlag}).margin({bottom:25.5*this.ratio}) - // Flex({justifyContent:FlexAlign.SpaceBetween}){ - // Row(){ - // Image($r('app.media.signal_logoS')).width(30*this.ratio).height(20*this.ratio).margin({left:15*this.ratio,right:15*this.ratio}) - // Text(this.time).fontColor('#EAA500').fontSize(18*this.ratio) - // } - // Image($r('app.media.topB_back')).width(125*this.ratio).height(50*this.ratio).onClick(()=>{ - // router.back() - // this.breakFlag=false - // }) - // }.width('100%').height(40*this.ratio).backgroundColor('#343434').margin({bottom:25.5*this.ratio}) - Flex({justifyContent:FlexAlign.SpaceBetween}){ - Column(){ - Row(){ - Image(this.passArray[0]?(this.warnFlag[0]=='0'?$r('app.media.cheliangmoxing'):(this.warnFlag[0]=='1'?$r('app.media.cheliangmoxing_r'):$r('app.media.cheliangmoxing_g'))):$r('app.media.cheliangmoxing')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[1]?(this.warnFlag[1]=='0'?$r('app.media.weixingxinhao'):(this.warnFlag[1]=='1'?$r('app.media.weixingxinhao_r'):$r('app.media.weixingxinhao_g'))):$r('app.media.weixingxinhao')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[2]?(this.warnFlag[2]=='0'?$r('app.media.shipinjiankong'):(this.warnFlag[2]=='1'?$r('app.media.shipingjiankong_r'):$r('app.media.shipinjiankong_g'))):$r('app.media.shipinjiankong')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[3]?(this.warnFlag[3]=='0'?$r('app.media.anquandai'):(this.warnFlag[3]=='1'?$r('app.media.anquandai_r'):$r('app.media.anquandai_g'))):$r('app.media.anquandai')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[4]?(this.warnFlag[4]=='0'?$r('app.media.liheqi'):(this.warnFlag[4]=='1'?$r('app.media.liheqi_r'):$r('app.media.leheqi_g'))):$r('app.media.liheqi')).width(138.5*this.ratio).height(112.5*this.ratio) + TopLogo({ outFlag: $outFlag }).margin({ bottom: 25.5 * this.ratio }) + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Row() { + Image(this.passArray[0] ? (this.warnFlag[0] == '0' ? $r('app.media.cheliangmoxing') : (this.warnFlag[0] == '1' ? $r('app.media.cheliangmoxing_r') : $r('app.media.cheliangmoxing_g'))) : $r('app.media.cheliangmoxing')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[1] ? (this.warnFlag[1] == '0' ? $r('app.media.weixingxinhao') : (this.warnFlag[1] == '1' ? $r('app.media.weixingxinhao_r') : $r('app.media.weixingxinhao_g'))) : $r('app.media.weixingxinhao')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[2] ? (this.warnFlag[2] == '0' ? $r('app.media.shipinjiankong') : (this.warnFlag[2] == '1' ? $r('app.media.shipingjiankong_r') : $r('app.media.shipinjiankong_g'))) : $r('app.media.shipinjiankong')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[3] ? (this.warnFlag[3] == '0' ? $r('app.media.anquandai') : (this.warnFlag[3] == '1' ? $r('app.media.anquandai_r') : $r('app.media.anquandai_g'))) : $r('app.media.anquandai')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[4] ? (this.warnFlag[4] == '0' ? $r('app.media.liheqi') : (this.warnFlag[4] == '1' ? $r('app.media.liheqi_r') : $r('app.media.leheqi_g'))) : $r('app.media.liheqi')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) } - Row(){ - Image(this.passArray[5]?(this.warnFlag[5]=='0'?$r('app.media.shousha'):(this.warnFlag[5]=='1'?$r('app.media.shousha_r'):$r('app.media.shousha_g'))):$r('app.media.shousha')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[6]?(this.warnFlag[6]=='0'?$r('app.media.jiaosha'):(this.warnFlag[6]=='1'?$r('app.media.jiaosha_r'):$r('app.media.jiaosha_g'))):$r('app.media.jiaosha')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[7]?(this.warnFlag[7]=='0'?$r('app.media.chemen'):(this.warnFlag[7]=='1'?$r('app.media.chemen_r'):$r('app.media.chemeen_g'))):$r('app.media.chemen')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[8]?(this.warnFlag[8]=='0'?$r('app.media.fusha'):(this.warnFlag[8]=='1'?$r('app.media.fusha_r'):$r('app.media.fusha_g'))):$r('app.media.fusha')).width(138.5*this.ratio).height(112.5*this.ratio) - Image(this.passArray[9]?(this.warnFlag[9]=='0'?$r('app.media.dianhuo'):(this.warnFlag[9]=='1'?$r('app.media.dianhuo_r'):$r('app.media.dianhuo_g'))):$r('app.media.dianhuo')).width(138.5*this.ratio).height(112.5*this.ratio) - // Image(this.passArray[6]?this.warnFlag[6]?$r('app.media.jiaosha_r'):$r('app.media.jiaosha_g'):$r('app.media.jiaosha')).width(138.5*this.ratio).height(112.5*this.ratio) - // Image(this.passArray[7]?this.warnFlag[7]?$r('app.media.chemen_r'):$r('app.media.chemeen_g'):$r('app.media.chemen')).width(138.5*this.ratio).height(112.5*this.ratio) - // Image(this.passArray[8]?this.warnFlag[8]?$r('app.media.fusha_r'):$r('app.media.fusha_g'):$r('app.media.fusha')).width(138.5*this.ratio).height(112.5*this.ratio) - // Image(this.passArray[9]?this.warnFlag[9]?$r('app.media.dianhuo_r'):$r('app.media.dianhuo_g'):$r('app.media.dianhuo')).width(138.5*this.ratio).height(112.5*this.ratio) + + Row() { + Image(this.passArray[5] ? (this.warnFlag[5] == '0' ? $r('app.media.shousha') : (this.warnFlag[5] == '1' ? $r('app.media.shousha_r') : $r('app.media.shousha_g'))) : $r('app.media.shousha')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[6] ? (this.warnFlag[6] == '0' ? $r('app.media.jiaosha') : (this.warnFlag[6] == '1' ? $r('app.media.jiaosha_r') : $r('app.media.jiaosha_g'))) : $r('app.media.jiaosha')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[7] ? (this.warnFlag[7] == '0' ? $r('app.media.chemen') : (this.warnFlag[7] == '1' ? $r('app.media.chemen_r') : $r('app.media.chemeen_g'))) : $r('app.media.chemen')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[8] ? (this.warnFlag[8] == '0' ? $r('app.media.fusha') : (this.warnFlag[8] == '1' ? $r('app.media.fusha_r') : $r('app.media.fusha_g'))) : $r('app.media.fusha')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + Image(this.passArray[9] ? (this.warnFlag[9] == '0' ? $r('app.media.dianhuo') : (this.warnFlag[9] == '1' ? $r('app.media.dianhuo_r') : $r('app.media.dianhuo_g'))) : $r('app.media.dianhuo')) + .width(138.5 * this.ratio) + .height(112.5 * this.ratio) + } } - if(this.breakFlag){ - Column(){ - Image($r('app.media.open_loading')).width(100*this.ratio).rotate({angle:this.angle}).height(100*this.ratio).animation({ - duration: 5000, // 动画时长 - curve: Curve.EaseOut, // 动画曲线 - delay: 500, // 动画延迟 - iterations:-1, // 播放次数 - playMode: PlayMode.Normal, // 动画模式 - }) - Text('等待检测…').fontSize(24*this.ratio).fontColor('#FFB133').margin({top:35*this.ratio}) + + if (this.breakFlag) { + Column() { + Image($r('app.media.open_loading')) + .width(100 * this.ratio) + .rotate({ angle: this.angle }) + .height(100 * this.ratio) + .animation({ + duration: 5000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线 + delay: 500, // 动画延迟 + iterations: -1, // 播放次数 + playMode: PlayMode.Normal, // 动画模式 + }) + Text('等待检测…').fontSize(24 * this.ratio).fontColor('#FFB133').margin({ top: 35 * this.ratio }) }.align(Alignment.Center).flexGrow(1) } } - Flex({justifyContent:FlexAlign.SpaceBetween}){ - Row(){ + + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + Row() { //绕车 - Column(){ - Row(){ - Image(this.warnFlag[10]=='1'?$r('app.media.zq_r'):this.warnFlag[10]=='2'?$r('app.media.zq'):'').width(102*this.ratio).height(118.5*this.ratio).visibility(this.passArray[10]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[11]=='1'?$r('app.media.yq_r'):this.warnFlag[11]=='2'?$r('app.media.yq'):'').width(102*this.ratio).height(118.5*this.ratio).visibility(this.passArray[11]?Visibility.Visible:Visibility.Hidden) + Column() { + Row() { + Image(this.warnFlag[10] == '1' ? $r('app.media.zq_r') : this.warnFlag[10] == '2' ? $r('app.media.zq') : '') + .width(102 * this.ratio) + .height(118.5 * this.ratio) + .visibility(this.passArray[10] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[11] == '1' ? $r('app.media.yq_r') : this.warnFlag[11] == '2' ? $r('app.media.yq') : '') + .width(102 * this.ratio) + .height(118.5 * this.ratio) + .visibility(this.passArray[11] ? Visibility.Visible : Visibility.Hidden) } - Row(){ - Image(this.warnFlag[12]=='1'?$r('app.media.zh_r'):this.warnFlag[12]=='2'?$r('app.media.zh'):'').width(103*this.ratio).height(118.5*this.ratio).visibility(this.passArray[12]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[13]=='1'?$r('app.media.yh_r'):this.warnFlag[13]=='2'?$r('app.media.yh'):'').width(103*this.ratio).height(118.5*this.ratio).visibility(this.passArray[13]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[12]?$r('app.media.zh_r'):$r('app.media.zh')).width(103*this.ratio).height(118.5*this.ratio).visibility(this.passArray[12]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[13]?$r('app.media.yh_r'):$r('app.media.yh')).width(103*this.ratio).height(118.5*this.ratio).visibility(this.passArray[13]?Visibility.Visible:Visibility.Hidden) + Row() { + Image(this.warnFlag[12] == '1' ? $r('app.media.zh_r') : this.warnFlag[12] == '2' ? $r('app.media.zh') : '') + .width(103 * this.ratio) + .height(118.5 * this.ratio) + .visibility(this.passArray[12] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[13] == '1' ? $r('app.media.yh_r') : this.warnFlag[13] == '2' ? $r('app.media.yh') : '') + .width(103 * this.ratio) + .height(118.5 * this.ratio) + .visibility(this.passArray[13] ? Visibility.Visible : Visibility.Hidden) } - }.backgroundImage($r('app.media.rc')).backgroundImageSize({width:'100%',height:'100%'}).width(206*this.ratio).height(235.5*this.ratio) + } + .backgroundImage($r('app.media.rc')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .width(206 * this.ratio) + .height(235.5 * this.ratio) //档位 - Column(){ - Image(this.warnFlag[14]=='1'?$r('app.media.1_r'):this.warnFlag[14]=='2'?$r('app.media.1'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:25*this.ratio,y:57*this.ratio}).visibility(this.passArray[14]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[16]=='1'?$r('app.media.3_r'):this.warnFlag[16]=='2'?$r('app.media.3'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:57*this.ratio}).visibility(this.passArray[16]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[18]=='1'?$r('app.media.5_r'):this.warnFlag[18]=='2'?$r('app.media.5'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:139.5*this.ratio,y:57*this.ratio}).visibility(this.passArray[18]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[15]=='1'?$r('app.media.2_r'):this.warnFlag[15]=='2'?$r('app.media.2'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:25*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[15]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[17]=='1'?$r('app.media.4_r'):this.warnFlag[17]=='2'?$r('app.media.4'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[17]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[19]=='1'?$r('app.media.R_r'):this.warnFlag[19]=='2'?$r('app.media.R'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:139.5*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[19]?Visibility.Visible:Visibility.Hidden) - Image(this.warnFlag[20]=='1'?$r('app.media.N_r'):this.warnFlag[20]=='2'?$r('app.media.N'):'').width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:115.5*this.ratio}).visibility(this.passArray[20]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[14]?$r('app.media.1_r'):$r('app.media.1')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:25*this.ratio,y:57*this.ratio}).visibility(this.passArray[14]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[16]?$r('app.media.3_r'):$r('app.media.3')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:57*this.ratio}).visibility(this.passArray[16]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[18]?$r('app.media.5_r'):$r('app.media.5')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:139.5*this.ratio,y:57*this.ratio}).visibility(this.passArray[18]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[15]?$r('app.media.2_r'):$r('app.media.2')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:25*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[15]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[17]?$r('app.media.4_r'):$r('app.media.4')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[17]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[19]?$r('app.media.R_r'):$r('app.media.R')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:139.5*this.ratio,y:173.5*this.ratio}).visibility(this.passArray[19]?Visibility.Visible:Visibility.Hidden) - // Image(this.warnFlag[20]?$r('app.media.N_r'):$r('app.media.N')).width(44.5*this.ratio).height(44.5*this.ratio).position({x:82.5*this.ratio,y:115.5*this.ratio}).visibility(this.passArray[20]?Visibility.Visible:Visibility.Hidden) + Column() { + Image(this.warnFlag[14] == '1' ? $r('app.media.1_r') : this.warnFlag[14] == '2' ? $r('app.media.1') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 25 * this.ratio, y: 57 * this.ratio }) + .visibility(this.passArray[14] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[16] == '1' ? $r('app.media.3_r') : this.warnFlag[16] == '2' ? $r('app.media.3') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 82.5 * this.ratio, y: 57 * this.ratio }) + .visibility(this.passArray[16] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[18] == '1' ? $r('app.media.5_r') : this.warnFlag[18] == '2' ? $r('app.media.5') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 139.5 * this.ratio, y: 57 * this.ratio }) + .visibility(this.passArray[18] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[15] == '1' ? $r('app.media.2_r') : this.warnFlag[15] == '2' ? $r('app.media.2') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 25 * this.ratio, y: 173.5 * this.ratio }) + .visibility(this.passArray[15] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[17] == '1' ? $r('app.media.4_r') : this.warnFlag[17] == '2' ? $r('app.media.4') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 82.5 * this.ratio, y: 173.5 * this.ratio }) + .visibility(this.passArray[17] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[19] == '1' ? $r('app.media.R_r') : this.warnFlag[19] == '2' ? $r('app.media.R') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 139.5 * this.ratio, y: 173.5 * this.ratio }) + .visibility(this.passArray[19] ? Visibility.Visible : Visibility.Hidden) + Image(this.warnFlag[20] == '1' ? $r('app.media.N_r') : this.warnFlag[20] == '2' ? $r('app.media.N') : '') + .width(44.5 * this.ratio) + .height(44.5 * this.ratio) + .position({ x: 82.5 * this.ratio, y: 115.5 * this.ratio }) + .visibility(this.passArray[20] ? Visibility.Visible : Visibility.Hidden) + } + .backgroundImage($r('app.media.dw')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .width(206 * this.ratio) + .height(235.5 * this.ratio) - }.backgroundImage($r('app.media.dw')).backgroundImageSize({width:'100%',height:'100%'}).width(206*this.ratio).height(235.5*this.ratio) - Column(){ - Row(){ - Image(this.passArray[21]?(this.warnFlag[21]=='0'?$r('app.media.zuo'):(this.warnFlag[21]=='1'?$r('app.media.zuo_r'):$r('app.media.zuo_g'))):$r('app.media.zuo')).width(138.5*this.ratio).height(81.5*this.ratio) - Image(this.passArray[22]?(this.warnFlag[22]=='0'?$r('app.media.you'):(this.warnFlag[22]=='1'?$r('app.media.you_r'):$r('app.media.you_g'))):$r('app.media.you')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[21]?this.warnFlag[21]?$r('app.media.zuo_r'):$r('app.media.zuo_g'):$r('app.media.zuo')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[22]?this.warnFlag[22]?$r('app.media.you_r'):$r('app.media.you_g'):$r('app.media.you')).width(138.5*this.ratio).height(81.5*this.ratio) + Column() { + Row() { + Image(this.passArray[21] ? (this.warnFlag[21] == '0' ? $r('app.media.zuo') : (this.warnFlag[21] == '1' ? $r('app.media.zuo_r') : $r('app.media.zuo_g'))) : $r('app.media.zuo')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) + Image(this.passArray[22] ? (this.warnFlag[22] == '0' ? $r('app.media.you') : (this.warnFlag[22] == '1' ? $r('app.media.you_r') : $r('app.media.you_g'))) : $r('app.media.you')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) } - Row(){ - Image(this.passArray[23]?(this.warnFlag[23]=='0'?$r('app.media.zuo1'):(this.warnFlag[23]=='1'?$r('app.media.yuanguangdeng_r'):$r('app.media.yuanguangdeng_g'))):$r('app.media.zuo1')).width(138.5*this.ratio).height(81.5*this.ratio) - Image(this.passArray[24]?(this.warnFlag[24]=='0'?$r('app.media.jinguangdeng'):(this.warnFlag[24]=='1'?$r('app.media.jinguangdeng_r'):$r('app.media.jinguangdeng_g'))):$r('app.media.jinguangdeng')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[23]?this.warnFlag[23]?$r('app.media.yuanguangdeng_r'):$r('app.media.yuanguangdeng_g'):$r('app.media.zuo1')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[24]?this.warnFlag[24]?$r('app.media.jinguangdeng_r'):$r('app.media.jinguangdeng_g'):$r('app.media.jinguangdeng')).width(138.5*this.ratio).height(81.5*this.ratio) + + Row() { + Image(this.passArray[23] ? (this.warnFlag[23] == '0' ? $r('app.media.zuo1') : (this.warnFlag[23] == '1' ? $r('app.media.yuanguangdeng_r') : $r('app.media.yuanguangdeng_g'))) : $r('app.media.zuo1')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) + Image(this.passArray[24] ? (this.warnFlag[24] == '0' ? $r('app.media.jinguangdeng') : (this.warnFlag[24] == '1' ? $r('app.media.jinguangdeng_r') : $r('app.media.jinguangdeng_g'))) : $r('app.media.jinguangdeng')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) } - Row(){ - Image(this.passArray[25]?(this.warnFlag[25]=='0'?$r('app.media.guzhang'):(this.warnFlag[25]=='1'?$r('app.media.guzhang_r'):$r('app.media.guzhang_g'))):$r('app.media.guzhang')).width(138.5*this.ratio).height(81.5*this.ratio) - Image(this.passArray[26]?(this.warnFlag[26]=='0'?$r('app.media.jinzhi'):(this.warnFlag[26]=='1'?$r('app.media.jinzhi_r'):$r('app.media.jinzhi_g'))):$r('app.media.jinzhi')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[25]?this.warnFlag[25]?$r('app.media.guzhang_r'):$r('app.media.guzhang_g'):$r('app.media.guzhang')).width(138.5*this.ratio).height(81.5*this.ratio) - // Image(this.passArray[26]?this.warnFlag[26]?$r('app.media.jinzhi_r'):$r('app.media.jinzhi_g'):$r('app.media.jinzhi')).width(138.5*this.ratio).height(81.5*this.ratio) + + Row() { + Image(this.passArray[25] ? (this.warnFlag[25] == '0' ? $r('app.media.guzhang') : (this.warnFlag[25] == '1' ? $r('app.media.guzhang_r') : $r('app.media.guzhang_g'))) : $r('app.media.guzhang')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) + Image(this.passArray[26] ? (this.warnFlag[26] == '0' ? $r('app.media.jinzhi') : (this.warnFlag[26] == '1' ? $r('app.media.jinzhi_r') : $r('app.media.jinzhi_g'))) : $r('app.media.jinzhi')) + .width(138.5 * this.ratio) + .height(81.5 * this.ratio) } } } - Column(){ - if(this.breakFlag){ - Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){ - }.width(215*this.ratio).height(64*this.ratio).margin({bottom:10*this.ratio}).onClick(()=>{ - }).zIndex(11) - }else{ - // Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){ - // Image($r('app.media.xhxs')).width(28*this.ratio).height(28*this.ratio) - // Text('信号显示').fontColor('#fff').fontSize(24*this.ratio) - // } + Column() { + if (this.breakFlag) { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + + } + .width(215 * this.ratio) + .height(64 * this.ratio) + .margin({ bottom: 10 * this.ratio }) + .onClick(() => { + }) + .zIndex(11) + } else { + Image($r('app.media.xhxs_btn')) - .width(215*this.ratio).height(64*this.ratio).backgroundImage($r('app.media.button_nor')).backgroundImageSize({width:'100%',height:'100%'}).margin({bottom:10*this.ratio}).onClick(()=>{ - // console.log("laogoao") - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) - this.xhxs() - }).zIndex(11) + .width(215 * this.ratio) + .height(64 * this.ratio) + .backgroundImage($r('app.media.button_nor')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ bottom: 10 * this.ratio }) + .onClick(() => { + + this.xhxs() + }) + .zIndex(11) } - // Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){ - // Image($r('app.media.tczj')).width(28*this.ratio).height(28*this.ratio) - // Text('退出自检').fontColor('#fff').fontSize(24*this.ratio) - // } Image($r('app.media.tczj_btn')) - .width(215*this.ratio).height(64*this.ratio).backgroundImage($r('app.media.button_nor')).backgroundImageSize({width:'100%',height:'100%'}).margin({bottom:10*this.ratio}).onClick(()=>{ - this.stopCheck() - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) - // this.udpClient.closeUdp(()=>{ - // - // }) - // this.udpClient.onMessage(()=>{ - // prompt.showToast({ - // message: JSON.stringify(('msgChange')), - // duration: 3000 - // }); - // }) - }).zIndex(11) - // Flex({justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center}){ - // Text('开始自检').fontColor('#fff').fontSize(24*this.ratio) - // } - Image($r('app.media.kszj_btn')) - .width(215*this.ratio).height(64*this.ratio).backgroundImage($r('app.media.anniu_nor')).backgroundImageSize({width:'100%',height:'100%'}).margin({bottom:10*this.ratio}).onClick(()=>{ - // console.log(event) - this.kszj() - const that=this - setTimeout(()=>{ - this.angle=360 - },1000) - - globalThis.udpClient.onMessage((msg) => { - if(!this.breakFlag){ - return - } - // - // that.signArr = msg.split(',') - // if (this.signArr[0] != '#DN_GD') { - // return - // } - const stachArr=msg.split(',') - if (stachArr[0] != '#DN_GD') { - return - } - this.signArr = stachArr - const realNum = { - 3: 19, - 4: 17, - 5: 13, - 6: 12, - 7: 14, - 8: 18, - 9: 5, - 10: 29, - 11: 30, - 12: 31, - 13: 32, - 14: 28, - 15: 28, - 16: 28, - 17: 28, - 18: 28, - 19: 28, - 20: 28, - 21: 2, //左方向灯, - 22: 3, - 23: 7, - 24: 8, - 25: 20, - 26: '' - } - const dw = [14, 15, 16, 17, 18, 19, 20]; - const dwMap = { - 14: '1', - 15: '2', - 16: '3', - 17: '4', - 18: '5', - 19: '9', - 20: '0' - } - const dwArr=[14,15,16,17,18,19,20] - if(dwArr.indexOf(this.index)>=0){ - return - } - if(this.subFlag){ - //进项目 - that.stachValue[that.index]=that.signArr[realNum[that.index]] - - return - } - if(this.index==26){ - //关闭所有灯光 - if(that.signArr[2]!='0'||that.signArr[3]!='0'||that.signArr[7]!='0'||that.signArr[8]!='0'){ - // this.warnFlag[26]='1' - }else{ - this.warnFlag[26]='2' - } - } - - if(that.index==10||that.index==11||that.index==12||that.index==13){ - if(that.signArr[realNum[that.index]] != '1200'){ - that.warnFlag[that.index]='2' - }else{ - } - return - } - - if(this.warnFlagTip[that.index].length>1){ - if(that.stachValue[that.index]!=that.signArr[realNum[that.index]]){ - that.warnFlag[that.index]='2' - }else{ - // that.warnFlag[that.index]='1' - } - return - } - - - if (!Array.isArray(realNum[that.index])) { - if (dw.indexOf(that.index) >= 0) { - // that.warnFlagTip[Math.ceil(that.index/2)] = that.signArr[28] == dwMap[Math.ceil(that.index/2)] ? true : false - that.warnFlag[that.index] = (that.signArr[28] == dwMap[that.index] ? '2' : '0') - return - } - - - if(that.signArr[realNum[that.index]] !== '0'){ - // that.warnFlagTip[that.index]=true - that.warnFlag[that.index]='2' - }else{ - // that.warnFlagTip[that.index]=false - // that.warnFlag[that.index]='1' - } - // this.warnFlag = !this.signArr[realNum[this.index]] - } - - // else { - // let flag=false - // realNum[that.index].map(res => { - // if (that.signArr[res] !== '0') { - // flag=true - // // that.warnFlagTip[that.index] = true - // that.warnFlag[that.index]='2' - // } - // }) - // if(!flag){ - // // that.warnFlagTip[that.index]=false - // that.warnFlag[that.index]='1' - // } - // } + .width(215 * this.ratio) + .height(64 * this.ratio) + .backgroundImage($r('app.media.button_nor')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ bottom: 10 * this.ratio }) + .onClick(() => { + this.stopCheck() }) - // globalThis.udpClient.sendMsg('111') - - }).zIndex(11) + .zIndex(11) + Image($r('app.media.kszj_btn')) + .width(215 * this.ratio) + .height(64 * this.ratio) + .backgroundImage($r('app.media.anniu_nor')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ bottom: 10 * this.ratio }) + .onClick(() => { + this.kszj() + this.getPLCInfo() + setTimeout(() => { + this.angle = 360 + }, 1000) + }) + .zIndex(11) } }.width('100%') } - .height('100%').width('100%').backgroundImage($r('app.media.bg')).backgroundImageSize({width:'100%',height:'100%'}) + .height('100%') + .width('100%') + .backgroundImage($r('app.media.bg')) + .backgroundImageSize({ width: '100%', height: '100%' }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fc04d283..e55c41e9 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -3,7 +3,7 @@ import common from '@ohos.app.ability.common'; import router from '@ohos.router' import { getCarInfo, getDeviceInfo } from '../common/service/terminalService' import { setCurrentTime } from '../common/service/timeService' -import {Array2Byte,string2Bytes} from '../common/utils/tools' +import {string2Bytes} from '../common/utils/tools' import { getEsCarModel, } from '../common/service/initable' @@ -61,7 +61,7 @@ struct Index { Column() { Row() { if (!this.isSingle) { - Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(() => { + Image($r('app.media.index_lw')).width('30.5%').height('74%').onClick(async() => { if (this.loading) { return } @@ -72,15 +72,11 @@ struct Index { this.angle = 0 //mode为3双中心下载表 if(globalThis.timeInfo.mode=='3'){ - getDoubleCeneterTable().then(()=>{ - this.loading=false - }) + await getDoubleCeneterTable() }else{ - getSingleCenterTable().then(()=>{ - this.loading=false - }) + await getSingleCenterTable() } - + this.loading=false }) } diff --git a/entry/src/main/ets/pages/Settings.ets b/entry/src/main/ets/pages/Settings.ets index a39675ce..1a80fbd6 100644 --- a/entry/src/main/ets/pages/Settings.ets +++ b/entry/src/main/ets/pages/Settings.ets @@ -18,31 +18,18 @@ struct Index { Column() { Row() { Image($r('app.media.setting_clzc')).width('30.5%').height('74%').onClick(()=>{ - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) this.url='pages/register' router.pushUrl({ url: this.url, },router.RouterMode.Single); }) Image($r('app.media.setting_spjk')).width('30.5%').height('74%').onClick(()=>{ - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) this.url='pages/videoConfig' router.pushUrl({ url: this.url, },router.RouterMode.Single); }) Image($r('app.media.setting_xtts')).width('30.5%').height('74%').onClick(()=>{ - console.info('jiangsong Button onClick') - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) this.url='pages/TeminalInfos' router.pushUrl({ url: this.url, @@ -74,21 +61,11 @@ struct Index { .backgroundImageSize({ width: '100%', height: '100%' }) } aboutToAppear() { - console.info('jiangsong:index Index aboutToAppear'); this.carNum = globalThis.carInfo.plateNo; this.version = globalThis.version; this.hasAuth = globalThis.hasAuth; } - onPageShow() { - console.info('Index onPageShow'); - // tF = new voiceService(async (status,val) => { - // if (status == 'idle') { - // router.pushUrl({ - // url: this.url, - // }); - // } - // }); - } + outClick(){ } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/SignDisplay.ets b/entry/src/main/ets/pages/SignDisplay.ets index 1c8bf7d5..66026bc1 100644 --- a/entry/src/main/ets/pages/SignDisplay.ets +++ b/entry/src/main/ets/pages/SignDisplay.ets @@ -1,10 +1,6 @@ import router from '@ohos.router' import UdpClient from '../common/utils/UdpClient'; import FileLog from './judgeSDK/utils/file-log' -import { voiceService } from '../common/service/voiceService' -import prompt from '@ohos.prompt' -import SerialPortClient from '../common/utils/SerialPortClient' -import RealTime from './compontents/judge/real-time' import signDisplayCom from './compontents/signDisplayCom' @Entry @Component diff --git a/entry/src/main/ets/pages/TerminalInfo.ets b/entry/src/main/ets/pages/TerminalInfo.ets index 864082ae..3b1037ea 100644 --- a/entry/src/main/ets/pages/TerminalInfo.ets +++ b/entry/src/main/ets/pages/TerminalInfo.ets @@ -9,12 +9,12 @@ import { voiceService } from '../common/service/voiceService' @Entry @Component struct Index { - @State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:','中心服务器IP:','心跳响应端口:', 'GPS响应端口:'] + @State textList1: string[] = ['ftp服务器IP:','响应端口','前置机IP','响应端口', '子网掩码','默认网关','用户名:', '密码:','dns','差分服务器IP: ', '响应端口:',] @State textList2: string[] = ['后置机IP:','响应端口:', '本地端口:'] @State ratio: number = 850 / 960 @State inputFontSize:number=12 //12 // - @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.203','8000','192.168.36.9','11111','33333'] + @State inputTextList1: string[] = ['192.168.36.2','8083','192.168.36.92','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.203','8000',] @State inputTextList2: string[] = ['192.168.36.91','20022'] // 112.80.35.83 11052 // @State inputTextList1: string[] = ['192.168.7.254','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11052'] @@ -101,13 +101,7 @@ struct Index { .borderRadius('25px') Column() { Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{ - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) - upDateTableConfig('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8],centerIp:this.inputTextList1[11],heartPort:this.inputTextList1[12],gpsPort:this.inputTextList1[13]}]) - - console.log('kkkk2',this.inputTextList2.toString()) + upDateTableConfig('IpConfigTable',[{udplocalIp:this.inputTextList1[2],udplocalIpPort:this.inputTextList1[3],udpOppositeIp:this.inputTextList2[0],udpOppositeIpPort:this.inputTextList2[1],tcplocalIp:this.inputTextList1[0],tcplocalIpPort:this.inputTextList1[1],tcpOppositeIp:this.inputTextList1[9],tcpOppositePort:this.inputTextList1[10],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[8]}]) ethernet.setIfaceConfig("eth0", { mode: 0, ipAddr:this.inputTextList1[2], @@ -123,10 +117,10 @@ struct Index { duration: 3000 }); } else { - prompt.showToast({ - message: '设置成功', - duration: 3000 - }); + prompt.showToast({ + message: '设置成功', + duration: 3000 + }); } }); }) @@ -151,41 +145,41 @@ struct Index { .backgroundImage($r('app.media.index_bg')) .backgroundImageSize({ width: '100%', height: '100%' }) } - aboutToAppear() { - getSyncData('IpConfigTable').then((result:Array)=>{ - console.log('result222',JSON.stringify(result)) - if(result.length){ - console.log('tagtag',JSON.stringify(result)) - this.inputTextList1[2]=result[0].udplocalIp - this.inputTextList1[3]=result[0].udplocalIpPort - this.inputTextList2[0]=result[0].udpOppositeIp - this.inputTextList2[1]=result[0].udpOppositeIpPort + aboutToAppear() { + getSyncData('IpConfigTable').then((result:Array)=>{ + console.log('result222',JSON.stringify(result)) + if(result.length){ + console.log('tagtag',JSON.stringify(result)) + this.inputTextList1[2]=result[0].udplocalIp + this.inputTextList1[3]=result[0].udplocalIpPort + this.inputTextList2[0]=result[0].udpOppositeIp + this.inputTextList2[1]=result[0].udpOppositeIpPort - this.inputTextList1[0]=result[0].tcplocalIp - this.inputTextList1[1]=result[0].tcplocalIpPort - this.inputTextList1[9]=result[0].tcpOppositeIp - this.inputTextList1[10]=result[0].tcpOppositePort - this.inputTextList1[5]=result[0].gateway - this.inputTextList1[4]=result[0].netMask - this.inputTextList1[8]=result[0].dnsServers - this.inputTextList1[11]=result[0].centerIp - this.inputTextList1[12]=result[0].heartPort - this.inputTextList1[13]=result[0].gpsPort - } - }) - ethernet.getIfaceConfig("eth0", (error, value) => { - if (error) { - // that.errorMsg='error' - console.log("boot_up getIp_new callback error = " + JSON.stringify(error)); - } else { - console.log("boot_up getIp_new callback ipAddr = " + JSON.stringify(value.ipAddr)); // - console.log(" boot_up getIp_new callback mode = " + JSON.stringify(value.mode)); - console.log("boot_up getIp_new callback route = " + JSON.stringify(value.route)); - console.log("boot_up getIp_new callback gateway = " + JSON.stringify(value.gateway)); - console.log("boot_up getIp_new callback netMask = " + JSON.stringify(value.netMask)); - console.log("boot_up getIp_new callback dnsServers = " + JSON.stringify(value.dnsServers)); - } - }) + this.inputTextList1[0]=result[0].tcplocalIp + this.inputTextList1[1]=result[0].tcplocalIpPort + this.inputTextList1[9]=result[0].tcpOppositeIp + this.inputTextList1[10]=result[0].tcpOppositePort + this.inputTextList1[5]=result[0].gateway + this.inputTextList1[4]=result[0].netMask + this.inputTextList1[8]=result[0].dnsServers + this.inputTextList1[11]=result[0].centerIp + this.inputTextList1[12]=result[0].heartPort + this.inputTextList1[13]=result[0].gpsPort + } + }) + ethernet.getIfaceConfig("eth0", (error, value) => { + if (error) { + // that.errorMsg='error' + console.log("boot_up getIp_new callback error = " + JSON.stringify(error)); + } else { + console.log("boot_up getIp_new callback ipAddr = " + JSON.stringify(value.ipAddr)); // + console.log(" boot_up getIp_new callback mode = " + JSON.stringify(value.mode)); + console.log("boot_up getIp_new callback route = " + JSON.stringify(value.route)); + console.log("boot_up getIp_new callback gateway = " + JSON.stringify(value.gateway)); + console.log("boot_up getIp_new callback netMask = " + JSON.stringify(value.netMask)); + console.log("boot_up getIp_new callback dnsServers = " + JSON.stringify(value.dnsServers)); + } + }) } onPageShow() { diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index f14c02c1..9a8ab1a0 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -664,7 +664,6 @@ struct UserInfo { if (this.showFaceCompare) { FaceCompare({ - showFaceCompare: $showFaceCompare, sfzh: this.currentUser.sfzmhm, firstImage: this.currentUser.kszp, faceCompareSucess: $faceCompareSucess, diff --git a/entry/src/main/ets/pages/register.ets b/entry/src/main/ets/pages/register.ets index cff88698..22d41d22 100644 --- a/entry/src/main/ets/pages/register.ets +++ b/entry/src/main/ets/pages/register.ets @@ -5,7 +5,7 @@ import { dateFormat} from '../common/utils/tools' import deviceManager from '@ohos.distributedHardware.deviceManager' import { upDateTableConfig } from '../common/service/initable' import { voiceService } from '../common/service/voiceService' -import prompt from '@ohos.prompt' +import promptAction from '@ohos.promptAction' @Entry @Component struct Index { @@ -19,8 +19,6 @@ struct Index { @State @Watch('outClick') outFlag: boolean = false; @State subType: string = '2'; onPageShow() { - // this.ip = globalThis.diskId - this.plateNo=globalThis.carInfo.plateNo deviceManager.createDeviceManager('com.example.udptest', (error, value) => { if (error) { @@ -29,9 +27,9 @@ struct Index { } let dvMgrObj = value; this.deviceName = dvMgrObj.getLocalDeviceInfoSync().deviceName - this.deviceNo=dvMgrObj.getLocalDeviceInfoSync().deviceId - this.ip='MAC-'+this.deviceName.toUpperCase() - globalThis.deviceNo='MAC-'+this.deviceName + this.deviceNo=dvMgrObj.getLocalDeviceInfoSync().deviceId.substring(0,10).toUpperCase() + this.ip='MAC-'+this.deviceNo + globalThis.deviceNo='MAC-'+this.deviceNo }); } @@ -46,16 +44,11 @@ struct Index { .width(50).onChange((isChecked: boolean) => { if(isChecked) this.subType = '2' - this.ip='MAC-'+this.deviceName + this.ip='MAC-'+this.deviceNo globalThis.deviceNo=this.ip - // this.ip = globalThis.diskId }) Text('网卡').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * this.ratio }) - - }.onClick(() => { - // this.checked = '0' - // this.ip = globalThis.diskId - }) + } Row() { Radio({ value: '1', group: 'radioGroup' }).checked(this.subType=='3'?true:false) @@ -63,36 +56,15 @@ struct Index { .width(50).onChange((isChecked: boolean) => { if(isChecked) this.subType = '3' - this.ip='DISK-'+this.deviceName + this.ip='DISK-'+this.deviceNo globalThis.deviceNo=this.ip // this.ip = ip }) Text('硬盘').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 83 * this.ratio }) - - }.onClick(() => { - // this.checked = '1' - // this.ip = globalThis.deviceNo - }) - - // Image($r('app.media.huoqu_nor')).width(185 * this.ratio).height(89 * this.ratio).onClick(() => { - // // this.checked = '1111' - // getDeviceInfo() - // }) + } }.margin({ top: 35 * this.ratio }) Row() { - // Column(){ - // Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - // Text(this.plateNo).fontColor('#fff').fontSize(33.6 * this.ratio) - // }.width('100%') - // .height('100%') - // .padding({ left: 30 * this.ratio, right: 30 * this.ratio }) - // } - // .backgroundImage($r('app.media.xk')) - // .backgroundImageSize({ width: '100%', height: '100%' }) - // .width(220 * this.ratio) - // .height(108 * this.ratio) - Column(){ Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text(this.ip).fontColor('#fff') @@ -128,14 +100,9 @@ struct Index { outClick(){ } registrationDeviceNoFn(){ - // this.vocObj.playAudio({ - // type: 1, - // name: 'media_button.wav' - // }) const date=new Date() const param={ time: dateFormat(date), - // deviceNo:this.deviceNo, deviceName:this.ip, type:'1' } @@ -143,7 +110,7 @@ struct Index { upDateTableConfig('DeviceInfoTable',[{deviceId:this.ip}]) registrationDeviceNo(param).then(res=>{ if(res.registrationDeviceNoRsp.head.resultCode=='0'){ - prompt.showToast({ + promptAction.showToast({ message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage), duration: 3000 }); diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 473978ff..d52e162a 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -16,7 +16,7 @@ "name": "EntryAbility", "srcEntrance": "./ets/entryability/EntryAbility.ts", "description": "$string:EntryAbility_desc", - "icon": "$media:icon", + "icon": "$media:logo_app", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background",