From 71ed3fb4d4aaf9614667470515f11cef57589cfa Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Mon, 1 Jul 2024 12:36:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ets/common/constants/MA_MAP_SUBITEM.ts | 6 ++--- entry/src/main/ets/common/database/Rdb.ts | 8 +++---- entry/src/main/ets/common/service/initable.ts | 5 ++-- .../ets/common/service/terminalService.ts | 4 ++-- entry/src/main/ets/pages/Index.ets | 23 +++++-------------- entry/src/main/ets/pages/TerminalInfos.ets | 4 ++-- 6 files changed, 20 insertions(+), 30 deletions(-) diff --git a/entry/src/main/ets/common/constants/MA_MAP_SUBITEM.ts b/entry/src/main/ets/common/constants/MA_MAP_SUBITEM.ts index 4171c295..5b3034ab 100644 --- a/entry/src/main/ets/common/constants/MA_MAP_SUBITEM.ts +++ b/entry/src/main/ets/common/constants/MA_MAP_SUBITEM.ts @@ -18,14 +18,14 @@ CommonConstants { /** * Rdb database config. */ - static readonly STORE_CONFIG = { name: 'MA_MAP_SUBITEM.db' }; + static readonly STORE_CONFIG = { name: 'MAP_SUBITEM.db' }; /** * Account table config. */ static readonly ACCOUNT_TABLE = { - tableName: 'MA_MAP_SUBITEM', - sqlCreate: 'CREATE TABLE IF NOT EXISTS MA_MAP_SUBITEM(id INTEGER PRIMARY KEY AUTOINCREMENT,itemno TEXT,posx1 TEXT, posx2 TEXT, ' + + tableName: 'MAP_SUBITEM', + sqlCreate: 'CREATE TABLE IF NOT EXISTS MAP_SUBITEM(id INTEGER PRIMARY KEY AUTOINCREMENT,itemno TEXT,posx1 TEXT, posx2 TEXT, ' + 'posx3 TEXT, posx4 TEXT,posy1 TEXT,posy2 TEXT,posy3 TEXT,posy4 TEXT,sno TEXT,subname TEXT)', columns: ['id','itemno', 'posx1', 'posx2', 'posx3', 'posx4', 'posy1', 'posy2', 'posy3', 'posy4', 'sno', 'subname'] }; diff --git a/entry/src/main/ets/common/database/Rdb.ts b/entry/src/main/ets/common/database/Rdb.ts index 1a33adf4..ea03c496 100644 --- a/entry/src/main/ets/common/database/Rdb.ts +++ b/entry/src/main/ets/common/database/Rdb.ts @@ -83,7 +83,7 @@ export default class Rdb { 'MA_MAP_POINT_ITEM': MA_MAP_POINT_ITEM, 'MA_MAP_ROAD': MA_MAP_ROAD, 'MA_MAP_ROAD_LANE': MA_MAP_ROAD_LANE, - 'MA_MAP_SUBITEM': MA_MAP_SUBITEM, + 'MAP_SUBITEM': MA_MAP_SUBITEM, 'MA_SYSSET': MA_SYSSET, 'ES_CARINFO': ES_CARINFO, 'ES_EXAMPOINTDETAIL': ES_EXAMPOINTDETAIL, @@ -92,10 +92,10 @@ export default class Rdb { 'MA_ITEMINFO': MA_ITEMINFO, 'MA_T_CARPARMSET': MA_T_CARPARMSET, 'ES_CAR_VIDEO_PARAMETER': ES_CAR_VIDEO_PARAMETER, - 'CommonConstants':CommonConstants, 'USER':USER, 'IpConfigTable':IpConfigTable, - 'DeviceInfoTable':DeviceInfoTable + 'DeviceInfoTable':DeviceInfoTable, + 'CommonConstants':CommonConstants } @@ -139,7 +139,7 @@ export default class Rdb { 'MA_MAP_POINT_ITEM': MA_MAP_POINT_ITEM, 'MA_MAP_ROAD': MA_MAP_ROAD, 'MA_MAP_ROAD_LANE': MA_MAP_ROAD_LANE, - 'MA_MAP_SUBITEM': MA_MAP_SUBITEM, + 'MAP_SUBITEM': MA_MAP_SUBITEM, 'MA_SYSSET': MA_SYSSET, 'ES_CARINFO': ES_CARINFO, 'ES_EXAMPOINTDETAIL': ES_EXAMPOINTDETAIL, diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index e34dd0cf..2046cdca 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -93,9 +93,9 @@ function sqlInsertCommonFn(tableName,resultArr,context?){ let str='(' map[tableName].ACCOUNT_TABLE.columns.map((res,index)=>{ if(map[tableName].ACCOUNT_TABLE.columns.length-1==index){ - str+=`"${data[res]||'0'}"` + str+=data[res]?`"${data[res]}"`:'NULL' }else{ - str+=`"${data[res]||'0'}"`+',' + str+=(data[res]?`"${data[res]}"`:'NULL')+',' } }) if(i==resultArr.length-1){ @@ -425,6 +425,7 @@ function setSyncCenterSqlData(key,res,param){ }else{ arrList=[res.initializationRsp.body[key].record] } + console.log('mapName[key]',mapName[key],key) sqlInsertCommonFn(mapName[key],arrList,param.context).then((result)=>{ console.log(key,'表建立成功') if(result){ diff --git a/entry/src/main/ets/common/service/terminalService.ts b/entry/src/main/ets/common/service/terminalService.ts index 0080b8e8..037fe061 100644 --- a/entry/src/main/ets/common/service/terminalService.ts +++ b/entry/src/main/ets/common/service/terminalService.ts @@ -6,8 +6,8 @@ import { getSyncData } from '../../common/service/initable' //获取设备信息 export async function getDeviceInfo() { - globalThis.deviceNo = '153216400880'; //科目三设备 - // globalThis.deviceNo = '150667400235'; //科目三设备 + // globalThis.deviceNo = '153216400880'; //科目三设备 + globalThis.deviceNo = '150667400235'; //科目三设备 return new Promise((resolve, reject) => { getSyncData('DeviceInfoTable').then((result: Array) => { diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index f8112a83..b912452f 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -221,23 +221,11 @@ struct Index { globalThis.ratio= 1700 / 960 this.angle = 0 this.loading = false - // let workerInstance = new worker.ThreadWorker('entry/ets/pages/worker.ts', { - // name: 'FriendsMoments Worker' - // }); - // this.workerInstance.onmessage = function(e) { - // console.log("onerror") - // router.pushUrl({ - // url: 'pages/ExaminerLogin', - // }, router.RouterMode.Single) - // this.loading=false - // } } async testXMLToJSONInWorker(){ let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts', { name: 'FriendsMoments Worker' }); - var xmlStr='123' - console.log("baoyihu before postMessage :"); const param={ carId:globalThis.carInfo?.carId, examinationRoomId:globalThis.carInfo?.examinationRoomId, @@ -249,11 +237,12 @@ struct Index { } workerInstance.postMessage(param); workerInstance.onmessage = (e: MessageEvents): void => { - console.log("baoyihu after postMessage :",e.data); - console.log("onerror") - router.pushUrl({ - url: 'pages/ExaminerLogin', - }, router.RouterMode.Single) + console.log("baoyihu after postMessage :",JSON.stringify(e.data)); + if(e.data.isComplete){ + router.pushUrl({ + url: 'pages/ExaminerLogin', + }, router.RouterMode.Single) + } this.loading=false // let workData: WorkData = e.data; // if (workData) { diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index ff59e3df..2c27b2f3 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -9,7 +9,7 @@ import { getSyncData} from '../common/service/initable' @Entry @Component struct Index { - @State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口','平台服务器Ip','响应端口'] + @State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口'] // @State textList2: string[] = [] @State ratio: number = 1700 / 960 @State inputFontSize:number=12 //12 @@ -19,7 +19,7 @@ struct Index { // @State inputTextList2: string[] = ['192.168.7.124','20022'] - @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122','172.37.55.191','11050'] + @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','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']