fix: 优化新评判
This commit is contained in:
		
							parent
							
								
									658fbed783
								
							
						
					
					
						commit
						d6a5c9fdba
					
				| @ -71,3 +71,5 @@ export const StartExamTag = '[StartExam]' | |||||||
| 
 | 
 | ||||||
| //人脸对比 | //人脸对比 | ||||||
| export const FaceCompareTag = '[FaceCompare]'; | export const FaceCompareTag = '[FaceCompare]'; | ||||||
|  | //过程数据处理 | ||||||
|  | export const ProcessDataTag = '[ProcessData]'; | ||||||
| @ -63,7 +63,7 @@ export enum ProcessDataEnumType { | |||||||
|   JudgeExamData = "2", |   JudgeExamData = "2", | ||||||
|   //judge_log_data |   //judge_log_data | ||||||
|   JudgeLogData = "3", |   JudgeLogData = "3", | ||||||
|   //   judge_progress_callback_data |   //judge_progress_callback_data | ||||||
|   JudgeProgressCallbackData = "4", |   JudgeProgressCallbackData = "4", | ||||||
|   //plc_data |   //plc_data | ||||||
|   PlcData = "5", |   PlcData = "5", | ||||||
|  | |||||||
| @ -189,7 +189,7 @@ struct Index { | |||||||
|     dConsole.log("test1111") |     dConsole.log("test1111") | ||||||
|     await GetDeviceInfo(this.context) |     await GetDeviceInfo(this.context) | ||||||
|     this.carInfo = await GetCarInfo() |     this.carInfo = await GetCarInfo() | ||||||
|     this.carInfo = AppStorage.get<CarInfoType>('carInfo')! |     AppStorage.setOrCreate<CarInfoType>("carInfo", this.carInfo) | ||||||
|     this.deviceId = this.carInfo.carNo || "" |     this.deviceId = this.carInfo.carNo || "" | ||||||
|     await SetCurrentTime() |     await SetCurrentTime() | ||||||
|     this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')! |     this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')! | ||||||
|  | |||||||
| @ -48,7 +48,7 @@ export async function GetCarInfo(): Promise<CarInfoType> { | |||||||
|     deviceNo: AppStorage.get<string>('deviceNo') || "" |     deviceNo: AppStorage.get<string>('deviceNo') || "" | ||||||
|   }; |   }; | ||||||
|   let res: ApiResponseType = await obtainCarExamInfo(params) |   let res: ApiResponseType = await obtainCarExamInfo(params) | ||||||
|   dConsole.log("获取到的车辆信息", res) |   dConsole.log("90", res) | ||||||
|   if (res.obtainCarExamInfoRsp && res.obtainCarExamInfoRsp.body) { |   if (res.obtainCarExamInfoRsp && res.obtainCarExamInfoRsp.body) { | ||||||
|     const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body! |     const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body! | ||||||
|     carInfo.plateNo = decodeURIComponent(carInfo.plateNo) |     carInfo.plateNo = decodeURIComponent(carInfo.plateNo) | ||||||
|  | |||||||
| @ -396,7 +396,6 @@ struct JudgePage { | |||||||
|         Reflect.set(this.projectsObj, 1, project_1) |         Reflect.set(this.projectsObj, 1, project_1) | ||||||
|       } |       } | ||||||
|       Reflect.set(this.judgeConfigObj, sys.v_no!, value) |       Reflect.set(this.judgeConfigObj, sys.v_no!, value) | ||||||
|       dConsole.log("寻找", this.judgeConfigObj) |  | ||||||
|     }); |     }); | ||||||
|     this.judgeConfig = syssetJudgeConfigArr; |     this.judgeConfig = syssetJudgeConfigArr; | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -1,7 +1,9 @@ | |||||||
| import { | import { | ||||||
|   JudgeConfigObjKmItems, |   JudgeConfigObjKmItems, | ||||||
|  |   JudgeKSJS, | ||||||
|   JudgePerformInfo, |   JudgePerformInfo, | ||||||
|   JudgeUI, |   JudgeUI, | ||||||
|  |   LANE, | ||||||
|   MarkRule, |   MarkRule, | ||||||
|   PLCType, |   PLCType, | ||||||
|   ProcessDataEnumType, |   ProcessDataEnumType, | ||||||
| @ -22,6 +24,10 @@ import { PlcStrToJson, PlcStrToWXJson } from './utils' | |||||||
| import { JudgeEndFn } from './JudgeEnd' | import { JudgeEndFn } from './JudgeEnd' | ||||||
| 
 | 
 | ||||||
| export default class JudgeBusiness { | export default class JudgeBusiness { | ||||||
|  |   public mndgStr: string | undefined | ||||||
|  |   public lane: LANE = { | ||||||
|  |     road: '', num: 0, count: 0 | ||||||
|  |   } | ||||||
|   public fileUtil: FileUtils |   public fileUtil: FileUtils | ||||||
|   public avPlayer?: VoiceAnnounce |   public avPlayer?: VoiceAnnounce | ||||||
|   public performInfo?: JudgePerformInfo |   public performInfo?: JudgePerformInfo | ||||||
| @ -31,7 +37,7 @@ export default class JudgeBusiness { | |||||||
|   public isEndTip: boolean = false; |   public isEndTip: boolean = false; | ||||||
|   //是否手动结束考试 |   //是否手动结束考试 | ||||||
|   public isManual: boolean = false |   public isManual: boolean = false | ||||||
|   public deductedPopShowTimer: number = 0; |   public deductedPopShowTimer: number = -1; | ||||||
|   public videoData?: RecordHandleType |   public videoData?: RecordHandleType | ||||||
|   //是否是考试模式 |   //是否是考试模式 | ||||||
|   public isExam: boolean |   public isExam: boolean | ||||||
| @ -48,12 +54,12 @@ export default class JudgeBusiness { | |||||||
|   public xmxh: string = "" |   public xmxh: string = "" | ||||||
|   public kfArr?: MarkRule[] |   public kfArr?: MarkRule[] | ||||||
|   public carztStr: string |   public carztStr: string | ||||||
|  |   public ksjs?: JudgeKSJS | ||||||
|   private judgeUI: JudgeUI |   private judgeUI: JudgeUI | ||||||
|   private tempData?: PLCType |   private tempData?: PLCType | ||||||
|   private plcData?: PLCType |   private plcData?: PLCType | ||||||
|   // 是否发送udp |   // 是否发送udp | ||||||
|   private isUdpEnd: boolean = false |   private isUdpEnd: boolean = false | ||||||
|   private mndgStr: string | undefined |  | ||||||
| 
 | 
 | ||||||
|   constructor(judgeUI: JudgeUI) { |   constructor(judgeUI: JudgeUI) { | ||||||
|     this.judgeUI = judgeUI |     this.judgeUI = judgeUI | ||||||
|  | |||||||
| @ -1,9 +1,19 @@ | |||||||
| import { JudgeTag } from '../../config'; | import { JudgeTag } from '../../config'; | ||||||
| import { JudgeCallBackData, JudgeUI, KmItem, MarkRule, ProcessDataEnumType, ProjectInfo } from '../../model'; | import { | ||||||
|  |   JudgeCallBackData, | ||||||
|  |   JudgeConfigObj, | ||||||
|  |   JudgeSound, | ||||||
|  |   JudgeUI, | ||||||
|  |   KmItem, | ||||||
|  |   MarkRule, | ||||||
|  |   ProcessDataEnumType, | ||||||
|  |   ProjectInfo | ||||||
|  | } from '../../model'; | ||||||
| import { dConsole } from '../../utils/LogWorker'; | import { dConsole } from '../../utils/LogWorker'; | ||||||
|  | import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'; | ||||||
| import JudgeBusiness from './JudgeBusiness'; | import JudgeBusiness from './JudgeBusiness'; | ||||||
| import { examJudgeArtificialItem } from './JudgeSDKUtils'; | import { examJudgeArtificialItem, examJudgeSoundEnd } from './JudgeSDKUtils'; | ||||||
| import { CurrentProjectConversion, DeductionProjectConversion } from './utils'; | import { CurrentProjectConversion, DeductionProjectConversion, DetectingDifferences, GetCarStatus } from './utils'; | ||||||
| 
 | 
 | ||||||
| export const JudgingFn = async (strData: string, callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) => { | export const JudgingFn = async (strData: string, callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) => { | ||||||
|   let examData: JudgeCallBackData = JSON.parse(strData); |   let examData: JudgeCallBackData = JSON.parse(strData); | ||||||
| @ -26,13 +36,10 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|   const isManualProjectIn = artSubject3ProjectsCodesArr.includes(xmdm); |   const isManualProjectIn = artSubject3ProjectsCodesArr.includes(xmdm); | ||||||
|   const examSubject = judgeUI.examSubject |   const examSubject = judgeUI.examSubject | ||||||
|   const judgeConfigObj = judgeUI.judgeConfigObj |   const judgeConfigObj = judgeUI.judgeConfigObj | ||||||
|   let project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) |  | ||||||
|   const xmmcCode = project.projectCodeCenter || ""; |  | ||||||
|   const kmItem: KmItem = Reflect.get(that.kmItems, xmmcCode) |  | ||||||
| 
 |  | ||||||
|   switch (event) { |   switch (event) { | ||||||
|   //   项目开始 |   //   项目开始 | ||||||
|     case 1: |     case 1: { | ||||||
|  |       const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||||
|       project.type = '2'; |       project.type = '2'; | ||||||
|       if (isManualProjectIn) { |       if (isManualProjectIn) { | ||||||
|         //手动项目是否在进行中 |         //手动项目是否在进行中 | ||||||
| @ -44,6 +51,8 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|       judgeUI.currentXmdm = xmdm; |       judgeUI.currentXmdm = xmdm; | ||||||
|       const xmmcStr = project.name || ""; |       const xmmcStr = project.name || ""; | ||||||
|       const xmmcSingleCode = project.projectCode || ""; |       const xmmcSingleCode = project.projectCode || ""; | ||||||
|  |       const xmmcCode = project.projectCodeCenter || ""; | ||||||
|  |       const kmItem: KmItem = Reflect.get(that.kmItems, xmmcCode) | ||||||
|       kmItem.status = 2; |       kmItem.status = 2; | ||||||
|       that.xmmcStr = xmmcStr; |       that.xmmcStr = xmmcStr; | ||||||
|       that.xmmcCode = xmmcCode; |       that.xmmcCode = xmmcCode; | ||||||
| @ -55,8 +64,11 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|       Reflect.set(judgeUI.projectsObj, xmdm, project) |       Reflect.set(judgeUI.projectsObj, xmdm, project) | ||||||
|       Reflect.set(that.kmItems, xmmcCode || 0, kmItem) |       Reflect.set(that.kmItems, xmmcCode || 0, kmItem) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   项目结束 |   //   项目结束 | ||||||
|     case 2: |     case 2: { | ||||||
|  |       const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||||
|  |       const xmmcCode = project.projectCodeCenter || ""; | ||||||
|       project.type = (xmjs.xmhg === 0 ? '4' : '3') |       project.type = (xmjs.xmhg === 0 ? '4' : '3') | ||||||
|       //计算项目是否全部结束 |       //计算项目是否全部结束 | ||||||
|       judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter((projectKey) => { |       judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter((projectKey) => { | ||||||
| @ -66,6 +78,7 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|       if (isManualProjectIn) { |       if (isManualProjectIn) { | ||||||
|         judgeUI.isManualProjectIn = false |         judgeUI.isManualProjectIn = false | ||||||
|       } |       } | ||||||
|  |       const kmItem: KmItem = Reflect.get(that.kmItems, xmmcCode) | ||||||
|       kmItem.status = 3; |       kmItem.status = 3; | ||||||
|       //统计必考项目数量 |       //统计必考项目数量 | ||||||
|       that.xmmcStr = '无'; |       that.xmmcStr = '无'; | ||||||
| @ -75,8 +88,9 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|       Reflect.set(judgeUI.projectsObj, xmdm, project) |       Reflect.set(judgeUI.projectsObj, xmdm, project) | ||||||
|       Reflect.set(that.kmItems, xmmcCode, kmItem) |       Reflect.set(that.kmItems, xmmcCode, kmItem) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   扣分 |   //   扣分 | ||||||
|     case 3: |     case 3: { | ||||||
|       const thisKf = DeductionProjectConversion(`${kf.xmdm}_${kf.kfdm}`, judgeUI.markRuleListObj) |       const thisKf = DeductionProjectConversion(`${kf.xmdm}_${kf.kfdm}`, judgeUI.markRuleListObj) | ||||||
|       const kfObj: MarkRule = { |       const kfObj: MarkRule = { | ||||||
|         //扣分项目名称 |         //扣分项目名称 | ||||||
| @ -104,32 +118,77 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
|         Reflect.set(judgeUI.projectsObj, kf.xmdm, project) |         Reflect.set(judgeUI.projectsObj, kf.xmdm, project) | ||||||
|       } |       } | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   // 考试状态 |   // 考试状态 | ||||||
|     case 4: |     case 4: { | ||||||
|  |       that.carztStr = GetCarStatus(carzt); | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   考试结束 |   //   考试结束 | ||||||
|     case 5: |     case 5: { | ||||||
|  |       that.ksjs = ksjs; | ||||||
|  |       // await fileLog?.setExamJudgeData(JSON.stringify({ | ||||||
|  |       //   method: 'examJudgeEndExam' | ||||||
|  |       // })) | ||||||
|  |       dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ | ||||||
|  |         method: 'examJudgeEndExam' | ||||||
|  |       })) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   项目取消 |   //   项目取消 | ||||||
|     case 6: |     case 6: { | ||||||
|  |       dConsole.info(JudgeTag, '项目取消'); | ||||||
|  |       const xmdm = xmqx.xmdm; | ||||||
|  |       const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||||
|  |       const xmmcCode = project.projectCodeCenter || ""; | ||||||
|  |       project.type = '1' | ||||||
|  |       const kmItem: KmItem = Reflect.get(that.kmItems, xmmcCode) | ||||||
|  |       Reflect.set(judgeUI.projectsObj, xmdm, project) | ||||||
|  |       kmItem.status = 1 | ||||||
|  |       Reflect.set(that.kmItems, xmmcCode, kmItem) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   语音播报和提示 |   //   语音播报和提示 | ||||||
|     case 7: |     case 7: { | ||||||
|  |       goJudgeVoice(sound, that.avPlayer) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   模拟灯光事件 |   //   模拟灯光事件 | ||||||
|     case 8: |     case 8: { | ||||||
|  |       that.mndgStr = mndg | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   车道和路段变化 |   //   车道和路段变化 | ||||||
|     case 9: |     case 9: { | ||||||
|  |       judgeUI.lane = lane | ||||||
|  |       that.lane = lane; | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|   //   预进项目事件 |   //   预进项目事件 | ||||||
|     case 10: |     case 10: { | ||||||
|       break; |       const xmdm = precast.xmdm | ||||||
|  |       const xmxh = precast.xmxh | ||||||
|  |       const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||||
|  |       const xmmcCode: string = judgeUI.projectsObj[xmdm].projectCodeCenter; | ||||||
|  |       const xmmcSingleCode: string = judgeUI.projectsObj[xmdm].projectCode; | ||||||
|  |       const kmItem: KmItem = Reflect.get(that.kmItems, xmmcCode) | ||||||
|  |       const xmmcStr = project?.name || ""; | ||||||
|  |       kmItem.status = 2; | ||||||
|  |       Reflect.set(that.kmItems, xmmcCode, project) | ||||||
|  |       that.xmmcStr = xmmcStr || ""; | ||||||
|  |       that.xmmcCode = xmmcCode || ""; | ||||||
|  |       that.xmdm = xmdm; | ||||||
|  |       that.xmxh = xmxh; | ||||||
|  |       that.xmmcSingleCode = xmmcSingleCode || ""; | ||||||
|  |       project.type = '2'; | ||||||
|  |       Reflect.set(judgeUI.projectsObj, xmdm, project) | ||||||
|  |     } | ||||||
|   //   差分事件 |   //   差分事件 | ||||||
|     case 11: |     case 11: { | ||||||
|  |       DetectingDifferences(nongps.type, that.avPlayer) | ||||||
|       break; |       break; | ||||||
|  |     } | ||||||
|     default: |     default: | ||||||
|       83 |  | ||||||
|       break; |       break; | ||||||
|   } |   } | ||||||
|   await callBack({ |   await callBack({ | ||||||
| @ -139,7 +198,25 @@ export const JudgingFn = async (strData: string, callBack: Function, judgeUI: Ju | |||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // | const goJudgeVoice = async (sound: JudgeSound, avPlayer: VoiceAnnounce) => { | ||||||
|  |   dConsole.info('surenjun code=>', JSON.stringify(sound.code)) | ||||||
|  |   //判断是不是模拟灯光语音 | ||||||
|  |   if (sound.type == 1) { | ||||||
|  |     avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => { | ||||||
|  |       examJudgeSoundEnd({ | ||||||
|  |         xmdm: sound.xmdm, code: sound.code[0], type: sound.type | ||||||
|  |       }) | ||||||
|  |       dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ | ||||||
|  |         method: 'examJudgeSoundEnd', | ||||||
|  |         itemno: sound.xmdm, | ||||||
|  |         code: sound.code[0], | ||||||
|  |         type: sound.type, | ||||||
|  |       })) | ||||||
|  |     }) | ||||||
|  |   } else { | ||||||
|  |     avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`]) | ||||||
|  |   } | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export const SetJudgeItem = async (itemno: string, type: 1 | 2) => { | export const SetJudgeItem = async (itemno: string, type: 1 | 2) => { | ||||||
| @ -152,3 +229,33 @@ export const SetJudgeItem = async (itemno: string, type: 1 | 2) => { | |||||||
|   dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, str) |   dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, str) | ||||||
|   dConsole.info(JudgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`) |   dConsole.info(JudgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | const changeExamStatus = async (event: number, xmdm: number, kf: MarkRule[], judgeUI: JudgeUI, that: JudgeBusiness) => { | ||||||
|  |   switch (event) { | ||||||
|  |     case 1: { | ||||||
|  |       const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); | ||||||
|  |       const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) | ||||||
|  |       setTimeout(() => { | ||||||
|  |         if (Reflect.get(param512, 7) != 0) { | ||||||
|  |           clearTimeout(that.deductedPopShowTimer) | ||||||
|  |           judgeUI.isDeductedPopShow = true | ||||||
|  |         } | ||||||
|  |       }, 200) | ||||||
|  |       if (!project.isEnd) { | ||||||
|  |         that.judgeTask.addTask(async () => { | ||||||
|  |           dConsole.info(JudgeTag, `项目开始-${xmdm}-${project.name}`) | ||||||
|  |           await beginProject(xmdm) | ||||||
|  |         }, { | ||||||
|  |           isDelay: true | ||||||
|  |         }) | ||||||
|  |         that.judgeTask.addTask(async () => { | ||||||
|  |           dConsole.info(JudgeTag, `项目-${xmdm}-上传照片 start`) | ||||||
|  |           await uploadProgressPhoto(xmdm) | ||||||
|  |         }, { | ||||||
|  |           isDelay: true | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -1,28 +0,0 @@ | |||||||
| import { testKm2Items, testKm3Items } from '../../mock'; |  | ||||||
| import { JudgeConfigObjKmItems, ProjectInfo, ProjectInfos } from '../../model'; |  | ||||||
| 
 |  | ||||||
| class judgeVariable { |  | ||||||
|   public rmndg: 0 | 1 = 0 |  | ||||||
|   public kmItems: JudgeConfigObjKmItems = {} |  | ||||||
|   public xmmcStr: string = "" |  | ||||||
|   public xmmcEndCode?: string = "" |  | ||||||
|   public xmxh: string = "" |  | ||||||
|   public status: string = "开始" |  | ||||||
| 
 |  | ||||||
|   constructor() { |  | ||||||
| 
 |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   public initKmItems(examSubject: string, projectsCenterObj: ProjectInfos) { |  | ||||||
|     (examSubject == '2' ? testKm2Items : testKm3Items).forEach(item => { |  | ||||||
|       const projectCenterObj: ProjectInfo = Reflect.get(projectsCenterObj, item.code) |  | ||||||
|       Reflect.set(this.kmItems, item.code, { |  | ||||||
|         code: item.code, |  | ||||||
|         status: projectCenterObj === undefined ? 0 : (projectCenterObj.isEnd ? 3 : 1) |  | ||||||
|       }) |  | ||||||
|     }) |  | ||||||
| 
 |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| export const JudgeVariable = new judgeVariable(); |  | ||||||
							
								
								
									
										182
									
								
								entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										182
									
								
								entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,182 @@ | |||||||
|  | /** | ||||||
|  |  * 过程数据处理 | ||||||
|  |  */ | ||||||
|  | import { ProcessDataTag } from '../../config'; | ||||||
|  | import { | ||||||
|  |   CarInfoType, | ||||||
|  |   CDSBInfo, | ||||||
|  |   CDSBInfos, | ||||||
|  |   DrvexamType, | ||||||
|  |   JudgeUI, | ||||||
|  |   MarkRule, | ||||||
|  |   PLCType, | ||||||
|  |   ProjectInfo, | ||||||
|  |   RegulatoryInterfaceParams | ||||||
|  | } from '../../model'; | ||||||
|  | import { GetPhotoBase64 } from '../../utils/Common'; | ||||||
|  | import dayTs from '../../utils/Date'; | ||||||
|  | import { dConsole } from '../../utils/LogWorker'; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * beginProject 项目开始 | ||||||
|  |  */ | ||||||
|  | export const ProjectStart = (ksxm: number, xmxh: string, judgeUI: JudgeUI) => { | ||||||
|  |   const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||||
|  |   const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||||
|  |   const sbxh = getSBXH(ksxm, xmxh, judgeUI.cdsbInfoObj, judgeUI.projectsObj, carInfo.examSubject); | ||||||
|  |   const drvexam: DrvexamType = { | ||||||
|  |     lsh: judgeUI.lsh, | ||||||
|  |     kskm: carInfo?.examSubject || "2", | ||||||
|  |     sfzmhm: judgeUI.idCard, | ||||||
|  |     ksxm: project.projectCodeCenter, | ||||||
|  |     sbxh, | ||||||
|  |     ksxl: judgeUI.xldm, | ||||||
|  |     kchp: encodeURI(carInfo?.plateNo || ""), | ||||||
|  |     ksdd: encodeURI(judgeUI.ksdd), | ||||||
|  |     kslx: encodeURI(judgeUI.kslx) || '', | ||||||
|  |     kssj: dayTs().format("YYYY-MM-DD HH:mm:ss") | ||||||
|  |   } | ||||||
|  |   const data: RegulatoryInterfaceParams = { | ||||||
|  |     //系统类别   接口序列号             接口标识 | ||||||
|  |     xtlb: '17', | ||||||
|  |     jkxlh: judgeUI.serialNumber, | ||||||
|  |     jkid: '17C52', | ||||||
|  |     drvexam | ||||||
|  |   } | ||||||
|  |   dConsole.log(ProcessDataTag, "项目开始数据处理", data) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * uploadProgressPhoto 上传过程照片 | ||||||
|  |  */ | ||||||
|  | export const UploadProgressPhoto = async (ksxm: number, plcData: PLCType, judgeUI: JudgeUI) => { | ||||||
|  |   const photoBase64 = await GetPhotoBase64(judgeUI.context); | ||||||
|  |   const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||||
|  |   const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||||
|  |   const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305') | ||||||
|  |   const drvexam: DrvexamType = { | ||||||
|  |     lsh: judgeUI.lsh, | ||||||
|  |     kskm: carInfo?.examSubject || "2", | ||||||
|  |     ksxm: project.projectCodeCenter, | ||||||
|  |     sfzmhm: judgeUI.idCard, | ||||||
|  |     kchp: encodeURI(carInfo?.plateNo || ""), | ||||||
|  |     zpsj: dayTs().format("YYYY-MM-DD HH:mm:ss"), | ||||||
|  |     zp: photoBase64, | ||||||
|  |     cs: Math.floor((judgeConfig_305 == 0 ? (plcData?.gps?.sd || 0) : (plcData?.sensor?.cs || 0)) * 1.852), | ||||||
|  |     ksdd: encodeURI(judgeUI.ksdd) | ||||||
|  |   } | ||||||
|  |   const data: RegulatoryInterfaceParams = { | ||||||
|  |     xtlb: '17', | ||||||
|  |     jkxlh: judgeUI.serialNumber, | ||||||
|  |     jkid: '17C54', | ||||||
|  |     drvexam | ||||||
|  |   }; | ||||||
|  |   dConsole.log(ProcessDataTag, "上传过程照片数据处理", data); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * pointsDedute 扣分补传 | ||||||
|  |  */ | ||||||
|  | export const DeductPoints = (ksxm: number, kf: MarkRule, xmmcEndCode: string, judgeUI: JudgeUI) => { | ||||||
|  |   const carInfo = AppStorage.get<CarInfoType>('carInfo')!; | ||||||
|  |   const examSubject = carInfo.examSubject | ||||||
|  |   const lsh = judgeUI.lsh | ||||||
|  |   const idCard = judgeUI.idCard | ||||||
|  |   const serialNumber = judgeUI.serialNumber | ||||||
|  |   const ksdd = judgeUI.ksdd | ||||||
|  |   const projectsObj: object = judgeUI.projectsObj | ||||||
|  |   const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||||
|  |   //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目 | ||||||
|  |   const checkProjects = ['17', '41', '1']; | ||||||
|  |   //获取正在进行的项目 | ||||||
|  |   const inProjects = Reflect.ownKeys(projectsObj).filter(projectKey => { | ||||||
|  |     const project: ProjectInfo = Reflect.get(projectsObj, projectKey) | ||||||
|  |     return project.type == '2' | ||||||
|  |   }); | ||||||
|  |   let commonKsxm = ''; | ||||||
|  |   checkProjects.forEach(projectCode => { | ||||||
|  |     if (inProjects.includes(projectCode)) { | ||||||
|  |       commonKsxm = projectCode | ||||||
|  |     } | ||||||
|  |   }) | ||||||
|  |   let ksxmD: string; | ||||||
|  |   if (!project) { | ||||||
|  |     if (commonKsxm) { | ||||||
|  |       ksxmD = Reflect.get(projectsObj, commonKsxm).projectCodeCenter; | ||||||
|  |     } else { | ||||||
|  |       if (examSubject == '3') { | ||||||
|  |         ksxmD = '30000'; | ||||||
|  |       } else { | ||||||
|  |         ksxmD = (xmmcEndCode == undefined ? '10000' : xmmcEndCode); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } else { | ||||||
|  |     ksxmD = project?.projectCodeCenter || ""; | ||||||
|  |   } | ||||||
|  |   const drvexam: DrvexamType = { | ||||||
|  |     lsh, | ||||||
|  |     kskm: examSubject, | ||||||
|  |     ksxm: ksxmD, | ||||||
|  |     kfxm: kf.markcatalog, | ||||||
|  |     kfxmmx: `${ksxm},${kf.markserial}`, | ||||||
|  |     sfzmhm: idCard, | ||||||
|  |     kchp: encodeURI(carInfo?.plateNo || ""), | ||||||
|  |     //扣分方式 | ||||||
|  |     kffs: kf.type == 0 ? 1 : 2, | ||||||
|  |     ksdd: encodeURI(ksdd), | ||||||
|  |     kfsj: dayTs().format("YYYY-MM-DD HH:mm:ss"), | ||||||
|  |   } | ||||||
|  |   const data: RegulatoryInterfaceParams = { | ||||||
|  |     xtlb: '17', | ||||||
|  |     jkxlh: serialNumber, | ||||||
|  |     jkid: '17C53', | ||||||
|  |     drvexam | ||||||
|  |   } | ||||||
|  |   dConsole.log(ProcessDataTag, "扣分上传数据", data) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * endProject 结束项目 | ||||||
|  |  */ | ||||||
|  | export const ProjectEnd = (ksxm: number, xmxh: string, judgeUI: JudgeUI) => { | ||||||
|  |   const carInfo = AppStorage.get<CarInfoType>('carInfo'); | ||||||
|  |   const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) | ||||||
|  |   const sbxh = carInfo.examSubject == '3' ? undefined : getSBXH(ksxm, xmxh, judgeUI.cdsbInfoObj, judgeUI.projectsObj, carInfo.examSubject); | ||||||
|  |   const drvexam: DrvexamType = { | ||||||
|  |     lsh: judgeUI.lsh, | ||||||
|  |     kskm: carInfo?.examSubject || "2", | ||||||
|  |     sfzmhm: judgeUI.idCard, | ||||||
|  |     ksxm: project.projectCodeCenter, | ||||||
|  |     sbxh, | ||||||
|  |     //TODO 操作类型 1:正常 0:撤销该考试记录 | ||||||
|  |     czlx: '1', | ||||||
|  |     ksxl: judgeUI.xldm, | ||||||
|  |     kchp: encodeURI(carInfo?.plateNo || ""), | ||||||
|  |     ksdd: encodeURI(judgeUI.ksdd), | ||||||
|  |     kslx: encodeURI(judgeUI.kslx) || '', | ||||||
|  |     jssj: dayTs().format("YYYY-MM-DD HH:mm:ss") | ||||||
|  |   } | ||||||
|  |   const data: RegulatoryInterfaceParams = { | ||||||
|  |     xtlb: '17', | ||||||
|  |     jkxlh: judgeUI.serialNumber, | ||||||
|  |     jkid: '17C55', | ||||||
|  |     drvexam | ||||||
|  |   } | ||||||
|  |   dConsole.log(ProcessDataTag, "结束项目数据", data) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | const getSBXH = (ksxm: number, xmxh: string, cdsbInfoObj: CDSBInfos, projectsObj: object, examSubject: string): string => { | ||||||
|  |   const project: ProjectInfo = Reflect.get(projectsObj, ksxm); | ||||||
|  |   //科目三不需要 | ||||||
|  |   if (examSubject == '3') { | ||||||
|  |     return "" | ||||||
|  |   } | ||||||
|  |   if (project === undefined) { | ||||||
|  |     return '00000000' | ||||||
|  |   } | ||||||
|  |   const projectKey = `${ksxm}_${xmxh}`; | ||||||
|  |   const currentCdsb: CDSBInfo = Reflect.get(cdsbInfoObj!, projectKey) || {} | ||||||
|  |   const sbxh: string = currentCdsb.sbbm || '00000000' | ||||||
|  |   return sbxh | ||||||
|  | } | ||||||
| @ -6,9 +6,11 @@ import { | |||||||
|   DefaultJudgeConfigObj, |   DefaultJudgeConfigObj, | ||||||
|   ExtendType, |   ExtendType, | ||||||
|   Gps, |   Gps, | ||||||
|  |   JudgeSound, | ||||||
|   LANE, |   LANE, | ||||||
|   MarkRule, |   MarkRule, | ||||||
|   PLCType, |   PLCType, | ||||||
|  |   ProcessDataEnumType, | ||||||
|   ProjectInfo, |   ProjectInfo, | ||||||
|   ProjectInfos, |   ProjectInfos, | ||||||
|   ProjectRoads, |   ProjectRoads, | ||||||
| @ -18,6 +20,8 @@ import { | |||||||
| import { ArrayToByteArray, NumberToByteArray } 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 VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'; | ||||||
|  | import { examJudgeSoundEnd } from './JudgeSDKUtils'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // 中心信号转换 | // 中心信号转换 | ||||||
| @ -853,3 +857,53 @@ export const CurrentProjectConversion = (code: number, projectsObj: object): str | |||||||
|   const project: ProjectInfo = Reflect.get(projectsObj, code) |   const project: ProjectInfo = Reflect.get(projectsObj, code) | ||||||
|   return project?.abbreviation || '通用评判' |   return project?.abbreviation || '通用评判' | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 获取评判语音 | ||||||
|  |  * @param sound - 评判音频对象 | ||||||
|  |  * @param avPlayer - 语音播放器实例 | ||||||
|  |  */ | ||||||
|  | export function PlayJudgeVoice(sound: JudgeSound, avPlayer: VoiceAnnounce) { | ||||||
|  |   if (sound.type == 1) { | ||||||
|  |     avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`], false, () => { | ||||||
|  |       examJudgeSoundEnd({ | ||||||
|  |         xmdm: sound.xmdm, code: sound.code[0], type: sound.type | ||||||
|  |       }); | ||||||
|  |       dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify({ | ||||||
|  |         method: 'examJudgeSoundEnd', | ||||||
|  |         itemno: sound.xmdm, | ||||||
|  |         code: sound.code[0], | ||||||
|  |         type: sound.type, | ||||||
|  |       })); | ||||||
|  |     }); | ||||||
|  |   } else { | ||||||
|  |     avPlayer?.playAudio([`voice/${sound.code[0]}.mp3`]); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 检查差分 | ||||||
|  |  */ | ||||||
|  | export const DetectingDifferences = async (type: number, avPlayer: VoiceAnnounce): Promise<boolean> => { | ||||||
|  |   switch (type) { | ||||||
|  |     case 0: | ||||||
|  |       return true; | ||||||
|  |     case 1: | ||||||
|  |       avPlayer?.playAudio([`voice/差分状态异常.mp3`], true) | ||||||
|  |     // setTimeout(() => { | ||||||
|  |     //   router.back() | ||||||
|  |     // }, 3000) | ||||||
|  |       return true | ||||||
|  |     case 2: | ||||||
|  |       avPlayer?.playAudio([`voice/差分状态异常.mp3`], true); | ||||||
|  |       return false | ||||||
|  |     case 3: | ||||||
|  |       avPlayer?.playAudio([`voice/差分状态异常.mp3`], true); | ||||||
|  |       return true | ||||||
|  |     case 4: | ||||||
|  |     //差分异常上报 | ||||||
|  |       return false | ||||||
|  |     default: | ||||||
|  |       return true | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user