Compare commits
	
		
			6 Commits
		
	
	
		
			78436c39f7
			...
			33bb420725
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 33bb420725 | ||
|  | 95a6ddec29 | ||
|  | e22def4691 | ||
|  | b6f5993e06 | ||
|  | 6584d8e2cb | ||
|  | 94d7ba9194 | 
| @ -498,6 +498,7 @@ export interface JudgeUI { | |||||||
|   dw: string |   dw: string | ||||||
|   endExamDialogController: CustomDialogController |   endExamDialogController: CustomDialogController | ||||||
|   generateExamRecordsDialogController: CustomDialogController |   generateExamRecordsDialogController: CustomDialogController | ||||||
|  |   laneSignal:PerLane, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -207,9 +207,7 @@ struct Index { | |||||||
|       DifferentialAndSignal.init() |       DifferentialAndSignal.init() | ||||||
|       this.initWork = true |       this.initWork = true | ||||||
|     } |     } | ||||||
|     DifferentialAndSignal.onMsg(() => { | 
 | ||||||
|       // dConsole.log("外层接受") |  | ||||||
|     }) |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|  | |||||||
| @ -38,14 +38,15 @@ import { | |||||||
|   SyssetConfig, |   SyssetConfig, | ||||||
|   SYSTEMPARMARR, |   SYSTEMPARMARR, | ||||||
|   User, |   User, | ||||||
|   ProcessDataEnumType |   ProcessDataEnumType, | ||||||
|  |   PerLane | ||||||
| } from '../model'; | } from '../model'; | ||||||
| import { GetSyncData } from '../utils/table/Operation'; | import { GetSyncData } from '../utils/table/Operation'; | ||||||
| import dayTs from '../utils/Date'; | import dayTs from '../utils/Date'; | ||||||
| import { GetCurrentTime } from '../utils/Common'; | import { GetCurrentTime } from '../utils/Common'; | ||||||
| import FileUtils from '../utils/FileUtils'; | import FileUtils from '../utils/FileUtils'; | ||||||
| import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog'; | import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog'; | ||||||
| import { DefaultJudgeConfigData, ProcessDataMock } from '../mock'; | import { DefaultJudgeConfigData, InitialPerLane, ProcessDataMock } from '../mock'; | ||||||
| import { dConsole } from '../utils/LogWorker'; | import { dConsole } from '../utils/LogWorker'; | ||||||
| import ConfirmDialog from './compontents/ConfirmDialog'; | import ConfirmDialog from './compontents/ConfirmDialog'; | ||||||
| import CarLoadingDialog from './compontents/CarLoading'; | import CarLoadingDialog from './compontents/CarLoading'; | ||||||
| @ -146,10 +147,18 @@ struct JudgePage { | |||||||
|   @State carInfo: CarInfoType = {} |   @State carInfo: CarInfoType = {} | ||||||
|   @State isErrorMsgEnd: boolean = false |   @State isErrorMsgEnd: boolean = false | ||||||
|   @State disConnectErrorOpen: boolean = false |   @State disConnectErrorOpen: boolean = false | ||||||
|  |   @State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane | ||||||
|  | 
 | ||||||
|  |   laneSignalChange() { | ||||||
|  |     dConsole.log("车道信号变化1", this.laneSignal) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   public context = getContext(this) as common.UIAbilityContext; |   public context = getContext(this) as common.UIAbilityContext; | ||||||
|   // 信号查看弹窗 |   // 信号查看弹窗 | ||||||
|   signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({ |   signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({ | ||||||
|     builder: SignalTrajectoryDialog(), |     builder: SignalTrajectoryDialog({ | ||||||
|  |       laneSignal: this.laneSignal | ||||||
|  |     }), | ||||||
|     customStyle: true, |     customStyle: true, | ||||||
|     autoCancel: true |     autoCancel: true | ||||||
|   }) |   }) | ||||||
| @ -167,8 +176,7 @@ struct JudgePage { | |||||||
|       text: "确认结束考试?", |       text: "确认结束考试?", | ||||||
|       onConfirm: async () => { |       onConfirm: async () => { | ||||||
|         if (this.isErrorMsgEnd) { |         if (this.isErrorMsgEnd) { | ||||||
|           dConsole.log(JudgeTag, "结束考试") |           dConsole.log(JudgeTag, "router back1") | ||||||
|           this.judge.closeAllFiles() |  | ||||||
|           router.back() |           router.back() | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
| @ -187,7 +195,7 @@ struct JudgePage { | |||||||
|         try { |         try { | ||||||
|           this.judge.checkExamIsEnd(true); |           this.judge.checkExamIsEnd(true); | ||||||
|         } catch (e) { |         } catch (e) { | ||||||
|           this.judge.closeAllFiles() |           dConsole.log(JudgeTag, "router back2") | ||||||
|           router.back() |           router.back() | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
| @ -505,6 +513,7 @@ struct JudgePage { | |||||||
|         message: '读取数据库信息失败,请重新联网更新!', |         message: '读取数据库信息失败,请重新联网更新!', | ||||||
|         duration: 8000 |         duration: 8000 | ||||||
|       }); |       }); | ||||||
|  |       dConsole.log(JudgeTag, "router back3") | ||||||
|       router.back(); |       router.back(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -687,9 +696,13 @@ struct JudgePage { | |||||||
|     Column() { |     Column() { | ||||||
|       // 顶部 |       // 顶部 | ||||||
|       HeaderComponent({ |       HeaderComponent({ | ||||||
|         logoExpansionBuilder: this.logoExpansionBuilder, |         logoExpansionBuilder: () => { | ||||||
|  |           this.logoExpansionBuilder() | ||||||
|  |         }, | ||||||
|         customizeReturnArea: true, |         customizeReturnArea: true, | ||||||
|         backAreaBuilder: this.backAreaBuilder |         backAreaBuilder: () => { | ||||||
|  |           this.backAreaBuilder() | ||||||
|  |         } | ||||||
|       }) |       }) | ||||||
|       Row() { |       Row() { | ||||||
|         Row() { |         Row() { | ||||||
|  | |||||||
| @ -1,9 +1,14 @@ | |||||||
|  | import { PerLane } from '../../model' | ||||||
|  | import { dConsole } from '../../utils/LogWorker' | ||||||
| import SignalDisplayComponent from '../compontents/SignalDisplay' | import SignalDisplayComponent from '../compontents/SignalDisplay' | ||||||
| import TabComponent from '../compontents/Tab' | import TabComponent from '../compontents/Tab' | ||||||
| 
 | 
 | ||||||
| @CustomDialog | @CustomDialog | ||||||
| export default struct SignalTrajectoryDialog { | export default struct SignalTrajectoryDialog { | ||||||
|   @State active: number = 0 |   @State active: number = 0 | ||||||
|  |   @Link  laneSignal: PerLane | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|   private controller?: CustomDialogController |   private controller?: CustomDialogController | ||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
| @ -32,7 +37,8 @@ export default struct SignalTrajectoryDialog { | |||||||
|       Scroll() { |       Scroll() { | ||||||
|         Column() { |         Column() { | ||||||
|           SignalDisplayComponent({ |           SignalDisplayComponent({ | ||||||
|             active: this.active |             active: this.active, | ||||||
|  |             laneSignal: this.laneSignal | ||||||
|           }) |           }) | ||||||
|         }.height(890) |         }.height(890) | ||||||
|       }.width("100%") |       }.width("100%") | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| import SignalDisplayComponent from './compontents/SignalDisplay'; | import SignalDisplayComponent from './compontents/SignalDisplay'; | ||||||
| import router from '@ohos.router'; | import router from '@ohos.router'; | ||||||
| import TabComponent from './compontents/Tab'; | import TabComponent from './compontents/Tab'; | ||||||
|  | import { InitialPerLane } from '../mock'; | ||||||
| 
 | 
 | ||||||
| @Entry | @Entry | ||||||
| @Component | @Component | ||||||
| @ -41,7 +42,8 @@ struct SignDisplayPage { | |||||||
|       }.width("100%").height(100) |       }.width("100%").height(100) | ||||||
| 
 | 
 | ||||||
|       SignalDisplayComponent({ |       SignalDisplayComponent({ | ||||||
|         active: this.active |         active: this.active, | ||||||
|  |         laneSignal: InitialPerLane | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|     .width('100%') |     .width('100%') | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ struct TerminalInfoPage { | |||||||
|   @State config: EnvironmentConfigurationType = {} |   @State config: EnvironmentConfigurationType = {} | ||||||
|   private fileUtil!: FileUtils |   private fileUtil!: FileUtils | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|  |   @State isProcessing: boolean = false; | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     this.fileUtil = new FileUtils(this.context) |     this.fileUtil = new FileUtils(this.context) | ||||||
| @ -39,172 +40,199 @@ struct TerminalInfoPage { | |||||||
|       Column() { |       Column() { | ||||||
|         Column() { |         Column() { | ||||||
|           Button().opacity(1).width(0).height(0) |           Button().opacity(1).width(0).height(0) | ||||||
|           Flex({ |           Scroll() { | ||||||
|             wrap: FlexWrap.Wrap, |             Flex({ | ||||||
|           }) { |               wrap: FlexWrap.Wrap, | ||||||
|             if (this.config.isOpenFiniteDifference === "1") { |             }) { | ||||||
|  |               if (this.config.isOpenFiniteDifference === "1") { | ||||||
|  |                 blockComponent({ | ||||||
|  |                   value: this.config.tcpOppositeIp, | ||||||
|  |                   change: (value: string) => { | ||||||
|  |                     this.config.tcpOppositeIp = value; | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|  |                 blockComponent({ | ||||||
|  |                   label: "差分响应端口", | ||||||
|  |                   value: this.config.tcpOppositePort, | ||||||
|  |                   change: (value: string) => { | ||||||
|  |                     this.config.tcpOppositePort = value; | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|  |               } | ||||||
|               blockComponent({ |               blockComponent({ | ||||||
|                 value: this.config.tcpOppositeIp, |                 label: "中心服务器IP", | ||||||
|  |                 value: this.config.centerIp, | ||||||
|                 change: (value: string) => { |                 change: (value: string) => { | ||||||
|                   this.config.tcpOppositeIp = value; |                   this.config.centerIp = value; | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|               blockComponent({ |               blockComponent({ | ||||||
|                 label: "差分响应端口", |                 label: "中心响应端口", | ||||||
|                 value: this.config.tcpOppositePort, |                 value: this.config.centerPort, | ||||||
|                 change: (value: string) => { |                 change: (value: string) => { | ||||||
|                   this.config.tcpOppositePort = value; |                   this.config.centerPort = value; | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|             } |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "中心服务器IP", |  | ||||||
|               value: this.config.centerIp, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.centerIp = value; |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "中心响应端口", |  | ||||||
|               value: this.config.centerPort, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.centerPort = value; |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "后置机IP", |  | ||||||
|               value: this.config.udpOppositeIp, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.udpOppositeIp = value; |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "后置机响应端口", |  | ||||||
|               value: this.config.udpOppositeIpPort, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.udpOppositeIpPort = value; |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             if (this.config.carType === "4") { |  | ||||||
|               blockComponent({ |               blockComponent({ | ||||||
|                 label: "后置机响应端口2", |                 label: "后置机IP", | ||||||
|                 value: this.config.udpOppositeIpPortTwo, |                 value: this.config.udpOppositeIp, | ||||||
|                 change: (value: string) => { |                 change: (value: string) => { | ||||||
|                   this.config.udpOppositeIpPortTwo = value; |                   this.config.udpOppositeIp = value; | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|             } |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "前置机IP", |  | ||||||
|               value: this.config.udplocalIp, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.udplocalIp = value; |  | ||||||
|                 this.config.tcplocalIp = value |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             blockComponent({ |  | ||||||
|               label: "后置机UDP本地端口", |  | ||||||
|               value: this.config.udplocalIpPort, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.udplocalIpPort = value; |  | ||||||
|               } |  | ||||||
|             }) |  | ||||||
|             if (this.config.carType === "4") { |  | ||||||
|               blockComponent({ |               blockComponent({ | ||||||
|                 label: "后置机UDP本地端口2", |                 label: "后置机响应端口", | ||||||
|                 value: this.config.udplocalIpPortTwo, |                 value: this.config.udpOppositeIpPort, | ||||||
|                 change: (value: string) => { |                 change: (value: string) => { | ||||||
|                   this.config.udplocalIpPortTwo = value; |                   this.config.udpOppositeIpPort = value; | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|             } |               if (this.config.carType === "4") { | ||||||
|             // blockComponent({ |                 blockComponent({ | ||||||
|             //   label: "TCP本地端口", |                   label: "后置机响应端口2", | ||||||
|             //   value: this.config.tcplocalIpPort, |                   value: this.config.udpOppositeIpPortTwo, | ||||||
|             //   change: (value: string) => { |                   change: (value: string) => { | ||||||
|             //     this.config.tcplocalIpPort = value; |                     this.config.udpOppositeIpPortTwo = value; | ||||||
|             //   } |                   } | ||||||
|             // }) |                 }) | ||||||
|             blockComponent({ |  | ||||||
|               label: "子网掩码", |  | ||||||
|               value: this.config.netMask, |  | ||||||
|               change: (value: string) => { |  | ||||||
|                 this.config.netMask = value; |  | ||||||
|               } |               } | ||||||
|             }) |               blockComponent({ | ||||||
|             blockComponent({ |                 label: "前置机IP", | ||||||
|               label: "默认网关", |                 value: this.config.udplocalIp, | ||||||
|               value: this.config.gateway, |                 change: (value: string) => { | ||||||
|               change: (value: string) => { |                   this.config.udplocalIp = value; | ||||||
|                 this.config.gateway = value; |                   this.config.tcplocalIp = value | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "后置机UDP本地端口", | ||||||
|  |                 value: this.config.udplocalIpPort, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.udplocalIpPort = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               if (this.config.carType === "4") { | ||||||
|  |                 blockComponent({ | ||||||
|  |                   label: "后置机UDP本地端口2", | ||||||
|  |                   value: this.config.udplocalIpPortTwo, | ||||||
|  |                   change: (value: string) => { | ||||||
|  |                     this.config.udplocalIpPortTwo = value; | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|               } |               } | ||||||
|             }) |               // blockComponent({ | ||||||
|             blockComponent({ |               //   label: "TCP本地端口", | ||||||
|               label: "DNS", |               //   value: this.config.tcplocalIpPort, | ||||||
|               value: this.config.dnsServers, |               //   change: (value: string) => { | ||||||
|               change: (value: string) => { |               //     this.config.tcplocalIpPort = value; | ||||||
|                 this.config.dnsServers = value; |               //   } | ||||||
|               } |               // }) | ||||||
|             }) |               blockComponent({ | ||||||
|             blockComponent({ |                 label: "子网掩码", | ||||||
|               label: "车型", |                 value: this.config.netMask, | ||||||
|               type: 4, |                 change: (value: string) => { | ||||||
|               value: this.config.carType, |                   this.config.netMask = value; | ||||||
|               change: (value: string) => { |                 } | ||||||
|                 this.config.carType = value; |               }) | ||||||
|               } |               blockComponent({ | ||||||
|             }) |                 label: "默认网关", | ||||||
|             blockComponent({ |                 value: this.config.gateway, | ||||||
|               label: "后置机类型", |                 change: (value: string) => { | ||||||
|               type: 1, |                   this.config.gateway = value; | ||||||
|               value: this.config.rearMachineModel, |                 } | ||||||
|               change: (value: string) => { |               }) | ||||||
|                 this.config.rearMachineModel = value; |               blockComponent({ | ||||||
|               } |                 label: "DNS", | ||||||
|             }) |                 value: this.config.dnsServers, | ||||||
|             blockComponent({ |                 change: (value: string) => { | ||||||
|               label: "是否开启差分", |                   this.config.dnsServers = value; | ||||||
|               type: 5, |                 } | ||||||
|               value: this.config.isOpenFiniteDifference, |               }) | ||||||
|               change: (value: string) => { |               blockComponent({ | ||||||
|                 this.config.isOpenFiniteDifference = value; |                 label: "外壳版本", | ||||||
|               } |                 value: this.config.version, | ||||||
|             }) |                 change: (value: string) => { | ||||||
|             blockComponent({ |                   this.config.version = value; | ||||||
|               label: "是否开启日志", |                 } | ||||||
|               type: 2, |               }) | ||||||
|               value: this.config.isOpenLog, |               blockComponent({ | ||||||
|               change: (value: string) => { |                 label: "评判版本", | ||||||
|                 this.config.isOpenLog = value; |                 value: this.config.judgeVersion, | ||||||
|               } |                 change: (value: string) => { | ||||||
|             }) |                   this.config.judgeVersion = value; | ||||||
|             blockComponent({ |                 } | ||||||
|               label: "板卡类型", |               }) | ||||||
|               type: 3, |               blockComponent({ | ||||||
|               value: this.config.boardType, |                 label: "车型", | ||||||
|               change: (value: string) => { |                 type: 4, | ||||||
|                 this.config.boardType = value; |                 value: this.config.carType, | ||||||
|               } |                 change: (value: string) => { | ||||||
|             }) |                   this.config.carType = value; | ||||||
|             blockComponent({ |                 } | ||||||
|               label: "是否开启调试", |               }) | ||||||
|               type: 6, |               blockComponent({ | ||||||
|               value: this.config.isOpenDebugger, |                 label: "后置机类型", | ||||||
|               change: (value: string) => { |                 type: 1, | ||||||
|                 this.config.isOpenDebugger = value; |                 value: this.config.rearMachineModel, | ||||||
|               } |                 change: (value: string) => { | ||||||
|             }) |                   this.config.rearMachineModel = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "是否开启差分", | ||||||
|  |                 type: 5, | ||||||
|  |                 value: this.config.isOpenFiniteDifference, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.isOpenFiniteDifference = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "是否开启日志", | ||||||
|  |                 type: 2, | ||||||
|  |                 value: this.config.isOpenLog, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.isOpenLog = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "板卡类型", | ||||||
|  |                 type: 3, | ||||||
|  |                 value: this.config.boardType, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.boardType = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |               blockComponent({ | ||||||
|  |                 label: "开启调试(重启APP)", | ||||||
|  |                 type: 6, | ||||||
|  |                 value: this.config.isOpenDebugger, | ||||||
|  |                 change: (value: string) => { | ||||||
|  |                   this.config.isOpenDebugger = value; | ||||||
|  |                 } | ||||||
|  |               }) | ||||||
|  |             }.margin(20) | ||||||
|  | 
 | ||||||
|           } |           } | ||||||
|           .backgroundColor("#282828") |  | ||||||
|           .height(650) |           .height(650) | ||||||
|  |           .width("100%") | ||||||
|  |           .backgroundColor("#282828") | ||||||
|           .borderRadius(20) |           .borderRadius(20) | ||||||
|           .margin(20) |           .margin(20) | ||||||
|           .padding({ |           .padding({ | ||||||
|             top: 10 |             top: 10 | ||||||
|           }) |           }) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|           Row() { |           Row() { | ||||||
|             Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => { |             Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => { | ||||||
|  |               if (this.isProcessing) { | ||||||
|  |                 Prompt.showToast({ | ||||||
|  |                   message: "请勿频繁点击", | ||||||
|  |                   duration: 3000 | ||||||
|  |                 }) | ||||||
|  |                 return | ||||||
|  |               } | ||||||
|  |               this.isProcessing = true | ||||||
|               dConsole.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config)) |               dConsole.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config)) | ||||||
|               AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) |               AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) | ||||||
|               this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config)) |               this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config)) | ||||||
| @ -228,8 +256,13 @@ struct TerminalInfoPage { | |||||||
|                     message: '设置成功', |                     message: '设置成功', | ||||||
|                     duration: 3000 |                     duration: 3000 | ||||||
|                   }); |                   }); | ||||||
|  |                   //   延迟几秒 | ||||||
|  |                   setTimeout(() => { | ||||||
|  |                     this.isProcessing = false | ||||||
|  |                   }, 3000) | ||||||
|                 } |                 } | ||||||
|               }); |               }); | ||||||
|  | 
 | ||||||
|             }) |             }) | ||||||
|           } |           } | ||||||
|           .width("100%") |           .width("100%") | ||||||
|  | |||||||
| @ -28,14 +28,18 @@ export default struct SignalDisplayComponent { | |||||||
|   // 原始数据 |   // 原始数据 | ||||||
|   @State rawData: string = "$GPS,,,,,,,,,,,,,,,,,,,,,,,,,,,,," |   @State rawData: string = "$GPS,,,,,,,,,,,,,,,,,,,,,,,,,,,,," | ||||||
|   // 车道信息 |   // 车道信息 | ||||||
|   @State laneSignal: PerLane = InitialPerLane |   @Link @Watch("laneSignalChange")  laneSignal: PerLane | ||||||
|  | 
 | ||||||
|  |   laneSignalChange(){ | ||||||
|  |     dConsole.log("车道信号变化3",this.laneSignal) | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   aboutToAppear(): void { |   aboutToAppear(): void { | ||||||
|     DifferentialAndSignal.onMsg(this.getMsg) |     DifferentialAndSignal.onMsg(this.getMsg) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   aboutToDisappear(): void { |   aboutToDisappear(): void { | ||||||
|     DifferentialAndSignal.onMsg(this.getMsg) |     DifferentialAndSignal.offMsg(this.getMsg) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getMsg = (data: string) => { |   getMsg = (data: string) => { | ||||||
| @ -162,6 +166,7 @@ export default struct SignalDisplayComponent { | |||||||
| struct trajectoryComponent { | struct trajectoryComponent { | ||||||
|   @State scaleNum: number = 100 |   @State scaleNum: number = 100 | ||||||
|   scaleFn = async (num: number) => { |   scaleFn = async (num: number) => { | ||||||
|  |     console.log("缩放传入数据", num.toString()) | ||||||
|     const scaleNum = this.scaleNum |     const scaleNum = this.scaleNum | ||||||
|     if (scaleNum > 0 && scaleNum < 5000) { |     if (scaleNum > 0 && scaleNum < 5000) { | ||||||
|       this.scaleNum += num; |       this.scaleNum += num; | ||||||
| @ -172,6 +177,7 @@ struct trajectoryComponent { | |||||||
|     if (scaleNum > 5000 && num < 0) { |     if (scaleNum > 5000 && num < 0) { | ||||||
|       this.scaleNum += num; |       this.scaleNum += num; | ||||||
|     } |     } | ||||||
|  |     console.log("缩放数据", this.scaleNum.toString()) | ||||||
|     await examJudgeMapSetScaling(this.scaleNum); |     await examJudgeMapSetScaling(this.scaleNum); | ||||||
|   } |   } | ||||||
|   getScaleNum = (): number => { |   getScaleNum = (): number => { | ||||||
| @ -187,7 +193,7 @@ struct trajectoryComponent { | |||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|     Stack({ |     Stack({ | ||||||
|       alignContent: Alignment.TopStart |       alignContent: Alignment.TopEnd | ||||||
|     }) { |     }) { | ||||||
|       XComponent({ |       XComponent({ | ||||||
|         id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 |         id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 | ||||||
| @ -206,7 +212,7 @@ struct trajectoryComponent { | |||||||
|         }) |         }) | ||||||
|       Row() { |       Row() { | ||||||
|         Image($rawfile('judge/big.png')).width(60).onClick(() => { |         Image($rawfile('judge/big.png')).width(60).onClick(() => { | ||||||
|           this.scaleFn(this.getScaleNum() - 1) |           this.scaleFn(-this.getScaleNum()) | ||||||
|         }) |         }) | ||||||
|         Image($rawfile('judge/small.png')).width(60).onClick(() => { |         Image($rawfile('judge/small.png')).width(60).onClick(() => { | ||||||
|           this.scaleFn(this.getScaleNum()) |           this.scaleFn(this.getScaleNum()) | ||||||
| @ -241,6 +247,7 @@ struct LaneComponent { | |||||||
|   ] |   ] | ||||||
| 
 | 
 | ||||||
|   getValues(roadColumn: RoadDataType) { |   getValues(roadColumn: RoadDataType) { | ||||||
|  |     dConsole.log(SignDisplayTag, "车道信息", this.laneSignal) | ||||||
|     let key = roadColumn.key; |     let key = roadColumn.key; | ||||||
|     let str = '' |     let str = '' | ||||||
|     if (Array.isArray(key)) { |     if (Array.isArray(key)) { | ||||||
|  | |||||||
| @ -1,161 +0,0 @@ | |||||||
| import apiJudgeSdk from 'libJudgeSdk.so'; |  | ||||||
| import { examJudgeMapSetScaling } from '../../judgeSDK/api'; |  | ||||||
| import { PerLane } from '../../../model'; |  | ||||||
| import { InitialPerLane } from '../../../mock'; |  | ||||||
| 
 |  | ||||||
| interface RoadDataType { |  | ||||||
|   name: string, |  | ||||||
|   key: string | string[] |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @Component |  | ||||||
| export default struct RealTime { |  | ||||||
|   @State message: string = '开始绘制' |  | ||||||
|   // 控制XComponent组件的创建和销毁 |  | ||||||
|   @State draw: boolean = false |  | ||||||
|   //模拟考试项目 |  | ||||||
|   @State scaleNum: number = 100 |  | ||||||
|   @State gpsActive: number = 1 |  | ||||||
|   @State ratio: number = 1 |  | ||||||
|   @State lane: PerLane = InitialPerLane |  | ||||||
|   scaleFn = async (num: number) => { |  | ||||||
|     const scaleNum = this.scaleNum |  | ||||||
|     if (scaleNum > 0 && scaleNum < 5000) { |  | ||||||
|       this.scaleNum += num; |  | ||||||
|     } |  | ||||||
|     if (scaleNum === 0 && num > 0) { |  | ||||||
|       this.scaleNum += num; |  | ||||||
|     } |  | ||||||
|     if (scaleNum > 5000 && num < 0) { |  | ||||||
|       this.scaleNum += num; |  | ||||||
|     } |  | ||||||
|     await examJudgeMapSetScaling(this.scaleNum); |  | ||||||
|   } |  | ||||||
|   private widthNumber: string | number | Resource = 0 |  | ||||||
|   private heightNumber: string | number | Resource = 0 |  | ||||||
|   private RoadData: Array<RoadDataType> = [ |  | ||||||
|     { name: '路段组号', key: 'MapRoad_Code_No' }, |  | ||||||
|     { name: '路段编码', key: 'MapRoad_Name' }, |  | ||||||
|     { name: '车轮压线', key: ['TouchLineType', 'TouchDir'] }, |  | ||||||
|     { name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] }, |  | ||||||
|     { name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] }, |  | ||||||
|     { name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] }, |  | ||||||
|     { name: '后车点道', key: ['BackPointLaneNo', 'BackPointLaneCount'] }, |  | ||||||
|     { name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] }, |  | ||||||
|     { name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] }, |  | ||||||
|     { name: '右前/后车身边线', key: ['Body_RF_ToBaseLine', 'Body_RB_ToBaseLine'] }, |  | ||||||
|     { name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] }, |  | ||||||
|     { name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RB_ToBaseLine'] }, |  | ||||||
|     { name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] }, |  | ||||||
|     { name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] }, |  | ||||||
|     { name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr', 'DirInverse'] }, |  | ||||||
|     { name: '形状', key: ['InShapeAttr', 'ShapeNo', 'ShapeNoWheel'] }, |  | ||||||
|     { name: '路段点', key: ['CrossPointNo'] }, |  | ||||||
|   ] |  | ||||||
| 
 |  | ||||||
|   async aboutToDisappear() { |  | ||||||
|     // clearInterval(this.timer) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   async aboutToAppear() { |  | ||||||
|     // const judge = new Judge(this) |  | ||||||
|     // let timer = setInterval(() => { |  | ||||||
|     //   this.lane = globalThis.laneData; |  | ||||||
|     // }, 1000) |  | ||||||
|     // this.timer = timer |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   getScaleNum = (): number => { |  | ||||||
|     const scaleNum = this.scaleNum; |  | ||||||
|     if (scaleNum < 200) return 10; |  | ||||||
|     if (scaleNum < 400) return 30; |  | ||||||
|     if (scaleNum < 600) return 50; |  | ||||||
|     if (scaleNum < 800) return 70; |  | ||||||
|     if (scaleNum < 1000) return 100; |  | ||||||
|     if (scaleNum < 2000) return 500; |  | ||||||
|     return 1000; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   getValues(roadColumn: RoadDataType) { |  | ||||||
|     const lane = this.lane; |  | ||||||
|     let key = roadColumn.key; |  | ||||||
|     let str = '' |  | ||||||
|     if (Array.isArray(key)) { |  | ||||||
|       key.forEach((k, index) => { |  | ||||||
|         str += (Reflect.get(lane, k) === undefined ? '' : Reflect.get(lane, k)) + (index == key.length - 1 ? '' : '/') |  | ||||||
|       }) |  | ||||||
|     } else { |  | ||||||
|       str = Reflect.get(lane, key) === undefined ? '' : Reflect.get(lane, key) |  | ||||||
|     } |  | ||||||
|     return str |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   build() { |  | ||||||
|     Row() { |  | ||||||
|       Column() { |  | ||||||
|         Row() { |  | ||||||
|           Text('车道信息').fontColor(this.gpsActive == 0 ? '#2D3C5A' : '#fff').fontSize(20) |  | ||||||
|         } |  | ||||||
|         .width('100%') |  | ||||||
|         .height(37) |  | ||||||
|         .backgroundColor(this.gpsActive == 0 ? '#fff' : '#1A1A1A') |  | ||||||
|         .margin({ top: 10 * this.ratio, right: 10 }) |  | ||||||
|         .justifyContent(FlexAlign.Center) |  | ||||||
| 
 |  | ||||||
|         Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) { |  | ||||||
|           ForEach(this.RoadData, (item: RoadDataType) => { |  | ||||||
|             Column() { |  | ||||||
|               Text(`${item.name}:${this.getValues(item)}`) |  | ||||||
|                 .fontSize(20) |  | ||||||
|                 .lineHeight(30) |  | ||||||
|                 .fontColor('#fff') |  | ||||||
|             }.height(30).justifyContent(FlexAlign.Start).width('100%') |  | ||||||
|           }) |  | ||||||
|         }.margin({ top: 5 }) |  | ||||||
| 
 |  | ||||||
|       }.width(168 * 1.5) |  | ||||||
|       .height(this.heightNumber) |  | ||||||
|       .backgroundColor('#282828') |  | ||||||
|       .margin({ top: 6 * this.ratio, }) |  | ||||||
| 
 |  | ||||||
|       Column() { |  | ||||||
|         if (this.draw) { |  | ||||||
|           XComponent({ |  | ||||||
|             id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 |  | ||||||
|             type: 'surface', |  | ||||||
|             libraryname: 'JudgeSdk' |  | ||||||
|             // libraryname: 'judgesdk' |  | ||||||
|           }) |  | ||||||
|             .width(this.widthNumber) |  | ||||||
|             .height(this.heightNumber) |  | ||||||
|             .onLoad(() => { |  | ||||||
|               apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹,false:表示结束绘制 |  | ||||||
|             }) |  | ||||||
|             .onDestroy(() => { |  | ||||||
|               apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹,false:表示结束绘制 |  | ||||||
|               this.draw = false; |  | ||||||
|               // clearInterval(globalThis.realTimer) |  | ||||||
|             }) |  | ||||||
|         } else { |  | ||||||
|           Column() { |  | ||||||
|           } |  | ||||||
|           .width(this.widthNumber) |  | ||||||
|           .height(this.heightNumber) |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       .width('100%') |  | ||||||
|       .backgroundColor('#fff') |  | ||||||
| 
 |  | ||||||
|       Row() { |  | ||||||
|         Image($rawfile('judge/big.png')).width(60).onClick(() => { |  | ||||||
|           this.scaleFn(this.getScaleNum() - 1) |  | ||||||
|         }) |  | ||||||
|         Image($rawfile('judge/small.png')).width(60).onClick(() => { |  | ||||||
|           this.scaleFn(this.getScaleNum()) |  | ||||||
|         }).margin({ left: 20 }) |  | ||||||
|       }.position({ x: '32%', y: 60 }) |  | ||||||
|     } |  | ||||||
|     .height('100%') |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @ -285,6 +285,16 @@ export default class Judge { | |||||||
|     if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { |     if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { | ||||||
|       return |       return | ||||||
|     } |     } | ||||||
|  |     const gpsPart = msg.split("#END$GPS,")[1]; | ||||||
|  |     const gpsStatus = gpsPart.split(",")[0]; | ||||||
|  |     if (gpsStatus === "4") { | ||||||
|  |       dConsole.log(JudgeTag, "差分状态正常", gpsStatus) | ||||||
|  |       this.judgeUI.isDwztRight = true | ||||||
|  |     } else { | ||||||
|  |       dConsole.log(JudgeTag, "差分状态异常", gpsStatus) | ||||||
|  |       this.judgeUI.isDwztRight = false | ||||||
|  |     } | ||||||
|  |     this.judgeUI.isDwztRight | ||||||
|     const plcData = await this.getPlcData(msg); |     const plcData = await this.getPlcData(msg); | ||||||
|     // 4.过程数据 |     // 4.过程数据 | ||||||
|     await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) |     await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) | ||||||
| @ -591,7 +601,7 @@ export default class Judge { | |||||||
|       num++ |       num++ | ||||||
|       // 4.过程数据 |       // 4.过程数据 | ||||||
|       this.tempData = msg |       this.tempData = msg | ||||||
|       this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3); |       // this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3); | ||||||
|       this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + ''; |       this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + ''; | ||||||
|       this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + '' |       this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + '' | ||||||
|       this.plcData = msg |       this.plcData = msg | ||||||
| @ -1075,7 +1085,6 @@ export default class Judge { | |||||||
|     const checkExamIsEnd = this.checkExamIsEnd |     const checkExamIsEnd = this.checkExamIsEnd | ||||||
|     const checkProjectIsStart = this.checkProjectIsStart |     const checkProjectIsStart = this.checkProjectIsStart | ||||||
|     const lane = this.lane |     const lane = this.lane | ||||||
|     const closeAllFiles = this.closeAllFiles |  | ||||||
| 
 | 
 | ||||||
|     const projectsObj: object = judgeUI.projectsObj |     const projectsObj: object = judgeUI.projectsObj | ||||||
|     const judgeConfigObj: object = judgeUI.judgeConfigObj |     const judgeConfigObj: object = judgeUI.judgeConfigObj | ||||||
| @ -1332,7 +1341,6 @@ export default class Judge { | |||||||
|     const avPlayer = this.avPlayer |     const avPlayer = this.avPlayer | ||||||
|     const judgeTask = this.judgeTask |     const judgeTask = this.judgeTask | ||||||
|     const isManual = this.isManual |     const isManual = this.isManual | ||||||
|     const closeAllFiles = this.closeAllFiles |  | ||||||
| 
 | 
 | ||||||
|     const judgeConfigObj = judgeUI.judgeConfigObj |     const judgeConfigObj = judgeUI.judgeConfigObj | ||||||
|     const examSubject = judgeUI.examSubject |     const examSubject = judgeUI.examSubject | ||||||
| @ -1354,7 +1362,7 @@ export default class Judge { | |||||||
|     if (!singlePlay && isManual && !isAllProjectsEnd) { |     if (!singlePlay && isManual && !isAllProjectsEnd) { | ||||||
|       avPlayer?.playAudio(['voice/empty.mp3'], true, () => { |       avPlayer?.playAudio(['voice/empty.mp3'], true, () => { | ||||||
|         this.isUdpEnd = true; |         this.isUdpEnd = true; | ||||||
|         closeAllFiles() |         dConsole.log(JudgeTag, "router back7") | ||||||
|         router.back(); |         router.back(); | ||||||
|       }) |       }) | ||||||
|       return |       return | ||||||
| @ -1396,7 +1404,6 @@ export default class Judge { | |||||||
|     const avPlayer = this.avPlayer |     const avPlayer = this.avPlayer | ||||||
|     const kfArr = this.kfArr |     const kfArr = this.kfArr | ||||||
|     const filePath = this.filePath |     const filePath = this.filePath | ||||||
|     const closeAllFiles = this.closeAllFiles |  | ||||||
| 
 | 
 | ||||||
|     const lsh = judgeUI.lsh; |     const lsh = judgeUI.lsh; | ||||||
|     const idCard = judgeUI.idCard; |     const idCard = judgeUI.idCard; | ||||||
| @ -1436,6 +1443,7 @@ export default class Judge { | |||||||
|       drvexam |       drvexam | ||||||
|     } |     } | ||||||
|     let backTimeOut = setTimeout(() => { |     let backTimeOut = setTimeout(() => { | ||||||
|  |       dConsole.log(JudgeTag, "router back6") | ||||||
|       router.back() |       router.back() | ||||||
|     }, 90 * 1000) |     }, 90 * 1000) | ||||||
|     const temp = await this.sendWriteObjectOut(data, filePath); |     const temp = await this.sendWriteObjectOut(data, filePath); | ||||||
| @ -1449,7 +1457,6 @@ export default class Judge { | |||||||
|         this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' |         this.judgeUI.errorMsg = '当前的考试过程信息监管审核未通过,程序将退出!' | ||||||
|       } |       } | ||||||
|       this.isUdpEnd = true; |       this.isUdpEnd = true; | ||||||
|       closeAllFiles() |  | ||||||
|       // this.judgeUI.loadingPopupVisible = false; |       // this.judgeUI.loadingPopupVisible = false; | ||||||
|       dConsole.log(JudgeTag, ' 关闭车辆loading1') |       dConsole.log(JudgeTag, ' 关闭车辆loading1') | ||||||
|       this.judgeUI.generateExamRecordsDialogController.close() |       this.judgeUI.generateExamRecordsDialogController.close() | ||||||
| @ -1536,7 +1543,7 @@ export default class Judge { | |||||||
|               if (kfArr && kfArr.length - 1 === index) { |               if (kfArr && kfArr.length - 1 === index) { | ||||||
|                 avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { |                 avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { | ||||||
|                   this.isUdpEnd = true; |                   this.isUdpEnd = true; | ||||||
|                   closeAllFiles() |                   dConsole.log(JudgeTag, "router back4") | ||||||
|                   router.back(); |                   router.back(); | ||||||
|                 }) |                 }) | ||||||
|                 throw new Error('End Loop') |                 throw new Error('End Loop') | ||||||
| @ -1545,7 +1552,7 @@ export default class Judge { | |||||||
|             } else { |             } else { | ||||||
|               avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { |               avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { | ||||||
|                 this.isUdpEnd = true; |                 this.isUdpEnd = true; | ||||||
|                 closeAllFiles() |                 dConsole.log(JudgeTag, "router back5") | ||||||
|                 router.back(); |                 router.back(); | ||||||
|               }) |               }) | ||||||
|               throw new Error('End Loop') |               throw new Error('End Loop') | ||||||
| @ -1559,9 +1566,10 @@ export default class Judge { | |||||||
|       avPlayer?.playAudio([voiceURL], true, () => { |       avPlayer?.playAudio([voiceURL], true, () => { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           this.isUdpEnd = true |           this.isUdpEnd = true | ||||||
|           closeAllFiles() |  | ||||||
|           dConsole.log(JudgeTag, ' 关闭车辆loading2') |           dConsole.log(JudgeTag, ' 关闭车辆loading2') | ||||||
|           this.judgeUI.generateExamRecordsDialogController.close() |           this.judgeUI.generateExamRecordsDialogController.close() | ||||||
|  |           dConsole.log(JudgeTag, "router back8") | ||||||
|  |           DifferentialAndSignal.clearMsg() | ||||||
|           router.back(); |           router.back(); | ||||||
|         }, param302 == '8' ? 3000 : 0) |         }, param302 == '8' ? 3000 : 0) | ||||||
|       }) |       }) | ||||||
| @ -1841,11 +1849,6 @@ export default class Judge { | |||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   closeAllFiles = () => { |  | ||||||
|     setTimeout(() => { |  | ||||||
|       this.fileLog?.closeAllFiles() |  | ||||||
|     }, 1000) |  | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   //开始评判 |   //开始评判 | ||||||
|   private async judging(callBack: Function) { |   private async judging(callBack: Function) { | ||||||
| @ -1857,15 +1860,8 @@ export default class Judge { | |||||||
|     const kssycs = judgeUI.kssycs |     const kssycs = judgeUI.kssycs | ||||||
|     const manualMarkRules = judgeUI.manualMarkRules |     const manualMarkRules = judgeUI.manualMarkRules | ||||||
| 
 | 
 | ||||||
|     const fileLog = new FileLog(judgeUI.context); |  | ||||||
|     const filePath = await fileLog?.initFileLogo({ |  | ||||||
|       name, lsh, idCard |  | ||||||
|     }); |  | ||||||
|     this.fileLog = fileLog; |  | ||||||
|     this.filePath = filePath; |  | ||||||
| 
 | 
 | ||||||
|     const getJudgeBeginData = this.getJudgeBeginData; |     const getJudgeBeginData = this.getJudgeBeginData; | ||||||
|     const handleUdp = this.handleUdp; |  | ||||||
|     const handDistance = this.getJudgeBeginData; |     const handDistance = this.getJudgeBeginData; | ||||||
|     const handleTrajectoryUdp = this.handleTrajectoryUdp; |     const handleTrajectoryUdp = this.handleTrajectoryUdp; | ||||||
|     const isTrajectoryOpen = this.isTrajectoryOpen; |     const isTrajectoryOpen = this.isTrajectoryOpen; | ||||||
| @ -1884,7 +1880,7 @@ export default class Judge { | |||||||
|     await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => { |     await examJudgeSetLogCallback(3, async (level: number, info: string, len: number) => { | ||||||
|       dConsole.log(JudgeTag, '评判日志:' + info) |       dConsole.log(JudgeTag, '评判日志:' + info) | ||||||
|       // await fileLog?.setExamJudgeLogData(info); |       // await fileLog?.setExamJudgeLogData(info); | ||||||
|       dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData,info) |       dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info) | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     dConsole.info(JudgeTag, '2.注册日志回调完成') |     dConsole.info(JudgeTag, '2.注册日志回调完成') | ||||||
| @ -1903,7 +1899,7 @@ export default class Judge { | |||||||
|     await examJudgeSetRealExamCallback(async (strData: string, len: number) => { |     await examJudgeSetRealExamCallback(async (strData: string, len: number) => { | ||||||
|       // 评判回调日志 |       // 评判回调日志 | ||||||
|       // await fileLog?.setExamJudgeCallbackData(strData) |       // await fileLog?.setExamJudgeCallbackData(strData) | ||||||
|       dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData,strData) |       dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData, strData) | ||||||
|       dConsole.info(JudgeTag, '评判回调数据', strData) |       dConsole.info(JudgeTag, '评判回调数据', strData) | ||||||
|       await this.handleRealExam(strData, callBack) |       await this.handleRealExam(strData, callBack) | ||||||
|     }) |     }) | ||||||
| @ -1919,6 +1915,8 @@ export default class Judge { | |||||||
|       this.judgeUI.jl = jl |       this.judgeUI.jl = jl | ||||||
|       //TODO 待优化 跨组件传值不生效 |       //TODO 待优化 跨组件传值不生效 | ||||||
|       // globalThis.laneData = performInfo.lane; |       // globalThis.laneData = performInfo.lane; | ||||||
|  |       dConsole.log(JudgeTag, "车道信息", performInfo.lane) | ||||||
|  |       this.judgeUI.laneSignal = performInfo.lane | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     let beginExamInfo: JudgeBeginObj | undefined = undefined |     let beginExamInfo: JudgeBeginObj | undefined = undefined | ||||||
| @ -1929,7 +1927,6 @@ export default class Judge { | |||||||
|     } else { |     } else { | ||||||
|       beginExamInfo = await getJudgeBeginData() |       beginExamInfo = await getJudgeBeginData() | ||||||
|     } |     } | ||||||
|     await fileLog?.setExamJudgeData(JSON.stringify(beginExamInfo)) |  | ||||||
|     if (beginExamInfo) { |     if (beginExamInfo) { | ||||||
|       await examJudgeBeginExam(beginExamInfo); |       await examJudgeBeginExam(beginExamInfo); | ||||||
|     } |     } | ||||||
| @ -1961,7 +1958,7 @@ export default class Judge { | |||||||
|     DifferentialAndSignal.onMsg((data: string) => { |     DifferentialAndSignal.onMsg((data: string) => { | ||||||
|       const result: WorkerBackMessage = JSON.parse(data) |       const result: WorkerBackMessage = JSON.parse(data) | ||||||
|       if (result.type === WorkerBackMessageType.ObtainUdpData) { |       if (result.type === WorkerBackMessageType.ObtainUdpData) { | ||||||
|         handleUdp(result.data as string) |         this.handleUdp(result.data as string) | ||||||
|         dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string) |         dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string) | ||||||
|       } |       } | ||||||
|       //TODO UDP修改 |       //TODO UDP修改 | ||||||
|  | |||||||
| @ -29,8 +29,8 @@ export default class FileLog { | |||||||
|   } |   } | ||||||
|   // 无锡所接口数据 |   // 无锡所接口数据 | ||||||
|   public setExamJudgeWuxiData = async (str: string) => { |   public setExamJudgeWuxiData = async (str: string) => { | ||||||
|     this.examJudgeWuxiDataFd = |     // this.examJudgeWuxiDataFd = | ||||||
|       await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str); |     //   await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str); | ||||||
|   } |   } | ||||||
|   // 无锡所过程数据 |   // 无锡所过程数据 | ||||||
|   public setExamJudgeWuxiProgressData = async (str: string) => { |   public setExamJudgeWuxiProgressData = async (str: string) => { | ||||||
|  | |||||||
| @ -12,6 +12,8 @@ export default class TcpClient { | |||||||
|   private tcpSendNum: number = 0 |   private tcpSendNum: number = 0 | ||||||
|   private tcp: socket.TCPSocket = socket.constructTCPSocketInstance() |   private tcp: socket.TCPSocket = socket.constructTCPSocketInstance() | ||||||
|   private events: Array<Function> = [] |   private events: Array<Function> = [] | ||||||
|  |   // 连接状态是否成功 | ||||||
|  |   private linkStatus: boolean = false | ||||||
| 
 | 
 | ||||||
|   constructor() { |   constructor() { | ||||||
|     if (!TcpClient.instance) { |     if (!TcpClient.instance) { | ||||||
| @ -58,6 +60,7 @@ export default class TcpClient { | |||||||
|         }, timeout: 1000 * 15 |         }, timeout: 1000 * 15 | ||||||
|       }) |       }) | ||||||
|         .then(() => { |         .then(() => { | ||||||
|  |           this.linkStatus = true | ||||||
|           this.getMessage() |           this.getMessage() | ||||||
|           console.log(TCPTag, "tcp connect success") |           console.log(TCPTag, "tcp connect success") | ||||||
|           return this.tcp.setExtraOptions({ |           return this.tcp.setExtraOptions({ | ||||||
| @ -68,6 +71,7 @@ export default class TcpClient { | |||||||
|           resolve(true) |           resolve(true) | ||||||
|         }) |         }) | ||||||
|         .catch((err: BusinessError) => { |         .catch((err: BusinessError) => { | ||||||
|  |           this.linkStatus = false | ||||||
|           console.log(TCPTag, "tcp connect or keepAlive error: ", JSON.stringify(err)) |           console.log(TCPTag, "tcp connect or keepAlive error: ", JSON.stringify(err)) | ||||||
|           console.log(TCPTag, "tcp 重启服务") |           console.log(TCPTag, "tcp 重启服务") | ||||||
|           reject(err) |           reject(err) | ||||||
| @ -76,6 +80,10 @@ export default class TcpClient { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getMessage() { |   getMessage() { | ||||||
|  |     if (!this.linkStatus) { | ||||||
|  |       console.log(TCPTag, '不允许获取消息: TCP未连接'); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     this.tcp.on("message", value => { |     this.tcp.on("message", value => { | ||||||
|       let data = new DataView(value.message) |       let data = new DataView(value.message) | ||||||
|       this.events.forEach(cb => { |       this.events.forEach(cb => { | ||||||
| @ -88,6 +96,7 @@ export default class TcpClient { | |||||||
| 
 | 
 | ||||||
|   // 重新绑定tcp |   // 重新绑定tcp | ||||||
|   async reBind() { |   async reBind() { | ||||||
|  |     console.log(TCPTag, 'tcp rebind') | ||||||
|     await this.close() |     await this.close() | ||||||
|     this.tcp = socket.constructTCPSocketInstance(); |     this.tcp = socket.constructTCPSocketInstance(); | ||||||
|     await this.bindTcp() |     await this.bindTcp() | ||||||
| @ -109,11 +118,19 @@ export default class TcpClient { | |||||||
| 
 | 
 | ||||||
|   // 监听tcp消息 |   // 监听tcp消息 | ||||||
|   onMsg(callback: Function) { |   onMsg(callback: Function) { | ||||||
|     this.events.push(callback) |     if (this.events.includes(callback)) { | ||||||
|  |       console.log(TCPTag, '已经存在这个获取消息方法了'); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     this.events.push(callback); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 接收tcp消息 |   // 接收tcp消息 | ||||||
|   sendMsg(data: string): Promise<void> { |   sendMsg(data: string): Promise<void> { | ||||||
|  |     if (!this.linkStatus) { | ||||||
|  |       console.log(TCPTag, '不允许发送: TCP未连接'); | ||||||
|  |       return Promise.reject(new Error('TCP connection is not established')); | ||||||
|  |     } | ||||||
|     return this.tcp?.send({ |     return this.tcp?.send({ | ||||||
|       data |       data | ||||||
|     }).catch(async (err: BusinessError) => { |     }).catch(async (err: BusinessError) => { | ||||||
|  | |||||||
| @ -37,6 +37,8 @@ export default class UdpClient { | |||||||
|   private messageEvents: Array<Function> = [] |   private messageEvents: Array<Function> = [] | ||||||
|   private errorEvents: Array<Function> = [] |   private errorEvents: Array<Function> = [] | ||||||
|   private dealMethod?: DealMethod<object> |   private dealMethod?: DealMethod<object> | ||||||
|  |   // 连接状态 | ||||||
|  |   private linkStatus: boolean = false | ||||||
| 
 | 
 | ||||||
|   // 绑定udp连接 |   // 绑定udp连接 | ||||||
|   bindUdp(): Promise<void> | undefined { |   bindUdp(): Promise<void> | undefined { | ||||||
|  | |||||||
| @ -50,6 +50,11 @@ class differentialAndSignal { | |||||||
|     this.events = this.events.filter((cb) => cb !== callback); |     this.events = this.events.filter((cb) => cb !== callback); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   // 清除监听 | ||||||
|  |   clearMsg() { | ||||||
|  |     this.events = [] | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   // 关闭 |   // 关闭 | ||||||
|   close() { |   close() { | ||||||
|     this.events = []; |     this.events = []; | ||||||
| @ -67,7 +72,8 @@ class differentialAndSignal { | |||||||
|   getMessage() { |   getMessage() { | ||||||
|     this.workerInstance.onmessage = (e: MessageEvents): void => { |     this.workerInstance.onmessage = (e: MessageEvents): void => { | ||||||
|       if (e.data) { |       if (e.data) { | ||||||
|         // console.log(WorkerTag, "Worker 收到消息: " + e.data); |         console.log(WorkerTag, "Worker 收到消息: " + e.data); | ||||||
|  |         console.log(WorkerTag, "Worker 目前监听数量: " + this.events.length.toString()); | ||||||
|         this.events.forEach((callback) => { |         this.events.forEach((callback) => { | ||||||
|           callback(e.data); |           callback(e.data); | ||||||
|         }); |         }); | ||||||
|  | |||||||
| @ -98,7 +98,40 @@ async function InitExam(dirName: string) { | |||||||
| 
 | 
 | ||||||
| // 写过程数据 | // 写过程数据 | ||||||
| async function WriteProcessData(type: ProcessDataEnumType, data: string) { | async function WriteProcessData(type: ProcessDataEnumType, data: string) { | ||||||
|   writeQueue.push({ type, data }); |   if (type === ProcessDataEnumType.WuxiExam) { | ||||||
|  |     //   改变数据为无锡所需要的数据 | ||||||
|  |     const plcData = data.split(','); | ||||||
|  |     const time = dayTs().format("YYYY-MM-DD HH:mm:ss") | ||||||
|  |     const lineData = [ | ||||||
|  |     /*帧头*/time, | ||||||
|  |       /*卫星时间*/time, | ||||||
|  |       /*经度*/ plcData[95], | ||||||
|  |       /*纬度*/ plcData[95], | ||||||
|  |       /*高度*/ plcData[86], | ||||||
|  |       /*方位角*/ 0, | ||||||
|  |       /*俯仰角*/ plcData[91], | ||||||
|  |       /*速度角*/'', | ||||||
|  |       /*速度*/  plcData[97], | ||||||
|  |       /*横滚*/'', | ||||||
|  |       /*卫星定位状态*/'', | ||||||
|  |       /*卫星定向状态*/'', | ||||||
|  |       /*前天线可用星数*/'', | ||||||
|  |       /*后天线可用星数*/'', | ||||||
|  |       /*东向位置坐标*/'', | ||||||
|  |       /*北向位置坐标*/'', | ||||||
|  |       /*天向位置坐标*/'', | ||||||
|  |       /*东向速度*/'', | ||||||
|  |       /*北向速度*/'', | ||||||
|  |       /*评判信号1*/[plcData[14], plcData[19], plcData[5], '', plcData[2], plcData[3], plcData[7], plcData[8], | ||||||
|  |         plcData[13], plcData[12], plcData[17], '', plcData[4], plcData[11], plcData[20], plcData[9], 0].join(','), | ||||||
|  |       /*评判信号2*/['', plcData[28], '', '', plcData[10], '', '', '', '', '', '', '', '', '', '', '', '', ''].join(','), | ||||||
|  |       /*发动机转速*/ plcData[25], | ||||||
|  |       /*结束符*/ time, | ||||||
|  |     ]; | ||||||
|  |     writeQueue.push({ type, data: JSON.stringify(lineData) }); | ||||||
|  |   } else { | ||||||
|  |     writeQueue.push({ type, data }); | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   if (!isProcessing) { |   if (!isProcessing) { | ||||||
|     processQueue(); |     processQueue(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user