Compare commits
	
		
			No commits in common. "cbb64fdf422eb2fcc66cc1d7a1cbbf09a5695f4f" and "b6c153443a6e32bdfd84b399129762d055ecc3aa" have entirely different histories.
		
	
	
		
			cbb64fdf42
			...
			b6c153443a
		
	
		
							
								
								
									
										6
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,8 +1,8 @@ | ||||
| gitLog: | ||||
| 	git log --since="2025-08-08 14:00" --until="2025-08-19 15:00"  --pretty=format:"<details>%n    <summary>%s</summary>%n     <span style=\"color: #888;\">[提交人]:</span><span style=\"color: #333;\">%an</span><br>%n     <span style=\"color: #888;\">[提交时间]:</span><span style=\"color: #333;\">%ad</span><br>%n    <span style=\"color: #888;\">[提交版本]:</span><span style=\"color: #333;\">%h</span>%n</details>%n" --date=format:"%Y-%m-%d %H:%M" > release_note.md | ||||
| 
 | ||||
| re: | ||||
| 	hdc shell mount -o remount,rw / | ||||
| 
 | ||||
| pushJudge: | ||||
| 	hdc file send  /Users/wangzhongjie/Desktop/duolun/openHarmony/car_next/ohos/so/libjudgesdk.z.so /system/lib/module/ | ||||
| uninstall: | ||||
| 	hdc uninstall com.oh.dts | ||||
| 	hdc file send  /Users/wangzhongjie/Desktop/duolun/openHarmony/car_next/ohos/so/libjudgesdk.z.so /system/lib/module/ | ||||
| @ -5,9 +5,9 @@ | ||||
|         "name": "default", | ||||
|         "material": { | ||||
|           "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer", | ||||
|           "storePassword": "0000001B42BCAC6B534ABB3B488F5C45764278201EE92A007F988939EC561EEB8ED64F737B8A11A7A72A1E", | ||||
|           "storePassword": "0000001BD807731D6FB9F044E3DF0E0429F4BB4214FE1608E25B4197041FBF36DDA3C6760585312F2864B6", | ||||
|           "keyAlias": "debugKey", | ||||
|           "keyPassword": "0000001B2A149F63C38A6F5B972EC903EB0ADAB7978BA6C33B8E460C7353BD0BC2248776AB2FD2AE009A98", | ||||
|           "keyPassword": "0000001BFA38BF5235541496B5FF9ED9FFA764AB53FABC873D21DC230060209C2FF24ACE5DA09413B0C138", | ||||
|           "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b", | ||||
|           "signAlg": "SHA256withECDSA", | ||||
|           "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12" | ||||
|  | ||||
| @ -8,9 +8,10 @@ import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoTy | ||||
| import DB from '../utils/DbSql'; | ||||
| import { DrivingDataStorage } from '../utils/business/DrivingDataStorage'; | ||||
| import { InitTable } from '../utils/table/Operation'; | ||||
| import FileUtils from '../utils/FileUtils'; | ||||
| import { EntryTag } from '../config'; | ||||
| import { dConsole } from '../utils/LogWorker'; | ||||
| import { ReadFileContent, UseAuth } from '../utils/Common'; | ||||
| import { UseAuth } from '../utils/Common'; | ||||
| import { DifferentialAndSignal } from '../utils/business/DifferentialAndSignalWorker'; | ||||
| 
 | ||||
| export default class EntryAbility extends UIAbility { | ||||
| @ -18,8 +19,9 @@ export default class EntryAbility extends UIAbility { | ||||
|     console.log(EntryTag, "多伦鸿蒙车载程序启动") | ||||
|     await DB.init(this.context) | ||||
|     try { | ||||
|       let fileUtil = new FileUtils(this.context) | ||||
|       // 读取系统设置参数 | ||||
|       const data = await ReadFileContent(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt') | ||||
|       const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||
|       if (data !== '' && data !== undefined) { | ||||
|         const result: EnvironmentConfigurationType = JSON.parse(data) | ||||
|         AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result) | ||||
| @ -31,7 +33,7 @@ export default class EntryAbility extends UIAbility { | ||||
|         AppStorage.setOrCreate<string>("host", host) | ||||
|       } | ||||
|       // 读取视频配置 | ||||
|       const videoData = await ReadFileContent(GlobalConfig.commonFileWriteAddress + '/config/config3.txt') | ||||
|       const videoData = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt'); | ||||
|       if (videoData !== '' && videoData !== undefined) { | ||||
|         const videoConfig: VideoConfig = JSON.parse(videoData) | ||||
|         AppStorage.setOrCreate<VideoConfig>("VideoConfig", videoConfig) | ||||
| @ -77,7 +79,8 @@ export default class EntryAbility extends UIAbility { | ||||
|     }) | ||||
|     AppStorage.setOrCreate('isJudgeInitBool', false) | ||||
| 
 | ||||
|     const data = await ReadFileContent(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt') | ||||
|     let fileUtil = new FileUtils(this.context) | ||||
|     const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||
|     if (data !== '' && data !== undefined) { | ||||
|       const config: EnvironmentConfigurationType = JSON.parse(data) | ||||
|       await windowClass.setWindowLayoutFullScreen(true) | ||||
|  | ||||
| @ -1,71 +0,0 @@ | ||||
| import { CommonListType } from '../model' | ||||
| 
 | ||||
| export const RearMachineModelListData: CommonListType[] = [ | ||||
|   { | ||||
|     label: '一型机', | ||||
|     value: '1' | ||||
|   }, | ||||
|   { | ||||
|     label: '二型机', | ||||
|     value: '2' | ||||
|   }, | ||||
|   { | ||||
|     label: '三型机', | ||||
|     value: '3' | ||||
|   }, | ||||
|   { | ||||
|     label: '一体机', | ||||
|     value: '4' | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
| export const BoardListData: CommonListType[] = [ | ||||
|   { | ||||
|     label: '北云', | ||||
|     value: '1' | ||||
|   }, | ||||
|   { | ||||
|     label: '天宝MB2', | ||||
|     value: '2' | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
| export const LogListData: CommonListType[] = [ | ||||
|   { | ||||
|     label: '开启', | ||||
|     value: '1' | ||||
|   }, | ||||
|   { | ||||
|     label: '关闭', | ||||
|     value: '0' | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
| export const CarTypeListData: CommonListType[] = [ | ||||
|   { | ||||
|     label: '小车C1', | ||||
|     value: '1' | ||||
|   }, | ||||
|   { | ||||
|     label: '小车C2', | ||||
|     value: '2' | ||||
|   }, | ||||
|   { | ||||
|     label: '大车', | ||||
|     value: '3' | ||||
|   }, | ||||
|   { | ||||
|     label: '牵引车A2', | ||||
|     value: '4' | ||||
|   } | ||||
| ] | ||||
| export const ManufacturerListData: CommonListType[] = [ | ||||
|   { | ||||
|     label: '诚迈', | ||||
|     value: '1' | ||||
|   }, | ||||
|   { | ||||
|     label: '润和', | ||||
|     value: '2' | ||||
|   } | ||||
| ] | ||||
| @ -7,5 +7,4 @@ export * from "./Judge" | ||||
| export * from "./SignDisplay" | ||||
| 
 | ||||
| export * from "./CarCheck" | ||||
| export * from "./Test" | ||||
| export * from "./TerminallInfo" | ||||
| export * from "./Test" | ||||
| @ -173,8 +173,6 @@ export interface EnvironmentConfigurationType { | ||||
|   judgeVersion?: string | ||||
|   //   是否使用网络摄像头 | ||||
|   isUseNetworkCamera?: string | ||||
|   //   厂商  诚迈 1 润和 2 | ||||
|   manufacturer?: string | ||||
| } | ||||
| 
 | ||||
| //全局配置 | ||||
|  | ||||
| @ -427,8 +427,7 @@ export struct JudgePage { | ||||
|       const carlistArr = info.carlist === '' ? [] : (decodeURI(info.carlist || "").split(',') || []); | ||||
|       const newKey = key.split('~').join('_') | ||||
|       const xmdm = Number(key.split('~')[0]) | ||||
|       const data: ProjectInfos = JSON.parse(JSON.stringify(this.projectsObj)) | ||||
|       const currentProject: ProjectInfo = Reflect.get(data, xmdm) | ||||
|       const currentProject: ProjectInfo = Reflect.get(this.projectsObj, xmdm) | ||||
|       if (currentProject && (carlistArr.length == 0 || carlistArr.includes(this.carlist))) { | ||||
|         Reflect.set(this.itemInfoObj!, newKey, { | ||||
|           modelKey: newKey, | ||||
| @ -462,7 +461,7 @@ export struct JudgePage { | ||||
|       const examItems: string | undefined = currentParams?.examItems; | ||||
|       // 2024-01-03 16:29:26;0;20300,;2,4^2,4;null; | ||||
|       if (examItems !== '' && examItems !== undefined) { | ||||
|         dConsole.info(JudgeTag, 'surenjun examItems=>', examItems) | ||||
|         dConsole.info(JudgeTag, 'surenjun examItems=>', JSON.stringify(examItems)) | ||||
|         const examItemsArrs = examItems.split(';'); | ||||
|         const startTime = examItemsArrs[0] | ||||
|         const ddxkKsxmArr = examItemsArrs[2]?.split(',').filter(item => item) || [] | ||||
|  | ||||
| @ -408,9 +408,9 @@ export class BaseJudge { | ||||
|     const singlePlay = judgeUI.singlePlay | ||||
|     //TODO 断网考试结束补传 | ||||
|     // await uploadDisConnectData(); | ||||
|     // let backTimeOut = setTimeout(() => { | ||||
|     //   router.back() | ||||
|     // }, 90 * 1000) | ||||
|     let backTimeOut = setTimeout(() => { | ||||
|       router.back() | ||||
|     }, 90 * 1000) | ||||
| 
 | ||||
|     console.info(JudgeTag, '考试结束 end') | ||||
|     const param302 = judgeUI.judgeConfigObj.param_302; | ||||
| @ -427,9 +427,11 @@ export class BaseJudge { | ||||
|         case 'voice/unqualified_one.wav': | ||||
|           currentKssycs = 0; | ||||
|           break; | ||||
| 
 | ||||
|         case 'voice/unqualified_two.wav': | ||||
|           currentKssycs = 1; | ||||
|           break; | ||||
| 
 | ||||
|         case 'voice/qualified.mp3': | ||||
|           currentKssycs = 0; | ||||
|           break; | ||||
| @ -472,7 +474,7 @@ export class BaseJudge { | ||||
|     if (!singlePlay) { | ||||
|       // await uploadProgressData(); | ||||
|     } | ||||
|     // clearTimeout(backTimeOut) | ||||
|     clearTimeout(backTimeOut) | ||||
|     //语音播放扣分项 | ||||
|     let score = 0; | ||||
|     //结束考试时候是否播报一遍所有扣分 | ||||
| @ -745,7 +747,7 @@ export class BaseJudge { | ||||
|       } | ||||
|     //   考试结束 | ||||
|       case 5: { | ||||
|         dConsole.info(JudgeTag, "考试结束距离1", ksjs) | ||||
|         dConsole.info(JudgeTag, "考试结束") | ||||
|         that.ksjs = ksjs; | ||||
|         dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ | ||||
|           method: 'examJudgeEndExam' | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| /** | ||||
|  * 过程数据处理 | ||||
|  */ | ||||
| import { ExamProcessDataTag, JudgeTag, ProcessDataTag, QueueTag } from '../../config'; | ||||
| import { ExamProcessDataTag, ProcessDataTag, QueueTag } from '../../config'; | ||||
| import { | ||||
|   CarInfoType, | ||||
|   CDSBInfo, | ||||
| @ -184,7 +184,6 @@ export const TheExamIsOver = async (judgeUI: JudgePage, that: JudgeBusiness, cal | ||||
|   const carInfo: CarInfoType = AppStorage.get("carInfo")! | ||||
|   const photoBase64 = await GetPhotoBase64(judgeUI.context); | ||||
|   const ksjs = that.ksjs! | ||||
|   dConsole.log(JudgeTag, "考试结束距离", that.ksjs) | ||||
|   const data: RegulatoryInterfaceParams = { | ||||
|     JGHOST: AppStorage.get<string>("JGHOST") || "", | ||||
|     xtlb: '17', | ||||
| @ -198,8 +197,7 @@ export const TheExamIsOver = async (judgeUI: JudgePage, that: JudgeBusiness, cal | ||||
|       zp: photoBase64, | ||||
|       jssj: dayTs().format("YYYY-MM-DD HH:mm:ss"), | ||||
|       kscj: (judgeUI.totalScore * 1) > 0 ? judgeUI.totalScore : 0, | ||||
|       // kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), | ||||
|       kslc: Math.ceil(((ksjs?.qjjl + ksjs?.dcjl) || 0) / 100), | ||||
|       kslc: Math.ceil(((ksjs?.qjjl! + ksjs?.dcjl!) || 0) / 100), | ||||
|       dwlc: [ksjs.d1, ksjs.d2, ksjs.d3, ksjs.d4, ksjs!.d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`) | ||||
|         .join(';'), | ||||
|     } | ||||
|  | ||||
| @ -99,12 +99,11 @@ 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[]) { | ||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||
|     const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3' | ||||
|     dConsole.log(JudgeTag, "itemInfoObj", itemInfoObj) | ||||
| 
 | ||||
|     let allitems: ItemInfo[] = []; | ||||
|     if (examSubject == '2' && itemInfoObj) { | ||||
|       allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { | ||||
|         // const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); | ||||
|         const cdsb: CDSBInfo = Object.entries(itemInfoObj).find((arr: Array<string>) => arr[0] === cdsbKey)![1] | ||||
|         const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); | ||||
|         const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context) | ||||
|         const temp: ItemInfo = { | ||||
|           xmdm: cdsb?.xmdm || 0, | ||||
| @ -299,6 +298,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | ||||
|   } | ||||
| 
 | ||||
|   public async JudgeStart(callBack: Function, judgeUI: JudgePage, that: JudgeBusiness) { | ||||
| 
 | ||||
|     const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen; | ||||
|     const trajectoryPath = JudgeConfig.trajectoryPath; | ||||
|     let strArr: string[] = []; | ||||
|  | ||||
| @ -1,25 +1,25 @@ | ||||
| import HeaderComponent from './compontents/Header'; | ||||
| import { CommonListType, EnvironmentConfigurationType } from '../model'; | ||||
| import common from '@ohos.app.ability.common'; | ||||
| import FileUtils from '../utils/FileUtils'; | ||||
| import { GlobalConfig, TerminalInfoTag } from '../config'; | ||||
| import ethernet from '@ohos.net.ethernet'; | ||||
| import { BusinessError } from '@ohos.base'; | ||||
| import Prompt from '@system.prompt'; | ||||
| import { dConsole } from '../utils/LogWorker'; | ||||
| import window from '@ohos.window'; | ||||
| import { BoardListData, CarTypeListData, LogListData, ManufacturerListData, RearMachineModelListData } from '../mock'; | ||||
| import { OverWriteFile, ReadFileContent } from '../utils/Common'; | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| struct TerminalInfoPage { | ||||
|   @State config: EnvironmentConfigurationType = {} | ||||
|   @State isProcessing: boolean = false; | ||||
|   @State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt' | ||||
|   private fileUtil!: FileUtils | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
| 
 | ||||
|   async aboutToAppear() { | ||||
|     const data = await ReadFileContent(this.IpConfigFilePath) | ||||
|     this.fileUtil = new FileUtils(this.context) | ||||
|     const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||
|     dConsole.log(TerminalInfoTag, "data", data) | ||||
|     if (data) { | ||||
|       this.config = JSON.parse(data) | ||||
| @ -28,10 +28,6 @@ struct TerminalInfoPage { | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   async aboutToDisappear() { | ||||
|     dConsole.log(TerminalInfoTag, "TerminalInfoPage aboutToDisappear") | ||||
|   } | ||||
| 
 | ||||
|   build() { | ||||
|     Flex({ | ||||
|       justifyContent: FlexAlign.Center, | ||||
| @ -229,14 +225,6 @@ struct TerminalInfoPage { | ||||
|                   } | ||||
|                 } | ||||
|               }) | ||||
|               blockComponent({ | ||||
|                 label: "前置机厂商", | ||||
|                 type: 8, | ||||
|                 value: this.config.manufacturer, | ||||
|                 change: (value: string) => { | ||||
|                   this.config.manufacturer = value; | ||||
|                 } | ||||
|               }) | ||||
|             }.margin(20) | ||||
|           } | ||||
|           .height(650) | ||||
| @ -249,7 +237,7 @@ struct TerminalInfoPage { | ||||
|           }) | ||||
| 
 | ||||
|           Row() { | ||||
|             Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(async () => { | ||||
|             Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => { | ||||
|               if (this.isProcessing) { | ||||
|                 Prompt.showToast({ | ||||
|                   message: "请勿频繁点击", | ||||
| @ -260,43 +248,33 @@ struct TerminalInfoPage { | ||||
|               this.isProcessing = true | ||||
|               dConsole.log(TerminalInfoTag, "保存配置", JSON.stringify(this.config)) | ||||
|               AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) | ||||
|               // this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config)) | ||||
|               // 先删除文件 | ||||
|               const result = await OverWriteFile(this.IpConfigFilePath, JSON.stringify(this.config)) | ||||
|               if (result) { | ||||
|                 Prompt.showToast({ | ||||
|                   message: "保存配置文件成功", | ||||
|                   duration: 3000 | ||||
|                 }) | ||||
|                 ethernet.setIfaceConfig("eth0", { | ||||
|                   mode: ethernet.IPSetMode.STATIC, | ||||
|                   ipAddr: this.config.udplocalIp, | ||||
|                   route: "0.0.0.0", | ||||
|                   gateway: this.config.gateway, //value.gateway网关 | ||||
|                   netMask: this.config.netMask, //value.netMask网络掩码 | ||||
|                   dnsServers: this.config.dnsServers, | ||||
|                   domain: "" | ||||
|                 }, (error: BusinessError) => { | ||||
|                   if (error) { | ||||
|                     Prompt.showToast({ | ||||
|                       message: '设置失败' + JSON.stringify(error), | ||||
|                       duration: 3000 | ||||
|                     }); | ||||
|                   } else { | ||||
|                     Prompt.showToast({ | ||||
|                       message: '设置网络成功', | ||||
|                       duration: 3000 | ||||
|                     }); | ||||
|                     //   延迟几秒 | ||||
|                     setTimeout(() => { | ||||
|                       this.isProcessing = false | ||||
|                     }, 3000) | ||||
|                   } | ||||
|                 }); | ||||
|               } | ||||
| 
 | ||||
|               this.fileUtil.addFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt', JSON.stringify(this.config)) | ||||
|               dConsole.init(this.config.isOpenLog) | ||||
| 
 | ||||
|               ethernet.setIfaceConfig("eth0", { | ||||
|                 mode: ethernet.IPSetMode.STATIC, | ||||
|                 ipAddr: this.config.udplocalIp, | ||||
|                 route: "0.0.0.0", | ||||
|                 gateway: this.config.gateway, //value.gateway网关 | ||||
|                 netMask: this.config.netMask, //value.netMask网络掩码 | ||||
|                 dnsServers: this.config.dnsServers, | ||||
|                 domain: "" | ||||
|               }, (error: BusinessError) => { | ||||
|                 if (error) { | ||||
|                   Prompt.showToast({ | ||||
|                     message: '设置失败' + JSON.stringify(error), | ||||
|                     duration: 3000 | ||||
|                   }); | ||||
|                 } else { | ||||
|                   Prompt.showToast({ | ||||
|                     message: '设置成功', | ||||
|                     duration: 3000 | ||||
|                   }); | ||||
|                   //   延迟几秒 | ||||
|                   setTimeout(() => { | ||||
|                     this.isProcessing = false | ||||
|                   }, 3000) | ||||
|                 } | ||||
|               }); | ||||
| 
 | ||||
|             }) | ||||
|           } | ||||
| @ -337,13 +315,64 @@ struct blockComponent { | ||||
|   // 0 -输入框,1 -后置机类型,2 -日志开关,3 -板卡类型 | ||||
|   @State type: number = 0 | ||||
|   // '一型机', '二型机', '三型机', '一体机' | ||||
|   @State rearMachineModelList: CommonListType[] = RearMachineModelListData | ||||
|   @State rearMachineModelList: CommonListType[] = [ | ||||
|     { | ||||
|       label: '一型机', | ||||
|       value: '1' | ||||
|     }, | ||||
|     { | ||||
|       label: '二型机', | ||||
|       value: '2' | ||||
|     }, | ||||
|     { | ||||
|       label: '三型机', | ||||
|       value: '3' | ||||
|     }, | ||||
|     { | ||||
|       label: '一体机', | ||||
|       value: '4' | ||||
|     } | ||||
|   ] | ||||
|   // '北云', '天宝MB2' | ||||
|   @State boardList: CommonListType[] = BoardListData | ||||
|   @State logList: CommonListType[] = LogListData | ||||
|   @State boardList: CommonListType[] = [ | ||||
|     { | ||||
|       label: '北云', | ||||
|       value: '1' | ||||
|     }, | ||||
|     { | ||||
|       label: '天宝MB2', | ||||
|       value: '2' | ||||
|     } | ||||
|   ] | ||||
|   @State logList: CommonListType[] = [ | ||||
|     { | ||||
|       label: '开启', | ||||
|       value: '1' | ||||
|     }, | ||||
|     { | ||||
|       label: '关闭', | ||||
|       value: '0' | ||||
|     } | ||||
|   ] | ||||
|   // 车型 "小车C1", "小车C2", "大车", "牵引车A2" | ||||
|   @State carTypeList: CommonListType[] = CarTypeListData | ||||
|   @State manufacturerList: CommonListType[] = ManufacturerListData | ||||
|   @State carTypeList: CommonListType[] = [ | ||||
|     { | ||||
|       label: '小车C1', | ||||
|       value: '1' | ||||
|     }, | ||||
|     { | ||||
|       label: '小车C2', | ||||
|       value: '2' | ||||
|     }, | ||||
|     { | ||||
|       label: '大车', | ||||
|       value: '3' | ||||
|     }, | ||||
|     { | ||||
|       label: '牵引车A2', | ||||
|       value: '4' | ||||
|     } | ||||
|   ] | ||||
| 
 | ||||
|   aboutToAppear(): void { | ||||
|   } | ||||
| @ -381,7 +410,7 @@ struct blockComponent { | ||||
|         } else { | ||||
|           ForEach(this.type === 1 ? this.rearMachineModelList : | ||||
|             this.type === 2 || this.type === 5 || this.type === 6 || this.type === 7 ? this.logList : | ||||
|               this.type === 3 ? this.boardList : this.type === 8 ? this.manufacturerList : this.carTypeList, (item: CommonListType, index) => { | ||||
|               this.type === 3 ? this.boardList : this.carTypeList, (item: CommonListType, index) => { | ||||
|             Radio({ value: item.label, group: 'terRadioGroup' + this.type }) | ||||
|               .borderColor('#E5CBA1') | ||||
|               .checked(item.value === this.value ? true : false) | ||||
|  | ||||
| @ -156,6 +156,14 @@ struct UserInfoPage { | ||||
|   @State singlePlay: boolean = false | ||||
|   private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; | ||||
|   private avPlayer!: VoiceAnnounce | ||||
|   private labelBlocks: LabelBlockType[] = [ | ||||
|     { label: '考生姓名', key: 'xm' }, | ||||
|     { label: '身份证号', key: 'sfzmhm' }, | ||||
|     { label: ' 流 水 号 ', key: 'lsh' }, | ||||
|     { label: '考试路线', key: 'ksxl' }, | ||||
|     { label: '待考次数', key: 'kssycs' }, | ||||
|     { label: '考试员名', key: 'ksy2' }, | ||||
|   ] | ||||
|   //开始考试准备 | ||||
|   prePareExam = async () => { | ||||
|     dConsole.log(StartExamTag, 'prePareExam') | ||||
| @ -172,12 +180,9 @@ struct UserInfoPage { | ||||
|       if (this.singlePlay) { | ||||
|         this.currentUser.id = '0' | ||||
|         dConsole.log(StartExamTag, '开始考试3', this.currentUser) | ||||
|         try { | ||||
|           // let data: Array<User> = JSON.parse(JSON.stringify([this.currentUser])) | ||||
|           await SqlInsertTable('USER', [this.currentUser]) | ||||
|         } catch (e) { | ||||
|           dConsole.error(StartExamTag, '开始考试插入用户表失败', JSON.stringify(e)) | ||||
|         } | ||||
|         SqlInsertTable('USER', [this.currentUser]).catch((e: BusinessError) => { | ||||
|           dConsole.log(StartExamTag, "error", JSON.stringify(e)) | ||||
|         }) | ||||
|         // 初始化开始考试过程数据文件夹 | ||||
|         InitializeExamProcessData(this.currentUser) | ||||
|         dConsole.log(StartExamTag, '开始考试4') | ||||
| @ -208,14 +213,6 @@ struct UserInfoPage { | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
|   private labelBlocks: LabelBlockType[] = [ | ||||
|     { label: '考生姓名', key: 'xm' }, | ||||
|     { label: '身份证号', key: 'sfzmhm' }, | ||||
|     { label: ' 流 水 号 ', key: 'lsh' }, | ||||
|     { label: '考试路线', key: 'ksxl' }, | ||||
|     { label: '待考次数', key: 'kssycs' }, | ||||
|     { label: '考试员名', key: 'ksy2' }, | ||||
|   ] | ||||
| 
 | ||||
|   async aboutToAppear() { | ||||
|     this.avPlayer = new VoiceAnnounce(this.context); | ||||
|  | ||||
| @ -109,11 +109,11 @@ export function NumberToByteArray(number: number | string, len: number): number[ | ||||
|   return arrBytes; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 将字符串填充为指定长度的字符串,前面补0 | ||||
|  * @param str 要填充的字符串或数字 | ||||
|  * @param len 目标长度 | ||||
|  * @return 返回填充后的字符串 | ||||
| /* | ||||
|   * 将字符串填充为指定长度的字符串,前面补0 | ||||
|   * @param str 要填充的字符串或数字 | ||||
|   * @param len 目标长度 | ||||
|   * @return 返回填充后的字符串 | ||||
|  */ | ||||
| export function FillZero(str: string | number, len: number): string { | ||||
|   str = str.toString(); | ||||
| @ -176,10 +176,10 @@ export function DeepClone<T extends Object>(target: T): T { | ||||
|   return target; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 检查文件或目录是否存在 | ||||
|  * @param path 文件或目录的路径 | ||||
|  * @return 返回一个 Promise,解析为 true 如果存在,否则为 false | ||||
| /* | ||||
|   * 检查文件或目录是否存在 | ||||
|   * @param path 文件或目录的路径 | ||||
|   * @return 返回一个 Promise,解析为 true 如果存在,否则为 false | ||||
|  */ | ||||
| export function IsExit(path: string): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
| @ -221,37 +221,7 @@ export function CreateDir(path: string): Promise<boolean> { | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 打开文件 | ||||
|  */ | ||||
| export function OpenFile(path: string): Promise<number> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     try { | ||||
|       const file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.APPEND | fs.OpenMode.CREATE) | ||||
|       resolve(file.fd) | ||||
|     } catch (e) { | ||||
|       reject(-1) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 关闭文件 | ||||
|  */ | ||||
| export function CloseFile(fd: number): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     try { | ||||
|       fs.closeSync(fd) | ||||
|       resolve(true) | ||||
|     } catch (e) { | ||||
|       reject(false) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 追加写文件 | ||||
|  * @params fd 文件描述符 | ||||
|  * @params data 写入的数据 | ||||
|  * 写文件 | ||||
|  */ | ||||
| export function EditFile(fd: number, data: string): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
| @ -264,31 +234,6 @@ export function EditFile(fd: number, data: string): Promise<boolean> { | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 覆盖写文件 | ||||
|  */ | ||||
| export function OverWriteFile(path: string, data: string): Promise<boolean> { | ||||
|   return new Promise(async (resolve, reject) => { | ||||
|     try { | ||||
|       // 先删除文件 | ||||
|       const res = await DeleteFile(path); | ||||
|       if (res) { | ||||
|         // 创建文件 | ||||
|         const fd = await CreateFile(path); | ||||
|         if (fd !== -1) { | ||||
|           // 写入数据 | ||||
|           await EditFile(fd, data); | ||||
|           // 关闭文件 | ||||
|           await CloseFile(fd); | ||||
|         } | ||||
|       } | ||||
|       resolve(true) | ||||
|     } catch (e) { | ||||
|       reject(false) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 创建文件 | ||||
|  * @params path 文件具体路径 | ||||
| @ -307,41 +252,10 @@ export function CreateFile(path: string): Promise<number> { | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 删除文件 | ||||
|  */ | ||||
| export function DeleteFile(path: string): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     try { | ||||
|       fs.unlinkSync(path) | ||||
|       console.log(CommonFileTag, "删除文件成功", path) | ||||
|       resolve(true) | ||||
|     } catch (e) { | ||||
|       console.log(CommonFileTag, "删除文件失败", path) | ||||
|       reject(false) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 读取文件内容 | ||||
|  * @params path 文件具体路径 | ||||
|  */ | ||||
| export function ReadFileContent(path: string): Promise<string> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     try { | ||||
|       const data = fs.readTextSync(path) | ||||
|       resolve(data) | ||||
|     } catch (e) { | ||||
|       reject(e) | ||||
|     } | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 将秒数转换为灵活的时间格式(HH:MM:SS) | ||||
|  * @param seconds 要转换的秒数 | ||||
|  * @return 返回格式化后的时间字符串 | ||||
| /* | ||||
|   * 将秒数转换为灵活的时间格式(HH:MM:SS) | ||||
|   * @param seconds 要转换的秒数 | ||||
|   * @return 返回格式化后的时间字符串 | ||||
|  */ | ||||
| export function FormatTimeFlexible(seconds: number): string { | ||||
|   if (seconds < 0) { | ||||
| @ -377,10 +291,10 @@ export function ApplyForAuthorization(context: Context, permissionList: Array<Pe | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 使用权限 | ||||
|  * @param context 上下文 | ||||
|  * @return 返回一个 Promise,解析为 true 如果授权成功,否则为 false | ||||
| /* | ||||
|   * 使用权限 | ||||
|   * @param context 上下文 | ||||
|   * @return 返回一个 Promise,解析为 true 如果授权成功,否则为 false | ||||
|  */ | ||||
| export async function UseAuth(context: common.UIAbilityContext): Promise<boolean> { | ||||
|   const permissions: Array<Permissions> = [ | ||||
| @ -437,5 +351,4 @@ export const GetPhotoBase64 = async (context: common.UIAbilityContext): Promise< | ||||
|       return '' | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| } | ||||
| @ -1,14 +1,14 @@ | ||||
| import testNapi from '@ohos.hiserialsdk'; | ||||
| import HiSerialSDK from '@ohos.hiserialsdk'; | ||||
| import { SerialPortTag } from '../config'; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * 打开串口工具 | ||||
|  * @param serialPort 串口名称 | ||||
| // 打开串口工具 | ||||
| /* | ||||
|   * @param serialPort 串口名称 | ||||
|  */ | ||||
| export const OpenSerialPort = (serialPort: string) => { | ||||
|   return new Promise<number>((resolve, reject) => { | ||||
|     HiSerialSDK.SerialOpenAsync(serialPort, (value: number) => { | ||||
|     testNapi.SerialOpenAsync(serialPort, (value: number) => { | ||||
|       if (value === -1) { | ||||
|         console.error(SerialPortTag, "打开串口失败!") | ||||
|         reject(-1) | ||||
| @ -19,17 +19,16 @@ export const OpenSerialPort = (serialPort: string) => { | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * 初始化串口数据 | ||||
|  * @param fd 串口文件描述符 | ||||
|  * @param speed 波特率 | ||||
|  * @returns Promise<boolean> 成功返回true,失败返回false | ||||
| //初始化串口数据 | ||||
| /* | ||||
|   * @param fd 串口文件描述符 | ||||
|   * @param speed 波特率 | ||||
|   * @returns Promise<boolean> 成功返回true,失败返回false | ||||
|  */ | ||||
| export const InitSerialPortData = | ||||
|   async (fd: number, speed: number) => { | ||||
|     return new Promise<boolean>((resolve, reject) => { | ||||
|       HiSerialSDK.SerialSetAsync(fd, speed, 0, 8, 1, 0x4e, (value: number) => { | ||||
|       testNapi.SerialSetAsync(fd, speed, 0, 8, 1, 0x4e, (value: number) => { | ||||
|         //   0 成功  -1失败 | ||||
|         if (value === 0) { | ||||
|           console.log(SerialPortTag, "初始化成功!") | ||||
| @ -43,17 +42,16 @@ export const InitSerialPortData = | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
| /** | ||||
|  * 发送数据 | ||||
|  * @param fd 串口文件描述符 | ||||
|  * @param data 要发送的数据数组 | ||||
|  * @returns Promise<number> 成功返回发送的字节数,失败返回-1 | ||||
| //发送数据 | ||||
| /* | ||||
|   * @param fd 串口文件描述符 | ||||
|   * @param data 要发送的数据数组 | ||||
|   * @returns Promise<number> 成功返回发送的字节数,失败返回-1 | ||||
|  */ | ||||
| export const SendSerialPortData = (fd: number, data: number[]) => { | ||||
|   console.log(SerialPortTag, "wzj-----发送数据") | ||||
|   // console.log(SerialPortTag, "wzj-----发送数据") | ||||
|   return new Promise<number>((resolve, reject) => { | ||||
|     HiSerialSDK.SerialSendAsync(fd, data, (value: number) => { | ||||
|       console.log(SerialPortTag, "发送数据完成!") | ||||
|     testNapi.SerialSendAsync(fd, data, (value: number) => { | ||||
|       if (value === -1) { | ||||
|         console.error(SerialPortTag, "发送失败!") | ||||
|         reject(-1) | ||||
| @ -63,16 +61,16 @@ export const SendSerialPortData = (fd: number, data: number[]) => { | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 接受数据 | ||||
|  * @param fd 串口文件描述符 | ||||
|  * @param timeout 超时时间,单位毫秒 | ||||
|  * @returns Promise<HiSerialSDK.receiveInfo> 成功返回接收到的数据,失败返回-1 | ||||
| // 接受数据 | ||||
| /* | ||||
|   * @param fd 串口文件描述符 | ||||
|   * @param timeout 超时时间,单位毫秒 | ||||
|   * @returns Promise<HiSerialSDK.receiveInfo> 成功返回接收到的数据,失败返回-1 | ||||
|  */ | ||||
| export const ReceiveSerialPortData = (fd: number, timeout: number,) => { | ||||
|   console.log(SerialPortTag, "wzj-----接受数据") | ||||
|   // console.log(SerialPortTag, "wzj-----接受数据") | ||||
|   return new Promise<HiSerialSDK.receiveInfo>((resolve) => { | ||||
|     HiSerialSDK.SerialRecvAsync(fd, timeout, (value: HiSerialSDK.receiveInfo) => { | ||||
|     testNapi.SerialRecvAsync(fd, timeout, (value: HiSerialSDK.receiveInfo) => { | ||||
|       resolve(value) | ||||
|     }) | ||||
|   }) | ||||
| @ -80,13 +78,13 @@ export const ReceiveSerialPortData = (fd: number, timeout: number,) => { | ||||
| 
 | ||||
| // 主动接受数据 | ||||
| export const ReceiveSerialPortDataBySelf = (fd: number, callback: Function) => { | ||||
|   HiSerialSDK.SerialListenCallbackSet(fd, callback) | ||||
|   testNapi.SerialListenCallbackSet(fd, callback) | ||||
| } | ||||
| 
 | ||||
| // 取消主动接受 | ||||
| export const CancelReceiveSerialPortData = async (fd: number) => { | ||||
|   return new Promise<boolean>((resolve, reject) => { | ||||
|     let result: number = HiSerialSDK.SerialListenCallbackCancel(fd) | ||||
|     let result: number = testNapi.SerialListenCallbackCancel(fd) | ||||
|     if (result === 0) { | ||||
|       resolve(true) | ||||
|     } else { | ||||
|  | ||||
| @ -83,7 +83,7 @@ export default class UdpClient { | ||||
|         address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1 | ||||
|       } | ||||
|     }).then(res => { | ||||
|       // console.log(UDPTag, "udp发送成功", JSON.stringify(res)) | ||||
|       console.log(UDPTag, "udp发送成功", JSON.stringify(res)) | ||||
|     }).catch((e: BusinessError) => { | ||||
|       console.error(UDPTag, "udp发送失败", JSON.stringify(e)) | ||||
|     }) | ||||
|  | ||||
| @ -43,7 +43,7 @@ class CenterUDPBusiness { | ||||
|     console.log(CenterUdpTag, "心跳", JSON.stringify(this.carInfo)) | ||||
|     // 组装消息,一秒发送一次 | ||||
|     this.timer = setInterval(() => { | ||||
|       // console.log(CenterUdpTag, "发送心跳") | ||||
|       console.log(CenterUdpTag, "发送心跳") | ||||
|       // 生成流水号 | ||||
|       SerialNumberInstance.generate() | ||||
|       // console.log(CenterUdpTag, "流水号生成") | ||||
|  | ||||
| @ -20,6 +20,8 @@ import { GetDwStatusType, GetTranslateSignals } from '../../pages/Judge/utils'; | ||||
| import { testKm2Items, testKm3Items } from '../../mock'; | ||||
| import { dConsole } from '../LogWorker'; | ||||
| 
 | ||||
| // import { examCalcGpsDistance } from '../../pages/Judge/JudgeUtils'; | ||||
| 
 | ||||
| 
 | ||||
| class JudgeUdpBusiness { | ||||
|   private static instance: JudgeUdpBusiness | ||||
|  | ||||
| @ -9,7 +9,6 @@ import { | ||||
| } from '../SerialPort'; | ||||
| import Prompt from '@system.prompt'; | ||||
| import { SerialPortTag } from '../../config'; | ||||
| import { EnvironmentConfigurationType } from '../../model'; | ||||
| 
 | ||||
| class serialPortService { | ||||
|   private fd: number = -1 | ||||
| @ -21,11 +20,6 @@ class serialPortService { | ||||
|   private tryCount: number = 0 | ||||
| 
 | ||||
|   async init() { | ||||
|     let config: EnvironmentConfigurationType = AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")! | ||||
|     if (config.manufacturer === "2") { | ||||
|       console.log(SerialPortTag, "更改润和串口端口") | ||||
|       this.serialPort = "/dev/ttyS7" | ||||
|     } | ||||
|     const res = await OpenSerialPort(this.serialPort) | ||||
|     if (res === -1) { | ||||
|       Prompt.showToast({ | ||||
|  | ||||
| @ -34,10 +34,7 @@ export function SqlInsertTable(tableName: string, data: Array<RecordType>, delFl | ||||
|       const columns: string = columnsData?.filter((column) => column !== "id").join(",") || ""; | ||||
|       const values = data.map(item => { | ||||
|         const value = columnsData?.filter(column => column !== "id") | ||||
|           .map((column) => { | ||||
|             // return `'${Reflect.get(item, column) || ""}'` | ||||
|             return `'${Object.entries(item).find((keyArr: Array<string>) => keyArr[0] === column)?.[1] || ""}'` | ||||
|           }) | ||||
|           .map((column) => `'${Reflect.get(item, column) || ""}'`) | ||||
|           .join(",") | ||||
|         return `(${value})` | ||||
|       }).join(",") | ||||
| @ -55,6 +52,8 @@ export function SqlInsertTable(tableName: string, data: Array<RecordType>, delFl | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| // 参数平台 | ||||
| 
 | ||||
| // TODO 后续废弃这个方法,直接调用SqlInsertTable | ||||
| // 依据数组和表名更新sql表 | ||||
| export function UpdateTableByArray(tableName: string, arr: Array<RecordType>): Promise<boolean> { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user