fix: 补全完善类型系统

This commit is contained in:
wangzhongjie 2025-06-30 17:15:33 +08:00
parent b92d31b661
commit 03d3f09d2a
7 changed files with 177 additions and 781 deletions

View File

@ -1,2 +1,2 @@
gitLog:
git log --since="2025-06-23 11:00" --until="2025-06-27 15:02" --pretty=format:"<details>%n <summary>%s</summary>%n <span style=\"color: #888;\">[提交人]:</span><span style=\"color: #333;\">%an</span><br>%n <span style=\"color: #888;\">[提交时间]:</span><span style=\"color: #333;\">%ad</span><br>%n <span style=\"color: #888;\">[提交版本]:</span><span style=\"color: #333;\">%h</span>%n</details>%n" --date=format:"%Y-%m-%d %H:%M" > release_note.md
git log --since="2025-06-27 15:02" --until="2025-06-30 17:14" --pretty=format:"<details>%n <summary>%s</summary>%n <span style=\"color: #888;\">[提交人]:</span><span style=\"color: #333;\">%an</span><br>%n <span style=\"color: #888;\">[提交时间]:</span><span style=\"color: #333;\">%ad</span><br>%n <span style=\"color: #888;\">[提交版本]:</span><span style=\"color: #333;\">%h</span>%n</details>%n" --date=format:"%Y-%m-%d %H:%M" > release_note.md

View File

