diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index a91c34ba..27c19d23 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -128,6 +128,8 @@ export async function getDoubleCeneterTable(param) { export async function getSingleCenterTable(param) { return new Promise((reslove, reject) => { upDataZhongxinginitialization(param).then((result) => { + console.log('teststetfinsh01') + if (result) { reslove(true) } else { diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index 4946d97d..713ff39d 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -85,10 +85,10 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { }, map[tableName], context); accountTable.getRdbStore(() => { accountTable.query('0', async (result) => { - console.log('sqlsqlinsertresult',JSON.stringify(result)) + console.log('teststet3',) + // console.log('表长度',result.length,tableName) if (result.length == 0) { - console.log('sqlsqlinsert00000') let INSERT_SQL = "INSERT INTO " + tableName + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES " @@ -109,8 +109,10 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { } INSERT_SQL += str }) - console.log('sqlsqlinsertINSERT_SQLINSERT_SQL', INSERT_SQL) + console.log('sqlsINSERT_SQLINSERT_SQL', INSERT_SQL) accountTable.sqlOperate(INSERT_SQL, tableName, (val) => { + console.log('teststet3',val,tableName) + console.log('sqlsqlinsert,', val, 'tableName', tableName) resolve(val) }) @@ -167,8 +169,8 @@ export async function getDataBaseTable(params, reqParam) { //依据数组和表名更新sql表 export async function upDateTableByArray(tableName, arr) { - return new Promise(async (reslove,reject)=>{ - const data =await sqlInsertCommonFn(tableName, arr) + return new Promise(async (reslove, reject) => { + const data = await sqlInsertCommonFn(tableName, arr) reslove(data) }) } @@ -327,30 +329,26 @@ export async function getEsCarModel(context) { } export async function upDataZhongxinginitialization(param) { - return new Promise((resolve, reject) => { + return new Promise(async(resolve, reject) => { if (!param.carId) { resolve(false) return } - if(param.singlePlay){ + if (param.singlePlay) { + console.log('teststet0') const fileUtil = new FileUtil(param.context) - const tableList=['MA_ITEMINFO','MA_MARKRULE','MA_SYSTEMPARM','MA_MAP_COLLECT','MA_MAP_COLLECT_SHAPE','MA_MAP_ITEMCLASS','MA_MAP_POINT','MA_MAP_POINT_ITEM','MA_MAP_ROAD','MA_MAP_ROAD_LANE','MAP_SUBITEM','MA_SYSSET','ES_CARINFO','MA_MARKRULESET','MA_CDSBINFO','MA_T_CARPARMSET']; - tableList.map(async(tableName)=>{ - const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableName}.txt`); - if(data&&JSON.parse(data)){ - sqlInsertCommonFn(tableName, JSON.parse(data), param.context).then((result) => { - console.log(key, '单机表建立成功') - if (result) { - resolve(true) - } else { - resolve(false) - } - }).catch((msg) => { - reject(false) - console.log(key, '单机表建立失败') - }) - } - }) + const tableList = ['MA_SYSSET', 'MA_SYSTEMPARM', 'MA_MARKRULE', 'MA_MARKRULESET','ES_CARINFO','MA_MAP_ROAD','MA_MAP_ROAD_LANE','MAP_SUBITEM','MA_T_CARPARMSET','MA_MAP_ITEMCLASS','MA_MAP_POINT','MA_MAP_POINT_ITEM']; + + for(let i=0;i<=tableList.length-1;i++){ + console.log('teststet1',tableList[i]) + const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableList[i]}.txt`); + console.log('teststet1',data) + + await sqlInsertCommonFn(tableList[i], JSON.parse(data) || [], param.context) + console.log('teststet2',data) + } + console.log('teststetfinsh') + resolve(true) return } const str = { @@ -393,7 +391,7 @@ export async function upDataZhongxinginitialization(param) { } function setSyncCenterSqlData(key, res, param) { - return new Promise(async(resolve, reject) => { + return new Promise(async (resolve, reject) => { const mapName = { 'ItemInfo': 'MA_ITEMINFO', 'MarkRule': 'MA_MARKRULE', diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index 4452f33d..72b950f4 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -115,9 +115,19 @@ export default class TcpClient { // socketTimeout: 3000, }, err => { if (err) { + console.log('testTagtestTagerrrrr,success') + if(this.num>3){ + return + } + setTimeout(() => { + getTCP() + resolve(false) + }, 2000) return; } }); + console.log('testTagtestTagconnect,success') + globalThis.getCloseTcp = false resolve(true) }).catch(err => { @@ -130,7 +140,7 @@ export default class TcpClient { getTCP() resolve(false) }, 2000) - console.log('testTagconnect,error') + console.log('testTagtestTagconnect,error') }); }) @@ -152,7 +162,7 @@ export default class TcpClient { onMessage(callback?) { this.tcp.on('message', value => { - console.log(TAG, 'Tcponmessage', value.length, value) + console.log(TAG, 'Tcponmessage', value) globalThis.tcpUdpError = false // console.log('messageLengt',,value.message.length)) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 8d3a72ec..209a8cf5 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -132,10 +132,9 @@ struct Index { if (this.loading) { return } - router.pushUrl({ - url: 'pages/UserInfo', - params: { judge: true } - }, router.RouterMode.Single); + this.testXMLToJSONInWorker() + + ; }) } Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:80* globalThis.ratio}).onClick(() => { @@ -285,7 +284,7 @@ struct Index { let workData: WorkData = e.data; if (workData.isComplete) { router.pushUrl({ - url: 'pages/ExaminerLogin', + url: globalThis.singlePlay?'pages/UserInfo':'pages/ExaminerLogin', }, router.RouterMode.Single) } this.loading = false diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index 6813c5f3..029fb043 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -22,7 +22,7 @@ struct Index { // @State inputTextList2: string[] = ['192.168.7.124','20022'] // @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] - @State inputTextList1: string[] = ['192.168.1.146','18782','192.168.1.146','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] + @State inputTextList1: string[] = ['192.168.1.144','18782','192.168.1.146','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] // @State inputTextList2: string[] = [] // 112.80.35.83 11052 // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 0f8b0c37..2e8442ab 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -17,17 +17,15 @@ import promptAction from '@ohos.promptAction'; import FilePhoto from './judgeSDK/utils/filePhoto'; import { getSyncData, upDateTableByArray } from '../common/service/initable'; import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData'; -import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup' +import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup'; import LoadingPopup from './compontents/judge/LoadingPopup'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; -import { JudgeConfig } from '../config/judge'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { initJudgeUdp } from '../common/utils/UdpJudge'; + @Entry @Component struct UserInfo { - private filePhoto: FilePhoto - private avPlayer @State pageIndex: number = 0 @State ratio: number = 1700 / 960 @State index: number = 0 @@ -46,9 +44,12 @@ struct UserInfo { @State isBoardPrePareSetPopupOpen: boolean = false @State isFirstBoardPrePareSetPopupBtnShow: boolean = false @State isBoardPrePareSetPopupShow: boolean = false - @State isLoadingPopupVisible:boolean = false; - @State loadingText:string = '正在认证监管信息,请稍后...' - @State sczbkf:{xmdm:number,kfdm:string}[] = [] + @State isLoadingPopupVisible: boolean = false; + @State loadingText: string = '正在认证监管信息,请稍后...' + @State sczbkf: { + xmdm: number, + kfdm: string + }[] = [] @State currentUser: User = EmptyCandidateObject @State dataList: Array = [] @State list: Array = [] @@ -61,7 +62,7 @@ struct UserInfo { @State idCard: string = ''; @State grantDept: string = ''; //是否已经开始考试 - @State isExamStart:boolean = false; + @State isExamStart: boolean = false; @State effectDate: string = ''; @State interval: any = null; @State studentRefreshStatue: string = '0'; @@ -73,7 +74,7 @@ struct UserInfo { @State faceFlag: string = '0'; @State FaceOpenStatue: string = '0'; //是否开启人脸识别 @State faceCatchImg: string = '' - @State Param803Str:string = '' + @State Param803Str: string = '' // 过程照片拍照 getPhoto = async (empty?: boolean) => { const singlePlay = globalThis.singlePlay @@ -86,7 +87,10 @@ struct UserInfo { return photoBase64 } } - private AccountTable = new AccountTable(() => {}, USER); + private filePhoto: FilePhoto + private avPlayer + private AccountTable = new AccountTable(() => { + }, USER); private context = getContext(this) as common.UIAbilityContext; private labelBlocks = [ { label: '考生姓名', key: 'xm' }, @@ -261,8 +265,8 @@ struct UserInfo { this.isBoardPrePareSetPopupOpen = true; } // 开始考试前必须解开安全带或关车门 - if (sys.v_no === '803'){ - this.Param803Str = sys.v_value+''; + if (sys.v_no === '803') { + this.Param803Str = sys.v_value + ''; } }) @@ -312,13 +316,13 @@ struct UserInfo { const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') - const openCheckFlag =openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' + const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' const faceParam = syssetParams.filter(sys => sys.v_no == '2413') // faceParam?.[0]?.v_value || // 1身份证读卡器 2指纹 3人脸 - if(openCheckFlag=='1'){ + if (openCheckFlag == '1') { that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' this.faceFlag = faceParam?.[0]?.v_value || '0' if (faceParam?.[0]?.v_value == '1') { @@ -382,7 +386,7 @@ struct UserInfo { return } const param = `${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}${globalThis.carInfo.carId}${globalThis.carInfo.examinationRoomId}${globalThis.username}` - getExaminationStudentInfo(param).then(async(res) => { + getExaminationStudentInfo(param).then(async (res) => { setTimeout(() => { this.updateTimeLimit = true }, 30000) @@ -430,8 +434,8 @@ struct UserInfo { globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm console.log('this.currentUse3' + JSON.stringify(this.currentUser)) this.pageIndex = 0 - getSyncData('USER').then(data=>{ - if(data?.[0]){ + getSyncData('USER').then(data => { + if (data?.[0]) { this.getCurrentStudent(data[0].sfzmhm) } }) @@ -518,13 +522,13 @@ struct UserInfo { this.currentUser.id = '1' const avPlayer = this.avPlayer; this.isLoadingPopupVisible = true - avPlayer.playAudio([`voice/监管通信中.mp3`],false,async ()=>{ + avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { const temp = await this.beginExam(); - console.info('surenjun',JSON.stringify(temp)) + console.info('surenjun', JSON.stringify(temp)) if (temp.code != 1) { promptAction.showToast({ - message:temp.message, - duration:4000 + message: temp.message, + duration: 4000 }) return } @@ -550,15 +554,15 @@ struct UserInfo { const {isCheckFireOpen} = judgeConfig const {Param803Str,isBoardPrePareSetPopupOpen} = this; - if(Param803Str === ''){ + if (Param803Str === '') { return true } - return new Promise((resolve,reject)=>{ - if(isCheckFireOpen){ + return new Promise((resolve, reject) => { + if (isCheckFireOpen) { resolve(true) return } - let plcValue = globalThis.udpClient.getCurrentMessage(); + let plcValue = globalThis.udpClient.getCurrentMessage(); const msgArr = plcValue.split(',') || '' const mkg = msgArr[14]; const fdjzs = msgArr[25]; @@ -568,79 +572,79 @@ struct UserInfo { const ssc = msgArr[13]; const dw = msgArr[28]; // 开始考试信号检测 - if(Param803Str !== ''){ + if (Param803Str !== '') { //安全带 - if(aqd == 1 && Param803Str.includes('1')){ + if (aqd == 1 && Param803Str.includes('1')) { this.avPlayer.playAudio(['voice/请解开安全带.mp3']) promptAction.showToast({ - message:'请解开安全带', - duration:4000 + message: '请解开安全带', + duration: 4000 }) reject(false) } //门开关 - if(mkg == 1 && Param803Str.includes('2')){ + if (mkg == 1 && Param803Str.includes('2')) { this.avPlayer.playAudio(['voice/关门.mp3']) promptAction.showToast({ - message:'请关闭车门', - duration:4000 + message: '请关闭车门', + duration: 4000 }) reject(false) } //远、近光灯 - if((jgd == 1 || ygd == 1) && Param803Str.includes('3')){ + if ((jgd == 1 || ygd == 1) && Param803Str.includes('3')) { this.avPlayer.playAudio(['voice/请关闭远近光灯.mp3']) promptAction.showToast({ - message:'请关闭远近光灯', - duration:4000 + message: '请关闭远近光灯', + duration: 4000 }) reject(false) } //拉手刹 - if(ssc == 0 && Param803Str.includes('4')){ + if (ssc == 0 && Param803Str.includes('4')) { this.avPlayer.playAudio(['voice/请拉手刹.mp3']) promptAction.showToast({ - message:'请拉手刹', - duration:4000 + message: '请拉手刹', + duration: 4000 }) reject(false) } //请点火 - if(fdjzs*1 <=0 && Param803Str.includes('5')){ + if (fdjzs * 1 <= 0 && Param803Str.includes('5')) { this.avPlayer.playAudio(['voice/点火.mp3']) promptAction.showToast({ - message:'请点火', - duration:4000 + message: '请点火', + duration: 4000 }) reject(false) } //置空档 - if(dw != 0 && Param803Str.includes('6')){ + if (dw != 0 && Param803Str.includes('6')) { this.avPlayer.playAudio(['voice/请置空档.mp3']) promptAction.showToast({ - message:'请置空档', - duration:4000 + message: '请置空档', + duration: 4000 }) reject(false) } } // 考前绕车一周信号检测 - if(isBoardPrePareSetPopupOpen){ + if (isBoardPrePareSetPopupOpen) { //请熄火 - if(fdjzs*1 > 0){ + if (fdjzs * 1 > 0) { this.avPlayer.playAudio(['voice/熄火.mp3']) promptAction.showToast({ - message:'请熄火', - duration:4000 + message: '请熄火', + duration: 4000 }) reject(false) } - if(mkg == 1){ + if (mkg == 1) { this.avPlayer.playAudio(['voice/关门.mp3']) promptAction.showToast({ - message:'请关闭车门', - duration:4000 + message: '请关闭车门', + duration: 4000 }) reject(false) } @@ -678,7 +682,7 @@ struct UserInfo { //接口标识 jkid: '17C51', } - console.info('surenjun',JSON.stringify(param)) + console.info('surenjun', JSON.stringify(param)) const temp = await writeObjectOut(param); globalThis.lsh = this.currentUser.lsh globalThis.ksyh = this.currentUser.ksy1sfzmhm || this.currentUser.ksy2sfzmhm; @@ -732,7 +736,7 @@ struct UserInfo { .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { - if(this.isExamStart){ + if (this.isExamStart) { return } this.currentUser = item @@ -857,7 +861,7 @@ struct UserInfo { this.sfbdinterfaceFn() } } catch (e) { - console.info('Throw Error',JSON.stringify(e)) + console.info('Throw Error', JSON.stringify(e)) } }) @@ -920,7 +924,7 @@ struct UserInfo { } // loading - if(this.isLoadingPopupVisible){ + if (this.isLoadingPopupVisible) { LoadingPopup({ title: this.loadingText, }) @@ -960,7 +964,7 @@ struct CommText { build() { Text(this.text) - .fontSize(16 * this.ratio) + .fontSize(19.5 * this.ratio) .lineHeight(30 * this.ratio) .fontWeight(500) .fontColor(this.color) diff --git a/entry/src/main/ets/workers/worker.ts b/entry/src/main/ets/workers/worker.ts index b7a22f6f..effd5dc2 100644 --- a/entry/src/main/ets/workers/worker.ts +++ b/entry/src/main/ets/workers/worker.ts @@ -31,6 +31,7 @@ workerPort.onmessage = (e: MessageEvents): void => { if(param.mode=='1'){ //单中心 getSingleCenterTable(param).then((ret) => { + console.log('teststetfinsh1') if (ret) { workerPort.postMessage({ isComplete: true }); }else{