This commit is contained in:
lvyuankang 2024-12-20 13:28:03 +08:00
parent 30063c3d6a
commit 8e2b093a67
7 changed files with 59 additions and 38 deletions

View File

@ -17,9 +17,11 @@ export async function getTCP() {
// const tcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort)
// globalThis.TcpClient = tcpClient
setTimeout(async () => {
await globalThis.TcpClient.rebindTcp(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort)
const tcpClient: TcpClient = new TcpClient(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort)
globalThis.TcpClient = tcpClient
await globalThis.TcpClient.bindTcp()
// await globalThis.TcpClient.rebindTcp(result.tcplocalIp, result.tcplocalIpPort, result.tcpOppositeIp, result.tcpOppositePort)
await globalThis.TcpClient.connectTcp()
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
globalThis.TcpClient.onError((val) => {
setTimeout(() => {
getTCP()
@ -27,7 +29,6 @@ export async function getTCP() {
})
await globalThis.TcpClient.onMessage((val) => {
setTimeout(() => {
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
if (val) {
// const msg=val.substring(5,val.length-1)
console.log('socketTag[PLC.UdpClient] status:', globalThis.udpClient.getStatus())
@ -46,6 +47,12 @@ export async function getTCP() {
await globalThis.TcpClient.bindTcp()
await globalThis.TcpClient.connectTcp()
await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
clearInterval(globalThis.intervalSendmsg)
globalThis.intervalSendmsg=setInterval(()=>{
if(!globalThis.getCloseTcp){
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
}
},1000/3)
globalThis.TcpClient.onError((val) => {
setTimeout(() => {
getTCP()
@ -54,7 +61,6 @@ export async function getTCP() {
await globalThis.TcpClient.onMessage((val) => {
hilog.info(0x0000, 'testTag', "valvalval2" + JSON.stringify(val));
setTimeout(() => {
globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002
if (val && globalThis.udpClient?.sendMsg) {
globalThis.udpClient?.sendMsg(val)
}

View File

@ -62,7 +62,7 @@ export default class TcpClient {
time:dateFormat(new Date()),
message: `${TAG} tcprebind tcpreBinderror${JSON.stringify(err)}`,
})
globalThis.getCloseTcp = true
// globalThis.getCloseTcp = true
hilog.info(0x0000, 'testTag', "tcpreBinderror:" + JSON.stringify(err));
resolve(true)
}
@ -71,7 +71,7 @@ export default class TcpClient {
message: `${TAG} tcprebind success`,
})
console.log('testTag,rebindtestTag tcp bind success');
globalThis.getCloseTcp = false
// globalThis.getCloseTcp = false
resolve(false)
})
@ -105,12 +105,12 @@ export default class TcpClient {
message: `${TAG} tcpbind error ${JSON.stringify(err)}`,
})
console.log('testTag tcp bind faile');
globalThis.getCloseTcp = true
// globalThis.getCloseTcp = true
hilog.info(0x0000, 'testTag', "tcpBinderror:" + JSON.stringify(err));
resolve(true)
return
}
globalThis.getCloseTcp = false
// globalThis.getCloseTcp = false
console.log('testTag tcp bind success');
// this.writeLog({
// time:dateFormat(new Date()),
@ -171,7 +171,6 @@ export default class TcpClient {
}
});
console.log('socketTag','success')
globalThis.getCloseTcp = false
resolve(true)
}).catch(err => {
@ -180,7 +179,7 @@ export default class TcpClient {
time:dateFormat(new Date()),
message: `${TAG} TCPconnect error2 ${JSON.stringify(err)}`,
})
globalThis.getCloseTcp = true
// globalThis.getCloseTcp = true
this.num++
if(this.num>3){
return
@ -244,7 +243,7 @@ export default class TcpClient {
//程序断开
if (globalThis.tcpUdpError) {
console.log(TAG,'tcp信号丢失')
getTCP()
// getTCP()
prompt.showToast({
message: 'tcp信号丢失',
duration: 2000

View File

@ -30,8 +30,8 @@ export default class EntryAbility extends UIAbility {
globalThis.deviceNo = '';
globalThis.hasAuth = false
globalThis.version = GlobalConfig.version.sz.km2[0];
globalThis.judgeVersion = GlobalConfig.version.sz.km2[1];
globalThis.version = GlobalConfig.version.jn.km3[0];
globalThis.judgeVersion = GlobalConfig.version.jn.km3[1];
globalThis.videoVersion= '1.0'

View File

@ -32,7 +32,8 @@ struct UserInfo {
@State pageIndex: number = 0
@State ratio: number = 1700 / 960
@State index: number = 0
@State stepFlag: boolean = false;
@State stepFlag:
boolean = false;
@State errorMsg: string = ''
@State ksxtbh: string = ''
@State pic: string = ''
@ -180,8 +181,7 @@ struct UserInfo {
if (this.dataList.length) {
setTimeout(()=>{
this.currentUser = this.dataList[0]
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
globalThis.lsh=this.currentUser.lsh
},200)
} else {
@ -253,7 +253,7 @@ struct UserInfo {
if (res.sfzmhm == id) {
flag = true
this.currentUser = res
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
this.lsh = this.currentUser.lsh
globalThis.lsh = this.currentUser.lsh
@ -284,7 +284,7 @@ struct UserInfo {
await upDateTableByArray('USER', [])
setTimeout(()=>{
this.currentUser = this.list[0]
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
globalThis.lsh = this.currentUser.lsh
},200)
@ -370,7 +370,7 @@ struct UserInfo {
this.pageIndex = 0
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
this.currentUser = this.dataList[0]
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
this.lsh = this.currentUser.lsh
globalThis.ksyh = this.currentUser.ksy1sfzmhm
@ -487,6 +487,7 @@ struct UserInfo {
if(!Number(this.systemParam.Param305Str)){
that.systemParam.Param305Str='2'
}
console.log('Param305Str',that.systemParam.Param305Str)
// delHilog(this.Param305Str)
getUserAlbumItemByDisplayName('', that.systemParam.Param305Str,1)
getUserAlbumItemByDisplayName('',that.systemParam.Param305Str,2)
@ -602,9 +603,11 @@ struct UserInfo {
listData[i] = decodeURI(listData[i])
}
if(this.systemParam.Param828Str=='1'||this.systemParam.Param828Str=='2'){
listData.ksy2=listData.ksy1;
// listData.ksy2=listData.ksy1;
listData.ksy2=globalThis.kgxm
}else{
listData.ksy2=listData.ksy2;
// listData.ksy2=listData.ksy2;
listData.ksy2=globalThis.kgxm
}
listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp
@ -616,7 +619,7 @@ struct UserInfo {
if (this.dataList.length) {
setTimeout(()=>{
this.currentUser = this.dataList[0]
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
globalThis.lsh=this.currentUser.lsh
},200)
// this.currentUser = this.dataList[0]
@ -896,7 +899,7 @@ struct UserInfo {
//接口标识
jkid: '17C51',
}
console.info('surenjun', JSON.stringify(param))
console.info('surenjunjianguan', JSON.stringify(param))
const temp = await writeObjectOut(param);
globalThis.lsh = this.currentUser.lsh
globalThis.ksyh = this.currentUser.ksy1sfzmhm
@ -1022,7 +1025,7 @@ struct UserInfo {
globalThis.lsh = item.lsh;
setTimeout(()=>{
this.currentUser = item
this.currentUser.ksy2= globalThis.ksyxm
this.currentUser.ksy2= globalThis.kgxm
},200)

View File

@ -4,7 +4,8 @@ import FileLog from '../judgeSDK/utils/fileLog';
import RealTime from '../compontents/judge/RealTime';
import { GPSData, SignalData } from '../../mock';
import { SignalDataType } from '../../model';
import FileUtil from '../../common/utils/File'
import { GlobalConfig } from '../../config/index'
@Component
export default struct SignDisplayCom {
@State showBack: boolean = false
@ -13,6 +14,7 @@ export default struct SignDisplayCom {
@State signArr: Array<any> = []
@State sjxhColum: Array<SignalDataType> = SignalData
@State GPSColum: Array<SignalDataType> = GPSData
@State udplocalIp: string = ''
@State ratio: number = 850 / 960
@State gpsActive: number = 1
@Prop active: number = 0
@ -166,7 +168,7 @@ export default struct SignDisplayCom {
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
Row() {
Text("本机IP" + this.signArr[53] || '0')
Text("本机IP" + '192.168.7.170')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
@ -219,7 +221,7 @@ export default struct SignDisplayCom {
Text('时分秒:' + this.signArr[94]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('经度:' + this.signArr[95]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('速度:' + this.signArr[97]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('速度:' +((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString()).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
}
.backgroundColor('#1A1A1A')
.width(170 * this.ratio)
@ -319,7 +321,10 @@ export default struct SignDisplayCom {
clearInterval(this.interval)
}
aboutToAppear() {
async aboutToAppear() {
// const fileUtil = new FileUtil(globalThis.context)
// const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt')
// this.udplocalIp=JSON.parse(data)?.udplocalIp||'192.168.7.170'
this.ratio = this.ratio * (this.scaleNum || 1);
const that = this
const {showBack,getSignal} = this
@ -369,7 +374,6 @@ export default struct SignDisplayCom {
}
getSignal = (msg) => {
console.log('msgmsgmsg', msg)
const that = this;
that.msg = msg
const strachArr = msg.split(',')
@ -411,6 +415,12 @@ export default struct SignDisplayCom {
this.GPSColum[t].value = this.signArr[i]
t++
}
this.GPSColum[14].value = ((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString()
const str0=this.signArr[93].substr(0,2)
const str1=this.signArr[93].substr(2,2)
const str2=this.signArr[93].substr(4.2)
this.signArr[93]=str2+str1+str0
// this.signArr[53]=192.168.7.170'
this.sjxhColum = JSON.parse(JSON.stringify((this.sjxhColum)))
that.signArr = JSON.parse(JSON.stringify((this.signArr)))
that.GPSColum = JSON.parse(JSON.stringify((this.GPSColum)))

View File

@ -12,7 +12,7 @@ export default struct DeductedPopup {
super()
}
@State fontSize:number = 24
@State fontSize:number = 30
@State unselected:SEL = {fontColor:'#000000', bgColor:'#CCC4B8'}
@State selected:SEL = {fontColor:'#FFAD33', bgColor:'#26231E'}
@ -90,7 +90,7 @@ export default struct DeductedPopup {
Row(){
Text(text).fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor).fontSize(this.fontSize).fontWeight(500)
}
.width(120).height(60)
.width(140).height(60)
.backgroundColor(index === this.currentIndex ? this.selected.bgColor: this.unselected.bgColor ).justifyContent(FlexAlign.Center).justifyContent(FlexAlign.Center)
.borderRadius({topLeft:20,topRight:20}).margin({right:10})
.onClick(()=>{
@ -113,7 +113,7 @@ export default struct DeductedPopup {
Row(){
Image($rawfile(`judge/km3/zuo_nor.png`)).height(15).margin({left:20,top:0})
Text('上一页'){}.fontColor('#FFF').fontSize(this.fontSize)
}.width(140).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:15})
}.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30})
.onClick(()=>{this.goPage(0)})
}
@ -123,7 +123,7 @@ export default struct DeductedPopup {
Row(){
Text('下一页'){}.fontColor('#FFF').fontSize(this.fontSize).padding({left:30})
Image($rawfile(`judge/km3/you_nor.png`)).height(15).margin({right:6,top:0})
}.width(140).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:15})
}.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30})
.onClick(()=>{this.goPage(1)})
}
@ -138,12 +138,14 @@ export default struct DeductedPopup {
Column(){
ForEach(this.getCurrentMarkRuleList(),(item,index) => {
Row(){
Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(500)
Row(){
Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(500)
Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(600)
}.width(1000)
Row(){
Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(600)
}
}
.width('100%').height(70).justifyContent(FlexAlign.SpaceBetween).alignItems(VerticalAlign.Center)
.width('100%').justifyContent(FlexAlign.SpaceBetween).alignItems(VerticalAlign.Center).constraintSize({minHeight:70})
.padding({left:20,right:20})
.backgroundColor(this.getSelectedLine(index))
.onClick(()=>{this.selectedLine = index})

View File

@ -2,13 +2,14 @@
//考试回放开关
export const judgeConfig = {
//本地目录开关
isTrajectoryOpen: true,
isTrajectoryOpen: false,
//是否开启拍照
isPhotoOpen: false,
isPhotoOpen: true,
//扣分语音是否强制开启
kfVoiceOpen: false,
//忽略的考试项目
ignoreProjects:[],
// 是否忽略考试前熄火、车门检查
isCheckFireOpen: true,
//轨迹回放是否开启Udp