外殼修改

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 = {
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)',
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1']
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','ksmjzp']
};
/**

View File

@ -25,8 +25,8 @@ CommonConstants {
*/
static readonly ACCOUNT_TABLE = {
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)',
columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1']
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','ksmjzp']
};
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -107,7 +107,12 @@ export default struct FaceCompare {
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(async () => {
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%')
@ -190,8 +195,8 @@ export default struct FaceCompare {
verifyType: 1
})
.then(res => {
console.log('mmmmm8', res)
if (res) {
console.log('mmmmm8', JSON.stringify(res))
if (res.imageCompareRsp.head.resultCode=='0') {
this.controller.stop()
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag = !this.showFaceCompareFlag