Compare commits

...

15 Commits

Author SHA1 Message Date
9be231d31e feat:合并代码 2024-08-15 09:05:53 +08:00
45c6b12067 Merge branch 'main' into feat_surenjun
# Conflicts:
#	entry/src/main/ets/common/utils/UdpClientByCenter.ts
#	entry/src/main/ets/pages/TerminalInfos.ets
#	entry/src/main/ets/pages/UserInfo.ets
2024-08-15 09:05:19 +08:00
f98ce3d832 Merge pull request 'tcp修改' (#58) from lv_chengmai into main
Reviewed-on: #58
2024-08-14 14:52:08 +08:00
b89b0c911e tcp修改 2024-08-14 14:46:33 +08:00
3b121ed5b2 外殼優化 2024-08-14 13:15:03 +08:00
a617763947 Merge pull request 'lv_chengmai' (#57) from lv_chengmai into main
Reviewed-on: #57
2024-08-14 13:12:44 +08:00
d743f22889 Merge branch 'main' into lv_chengmai 2024-08-14 09:19:52 +08:00
f974da9303 外殼修改 2024-08-14 09:18:33 +08:00
4bc2a88b7c Merge branch 'main' into lv_chengmai 2024-08-13 11:51:39 +08:00
829a18a314 洛陽修改 2024-08-13 11:50:38 +08:00
f720674c7b Merge pull request 'lv_chengmai' (#56) from lv_chengmai into main
Reviewed-on: #56
2024-08-13 11:48:30 +08:00
1b3093b067 衝突解決 2024-08-12 14:54:10 +08:00
fd4db7b355 Merge pull request 'lv_chengmai' (#55) from lv_chengmai into main
Reviewed-on: #55
2024-08-12 14:52:06 +08:00
3e53801f12 提交 2024-08-12 14:46:16 +08:00
1dd23b9768 Merge pull request 'feat_surenjun' (#54) from feat_surenjun into main
Reviewed-on: #54
2024-08-12 14:37:17 +08:00
16 changed files with 192 additions and 108 deletions

View File

@ -152,10 +152,10 @@ export async function getSingleCenterTable(param) {
// reslove(false) // reslove(false)
// }) // })
console.log('联网更新失败,请检查网络后重新更新') console.log('联网更新失败,请检查网络后重新更新')
promptAction.showToast({ // promptAction.showToast({
message: `联网更新表数据失败,请重新更新`, // message: `联网更新表数据失败,请重新更新`,
duration: 3000 // duration: 3000
}); // });
reslove(false) reslove(false)
} }
}).catch((error) => { }).catch((error) => {

View File

@ -26,6 +26,8 @@ import DeviceInfoTable from '../constants/DeviceInfoTable';
import USER from '../constants/USER'; import USER from '../constants/USER';
import util from '@ohos.util'; import util from '@ohos.util';
import FileModel from '../../pages/judgeSDK/utils/fileModel'; import FileModel from '../../pages/judgeSDK/utils/fileModel';
import FileUtil from '../../common/utils/File';
import { GlobalConfig } from '../../config/index';
// @ts-nocheck // @ts-nocheck
//读表 //读表
@ -330,6 +332,27 @@ export async function upDataZhongxinginitialization(param) {
resolve(false) resolve(false)
return return
} }
if(param.singlePlay){
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, '单机表建立失败')
})
}
})
return
}
const str = { const str = {
"carId": param.carId, // 表名 "carId": param.carId, // 表名
"examinationRoomId": param.examinationRoomId, //考试平台kdid "examinationRoomId": param.examinationRoomId, //考试平台kdid
@ -370,7 +393,7 @@ export async function upDataZhongxinginitialization(param) {
} }
function setSyncCenterSqlData(key, res, param) { function setSyncCenterSqlData(key, res, param) {
return new Promise((resolve, reject) => { return new Promise(async(resolve, reject) => {
const mapName = { const mapName = {
'ItemInfo': 'MA_ITEMINFO', 'ItemInfo': 'MA_ITEMINFO',
'MarkRule': 'MA_MARKRULE', 'MarkRule': 'MA_MARKRULE',
@ -389,7 +412,6 @@ function setSyncCenterSqlData(key, res, param) {
'MarkRuleSet': 'MA_MARKRULESET', 'MarkRuleSet': 'MA_MARKRULESET',
'Cdsbinfo': 'MA_CDSBINFO', 'Cdsbinfo': 'MA_CDSBINFO',
'T_CarParmSet': 'MA_T_CARPARMSET', 'T_CarParmSet': 'MA_T_CARPARMSET',
// 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
} }
// const accountTable = new AccountTable(() => { // const accountTable = new AccountTable(() => {
// }, centerToMap[key],param.context); // }, centerToMap[key],param.context);
@ -399,6 +421,9 @@ function setSyncCenterSqlData(key, res, param) {
} else { } else {
arrList = [res.initializationRsp.body[key].record] arrList = [res.initializationRsp.body[key].record]
} }
const fileUtil = new FileUtil(param.context)
const folderPath = await fileUtil.initFolder(`/config/tableList`);
fileUtil.addFile(`${folderPath}/${mapName[key]}.txt`, JSON.stringify(arrList))
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, '表建立成功')

View File

@ -9,29 +9,21 @@ import FileUtil from '../../common/utils/File'
//获取设备信息 //获取设备信息
export async function getDeviceInfo(context) { export async function getDeviceInfo(context) {
// globalThis.deviceNo = '153216400880'; //科目三设备
// globalThis.deviceNo = '150667400235'; //科目三设备
// globalThis.deviceNo = '1649018001275'; //洛阳科目三设备
// globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489
// globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备
globalThis.deviceNo = 'MAC-B2A3A8FD'; //杭州科目二设备
return
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const fileUtil = new FileUtil(context) const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
console.log('globalThis.deviceNoglobalThis.deviceNo',data)
if (data === '' || data === undefined) { if (data === '' || data === undefined) {
promptAction.showToast({ promptAction.showToast({
message: `请先进行设备注册`, message: `请先进行设备注册`,
duration: 3000 duration: 3000
}); });
router.pushUrl({
url: 'pages/Register',
}, router.RouterMode.Single);
resolve('') resolve('')
} else { } else {
const fileData=JSON.parse(data) const fileData=JSON.parse(data)
globalThis.deviceNo = fileData.deviceName globalThis.deviceNo = fileData.deviceName
getCarInfo() console.log('globalThis.deviceNo', globalThis.deviceNo)
// getCarInfo()
resolve(fileData.deviceName) resolve(fileData.deviceName)
} }
}) })
@ -40,6 +32,8 @@ export async function getDeviceInfo(context) {
//获取考车信息 //获取考车信息
export async function getCarInfo() { export async function getCarInfo() {
let date = new Date(); let date = new Date();
console.log('globalThis.carInfo2222', globalThis.deviceNo)
let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo }; let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo };
let res: any = await obtainCarExamInfo(params) let res: any = await obtainCarExamInfo(params)
if (!res?.obtainCarExamInfoRsp?.body) { if (!res?.obtainCarExamInfoRsp?.body) {
@ -48,7 +42,7 @@ export async function getCarInfo() {
// }, router.RouterMode.Single); // }, router.RouterMode.Single);
} else { } else {
globalThis.carInfo = res.obtainCarExamInfoRsp.body globalThis.carInfo = res.obtainCarExamInfoRsp.body
console.log('globalThis.carInfo', JSON.stringify(globalThis.carInfo)); console.log('globalThis.carInfo2222', JSON.stringify(res));
// globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo) globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo)
} }

View File

@ -13,6 +13,7 @@ export async function getUDP(context,errorFlag?) {
return new Promise(async (reslove,reject)=>{ return new Promise(async (reslove,reject)=>{
const fileUtil = new FileUtil(context) const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
console.log('ttttt',data)
if (data === '' || data === undefined) { if (data === '' || data === undefined) {
console.log(` getUDP has no IPConfigTable `); console.log(` getUDP has no IPConfigTable `);
globalThis.udpClient = {} globalThis.udpClient = {}
@ -45,6 +46,7 @@ export async function getUDP(context,errorFlag?) {
else { else {
// 未绑定 // 未绑定
console.log(` getUDP has no udclent and bind `); console.log(` getUDP has no udclent and bind `);
console.log('ttttttdata',JSON.stringify(result))
const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort) const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort)
udpClient.bindUdp() udpClient.bindUdp()
udpClient.sendMsg('111') udpClient.sendMsg('111')
@ -62,7 +64,7 @@ export async function getUDP(context,errorFlag?) {
} }
}) })
getChuankouFn() getChuankouFn()
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) reslove(`http://${result.centerIp}:${result.centerPort}`)
} }

View File

@ -1,6 +1,7 @@
import socket from '@ohos.net.socket'; import socket from '@ohos.net.socket';
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import { getTCP } from './GlobalTcp'; import { getTCP } from './GlobalTcp';
import prompt from '@ohos.prompt';
const TAG = 'socketTag[TcpDemo.TcpClient]' const TAG = 'socketTag[TcpDemo.TcpClient]'
@ -152,6 +153,7 @@ export default class TcpClient {
onMessage(callback?) { onMessage(callback?) {
this.tcp.on('message', value => { this.tcp.on('message', value => {
console.log(TAG, 'Tcponmessage', value.length, value) console.log(TAG, 'Tcponmessage', value.length, value)
globalThis.tcpUdpError = false
// console.log('messageLengt',,value.message.length)) // console.log('messageLengt',,value.message.length))
console.log('testTagtcpmsg') console.log('testTagtcpmsg')
@ -165,6 +167,22 @@ export default class TcpClient {
} else { } else {
callback && callback('') callback && callback('')
} }
clearInterval(globalThis.intervaltcp)
globalThis.intervaltcp=setInterval(()=>{
setTimeout(async () => {
//程序断开
if (globalThis.tcpUdpError) {
console.log(TAG,'tcp信号丢失')
getTCP()
prompt.showToast({
message: 'tcp信号丢失',
duration: 2000
});
}
globalThis.tcpUdpError = true;
}, 2000)
},3000)
// callback(value.message) // callback(value.message)
}); });
} }
@ -181,6 +199,7 @@ export default class TcpClient {
let promise = this.tcp.close(); let promise = this.tcp.close();
promise.then(() => { promise.then(() => {
globalThis.getCloseTcp = true globalThis.getCloseTcp = true
console.log(TAG, 'tcpCloseSuccess') console.log(TAG, 'tcpCloseSuccess')
callback() callback()
reslove(true) reslove(true)

View File

@ -16,7 +16,7 @@
import socket from '@ohos.net.socket'; import socket from '@ohos.net.socket';
import { Array2Byte } from '../utils/tools' import { Array2Byte } from '../utils/tools'
import {getChuankouFn} from '../../common/service/indexService' import {getChuankouFn} from '../../common/service/indexService'
import {getUDP} from './GlobalUdp'
const TAG = 'socketTag[PLC.UdpClient]' const TAG = 'socketTag[PLC.UdpClient]'
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
@ -29,7 +29,7 @@ export default class UdpClient {
private oppositeIpPort: string = '' private oppositeIpPort: string = ''
private udp: any = null private udp: any = null
// private stashFn:StashFuncotion // private stashFn:StashFuncotionon
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
this.localIp = udplocalIp this.localIp = udplocalIp
@ -176,14 +176,15 @@ export default class UdpClient {
//程序断开 //程序断开
lightLineUdp?.send(globalThis.plcUdpError ? arrRedBuffer : (isJudge ? arrGreenBugger : arrBlueBuffer)); lightLineUdp?.send(globalThis.plcUdpError ? arrRedBuffer : (isJudge ? arrGreenBugger : arrBlueBuffer));
if (globalThis.plcUdpError) { if (globalThis.plcUdpError) {
num++ // num++
console.log(TAG,'plc udp信号丢失') console.log(TAG,'plc udp信号丢失')
if(num==3){ // if(num==3){
await this.bindUdp() getUDP(globalThis.context,true)
await this.sendMsg('111') // await this.bindUdp()
await this.onMessage(callback) // await this.sendMsg('111')
num=0 // await this.onMessage(callback)
} // num=0
// }
prompt.showToast({ prompt.showToast({
message: 'plc udp信号丢失', message: 'plc udp信号丢失',
duration: 2000 duration: 2000

View File

@ -23,6 +23,7 @@ const TAG = '[UdpDemo.UdpClient]'
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { getUDP } from './GlobalUdp';
export default class UdpClientByCenter { export default class UdpClientByCenter {
@ -144,7 +145,9 @@ export default class UdpClientByCenter {
setMsgBody({id,list}) { setMsgBody({id,list}) {
let tmpList = [] let tmpList = []
tmpList = list tmpList = list
return tmpList; return tmpList;
} }
sendHeadMsg(msgData) { sendHeadMsg(msgData) {
@ -153,37 +156,35 @@ export default class UdpClientByCenter {
console.log('getUDPsendHeadMsg exit') console.log('getUDPsendHeadMsg exit')
} }
sendMsg(msg, sendCallback?) { sendMsg(msg, sendCallback?)
if (!this.isWorking && sendCallback) { {
sendCallback() console.log(`${TAG}getUDPudpCLient sendMsg enter oppositeIp:${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort:${this.localIpPort}`);
} if (!this.isWorking ) {
this.udp.getState((err, data) => { console.log(`${TAG}getUDPudpCLient sendMsg is closed return `);
if (err) { if(sendCallback) {
this.isWorking = false sendCallback()
return;
} else {
let promise = this.udp.send({
data: msg,
address: {
address: this.oppositeIp,
port: parseInt(this.oppositeIpPort),
}
});
promise.then(() => {
if (sendCallback) {
sendCallback()
}
console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
}).catch(err => {
console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
promptAction.showToast({
message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
duration:4000
})
});
} }
console.log('getUDPgetState success:' + JSON.stringify(data)); return;
}) }
let promise = this.udp.send({
data: msg,
address: {
address: this.oppositeIp,
port: parseInt(this.oppositeIpPort),
}
});
promise.then(() => {
if (sendCallback) {
sendCallback()
}
console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
}).catch(err => {
console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
promptAction.showToast({
message:`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`,
duration:4000
})
});
} }
sendMsgExt(param, context?) { sendMsgExt(param, context?) {
@ -334,9 +335,8 @@ export default class UdpClientByCenter {
num++ num++
console.log(TAG, 'plc udp信号丢失') console.log(TAG, 'plc udp信号丢失')
if (num == 3) { if (num == 3) {
await this.bindUdp() getUDP(globalThis.context,true)
await this.sendMsg('111', null)
await this.onMessage_1(callback)
num = 0 num = 0
} }
prompt.showToast({ prompt.showToast({

View File

@ -3,6 +3,9 @@ import convertxml from '@ohos.convertxml';
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon'; import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon';
import {GlobalConfig} from '../../config/index' import {GlobalConfig} from '../../config/index'
import FileUtil from '../../common/utils/File';
import { dateFormat } from '../utils/tools'
const config = { const config = {
host:GlobalConfig.host, host:GlobalConfig.host,
} }
@ -36,16 +39,31 @@ export default async function request(req: any) {
try { try {
let baseUrl=host?host:globalThis.host let baseUrl=host?host:globalThis.host
// let baseUrl=host?config.csptHost:config.host' // let baseUrl=host?config.csptHost:config.host'
console.log('响应头地址' + paramsStr)
console.log('响应头地址' + baseUrl)
// writeLog({
// time:dateFormat(new Date()),
// url,
// extraData: JSON.stringify(data),
// state:'start'
// })
const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options); const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, options);
// fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
// writeLog({
// time:dateFormat(new Date()),
// url,
// result:JSON.stringify(result),
// extraData: JSON.stringify(data),
// state:'end'
// })
console.log('响应头地址' + JSON.stringify(result)) console.log('响应头地址' + JSON.stringify(result))
let res:any = xml ? xmlToJson(result,url) : result; let res:any = xml ? xmlToJson(result,url) : result;
console.log('响应头地址' + JSON.stringify(res)) console.log('响应头地址' + JSON.stringify(res))
let resObj = null; let resObj = null;
if(typeof res === "string"){ if(typeof res === "string"){
res=JSON.parse(res) res=JSON.parse(res)
} }
//处理中心服务code //处理中心服务code
if(res.Envelope){ if(res.Envelope){
const msgXml = res.Envelope.Body.writeObjectOutResponse.return; const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
@ -99,7 +117,12 @@ export default async function request(req: any) {
} }
} }
async function writeLog(param){
const fileUtil = new FileUtil(globalThis.context)
const folderPath = await fileUtil.initFolder(`/errorMsg/`);
fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param)+`\n`)
}
//xml格式转JSON //xml格式转JSON
function xmlToJson(result,url) { function xmlToJson(result,url) {
console.log("xmlToJson begin",url); console.log("xmlToJson begin",url);

View File

@ -30,6 +30,8 @@ export default class EntryAbility extends UIAbility {
globalThis.hasAuth = false globalThis.hasAuth = false
globalThis.version = '2022.08.13.01' globalThis.version = '2022.08.13.01'
globalThis.judgeVersion = '2022.12.05.1' globalThis.judgeVersion = '2022.12.05.1'
// globalThis.version = '2024.11.22.14'
// globalThis.judgeVersion = '2024.11.22.14'
globalThis.videoVersion= '1.0' globalThis.videoVersion= '1.0'
// globalThis.version = '2023.12.13.01' // globalThis.version = '2023.12.13.01'
// globalThis.judgeVersion = '2023.09.30.1' // globalThis.judgeVersion = '2023.09.30.1'

View File

@ -1,5 +1,4 @@
// @ts-nocheck // @ts-nocheck
import { VideoConfig } from './interfaces'
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import router from '@ohos.router'; import router from '@ohos.router';
import { getCarInfo, getDeviceInfo } from '../common/service/terminalService'; import { getCarInfo, getDeviceInfo } from '../common/service/terminalService';
@ -16,7 +15,7 @@ import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import worker, { MessageEvents } from '@ohos.worker'; import worker, { MessageEvents } from '@ohos.worker';
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import { voiceService } from '../common/service/voiceService'; import { voiceService } from '../common/service/voiceService';
// import errorMsgDialog from './compontents/errorMsgDialog'
@Entry @Entry
@Component @Component
struct Index { struct Index {
@ -48,7 +47,13 @@ struct Index {
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.margin({ bottom: 12 * this.ratio}) .margin({ bottom: 12 * this.ratio})
} }
// dialogController: CustomDialogController | null = new CustomDialogController({
// builder: errorMsgDialog(
// title,
// isDialog,
// // cancel: ()=> { },
// // confirm: ()=> { }
// })
build() { build() {
Column() { Column() {
Column() { Column() {
@ -100,7 +105,7 @@ struct Index {
Column() { Column() {
Row() { Row() {
if (!this.isSingle) { if (!this.isSingle) {
Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:10 * globalThis.ratio}).onClick(async () => { Image($r('app.media.index_lw')).width('28%').height('71%').margin({left:80 * globalThis.ratio}).onClick(async () => {
if (this.loading) { if (this.loading) {
return return
} }
@ -123,7 +128,7 @@ struct Index {
}) })
} }
if (this.isSingle) { if (this.isSingle) {
Image($r('app.media.index_dj')).width('30.5%').height('74%').margin({left:10 * globalThis.ratio}).onClick(() => { Image($r('app.media.index_dj')).width('28%').height('71%').margin({left:80 * globalThis.ratio}).onClick(() => {
if (this.loading) { if (this.loading) {
return return
} }
@ -133,7 +138,7 @@ struct Index {
}, router.RouterMode.Single); }, router.RouterMode.Single);
}) })
} }
Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:10* globalThis.ratio}).onClick(() => { Image($r('app.media.index_zj')).width('28%').height('71%').margin({right:80* globalThis.ratio}).onClick(() => {
if (this.loading) { if (this.loading) {
return return
} }
@ -257,8 +262,7 @@ struct Index {
this.dialogVisiable=false this.dialogVisiable=false
this.angle = 0 this.angle = 0
this.loading = false this.loading = false
this.vocObj = new voiceService(async (status, val, next) => {
});
} }
async testXMLToJSONInWorker() { async testXMLToJSONInWorker() {
@ -272,7 +276,8 @@ 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
} }
workerInstance.postMessage(param); workerInstance.postMessage(param);
workerInstance.onmessage = (e: MessageEvents): void => { workerInstance.onmessage = (e: MessageEvents): void => {
@ -306,6 +311,7 @@ struct Index {
carNo: globalThis.carInfo.carNo, carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId placeId: globalThis.carInfo.examinationRoomId
} }
console.log('paramparam',JSON.stringify(param))
// globalThis.udpClient2.initHeartSendMsg(param,this.context) // globalThis.udpClient2.initHeartSendMsg(param,this.context)
if (globalThis.udpClient2.getStatus()) { if (globalThis.udpClient2.getStatus()) {
globalThis.udpClient2.sendMsgExt(param, this.context) globalThis.udpClient2.sendMsgExt(param, this.context)
@ -313,26 +319,14 @@ struct Index {
} }
async onPageShow() { async onPageShow() {
this.loading = false console.log('ttttt',1111)
this.userAuth(); this.userAuth();
this.createAlbum() console.log('ttttt2222',1111)
await getUDP(this.context,false)
await getUDP2(this.context,false)
this.num=0
clearInterval(this.interval)
this.interval = setInterval(() => {
this.num++
setliushuiNum(this.context)
getliushuiNum(this.context)
if(this.num>=3){
this.heartMsg()
}
}, 1000)
// this.vocObj = new voiceService(async (status, val, next) => {
getTCP() });
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
console.log('globalThis.singlePlay',globalThis.singlePlay)
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
this.vocObj.playAudio({ this.vocObj.playAudio({
type: 1, type: 1,
@ -341,6 +335,14 @@ struct Index {
globalThis.singlePlay = false globalThis.singlePlay = false
} }
this.isSingle = globalThis.singlePlay this.isSingle = globalThis.singlePlay
this.loading = false
this.createAlbum()
this.num=0
//
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
console.info('Index onPageShow'); console.info('Index onPageShow');
@ -378,16 +380,31 @@ struct Index {
} }
async initParams() { async initParams() {
//设置plc udp 同步requesthost
await getUDP(this.context,false)
this.loading = false this.loading = false
takePhotoFn(this.context) console.log('globalThis.deviceNo000')
this.deviceId=await getDeviceInfo(this.context) || '' await getDeviceInfo(this.context)
await getCarInfo() await getCarInfo()
await getUDP2(this.context,false)
getTCP()
this.deviceId= globalThis.carInfo.carNo
await setCurrentTime(); await setCurrentTime();
this.carNum = globalThis.carInfo.plateNo; this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version; this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth; this.hasAuth = globalThis.hasAuth;
initJudgeUdp() initJudgeUdp()
takePhotoFn(this.context)
console.log('deviceIddeviceId',globalThis.deviceNo,this.deviceNo) console.log('deviceIddeviceId',globalThis.deviceNo,this.deviceNo)
clearInterval(this.interval)
this.interval = setInterval(() => {
this.num++
setliushuiNum(this.context)
getliushuiNum(this.context)
if(this.num>=3){
this.heartMsg()
}
}, 1000)
//下载模型 //下载模型
// await this.getModel() // await this.getModel()
// const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00] // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]

View File

@ -55,7 +55,7 @@ export default struct Index {
} }
.margin({ left: 24 * this.ratio }) .margin({ left: 24 * this.ratio })
Text('考车号:' + globalThis.deviceNo) Text('考车号:' + globalThis.carInfo.carNo)
.fontColor('#CCAE7A') .fontColor('#CCAE7A')
.fontSize(22 * this.ratio) .fontSize(22 * this.ratio)
.margin({ right: 24 * this.ratio }) .margin({ right: 24 * this.ratio })

View File

@ -135,7 +135,6 @@ struct Index {
async aboutToAppear() { async aboutToAppear() {
const fileUtil = new FileUtil(this.context) const fileUtil = new FileUtil(this.context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
console.log('datadata',data)
if (data === '' || data === undefined) { if (data === '' || data === undefined) {
}else{ }else{
const result=JSON.parse(data) const result=JSON.parse(data)

View File

@ -28,7 +28,6 @@ import { initJudgeUdp } from '../common/utils/UdpJudge';
struct UserInfo { struct UserInfo {
private filePhoto: FilePhoto private filePhoto: FilePhoto
private avPlayer private avPlayer
@State pageIndex: number = 0 @State pageIndex: number = 0
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@State index: number = 0 @State index: number = 0
@ -70,10 +69,9 @@ struct UserInfo {
@State numCount: number = 0; @State numCount: number = 0;
@State signNum: number = 0; @State signNum: number = 0;
@State isCanClick: boolean = true; @State isCanClick: boolean = true;
@State updateTimeLimit: boolean = true @State updateTimeLimit: boolean = false
@State faceFlag: string = '0'; @State faceFlag: string = '0';
@State FaceOpenStatue: string = '0'; //是否开启人脸识别 @State FaceOpenStatue: string = '0'; //是否开启人脸识别
subscriber;
@State faceCatchImg: string = '' @State faceCatchImg: string = ''
@State Param803Str:string = '' @State Param803Str:string = ''
// 过程照片拍照 // 过程照片拍照
@ -318,7 +316,6 @@ struct UserInfo {
const faceParam = syssetParams.filter(sys => sys.v_no == '2413') const faceParam = syssetParams.filter(sys => sys.v_no == '2413')
// that.FaceOpenStatue = '0'
// faceParam?.[0]?.v_value || // faceParam?.[0]?.v_value ||
// 1身份证读卡器 2指纹 3人脸 // 1身份证读卡器 2指纹 3人脸
if(openCheckFlag=='1'){ if(openCheckFlag=='1'){
@ -328,7 +325,6 @@ struct UserInfo {
that.openDeviceByIDCard() that.openDeviceByIDCard()
} }
} }
//0不自动更新 1自动更新不限次数 2没有考生更新2次 //0不自动更新 1自动更新不限次数 2没有考生更新2次
if (that.studentRefreshStatue == '2') { if (that.studentRefreshStatue == '2') {
clearInterval(that.interval) clearInterval(that.interval)
@ -376,11 +372,18 @@ struct UserInfo {
} }
this.pageIndex--; this.pageIndex--;
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
this.dataList.forEach(listData => {
for (let i in listData) {
listData[i] = decodeURI(listData[i])
}
listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp
})
} }
//获取下载考生 //获取下载考生
getExaminationStudentInfoFn() { getExaminationStudentInfoFn() {
if (globalThis.singlePlay && this.updateTimeLimit) { if (globalThis.singlePlay || this.updateTimeLimit) {
return return
} }
const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>` const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>`

View File

@ -217,7 +217,7 @@ struct Index {
this.param.faceFlag = value this.param.faceFlag = value
console.info('Checkbox1 change is' + value) console.info('Checkbox1 change is' + value)
}) })
Text('启用过程人脸比对').fontColor('#333333').fontSize(16 * this.ratio) Text('启用人脸比对').fontColor('#333333').fontSize(16 * this.ratio)
TextInput({ text: this.param.rlls, controller: this.inputController }) TextInput({ text: this.param.rlls, controller: this.inputController })
.type(InputType.Normal) .type(InputType.Normal)
.borderRadius(0) .borderRadius(0)
@ -229,7 +229,7 @@ struct Index {
.onChange((value) => { .onChange((value) => {
this.param.rlls = value this.param.rlls = value
}) })
Text('拍照通道').fontColor('#333333').fontSize(16 * this.ratio) Text('过程拍照通道').fontColor('#333333').fontSize(16 * this.ratio)
TextInput({ text: this.param.pztd, controller: this.inputController }) TextInput({ text: this.param.pztd, controller: this.inputController })
.type(InputType.Normal) .type(InputType.Normal)
.borderRadius(0) .borderRadius(0)

View File

@ -45,7 +45,7 @@ export default struct FaceCompare {
Column() { Column() {
Column() { Column() {
Text('照片比对') Text('照片比对')
.lineHeight('16%') // .lineHeight('16%')
.height('16%') .height('16%')
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.fontSize(24) .fontSize(24)
@ -78,11 +78,11 @@ export default struct FaceCompare {
.height('100%') .height('100%')
} }
.width('88.9%') .width('88.9%')
.height('53.2%') .height('52%')
.justifyContent(FlexAlign.SpaceBetween) .justifyContent(FlexAlign.SpaceBetween)
Text('正在等待拍照…') Text('正在等待拍照…')
.lineHeight('16%') // .lineHeight('16%')
.height('16%') .height('16%')
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.fontColor('#CC7E00') .fontColor('#CC7E00')
@ -178,7 +178,7 @@ export default struct FaceCompare {
async faceComparFn() { async faceComparFn() {
console.log('mmmmm0', 2) console.log('mmmmm0', 2)
this.param.pztd=this.param.rlls
const data=await takePhoto(this.param, this.context, 'jt/', 1,) const data=await takePhoto(this.param, this.context, 'jt/', 1,)
this.base64=this.imageBase64 + data.base64 this.base64=this.imageBase64 + data.base64
console.log('mmmmt',this.base64) console.log('mmmmt',this.base64)
@ -191,7 +191,6 @@ export default struct FaceCompare {
}) })
.then(res => { .then(res => {
console.log('mmmmm8', res) console.log('mmmmm8', res)
if (res) { if (res) {
this.controller.stop() this.controller.stop()
this.showFaceCompare = !this.showFaceCompare this.showFaceCompare = !this.showFaceCompare

View File

@ -2,9 +2,9 @@
//考试回放开关 //考试回放开关
export const judgeConfig = { export const judgeConfig = {
//本地目录开关 //本地目录开关
isTrajectoryOpen: true, isTrajectoryOpen: false,
//是否开启拍照 //是否开启拍照
isPhotoOpen: false, isPhotoOpen: true,
//扣分语音是否强制开启 //扣分语音是否强制开启
kfVoiceOpen: false, kfVoiceOpen: false,
//忽略的考试项目 //忽略的考试项目