Compare commits
	
		
			No commits in common. "afb59d06110570d36b117279b2425a796cf4424e" and "3ee0145b6679d8eb83d5d42b0f60c95a2b5f501d" have entirely different histories.
		
	
	
		
			afb59d0611
			...
			3ee0145b66
		
	
		
| @ -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": {} | ||||||
|  | |||||||
| @ -305,7 +305,6 @@ 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,7 +8,6 @@ import { | |||||||
|   ItemInfo, |   ItemInfo, | ||||||
|   ItemInfos, |   ItemInfos, | ||||||
|   JudgeBeginObj, |   JudgeBeginObj, | ||||||
|   JudgeCallBackData, |  | ||||||
|   JudgeInitObj, |   JudgeInitObj, | ||||||
|   JudgeKFXM, |   JudgeKFXM, | ||||||
|   JudgeKSXM, |   JudgeKSXM, | ||||||
| @ -16,17 +15,28 @@ import { | |||||||
|   MAPITEMPOINTITEM, |   MAPITEMPOINTITEM, | ||||||
|   MAPPOINT, |   MAPPOINT, | ||||||
|   MarkRule, |   MarkRule, | ||||||
|   Project, |   ProcessDataEnumType, | ||||||
|   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 { examJudgeVersion } from './JudgeSDKUtils'; | import { | ||||||
|  |   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'; | ||||||
| @ -40,6 +50,129 @@ 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; | ||||||
| @ -339,129 +472,4 @@ 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,19 +102,17 @@ 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) { | ||||||
|       const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { |       allitems = Reflect.ownKeys(itemInfoObj).map(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 = await GetModelData(`${examType}/${cdsb.modelKey}.txt`, context); |         const model = 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); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //获取版本号 |     //获取版本号 | ||||||
| @ -132,7 +130,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|       kscx: carType, |       kscx: carType, | ||||||
|       cxcode: '1', |       cxcode: '1', | ||||||
|       name: carName, |       name: carName, | ||||||
|       carmodel: await GetModelData(`${examType}/${carType}.txt`, context) || "", |       carmodel: GetModelData(`${examType}/${carType}.txt`, context) || "", | ||||||
|       allitems, |       allitems, | ||||||
|       iteminfo: [], |       iteminfo: [], | ||||||
|       systemparm: systemparmArr, |       systemparm: systemparmArr, | ||||||
| @ -149,8 +147,8 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | |||||||
|         map_point_item: mapPointItemArr, |         map_point_item: mapPointItemArr, | ||||||
|         //科目三暂时为空 |         //科目三暂时为空 | ||||||
|         iteminfo: [], |         iteminfo: [], | ||||||
|         roads: await GetModelData('km3/Roads.txt', context) || "", |         roads: GetModelData('km3/Roads.txt', context) || "", | ||||||
|         sharps: await GetModelData('km3/Sharps.txt', context) || "" |         sharps: 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,19 +11,21 @@ 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, ReadFileContent } from '../../utils/Common'; | import { ArrayToByteArray, NumberToByteArray } 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 { GlobalConfig, JudgeConfig, JudgeTag } from '../../config'; | import { JudgeConfig, JudgeTag } from '../../config'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // 中心信号转换 | // 中心信号转换 | ||||||
| @ -913,12 +915,9 @@ export const DetectingDifferences = async (type: number, avPlayer: VoiceAnnounce | |||||||
| /** | /** | ||||||
|  * 获取车辆模型 |  * 获取车辆模型 | ||||||
|  */ |  */ | ||||||
| export const GetModelData = async (modelName: string, context: common.UIAbilityContext): Promise<string> => { | export const GetModelData = (modelName: string, context: common.UIAbilityContext): string => { | ||||||
|   try { |   try { | ||||||
|     let path = GlobalConfig.commonFileWriteAddress + "/" + JudgeConfig.modelPath + "/" + modelName |     return new FileModel(context).getModelContent(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,8 +452,3 @@ 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,6 +9,7 @@ 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 | ||||||
| @ -20,6 +21,11 @@ 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,18 +81,14 @@ function getDataFn(config: EnvironmentConfigurationType) { | |||||||
|       // TODO |       // TODO | ||||||
|       // 需要观察 |       // 需要观察 | ||||||
|       // console.log(WorkerTag, "后置机消息", data) |       // console.log(WorkerTag, "后置机消息", data) | ||||||
|       try { |       const res = await SerialPortService.getData() | ||||||
|         const res = await SerialPortService.getData() |       console.log(SerialPortTag, "档位原始数据", res) | ||||||
|         console.log(SerialPortTag, "档位原始数据", res) |       if (res.length > 0) { | ||||||
|         if (res.length > 0) { |         const dataArray = data.split(","); | ||||||
|           const dataArray = data.split(","); |         // 替换data的第28位 | ||||||
|           // 替换data的第28位 |         dataArray[28] = res[9].toString(); | ||||||
|           dataArray[28] = res[9].toString(); |         data = dataArray.join(","); | ||||||
|           data = dataArray.join(","); |         // console.log(SerialPortTag, "档位", res[9].toString()) | ||||||
|           // 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,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/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/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