大车代码合并
小红球udp开始时间修改
This commit is contained in:
		
							parent
							
								
									a7c85152a4
								
							
						
					
					
						commit
						fca8d0ed08
					
				| @ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 1, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": {}, |   "specifiers": {}, | ||||||
|   "packages": {} |   "packages": {} | ||||||
|  | |||||||
| @ -140,6 +140,7 @@ export interface EnvironmentConfigurationType { | |||||||
|   // 前置机响应后置机端口2 |   // 前置机响应后置机端口2 | ||||||
|   udplocalIpPortTwo?: string, |   udplocalIpPortTwo?: string, | ||||||
|   udpOppositeIp?: string, |   udpOppositeIp?: string, | ||||||
|  |   udpOppositeIpTwo?: string, | ||||||
| 
 | 
 | ||||||
|   // 后置机响应端口 |   // 后置机响应端口 | ||||||
|   udpOppositeIpPort?: string, |   udpOppositeIpPort?: string, | ||||||
|  | |||||||
| @ -659,7 +659,7 @@ export interface JudgeBeginObj { | |||||||
|   sczbkf?: JudgeKFXM[] |   sczbkf?: JudgeKFXM[] | ||||||
|   dmndg: boolean |   dmndg: boolean | ||||||
|   mfxx: boolean |   mfxx: boolean | ||||||
|   mfxxn: boolean |   zeng: boolean | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export interface JudgeXMJS { | export interface JudgeXMJS { | ||||||
|  | |||||||
| @ -72,6 +72,8 @@ export interface WorkerBackMessage { | |||||||
| export enum WorkerBackMessageType { | export enum WorkerBackMessageType { | ||||||
|   // 后置机信息 |   // 后置机信息 | ||||||
|   ObtainUdpData = 'obtainUdpData', |   ObtainUdpData = 'obtainUdpData', | ||||||
|  |   // 后置机GPS2消息 | ||||||
|  |   ObtainUdpGps2Data = 'obtainUdpGps2Data', | ||||||
|   // 中心消息 |   // 中心消息 | ||||||
|   CenterUdpData = 'centerUdpData', |   CenterUdpData = 'centerUdpData', | ||||||
|   // 远程开始考试 |   // 远程开始考试 | ||||||
|  | |||||||
| @ -149,7 +149,6 @@ export struct JudgePage { | |||||||
|   @State isErrorMsgEnd: boolean = false |   @State isErrorMsgEnd: boolean = false | ||||||
|   @State disConnectErrorOpen: boolean = false |   @State disConnectErrorOpen: boolean = false | ||||||
|   @State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane |   @State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane | ||||||
|   public udpStartTIme: string = "" |  | ||||||
|   public examTime: number = 0 |   public examTime: number = 0 | ||||||
|   public context = getContext(this) as common.UIAbilityContext; |   public context = getContext(this) as common.UIAbilityContext; | ||||||
|   // 信号查看弹窗 |   // 信号查看弹窗 | ||||||
| @ -214,7 +213,6 @@ export struct JudgePage { | |||||||
|     this.startFullTime = dayTs().format("YYYYMMDDHHmmss"); |     this.startFullTime = dayTs().format("YYYYMMDDHHmmss"); | ||||||
|     this.startTime = dayTs().format("YYYY-MM-DD HH:mm:ss") |     this.startTime = dayTs().format("YYYY-MM-DD HH:mm:ss") | ||||||
|     this.startExamTime = dayTs().format("YYYY-MM-DD HH:mm:ss") |     this.startExamTime = dayTs().format("YYYY-MM-DD HH:mm:ss") | ||||||
|     this.udpStartTIme = dayTs().format("HHmmssSSS") |  | ||||||
|     //初始化数据库表 |     //初始化数据库表 | ||||||
|     await this.initDb() |     await this.initDb() | ||||||
|     //断点续考 |     //断点续考 | ||||||
|  | |||||||
| @ -36,6 +36,7 @@ import router from '@ohos.router' | |||||||
| import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation' | import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation' | ||||||
| import { CurrentProjectConversion, DeductionProjectConversion, DetectingDifferences, GetCarStatus } from './utils' | import { CurrentProjectConversion, DeductionProjectConversion, DetectingDifferences, GetCarStatus } from './utils' | ||||||
| import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' | import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' | ||||||
|  | import dayTs from '../../utils/Date' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export interface GetSysSetResult { | export interface GetSysSetResult { | ||||||
| @ -288,28 +289,7 @@ export class BaseJudge { | |||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     that.avPlayer?.playAudio(['voice/exam_waiting.mp3'], judgeUI.singlePlay, async () => { |     that.avPlayer?.playAudio(['voice/exam_waiting.mp3'], judgeUI.singlePlay, async () => { | ||||||
|       this.isUdpEnd = true | 
 | ||||||
|       try { |  | ||||||
|         if (!judgeUI.singlePlay) { |  | ||||||
|           DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { |  | ||||||
|             judgeUdpEnd: this.isUdpEnd, |  | ||||||
|             judgeExamEnd: true, |  | ||||||
|             performInfo: that.performInfo, |  | ||||||
|             business: { |  | ||||||
|               totalScore: that.judgeUI.totalScore, |  | ||||||
|               kfArr: that.judgeUI.kfArr, |  | ||||||
|               startTime: that.judgeUI.udpStartTIme, |  | ||||||
|               xmmcSingleCode: that.xmmcSingleCode, |  | ||||||
|               kmItems: that.kmItems, |  | ||||||
|               examTime: that.judgeUI.examTime, |  | ||||||
|               cdsbInfoObj: that.judgeUI.cdsbInfoObj!, |  | ||||||
|               xmdm: that.xmdm, |  | ||||||
|               xmxh: that.xmxh |  | ||||||
|             } } }) |  | ||||||
|         } |  | ||||||
|       } catch (e) { |  | ||||||
|         console.info(JudgeTag, JSON.stringify(e)) |  | ||||||
|       } |  | ||||||
|       if (judgeUI.singlePlay) { |       if (judgeUI.singlePlay) { | ||||||
|         // 单机结束 |         // 单机结束 | ||||||
|         await this.endExam(judgeUI, that) |         await this.endExam(judgeUI, that) | ||||||
| @ -433,6 +413,29 @@ export class BaseJudge { | |||||||
|               throw new Error('End Loop') |               throw new Error('End Loop') | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
|  |           this.isUdpEnd = true | ||||||
|  |           try { | ||||||
|  |             if (!judgeUI.singlePlay) { | ||||||
|  |               let startTime: Date = AppStorage.get("startTime") || new Date() | ||||||
|  |               DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { | ||||||
|  |                 judgeUdpEnd: this.isUdpEnd, | ||||||
|  |                 judgeExamEnd: true, | ||||||
|  |                 performInfo: that.performInfo, | ||||||
|  |                 business: { | ||||||
|  |                   totalScore: that.judgeUI.totalScore, | ||||||
|  |                   kfArr: that.judgeUI.kfArr, | ||||||
|  |                   startTime: dayTs(startTime).format("HHmmssSSS"), | ||||||
|  |                   xmmcSingleCode: that.xmmcSingleCode, | ||||||
|  |                   kmItems: that.kmItems, | ||||||
|  |                   examTime: that.judgeUI.examTime, | ||||||
|  |                   cdsbInfoObj: that.judgeUI.cdsbInfoObj!, | ||||||
|  |                   xmdm: that.xmdm, | ||||||
|  |                   xmxh: that.xmxh | ||||||
|  |                 } } }) | ||||||
|  |             } | ||||||
|  |           } catch (e) { | ||||||
|  |             console.info(JudgeTag, JSON.stringify(e)) | ||||||
|  |           } | ||||||
|         } catch (e) { |         } catch (e) { | ||||||
|           console.info(JudgeTag, JSON.stringify(e)) |           console.info(JudgeTag, JSON.stringify(e)) | ||||||
|         } |         } | ||||||
| @ -441,6 +444,28 @@ export class BaseJudge { | |||||||
|       that.avPlayer?.playAudio([voiceURL], true, () => { |       that.avPlayer?.playAudio([voiceURL], true, () => { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|           this.isUdpEnd = true |           this.isUdpEnd = true | ||||||
|  |           try { | ||||||
|  |             if (!judgeUI.singlePlay) { | ||||||
|  |               let startTime: Date = AppStorage.get("startTime") || new Date() | ||||||
|  |               DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { | ||||||
|  |                 judgeUdpEnd: this.isUdpEnd, | ||||||
|  |                 judgeExamEnd: true, | ||||||
|  |                 performInfo: that.performInfo, | ||||||
|  |                 business: { | ||||||
|  |                   totalScore: that.judgeUI.totalScore, | ||||||
|  |                   kfArr: that.judgeUI.kfArr, | ||||||
|  |                   startTime: dayTs(startTime).format("HHmmssSSS"), | ||||||
|  |                   xmmcSingleCode: that.xmmcSingleCode, | ||||||
|  |                   kmItems: that.kmItems, | ||||||
|  |                   examTime: that.judgeUI.examTime, | ||||||
|  |                   cdsbInfoObj: that.judgeUI.cdsbInfoObj!, | ||||||
|  |                   xmdm: that.xmdm, | ||||||
|  |                   xmxh: that.xmxh | ||||||
|  |                 } } }) | ||||||
|  |             } | ||||||
|  |           } catch (e) { | ||||||
|  |             console.info(JudgeTag, JSON.stringify(e)) | ||||||
|  |           } | ||||||
|           dConsole.log(JudgeTag, "考试结束自动退出5") |           dConsole.log(JudgeTag, "考试结束自动退出5") | ||||||
|           router.back(); |           router.back(); | ||||||
|         }, param302 === "8" ? 3000 : 0) |         }, param302 === "8" ? 3000 : 0) | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSigna | |||||||
| import { PlcStrToJson, PlcStrToWXJson } from './utils' | import { PlcStrToJson, PlcStrToWXJson } from './utils' | ||||||
| import { BaseJudgeImpl, SetJudgeItem } from './BaseJudgeBussines' | import { BaseJudgeImpl, SetJudgeItem } from './BaseJudgeBussines' | ||||||
| import { JudgePage } from '../Judge' | import { JudgePage } from '../Judge' | ||||||
|  | import dayTs from '../../utils/Date' | ||||||
| 
 | 
 | ||||||
| export default class JudgeBusiness { | export default class JudgeBusiness { | ||||||
|   public mndgStr: string | undefined |   public mndgStr: string | undefined | ||||||
| @ -58,9 +59,8 @@ export default class JudgeBusiness { | |||||||
|   public plcData?: PLCType |   public plcData?: PLCType | ||||||
|   public totalScore: number = -1 |   public totalScore: number = -1 | ||||||
|   public judgeUI: JudgePage |   public judgeUI: JudgePage | ||||||
|   private tempData?: PLCType |  | ||||||
|   // 是否发送udp |  | ||||||
|   private judgeBusiness: BaseJudgeImpl |   private judgeBusiness: BaseJudgeImpl | ||||||
|  |   private plc2Data?: string | ||||||
| 
 | 
 | ||||||
|   constructor(judgeUI: JudgePage) { |   constructor(judgeUI: JudgePage) { | ||||||
|     this.judgeUI = judgeUI |     this.judgeUI = judgeUI | ||||||
| @ -88,7 +88,6 @@ export default class JudgeBusiness { | |||||||
|       const msg: PLCType = JSON.parse(strArr[num]); |       const msg: PLCType = JSON.parse(strArr[num]); | ||||||
|       num++ |       num++ | ||||||
|       // 4.过程数据 |       // 4.过程数据 | ||||||
|       this.tempData = msg |  | ||||||
|       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 | ||||||
| @ -146,6 +145,9 @@ export default class JudgeBusiness { | |||||||
|       this.HandlePLCData(result.data as string) |       this.HandlePLCData(result.data as string) | ||||||
|       dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string) |       dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string) | ||||||
|     } |     } | ||||||
|  |     if (result.type === WorkerBackMessageType.ObtainUdpGps2Data) { | ||||||
|  |       this.plc2Data = result.data as string | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 处理PLC数据 |   // 处理PLC数据 | ||||||
| @ -164,14 +166,13 @@ export default class JudgeBusiness { | |||||||
|     } |     } | ||||||
|     // 记录原始PLC数据 |     // 记录原始PLC数据 | ||||||
|     dConsole.writeProcessData(ProcessDataEnumType.PlcData, msg) |     dConsole.writeProcessData(ProcessDataEnumType.PlcData, msg) | ||||||
|     const tempData = await PlcStrToJson(msg); |     const tempData = await PlcStrToJson(msg, this.plc2Data); | ||||||
|     tempData.sensor.rmndg = this.rmndg; |     tempData.sensor.rmndg = this.rmndg; | ||||||
|     tempData.sensor.mndg = this.mndgStr || ""; |     tempData.sensor.mndg = this.mndgStr || ""; | ||||||
|     const wuXiDataStr = await PlcStrToWXJson(msg) |     const wuXiDataStr = await PlcStrToWXJson(msg) | ||||||
|     // 无锡所数据记录 |     // 无锡所数据记录 | ||||||
|     dConsole.writeProcessData(ProcessDataEnumType.WuxiProgressData, wuXiDataStr) |     dConsole.writeProcessData(ProcessDataEnumType.WuxiProgressData, wuXiDataStr) | ||||||
|     this.plcData = tempData |     this.plcData = tempData | ||||||
|     this.tempData = tempData |  | ||||||
|     this.plcStr = msg; |     this.plcStr = msg; | ||||||
|     this.mndgStr = ''; |     this.mndgStr = ''; | ||||||
|     this.rmndg = 0; |     this.rmndg = 0; | ||||||
| @ -184,6 +185,7 @@ export default class JudgeBusiness { | |||||||
| 
 | 
 | ||||||
|     // dConsole.info("小红球过程数据1", this.judgeBusiness.getIsUdpEnd(), this.judgeUI.kfArr) |     // dConsole.info("小红球过程数据1", this.judgeBusiness.getIsUdpEnd(), this.judgeUI.kfArr) | ||||||
| 
 | 
 | ||||||
|  |     let startTime: Date = AppStorage.get("startTime") || new Date() | ||||||
| 
 | 
 | ||||||
|     DifferentialAndSignal.sendMsg({ |     DifferentialAndSignal.sendMsg({ | ||||||
|       type: WorkerMessageDataType.JudgeSend, data: { |       type: WorkerMessageDataType.JudgeSend, data: { | ||||||
| @ -193,7 +195,7 @@ export default class JudgeBusiness { | |||||||
|         business: { |         business: { | ||||||
|           totalScore: this.judgeUI.totalScore, |           totalScore: this.judgeUI.totalScore, | ||||||
|           kfArr: this.judgeUI.kfArr, |           kfArr: this.judgeUI.kfArr, | ||||||
|           startTime: this.judgeUI.udpStartTIme, |           startTime: dayTs(startTime).format("HHmmssSSS"), | ||||||
|           xmmcSingleCode: this.xmmcSingleCode, |           xmmcSingleCode: this.xmmcSingleCode, | ||||||
|           kmItems: this.kmItems, |           kmItems: this.kmItems, | ||||||
|           examTime: this.judgeUI.examTime, |           examTime: this.judgeUI.examTime, | ||||||
|  | |||||||
| @ -1,9 +1,9 @@ | |||||||
| import { JudgeConfig, JudgeTag } from '../../config'; | import { JudgeConfig, JudgeTag } from '../../config'; | ||||||
| import { | import { | ||||||
|  |   BaseInfoType, | ||||||
|   CAR_INFO, |   CAR_INFO, | ||||||
|   CarInfoType, |   CarInfoType, | ||||||
|   CDSBInfo, |   CDSBInfo, | ||||||
|   EnvironmentConfigurationType, |  | ||||||
|   ExaminerInfoType, |   ExaminerInfoType, | ||||||
|   ItemInfo, |   ItemInfo, | ||||||
|   ItemInfos, |   ItemInfos, | ||||||
| @ -21,7 +21,8 @@ import { | |||||||
|   ProjectInfos, |   ProjectInfos, | ||||||
|   RouteParamsType, |   RouteParamsType, | ||||||
|   SyssetConfig, |   SyssetConfig, | ||||||
|   SYSTEM_PARAM |   SYSTEM_PARAM, | ||||||
|  |   EnvironmentConfigurationType | ||||||
| } from '../../model'; | } from '../../model'; | ||||||
| import common from '@ohos.app.ability.common'; | import common from '@ohos.app.ability.common'; | ||||||
| import { dConsole } from '../../utils/LogWorker'; | import { dConsole } from '../../utils/LogWorker'; | ||||||
| @ -44,6 +45,126 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|     return super.getIsUdpEnd() |     return super.getIsUdpEnd() | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   private async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) { | ||||||
|  |     const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo') | ||||||
|  |     const examinerName = examinerInfo?.name || "" | ||||||
|  |     let currentParams: RouteParamsType = router.getParams() as RouteParamsType; | ||||||
|  |     const sczb = currentParams.sczb; | ||||||
|  |     const kfdm = currentParams.kfdm; | ||||||
|  |     const ksxm: JudgeKSXM[] = projects.map(project => { | ||||||
|  |       const temp: JudgeKSXM = { | ||||||
|  |         xmdm: Number(project.projectCode), xmxh: '' | ||||||
|  |       } | ||||||
|  |       return temp | ||||||
|  |     }) | ||||||
|  |     const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => { | ||||||
|  |       const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode) | ||||||
|  |       return Number(currentProject.projectCode) | ||||||
|  |     })) || []; | ||||||
|  |     const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => { | ||||||
|  |       return { | ||||||
|  |         xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1] | ||||||
|  |       } as JudgeKFXM | ||||||
|  |     })) : [] | ||||||
|  |     const beginInfo: JudgeBeginObj = { | ||||||
|  |       kgid: '012', | ||||||
|  |       kgxm: decodeURI(examinerName || ''), | ||||||
|  |       exam: isExam ? 1 : 0, | ||||||
|  |       //是否回放 | ||||||
|  |       replay: 0, | ||||||
|  |       //生成的轨迹文件 | ||||||
|  |       track: '', | ||||||
|  |       xm: name, | ||||||
|  |       sex: 0, | ||||||
|  |       kslsh: lsh, | ||||||
|  |       sfzmhm: idCard, | ||||||
|  |       ksyy: '', | ||||||
|  |       kscx: carType, | ||||||
|  |       kkcs: Number(kssycs) || 2, | ||||||
|  |       sfyk: 0, | ||||||
|  |       ykkkcs: 1, | ||||||
|  |       wayno: Number(wayno), | ||||||
|  |       czlx: 0, | ||||||
|  |       kskssj: await systemDateTime.getCurrentTime(), | ||||||
|  |       passing: Number(passingScore), | ||||||
|  |       ksxm, | ||||||
|  |       //断点续考 | ||||||
|  |       ddxk: isDdxk ? 1 : 0, | ||||||
|  |       ddkssj: ddxkTime || 0, | ||||||
|  |       ykxm, | ||||||
|  |       kfxm, | ||||||
|  |       yklc: 0, | ||||||
|  |       special: [], | ||||||
|  |       sczb: (sczb === undefined || sczb == '0') ? 0 : 1, | ||||||
|  |       sczbkf: kfdm, | ||||||
|  |       dmndg: this.mockLight, | ||||||
|  |       mfxx: this.mode === 5, | ||||||
|  |       zeng: this.mode === 3 || this.mode === 4 | ||||||
|  |     } | ||||||
|  |     dConsole.info(JudgeTag, '5.获取开始考试数据完成') | ||||||
|  |     return beginInfo | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   private async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { | ||||||
|  |     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||||
|  | 
 | ||||||
|  |     let allitems: ItemInfo[] = []; | ||||||
|  |     if (examSubject == '2' && itemInfoObj) { | ||||||
|  |       const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { | ||||||
|  |         const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); | ||||||
|  |         const model = await GetModelData(`/${cdsb.modelKey}.txt`, context); | ||||||
|  |         const temp: ItemInfo = { | ||||||
|  |           xmdm: cdsb?.xmdm || 0, | ||||||
|  |           xmxh: cdsb?.xmxh || "", | ||||||
|  |           model: model || "" | ||||||
|  |         }; | ||||||
|  |         return temp; | ||||||
|  |       }); | ||||||
|  |       // 等待所有的 Promise 解析完成 | ||||||
|  |       allitems = await Promise.all(promiseItems); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     const mark: MarkRule[] = Object.values(markRuleListObj) | ||||||
|  |     const initInfo: JudgeInitObj = { | ||||||
|  |       sdkver: await examJudgeVersion(), | ||||||
|  |       appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "", | ||||||
|  |       kskm: Number(carInfo?.examSubject || "2"), | ||||||
|  |       kchp: carInfo?.plateNo || "", | ||||||
|  |       kchm: Number(carInfo?.carId || ""), | ||||||
|  |       kscx: carType, | ||||||
|  |       cxcode: '1', | ||||||
|  |       name: carName, | ||||||
|  |       carmodel: await GetModelData(`/${carType}.txt`, context) || "", | ||||||
|  |       allitems, | ||||||
|  |       iteminfo: [], | ||||||
|  |       systemparm: systemparmArr, | ||||||
|  |       mark, | ||||||
|  |       sysset: judgeConfig, | ||||||
|  |       itemInfoObj, | ||||||
|  |       carlist: carlist, | ||||||
|  |       carinfo: carinfoArr, | ||||||
|  |     }; | ||||||
|  |     let km3Config: Km3JudgeInitConfig = {} | ||||||
|  |     if (examSubject == '3') { | ||||||
|  |       km3Config = { | ||||||
|  |         map_point: mapPointArr, | ||||||
|  |         map_point_item: mapPointItemArr, | ||||||
|  |         //科目三暂时为空 | ||||||
|  |         iteminfo: [], | ||||||
|  |         roads: await GetModelData('/Roads.txt', context) || "", | ||||||
|  |         sharps: await GetModelData('/Sharps.txt', context) || "" | ||||||
|  |       }; | ||||||
|  |       initInfo.map_point = km3Config.map_point | ||||||
|  |       initInfo.map_point_item = km3Config.map_point_item | ||||||
|  |       initInfo.iteminfo = km3Config.iteminfo | ||||||
|  |       initInfo.roads = km3Config.roads | ||||||
|  |       initInfo.sharps = km3Config.sharps | ||||||
|  |     } | ||||||
|  |     // 获取科目三的评判配置 | ||||||
|  |     dConsole.info(JudgeTag, '3.获取评判初始化数据完成') | ||||||
|  |     return initInfo | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|   public async JudgeInit(judgeUI: JudgePage, that: JudgeBusiness): Promise<GetSysSetResult> { |   public async JudgeInit(judgeUI: JudgePage, that: JudgeBusiness): Promise<GetSysSetResult> { | ||||||
|     const systemParams = await GetSyncData<SYSTEM_PARAM>('MA_SYSTEMPARM') |     const systemParams = await GetSyncData<SYSTEM_PARAM>('MA_SYSTEMPARM') | ||||||
|     let currentParams: RouteParamsType = router.getParams() as RouteParamsType; |     let currentParams: RouteParamsType = router.getParams() as RouteParamsType; | ||||||
| @ -121,14 +242,14 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|     systemParams.forEach((systemParam) => { |     systemParams.forEach((systemParam) => { | ||||||
|       // if (isTrajectoryOpen) { |       if (JudgeConfig.isTrajectoryOpen) { | ||||||
|       //   systemParam.no1 = systemParam.NO1; |         systemParam.no1 = systemParam.NO1!.toString()!; | ||||||
|       //   systemParam.no2 = systemParam.NO2; |         systemParam.no2 = systemParam.NO2!.toString()!; | ||||||
|       //   systemParam.no3 = systemParam.NO3; |         systemParam.no3 = systemParam.NO3!.toString()!; | ||||||
|       //   systemParam.txt1 = systemParam.TXT1; |         systemParam.txt1 = systemParam.TXT1!; | ||||||
|       //   systemParam.txt2 = systemParam.TXT2; |         systemParam.txt2 = systemParam.TXT2!; | ||||||
|       //   systemParam.txt3 = systemParam.TXT3; |         systemParam.txt3 = systemParam.TXT3!; | ||||||
|       // } |       } | ||||||
|       const no1 = systemParam.no1; |       const no1 = systemParam.no1; | ||||||
|       const no2 = systemParam.no2; |       const no2 = systemParam.no2; | ||||||
|       const no3 = systemParam.no3; |       const no3 = systemParam.no3; | ||||||
| @ -344,128 +465,5 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|     super.judgeEnd(judgeUI, that, isManual) |     super.judgeEnd(judgeUI, that, isManual) | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   private async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) { |  | ||||||
|     const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo') |  | ||||||
|     const examinerName = examinerInfo?.name || "" |  | ||||||
|     let currentParams: RouteParamsType = router.getParams() as RouteParamsType; |  | ||||||
|     const sczb = currentParams.sczb; |  | ||||||
|     const kfdm = currentParams.kfdm; |  | ||||||
|     const ksxm: JudgeKSXM[] = projects.map(project => { |  | ||||||
|       const temp: JudgeKSXM = { |  | ||||||
|         xmdm: Number(project.projectCode), xmxh: '' |  | ||||||
|       } |  | ||||||
|       return temp |  | ||||||
|     }) |  | ||||||
|     const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => { |  | ||||||
|       const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode) |  | ||||||
|       return Number(currentProject.projectCode) |  | ||||||
|     })) || []; |  | ||||||
|     const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => { |  | ||||||
|       return { |  | ||||||
|         xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1] |  | ||||||
|       } as JudgeKFXM |  | ||||||
|     })) : [] |  | ||||||
|     const beginInfo: JudgeBeginObj = { |  | ||||||
|       kgid: '012', |  | ||||||
|       kgxm: decodeURI(examinerName || ''), |  | ||||||
|       exam: isExam ? 1 : 0, |  | ||||||
|       //是否回放 |  | ||||||
|       replay: 0, |  | ||||||
|       //生成的轨迹文件 |  | ||||||
|       track: '', |  | ||||||
|       xm: name, |  | ||||||
|       sex: 0, |  | ||||||
|       kslsh: lsh, |  | ||||||
|       sfzmhm: idCard, |  | ||||||
|       ksyy: '', |  | ||||||
|       kscx: carType, |  | ||||||
|       kkcs: Number(kssycs) || 2, |  | ||||||
|       sfyk: 0, |  | ||||||
|       ykkkcs: 1, |  | ||||||
|       wayno: Number(wayno), |  | ||||||
|       czlx: 0, |  | ||||||
|       kskssj: await systemDateTime.getCurrentTime(), |  | ||||||
|       passing: Number(passingScore), |  | ||||||
|       ksxm, |  | ||||||
|       //断点续考 |  | ||||||
|       ddxk: isDdxk ? 1 : 0, |  | ||||||
|       ddkssj: ddxkTime || 0, |  | ||||||
|       ykxm, |  | ||||||
|       kfxm, |  | ||||||
|       yklc: 0, |  | ||||||
|       special: [], |  | ||||||
|       sczb: (sczb === undefined || sczb == '0') ? 0 : 1, |  | ||||||
|       sczbkf: kfdm, |  | ||||||
|       dmndg: this.mockLight, |  | ||||||
|       mfxx: this.mode === 5, |  | ||||||
|       mfxxn: this.mode === 3 || this.mode === 4 |  | ||||||
|     } |  | ||||||
|     dConsole.info(JudgeTag, '5.获取开始考试数据完成') |  | ||||||
|     return beginInfo |  | ||||||
|   }; |  | ||||||
| 
 | 
 | ||||||
|   private async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { |  | ||||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); |  | ||||||
|     const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3' |  | ||||||
| 
 |  | ||||||
|     let allitems: ItemInfo[] = []; |  | ||||||
|     if (examSubject == '2' && itemInfoObj) { |  | ||||||
|       const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { |  | ||||||
|         const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); |  | ||||||
|         const model = await GetModelData(`/${cdsb.modelKey}.txt`, context); |  | ||||||
|         const temp: ItemInfo = { |  | ||||||
|           xmdm: cdsb?.xmdm || 0, |  | ||||||
|           xmxh: cdsb?.xmxh || "", |  | ||||||
|           model: model || "" |  | ||||||
|         }; |  | ||||||
|         return temp; |  | ||||||
|       }); |  | ||||||
|       // 等待所有的 Promise 解析完成 |  | ||||||
|       allitems = await Promise.all(promiseItems); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     //获取版本号 |  | ||||||
|     const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => { |  | ||||||
|       const current: MarkRule = Reflect.get(markRuleListObj, ruleKey) |  | ||||||
|       return current |  | ||||||
|     }) |  | ||||||
|     const initInfo: JudgeInitObj = { |  | ||||||
|       sdkver: await examJudgeVersion(), |  | ||||||
|       appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "", |  | ||||||
|       kskm: Number(carInfo?.examSubject || "2"), |  | ||||||
|       kchp: carInfo?.plateNo || "", |  | ||||||
|       kchm: Number(carInfo?.carId || ""), |  | ||||||
|       kscx: carType, |  | ||||||
|       cxcode: '1', |  | ||||||
|       name: carName, |  | ||||||
|       carmodel: await GetModelData(`/${carType}.txt`, context) || "", |  | ||||||
|       allitems, |  | ||||||
|       iteminfo: [], |  | ||||||
|       systemparm: systemparmArr, |  | ||||||
|       mark, |  | ||||||
|       sysset: judgeConfig, |  | ||||||
|       itemInfoObj, |  | ||||||
|       carlist: carlist, |  | ||||||
|       carinfo: carinfoArr, |  | ||||||
|     }; |  | ||||||
|     let km3Config: Km3JudgeInitConfig = {} |  | ||||||
|     if (examSubject == '3') { |  | ||||||
|       km3Config = { |  | ||||||
|         map_point: mapPointArr, |  | ||||||
|         map_point_item: mapPointItemArr, |  | ||||||
|         //科目三暂时为空 |  | ||||||
|         iteminfo: [], |  | ||||||
|         roads: await GetModelData('/Roads.txt', context) || "", |  | ||||||
|         sharps: await GetModelData('/Sharps.txt', context) || "" |  | ||||||
|       }; |  | ||||||
|       initInfo.map_point = km3Config.map_point |  | ||||||
|       initInfo.map_point_item = km3Config.map_point_item |  | ||||||
|       initInfo.iteminfo = km3Config.iteminfo |  | ||||||
|       initInfo.roads = km3Config.roads |  | ||||||
|       initInfo.sharps = km3Config.sharps |  | ||||||
|     } |  | ||||||
|     // 获取科目三的评判配置 |  | ||||||
|     dConsole.info(JudgeTag, '3.获取评判初始化数据完成') |  | ||||||
|     return initInfo |  | ||||||
|   }; |  | ||||||
| } | } | ||||||
| @ -94,7 +94,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|       sczbkf: kfdm, |       sczbkf: kfdm, | ||||||
|       dmndg: false, |       dmndg: false, | ||||||
|       mfxx: false, |       mfxx: false, | ||||||
|       mfxxn: false |       zeng: false | ||||||
|     } |     } | ||||||
|     dConsole.info(JudgeTag, '5.获取开始考试数据完成') |     dConsole.info(JudgeTag, '5.获取开始考试数据完成') | ||||||
|     return beginInfo |     return beginInfo | ||||||
| @ -102,7 +102,6 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
| 
 | 
 | ||||||
|   public async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { |   public async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { | ||||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); |     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||||
|     const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3' |  | ||||||
|     dConsole.log(JudgeTag, "itemInfoObj", itemInfoObj) |     dConsole.log(JudgeTag, "itemInfoObj", itemInfoObj) | ||||||
|     let allitems: ItemInfo[] = []; |     let allitems: ItemInfo[] = []; | ||||||
|     if (examSubject == '2' && itemInfoObj) { |     if (examSubject == '2' && itemInfoObj) { | ||||||
| @ -121,11 +120,6 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|       allitems = await Promise.all(promiseItems); |       allitems = await Promise.all(promiseItems); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //获取版本号 |  | ||||||
|     // const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => { |  | ||||||
|     //   const current: MarkRule = Reflect.get(markRuleListObj, ruleKey) |  | ||||||
|     //   return current |  | ||||||
|     // }) |  | ||||||
|     const mark: MarkRule[] = Object.values(markRuleListObj) |     const mark: MarkRule[] = Object.values(markRuleListObj) | ||||||
|     const initInfo: JudgeInitObj = { |     const initInfo: JudgeInitObj = { | ||||||
|       sdkver: await examJudgeVersion(), |       sdkver: await examJudgeVersion(), | ||||||
| @ -329,7 +323,6 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public async JudgeEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { |   public async JudgeEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { | ||||||
|     dConsole.info(JudgeTag, '收到远程结束考试消息2') |  | ||||||
|     super.judgeEnd(judgeUI, that, isManual) |     super.judgeEnd(judgeUI, that, isManual) | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  | |||||||
| @ -468,8 +468,9 @@ export function UploadRegulatoryCodeConversion( | |||||||
| /** | /** | ||||||
|  * 将PLC字符串转换为JSON对象 |  * 将PLC字符串转换为JSON对象 | ||||||
|  */ |  */ | ||||||
| export const PlcStrToJson = async (plc: string) => { | export const PlcStrToJson = async (plc: string, plc2?: string) => { | ||||||
|   const plcArr = plc.split(',') |   const plcArr = plc.split(',') | ||||||
|  |   const plc2Arr = plc2?.split(",") || [] | ||||||
|   const p = plcArr.map((val, key) => { |   const p = plcArr.map((val, key) => { | ||||||
|     if (key !== 27 && key !== 92) { |     if (key !== 27 && key !== 92) { | ||||||
|       return Number(val); |       return Number(val); | ||||||
| @ -477,6 +478,16 @@ export const PlcStrToJson = async (plc: string) => { | |||||||
|       return 0; // 或者返回 undefined,根据需求选择 |       return 0; // 或者返回 undefined,根据需求选择 | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
|  |   let gps2p: number[] = [] | ||||||
|  |   if (plc2) { | ||||||
|  |     gps2p = plc2Arr.map((val, key) => { | ||||||
|  |       if (key !== 27 && key !== 92) { | ||||||
|  |         return Number(val); | ||||||
|  |       } else { | ||||||
|  |         return 0; // 或者返回 undefined,根据需求选择 | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|   const time = await systemTime.getCurrentTime() |   const time = await systemTime.getCurrentTime() | ||||||
|   const gps2: Gps = TestRealExam.gps2 |   const gps2: Gps = TestRealExam.gps2 | ||||||
|   const radar: Radar = TestRealExam.radar |   const radar: Radar = TestRealExam.radar | ||||||
| @ -553,7 +564,30 @@ export const PlcStrToJson = async (plc: string) => { | |||||||
|       // 角度搜星数 |       // 角度搜星数 | ||||||
|       jdsxs: Number(plcArr[92].split('-')[1]) || 0 |       jdsxs: Number(plcArr[92].split('-')[1]) || 0 | ||||||
|     }, |     }, | ||||||
|     gps2: gps2, |     gps2: plc2 ? { | ||||||
|  |       //办卡类型    定位差分状态 | ||||||
|  |       bklx: gps2p[56], | ||||||
|  |       dwzt: gps2p[83], | ||||||
|  |       // 角度差分状态 | ||||||
|  |       jdzt: Number(plc2Arr[92].split('-')[0]), | ||||||
|  |       //gps数据 | ||||||
|  |       //gps时间 经度      纬度       航向角      俯仰角      海拔高       高度差     速度 | ||||||
|  |       sj: time, | ||||||
|  |       jd: gps2p[96], | ||||||
|  |       wd: gps2p[95], | ||||||
|  |       hxj: gps2p[90], | ||||||
|  |       fyj: gps2p[91], | ||||||
|  |       hbg: gps2p[85], | ||||||
|  |       gdc: gps2p[86], | ||||||
|  |       sd: gps2p[97], | ||||||
|  |       //龄期      经度因子     纬度因子      定位搜星数 | ||||||
|  |       age: gps2p[87], | ||||||
|  |       jdyz: gps2p[89], | ||||||
|  |       wdyz: gps2p[88], | ||||||
|  |       dwsxs: gps2p[84] || 0, | ||||||
|  |       // 角度搜星数 | ||||||
|  |       jdsxs: Number(plc2Arr[92].split('-')[1]) || 0 | ||||||
|  |     } : gps2, | ||||||
|     vision, |     vision, | ||||||
|     radar, |     radar, | ||||||
|     extend |     extend | ||||||
|  | |||||||
| @ -93,6 +93,15 @@ struct TerminalInfoPage { | |||||||
|                   this.config.udpOppositeIp = value; |                   this.config.udpOppositeIp = value; | ||||||
|                 } |                 } | ||||||
|               }) |               }) | ||||||
|  |               if (this.config.carType === "4") { | ||||||
|  |                 blockComponent({ | ||||||
|  |                   label: "后置机2IP", | ||||||
|  |                   value: this.config.udpOppositeIpTwo, | ||||||
|  |                   change: (value: string) => { | ||||||
|  |                     this.config.udpOppositeIpTwo = value; | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|  |               } | ||||||
|               blockComponent({ |               blockComponent({ | ||||||
|                 label: "后置机响应端口", |                 label: "后置机响应端口", | ||||||
|                 value: this.config.udpOppositeIpPort, |                 value: this.config.udpOppositeIpPort, | ||||||
| @ -102,7 +111,7 @@ struct TerminalInfoPage { | |||||||
|               }) |               }) | ||||||
|               if (this.config.carType === "4") { |               if (this.config.carType === "4") { | ||||||
|                 blockComponent({ |                 blockComponent({ | ||||||
|                   label: "后置机响应端口2", |                   label: "后置机2响应端口", | ||||||
|                   value: this.config.udpOppositeIpPortTwo, |                   value: this.config.udpOppositeIpPortTwo, | ||||||
|                   change: (value: string) => { |                   change: (value: string) => { | ||||||
|                     this.config.udpOppositeIpPortTwo = value; |                     this.config.udpOppositeIpPortTwo = value; | ||||||
|  | |||||||
| @ -987,6 +987,8 @@ struct UserInfoPage { | |||||||
|       this.startExamDialogController.close() |       this.startExamDialogController.close() | ||||||
|       return { code: -200 } |       return { code: -200 } | ||||||
|     } |     } | ||||||
|  |     let startTime = new Date() | ||||||
|  |     AppStorage.setOrCreate("startTime", startTime) | ||||||
|     const drvexam: DrvexamType = { |     const drvexam: DrvexamType = { | ||||||
|       lsh: this.currentUser.lsh, |       lsh: this.currentUser.lsh, | ||||||
|       kskm: this.carInfo.examSubject, |       kskm: this.carInfo.examSubject, | ||||||
| @ -995,7 +997,7 @@ struct UserInfoPage { | |||||||
|       ksysfzmhm: this.currentUser.ksy1sfzmhm || '', |       ksysfzmhm: this.currentUser.ksy1sfzmhm || '', | ||||||
|       ksxl: this.currentUser.xldm, |       ksxl: this.currentUser.xldm, | ||||||
|       zp: photoBase64, |       zp: photoBase64, | ||||||
|       kssj: dayTs().format("YYYY-MM-DD HH:mm:ss") || '', |       kssj: dayTs(startTime).format("YYYY-MM-DD HH:mm:ss") || '', | ||||||
|       kchp: decodeURI(this.carInfo.plateNo || ""), |       kchp: decodeURI(this.carInfo.plateNo || ""), | ||||||
|       Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || '' |       Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || '' | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -45,8 +45,7 @@ class JudgeUdpBusiness { | |||||||
|     return JudgeUdpBusiness.instance |     return JudgeUdpBusiness.instance | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getMessageHeartbeat(msg: string): Promise<number[]> { |   async getMessageHeartbeat(msg: string, gps2?: string): Promise<number[]> { | ||||||
|     // dConsole.info(Tag, msg, this.lsh) |  | ||||||
|     if (!this.business || !this.performInfo) { |     if (!this.business || !this.performInfo) { | ||||||
|       return this.getOBDMessageHeart(msg) |       return this.getOBDMessageHeart(msg) | ||||||
|     } |     } | ||||||
| @ -60,6 +59,7 @@ class JudgeUdpBusiness { | |||||||
|     const ascsbxhArr = StringToASCII(this.getSbxh(this.business.xmdm, this.business.xmxh)) |     const ascsbxhArr = StringToASCII(this.getSbxh(this.business.xmdm, this.business.xmxh)) | ||||||
| 
 | 
 | ||||||
|     const plcData = await this.getPlcData(msg); |     const plcData = await this.getPlcData(msg); | ||||||
|  |     const plc2Data = await this.getPlcData(gps2 || "") | ||||||
|     let param: number[] = [plcData.sensor.zfxd, plcData.sensor.yfxd, plcData.sensor.shtd, plcData.sensor.ygd, plcData.sensor.jgd, plcData.sensor.skd, plcData.sensor.dh1, plcData.sensor.dh2, plcData.sensor.lhq, plcData.sensor.jsc, plcData.sensor.ssc, plcData.sensor.fsc, plcData.sensor.lb, plcData.sensor.mkg, plcData.sensor.aqd] |     let param: number[] = [plcData.sensor.zfxd, plcData.sensor.yfxd, plcData.sensor.shtd, plcData.sensor.ygd, plcData.sensor.jgd, plcData.sensor.skd, plcData.sensor.dh1, plcData.sensor.dh2, plcData.sensor.lhq, plcData.sensor.jsc, plcData.sensor.ssc, plcData.sensor.fsc, plcData.sensor.lb, plcData.sensor.mkg, plcData.sensor.aqd] | ||||||
|       .concat(GetDwStatusType(plcData.sensor.dw)) |       .concat(GetDwStatusType(plcData.sensor.dw)) | ||||||
|       .concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0]) |       .concat([0, 0, plcData.sensor.ygq, plcData.sensor.wd, 0]) | ||||||
| @ -67,6 +67,13 @@ class JudgeUdpBusiness { | |||||||
|     const translateProject = this.getTranslateProject(1); |     const translateProject = this.getTranslateProject(1); | ||||||
|     const translateJd = Number(this.convertGpsCoord2(plcData.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit); |     const translateJd = Number(this.convertGpsCoord2(plcData.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit); | ||||||
|     const translateWd = Number(this.convertGpsCoord2(plcData.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit) |     const translateWd = Number(this.convertGpsCoord2(plcData.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit) | ||||||
|  |     let translateGps2Jd: number = 0 | ||||||
|  |     let translateGps2Wd: number = 0 | ||||||
|  |     if (gps2) { | ||||||
|  |       translateGps2Jd = Number(this.convertGpsCoord2(plc2Data.gps.wd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit); | ||||||
|  |       translateGps2Wd = Number(this.convertGpsCoord2(plc2Data.gps.jd).toFixed(gpsDigit)) * Math.pow(10, gpsDigit) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const translateProjects = translateProject.map(numStr => NumberToByteArray(parseInt(numStr, 2), 8)[0]) |     const translateProjects = translateProject.map(numStr => NumberToByteArray(parseInt(numStr, 2), 8)[0]) | ||||||
|     let tempSd = Number((plcData.gps.sd * 1.852).toFixed(0)) |     let tempSd = Number((plcData.gps.sd * 1.852).toFixed(0)) | ||||||
|     if (tempSd < 1) { |     if (tempSd < 1) { | ||||||
| @ -114,10 +121,13 @@ class JudgeUdpBusiness { | |||||||
|       NumberToByteArray(this.business.kfArr.length, 8), |       NumberToByteArray(this.business.kfArr.length, 8), | ||||||
|       //n个扣分序号 |       //n个扣分序号 | ||||||
|       this.business.kfArr.map(kf => NumberToByteArray(kf.kfxh!, 8)[0]), |       this.business.kfArr.map(kf => NumberToByteArray(kf.kfxh!, 8)[0]), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|       //牵引车第二gps精度、纬度 |       //牵引车第二gps精度、纬度 | ||||||
|       NumberToByteArray(0, 4 * 8), NumberToByteArray(0, 4 * 8), |       NumberToByteArray(translateGps2Jd, 4 * 8), | ||||||
|  |       NumberToByteArray(translateGps2Wd, 4 * 8), | ||||||
|       //牵引车第二航向角 |       //牵引车第二航向角 | ||||||
|       NumberToByteArray(0, 2 * 8), |       NumberToByteArray(plc2Data?.gps?.hxj || 0, 2 * 8), | ||||||
|       //摩托压线 Byte[20], |       //摩托压线 Byte[20], | ||||||
|       NumberToByteArray(0, 20 * 8), |       NumberToByteArray(0, 20 * 8), | ||||||
|       //考试用时 |       //考试用时 | ||||||
|  | |||||||
| @ -6,14 +6,17 @@ import UdpClient from '../UdpUtils' | |||||||
| class ObtainUdpBusiness { | class ObtainUdpBusiness { | ||||||
|   // 三代机UDP |   // 三代机UDP | ||||||
|   private thirdGenerationMachineUdp?: UdpClient |   private thirdGenerationMachineUdp?: UdpClient | ||||||
|  |   private thirdGenerationMachineUdpGps2?: UdpClient | ||||||
|   // 几代机 |   // 几代机 | ||||||
|   private modelNo: string = "3" |   private modelNo: string = "3" | ||||||
|  |   private config?: EnvironmentConfigurationType | ||||||
| 
 | 
 | ||||||
|   constructor() { |   constructor() { | ||||||
|     this.modelNo = GlobalConfig.modelNo || "" |     this.modelNo = GlobalConfig.modelNo || "" | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   init(config: EnvironmentConfigurationType) { |   init(config: EnvironmentConfigurationType) { | ||||||
|  |     this.config = config | ||||||
|     switch (this.modelNo) { |     switch (this.modelNo) { | ||||||
|       case "0": |       case "0": | ||||||
|         this.initSecondaryBoard() |         this.initSecondaryBoard() | ||||||
| @ -52,6 +55,25 @@ class ObtainUdpBusiness { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   onGps2Msg(callback: (data: string) => void) { | ||||||
|  |     switch (this.modelNo) { | ||||||
|  |       case "0": | ||||||
|  |         this.onSecondaryBoardMsg(callback) | ||||||
|  |         break | ||||||
|  |       case "1": | ||||||
|  |         this.onFirstGenerationMsg(callback) | ||||||
|  |         break | ||||||
|  |       case "2": | ||||||
|  |         this.onSecondGenerationMsg(callback) | ||||||
|  |         break | ||||||
|  |       case "3": | ||||||
|  |         this.onThirdGenerationGps2Msg(callback) | ||||||
|  |         break | ||||||
|  |       default: | ||||||
|  |         break | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   offMsg(cb: Function) { |   offMsg(cb: Function) { | ||||||
|     switch (this.modelNo) { |     switch (this.modelNo) { | ||||||
|       case "0": |       case "0": | ||||||
| @ -61,7 +83,23 @@ class ObtainUdpBusiness { | |||||||
|       case "2": |       case "2": | ||||||
|         break |         break | ||||||
|       case "3": |       case "3": | ||||||
|         this.thirdGenerationMachineUdp!.offMsg(cb) |         this.thirdGenerationMachineUdpGps2!.offMsg(cb) | ||||||
|  |         break | ||||||
|  |       default: | ||||||
|  |         break | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   offGps2Msg(cb: Function) { | ||||||
|  |     switch (this.modelNo) { | ||||||
|  |       case "0": | ||||||
|  |         break | ||||||
|  |       case "1": | ||||||
|  |         break | ||||||
|  |       case "2": | ||||||
|  |         break | ||||||
|  |       case "3": | ||||||
|  |         this.thirdGenerationMachineUdpGps2!.offMsg(cb) | ||||||
|         break |         break | ||||||
|       default: |       default: | ||||||
|         break |         break | ||||||
| @ -99,6 +137,7 @@ class ObtainUdpBusiness { | |||||||
|         break |         break | ||||||
|       case "3": |       case "3": | ||||||
|         this.thirdGenerationMachineUdp!.close() |         this.thirdGenerationMachineUdp!.close() | ||||||
|  |         this.thirdGenerationMachineUdpGps2?.close() | ||||||
|         break |         break | ||||||
|       default: |       default: | ||||||
|         break |         break | ||||||
| @ -120,8 +159,6 @@ class ObtainUdpBusiness { | |||||||
|   // 三代机udp初始化 |   // 三代机udp初始化 | ||||||
|   private initThirdGeneration(config: EnvironmentConfigurationType) { |   private initThirdGeneration(config: EnvironmentConfigurationType) { | ||||||
|     try { |     try { | ||||||
|       // let config: EnvironmentConfigurationType = |  | ||||||
|       //   AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")! |  | ||||||
|       console.log("获取udp设置", JSON.stringify(config)) |       console.log("获取udp设置", JSON.stringify(config)) | ||||||
|       this.thirdGenerationMachineUdp = new UdpClient() |       this.thirdGenerationMachineUdp = new UdpClient() | ||||||
|       this.thirdGenerationMachineUdp.create(config.udplocalIp!, config.udplocalIpPort!, config.udpOppositeIp!, |       this.thirdGenerationMachineUdp.create(config.udplocalIp!, config.udplocalIpPort!, config.udpOppositeIp!, | ||||||
| @ -130,6 +167,11 @@ class ObtainUdpBusiness { | |||||||
|     } catch (e) { |     } catch (e) { | ||||||
|       console.error(UDPTag, "三代机 udp失败") |       console.error(UDPTag, "三代机 udp失败") | ||||||
|     } |     } | ||||||
|  |     if (config.carType === "4") { | ||||||
|  |       this.thirdGenerationMachineUdpGps2 = new UdpClient() | ||||||
|  |       this.thirdGenerationMachineUdpGps2.create(config.udplocalIp!, config.udplocalIpPortTwo!, config.udpOppositeIpTwo!, config.udpOppositeIpPortTwo!) | ||||||
|  |       this.thirdGenerationMachineUdpGps2.setDealMethod(this.dealThirdGenerationMsg) | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   private dealSecondaryBoardMsg() { |   private dealSecondaryBoardMsg() { | ||||||
| @ -176,6 +218,10 @@ class ObtainUdpBusiness { | |||||||
|     this.thirdGenerationMachineUdp!.onMsg(cb) |     this.thirdGenerationMachineUdp!.onMsg(cb) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   private onThirdGenerationGps2Msg(cb: Function) { | ||||||
|  |     this.thirdGenerationMachineUdpGps2!.onMsg(cb) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   private sendSecondaryBoardMsg(data: string | ArrayBuffer) { |   private sendSecondaryBoardMsg(data: string | ArrayBuffer) { | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
| @ -190,6 +236,9 @@ class ObtainUdpBusiness { | |||||||
| 
 | 
 | ||||||
|   private sendThirdGenerationMsg(data: string | ArrayBuffer) { |   private sendThirdGenerationMsg(data: string | ArrayBuffer) { | ||||||
|     this.thirdGenerationMachineUdp!.sendMsg(data) |     this.thirdGenerationMachineUdp!.sendMsg(data) | ||||||
|  |     if (this.config?.carType === '4') { | ||||||
|  |       this.thirdGenerationMachineUdpGps2!.sendMsg(data) | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -29,6 +29,7 @@ let udpLsh = 1 | |||||||
| let udpIndex = 0 | let udpIndex = 0 | ||||||
| let kfDirective: number | undefined = undefined | let kfDirective: number | undefined = undefined | ||||||
| let signNum: number = 0 | let signNum: number = 0 | ||||||
|  | let gps2: string | undefined = undefined | ||||||
| 
 | 
 | ||||||
| function checkLsh() { | function checkLsh() { | ||||||
|   let now = dayTs(new Date()).format().split(" ")[0] |   let now = dayTs(new Date()).format().split(" ")[0] | ||||||
| @ -88,6 +89,9 @@ workerPort.onmessage = async (e: MessageEvents) => { | |||||||
| 
 | 
 | ||||||
| // 初始化函数 | // 初始化函数 | ||||||
| function initFn(result: InitData) { | function initFn(result: InitData) { | ||||||
|  |   if (result.config?.carType === '4') { | ||||||
|  | 
 | ||||||
|  |   } | ||||||
|   // 初始化差分校正TCP |   // 初始化差分校正TCP | ||||||
|   DifferentialSignal.init(result.config!); |   DifferentialSignal.init(result.config!); | ||||||
|   // 定时发送TCP消息 |   // 定时发送TCP消息 | ||||||
| @ -136,7 +140,7 @@ function getDataFn(config: EnvironmentConfigurationType) { | |||||||
|       } |       } | ||||||
|       if (udpIndex % 5 === 0) { |       if (udpIndex % 5 === 0) { | ||||||
|         checkLsh() |         checkLsh() | ||||||
|         let byte = await JudgeUdpBusinessInstance.getMessageHeartbeat(data) |         let byte = await JudgeUdpBusinessInstance.getMessageHeartbeat(data, gps2) | ||||||
|         JudgeUdpBusinessInstance.sendData(byte, udpLsh) |         JudgeUdpBusinessInstance.sendData(byte, udpLsh) | ||||||
|       } |       } | ||||||
|       udpIndex++ |       udpIndex++ | ||||||
| @ -148,6 +152,28 @@ function getDataFn(config: EnvironmentConfigurationType) { | |||||||
|         } as WorkerBackMessage)) |         } as WorkerBackMessage)) | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|  |   if (config.carType === '4') { | ||||||
|  |     ObtainUdpBusinessInstance.onGps2Msg(async (data: string) => { | ||||||
|  |       if (data !== "" && config.carType !== "2") { | ||||||
|  |         try { | ||||||
|  |           const res = await SerialPortService.getData() | ||||||
|  |           if (res.length > 0) { | ||||||
|  |             const dataArray = data.split(","); | ||||||
|  |             dataArray[28] = res[9].toString(); | ||||||
|  |             data = dataArray.join(","); | ||||||
|  |           } | ||||||
|  |         } catch (err) { | ||||||
|  |           console.error(SerialPortTag, "获取档位信号失败", err) | ||||||
|  |         } | ||||||
|  |         gps2 = data | ||||||
|  |         workerPort.postMessage( | ||||||
|  |           JSON.stringify({ | ||||||
|  |             type: WorkerBackMessageType.ObtainUdpGps2Data, | ||||||
|  |             data: data | ||||||
|  |           } as WorkerBackMessage)) | ||||||
|  |       } | ||||||
|  |     }) | ||||||
|  |   } | ||||||
|   // 中心UDP回执消息 |   // 中心UDP回执消息 | ||||||
|   CenterUDPBusinessInstance.onMsg((data: CenterCallBackMsgType) => { |   CenterUDPBusinessInstance.onMsg((data: CenterCallBackMsgType) => { | ||||||
|     // TODO |     // TODO | ||||||
|  | |||||||
| @ -1,20 +1,18 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 1, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": { |   "specifiers": { | ||||||
|     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", |     "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", | ||||||
|     "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3" |     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" | ||||||
|   }, |   }, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "@ohos/hypium@1.0.19": { |  | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", |  | ||||||
|       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", |  | ||||||
|       "registryType": "ohpm" |  | ||||||
|     }, |  | ||||||
|     "@ohos/crypto-js@2.0.3": { |     "@ohos/crypto-js@2.0.3": { | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", | ||||||
|       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", |       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==" | ||||||
|       "registryType": "ohpm" |     }, | ||||||
|  |     "@ohos/hypium@1.0.19": { | ||||||
|  |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", | ||||||
|  |       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user