@ -17,16 +17,16 @@ export interface OtherMessageType {
}
export interface WorkerBackMessage {
type: string;
type: WorkerBackMessageType;
data: string | CenterCallBackMsgType
}
// export enum WorkerBackMessageType {
// // 后置机信息
// ObtainUdpData = 'obtainUdpData',
// // 中心消息
// CenterUdpData = 'centerUdpData',
// }
export enum WorkerBackMessageType {
// 后置机信息
ObtainUdpData = 'obtainUdpData',
// 中心消息
CenterUdpData = 'centerUdpData',
}
export interface LogWorkerMessage {
type: WorkerMessageType;

View File

@ -1,437 +0,0 @@
import router from '@ohos.router';
import RealTime from '../compontents/judge/RealTime';
import { GPSData, SignalData } from '../../mock';
import { SignalDataType, WorkerBackMessage } from '../../model';
import { ObtainUdpBusinessInstance } from '../../utils/business/ObtainUdpBusiness';
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker';
@Component
export default struct SignDisplayCom {
@State showBack: boolean = false
@Prop showTrajectory: boolean = false
@State scaleNum: number = 1
@State msg: string = ''
@State signArr: Array<string> = []
@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
@State msgStr: string = ''
@State interval: number = 0
@State @Watch('outClick') outFlag: boolean = false;
@State url: string = ''
@State signalTimer: number = -1
constructor() {
super()
}
build() {
Column() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
Image($r('app.media.signal_logoS')).width(30 * this.ratio).height(24 * this.ratio)
Row() {
Text('PLC信号').fontColor(this.active == 0 ? '#FFAD33' : '#e7cba3').fontSize(20 * this.ratio)
}
.backgroundImage(this.active == 0 ? $r('app.media.signal_tabS') : $r('app.media.signal_tab'))
.width(144 * this.ratio)
.height(50 * this.ratio)
.backgroundImageSize({ width: '100%', height: '100%' })
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.active = 0
})
if (this.showTrajectory) {
Row() {
Text('实时轨迹').fontColor(this.active == 1 ? '#FFAD33' : '#e7cba3').fontSize(20 * this.ratio)
}
.backgroundImage(this.active == 1 ? $r('app.media.signal_tabS') : $r('app.media.signal_tab'))
.width(144 * this.ratio)
.height(50 * this.ratio)
.backgroundImageSize({ width: '100%', height: '100%' })
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.active = 1
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
})
}
Row() {
Text('原始数据').fontColor(this.active == 2 ? '#FFAD33' : '#e7cba3').fontSize(20 * this.ratio)
}
.backgroundImage(this.active == 2 ? $r('app.media.signal_tabS') : $r('app.media.signal_tab'))
.width(144 * this.ratio)
.height(50 * this.ratio)
.backgroundImageSize({ width: '100%', height: '100%' })
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.active = 2
})
}
Row() {
if (this.showBack) {
Image($r('app.media.topB_back')).height('12.2%')
.onClick(() => {
router.back()
// this.url='back'
// this.vocObj.playAudio({
// type: 1,
// name: 'media_button.wav'
// })
this.outFlag = true
})
}
}
}.width(936 * this.ratio)
Column() {
Flex({ direction: FlexDirection.Column }) {
Row() {
Text("发送次数:" + this.signArr[49] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
.textAlign(TextAlign.Start)
Text("固件版本:" + this.signArr[54] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('30%')
.textAlign(TextAlign.Start)
Text("GPS数据次数/数据长度:" + this.signArr[59] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
Row() {
Text("方向盘类型:" + this.signArr[50] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
.textAlign(TextAlign.Start)
Text("按键数值:" + this.signArr[55] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('30%')
.textAlign(TextAlign.Start)
Text("GPS错误次数" + this.signArr[60] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
Row() {
Text("汽车类型:" + this.signArr[51] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
.textAlign(TextAlign.Start)
Text("GPS板卡类型" + this.signArr[56] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('30%')
.textAlign(TextAlign.Start)
Text("已工作时长/设定的工作时长:" + this.signArr[61] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
Row() {
Text("接口心跳:" + this.signArr[52] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
.textAlign(TextAlign.Start)
Text("GPS板卡软件版本" + this.signArr[57] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('30%')
.textAlign(TextAlign.Start)
Text("改正数次数/改正数大小:" + this.signArr[58] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
Row() {
Text("本机IP" + '192.168.7.170')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.width('25%')
.textAlign(TextAlign.Start)
Text("改正数数据长度*数据长度-基准站RTCM改正数类型" + this.signArr[62] || '0')
.fontColor('#FFF5E5')
.fontSize(14 * this.ratio)
.textAlign(TextAlign.Start)
}.justifyContent(FlexAlign.Start).padding({ left: 10 * this.ratio }).margin({ top: 8 * this.ratio })
}
.backgroundColor('#282828')
.width(this.ratio * 890)
.height(136 * this.ratio)
.margin({ left: 0 * this.ratio, top: 15 * this.ratio })
Row() {
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap }) {
ForEach(this.sjxhColum, (item: SignalDataType) => {
Column() {
Text(`${item.key}:${item.value}`)
.fontSize(14 * this.ratio)
.lineHeight(25 * this.ratio)
.fontColor('#fff')
}.height(25 * this.ratio).justifyContent(FlexAlign.Start).width('16%')
})
}
Column() {
Text('GPS坐标:').fontColor('#FFFFFF').fontSize(14 * this.ratio).margin({ bottom: 10 * this.ratio })
Text('状态:' + this.signArr[83]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('收星数:' + this.signArr[84]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('维度因子:' + this.signArr[88])
.fontColor('#FFB433')
.fontSize(14 * this.ratio)
.height(18 * this.ratio)
Text('经度因子:' + this.signArr[89])
.fontColor('#FFB433')
.fontSize(14 * this.ratio)
.height(18 * this.ratio)
Text('航向角:' + this.signArr[90]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('俯仰角:' + this.signArr[91]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
Text('航向角状态-收星数:' + this.signArr[92])
.fontColor('#FFB433')
.fontSize(14 * this.ratio)
.height(18 * this.ratio)
Text('年月日:' + this.signArr[93]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio)
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('速度:' + ((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)
.height(300 * this.ratio)
.position({ y: 0 * this.ratio, x: 720 * this.ratio })
}.backgroundColor('#282828').width(this.ratio * 890).height(308 * this.ratio).margin({ top: 3 * 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 == 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() {
Flex({ direction: FlexDirection.Column }) {
Row() {
Row() {
Text('GPS').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff')
}
.width(316 / 2 * this.ratio)
.height(24 * this.ratio)
.backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A')
.margin({ left: 10 * this.ratio, right: 10 * this.ratio })
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.gpsActive = 0
})
}.margin({ top: 10 * this.ratio })
Flex({ direction: FlexDirection.Column }) {
ForEach(this.GPSColum, (item: SignalDataType) => {
Column() {
Text(`${item.key}:${item.value}`)
.fontSize(12 * this.ratio)
.lineHeight(20 * this.ratio)
.fontColor('#fff')
}.height(20 * this.ratio).justifyContent(FlexAlign.Start).width('100%')
})
}
}
.width(168 * this.ratio)
.height(380 * this.ratio)
.backgroundColor('#282828')
.margin({ top: 6 * this.ratio, left: 10 * this.ratio })
Row() {
RealTime({
widthNumber: Math.floor(550 * this.ratio),
heightNumber: Math.floor(380 * this.ratio),
})
}
.width(550 * this.ratio)
.height(380 * this.ratio)
.backgroundColor('#1A1A1A')
.margin({ top: 6 * this.ratio, })
}
.width(936 * this.ratio)
.height(420 * 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 == 1 ? Visibility.Visible : Visibility.None)
}
.width('100%')
.height('100%')
}
}
aboutToDisappear() {
clearInterval(this.interval)
}
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);
if (this.showBack) {
this.ratio = 1.4
DifferentialAndSignal.onMsg((data: string) => {
const result: WorkerBackMessage = JSON.parse(data)
if (result.type === "centerUdpData") {
this.getSignal(result.data as string)
}
})
} else {
clearInterval(this.signalTimer)
this.signalTimer = setInterval(() => {
const msgStr = AppStorage.get<string>('msgStr')
if (msgStr) {
this.getSignal(msgStr)
}
}, 200)
}
}
onPageShow() {
const getSignal = this.getSignal;
const showBack = this.showBack;
if (showBack) {
ObtainUdpBusinessInstance.onMsg((msg) => {
if (msg) {
getSignal(msg)
}
})
} else {
clearInterval(this.signalTimer)
this.signalTimer = setInterval(() => {
//TODO 临时方案
const msgStr = AppStorage.get<string>('msgStr') || ""
getSignal(msgStr)
}, 200)
}
}
getSignal = (msg: string) => {
const that = this;
that.msg = msg
const strachArr = msg.split(',')
if (strachArr[0] != '#DN_GD') {
return
}
this.signArr = strachArr
for (let i = 0; i <= 12; i++) {
this.sjxhColum[i].value = this.signArr[i+2]
}
this.sjxhColum[13].value = this.signArr[17]
this.sjxhColum[14].value = this.signArr[18]
this.sjxhColum[15].value = this.signArr[19]
this.sjxhColum[16].value = this.signArr[20]
this.sjxhColum[17].value = this.signArr[23] //车速
this.sjxhColum[18].value = this.signArr[28]
this.sjxhColum[19].value = this.signArr[29]
this.sjxhColum[20].value = this.signArr[30]
this.sjxhColum[21].value = this.signArr[15] //NC
this.sjxhColum[22].value = this.signArr[16] //SA15
this.sjxhColum[23].value = this.signArr[21]
this.sjxhColum[24].value = this.signArr[22]
this.sjxhColum[25].value = this.signArr[24]
this.sjxhColum[26].value = this.signArr[26]
this.sjxhColum[27].value = this.signArr[25]
this.sjxhColum[28].value = this.signArr[27]
this.sjxhColum[29].value = this.signArr[31]
this.sjxhColum[30].value = this.signArr[32]
this.sjxhColum[31].value = this.signArr[33]
this.sjxhColum[32].value = this.signArr[34]
this.sjxhColum[33].value = this.signArr[35]
for (let i = 34; i <= 46; i++) {
this.sjxhColum[i].value = this.signArr[i+2]
}
let t = 0
for (let i = 83; i <= 97; i++) {
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.GPSColum[10].value = this.signArr[93]
// 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)))
}
outClick() {
}
saveLog() {
}
}

View File

@ -1,5 +1,12 @@
import { GPSData, InitialPerLane, SignalData } from '../../mock'
import { EnvironmentConfigurationType, PerLane, RoadDataType, SignalDataType, WorkerBackMessage } from '../../model'
import {
EnvironmentConfigurationType,
PerLane,
RoadDataType,
SignalDataType,
WorkerBackMessage,
WorkerBackMessageType
} from '../../model'
import apiJudgeSdk from 'libJudgeSdk.so'
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
@ -26,7 +33,7 @@ export default struct SignalDisplayComponent {
DifferentialAndSignal.onMsg((data: string) => {
const result: WorkerBackMessage = JSON.parse(data)
dConsole.log("wzj", data)
if (result.type === "obtainUdpData") {
if (result.type === WorkerBackMessageType.ObtainUdpData) {
this.getSignal(result.data as string)
this.rawData = result.data as string
}

View File

@ -51,6 +51,7 @@ import {
TKmItem,
User,
WorkerBackMessage,
WorkerBackMessageType,
WR
} from '../../model';
import { DrivingDataStorage } from '../../utils/business/DrivingDataStorage';
@ -183,37 +184,6 @@ export default class Judge {
private isExamEnd: boolean
// 是否发送udp
private isUdpEnd: boolean = false
// 处理udp plc信号
handleUdp = async (msg: string) => {
const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
return
}
const plcData = await this.getPlcData(msg);
// 4.过程数据
await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
//检测到有无锡所设备接入,需要发送特定的数据,供检测
// if (this.usbService.isWXUSBDevice) {
// const str = await senorToWXDataStr(msg);
// this.usbService.sendUSB(str)
// }
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
//TODO 暂时关闭差分检测异常
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
if (!this.isExamEnd) {
await examJudgeRealExam(plcData)
}
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
// TODO UPD缺失
// const judgeUdp = globalThis.judgeUdp
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
// judgeUdp.send(bytes)
// }
// AppStorage.setOrCreate('udpIndex', udpIndex++)
}
//是否手动结束考试
private isManual: boolean = false
//UDP服务序列号
@ -260,60 +230,6 @@ export default class Judge {
dConsole.info(JudgeTag, '过程数据文件上传 end')
}
private judgeTask: JudgeTask
// 检测扣分、结束项目时该项目是否开始
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
if (xmdm == 20) {
return true
}
const judgeUI = this.judgeUI;
const judgeTask = this.judgeTask;
const projectsObj: object = this.judgeUI.projectsObj
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
const isUpload = currentProject.isUpload
//如果项目没有开始
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
if (!isUpload) {
dConsole.info(JudgeTag, '项目补传开始')
//项目开始补传
judgeTask.addTask(async () => {
await this.beginProject(xmdm)
}, {
isDelay: true
})
judgeTask.addTask(async () => {
await this.uploadProgressPhoto(xmdm)
}, {
isDelay: true
})
currentProject.isUpload = true;
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
//扣分补传
if (currentType == 2) {
judgeTask.addTask(async () => {
await this.pointsDedute(xmdm, kf!)
}, {
isDelay: true
})
}
//扣分补传判断是否合格 不合格补传项目结束
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
judgeTask.addTask(async () => {
await this.endProject(xmdm)
}, {
isDelay: true
})
currentProject.isEnd = true;
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
}
judgeTask.addTask(async () => {
this.checkExamIsEnd()
})
return false;
} else {
return true
}
}
private tempData?: PLCType
//实时计算gps经纬度距离
handDistance = async () => {
@ -477,6 +393,37 @@ export default class Judge {
AppStorage.setOrCreate('msgStr', plc)
return tempData
}
// 处理udp plc信号
handleUdp = async (msg: string) => {
const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
return
}
const plcData = await this.getPlcData(msg);
// 4.过程数据
await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
//检测到有无锡所设备接入,需要发送特定的数据,供检测
// if (this.usbService.isWXUSBDevice) {
// const str = await senorToWXDataStr(msg);
// this.usbService.sendUSB(str)
// }
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
//TODO 暂时关闭差分检测异常
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
if (!this.isExamEnd) {
await examJudgeRealExam(plcData)
}
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
// TODO UPD缺失
// const judgeUdp = globalThis.judgeUdp
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
// judgeUdp.send(bytes)
// }
// AppStorage.setOrCreate('udpIndex', udpIndex++)
}
// 处理轨迹plc信号
handleTrajectoryUdp = async (strArr: string[]) => {
let num = 2;
@ -514,9 +461,9 @@ export default class Judge {
}
//本地轨迹回放地址
private trajectoryPath: string
//当前科目二的考试项目
// private currentKm2ItemsObj: any
private isTrajectoryOpen: boolean;
//当前科目二的考试项目
// 调代理接口是否断网了
private isJudgeDisConnect: boolean = false;
// 断网数据补传
@ -531,33 +478,6 @@ export default class Judge {
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
}
}
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
private lane: LANE = {
road: '', num: 0, count: 0
}
private videoData?: RecordHandleType
private disConnectNum: number = 0;
//调用监管接口
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath, this.context);
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
//断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1;
if (this.disConnectNum < 5) {
return await this.sendWriteObjectOut(data, filePath)
}
}
if (this.disConnectNum >= 5) {
dConsole.info('surenjun', '123')
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
this.judgeUI.disConnectErrorOpen = true
}
this.disConnectNum = 0
return temp
}
// 项目开始接口同步
beginProject = async (ksxm: number) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo');
@ -661,6 +581,87 @@ export default class Judge {
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
dConsole.info(JudgeTag, '上传照片 end')
}
// 检测扣分、结束项目时该项目是否开始
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
if (xmdm == 20) {
return true
}
const judgeUI = this.judgeUI;
const judgeTask = this.judgeTask;
const projectsObj: object = this.judgeUI.projectsObj
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
const isUpload = currentProject.isUpload
//如果项目没有开始
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
if (!isUpload) {
dConsole.info(JudgeTag, '项目补传开始')
//项目开始补传
judgeTask.addTask(async () => {
await this.beginProject(xmdm)
}, {
isDelay: true
})
judgeTask.addTask(async () => {
await this.uploadProgressPhoto(xmdm)
}, {
isDelay: true
})
currentProject.isUpload = true;
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
//扣分补传
if (currentType == 2) {
judgeTask.addTask(async () => {
await this.pointsDedute(xmdm, kf!)
}, {
isDelay: true
})
}
//扣分补传判断是否合格 不合格补传项目结束
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
judgeTask.addTask(async () => {
await this.endProject(xmdm)
}, {
isDelay: true
})
currentProject.isEnd = true;
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
}
judgeTask.addTask(async () => {
this.checkExamIsEnd()
})
return false;
} else {
return true
}
}
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
private lane: LANE = {
road: '', num: 0, count: 0
}
private videoData?: RecordHandleType
private disConnectNum: number = 0;
//调用监管接口
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
const temp = await writeObjectOut(data, filePath, this.context);
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
//断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1;
if (this.disConnectNum < 5) {
return await this.sendWriteObjectOut(data, filePath)
}
}
if (this.disConnectNum >= 5) {
dConsole.info('surenjun', '123')
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
this.judgeUI.disConnectErrorOpen = true
}
this.disConnectNum = 0
return temp
}
constructor(judgeUI: JudgeUI) {
this.serialIndex = 1;
@ -1956,7 +1957,7 @@ export default class Judge {
DifferentialAndSignal.onMsg((data: string) => {
dConsole.info(JudgeTag, 'socketTag[PLC.UdpClient]', '收到udp回调数据')
const result: WorkerBackMessage = JSON.parse(data)
if (result.type === "obtainUdpData") {
if (result.type === WorkerBackMessageType.ObtainUdpData) {
handleUdp(result.data as string)
}
//TODO UDP修改

View File

@ -1,7 +1,7 @@
// 处理worker线程的消息tcp拿差分改正数,udp给后置机
import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker';
import { SerialPortTag, WorkerTag } from '../config';
import { CenterCallBackMsgType, WorkerBackMessage, WorkerMessage } from '../model';
import { CenterCallBackMsgType, WorkerBackMessage, WorkerBackMessageType, WorkerMessage } from '../model';
import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
import { DifferentialSignal } from '../utils/business/DifferentialSignal';
import { ObtainUdpBusinessInstance } from '../utils/business/ObtainUdpBusiness';
@ -73,7 +73,7 @@ function getDataFn() {
console.log(SerialPortTag, "处理完的档位信号", data)
workerPort.postMessage(
JSON.stringify({
type: "obtainUdpData",
type: WorkerBackMessageType.ObtainUdpData,
data: data
} as WorkerBackMessage))
}
@ -86,7 +86,7 @@ function getDataFn() {
// 收到中心指令发送出去
workerPort.postMessage(
JSON.stringify({
type: "centerUdpData",
type: WorkerBackMessageType.CenterUdpData,
data: data
} as WorkerBackMessage)
)

View File

@ -1,3 +1,45 @@
<details>
<summary>fix: 档位信号处理,信号显示界面无法进入问题解决</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-30 16:50</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">b92d31b</span>
</details>
<details>
<summary>fix: 档位信号处理</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-30 16:41</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">c717b16</span>
</details>
<details>
<summary>fix: 完善worker关闭性能优化,完善读取串口代码</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-30 09:55</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">078ec1a</span>
</details>
<details>
<summary>fix: 修改版本参数</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-30 09:10</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">fd2f75d</span>
</details>
<details>
<summary>fix: 解决页面有输入法会自动弹出自动聚焦影响体验问题</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-27 17:29</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">f1fc2f9</span>
</details>
<details>
<summary>fix: 完善版本发布</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-27 16:01</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">e34297a</span>
</details>
<details>
<summary>fix: 完善版本发布</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
@ -11,220 +53,3 @@
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-27 15:02</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">0809571</span>
</details>
<details>
<summary>fix: 优化界面</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-27 14:37</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">d7d1c68</span>
</details>
<details>
<summary>fix: 优化扣分bug</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-27 14:33</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">344f74d</span>
</details>
<details>
<summary>fix: 设置界面优化</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 18:10</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">bc74a62</span>
</details>
<details>
<summary>fix: 去掉一些东西</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 18:05</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">608ffca</span>
</details>
<details>
<summary>fix: 修改启动图</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 17:51</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">e1dcac0</span>
</details>
<details>
<summary>fix: 组件复用</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 17:33</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">628671d</span>
</details>
<details>
<summary>fix: 优化了信号取值问题,优化了评判内部弹窗</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 17:28</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">edf7e07</span>
</details>
<details>
<summary>fix: 解决评判一个问题</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 16:13</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">acd7aef</span>
</details>
<details>
<summary>fix: 解决评判一个问题</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 16:13</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">c3a27f6</span>
</details>
<details>
<summary>fix: 优化登陆,太快延迟一下,防止动画太难看</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 14:27</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">ffe0dfd</span>
</details>
<details>
<summary>fix: 优化考生列表</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 11:18</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">7c0f24d</span>
</details>
<details>
<summary>fix: 重构登陆页面</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 10:47</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">019b582</span>
</details>
<details>
<summary>fix: 重构登陆页面</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-26 10:28</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">0c0fc17</span>
</details>
<details>
<summary>fix: 日志小优化</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 14:50</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">cb302cf</span>
</details>
<details>
<summary>fix: 优化打印结构</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 14:27</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">cd28204</span>
</details>
<details>
<summary>fix: dConsole.log问题</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 14:10</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">80c715d</span>
</details>
<details>
<summary>fix: 优化数据库方面操作打印信息</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 13:48</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">9da3b0f</span>
</details>
<details>
<summary>fix: 优化初始化数据库操作</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 13:42</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">014c21a</span>
</details>
<details>
<summary>fix: 补充初始化代码</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 13:38</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">637e412</span>
</details>
<details>
<summary>fix: 授权代码优化</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 10:59</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">84bf418</span>
</details>
<details>
<summary>fix: 解决授权依次授权的问题</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 10:35</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">3f6137f</span>
</details>
<details>
<summary>fix: 优化一些工具函数</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-25 10:03</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">b4cd064</span>
</details>
<details>
<summary>fix: 规范性优化</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-24 10:58</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">30e0d96</span>
</details>
<details>
<summary>fix: 公司环境</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-24 10:03</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">cae695e</span>
</details>
<details>
<summary>fix: 日志打印替换</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 17:24</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">768b542</span>
</details>
<details>
<summary>fix: 日志修改</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 17:08</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">0608d66</span>
</details>
<details>
<summary>fix: 日志系统</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 16:44</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">4226dbf</span>
</details>
<details>
<summary>fix: 日志系统</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 15:31</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">47fb785</span>
</details>
<details>
<summary>fix: 评判日志</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 13:50</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">a7bd343</span>
</details>
<details>
<summary>fix: 完善Date工具函数 对毫秒的支持,以及完善judge工具函数的完善</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 11:14</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">d21cd89</span>
</details>
<details>
<summary>fix: 完善Date工具函数 对毫秒的支持,以及完善judge工具函数的完善</summary>
<span style="color: #888;">[提交人]:</span><span style="color: #333;">wangzhongjie</span><br>
<span style="color: #888;">[提交时间]:</span><span style="color: #333;">2025-06-23 11:13</span><br>
<span style="color: #888;">[提交版本]:</span><span style="color: #333;">11e738b</span>
</details>