Compare commits
	
		
			3 Commits
		
	
	
		
			3ee0145b66
			...
			afb59d0611
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | afb59d0611 | ||
|  | 3f08b76e08 | ||
|  | 77523adcb2 | 
| @ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 2, | ||||||
|   "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": {} | ||||||
|  | |||||||
| @ -305,6 +305,7 @@ export struct JudgePage { | |||||||
|       } |       } | ||||||
|       tempObj.markserial = mark.markserial |       tempObj.markserial = mark.markserial | ||||||
|       Reflect.set(this.markRuleListObj, `${mark.itemno}_${mark.markserial}`, tempObj) |       Reflect.set(this.markRuleListObj, `${mark.itemno}_${mark.markserial}`, tempObj) | ||||||
|  |       dConsole.log(JudgeTag, 'markRuleListObj' + JSON.stringify(this.markRuleListObj)) | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ import { | |||||||
|   ItemInfo, |   ItemInfo, | ||||||
|   ItemInfos, |   ItemInfos, | ||||||
|   JudgeBeginObj, |   JudgeBeginObj, | ||||||
|  |   JudgeCallBackData, | ||||||
|   JudgeInitObj, |   JudgeInitObj, | ||||||
|   JudgeKFXM, |   JudgeKFXM, | ||||||
|   JudgeKSXM, |   JudgeKSXM, | ||||||
| @ -15,28 +16,17 @@ import { | |||||||
|   MAPITEMPOINTITEM, |   MAPITEMPOINTITEM, | ||||||
|   MAPPOINT, |   MAPPOINT, | ||||||
|   MarkRule, |   MarkRule, | ||||||
|   ProcessDataEnumType, |   Project, | ||||||
|   ProjectInfo, |   ProjectInfo, | ||||||
|  |   ProjectInfos, | ||||||
|   RouteParamsType, |   RouteParamsType, | ||||||
|   SyssetConfig, |   SyssetConfig, | ||||||
|   SYSTEM_PARAM, |   SYSTEM_PARAM | ||||||
|   Project, |  | ||||||
|   ProjectInfos, |  | ||||||
|   JudgeCallBackData, |  | ||||||
|   KmItem |  | ||||||
| } 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'; | ||||||
| import { | import { examJudgeVersion } from './JudgeSDKUtils'; | ||||||
|   examJudgeBeginExam, |  | ||||||
|   examJudgeInit, |  | ||||||
|   examJudgeSetLogCallback, |  | ||||||
|   examJudgeSetPerformCallback, |  | ||||||
|   examJudgeSetRealExamCallback, |  | ||||||
|   examJudgeVersion |  | ||||||
| } from './JudgeSDKUtils'; |  | ||||||
| import JudgeBusiness from './JudgeBusiness'; | import JudgeBusiness from './JudgeBusiness'; | ||||||
| import { saveStartRecordVideo } from '../../utils/Video'; |  | ||||||
| import router from '@ohos.router'; | import router from '@ohos.router'; | ||||||
| import { GetModelData } from './utils'; | import { GetModelData } from './utils'; | ||||||
| import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines'; | import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines'; | ||||||
| @ -50,129 +40,6 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|   private mockLight: boolean = false |   private mockLight: boolean = false | ||||||
|   private mode: number = 1 |   private mode: number = 1 | ||||||
| 
 | 
 | ||||||
|   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) { |  | ||||||
|       allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { |  | ||||||
|         const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); |  | ||||||
|         const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context) |  | ||||||
|         const temp: ItemInfo = { |  | ||||||
|           xmdm: cdsb?.xmdm || 0, |  | ||||||
|           xmxh: cdsb?.xmxh || "", |  | ||||||
|           model: model || "" |  | ||||||
|         } |  | ||||||
|         return temp |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     //获取版本号 |  | ||||||
|     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<BaseInfoType>('baseInfo')?.version || "", |  | ||||||
|       kskm: Number(carInfo?.examSubject || "2"), |  | ||||||
|       kchp: carInfo?.plateNo || "", |  | ||||||
|       kchm: Number(carInfo?.carId || ""), |  | ||||||
|       kscx: carType, |  | ||||||
|       cxcode: '1', |  | ||||||
|       name: carName, |  | ||||||
|       carmodel: GetModelData(`${examType}/${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: GetModelData('km3/Roads.txt', context) || "", |  | ||||||
|         sharps: GetModelData('km3/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; | ||||||
| @ -472,4 +339,129 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|   public async JudgeEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { |   public async JudgeEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { | ||||||
|     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(`${examType}/${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<BaseInfoType>('baseInfo')?.version || "", | ||||||
|  |       kskm: Number(carInfo?.examSubject || "2"), | ||||||
|  |       kchp: carInfo?.plateNo || "", | ||||||
|  |       kchm: Number(carInfo?.carId || ""), | ||||||
|  |       kscx: carType, | ||||||
|  |       cxcode: '1', | ||||||
|  |       name: carName, | ||||||
|  |       carmodel: await GetModelData(`${examType}/${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('km3/Roads.txt', context) || "", | ||||||
|  |         sharps: await GetModelData('km3/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 | ||||||
|  |   }; | ||||||
| } | } | ||||||
| @ -102,17 +102,19 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|     dConsole.log(JudgeTag, "itemInfoObj", itemInfoObj) |     dConsole.log(JudgeTag, "itemInfoObj", itemInfoObj) | ||||||
|     let allitems: ItemInfo[] = []; |     let allitems: ItemInfo[] = []; | ||||||
|     if (examSubject == '2' && itemInfoObj) { |     if (examSubject == '2' && itemInfoObj) { | ||||||
|       allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { |       const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { | ||||||
|         // const cdsb: CDSBInfo = Reflect.get(itemInfoObj, 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 = Object.entries(itemInfoObj).find((arr: Array<string>) => arr[0] === cdsbKey)![1]; | ||||||
|         const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context) |         const model = await GetModelData(`${examType}/${cdsb.modelKey}.txt`, context); | ||||||
|         const temp: ItemInfo = { |         const temp: ItemInfo = { | ||||||
|           xmdm: cdsb?.xmdm || 0, |           xmdm: cdsb?.xmdm || 0, | ||||||
|           xmxh: cdsb?.xmxh || "", |           xmxh: cdsb?.xmxh || "", | ||||||
|           model: model || "" |           model: model || "" | ||||||
|         } |         }; | ||||||
|         return temp |         return temp; | ||||||
|       }) |       }); | ||||||
|  |       // 等待所有的 Promise 解析完成 | ||||||
|  |       allitems = await Promise.all(promiseItems); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //获取版本号 |     //获取版本号 | ||||||
| @ -130,7 +132,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|       kscx: carType, |       kscx: carType, | ||||||
|       cxcode: '1', |       cxcode: '1', | ||||||
|       name: carName, |       name: carName, | ||||||
|       carmodel: GetModelData(`${examType}/${carType}.txt`, context) || "", |       carmodel: await GetModelData(`${examType}/${carType}.txt`, context) || "", | ||||||
|       allitems, |       allitems, | ||||||
|       iteminfo: [], |       iteminfo: [], | ||||||
|       systemparm: systemparmArr, |       systemparm: systemparmArr, | ||||||
| @ -147,8 +149,8 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|         map_point_item: mapPointItemArr, |         map_point_item: mapPointItemArr, | ||||||
|         //科目三暂时为空 |         //科目三暂时为空 | ||||||
|         iteminfo: [], |         iteminfo: [], | ||||||
|         roads: GetModelData('km3/Roads.txt', context) || "", |         roads: await GetModelData('km3/Roads.txt', context) || "", | ||||||
|         sharps: GetModelData('km3/Sharps.txt', context) || "" |         sharps: await GetModelData('km3/Sharps.txt', context) || "" | ||||||
|       }; |       }; | ||||||
|       initInfo.map_point = km3Config.map_point |       initInfo.map_point = km3Config.map_point | ||||||
|       initInfo.map_point_item = km3Config.map_point_item |       initInfo.map_point_item = km3Config.map_point_item | ||||||
|  | |||||||
| @ -11,21 +11,19 @@ import { | |||||||
|   MarkRule, |   MarkRule, | ||||||
|   PLCType, |   PLCType, | ||||||
|   ProcessDataEnumType, |   ProcessDataEnumType, | ||||||
|   Project, |  | ||||||
|   ProjectInfo, |   ProjectInfo, | ||||||
|   ProjectInfos, |   ProjectInfos, | ||||||
|   ProjectRoads, |   ProjectRoads, | ||||||
|   Radar, |   Radar, | ||||||
|   Vision |   Vision | ||||||
| } from '../../model'; | } from '../../model'; | ||||||
| import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common'; | import { ArrayToByteArray, NumberToByteArray, ReadFileContent } from '../../utils/Common'; | ||||||
| import dayTs from '../../utils/Date'; | import dayTs from '../../utils/Date'; | ||||||
| import { dConsole } from '../../utils/LogWorker'; | import { dConsole } from '../../utils/LogWorker'; | ||||||
| import FileModel from '../judgeSDK/utils/fileModel'; |  | ||||||
| import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'; | import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'; | ||||||
| import { examJudgeSoundEnd } from './JudgeSDKUtils'; | import { examJudgeSoundEnd } from './JudgeSDKUtils'; | ||||||
| import common from '@ohos.app.ability.common'; | import common from '@ohos.app.ability.common'; | ||||||
| import { JudgeConfig, JudgeTag } from '../../config'; | import { GlobalConfig, JudgeConfig, JudgeTag } from '../../config'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // 中心信号转换 | // 中心信号转换 | ||||||
| @ -915,9 +913,12 @@ export const DetectingDifferences = async (type: number, avPlayer: VoiceAnnounce | |||||||
| /** | /** | ||||||
|  * 获取车辆模型 |  * 获取车辆模型 | ||||||
|  */ |  */ | ||||||
| export const GetModelData = (modelName: string, context: common.UIAbilityContext): string => { | export const GetModelData = async (modelName: string, context: common.UIAbilityContext): Promise<string> => { | ||||||
|   try { |   try { | ||||||
|     return new FileModel(context).getModelContent(JudgeConfig.modelPath, modelName) || ""; |     let path = GlobalConfig.commonFileWriteAddress + "/" + JudgeConfig.modelPath + "/" + modelName | ||||||
|  |     const res = await ReadFileContent(path) | ||||||
|  |     return res || "" | ||||||
|  |     // return new FileModel(context).getModelContent(JudgeConfig.modelPath, modelName) || ""; | ||||||
|   } catch (e) { |   } catch (e) { | ||||||
|     // 可根据实际需求,返回空字符串或抛出异常 |     // 可根据实际需求,返回空字符串或抛出异常 | ||||||
|     dConsole.error(JudgeTag, `获取模型数据失败: ${modelName}`, e.message) |     dConsole.error(JudgeTag, `获取模型数据失败: ${modelName}`, e.message) | ||||||
|  | |||||||
| @ -452,3 +452,8 @@ export const GetPhotoBase64 = async (context: common.UIAbilityContext): Promise< | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | export function GetObjectValue<T>(obj: T, key: string): ESObject { | ||||||
|  |   // 推荐:直接使用索引访问 | ||||||
|  |   return obj[key as keyof T]; | ||||||
|  | } | ||||||
| @ -50,7 +50,7 @@ export const InitSerialPortData = | |||||||
|  * @returns Promise<number> 成功返回发送的字节数,失败返回-1 |  * @returns Promise<number> 成功返回发送的字节数,失败返回-1 | ||||||
|  */ |  */ | ||||||
| export const SendSerialPortData = (fd: number, data: number[]) => { | export const SendSerialPortData = (fd: number, data: number[]) => { | ||||||
|   console.log(SerialPortTag, "wzj-----发送数据") |   // console.log(SerialPortTag, "wzj-----发送数据") | ||||||
|   return new Promise<number>((resolve, reject) => { |   return new Promise<number>((resolve, reject) => { | ||||||
|     HiSerialSDK.SerialSendAsync(fd, data, (value: number) => { |     HiSerialSDK.SerialSendAsync(fd, data, (value: number) => { | ||||||
|       console.log(SerialPortTag, "发送数据完成!") |       console.log(SerialPortTag, "发送数据完成!") | ||||||
|  | |||||||
| @ -9,7 +9,6 @@ import { | |||||||
| } from '../SerialPort'; | } from '../SerialPort'; | ||||||
| import Prompt from '@system.prompt'; | import Prompt from '@system.prompt'; | ||||||
| import { SerialPortTag } from '../../config'; | import { SerialPortTag } from '../../config'; | ||||||
| import { EnvironmentConfigurationType } from '../../model'; |  | ||||||
| 
 | 
 | ||||||
| class serialPortService { | class serialPortService { | ||||||
|   private fd: number = -1 |   private fd: number = -1 | ||||||
| @ -21,11 +20,6 @@ class serialPortService { | |||||||
|   private tryCount: number = 0 |   private tryCount: number = 0 | ||||||
| 
 | 
 | ||||||
|   async init() { |   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) |     const res = await OpenSerialPort(this.serialPort) | ||||||
|     if (res === -1) { |     if (res === -1) { | ||||||
|       Prompt.showToast({ |       Prompt.showToast({ | ||||||
|  | |||||||
| @ -35,8 +35,8 @@ export function SqlInsertTable(tableName: string, data: Array<RecordType>, delFl | |||||||
|       const values = data.map(item => { |       const values = data.map(item => { | ||||||
|         const value = columnsData?.filter(column => column !== "id") |         const value = columnsData?.filter(column => column !== "id") | ||||||
|           .map((column) => { |           .map((column) => { | ||||||
|             // return `'${Reflect.get(item, column) || ""}'` |             return `'${Reflect.get(item, column) || ""}'` | ||||||
|             return `'${Object.entries(item).find((keyArr: Array<string>) => keyArr[0] === column)?.[1] || ""}'` |             // return `'${Object.entries(item).find((keyArr: Array<string>) => keyArr[0] === column)?.[1] || ""}'` | ||||||
|           }) |           }) | ||||||
|           .join(",") |           .join(",") | ||||||
|         return `(${value})` |         return `(${value})` | ||||||
|  | |||||||
| @ -81,14 +81,18 @@ function getDataFn(config: EnvironmentConfigurationType) { | |||||||
|       // TODO |       // TODO | ||||||
|       // 需要观察 |       // 需要观察 | ||||||
|       // console.log(WorkerTag, "后置机消息", data) |       // console.log(WorkerTag, "后置机消息", data) | ||||||
|       const res = await SerialPortService.getData() |       try { | ||||||
|       console.log(SerialPortTag, "档位原始数据", res) |         const res = await SerialPortService.getData() | ||||||
|       if (res.length > 0) { |         console.log(SerialPortTag, "档位原始数据", res) | ||||||
|         const dataArray = data.split(","); |         if (res.length > 0) { | ||||||
|         // 替换data的第28位 |           const dataArray = data.split(","); | ||||||
|         dataArray[28] = res[9].toString(); |           // 替换data的第28位 | ||||||
|         data = dataArray.join(","); |           dataArray[28] = res[9].toString(); | ||||||
|         // console.log(SerialPortTag, "档位", res[9].toString()) |           data = dataArray.join(","); | ||||||
|  |           // console.log(SerialPortTag, "档位", res[9].toString()) | ||||||
|  |         } | ||||||
|  |       } catch (err) { | ||||||
|  |         console.error(SerialPortTag, "获取档位信号失败", err) | ||||||
|       } |       } | ||||||
|       // console.log(SerialPortTag, "处理完的档位信号", data) |       // console.log(SerialPortTag, "处理完的档位信号", data) | ||||||
|       workerPort.postMessage( |       workerPort.postMessage( | ||||||
|  | |||||||
| @ -1,18 +1,20 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 2, | ||||||
|   "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/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" |     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" | ||||||
|   }, |   }, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "@ohos/crypto-js@2.0.3": { |  | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", |  | ||||||
|       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==" |  | ||||||
|     }, |  | ||||||
|     "@ohos/hypium@1.0.19": { |     "@ohos/hypium@1.0.19": { | ||||||
|       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", | ||||||
|       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" |       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", | ||||||
|  |       "registryType": "ohpm" | ||||||
|  |     }, | ||||||
|  |     "@ohos/crypto-js@2.0.3": { | ||||||
|  |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", | ||||||
|  |       "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", | ||||||
|  |       "registryType": "ohpm" | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user