外殼修改

This commit is contained in:
lvyuankang 2024-08-26 19:27:23 +08:00
parent 002a1e84d8
commit 7ba4c2f5f0
10 changed files with 117 additions and 101 deletions

View File

@ -25,8 +25,8 @@ CommonConstants {
*/ */
static readonly ACCOUNT_TABLE = { static readonly ACCOUNT_TABLE = {
tableName: 'USER', tableName: 'USER',
sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT)', sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT,ksmjzp TEXT)',
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1'] columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1','ksmjzp']
}; };
/** /**

View File

@ -25,8 +25,8 @@ CommonConstants {
*/ */
static readonly ACCOUNT_TABLE = { static readonly ACCOUNT_TABLE = {
tableName: 'USERLIST', tableName: 'USERLIST',
sqlCreate: 'CREATE TABLE IF NOT EXISTS USERLIST(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT)', sqlCreate: 'CREATE TABLE IF NOT EXISTS USERLIST(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT,ksmjzp TEXT)',
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1'] columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1','ksmjzp']
}; };
/** /**

View File

@ -161,6 +161,7 @@ export async function getDoubleCeneterTable(param) {
export async function getSingleCenterTable(param) { export async function getSingleCenterTable(param) {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
try{ try{
console.log('teststet0')
upDataZhongxinginitialization(param).then((result) => { upDataZhongxinginitialization(param).then((result) => {
console.log('kkkkkkkkkkk',result) console.log('kkkkkkkkkkk',result)

View File

@ -339,11 +339,6 @@ export async function getEsCarModel(context) {
export async function upDataZhongxinginitialization(param) { export async function upDataZhongxinginitialization(param) {
return new Promise(async(resolve, reject) => { return new Promise(async(resolve, reject) => {
console.log('teststet00',JSON.stringify(param)) console.log('teststet00',JSON.stringify(param))
if (!param.carId) {
resolve(false)
return
}
let flag=true let flag=true
if (param.singlePlay) { if (param.singlePlay) {
console.log('teststet0',JSON.stringify(param)) console.log('teststet0',JSON.stringify(param))
@ -366,6 +361,10 @@ export async function upDataZhongxinginitialization(param) {
resolve(flag) resolve(flag)
return return
} }
if (!param.carId) {
resolve(false)
return
}
try{ try{
const str = { const str = {
"carId": param.carId, // 表名 "carId": param.carId, // 表名
@ -446,10 +445,10 @@ function setSyncCenterSqlData(key, res, param) {
console.log('mapName[key]', mapName[key], key) console.log('mapName[key]', mapName[key], key)
sqlInsertCommonFn(mapName[key], arrList, param.context).then((result) => { sqlInsertCommonFn(mapName[key], arrList, param.context).then((result) => {
console.log(key, '表建立成功') console.log(key, '表建立成功')
writeLog('PLC',{ // writeLog('PLC',{
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${key} 表建立成功`, // PLC:`${key} 表建立成功`,
}) // })
if (result) { if (result) {
resolve(true) resolve(true)
} else { } else {

View File

@ -27,10 +27,10 @@ export default class TcpClient {
onError(callback?) { onError(callback?) {
this.tcp.on('error', err => { this.tcp.on('error', err => {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} tcpOnerror ${JSON.stringify(err)}`, // PLC:`${TAG} tcpOnerror ${JSON.stringify(err)}`,
}) // })
console.log(TAG, 'tcpOnerror', JSON.stringify(err)) console.log(TAG, 'tcpOnerror', JSON.stringify(err))
setTimeout(async () => { setTimeout(async () => {
getTCP() getTCP()
@ -78,10 +78,10 @@ export default class TcpClient {
address: this.localIp, port: parseInt(this.localIpPort), family: 1 address: this.localIp, port: parseInt(this.localIpPort), family: 1
}, err => { }, err => {
if (err) { if (err) {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} testTag tcp bind faile ${JSON.stringify(err)}`, // PLC:`${TAG} testTag tcp bind faile ${JSON.stringify(err)}`,
}) // })
console.log('testTag tcp bind faile'); console.log('testTag tcp bind faile');
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err)); hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
@ -90,10 +90,10 @@ export default class TcpClient {
} }
globalThis.getCloseTcp = false globalThis.getCloseTcp = false
console.log('testTag tcp bind success'); console.log('testTag tcp bind success');
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} testTag tcp bind success`, // PLC:`${TAG} testTag tcp bind success`,
}) // })
resolve(false) resolve(false)
}) })
}) })
@ -122,10 +122,10 @@ export default class TcpClient {
keepAlive: true, keepAlive: true,
}, err => { }, err => {
if (err) { if (err) {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} tcp connect rebind success`, // PLC:`${TAG} tcp connect rebind success`,
}) // })
if(this.num>3){ if(this.num>3){
return return
} }
@ -150,10 +150,10 @@ export default class TcpClient {
getTCP() getTCP()
resolve(false) resolve(false)
}, 2000) }, 2000)
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} tcp connect error`, // PLC:`${TAG} tcp connect error`,
}) // })
}); });
}) })
} }
@ -174,10 +174,10 @@ export default class TcpClient {
onMessage(callback?) { onMessage(callback?) {
this.tcp.on('message', value => { this.tcp.on('message', value => {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} Tcponmessage`, // PLC:`${TAG} Tcponmessage`,
}) // })
console.log(TAG, 'Tcponmessage', value) console.log(TAG, 'Tcponmessage', value)
globalThis.tcpUdpError = false globalThis.tcpUdpError = false
@ -212,10 +212,11 @@ export default class TcpClient {
}); });
} }
async writeLog(param){ async writeLog(param){
const fileUtil = new FileUtil(globalThis.context) // return
const date=dateFormat(new Date).split(' ')[0] // const fileUtil = new FileUtil(globalThis.context)
const folderPath = await fileUtil.initFolder(`/PLC/${date}`); // const date=dateFormat(new Date).split(' ')[0]
fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) // const folderPath = await fileUtil.initFolder(`/PLC/${date}`);
// fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
} }
offTcp(callback) { offTcp(callback) {

View File

@ -86,17 +86,17 @@ export default class UdpClientByCenter {
// globalThis.closeHeartSocket=false // globalThis.closeHeartSocket=false
this.isWorking = true this.isWorking = true
console.log(`${TAG} getUDPudp rebind success`); console.log(`${TAG} getUDPudp rebind success`);
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} getUDPudp rebind success`, // PLC:`${TAG} getUDPudp rebind success`,
}) // })
}).catch(err => { }).catch(err => {
//globalThis.closeHeartSocket=true //globalThis.closeHeartSocket=true
this.isWorking = false this.isWorking = false
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`, // PLC:`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`,
}) // })
console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`); console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`);
}); });
} }
@ -107,16 +107,16 @@ export default class UdpClientByCenter {
}); });
promise.then(() => { promise.then(() => {
this.isWorking = true this.isWorking = true
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} getUDPudp bind success`, // PLC:`${TAG} getUDPudp bind success`,
}) // })
}).catch(err => { }).catch(err => {
this.isWorking = false this.isWorking = false
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG} getUDPudp bind error${JSON.stringify(err)},localIp:${this.localIpPort},port:${this.localIpPort}`, // PLC:`${TAG} getUDPudp bind error${JSON.stringify(err)},localIp:${this.localIpPort},port:${this.localIpPort}`,
}) // })
}); });
} }
@ -182,10 +182,10 @@ export default class UdpClientByCenter {
{ {
if (!this.isWorking ) { if (!this.isWorking ) {
console.log(`${TAG}getUDPudpCLient sendMsg is closed return `); console.log(`${TAG}getUDPudpCLient sendMsg is closed return `);
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG}getUDPudpCLient sendMsg is closed return oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`, // PLC:`${TAG}getUDPudpCLient sendMsg is closed return oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`,
}) // })
if(sendCallback) { if(sendCallback) {
sendCallback() sendCallback()
} }
@ -202,15 +202,15 @@ export default class UdpClientByCenter {
if (sendCallback) { if (sendCallback) {
sendCallback() sendCallback()
} }
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG}getUDPudpCLient udp send success: oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`, // PLC:`${TAG}getUDPudpCLient udp send success: oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`,
}) // })
}).catch(err => { }).catch(err => {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}${JSON.stringify(err)}`, // PLC:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}${JSON.stringify(err)}`,
}) // })
promptAction.showToast({ promptAction.showToast({
message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`, message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
duration:4000 duration:4000
@ -231,10 +231,10 @@ export default class UdpClientByCenter {
onError_Callback(callback?) { onError_Callback(callback?) {
this.udp.on('error', async err => { this.udp.on('error', async err => {
this.isWorking = false; this.isWorking = false;
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:'getUDPUdpClientByCenter onError err:' + JSON.stringify(err)+this.oppositeIpPort, // PLC:'getUDPUdpClientByCenter onError err:' + JSON.stringify(err)+this.oppositeIpPort,
}) // })
callback && callback() callback && callback()
}); });
} }
@ -288,19 +288,19 @@ export default class UdpClientByCenter {
console.log('getUDPUdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort); console.log('getUDPUdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort);
this.udp.close(err => { this.udp.close(err => {
if (err) { if (err) {
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:'getUDPUdpClientByCenter closeUdp err:' + JSON.stringify(err)+this.oppositeIpPort, // PLC:'getUDPUdpClientByCenter closeUdp err:' + JSON.stringify(err)+this.oppositeIpPort,
}) // })
} else { } else {
this.isWorking = false this.isWorking = false
if (callback != null) { if (callback != null) {
callback() callback()
} }
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC:'getUDPUdpClientByCenter closeUdp succeed:' + JSON.stringify(err)+this.oppositeIpPort, // PLC:'getUDPUdpClientByCenter closeUdp succeed:' + JSON.stringify(err)+this.oppositeIpPort,
}) // })
} }
}) })
} }
@ -343,10 +343,10 @@ export default class UdpClientByCenter {
// this.stashFn(str) // this.stashFn(str)
const newArr = JSON.parse(JSON.stringify(strachArr)) const newArr = JSON.parse(JSON.stringify(strachArr))
this.writeLog({ // this.writeLog({
time:dateFormat(new Date()), // time:dateFormat(new Date()),
PLC: JSON.stringify(newArr.toString()), // PLC: JSON.stringify(newArr.toString()),
}) // })
if(strachArr[83]!='4'){ if(strachArr[83]!='4'){
this.chafenFlag++ this.chafenFlag++
if(this.chafenFlag>=15&&!globalThis.dialogOpen){ if(this.chafenFlag>=15&&!globalThis.dialogOpen){
@ -393,10 +393,10 @@ export default class UdpClientByCenter {
this.testIfUdpConnetced(callback) this.testIfUdpConnetced(callback)
} }
async writeLog(param){ async writeLog(param){
const fileUtil = new FileUtil(globalThis.context) // const fileUtil = new FileUtil(globalThis.context)
const date=dateFormat(new Date).split(' ')[0] // const date=dateFormat(new Date).split(' ')[0]
const folderPath = await fileUtil.initFolder(`/PLC/${date}`); // const folderPath = await fileUtil.initFolder(`/PLC/${date}`);
fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) // fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
} }
//获取当前UDP信号 //获取当前UDP信号

View File

@ -4,6 +4,7 @@ import { expect } from '@ohos/hypium';
import FileUtil from './File'; import FileUtil from './File';
export async function writeLog(path,param){ export async function writeLog(path,param){
return
const fileUtil = new FileUtil(globalThis.context) const fileUtil = new FileUtil(globalThis.context)
const date=dateFormat(new Date).split(' ')[0] const date=dateFormat(new Date).split(' ')[0]
const folderPath = await fileUtil.initFolder(`/${path}/${date}`); const folderPath = await fileUtil.initFolder(`/${path}/${date}`);

View File

@ -9,6 +9,7 @@ import { getEsCarModel, } from '../common/service/initable';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'; import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
import { initJudgeUdp } from '../common/utils/UdpJudge'; import { initJudgeUdp } from '../common/utils/UdpJudge';
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import { getTCP } from '../common/utils/GlobalTcp'; import { getTCP } from '../common/utils/GlobalTcp';
import { getliushuiNum, setliushuiNum, takePhotoFn, deleteAllFIleLog } from '../common/service/indexService'; import { getliushuiNum, setliushuiNum, takePhotoFn, deleteAllFIleLog } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
@ -143,6 +144,12 @@ struct Index {
if (this.loading) { if (this.loading) {
return return
} }
if(judgeConfig.isTrajectoryOpen){
router.pushUrl({
url: 'pages/UserInfo',
}, router.RouterMode.Single)
return
}
//判断数据库是否有表数据,有则直接跳转,没有则读取本地数据 //判断数据库是否有表数据,有则直接跳转,没有则读取本地数据
getSyncData('MA_SYSSET').then(data => { getSyncData('MA_SYSSET').then(data => {
console.log('datadata', JSON.stringify(data)) console.log('datadata', JSON.stringify(data))
@ -301,6 +308,9 @@ struct Index {
if (this.loading) { if (this.loading) {
return return
} }
// let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1
// console.log('mode',mode)
let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts'); let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts');
const param = { const param = {
carId: globalThis.carInfo?.carId, carId: globalThis.carInfo?.carId,
@ -311,10 +321,9 @@ struct Index {
mode: globalThis.timeInfo?.mode, mode: globalThis.timeInfo?.mode,
context: this.context, context: this.context,
host: globalThis.host, host: globalThis.host,
centerHost: globalThis.timeInfo.url, centerHost: globalThis.timeInfo?.url,
singlePlay: globalThis.singlePlay singlePlay: globalThis.singlePlay
} }
console.log('globalThis.timeInfo', JSON.stringify(globalThis.timeInfo), 'globalThis.carInfo', JSON.stringify(globalThis.carInfo))
this.loading = true this.loading = true
workerInstance.postMessage(param); workerInstance.postMessage(param);
workerInstance.onmessage = (e: MessageEvents): void => { workerInstance.onmessage = (e: MessageEvents): void => {
@ -412,15 +421,13 @@ struct Index {
} }
async initParams() { async initParams() {
deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/') // deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/')
//设置plc udp 同步requesthost //设置plc udp 同步requesthost
await getUDP(this.context, false) await getUDP(this.context, false)
this.loading = false this.loading = false
console.log('globalThis.deviceNo000') console.log('globalThis.deviceNo000')
const data= await getDeviceInfo(this.context) await getDeviceInfo(this.context)
if(data==''){
return
}
await getCarInfo() await getCarInfo()
await getUDP2(this.context, false) await getUDP2(this.context, false)
getTCP() getTCP()

View File

@ -124,7 +124,7 @@ struct UserInfo {
console.log('响应头地址响应头地址') console.log('响应头地址响应头地址')
const mediaTest = new FilePhoto(this.context); const mediaTest = new FilePhoto(this.context);
this.filePhoto = new FilePhoto(this.context); this.filePhoto = new FilePhoto(this.context);
//语音功能 //语音功能on
new WebRTCVoice(this.context); new WebRTCVoice(this.context);
//初始化数据 //初始化数据
this.initData() this.initData()
@ -435,10 +435,12 @@ struct UserInfo {
//人脸比对窗口关闭 //人脸比对窗口关闭
changeFaceCompareSuccess() { changeFaceCompareSuccess() {
this.ksksLimit = false
console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser)) console.log('this.faceCompareSuces', this.faceCompareSucess, JSON.stringify(this.currentUser))
if (this.faceCompareSucess > 0) { if (this.faceCompareSucess > 0) {
//人脸比对通过 //人脸比对通过
globalThis.statue = 4 globalThis.statue = 4
this.showFaceCompare = false
this.sfbdinterfaceFn() this.sfbdinterfaceFn()
} }
} }
@ -600,7 +602,6 @@ struct UserInfo {
this.stepFlag = true this.stepFlag = true
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
const {carId,examinationRoomId} = carInfo; const {carId,examinationRoomId} = carInfo;
this.showFaceCompare = false
let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } }; let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } };
if (!globalThis.singlePlay) { if (!globalThis.singlePlay) {
//获取已考项目 //获取已考项目
@ -964,6 +965,7 @@ struct UserInfo {
this.stopDeviceById() this.stopDeviceById()
return return
} }
console.log('this.FaceOpenStatuethis.FaceOpenStatue',this.FaceOpenStatue)
if (this.FaceOpenStatue != '0') { if (this.FaceOpenStatue != '0') {
this.showFaceCompare = true this.showFaceCompare = true
} else { } else {

View File

@ -107,7 +107,12 @@ export default struct FaceCompare {
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(async () => { .onClick(async () => {
this.times = 1; this.times = 1;
this.controller.stop()
this.vocObj && this.vocObj.releasePlayer()
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.faceCompareSucess = -1
globalThis.statue = 2
}) })
} }
.width('88.9%') .width('88.9%')
@ -190,8 +195,8 @@ export default struct FaceCompare {
verifyType: 1 verifyType: 1
}) })
.then(res => { .then(res => {
console.log('mmmmm8', res) console.log('mmmmm8', JSON.stringify(res))
if (res) { if (res.imageCompareRsp.head.resultCode=='0') {
this.controller.stop() this.controller.stop()
this.showFaceCompare = !this.showFaceCompare this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag = !this.showFaceCompareFlag this.showFaceCompareFlag = !this.showFaceCompareFlag