Compare commits

..

No commits in common. "60d8f3dec419ca0baf74cc956f57d84eb2f95095" and "5b43845710884b6f3c0735fba41b0052d2ce321e" have entirely different histories.

16 changed files with 109 additions and 196 deletions

View File

@ -225,30 +225,25 @@ export async function takePhotoFn(context) {
// param[key] = false // param[key] = false
} }
for (let i = 0; i <= arr.length - 1; i++) { for (let i = 0; i <= arr.length - 1; i++) {
let key1 = arr[i] let key = arr[i]
if (param[key1]) { if (param[key]) {
param.pztd = param[`td${Number(i) + 1}`] param.pztd = param[`td${Number(i) + 1}`]
takePhoto(param, context, 'jt/', 0, (data) => { takePhoto(param, context, 'jt/', 0, (data) => {
consoele.log('getPhtogetPhto',data)
if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) { if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) {
console.log('getPhtot0000') map[key] = true
map[key1] = true
promptAction.showToast({ promptAction.showToast({
message: `视频遮挡`, message: `视频遮挡`,
duration: 3000 duration: 3000
}); });
globalThis.spzd[key1] = true globalThis.spzd[key] = true
} else { } else {
map[key1] = false map[key] = false
globalThis.spzd[key1] = false globalThis.spzd[key] = false
} }
console.log('getPhtot0000')
setTimeout(() => { setTimeout(() => {
takePhotoFn() takePhotoFn()
}, 3000) }, 3000)
}) })
} }
} }
globalThis.takePhotoNum++ globalThis.takePhotoNum++

View File

