fix: 评判代码抽离优化
This commit is contained in:
		
							parent
							
								
									98813fe361
								
							
						
					
					
						commit
						b0692d358c
					
				| @ -477,7 +477,7 @@ export interface JudgeUI { | ||||
|   ksdd: string | ||||
|   errorMsg: string | ||||
|   name: string | ||||
|   kfArrScroller: Scroller | ||||
|   // kfArrScroller: Scroller | ||||
|   disConnectErrorOpen: boolean | ||||
|   currentXmdm?: number | ||||
|   isRequiredProjectsEnd: boolean | ||||
|  | ||||
| @ -24,8 +24,6 @@ import { | ||||
|   LANE, | ||||
|   MA_CDSBINFOType, | ||||
|   MA_ITEMINFOType, | ||||
|   MA_MAP_POINT_ITEMType, | ||||
|   MA_MAP_POINTType, | ||||
|   MA_SYSTEMPARMType, | ||||
|   MAPITEMPOINTITEM, | ||||
|   MAPPOINT, | ||||
| @ -35,7 +33,6 @@ import { | ||||
|   Project, | ||||
|   ProjectInfo, | ||||
|   ProjectInfos, | ||||
|   ProjectRoads, | ||||
|   RouteParamsType, | ||||
|   SYSSET, | ||||
|   SyssetConfig, | ||||
| @ -44,7 +41,7 @@ import { | ||||
| } from '../model'; | ||||
| import { GetSyncData } from '../utils/table/Operation'; | ||||
| import dayTs from '../utils/Date'; | ||||
| import { CutArray, GetCurrentTime } from '../utils/Common'; | ||||
| import { GetCurrentTime } from '../utils/Common'; | ||||
| import FileUtils from '../utils/FileUtils'; | ||||
| import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog'; | ||||
| import { DefaultJudgeConfigData } from '../mock'; | ||||
| @ -54,6 +51,9 @@ import CarLoadingDialog from './compontents/CarLoading'; | ||||
| import HeaderComponent from './compontents/Header'; | ||||
| import MessageComponent from './Judge/Message'; | ||||
| import OperatingAreaComponent from './Judge/OperatingArea'; | ||||
| import JudgeAndProjectComponent from './Judge/JudgeAndProject'; | ||||
| import { GetIsExitManualProject } from './Judge/utils'; | ||||
| import { InitMapPoint, InitMapPointItem } from './Judge/TableUtils'; | ||||
| 
 | ||||
| 
 | ||||
| @Entry | ||||
| @ -62,8 +62,6 @@ struct JudgePage { | ||||
|   scroller: Scroller = new Scroller() | ||||
|   //页面通用字体大小 | ||||
|   @State wayno: number = 0 | ||||
|   @State FONTSIZE: number = 30 | ||||
|   @State BIGFONTSIZE: number = 32 | ||||
|   @State isDdxk: boolean = false; | ||||
|   @State time: string = '' | ||||
|   //考试用时 | ||||
| @ -139,7 +137,6 @@ struct JudgePage { | ||||
|   //定位差分状态时候正常 | ||||
|   @State isDwztRight: boolean = true; | ||||
|   @State defaultTabIndex: number = 0; | ||||
|   public kfArrScroller: Scroller = new Scroller() | ||||
|   //档位 | ||||
|   @State dw: string = '' | ||||
|   //速度 | ||||
| @ -246,8 +243,8 @@ struct JudgePage { | ||||
| 
 | ||||
|     // 科目三新增读取表数据 | ||||
|     if (this.examSubject == '3') { | ||||
|       await this.initMapPoint() | ||||
|       await this.initMapPointItem() | ||||
|       this.mapPointArr = await InitMapPoint() | ||||
|       this.mapPointItemArr = await InitMapPointItem() | ||||
|       //定时上传考试里程 | ||||
|       // let mileageTimer = setInterval(()=>{ | ||||
|       //   this.uploadMileage() | ||||
| @ -624,40 +621,6 @@ struct JudgePage { | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   // 初始化mapPoint表 | ||||
|   async initMapPoint() { | ||||
|     const pointParams: MA_MAP_POINTType[] = await GetSyncData<MA_MAP_POINTType>('MA_MAP_POINT') | ||||
|     pointParams.forEach(item => { | ||||
| 
 | ||||
|       this.mapPointArr.push({ | ||||
|         point_no: Number(item.point_no), | ||||
|         gps_e: Number(item.gps_e), | ||||
|         gps_n: Number(item.gps_n), | ||||
|         point_no_f: Number(item.point_no_f), | ||||
|         point_type: Number(item.point_type), | ||||
|         road_code: item.road_code!, | ||||
|         gps_e_Location: Number(item.gps_e_location), | ||||
|         gps_n_Location: Number(item.gps_n_location), | ||||
|         f_gps_e: Number(item.f_gps_e), | ||||
|         f_gps_n: Number(item.f_gps_n), | ||||
|         passed: Number(item.passed) | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   // 初始化mapPointItem表 | ||||
|   async initMapPointItem() { | ||||
|     const pointItemPoints: MA_MAP_POINT_ITEMType[] = await GetSyncData<MA_MAP_POINT_ITEMType>('MA_MAP_POINT_ITEM'); | ||||
|     pointItemPoints.forEach(item => { | ||||
|       this.mapPointItemArr.push({ | ||||
|         point_no: Number(item.point_no), | ||||
|         itemno: Number(item.itemno), | ||||
|         itemno1: Number(item.itemno1), | ||||
|         subname: item.subname! | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   // 初始化本地systemparam表、markrule表 | ||||
|   async initTrajectoryParam(trajectoryPath: string) { | ||||
|     const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen | ||||
| @ -734,199 +697,28 @@ struct JudgePage { | ||||
|               wayno: this.wayno, | ||||
|               judgeConfigObj: this.judgeConfigObj, | ||||
|             }) | ||||
|             Column() { | ||||
|               Row() { | ||||
|                 Text(this.carztStr).fontColor('#FFA500').fontSize(this.FONTSIZE) | ||||
|                 if (Reflect.get(this.judgeConfigObj, '342') == '0') { | ||||
|                   Text(`${this.dw}挡`).fontColor('#FFA500').fontSize(this.FONTSIZE).padding({ left: 15, right: 15 }) | ||||
|                   Text(`${this.sd}km/h`).fontColor('#FFA500').fontSize(this.FONTSIZE) | ||||
|                 } | ||||
|               }.height(40) | ||||
| 
 | ||||
|               Row() { | ||||
|                 Flex({ direction: FlexDirection.Column }) { | ||||
|                   if (this.kfArr.length) { | ||||
|                     List({ scroller: this.kfArrScroller }) { | ||||
|                       ForEach(this.kfArr, (item: MarkRule) => { | ||||
|                         ListItem() { | ||||
|                           Column() { | ||||
|                             Row() { | ||||
|                               Text(item.xmmcStr).fontSize(this.BIGFONTSIZE).fontColor('#FFF') | ||||
|                               Text(`${item.score}分`).fontSize(this.BIGFONTSIZE).fontColor('#FFF') | ||||
|                             } | ||||
|                             .width('100%') | ||||
|                             .backgroundColor('#38260B') | ||||
|                             .justifyContent(FlexAlign.SpaceBetween) | ||||
|                             .padding({ | ||||
|                               top: 12, | ||||
|                               bottom: 12, | ||||
|                               left: 8, | ||||
|                               right: 5 | ||||
|                             }) | ||||
| 
 | ||||
|                             Text(item.desc + `(${item.markcatalog})`) | ||||
|                               .fontSize(this.BIGFONTSIZE) | ||||
|                               .fontColor('#E5CBA1') | ||||
|                               .margin({ | ||||
|                                 top: 10, | ||||
|                                 bottom: 8, | ||||
|                                 left: 5, | ||||
|                                 right: 5 | ||||
|                               }) | ||||
|                           }.margin({ top: 15 }).alignItems(HorizontalAlign.Start) | ||||
| 
 | ||||
|                         }.margin({ bottom: 25 }) | ||||
|                       }) | ||||
|                     } | ||||
|                     .padding({ | ||||
|                       left: 15, | ||||
|                       right: 15, | ||||
|                       top: 30, | ||||
|                       bottom: 5 | ||||
|                     }) | ||||
|                   } else { | ||||
|                     Column() { | ||||
|                       Row() { | ||||
|                         Text('暂无扣分项').fontSize(this.BIGFONTSIZE).fontColor('#FFF') | ||||
|                       } | ||||
|                       .width('100%') | ||||
|                       .backgroundColor('#38260B') | ||||
|                       .justifyContent(FlexAlign.SpaceBetween) | ||||
|                       .padding({ | ||||
|                         top: 12, | ||||
|                         bottom: 12, | ||||
|                         left: 8, | ||||
|                         right: 3 | ||||
|                       }) | ||||
|                     }.margin({ top: 35 }).padding({ left: 20, right: 20 }).alignItems(HorizontalAlign.Start) | ||||
|                   } | ||||
|                 } | ||||
|                 .backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat) | ||||
|                 .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                 .width(514) | ||||
|                 .height(618) | ||||
|                 .padding({ | ||||
|                   top: 18, | ||||
|                   bottom: 15, | ||||
|                   left: 13, | ||||
|                   right: 14 | ||||
|                 }) | ||||
| 
 | ||||
|                 //科目二 | ||||
|                 if (this.examSubject == "2") { | ||||
|                   Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { | ||||
|                     List({}) { | ||||
|                       ForEach(CutArray(this.projects, 2), (item: [ProjectInfo, ProjectInfo]) => { | ||||
|                         ListItem() { | ||||
|                           Row() { | ||||
|                             Row() { | ||||
|                               //#FF7566 #00FFD5 #E6DECF | ||||
|                               // Text(this.projectsObj[item[0].projectCode]) | ||||
|                               Text(item[0].abbreviation) | ||||
|                                 .fontSize(item[0].abbreviation!.length > 5 ? 28 : 32) | ||||
|                                 .fontColor(this.getProjectColor(item[0])) | ||||
|                             } | ||||
|                             .backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat) | ||||
|                             .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                             .width('48.5%') | ||||
|                             .height(115) | ||||
|                             .margin({ bottom: 5 }) | ||||
|                             .justifyContent(FlexAlign.Center) | ||||
| 
 | ||||
|                             if (item[1]) { | ||||
|                               Row() { | ||||
|                                 //#FF7566 #00FFD5 #E6DECF | ||||
|                                 Text(item[1].abbreviation) | ||||
|                                   .fontSize(item[1].abbreviation.length > 5 ? 28 : 32) | ||||
|                                   .fontColor(this.getProjectColor(item[1])) | ||||
|                               } | ||||
|                               .backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat) | ||||
|                               .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                               .width('48.5%') | ||||
|                               .height(115) | ||||
|                               .margin({ left: 5, bottom: 5 }) | ||||
|                               .justifyContent(FlexAlign.Center) | ||||
|                             } | ||||
|                           } | ||||
|                         } | ||||
|                       }); | ||||
|                     } | ||||
|                   } | ||||
|                   .backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat) | ||||
|                   .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                   .width('57%') | ||||
|                   .height('100%') | ||||
|                   .padding(30) | ||||
|                   .margin({ right: 10 }) | ||||
|                 } | ||||
|                 //科目三 | ||||
|                 if (this.examSubject == '3') { | ||||
|                   Column() { | ||||
|                     Flex({ | ||||
|                       wrap: FlexWrap.Wrap, | ||||
|                       direction: FlexDirection.Row, | ||||
|                       justifyContent: FlexAlign.SpaceBetween | ||||
|                     }) { | ||||
|                       List({}) { | ||||
|                         ForEach(this.projects, (project: ProjectInfo) => { | ||||
|                           ListItem() { | ||||
|                             Text(project.name) { | ||||
|                             } | ||||
|                             .fontColor(this.getProjectColor(project)) | ||||
|                             .margin({ bottom: 2 }) | ||||
|                             .fontSize(24) | ||||
|                           }.margin({ bottom: 2 }) | ||||
|                         }) | ||||
|                       }.lanes(2).margin({ left: 25 }) | ||||
|                     } | ||||
|                     .width('100%') | ||||
|                     .height('57%') | ||||
|                     .backgroundImage($rawfile('judge/project_km3_bg.png'), ImageRepeat.NoRepeat) | ||||
|                     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                     .padding(30) | ||||
|                     .margin({ right: 5 }) | ||||
| 
 | ||||
|                     if (this.projects.length) { | ||||
|                       Flex({ | ||||
|                         wrap: FlexWrap.Wrap, | ||||
|                         direction: FlexDirection.Row, | ||||
|                         justifyContent: FlexAlign.SpaceAround | ||||
|                       }) { | ||||
|                         List() { | ||||
|                           ForEach(this.artSubject3Projects, (item: string, index) => { | ||||
|                             ListItem() { | ||||
|                             } | ||||
|                             .backgroundImage( | ||||
|                               $rawfile( | ||||
|                                 `judge/km3/${this.getIsExitManualProject(index) ? (this.getIsEndManualProject(index)) : | ||||
|                                   (item + '_gray')}.png` | ||||
|                               ), ImageRepeat.NoRepeat) | ||||
|                             .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                             .width(174) | ||||
|                             .height(118 * 0.95) | ||||
|                             .margin({ bottom: 8 }) | ||||
|                             .onClick(() => { | ||||
|                               // this.vocObj.playAudio({ | ||||
|                               //   type: 1, | ||||
|                               //   name: 'button_media.wav' | ||||
|                               // }) | ||||
|             //  扣分列表和评判列表 | ||||
|             JudgeAndProjectComponent({ | ||||
|               carztStr: this.carztStr, | ||||
|               judgeConfigObj: this.judgeConfigObj, | ||||
|               dw: this.dw, | ||||
|               sd: this.sd, | ||||
|               kfArr: this.kfArr, | ||||
|               examSubject: this.examSubject, | ||||
|               projects: this.projects, | ||||
|               artSubject3Projects: this.artSubject3Projects, | ||||
|               artSubject3ProjectsCodesArr: this.artSubject3ProjectsCodesArr, | ||||
|               projectsObj: this.projectsObj, | ||||
|               isManualProjectIn: this.isManualProjectIn, | ||||
|               isProjectIn: this.isProjectIn, | ||||
|               jl: this.jl, | ||||
|               examMileage: this.examMileage, | ||||
|               isRequiredProjectsEnd: this.isRequiredProjectsEnd, | ||||
|               lane: this.lane, | ||||
|               examClick: (index: number) => { | ||||
|                 this.setManualProjectFn(index) | ||||
|               } | ||||
|             }) | ||||
|                           }) | ||||
|                         }.lanes(3).margin({ left: 5, top: 12 }) | ||||
|                       } | ||||
|                     } | ||||
| 
 | ||||
|                   } | ||||
|                   .backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat) | ||||
|                   .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                   .width(660) | ||||
|                   .height(640) | ||||
|                   .padding(44) | ||||
|                   .margin({ right: 10 }) | ||||
|                 } | ||||
|               }.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween) | ||||
|             }.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 }) | ||||
|           }.height('100%').alignItems(HorizontalAlign.Start) | ||||
|         }.width('75%').height('100%') | ||||
| 
 | ||||
| @ -1035,43 +827,23 @@ struct JudgePage { | ||||
|           }, | ||||
|         }) | ||||
|       } | ||||
| 
 | ||||
|       if (this.disConnectErrorOpen) { | ||||
| 
 | ||||
|       } | ||||
|     } | ||||
|     .height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start) | ||||
|   } | ||||
| 
 | ||||
|   getProjectColor(project: ProjectInfo) { | ||||
|     const type = project.type; | ||||
|     switch (type) { | ||||
|       case '1': | ||||
|         return '#E6DECF'; | ||||
|       case '2': | ||||
|         return '#FFAD33'; | ||||
|       case '3': | ||||
|         return '#ff109d0a'; | ||||
|       case '4': | ||||
|         return '#FF7566'; | ||||
|       default: | ||||
|         return '#E6DECF'; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   //人工项目操作 | ||||
|   async setManualProjectFn(index: number) { | ||||
|     const isManualProjectIn = this.isManualProjectIn; | ||||
|     const getIsExitManualProject = this.getIsExitManualProject; | ||||
|     const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr; | ||||
|     const projectsObj = this.projectsObj; | ||||
| 
 | ||||
|     const projectCode = artSubject3ProjectsCodesArr[index] | ||||
|     let sideParkingStatus = GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane) | ||||
|     if (index === 5) { | ||||
|       dConsole.info(JudgeTag, 'surenjun 靠边停车状态=> ', getIsExitManualProject(index)) | ||||
|       dConsole.info(JudgeTag, 'surenjun 靠边停车状态=> ', sideParkingStatus) | ||||
|     } | ||||
|     const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) | ||||
|     if (getIsExitManualProject(index)) { | ||||
|     if (sideParkingStatus) { | ||||
|       // 正在进行的项目 取消项目 | ||||
|       if (isManualProjectIn && currentProject.type == '2') { | ||||
|         //判断人工是否能取消项目 && 当前项目有扣分的不能取消 | ||||
| @ -1113,169 +885,5 @@ struct JudgePage { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 获取是否能人工进项目 | ||||
|   getIsExitManualProject = (index: number) => { | ||||
| 
 | ||||
|     const judgeConfigObj = this.judgeConfigObj; | ||||
|     const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr; | ||||
|     const projectsObj = this.projectsObj; | ||||
|     const carztStr = this.carztStr; | ||||
|     const isManualProjectIn = this.isManualProjectIn; | ||||
|     const isProjectIn = this.isProjectIn; | ||||
|     const getProjectIsInRoad = this.getProjectIsInRoad; | ||||
| 
 | ||||
|     const projectCode = artSubject3ProjectsCodesArr[index]; | ||||
|     const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) | ||||
|     if (currentProject === undefined) { | ||||
|       return false | ||||
|     } | ||||
|     const projectType = currentProject.type; | ||||
| 
 | ||||
|     //不允许人工触发的项目列表,以","分隔 | ||||
|     const unExitManualProjects: string[] = Reflect.get(this.judgeConfigObj, '332').split(',') || []; | ||||
|     //直线行驶中不进其他考试项目(0-否 1-是) | ||||
|     const param348: string = Reflect.get(this.judgeConfigObj, '348') || '0', | ||||
|       //里程不够允许手工点靠边停车(0-否 1-是) | ||||
|       param387: string = Reflect.get(this.judgeConfigObj, '387') || '0', | ||||
|       //里程不够不报靠边停车(0-否+1-是+2-必考项目未完成且里程不够不报项目) | ||||
|       param319: string = Reflect.get(this.judgeConfigObj, '319') || '0', | ||||
|       //人工项目是否能取消 1:可取消; | ||||
|       param340: string = Reflect.get(this.judgeConfigObj, '340') || '0', | ||||
|       //307参数里设置的项目,项目已经做过,后续不能人工触发; | ||||
|       param307: string[] = (Reflect.get(this.judgeConfigObj, '307') || '').split(','); | ||||
| 
 | ||||
|     //非行驶状态(没有速度),人工项目不能触发(按钮灰色) | ||||
|     if (carztStr === '停车') { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能) | ||||
|     if (Reflect.get(this.judgeConfigObj, '342') === '3' || Reflect.get(this.judgeConfigObj, '342') === '2') { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //不允许人工触发的项目列表 | ||||
|     if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //项目进行中不能人工触发 | ||||
|     if (isProjectIn) { | ||||
|       if (param340 == '1') { | ||||
|         if (isManualProjectIn && (currentProject.type == '2')) { | ||||
|           return true | ||||
|         } else { | ||||
|           return false | ||||
|         } | ||||
|       } | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //项目路段信息判断 | ||||
|     if (!getProjectIsInRoad(projectCode + '')) { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     const project_9: ProjectInfo = Reflect.get(projectsObj, '9') | ||||
|     // 直线行驶中不进其他考试项目(0-否 1-是) | ||||
|     if (param348 == '0' && project_9.type == '2') { | ||||
|       return index === 0 ? true : false | ||||
|     } | ||||
| 
 | ||||
|     //项目已经做过,后续不能人工触发 | ||||
|     if (param307.includes(projectCode) && (projectType == '3' || projectType == '4')) { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //319不为0,或者387不为1,里程不够时,靠边停车项目不能触发 | ||||
|     if ((param387 != '1' || param319 != '0') && index === 5) { | ||||
|       const examMileage = this.examMileage | ||||
|       const isRequiredProjectsEnd = this.isRequiredProjectsEnd | ||||
|       const jl = this.jl | ||||
|       //里程是否达标 && 必考项目是否全完成 | ||||
|       return jl >= Number(examMileage) && isRequiredProjectsEnd | ||||
|     } | ||||
|     return true | ||||
|   } | ||||
|   // 判断项目是否在当前路段号 | ||||
|   getProjectIsInRoad = (projectCode: string,) => { | ||||
|     const judgeConfigObj = this.judgeConfigObj; | ||||
|     const lane = this.lane; | ||||
|     const road = lane.road; | ||||
|     const num = lane.num; | ||||
|     const count = lane.count; | ||||
| 
 | ||||
|     const param_3: string[] = (Reflect.get(this.judgeConfigObj, '514')?.split(',') || []); | ||||
|     const param_4: string[] = (Reflect.get(this.judgeConfigObj, '515')?.split(',') || []); | ||||
|     const param_10: string[] = (Reflect.get(this.judgeConfigObj, '516')?.split(',') || []); | ||||
|     const param_11: string[] = (Reflect.get(this.judgeConfigObj, '517')?.split(',') || []); | ||||
|     const param_9: string[] = (Reflect.get(this.judgeConfigObj, '518')?.split(',') || []); | ||||
|     const param_12: string[] = (Reflect.get(this.judgeConfigObj, '519')?.split(',') || []); | ||||
| 
 | ||||
|     const projectRoads: ProjectRoads = { | ||||
|       //直线行驶 | ||||
|       param_3, | ||||
|       //变更车道 | ||||
|       param_4, | ||||
|       //超车 | ||||
|       param_10, | ||||
|       //靠边停车 | ||||
|       param_11, | ||||
|       //会车 | ||||
|       param_9, | ||||
|       //掉头 | ||||
|       param_12, | ||||
|     }; | ||||
| 
 | ||||
| 
 | ||||
|     //未测绘得道路上或者不在差分状态 | ||||
|     if (road === '') { | ||||
|       return false | ||||
|     } | ||||
|     const currentProjectRoad: string[] = Reflect.get(projectRoads, `param_${projectCode}`) | ||||
|     if (currentProjectRoad.length == 0) { | ||||
|       return true | ||||
|     } | ||||
| 
 | ||||
|     //设置了514-519参数,只能在设置的路段触发对应项目 | ||||
|     if (currentProjectRoad.includes(road)) { | ||||
|       //如果525为1,则514-519设置的路段不能触发对应项目 | ||||
|       if (Reflect.get(this.judgeConfigObj, '525') == '1') { | ||||
|         return false | ||||
|       } | ||||
|     } else { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     //405参数为2是,如果在最左侧车道,超车项目不能触发; | ||||
|     if (projectCode == '10' && | ||||
|       Reflect.get(this.judgeConfigObj, '405') == '2' && | ||||
|       (num === count) && | ||||
|       num > 0 | ||||
|     ) { | ||||
|       return false | ||||
|     } | ||||
| 
 | ||||
|     // 车道总数少于2条,超车和变道不能触发 | ||||
|     if (projectCode == '10' || projectCode == '4') { | ||||
|       if (count < 2) { | ||||
|         return false | ||||
|       } | ||||
|     } | ||||
|     return true | ||||
| 
 | ||||
|   } | ||||
|   // 获取人工项目是否已做 | ||||
|   getIsEndManualProject = (index: number) => { | ||||
|     const projectName = this.artSubject3Projects[index]; | ||||
|     const projectCode = this.artSubject3ProjectsCodesArr[index]; | ||||
|     const currentProject: ProjectInfo = Reflect.get(this.projectsObj, projectCode) | ||||
|     const type = currentProject.type | ||||
|     if (type == '2') { | ||||
|       return projectName | ||||
|     } | ||||
|     return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										254
									
								
								entry/src/main/ets/pages/Judge/JudgeAndProject.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										254
									
								
								entry/src/main/ets/pages/Judge/JudgeAndProject.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,254 @@ | ||||
| import { JudgeTag } from '../../config'; | ||||
| import { DefaultJudgeConfigObj, LANE, MarkRule, ProjectInfo, ProjectInfos } from '../../model'; | ||||
| import { CutArray } from '../../utils/Common'; | ||||
| import { dConsole } from '../../utils/LogWorker'; | ||||
| import { GetIsEndManualProject, GetIsExitManualProject } from './utils'; | ||||
| 
 | ||||
| @Component | ||||
| export default struct JudgeAndProjectComponent { | ||||
|   public kfArrScroller: Scroller = new Scroller() | ||||
|   @Prop carztStr: string | ||||
|   @Prop judgeConfigObj: DefaultJudgeConfigObj | ||||
|   @Prop dw: string | ||||
|   @Prop sd: string | ||||
|   @Prop @Watch("scrollLengthChange") kfArr: MarkRule[] | ||||
|   @Prop examSubject: string | ||||
|   @Prop projects: ProjectInfo[] | ||||
|   @Prop artSubject3Projects: string[] | ||||
|   @Prop artSubject3ProjectsCodesArr: string[] | ||||
|   @Prop projectsObj: ProjectInfos | ||||
|   @Prop isManualProjectIn: boolean | ||||
|   @Prop isProjectIn: boolean | ||||
|   @Prop jl: number | ||||
|   @Prop examMileage: string | ||||
|   @Prop isRequiredProjectsEnd: boolean | ||||
|   @Prop lane: LANE | ||||
|   examClick: (index: number) => void = (index: number) => { | ||||
|   } | ||||
| 
 | ||||
|   scrollLengthChange(data: MarkRule[]) { | ||||
|     dConsole.log(JudgeTag, "容器滚动", data.length) | ||||
|     if (data.length > 4) { | ||||
|       this.kfArrScroller.scrollTo({ | ||||
|         yOffset: 999999, xOffset: 0 | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   getProjectColor(project: ProjectInfo) { | ||||
|     const type = project.type; | ||||
|     switch (type) { | ||||
|       case '1': | ||||
|         return '#E6DECF'; | ||||
|       case '2': | ||||
|         return '#FFAD33'; | ||||
|       case '3': | ||||
|         return '#ff109d0a'; | ||||
|       case '4': | ||||
|         return '#FF7566'; | ||||
|       default: | ||||
|         return '#E6DECF'; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   build() { | ||||
|     Column() { | ||||
|       Row() { | ||||
|         Text(this.carztStr).fontColor('#FFA500').fontSize(30) | ||||
|         if (Reflect.get(this.judgeConfigObj, '342') == '0') { | ||||
|           Text(`${this.dw}挡`).fontColor('#FFA500').fontSize(30).padding({ left: 15, right: 15 }) | ||||
|           Text(`${this.sd}km/h`).fontColor('#FFA500').fontSize(30) | ||||
|         } | ||||
|       }.height(40) | ||||
| 
 | ||||
|       Row() { | ||||
|         Flex({ direction: FlexDirection.Column }) { | ||||
|           if (this.kfArr.length) { | ||||
|             List({ scroller: this.kfArrScroller }) { | ||||
|               ForEach(this.kfArr, (item: MarkRule) => { | ||||
|                 ListItem() { | ||||
|                   Column() { | ||||
|                     Row() { | ||||
|                       Text(item.xmmcStr).fontSize(32).fontColor('#FFF') | ||||
|                       Text(`${item.score}分`).fontSize(32).fontColor('#FFF') | ||||
|                     } | ||||
|                     .width('100%') | ||||
|                     .backgroundColor('#38260B') | ||||
|                     .justifyContent(FlexAlign.SpaceBetween) | ||||
|                     .padding({ | ||||
|                       top: 12, | ||||
|                       bottom: 12, | ||||
|                       left: 8, | ||||
|                       right: 5 | ||||
|                     }) | ||||
| 
 | ||||
|                     Text(item.desc + `(${item.markcatalog})`) | ||||
|                       .fontSize(32) | ||||
|                       .fontColor('#E5CBA1') | ||||
|                       .margin({ | ||||
|                         top: 10, | ||||
|                         bottom: 8, | ||||
|                         left: 5, | ||||
|                         right: 5 | ||||
|                       }) | ||||
|                   }.margin({ top: 15 }).alignItems(HorizontalAlign.Start) | ||||
| 
 | ||||
|                 }.margin({ bottom: 25 }) | ||||
|               }) | ||||
|             } | ||||
|             .padding({ | ||||
|               left: 15, | ||||
|               right: 15, | ||||
|               top: 30, | ||||
|               bottom: 5 | ||||
|             }) | ||||
|           } else { | ||||
|             Column() { | ||||
|               Row() { | ||||
|                 Text('暂无扣分项').fontSize(32).fontColor('#FFF') | ||||
|               } | ||||
|               .width('100%') | ||||
|               .backgroundColor('#38260B') | ||||
|               .justifyContent(FlexAlign.SpaceBetween) | ||||
|               .padding({ | ||||
|                 top: 12, | ||||
|                 bottom: 12, | ||||
|                 left: 8, | ||||
|                 right: 3 | ||||
|               }) | ||||
|             }.margin({ top: 35 }).padding({ left: 20, right: 20 }).alignItems(HorizontalAlign.Start) | ||||
|           } | ||||
|         } | ||||
|         .backgroundImage($rawfile('judge/score_bg.png'), ImageRepeat.NoRepeat) | ||||
|         .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|         .width(514) | ||||
|         .height(618) | ||||
|         .padding({ | ||||
|           top: 18, | ||||
|           bottom: 15, | ||||
|           left: 13, | ||||
|           right: 14 | ||||
|         }) | ||||
| 
 | ||||
|         //科目二 | ||||
|         if (this.examSubject == "2") { | ||||
|           Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { | ||||
|             List({}) { | ||||
|               ForEach(CutArray(this.projects, 2), (item: [ProjectInfo, ProjectInfo]) => { | ||||
|                 ListItem() { | ||||
|                   Row() { | ||||
|                     Row() { | ||||
|                       //#FF7566 #00FFD5 #E6DECF | ||||
|                       // Text(this.projectsObj[item[0].projectCode]) | ||||
|                       Text(item[0].abbreviation) | ||||
|                         .fontSize(item[0].abbreviation!.length > 5 ? 28 : 32) | ||||
|                         .fontColor(this.getProjectColor(item[0])) | ||||
|                     } | ||||
|                     .backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat) | ||||
|                     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                     .width('48.5%') | ||||
|                     .height(115) | ||||
|                     .margin({ bottom: 5 }) | ||||
|                     .justifyContent(FlexAlign.Center) | ||||
| 
 | ||||
|                     if (item[1]) { | ||||
|                       Row() { | ||||
|                         //#FF7566 #00FFD5 #E6DECF | ||||
|                         Text(item[1].abbreviation) | ||||
|                           .fontSize(item[1].abbreviation.length > 5 ? 28 : 32) | ||||
|                           .fontColor(this.getProjectColor(item[1])) | ||||
|                       } | ||||
|                       .backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat) | ||||
|                       .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                       .width('48.5%') | ||||
|                       .height(115) | ||||
|                       .margin({ left: 5, bottom: 5 }) | ||||
|                       .justifyContent(FlexAlign.Center) | ||||
|                     } | ||||
|                   } | ||||
|                 } | ||||
|               }); | ||||
|             } | ||||
|           } | ||||
|           .backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat) | ||||
|           .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|           .width('57%') | ||||
|           .height('100%') | ||||
|           .padding(30) | ||||
|           .margin({ right: 10 }) | ||||
|         } | ||||
|         //科目三 | ||||
|         if (this.examSubject == '3') { | ||||
|           Column() { | ||||
|             Flex({ | ||||
|               wrap: FlexWrap.Wrap, | ||||
|               direction: FlexDirection.Row, | ||||
|               justifyContent: FlexAlign.SpaceBetween | ||||
|             }) { | ||||
|               List({}) { | ||||
|                 ForEach(this.projects, (project: ProjectInfo) => { | ||||
|                   ListItem() { | ||||
|                     Text(project.name) { | ||||
|                     } | ||||
|                     .fontColor(this.getProjectColor(project)) | ||||
|                     .margin({ bottom: 2 }) | ||||
|                     .fontSize(24) | ||||
|                   }.margin({ bottom: 2 }) | ||||
|                 }) | ||||
|               }.lanes(2).margin({ left: 25 }) | ||||
|             } | ||||
|             .width('100%') | ||||
|             .height('57%') | ||||
|             .backgroundImage($rawfile('judge/project_km3_bg.png'), ImageRepeat.NoRepeat) | ||||
|             .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|             .padding(30) | ||||
|             .margin({ right: 5 }) | ||||
| 
 | ||||
|             if (this.projects.length) { | ||||
|               Flex({ | ||||
|                 wrap: FlexWrap.Wrap, | ||||
|                 direction: FlexDirection.Row, | ||||
|                 justifyContent: FlexAlign.SpaceAround | ||||
|               }) { | ||||
|                 List() { | ||||
|                   ForEach(this.artSubject3Projects, (item: string, index) => { | ||||
|                     ListItem() { | ||||
|                     } | ||||
|                     // $rawfile( | ||||
|                     //   `judge/km3/${this.getIsExitManualProject(index) ? (this.getIsEndManualProject(index)) : | ||||
|                     //     (item + '_gray')}.png` | ||||
|                     // ) | ||||
|                     .backgroundImage( | ||||
|                       $rawfile( | ||||
|                         `judge/km3/${GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane) ? (GetIsEndManualProject(index, this.artSubject3Projects, this.artSubject3ProjectsCodesArr, this.projectsObj)) : | ||||
|                           (item + '_gray')}.png` | ||||
|                       ), ImageRepeat.NoRepeat) | ||||
|                     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|                     .width(174) | ||||
|                     .height(118 * 0.95) | ||||
|                     .margin({ bottom: 8 }) | ||||
|                     .onClick(() => { | ||||
|                       // this.vocObj.playAudio({ | ||||
|                       //   type: 1, | ||||
|                       //   name: 'button_media.wav' | ||||
|                       // }) | ||||
|                       this.examClick(index) | ||||
|                       // this.setManualProjectFn(index) | ||||
|                     }) | ||||
|                   }) | ||||
|                 }.lanes(3).margin({ left: 5, top: 12 }) | ||||
|               } | ||||
|             } | ||||
| 
 | ||||
|           } | ||||
|           .backgroundImage($rawfile('judge/project_bg.png'), ImageRepeat.NoRepeat) | ||||
|           .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|           .width(660) | ||||
|           .height(640) | ||||
|           .padding(44) | ||||
|           .margin({ right: 10 }) | ||||
|         } | ||||
|       }.margin({ top: 15 }).height('80%').justifyContent(FlexAlign.SpaceBetween) | ||||
|     }.width('100%').height('100%').alignItems(HorizontalAlign.Start).margin({ top: 10 }) | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,8 @@ | ||||
| @CustomDialog | ||||
| export default struct ManualConfirmationOfSubjectThreeProjectsDialog { | ||||
|   private controller?: CustomDialogController | ||||
| 
 | ||||
|   build() { | ||||
| 
 | ||||
|   } | ||||
| } | ||||
| @ -82,10 +82,6 @@ export default struct OperatingAreaComponent { | ||||
|           .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|           .margin({ bottom: 10 }) | ||||
|           .onClick(() => { | ||||
|             // this.vocObj.playAudio({ | ||||
|             //   type: 1, | ||||
|             //   name: 'button_media.wav' | ||||
|             // }) | ||||
|             // this.isDeductedPopShow = true | ||||
|             this.artificialEvaluationClick() | ||||
|           }) | ||||
|  | ||||
| @ -0,0 +1,8 @@ | ||||
| @CustomDialog | ||||
| export default struct SubjectThreeManualDeductionOfPointsDialog { | ||||
|   private controller?: CustomDialogController | ||||
| 
 | ||||
|   build() { | ||||
| 
 | ||||
|   } | ||||
| } | ||||
							
								
								
									
										40
									
								
								entry/src/main/ets/pages/Judge/TableUtils.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								entry/src/main/ets/pages/Judge/TableUtils.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| import { MA_MAP_POINT_ITEMType, MA_MAP_POINTType, MAPITEMPOINTITEM, MAPPOINT } from '../../model'; | ||||
| import { GetSyncData } from '../../utils/table/Operation'; | ||||
| 
 | ||||
| /** | ||||
|  * 初始化mapPoint表 | ||||
|  * @returns {Promise<MAPPOINT[]>} 返回mapPoint表数据 | ||||
|  */ | ||||
| export const InitMapPoint = async (): Promise<MAPPOINT[]> => { | ||||
|   const pointParams = await GetSyncData<MA_MAP_POINTType>('MA_MAP_POINT'); | ||||
|   if (pointParams.length === 0) return []; | ||||
| 
 | ||||
|   return pointParams.map(item => ({ | ||||
|     point_no: Number(item.point_no), | ||||
|     gps_e: Number(item.gps_e), | ||||
|     gps_n: Number(item.gps_n), | ||||
|     point_no_f: Number(item.point_no_f), | ||||
|     point_type: Number(item.point_type), | ||||
|     road_code: item.road_code || "", | ||||
|     gps_e_Location: Number(item.gps_e_location), | ||||
|     gps_n_Location: Number(item.gps_n_location), | ||||
|     f_gps_e: Number(item.f_gps_e), | ||||
|     f_gps_n: Number(item.f_gps_n), | ||||
|     passed: Number(item.passed), | ||||
|   } as MAPPOINT)); | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  * 初始化mapPointItem表 | ||||
|  * @returns {Promise<MAPITEMPOINTITEM[]>} 返回mapPointItem表数据 | ||||
|  */ | ||||
| export const InitMapPointItem = async (): Promise<MAPITEMPOINTITEM[]> => { | ||||
|   const pointItemPoints: MA_MAP_POINT_ITEMType[] = await GetSyncData<MA_MAP_POINT_ITEMType>('MA_MAP_POINT_ITEM'); | ||||
|   if (pointItemPoints.length === 0) return []; | ||||
|   return pointItemPoints.map(item => ({ | ||||
|     point_no: Number(item.point_no), | ||||
|     itemno: Number(item.itemno), | ||||
|     itemno1: Number(item.itemno1), | ||||
|     subname: item.subname ?? "" | ||||
|   } as MAPITEMPOINTITEM)) | ||||
| } | ||||
| @ -1,6 +1,18 @@ | ||||
| import systemTime from '@ohos.systemDateTime'; | ||||
| import { TestRealExam } from '../../mock'; | ||||
| import { CarInfoType, ExtendType, Gps, LANE, PLCType, Radar, Vision } from '../../model'; | ||||
| import { | ||||
|   CarInfoType, | ||||
|   DefaultJudgeConfigObj, | ||||
|   ExtendType, | ||||
|   Gps, | ||||
|   LANE, | ||||
|   PLCType, | ||||
|   ProjectInfo, | ||||
|   ProjectInfos, | ||||
|   ProjectRoads, | ||||
|   Radar, | ||||
|   Vision | ||||
| } from '../../model'; | ||||
| import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common'; | ||||
| import dayTs from '../../utils/Date'; | ||||
| import { dConsole } from '../../utils/LogWorker'; | ||||
| @ -658,3 +670,164 @@ export function sendRed() { | ||||
|   const arrRedBuffer = ArrayToByteArray(arrRed).buffer | ||||
|   // globalThis.lightLineUdp.send(arrRedBuffer); | ||||
| } | ||||
| 
 | ||||
| // 获取是否能人工进项目 | ||||
| export const GetIsExitManualProject = (index: number, judgeConfigObj: DefaultJudgeConfigObj, artSubject3ProjectsCodesArr: string[], projectsObj: ProjectInfos, carztStr: string, isManualProjectIn: boolean, isProjectIn: boolean, jl: number, examMileage: string, isRequiredProjectsEnd: boolean, lane: LANE): boolean => { | ||||
|   // const judgeConfigObj = this.judgeConfigObj; | ||||
|   // const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr; | ||||
|   // const projectsObj = this.projectsObj; | ||||
|   // const carztStr = this.carztStr; | ||||
|   // const isManualProjectIn = this.isManualProjectIn; | ||||
|   // const isProjectIn = this.isProjectIn; | ||||
|   // const getProjectIsInRoad = this.getProjectIsInRoad; | ||||
| 
 | ||||
|   const projectCode = artSubject3ProjectsCodesArr[index]; | ||||
|   const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) | ||||
|   if (currentProject === undefined) { | ||||
|     return false | ||||
|   } | ||||
|   const projectType = currentProject.type; | ||||
| 
 | ||||
|   //不允许人工触发的项目列表,以","分隔 | ||||
|   const unExitManualProjects: string[] = Reflect.get(judgeConfigObj, '332').split(',') || []; | ||||
|   //直线行驶中不进其他考试项目(0-否 1-是) | ||||
|   const param348: string = Reflect.get(judgeConfigObj, '348') || '0', | ||||
|     //里程不够允许手工点靠边停车(0-否 1-是) | ||||
|     param387: string = Reflect.get(judgeConfigObj, '387') || '0', | ||||
|     //里程不够不报靠边停车(0-否+1-是+2-必考项目未完成且里程不够不报项目) | ||||
|     param319: string = Reflect.get(judgeConfigObj, '319') || '0', | ||||
|     //人工项目是否能取消 1:可取消; | ||||
|     param340: string = Reflect.get(judgeConfigObj, '340') || '0', | ||||
|     //307参数里设置的项目,项目已经做过,后续不能人工触发; | ||||
|     param307: string[] = (Reflect.get(judgeConfigObj, '307') || '').split(','); | ||||
| 
 | ||||
|   //非行驶状态(没有速度),人工项目不能触发(按钮灰色) | ||||
|   if (carztStr === '停车') { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能) | ||||
|   if (Reflect.get(judgeConfigObj, '342') === '3' || Reflect.get(judgeConfigObj, '342') === '2') { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //不允许人工触发的项目列表 | ||||
|   if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //项目进行中不能人工触发 | ||||
|   if (isProjectIn) { | ||||
|     if (param340 == '1') { | ||||
|       if (isManualProjectIn && (currentProject.type == '2')) { | ||||
|         return true | ||||
|       } else { | ||||
|         return false | ||||
|       } | ||||
|     } | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //项目路段信息判断 | ||||
|   if (!GetProjectIsInRoad(projectCode + '', lane, judgeConfigObj)) { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   const project_9: ProjectInfo = Reflect.get(projectsObj, '9') | ||||
|   // 直线行驶中不进其他考试项目(0-否 1-是) | ||||
|   if (param348 == '0' && project_9.type == '2') { | ||||
|     return index === 0 ? true : false | ||||
|   } | ||||
| 
 | ||||
|   //项目已经做过,后续不能人工触发 | ||||
|   if (param307.includes(projectCode) && (projectType == '3' || projectType == '4')) { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //319不为0,或者387不为1,里程不够时,靠边停车项目不能触发 | ||||
|   if ((param387 != '1' || param319 != '0') && index === 5) { | ||||
|     //里程是否达标 && 必考项目是否全完成 | ||||
|     return jl >= Number(examMileage) && isRequiredProjectsEnd | ||||
|   } | ||||
|   return true | ||||
| } | ||||
| 
 | ||||
| // 判断项目是否在当前路段号 | ||||
| export const GetProjectIsInRoad = (projectCode: string, lane: LANE, judgeConfigObj: DefaultJudgeConfigObj): boolean => { | ||||
| 
 | ||||
|   // const lane = this.lane; | ||||
|   const road = lane.road; | ||||
|   const num = lane.num; | ||||
|   const count = lane.count; | ||||
| 
 | ||||
|   const param_3: string[] = (Reflect.get(judgeConfigObj, '514')?.split(',') || []); | ||||
|   const param_4: string[] = (Reflect.get(judgeConfigObj, '515')?.split(',') || []); | ||||
|   const param_10: string[] = (Reflect.get(judgeConfigObj, '516')?.split(',') || []); | ||||
|   const param_11: string[] = (Reflect.get(judgeConfigObj, '517')?.split(',') || []); | ||||
|   const param_9: string[] = (Reflect.get(judgeConfigObj, '518')?.split(',') || []); | ||||
|   const param_12: string[] = (Reflect.get(judgeConfigObj, '519')?.split(',') || []); | ||||
| 
 | ||||
|   const projectRoads: ProjectRoads = { | ||||
|     //直线行驶 | ||||
|     param_3, | ||||
|     //变更车道 | ||||
|     param_4, | ||||
|     //超车 | ||||
|     param_10, | ||||
|     //靠边停车 | ||||
|     param_11, | ||||
|     //会车 | ||||
|     param_9, | ||||
|     //掉头 | ||||
|     param_12, | ||||
|   }; | ||||
| 
 | ||||
| 
 | ||||
|   //未测绘得道路上或者不在差分状态 | ||||
|   if (road === '') { | ||||
|     return false | ||||
|   } | ||||
|   const currentProjectRoad: string[] = Reflect.get(projectRoads, `param_${projectCode}`) | ||||
|   if (currentProjectRoad.length == 0) { | ||||
|     return true | ||||
|   } | ||||
| 
 | ||||
|   //设置了514-519参数,只能在设置的路段触发对应项目 | ||||
|   if (currentProjectRoad.includes(road)) { | ||||
|     //如果525为1,则514-519设置的路段不能触发对应项目 | ||||
|     if (Reflect.get(judgeConfigObj, '525') == '1') { | ||||
|       return false | ||||
|     } | ||||
|   } else { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   //405参数为2是,如果在最左侧车道,超车项目不能触发; | ||||
|   if (projectCode == '10' && | ||||
|     Reflect.get(judgeConfigObj, '405') == '2' && | ||||
|     (num === count) && | ||||
|     num > 0 | ||||
|   ) { | ||||
|     return false | ||||
|   } | ||||
| 
 | ||||
|   // 车道总数少于2条,超车和变道不能触发 | ||||
|   if (projectCode == '10' || projectCode == '4') { | ||||
|     if (count < 2) { | ||||
|       return false | ||||
|     } | ||||
|   } | ||||
|   return true | ||||
| } | ||||
| 
 | ||||
| // 获取人工项目是否已做 | ||||
| export const GetIsEndManualProject = (index: number, artSubject3Projects: string[], artSubject3ProjectsCodesArr: string[], projectsObj: ProjectInfos): string => { | ||||
|   const projectName = artSubject3Projects[index]; | ||||
|   const projectCode = artSubject3ProjectsCodesArr[index]; | ||||
|   const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode) | ||||
|   const type = currentProject.type | ||||
|   if (type == '2') { | ||||
|     return projectName | ||||
|   } | ||||
|   return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`; | ||||
| } | ||||
| @ -184,37 +184,6 @@ export default class Judge { | ||||
|   private isExamEnd: boolean | ||||
|   // 是否发送udp | ||||
|   private isUdpEnd: boolean = false | ||||
|   // 处理udp plc信号 | ||||
|   handleUdp = async (msg: string) => { | ||||
|     const stachArr = msg.split(',') | ||||
|     if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { | ||||
|       return | ||||
|     } | ||||
|     const plcData = await this.getPlcData(msg); | ||||
|     // 4.过程数据 | ||||
|     await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) | ||||
|     //检测到有无锡所设备接入,需要发送特定的数据,供检测 | ||||
|     // if (this.usbService.isWXUSBDevice) { | ||||
|     //   const str = await senorToWXDataStr(msg); | ||||
|     //   this.usbService.sendUSB(str) | ||||
|     // } | ||||
|     const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350') | ||||
|     this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + '' | ||||
|     this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' | ||||
|     //TODO 暂时关闭差分检测异常 | ||||
|     // await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt); | ||||
|     if (!this.isExamEnd) { | ||||
|       await examJudgeRealExam(plcData) | ||||
|     } | ||||
|     // let udpIndex = AppStorage.get<number>('udpIndex') || 0; | ||||
|     // if (udpIndex % 5 === 0 && !this.isUdpEnd) { | ||||
|     // TODO UPD缺失 | ||||
|     // const judgeUdp = globalThis.judgeUdp | ||||
|     // const bytes = await this.getMessageHeartbeat(this.isExamEnd); | ||||
|     // judgeUdp.send(bytes) | ||||
|     // } | ||||
|     // AppStorage.setOrCreate('udpIndex', udpIndex++) | ||||
|   } | ||||
|   //是否手动结束考试 | ||||
|   private isManual: boolean = false | ||||
|   //UDP服务序列号 | ||||
| @ -261,60 +230,6 @@ export default class Judge { | ||||
|     dConsole.info(JudgeTag, '过程数据文件上传 end') | ||||
|   } | ||||
|   private judgeTask: JudgeTask | ||||
|   // 检测扣分、结束项目时该项目是否开始 | ||||
|   checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => { | ||||
|     if (xmdm == 20) { | ||||
|       return true | ||||
|     } | ||||
|     const judgeUI = this.judgeUI; | ||||
|     const judgeTask = this.judgeTask; | ||||
|     const projectsObj: object = this.judgeUI.projectsObj | ||||
|     const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm) | ||||
|     const isUpload = currentProject.isUpload | ||||
| 
 | ||||
|     //如果项目没有开始 | ||||
|     dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload) | ||||
|     if (!isUpload) { | ||||
|       dConsole.info(JudgeTag, '项目补传开始') | ||||
|       //项目开始补传 | ||||
|       judgeTask.addTask(async () => { | ||||
|         await this.beginProject(xmdm) | ||||
|       }, { | ||||
|         isDelay: true | ||||
|       }) | ||||
|       judgeTask.addTask(async () => { | ||||
|         await this.uploadProgressPhoto(xmdm) | ||||
|       }, { | ||||
|         isDelay: true | ||||
|       }) | ||||
|       currentProject.isUpload = true; | ||||
|       Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject) | ||||
|       //扣分补传 | ||||
|       if (currentType == 2) { | ||||
|         judgeTask.addTask(async () => { | ||||
|           await this.pointsDedute(xmdm, kf!) | ||||
|         }, { | ||||
|           isDelay: true | ||||
|         }) | ||||
|       } | ||||
|       //扣分补传判断是否合格 不合格补传项目结束 | ||||
|       if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) { | ||||
|         judgeTask.addTask(async () => { | ||||
|           await this.endProject(xmdm) | ||||
|         }, { | ||||
|           isDelay: true | ||||
|         }) | ||||
|         currentProject.isEnd = true; | ||||
|         Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject) | ||||
|       } | ||||
|       judgeTask.addTask(async () => { | ||||
|         this.checkExamIsEnd() | ||||
|       }) | ||||
|       return false; | ||||
|     } else { | ||||
|       return true | ||||
|     } | ||||
|   } | ||||
|   private tempData?: PLCType | ||||
|   //实时计算gps经纬度距离 | ||||
|   handDistance = async () => { | ||||
| @ -478,6 +393,37 @@ export default class Judge { | ||||
|     AppStorage.setOrCreate('msgStr', plc) | ||||
|     return tempData | ||||
|   } | ||||
|   // 处理udp plc信号 | ||||
|   handleUdp = async (msg: string) => { | ||||
|     const stachArr = msg.split(',') | ||||
|     if (stachArr[0] != '#DN_GD' || this.isUdpEnd) { | ||||
|       return | ||||
|     } | ||||
|     const plcData = await this.getPlcData(msg); | ||||
|     // 4.过程数据 | ||||
|     await this.fileLog?.setExamJudgeData(JSON.stringify(plcData)) | ||||
|     //检测到有无锡所设备接入,需要发送特定的数据,供检测 | ||||
|     // if (this.usbService.isWXUSBDevice) { | ||||
|     //   const str = await senorToWXDataStr(msg); | ||||
|     //   this.usbService.sendUSB(str) | ||||
|     // } | ||||
|     const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350') | ||||
|     this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + '' | ||||
|     this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + '' | ||||
|     //TODO 暂时关闭差分检测异常 | ||||
|     // await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt); | ||||
|     if (!this.isExamEnd) { | ||||
|       await examJudgeRealExam(plcData) | ||||
|     } | ||||
|     // let udpIndex = AppStorage.get<number>('udpIndex') || 0; | ||||
|     // if (udpIndex % 5 === 0 && !this.isUdpEnd) { | ||||
|     // TODO UPD缺失 | ||||
|     // const judgeUdp = globalThis.judgeUdp | ||||
|     // const bytes = await this.getMessageHeartbeat(this.isExamEnd); | ||||
|     // judgeUdp.send(bytes) | ||||
|     // } | ||||
|     // AppStorage.setOrCreate('udpIndex', udpIndex++) | ||||
|   } | ||||
|   // 处理轨迹plc信号 | ||||
|   handleTrajectoryUdp = async (strArr: string[]) => { | ||||
|     let num = 2; | ||||
| @ -515,9 +461,9 @@ export default class Judge { | ||||
|   } | ||||
|   //本地轨迹回放地址 | ||||
|   private trajectoryPath: string | ||||
|   //当前科目二的考试项目 | ||||
|   // private currentKm2ItemsObj: any | ||||
|   private isTrajectoryOpen: boolean; | ||||
|   //当前科目二的考试项目 | ||||
|   // 调代理接口是否断网了 | ||||
|   private isJudgeDisConnect: boolean = false; | ||||
|   // 断网数据补传 | ||||
| @ -532,33 +478,6 @@ export default class Judge { | ||||
|       const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context); | ||||
|     } | ||||
|   } | ||||
|   private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] | ||||
|   private lane: LANE = { | ||||
|     road: '', num: 0, count: 0 | ||||
|   } | ||||
|   private videoData?: RecordHandleType | ||||
|   private disConnectNum: number = 0; | ||||
|   //调用监管接口 | ||||
|   sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => { | ||||
|     const temp = await writeObjectOut(data, filePath, this.context); | ||||
|     dConsole.log(JudgeTag, "wzj", JSON.stringify(temp)) | ||||
|     //断网&网络超时次数计算 | ||||
|     if (temp.code == 2300007 || temp.code == 2300028) { | ||||
|       this.disConnectNum += 1; | ||||
|       if (this.disConnectNum < 5) { | ||||
|         return await this.sendWriteObjectOut(data, filePath) | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if (this.disConnectNum >= 5) { | ||||
|       dConsole.info('surenjun', '123') | ||||
|       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; | ||||
|       this.judgeUI.disConnectErrorOpen = true | ||||
|     } | ||||
| 
 | ||||
|     this.disConnectNum = 0 | ||||
|     return temp | ||||
|   } | ||||
|   // 项目开始接口同步 | ||||
|   beginProject = async (ksxm: number) => { | ||||
|     const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||
| @ -662,6 +581,87 @@ export default class Judge { | ||||
|     UploadRegulatoryCodeConversion('17C54', temp.code || 0) | ||||
|     dConsole.info(JudgeTag, '上传照片 end') | ||||
|   } | ||||
|   // 检测扣分、结束项目时该项目是否开始 | ||||
|   checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => { | ||||
|     if (xmdm == 20) { | ||||
|       return true | ||||
|     } | ||||
|     const judgeUI = this.judgeUI; | ||||
|     const judgeTask = this.judgeTask; | ||||
|     const projectsObj: object = this.judgeUI.projectsObj | ||||
|     const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm) | ||||
|     const isUpload = currentProject.isUpload | ||||
| 
 | ||||
|     //如果项目没有开始 | ||||
|     dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload) | ||||
|     if (!isUpload) { | ||||
|       dConsole.info(JudgeTag, '项目补传开始') | ||||
|       //项目开始补传 | ||||
|       judgeTask.addTask(async () => { | ||||
|         await this.beginProject(xmdm) | ||||
|       }, { | ||||
|         isDelay: true | ||||
|       }) | ||||
|       judgeTask.addTask(async () => { | ||||
|         await this.uploadProgressPhoto(xmdm) | ||||
|       }, { | ||||
|         isDelay: true | ||||
|       }) | ||||
|       currentProject.isUpload = true; | ||||
|       Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject) | ||||
|       //扣分补传 | ||||
|       if (currentType == 2) { | ||||
|         judgeTask.addTask(async () => { | ||||
|           await this.pointsDedute(xmdm, kf!) | ||||
|         }, { | ||||
|           isDelay: true | ||||
|         }) | ||||
|       } | ||||
|       //扣分补传判断是否合格 不合格补传项目结束 | ||||
|       if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) { | ||||
|         judgeTask.addTask(async () => { | ||||
|           await this.endProject(xmdm) | ||||
|         }, { | ||||
|           isDelay: true | ||||
|         }) | ||||
|         currentProject.isEnd = true; | ||||
|         Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject) | ||||
|       } | ||||
|       judgeTask.addTask(async () => { | ||||
|         this.checkExamIsEnd() | ||||
|       }) | ||||
|       return false; | ||||
|     } else { | ||||
|       return true | ||||
|     } | ||||
|   } | ||||
|   private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11] | ||||
|   private lane: LANE = { | ||||
|     road: '', num: 0, count: 0 | ||||
|   } | ||||
|   private videoData?: RecordHandleType | ||||
|   private disConnectNum: number = 0; | ||||
|   //调用监管接口 | ||||
|   sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => { | ||||
|     const temp = await writeObjectOut(data, filePath, this.context); | ||||
|     dConsole.log(JudgeTag, "wzj", JSON.stringify(temp)) | ||||
|     //断网&网络超时次数计算 | ||||
|     if (temp.code == 2300007 || temp.code == 2300028) { | ||||
|       this.disConnectNum += 1; | ||||
|       if (this.disConnectNum < 5) { | ||||
|         return await this.sendWriteObjectOut(data, filePath) | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if (this.disConnectNum >= 5) { | ||||
|       dConsole.info('surenjun', '123') | ||||
|       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; | ||||
|       this.judgeUI.disConnectErrorOpen = true | ||||
|     } | ||||
| 
 | ||||
|     this.disConnectNum = 0 | ||||
|     return temp | ||||
|   } | ||||
| 
 | ||||
|   constructor(judgeUI: JudgeUI) { | ||||
|     this.serialIndex = 1; | ||||
| @ -1205,11 +1205,11 @@ export default class Judge { | ||||
|           break | ||||
|       } | ||||
|       if (event == 2 || event == 3) { | ||||
|         setTimeout(() => { | ||||
|           this.judgeUI.kfArrScroller.scrollTo({ | ||||
|             yOffset: 999999, xOffset: 0 | ||||
|           }) | ||||
|         }, 500) | ||||
|         // setTimeout(() => { | ||||
|         //   this.judgeUI.kfArrScroller.scrollTo({ | ||||
|         //     yOffset: 999999, xOffset: 0 | ||||
|         //   }) | ||||
|         // }, 500) | ||||
|         //统计必考项目完成数量 | ||||
|         await this.setCountItems(); | ||||
|         await checkExamIsEnd() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user