lv_chengmai #57
@ -3,16 +3,12 @@ import { obtainCarExamInfo } from '../../api/index'
|
||||
import { dateFormat } from '../utils/tools'
|
||||
import router from '@ohos.router'
|
||||
import promptAction from '@ohos.promptAction'
|
||||
import { getSyncData } from '../../common/service/initable'
|
||||
import { GlobalConfig } from '../../config/index'
|
||||
import FileUtil from '../../common/utils/File'
|
||||
|
||||
//获取设备信息
|
||||
export async function getDeviceInfo(context) {
|
||||
// globalThis.deviceNo = '153216400880'; //科目三设备
|
||||
// globalThis.deviceNo = '150667400235'; //科目三设备
|
||||
// globalThis.deviceNo = '1649018001275'; //洛阳科目三设备
|
||||
// globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489
|
||||
// globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const fileUtil = new FileUtil(context)
|
||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
|
||||
@ -21,12 +17,9 @@ export async function getDeviceInfo(context) {
|
||||
message: `请先进行设备注册`,
|
||||
duration: 3000
|
||||
});
|
||||
router.pushUrl({
|
||||
url: 'pages/Register',
|
||||
}, router.RouterMode.Single);
|
||||
resolve('')
|
||||
} else {
|
||||
const fileData = JSON.parse(data)
|
||||
const fileData=JSON.parse(data)
|
||||
globalThis.deviceNo = fileData.deviceName
|
||||
getCarInfo()
|
||||
resolve(fileData.deviceName)
|
||||
|
||||
@ -152,6 +152,7 @@ export default class TcpClient {
|
||||
onMessage(callback?) {
|
||||
this.tcp.on('message', value => {
|
||||
console.log(TAG, 'Tcponmessage', value.length, value)
|
||||
globalThis.tcpUdpError = false
|
||||
|
||||
// console.log('messageLengt',,value.message.length))
|
||||
console.log('testTagtcpmsg')
|
||||
@ -165,6 +166,18 @@ export default class TcpClient {
|
||||
} else {
|
||||
callback && callback('')
|
||||
}
|
||||
setTimeout(async () => {
|
||||
//程序断开
|
||||
if (globalThis.tcpUdpError) {
|
||||
this.num++
|
||||
console.log(TAG,'tcp信号丢失')
|
||||
if(this.num==3){
|
||||
getTCP()
|
||||
this.num=0
|
||||
}
|
||||
}
|
||||
globalThis.tcpUdpError = true;
|
||||
}, 2000)
|
||||
// callback(value.message)
|
||||
});
|
||||
}
|
||||
@ -181,6 +194,7 @@ export default class TcpClient {
|
||||
let promise = this.tcp.close();
|
||||
promise.then(() => {
|
||||
globalThis.getCloseTcp = true
|
||||
|
||||
console.log(TAG, 'tcpCloseSuccess')
|
||||
callback()
|
||||
reslove(true)
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
import socket from '@ohos.net.socket';
|
||||
import { Array2Byte } from '../utils/tools'
|
||||
import {getChuankouFn} from '../../common/service/indexService'
|
||||
|
||||
import {getUDP} from './GlobalUdp'
|
||||
const TAG = 'socketTag[PLC.UdpClient]'
|
||||
import prompt from '@ohos.prompt'
|
||||
|
||||
@ -29,7 +29,7 @@ export default class UdpClient {
|
||||
private oppositeIpPort: string = ''
|
||||
|
||||
private udp: any = null
|
||||
// private stashFn:StashFuncotion
|
||||
// private stashFn:StashFuncotionon
|
||||
|
||||
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
|
||||
this.localIp = udplocalIp
|
||||
@ -179,9 +179,10 @@ export default class UdpClient {
|
||||
num++
|
||||
console.log(TAG,'plc udp信号丢失')
|
||||
if(num==3){
|
||||
await this.bindUdp()
|
||||
await this.sendMsg('111')
|
||||
await this.onMessage(callback)
|
||||
getUDP(globalThis.context,true)
|
||||
// await this.bindUdp()
|
||||
// await this.sendMsg('111')
|
||||
// await this.onMessage(callback)
|
||||
num=0
|
||||
}
|
||||
prompt.showToast({
|
||||
|
||||
@ -30,6 +30,8 @@ export default class EntryAbility extends UIAbility {
|
||||
globalThis.hasAuth = false
|
||||
globalThis.version = '2022.08.13.01'
|
||||
globalThis.judgeVersion = '2022.12.05.1'
|
||||
// globalThis.version = '2024.11.22.14'
|
||||
// globalThis.judgeVersion = '2024.11.22.14'
|
||||
globalThis.videoVersion= '1.0'
|
||||
// globalThis.version = '2023.12.13.01'
|
||||
// globalThis.judgeVersion = '2023.09.30.1'
|
||||
|
||||
@ -311,6 +311,7 @@ struct Index {
|
||||
carNo: globalThis.carInfo.carNo,
|
||||
placeId: globalThis.carInfo.examinationRoomId
|
||||
}
|
||||
console.log('paramparam',JSON.stringify(param))
|
||||
// globalThis.udpClient2.initHeartSendMsg(param,this.context)
|
||||
if (globalThis.udpClient2.getStatus()) {
|
||||
globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||
@ -318,6 +319,7 @@ struct Index {
|
||||
}
|
||||
|
||||
async onPageShow() {
|
||||
this.userAuth();
|
||||
this.vocObj = new voiceService(async (status, val, next) => {
|
||||
});
|
||||
|
||||
@ -331,10 +333,8 @@ struct Index {
|
||||
}
|
||||
this.isSingle = globalThis.singlePlay
|
||||
this.loading = false
|
||||
this.userAuth();
|
||||
this.createAlbum()
|
||||
await getUDP(this.context,false)
|
||||
await getUDP2(this.context,false)
|
||||
|
||||
this.num=0
|
||||
clearInterval(this.interval)
|
||||
this.interval = setInterval(() => {
|
||||
@ -347,7 +347,6 @@ struct Index {
|
||||
}, 1000)
|
||||
|
||||
//
|
||||
getTCP()
|
||||
// const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
|
||||
|
||||
console.info('Index onPageShow');
|
||||
@ -386,10 +385,15 @@ struct Index {
|
||||
}
|
||||
|
||||
async initParams() {
|
||||
//设置plc udp 同步requesthost
|
||||
await getUDP(this.context,false)
|
||||
this.loading = false
|
||||
takePhotoFn(this.context)
|
||||
this.deviceId=await getDeviceInfo(this.context) || ''
|
||||
await getCarInfo()
|
||||
await getDeviceInfo(this.context)
|
||||
// await getCarInfo()
|
||||
// await getUDP2(this.context,false)
|
||||
// getTCP()
|
||||
this.deviceId= globalThis.carInfo.carNo
|
||||
await setCurrentTime();
|
||||
this.carNum = globalThis.carInfo.plateNo;
|
||||
this.version = globalThis.version;
|
||||
|
||||
@ -55,7 +55,7 @@ export default struct Index {
|
||||
}
|
||||
.margin({ left: 24 * this.ratio })
|
||||
|
||||
Text('考车号:' + globalThis.deviceNo)
|
||||
Text('考车号:' + globalThis.carInfo.carNo)
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(22 * this.ratio)
|
||||
.margin({ right: 24 * this.ratio })
|
||||
|
||||
@ -316,7 +316,6 @@ struct UserInfo {
|
||||
|
||||
const faceParam = syssetParams.filter(sys => sys.v_no == '2413')
|
||||
|
||||
// that.FaceOpenStatue = '0'
|
||||
// faceParam?.[0]?.v_value ||
|
||||
// 1身份证读卡器 2指纹 3人脸
|
||||
if(openCheckFlag=='1'){
|
||||
@ -326,6 +325,7 @@ struct UserInfo {
|
||||
that.openDeviceByIDCard()
|
||||
}
|
||||
}
|
||||
// that.FaceOpenStatue = '0'
|
||||
|
||||
//0不自动更新 1自动更新(不限次数) 2没有考生更新2次
|
||||
if (that.studentRefreshStatue == '2') {
|
||||
|
||||
@ -217,7 +217,7 @@ struct Index {
|
||||
this.param.faceFlag = 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 })
|
||||
.type(InputType.Normal)
|
||||
.borderRadius(0)
|
||||
@ -229,7 +229,7 @@ struct Index {
|
||||
.onChange((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 })
|
||||
.type(InputType.Normal)
|
||||
.borderRadius(0)
|
||||
|
||||
@ -45,7 +45,7 @@ export default struct FaceCompare {
|
||||
Column() {
|
||||
Column() {
|
||||
Text('照片比对')
|
||||
.lineHeight('16%')
|
||||
// .lineHeight('16%')
|
||||
.height('16%')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontSize(24)
|
||||
@ -78,11 +78,11 @@ export default struct FaceCompare {
|
||||
.height('100%')
|
||||
}
|
||||
.width('88.9%')
|
||||
.height('53.2%')
|
||||
.height('52%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Text('正在等待拍照…')
|
||||
.lineHeight('16%')
|
||||
// .lineHeight('16%')
|
||||
.height('16%')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor('#CC7E00')
|
||||
@ -178,7 +178,7 @@ export default struct FaceCompare {
|
||||
|
||||
async faceComparFn() {
|
||||
console.log('mmmmm0', 2)
|
||||
|
||||
this.param.pztd=this.param.rlls
|
||||
const data=await takePhoto(this.param, this.context, 'jt/', 1,)
|
||||
this.base64=this.imageBase64 + data.base64
|
||||
console.log('mmmmt',this.base64)
|
||||
@ -191,7 +191,6 @@ export default struct FaceCompare {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('mmmmm8', res)
|
||||
|
||||
if (res) {
|
||||
this.controller.stop()
|
||||
this.showFaceCompare = !this.showFaceCompare
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user