@ -9,11 +9,11 @@ import FileUtil from '../../common/utils/File'
//获取设备信息 //获取设备信息
export async function getDeviceInfo(context) { export async function getDeviceInfo(context) {
// globalThis.deviceNo = '153216400880'; //科目三设备 // globalThis.deviceNo = '153216400880'; //科目三设备
// globalThis.deviceNo = '150667400235'; //科目三设备 globalThis.deviceNo = '150667400235'; //科目三设备
// globalThis.deviceNo = '1649018001275'; //洛阳科目三设备
// globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489 // globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489
// globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备 // globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备
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');

View File

@ -80,7 +80,6 @@ interface takePhotoParam {
name?:string, name?:string,
base64?:string, base64?:string,
fileSize?:number, fileSize?:number,
errorCode?:number
} }
/** /**
* *
@ -107,15 +106,15 @@ export async function takePhoto(param, context,dir,flag=1,callback?) {
if(flag==0){ if(flag==0){
rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{ rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{
console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize); console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize);
callback({fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) callback({fileSize:snapResult.fileSize })
}); });
} }
else{ else{
return new Promise<takePhotoParam>((resolve,reject)=>{ return new Promise<takePhotoParam>((resolve,reject)=>{
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{
console.log('getPhtot',JSON.stringify(snapResult)) console.log('getPhtot')
resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize })
}); });
}) })
console.log('getmyLog02') console.log('getmyLog02')

View File

@ -17,7 +17,12 @@ export async function getTCP() {
await globalThis.TcpClient.sendMsg('1002') //1002 await globalThis.TcpClient.sendMsg('1002') //1002
globalThis.TcpClient.onError((val) => { globalThis.TcpClient.onError((val) => {
setTimeout(() => { setTimeout(() => {
getTCP() globalThis.TcpClient.sendMsg('1002') //1002
if (val) {
// const msg=val.substring(5,val.length-1)
console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus())
globalThis.udpClient?.sendMsg(val)
}
}, 1000) }, 1000)
}) })
await globalThis.TcpClient.onMessage((val) => { await globalThis.TcpClient.onMessage((val) => {
@ -41,8 +46,12 @@ export async function getTCP() {
await globalThis.TcpClient.connectTcp() await globalThis.TcpClient.connectTcp()
await globalThis.TcpClient.sendMsg('1002') //1002 await globalThis.TcpClient.sendMsg('1002') //1002
globalThis.TcpClient.onError((val) => { globalThis.TcpClient.onError((val) => {
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
setTimeout(() => { setTimeout(() => {
getTCP() globalThis.TcpClient.sendMsg('1002') //1002
if (val && globalThis.udpClient?.sendMsg) {
globalThis.udpClient?.sendMsg(val)
}
}, 1000) }, 1000)
}) })
await globalThis.TcpClient.onMessage((val) => { await globalThis.TcpClient.onMessage((val) => {

View File

@ -7,7 +7,7 @@ export async function sendMsg(val) {
// globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val) // globalThis.udpClient1&&globalThis.udpClient1.sendMsg(val)
} }
export async function getUDP(errorFlag?) { export async function getUDP() {
return new Promise((reslove,reject)=>{ return new Promise((reslove,reject)=>{
getSyncData('IpConfigTable').then((result: Array<any>) => { getSyncData('IpConfigTable').then((result: Array<any>) => {
if (result.length) { if (result.length) {
@ -19,19 +19,10 @@ export async function getUDP(errorFlag?) {
globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort) globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, result[0].udpOppositeIpPort)
globalThis.udpClient.sendMsg('111', null) globalThis.udpClient.sendMsg('111', null)
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
globalThis.udpClient.onError_Callback(()=>{
console.log('getUDPgetUDPgetUDP')
getUDP(true)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
}
})
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
// globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) // globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
}, 1000) }, 1000)
}) })
} }
else { else {
// 未绑定 // 未绑定
@ -40,23 +31,11 @@ export async function getUDP(errorFlag?) {
udpClient.bindUdp() udpClient.bindUdp()
udpClient.sendMsg('111') udpClient.sendMsg('111')
globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}`
globalThis.udpClient = udpClient
globalThis.udpClient.onMessage_1(()=>{
console.log('getUDPonMessage_1msgmsgByGloalUdp')
})
globalThis.udpClient.onError_Callback(()=>{
getUDP(true)
if(errorFlag&&globalThis.udpClient&&globalThis.udpClient.onMessage_1){
globalThis.udpClient.onMessage_1=globalThis.udpClient.onMessage_1
}
})
// udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) // udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{})
globalThis.udpClient = udpClient
getChuankouFn() getChuankouFn()
reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) reslove(`http://${result[0].centerIp}:${result[0].centerPort}`)
} }
} else { } else {
@ -77,7 +56,7 @@ export async function getUDP(errorFlag?) {
} }
export async function getUDP2(errorFlag?) { export async function getUDP2() {
console.log(` getUDP2 enter`); console.log(` getUDP2 enter`);
getSyncData('IpConfigTable').then(async (result: Array<any>) => { getSyncData('IpConfigTable').then(async (result: Array<any>) => {
if (result.length) { if (result.length) {
@ -87,12 +66,6 @@ export async function getUDP2(errorFlag?) {
globalThis.udpClient2.closeUdp(async () => { globalThis.udpClient2.closeUdp(async () => {
setTimeout(() => { setTimeout(() => {
globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
globalThis.udpClient2.onError_Callback(()=>{
getUDP2(true);
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2
}
})
}, 1000) }, 1000)
}) })
} }
@ -101,35 +74,27 @@ export async function getUDP2(errorFlag?) {
console.log(` getUDP2 has no udclent and bind `); console.log(` getUDP2 has no udclent and bind `);
const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort) const udpClient2: UdpClientByCenter = new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, globalThis.carInfo?.messagePort)
await udpClient2.bindUdp() await udpClient2.bindUdp()
await udpClient2.onError_Callback(()=>{ await udpClient2.onError_Callback()
getUDP2(true); await udpClient2.onMessage_2((val) => {
if(errorFlag&&globalThis.udpClient2&&globalThis.udpClient2.onMessage_2){ if (val.id == '32') {
globalThis.udpClient2.onMessage_2=globalThis.udpClient2.onMessage_2 globalThis.signNum = val.body[1]
} else if (val.id == '46') {
let tmpList = []
const str = globalThis.lsh
for (let i = 0; i < str.length; i++) {
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
id: 47,
list: tmpList,
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId
}
globalThis.udpClient2.send(param)
} }
}) })
if(!errorFlag){
await udpClient2.onMessage_2((val) => {
if (val.id == '32') {
globalThis.signNum = val.body[1]
} else if (val.id == '46') {
let tmpList = []
const str = globalThis.lsh
for (let i = 0; i < str.length; i++) {
tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
id: 47,
list: tmpList,
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId
}
globalThis.udpClient2.send(param)
}
})
}
globalThis.udpClient2 = udpClient2 globalThis.udpClient2 = udpClient2
} }
} else { } else {
globalThis.udpClient2 = {} globalThis.udpClient2 = {}
@ -172,7 +137,6 @@ export async function setJudgeUdp() {
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_1((val) => { await udpClientbyCenter.onMessage_1((val) => {
console.log('valval', val) console.log('valval', val)
}) })
// globalThis.judgeUdpClient = udpClientbyCenter; // globalThis.judgeUdpClient = udpClientbyCenter;
return { return {

View File

@ -1,6 +1,5 @@
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';
const TAG = 'socketTag[TcpDemo.TcpClient]' const TAG = 'socketTag[TcpDemo.TcpClient]'
@ -25,7 +24,9 @@ export default class TcpClient {
this.tcp.on('error', err => { this.tcp.on('error', err => {
console.log(TAG, 'tcpOnerror', JSON.stringify(err)) console.log(TAG, 'tcpOnerror', JSON.stringify(err))
setTimeout(async () => { setTimeout(async () => {
getTCP() await this.bindTcp()
await this.connectTcp()
this.onMessage(callback)
}, 2000) }, 2000)
// this.closeUdp(()=>{ // this.closeUdp(()=>{
// this.bindUdp() // this.bindUdp()

View File

@ -73,11 +73,11 @@ export default class UdpClientByCenter {
promise.then(() => { promise.then(() => {
// globalThis.closeHeartSocket=false // globalThis.closeHeartSocket=false
this.isWorking = true this.isWorking = true
console.log(`${TAG} getUDPudp rebind success`); console.log(`${TAG} udp bind success`);
}).catch(err => { }).catch(err => {
//globalThis.closeHeartSocket=true //globalThis.closeHeartSocket=true
this.isWorking = false this.isWorking = false
console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`); console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
}); });
} }
@ -87,10 +87,10 @@ export default class UdpClientByCenter {
}); });
promise.then(() => { promise.then(() => {
this.isWorking = true this.isWorking = true
console.log(`${TAG} getUDPudp bind success`); console.log(`${TAG} udp bind success`);
}).catch(err => { }).catch(err => {
this.isWorking = false this.isWorking = false
console.log(`${TAG} getUDPudp bind failed:${JSON.stringify(err)}`); console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`);
}); });
} }
@ -147,9 +147,9 @@ export default class UdpClientByCenter {
} }
sendHeadMsg(msgData) { sendHeadMsg(msgData) {
console.log('getUDPsendHeadMsg enter') console.log('sendHeadMsg enter')
this.sendMsg(msgData, null) this.sendMsg(msgData, null)
console.log('getUDPsendHeadMsg exit') console.log('sendHeadMsg exit')
} }
sendMsg(msg, sendCallback?) { sendMsg(msg, sendCallback?) {
@ -172,12 +172,12 @@ export default class UdpClientByCenter {
if (sendCallback) { if (sendCallback) {
sendCallback() sendCallback()
} }
console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); console.log(`${TAG}udpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
}).catch(err => { }).catch(err => {
console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); console.log(`${TAG}udpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`);
}); });
} }
console.log('getUDPgetState success:' + JSON.stringify(data)); console.log('getState success:' + JSON.stringify(data));
}) })
} }
@ -194,7 +194,7 @@ 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;
console.log('getUDPUdpClientByCenter onError err:' + JSON.stringify(err)); console.log('UdpClientByCenter onError err:' + JSON.stringify(err));
callback && callback() callback && callback()
}); });
} }
@ -202,7 +202,7 @@ export default class UdpClientByCenter {
onError_resend(callback?) { onError_resend(callback?) {
this.udp.on('error', async err => { this.udp.on('error', async err => {
this.isWorking = false; this.isWorking = false;
console.log(TAG, 'getUDPudpError', JSON.stringify(err)) console.log(TAG, 'udpError', JSON.stringify(err))
await this.bindUdp() await this.bindUdp()
await this.sendMsg('111', null) await this.sendMsg('111', null)
await this.onMessage_1(callback) await this.onMessage_1(callback)
@ -243,16 +243,16 @@ export default class UdpClientByCenter {
} }
closeUdp(callback?) { closeUdp(callback?) {
console.log('getUDPUdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort); console.log('UdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort);
this.udp.close(err => { this.udp.close(err => {
if (err) { if (err) {
console.log('getUDPUdpClientByCenter closeUdp failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err)); console.log('UdpClientByCenter closeUdp failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err));
} else { } else {
this.isWorking = false this.isWorking = false
if (callback != null) { if (callback != null) {
callback() callback()
} }
console.log('getUDPUdpClientByCenter closeUdp succeed ip:' + this.localIp + ' port:' + this.localIpPort); console.log('UdpClientByCenter closeUdp succeed ip:' + this.localIp + ' port:' + this.localIpPort);
} }
}) })
} }
@ -264,9 +264,9 @@ export default class UdpClientByCenter {
} }
closeMessage_1(){ closeMessage_1(){
console.info('surenjun', 'getUDP关闭udp message监听事件') console.info('surenjun', '关闭udp message监听事件')
this.udp.off('message',this.message_1Fn); this.udp.off('message',this.message_1Fn);
console.info('surenjun', 'getUDP关闭udp message监听事件 成功') console.info('surenjun', '关闭udp message监听事件 成功')
} }
message_1Fn = (value)=>{ message_1Fn = (value)=>{
@ -291,7 +291,7 @@ export default class UdpClientByCenter {
} }
console.log(`${TAG} udp222 on message array buffer:${str}`); console.log(`${TAG} udp222 on message array buffer:${str}`);
strachArr[28] = globalThis.chuankoMsg || strachArr[28] strachArr[28] = globalThis.chuankoMsg || '0'
// this.stashFn(str) // this.stashFn(str)
const newArr = JSON.parse(JSON.stringify(strachArr)) const newArr = JSON.parse(JSON.stringify(strachArr))
// this.stashFn=()=>{} // this.stashFn=()=>{}

View File

@ -28,8 +28,8 @@ export default class EntryAbility extends UIAbility {
globalThis.examinerInfo = {} globalThis.examinerInfo = {}
globalThis.deviceNo = ''; globalThis.deviceNo = '';
globalThis.hasAuth = false globalThis.hasAuth = false
globalThis.version = '2022.08.13.01' globalThis.version = '2024.11.22.14'
globalThis.judgeVersion = '2022.12.05.1' 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

@ -103,9 +103,6 @@ export default struct Index {
router.pushUrl({ router.pushUrl({
url: 'pages/SignDisplay', url: 'pages/SignDisplay',
}, router.RouterMode.Single); }, router.RouterMode.Single);
this.stachValue = JSON.parse(JSON.stringify(StackValueData))
this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData))
this.passArray = JSON.parse(JSON.stringify(PassData))
// clearInterval(this.interval) // clearInterval(this.interval)
} }
@ -160,9 +157,6 @@ export default struct Index {
this.warnFlag = WarnFlagData this.warnFlag = WarnFlagData
this.passArray = PassData this.passArray = PassData
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
this.stachValue = JSON.parse(JSON.stringify(StackValueData))
this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData))
this.passArray = JSON.parse(JSON.stringify(PassData))
this.index = this.checkListCopy[0].key this.index = this.checkListCopy[0].key
this.vocObj.playAudio({ this.vocObj.playAudio({
type: 1, type: 1,
@ -173,8 +167,6 @@ export default struct Index {
getPLCInfo() { getPLCInfo() {
const that = this const that = this
globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => {
console.log('getUDPonMessage_1byCarCheck2')
if (!this.breakFlag) { if (!this.breakFlag) {
return return
} }
@ -317,9 +309,6 @@ export default struct Index {
outClick() { outClick() {
this.vocObj && this.vocObj.releasePlayer() this.vocObj && this.vocObj.releasePlayer()
this.breakFlag = false this.breakFlag = false
this.stachValue = JSON.parse(JSON.stringify(StackValueData))
this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData))
this.passArray = JSON.parse(JSON.stringify(PassData))
// clearInterval(this.interval) // clearInterval(this.interval)
} }

View File

@ -11,7 +11,7 @@ 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 { getTCP } from '../common/utils/GlobalTcp'; import { getTCP } from '../common/utils/GlobalTcp';
import { getliushuiNum, setliushuiNum,takePhotoFn } from '../common/service/indexService'; import { getliushuiNum, setliushuiNum } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; 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'
@ -285,6 +285,7 @@ struct Index {
this.heartMsg() this.heartMsg()
} }
}, 1000) }, 1000)
// takePhotoFn(this.context)
// //
getTCP() getTCP()
@ -336,7 +337,6 @@ struct Index {
async initParams() { async initParams() {
this.loading = false this.loading = false
takePhotoFn(this.context)
this.deviceId=await getDeviceInfo(this.context) || '' this.deviceId=await getDeviceInfo(this.context) || ''
await getCarInfo() await getCarInfo()
await setCurrentTime(); await setCurrentTime();

View File

@ -49,22 +49,15 @@ struct Index {
this.time = await getCurrentTime(); this.time = await getCurrentTime();
this.examTime += 1; this.examTime += 1;
}, 1000); }, 1000);
console.log('SURENJUN_JUDGE',10)
//初始化数据库表 //初始化数据库表
await this.initDb() await this.initDb()
//断点续考 //断点续考
console.log('SURENJUN_JUDGE',11)
await this.goDdxkItems() await this.goDdxkItems()
//初始化评判 //初始化评判
console.log('SURENJUN_JUDGE',6)
const judge = await this.initJudge(); const judge = await this.initJudge();
console.log('SURENJUN_JUDGE',7)
this.judge = judge this.judge = judge
} }
@ -76,6 +69,7 @@ struct Index {
const {isTrajectoryOpen,trajectoryPath} = judgeConfig const {isTrajectoryOpen,trajectoryPath} = judgeConfig
await this.initStudent(); await this.initStudent();
await this.initCar(); await this.initCar();
//是否开启轨迹回放模式 //是否开启轨迹回放模式
if (isTrajectoryOpen) { if (isTrajectoryOpen) {
this.initTrajectoryParam(trajectoryPath) this.initTrajectoryParam(trajectoryPath)
@ -85,16 +79,12 @@ struct Index {
await this.initSysset(); await this.initSysset();
this.singlePlay = globalThis.singlePlay this.singlePlay = globalThis.singlePlay
} }
await this.initCDSBInfo() await this.initCDSBInfo()
// 科目三新增读取表数据 // 科目三新增读取表数据
if (examSubject == 3) { if (examSubject == 3) {
await this.initMapPoint() await this.initMapPoint()
await this.initMapPointItem() await this.initMapPointItem()
//定时上传考试里程 //定时上传考试里程
// let mileageTimer = setInterval(()=>{ // let mileageTimer = setInterval(()=>{
// this.uploadMileage() // this.uploadMileage()
@ -341,10 +331,7 @@ struct Index {
// 评判相关初始化 // 评判相关初始化
async initJudge() { async initJudge() {
console.log('SURENJUN_JUDGE',0)
const judge = new Judge(this); const judge = new Judge(this);
console.log('SURENJUN_JUDGE',30)
await judge.onJudgeFn(async (judgeData) => { await judge.onJudgeFn(async (judgeData) => {
const {xmmcStr,carztStr,kfArr} = judgeData; const {xmmcStr,carztStr,kfArr} = judgeData;
this.xmmcStr = xmmcStr; this.xmmcStr = xmmcStr;

View File

@ -18,8 +18,8 @@ struct Index {
// '',] // '',]
// @State inputTextList2: string[] = ['192.168.7.124','20022'] // @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[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','172.37.55.1','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122']
@State inputTextList1: string[] = ['192.168.1.144','18782','192.168.1.144','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[] = ['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[] = [] // @State inputTextList2: string[] = []
// 112.80.35.83 11052 // 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'] // @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']

View File

@ -17,14 +17,18 @@ import promptAction from '@ohos.promptAction';
import FilePhoto from './judgeSDK/utils/filePhoto'; import FilePhoto from './judgeSDK/utils/filePhoto';
import { getSyncData, upDateTableByArray } from '../common/service/initable'; import { getSyncData, upDateTableByArray } from '../common/service/initable';
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData'; 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 LoadingPopup from './compontents/judge/LoadingPopup';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { JudgeConfig } from '../config/judge';
import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import { judgeConfig } from './judgeSDK/utils/judgeConfig';
@Entry @Entry
@Component @Component
struct UserInfo { struct UserInfo {
private filePhoto: FilePhoto
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
@ -43,12 +47,9 @@ struct UserInfo {
@State isBoardPrePareSetPopupOpen: boolean = false @State isBoardPrePareSetPopupOpen: boolean = false
@State isFirstBoardPrePareSetPopupBtnShow: boolean = false @State isFirstBoardPrePareSetPopupBtnShow: boolean = false
@State isBoardPrePareSetPopupShow: boolean = false @State isBoardPrePareSetPopupShow: boolean = false
@State isLoadingPopupVisible: boolean = false; @State isLoadingPopupVisible:boolean = false;
@State loadingText: string = '正在认证监管信息,请稍后...' @State loadingText:string = '正在认证监管信息,请稍后...'
@State sczbkf: { @State sczbkf:{xmdm:number,kfdm:string}[] = []
xmdm: number,
kfdm: string
}[] = []
@State currentUser: User = EmptyCandidateObject @State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = [] @State dataList: Array<User> = []
@State list: Array<User> = [] @State list: Array<User> = []
@ -61,7 +62,7 @@ struct UserInfo {
@State idCard: string = ''; @State idCard: string = '';
@State grantDept: string = ''; @State grantDept: string = '';
//是否已经开始考试 //是否已经开始考试
@State isExamStart: boolean = false; @State isExamStart:boolean = false;
@State effectDate: string = ''; @State effectDate: string = '';
@State interval: any = null; @State interval: any = null;
@State studentRefreshStatue: string = '0'; @State studentRefreshStatue: string = '0';
@ -69,7 +70,6 @@ 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 faceFlag: string = '0'; @State faceFlag: string = '0';
@State FaceOpenStatue: string = '0'; //是否开启人脸识别 @State FaceOpenStatue: string = '0'; //是否开启人脸识别
subscriber; subscriber;
@ -86,10 +86,7 @@ struct UserInfo {
return photoBase64 return photoBase64
} }
} }
private filePhoto: FilePhoto private AccountTable = new AccountTable(() => {}, USER);
private avPlayer
private AccountTable = new AccountTable(() => {
}, USER);
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private labelBlocks = [ private labelBlocks = [
{ label: '考生姓名', key: 'xm' }, { label: '考生姓名', key: 'xm' },
@ -311,7 +308,7 @@ struct UserInfo {
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452')
that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0'
const faceParam = syssetParams.filter(sys => sys.v_no === '2413') const faceParam = syssetParams.filter(sys => sys.v_no === '2313')
that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0'
that.FaceOpenStatue = '0' that.FaceOpenStatue = '0'
console.log('that.FaceOpenStatue', that.FaceOpenStatue) console.log('that.FaceOpenStatue', that.FaceOpenStatue)
@ -386,15 +383,11 @@ struct UserInfo {
//获取下载考生 //获取下载考生
getExaminationStudentInfoFn() { getExaminationStudentInfoFn() {
if (globalThis.singlePlay && this.updateTimeLimit) { if (globalThis.singlePlay) {
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>`
getExaminationStudentInfo(param).then(res => { getExaminationStudentInfo(param).then(res => {
setTimeout(() => {
this.updateTimeLimit = true
}, 30000)
this.updateTimeLimit = false
if (!res) { if (!res) {
this.dataList = [] this.dataList = []
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
@ -520,12 +513,12 @@ struct UserInfo {
this.currentUser.id = '1' this.currentUser.id = '1'
const avPlayer = this.avPlayer; const avPlayer = this.avPlayer;
this.isLoadingPopupVisible = true this.isLoadingPopupVisible = true
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { avPlayer.playAudio([`voice/监管通信中.mp3`],false,async ()=>{
const code = await this.beginExam(); const code = await this.beginExam();
if (code != 1) { if (code != 1) {
promptAction.showToast({ promptAction.showToast({
message: '开始考试接口调用失败!', message:'开始考试接口调用失败!',
duration: 4000 duration:4000
}) })
return return
} }
@ -549,30 +542,30 @@ struct UserInfo {
// 检测车门、熄火信号 // 检测车门、熄火信号
async checkSignal(): Promise<boolean> { async checkSignal(): Promise<boolean> {
const {isCheckFireOpen} = judgeConfig const {isCheckFireOpen} = judgeConfig
return new Promise((resolve, reject) => { return new Promise((resolve,reject)=>{
if (isCheckFireOpen) { if(isCheckFireOpen){
resolve(true) resolve(true)
// return // return
} }
console.info('socketTag[PLC.UdpClient]', '注册udp回调') console.info('socketTag[PLC.UdpClient]', '注册udp回调')
let plcValue = globalThis.udpClient.getCurrentMessage(); let plcValue = globalThis.udpClient.getCurrentMessage();
console.info('surenjun', plcValue) console.info('surenjun',plcValue)
const msgArr = plcValue.split(',') || '' const msgArr = plcValue.split(',') || ''
const mkg = msgArr[14]; const mkg = msgArr[14];
const fdjzs = msgArr[25]; const fdjzs = msgArr[25];
if (mkg == 1) { if(mkg == 1){
this.avPlayer.playAudio(['voice/关门.mp3']) this.avPlayer.playAudio(['voice/关门.mp3'])
promptAction.showToast({ promptAction.showToast({
message: '请关闭车门', message:'请关闭车门',
duration: 4000 duration:4000
}) })
reject(false) reject(false)
} }
if (fdjzs * 1 > 0) { if(fdjzs*1 > 0){
this.avPlayer.playAudio(['voice/熄火.mp3']) this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({ promptAction.showToast({
message: '请熄火', message:'请熄火',
duration: 4000 duration:4000
}) })
reject(false) reject(false)
} }
@ -762,7 +755,13 @@ struct UserInfo {
if (!this.currentUser.xm) { if (!this.currentUser.xm) {
return return
} }
// if(globalThis.spzdFlag){
// promptAction.showToast({
// message: '摄像头被遮挡',
// duration: 2000
// });
// return
// }
console.info('surenjun currentUser', JSON.stringify(this.currentUser)) console.info('surenjun currentUser', JSON.stringify(this.currentUser))
if (globalThis.singlePlay) { if (globalThis.singlePlay) {
const {examSubject} = globalThis.carInfo; const {examSubject} = globalThis.carInfo;
@ -847,7 +846,7 @@ struct UserInfo {
} }
// loading // loading
if (this.isLoadingPopupVisible) { if(this.isLoadingPopupVisible){
LoadingPopup({ LoadingPopup({
title: this.loadingText, title: this.loadingText,
}) })
@ -887,7 +886,7 @@ struct CommText {
build() { build() {
Text(this.text) Text(this.text)
.fontSize(19.5 * this.ratio) .fontSize(16 * this.ratio)
.lineHeight(30 * this.ratio) .lineHeight(30 * this.ratio)
.fontWeight(500) .fontWeight(500)
.fontColor(this.color) .fontColor(this.color)
@ -913,13 +912,9 @@ struct LabelBlock {
build() { build() {
Row() { Row() {
Text(this.label).fontSize(18 * this.ratio).fontColor('#99948A') Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A')
Row() { Row() {
Text(decodeURIComponent(this.value)) Text(decodeURIComponent(this.value)).fontColor('#fff').textAlign(TextAlign.Center).width('100%')
.fontColor('#fff')
.textAlign(TextAlign.Center)
.width('100%')
.fontSize(20 * this.ratio)
} }
.commLabelStyle() .commLabelStyle()
}.margin({ bottom: 10 * this.ratio }) }.margin({ bottom: 10 * this.ratio })

View File

@ -235,28 +235,7 @@ export default struct SignDisplayCom {
.backgroundImage($r('app.media.km_open')) .backgroundImage($r('app.media.km_open'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.visibility(this.active == 0 ? Visibility.Visible : Visibility.None) .visibility(this.active == 0 ? Visibility.Visible : Visibility.None)
Column() {
Column() {
Text( this.msg || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('100%')
.textAlign(TextAlign.Start)
}
.backgroundColor('#282828')
.width(this.ratio * 890)
.height(436 * this.ratio)
.margin({ left: 0 * this.ratio, top: 15 * this.ratio })
}
.width(936 * this.ratio)
.height(480 * this.ratio)
.margin({ left: 10 * this.ratio })
.padding({ left: 10 * this.ratio, right: 10 * this.ratio })
.backgroundImage($r('app.media.km_open'))
.backgroundImageSize({ width: '100%', height: '100%' })
.visibility(this.active == 2 ? Visibility.Visible : Visibility.None)
Row() { Row() {
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
Row() { Row() {
@ -329,7 +308,7 @@ export default struct SignDisplayCom {
if (showBack) { if (showBack) {
this.ratio = 1.4 this.ratio = 1.4
globalThis.udpClient.onMessage_1((msg) => { globalThis.udpClient.onMessage_1((msg) => {
console.log('getUDPonMessage_1bysignDisplay0', msg) console.log('msgmsg', msg)
if (msg) { if (msg) {
getSignal(msg) getSignal(msg)
} }
@ -354,8 +333,6 @@ export default struct SignDisplayCom {
const showBack = this.showBack; const showBack = this.showBack;
if (showBack) { if (showBack) {
globalThis.udpClient.onMessage_1((msg) => { globalThis.udpClient.onMessage_1((msg) => {
console.log('getUDPonMessage_1bysignDisplay2', msg)
getSignal(msg) getSignal(msg)
}) })
} else { } else {

View File

@ -25,10 +25,7 @@ export async function examJudgeVersion(){
* @desc * @desc
*/ */
export async function examJudgeSetLogCallback(level:number,handleLog:Function):Promise<string>{ export async function examJudgeSetLogCallback(level:number,handleLog:Function):Promise<string>{
console.log('SURENJUN_JUDGESDK',0)
const temp = libJudgeSdk.examJudgeSetLogCallback(level,handleLog); const temp = libJudgeSdk.examJudgeSetLogCallback(level,handleLog);
console.log('SURENJUN_JUDGESDK',1)
return await handle(temp,'examJudgeSetLogCallback') return await handle(temp,'examJudgeSetLogCallback')
} }

View File

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