fix: 优化代码格式,统一空格和分号使用
This commit is contained in:
		
							parent
							
								
									fca24538d0
								
							
						
					
					
						commit
						6984855346
					
				| @ -2,7 +2,7 @@ import common from '@ohos.app.ability.common'; | ||||
| // ------------------------------ | ||||
| // 基础共用类型 | ||||
| // ------------------------------ | ||||
| import { MA_SYSTEMPARMType } from './Table' | ||||
| import { MA_SYSTEMPARMType } from './Table'; | ||||
| 
 | ||||
| /** 基础考试字段 */ | ||||
| interface BaseExamFields { | ||||
| @ -214,9 +214,9 @@ export interface Plc { | ||||
|   extend: object | ||||
|   //轨迹回放需要 | ||||
|   method?: string | ||||
|   itemno: string | ||||
|   type: 1 | 2 | ||||
|   serial: 1 | 2 | ||||
|   itemno?: string | ||||
|   type?: 1 | 2 | ||||
|   serial?: 1 | 2 | ||||
| } | ||||
| 
 | ||||
| interface Qfsj { | ||||
| @ -381,7 +381,7 @@ export interface MarkRule { | ||||
|   score?: number | ||||
|   xmmcStr?: string | ||||
|   desc?: string | ||||
|   type?: 0|1|2 | ||||
|   type?: 0 | 1 | 2 | ||||
| } | ||||
| 
 | ||||
| export interface UploadExamMileage { | ||||
| @ -677,12 +677,12 @@ export interface JudgeEventKf { | ||||
|   nocancelid?: number | ||||
|   NoCancelId?: number | ||||
|   gps_sid?: number, | ||||
|   GPS_SID?:boolean | ||||
|   score?:number | ||||
|   GPS_SID?: boolean | ||||
|   score?: number | ||||
|   xmmcStr?: string | ||||
|   desc?: string | ||||
|   xmdm?: number | ||||
|   type?: 0 | 1 | 2 |3 | ||||
|   type?: 0 | 1 | 2 | 3 | ||||
| } | ||||
| 
 | ||||
| export interface JudgeKsjs { | ||||
| @ -719,54 +719,55 @@ export interface JudgeNongps { | ||||
|   type: 0 | 1 | 2 | 3 | 4 | ||||
| } | ||||
| 
 | ||||
| interface UdpKf{ | ||||
|   kfxh:string | ||||
|   directives:string | ||||
| interface UdpKf { | ||||
|   kfxh: string | ||||
|   directives: string | ||||
| } | ||||
| 
 | ||||
| export interface JudgeUdpKf { | ||||
|   data:UdpKf | ||||
|   data: UdpKf | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| export interface JudgePerformInfo { | ||||
|   time: number | ||||
|   carzt:-1 | 0 |1 | ||||
|   grade:number | ||||
|   qjjl:number | ||||
|   dcjl:number | ||||
|   dxjl:number | ||||
|   bxjl:number | ||||
|   hint:string | ||||
|   lane:PerLane | ||||
|   carzt: -1 | 0 | 1 | ||||
|   grade: number | ||||
|   qjjl: number | ||||
|   dcjl: number | ||||
|   dxjl: number | ||||
|   bxjl: number | ||||
|   hint: string | ||||
|   lane: PerLane | ||||
| } | ||||
| 
 | ||||
| interface PerLane{ | ||||
|   MapRoad_Code_No:string | ||||
|   MapRoad_Name:string | ||||
|   TouchLineType:number | ||||
|   TouchDir:number | ||||
|   TouchLineTypeCS:number | ||||
|   TouchLineDirCS:number | ||||
|   BasePointInLaneNo:number | ||||
|   BaseLaneCount:number | ||||
|   FrontPointLaneNo:number | ||||
|   FrontPointLaneCount:number | ||||
|   Body_LF_ToLeftEdge:number | ||||
|   Body_LB_ToLeftEdge:number | ||||
|   Body_RF_ToRightEdge:number | ||||
|   Body_RB_ToRightEdge:number | ||||
|   Wheel_RF_ToRightEdge:number | ||||
|   Wheel_RB_ToRightEdge:number | ||||
|   Wheel_RF_ToBaseLine:number | ||||
|   Wheel_LF_ToRightEdge:number | ||||
|   Wheel_LB_ToRightEdge:number | ||||
|   Wheel_LF_ToBaseLine:number | ||||
|   Wheel_LB_ToBaseLine:number | ||||
|   BasePointInLaneDir:string | ||||
|   CrossLineAttr:number | ||||
|   InShapeAttr:number | ||||
|   ShapeNo:number | ||||
|   CrossPointNo:number | ||||
| interface PerLane { | ||||
|   MapRoad_Code_No: string | ||||
|   MapRoad_Name: string | ||||
|   TouchLineType: number | ||||
|   TouchDir: number | ||||
|   TouchLineTypeCS: number | ||||
|   TouchLineDirCS: number | ||||
|   BasePointInLaneNo: number | ||||
|   BaseLaneCount: number | ||||
|   FrontPointLaneNo: number | ||||
|   FrontPointLaneCount: number | ||||
|   Body_LF_ToLeftEdge: number | ||||
|   Body_LB_ToLeftEdge: number | ||||
|   Body_RF_ToRightEdge: number | ||||
|   Body_RB_ToRightEdge: number | ||||
|   Wheel_RF_ToRightEdge: number | ||||
|   Wheel_RB_ToRightEdge: number | ||||
|   Wheel_RF_ToBaseLine: number | ||||
|   Wheel_LF_ToRightEdge: number | ||||
|   Wheel_LB_ToRightEdge: number | ||||
|   Wheel_LF_ToBaseLine: number | ||||
|   Wheel_LB_ToBaseLine: number | ||||
|   BasePointInLaneDir: string | ||||
|   CrossLineAttr: number | ||||
|   InShapeAttr: number | ||||
|   ShapeNo: number | ||||
|   CrossPointNo: number | ||||
| } | ||||
| 
 | ||||
| export interface JudgeCallBackData { | ||||
|  | ||||
| @ -8,7 +8,6 @@ interface StuInfo { | ||||
|   idCard: string | ||||
| } | ||||
| 
 | ||||
| const LOGTAG = 'LOGTAG' | ||||
| 
 | ||||
| export default class FileLog { | ||||
|   public folderPath: string | ||||
| @ -27,48 +26,46 @@ export default class FileLog { | ||||
|   // 过程文件数据 | ||||
|   public setExamProgressData = async (str: Object) => { | ||||
|     this.progressDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/exam_progress_data.txt`, JSON.stringify(str), | ||||
|         this.progressDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/exam_progress_data.txt`, JSON.stringify(str)); | ||||
|   } | ||||
|   // 无锡所接口数据 | ||||
|   public setExamJudgeWuxiData = async (str: string) => { | ||||
|     this.examJudgeWuxiDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str, this.examJudgeWuxiDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str); | ||||
|   } | ||||
|   // 无锡所过程数据 | ||||
|   public setExamJudgeWuxiProgressData = async (str: string) => { | ||||
|     this.examJudgeWuxiProgressDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/wuxi_progress_data.txt`, str, this.examJudgeWuxiProgressDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/wuxi_progress_data.txt`, str); | ||||
|   } | ||||
|   // plc文件数据 | ||||
|   public setPlcProgressData = async (str: Object) => { | ||||
|     this.plcDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/plc_data.txt`, JSON.stringify(str), this.plcDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/plc_data.txt`, JSON.stringify(str)); | ||||
|   } | ||||
|   // 过程评判json数据 | ||||
|   public setExamJudgeData = async (str: string) => { | ||||
|     this.examJudgeDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, str, this.examJudgeDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, str); | ||||
|   } | ||||
|   // 过程评判回调数据 | ||||
|   public setExamJudgeCallbackData = async (str: string) => { | ||||
|     this.examJudgeCallbackDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_progress_callback_data.txt`, str, | ||||
|         this.examJudgeCallbackDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_progress_callback_data.txt`, str); | ||||
|   } | ||||
|   // 过程评判日志调数据 | ||||
|   public setExamJudgeLogData = async (str: string) => { | ||||
|     this.examJudgeLogDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_log_data.txt`, str, this.examJudgeLogDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/judge_log_data.txt`, str); | ||||
|   } | ||||
|   // 设置四合一画面数据 | ||||
|   public setFourAndOneLogData = async (str: string) => { | ||||
|     this.fourAndOneLogDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/four_one_log_data.txt`, str, this.fourAndOneLogDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/four_one_log_data.txt`, str); | ||||
|   } | ||||
|   public setFourAndOneLogDataBytes = async (str: string) => { | ||||
|     this.fourAndOneLogDataBytesFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/four_one_log_byte_data.txt`, str, this.fourAndOneLogDataBytesFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/four_one_log_byte_data.txt`, str); | ||||
|   } | ||||
|   // 无锡所轨迹数据 | ||||
|   public setExamLineData = async (plcStr: string) => { | ||||
| @ -101,13 +98,12 @@ export default class FileLog { | ||||
|       /*结束符*/ time, | ||||
|     ]; | ||||
|     this.examLineDataFd = | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/exam_wuxi_data.txt`, JSON.stringify(lineData), | ||||
|         this.examLineDataFd); | ||||
|       await this.fileUtil.editFile(`${this.folderPath}/exam_wuxi_data.txt`, JSON.stringify(lineData)); | ||||
|   }; | ||||
|   private stuInfo: StuInfo | ||||
|   // private stuInfo: StuInfo | ||||
|   // 设置文件夹 | ||||
|   public initFileLogo = async (stuInfo: StuInfo) => { | ||||
|     this.stuInfo = stuInfo; | ||||
|     // this.stuInfo = stuInfo; | ||||
|     const time = GetCurrentTime() | ||||
|     const date = time.split(' ')[0].split('-').join('_') | ||||
|     const hourTime = time.split(' ')[1].split(':').join('_') | ||||
|  | ||||
| @ -1,17 +1,17 @@ | ||||
| import { testMarkRules, testRealExam } from '../dataTest/index'; | ||||
| import { GetCurrentTime, NumberToByteArray } from '../../../utils/Common'; | ||||
| import { testRealExam } from '../dataTest/index'; | ||||
| import { NumberToByteArray } from '../../../utils/Common'; | ||||
| 
 | ||||
| import systemTime from '@ohos.systemDateTime'; | ||||
| import { Array2Byte } from './Common'; | ||||
| import { CarInfoType } from '../../../model'; | ||||
| import { Gps, Lane,Plc,Vision,Radar, Sensor,DefaultJudgeConfigObj, JudgeLane} from '../../../model/Judge' | ||||
| import { DefaultJudgeConfigObj, Gps, JudgeLane, Plc, Radar, Sensor, Vision } from '../../../model/Judge'; | ||||
| 
 | ||||
| interface Extend {} | ||||
| 
 | ||||
| // 中心信号转换 | ||||
| export const getTranslateSignals = (tempItems:number[]) => { | ||||
| export const getTranslateSignals = (tempItems: number[]) => { | ||||
|   const len = Math.floor(tempItems.length / 8); | ||||
|   const arr:string[] = []; | ||||
|   const arr: string[] = []; | ||||
|   for (let i = 0; i < len; i++) { | ||||
|     const temp = tempItems.slice(i * 8, (i + 1) * 8); | ||||
|     arr.push(temp.join('')); | ||||
| @ -35,7 +35,7 @@ export function getCarStatus(status: -1 | 0 | 1): string { | ||||
| } | ||||
| 
 | ||||
| // 当前考车中心状态转换 | ||||
| export function getCarStatusType(carzt?:number) { | ||||
| export function getCarStatusType(carzt?: number) { | ||||
|   switch (carzt) { | ||||
|     case -1: | ||||
|       return [1, 0] | ||||
| @ -49,7 +49,7 @@ export function getCarStatusType(carzt?:number) { | ||||
| } | ||||
| 
 | ||||
| // 获取档位信号 | ||||
| export function getDwStatusType(dw?:number) { | ||||
| export function getDwStatusType(dw?: number) { | ||||
|   switch (dw) { | ||||
|     case 0: | ||||
|       return [0, 0, 0, 0] | ||||
| @ -72,7 +72,7 @@ export function getDwStatusType(dw?:number) { | ||||
| 
 | ||||
| 
 | ||||
| // 中心实时项目状态转换 | ||||
| export function getCenterProjectStatus(status?:number):string { | ||||
| export function getCenterProjectStatus(status?: number): string { | ||||
|   switch (status) { | ||||
|   //不考 | ||||
|     case 0: | ||||
| @ -94,19 +94,19 @@ export function getCenterProjectStatus(status?:number):string { | ||||
| 
 | ||||
| //获取科目三开始项目、结束项目语音 | ||||
| export function getKmProjectVoice( | ||||
|   projectCode:string, | ||||
|   projectCode: string, | ||||
|   // 1:项目开始 2:项目结束 | ||||
|   type: 1 | 2, | ||||
|   judgeConfig:object, | ||||
|   lane:JudgeLane, | ||||
|   xmxh:string | ||||
|   judgeConfig: object, | ||||
|   lane: JudgeLane, | ||||
|   xmxh: string | ||||
| ) { | ||||
|   const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||
|   const  examSubject = carInfo.examSubject; | ||||
|   const param506Str:number[] = ( Reflect.get(judgeConfig,'506')?.split(',') ) || [] | ||||
|   const param512Str:number[] = ( Reflect.get(judgeConfig,'512')?.split(',') ) || [] | ||||
|   const param544Str:number[] = ( Reflect.get(judgeConfig,'544')?.split(',') ) || [] | ||||
|   const param405Str:number = Reflect.get(judgeConfig,'405') || 0; | ||||
|   const examSubject = carInfo.examSubject; | ||||
|   const param506Str: number[] = (Reflect.get(judgeConfig, '506')?.split(',')) || [] | ||||
|   const param512Str: number[] = (Reflect.get(judgeConfig, '512')?.split(',')) || [] | ||||
|   const param544Str: number[] = (Reflect.get(judgeConfig, '544')?.split(',')) || [] | ||||
|   const param405Str: number = Reflect.get(judgeConfig, '405') || 0; | ||||
| 
 | ||||
|   console.info('surenjun => param544Str.length', param544Str.length) | ||||
| 
 | ||||
| @ -147,7 +147,7 @@ export function getKmProjectVoice( | ||||
|     case 41100: | ||||
|       return type === 1 | ||||
|         ? (param512Str[2] == 3 ? 411001 : undefined) | ||||
|         : (param544Str.includes(xmxh) ? undefined : (param544Str.length === 0 ? undefined : 411004)) | ||||
|         : (param544Str.includes(Number(xmxh)) ? undefined : (param544Str.length === 0 ? undefined : 411004)) | ||||
| 
 | ||||
|   //通过车站 | ||||
|     case 41200: | ||||
| @ -173,7 +173,7 @@ export function getKmProjectVoice( | ||||
| 
 | ||||
| 
 | ||||
| //获取科目三&科目三取消项目语音 | ||||
| export function getKmProjectCancelVoice(examSubject:number, projectCode:number) { | ||||
| export function getKmProjectCancelVoice(examSubject: number, projectCode: number) { | ||||
|   if (examSubject == 2) { | ||||
|     return 'xmqx' | ||||
|   } | ||||
| @ -459,7 +459,7 @@ export const plcStrToJson = async (plc: string) => { | ||||
|   const time = await systemTime.getCurrentTime() | ||||
| 
 | ||||
| 
 | ||||
|   const sensor:Sensor =  { | ||||
|   const sensor: Sensor = { | ||||
|     //安全带     车门门开关   手刹        脚刹        副刹       离合器      喇叭      示宽灯     近光灯     远光灯 | ||||
|     aqd: p[19], | ||||
|     mkg: p[14], | ||||
| @ -505,11 +505,11 @@ export const plcStrToJson = async (plc: string) => { | ||||
|     wav: 0, | ||||
|     mndg: '' | ||||
|   } | ||||
|   const gps2:Gps =testRealExam.gps2 | ||||
|   const radar:Radar =testRealExam.radar | ||||
|   const vision:Vision =testRealExam.vision | ||||
|   const extend:Extend = {}; | ||||
|   const tempData:Plc = { | ||||
|   const gps2: Gps = testRealExam.gps2 | ||||
|   const radar: Radar = testRealExam.radar | ||||
|   const vision: Vision = testRealExam.vision | ||||
|   const extend: Extend = {}; | ||||
|   const tempData: Plc = { | ||||
|     sensor: { | ||||
|       //安全带     车门门开关   手刹        脚刹        副刹       离合器      喇叭      示宽灯     近光灯     远光灯 | ||||
|       aqd: p[19], | ||||
| @ -561,7 +561,7 @@ export const plcStrToJson = async (plc: string) => { | ||||
|       bklx: p[56], | ||||
|       dwzt: p[83], | ||||
|       // 角度差分状态 | ||||
|       jdzt:  Number(plcArr[92].split('-')[0]), | ||||
|       jdzt: Number(plcArr[92].split('-')[0]), | ||||
|       //gps数据 | ||||
|       //gps时间 经度      纬度       航向角      俯仰角      海拔高       高度差     速度 | ||||
|       sj: time, | ||||
| @ -596,7 +596,7 @@ export const plcStrToWXJson = async (plc: string) => { | ||||
|     } | ||||
|   }); | ||||
|   const timeStr = p[93] + '' + p[94]; | ||||
|   const gps:Gps = { | ||||
|   const gps: Gps = { | ||||
|     //办卡类型    定位差分状态 | ||||
|     bklx: p[56], | ||||
|     dwzt: p[83], | ||||
| @ -636,19 +636,19 @@ export const plcStrToWXJson = async (plc: string) => { | ||||
|     //前天线可用星数 后天线可用星数 东向坐标位置 北向位置坐标 天向位置坐标  东向速度 北向速度 天向速度 | ||||
|     '', '', '', '', '', '', '', '', | ||||
|     // 评判信号1 评判信号2 发动机转速 | ||||
|     judgeSignalNum.toString(16),judgeAnotherSignalNum.toString(16), p[25], | ||||
|     judgeSignalNum.toString(16), judgeAnotherSignalNum.toString(16), p[25], | ||||
|     '0xFFFFFFF' | ||||
|   ] | ||||
|   const wuXiDataStr = wuXiData.join(',') | ||||
|   return wuXiDataStr | ||||
| } | ||||
| 
 | ||||
| export const senorToWXDataStr = async (tempData:Plc) => { | ||||
| export const senorToWXDataStr = async (tempData: Plc) => { | ||||
|   const sensor = tempData.sensor | ||||
|   const gps = tempData.gps | ||||
|   const timeStr = await getTimeStr() | ||||
| 
 | ||||
|   const judgeSignal:number[] = [ | ||||
|   const judgeSignal: number[] = [ | ||||
|   //车门 安全带  熄火    发动机启动 左转向 右转向  前照灯近灯 前照灯远灯 | ||||
|     sensor.mkg, sensor.aqd, sensor.dh1, sensor.dh2, sensor.zfxd, sensor.yfxd, sensor.jgd, sensor.ygd, | ||||
|     // 注车制动 行车制动 离合器 副制动   喇叭   雨刷    危险报警灯 示廓灯 系统未涉及的传感器信号 | ||||
| @ -714,7 +714,7 @@ export function sendRed() { | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| export const defaultJudgeConfigObj:DefaultJudgeConfigObj = { | ||||
| export const defaultJudgeConfigObj: DefaultJudgeConfigObj = { | ||||
|   //结束考试方式 0-不合格继续 1-考试不合格报靠边停车 2-不合格不报靠边 3-训练不合格报靠边 4-自动退出 5-不合格自动退出 | ||||
|   param_302: '5', | ||||
|   param_332: '', | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user