Compare commits
	
		
			2 Commits
		
	
	
		
			fdda0e9e58
			...
			a25ac61d58
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a25ac61d58 | |||
| 9d21d07597 | 
| @ -36,6 +36,7 @@ export interface InitData extends ExamData { | |||||||
| 
 | 
 | ||||||
| export interface JudgeData { | export interface JudgeData { | ||||||
|   judgeUdpEnd?: boolean, |   judgeUdpEnd?: boolean, | ||||||
|  |   judgeExamEnd?: boolean | ||||||
|   performInfo?: JudgePerformInfo, |   performInfo?: JudgePerformInfo, | ||||||
|   business?: JudgeUDPData |   business?: JudgeUDPData | ||||||
| } | } | ||||||
|  | |||||||
| @ -225,108 +225,7 @@ export class BaseJudge { | |||||||
|     if (event === 2 || event === 3) { |     if (event === 2 || event === 3) { | ||||||
|       dConsole.log(JudgeTag, "项目结束判定统计项目") |       dConsole.log(JudgeTag, "项目结束判定统计项目") | ||||||
|       await this.setCountItems(judgeUI); |       await this.setCountItems(judgeUI); | ||||||
|       await this.checkExamIsEnd(judgeUI, that) |       await this.judgeEnd(judgeUI, that) | ||||||
|     } |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   /** |  | ||||||
|    * 校验考试是否结束 |  | ||||||
|    */ |  | ||||||
|   async checkExamIsEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { |  | ||||||
|     dConsole.log(JudgeTag, "校验考试是否结束") |  | ||||||
|     const totalScore = Number(judgeUI.totalScore) |  | ||||||
|     const examMileage = Number(judgeUI.examMileage) |  | ||||||
|     const passingScore = Number(judgeUI.passingScore) |  | ||||||
|     if (that.isExamEnd) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     if (isManual) { |  | ||||||
|       //   考试不合格 |  | ||||||
|       await examJudgeEndExam() |  | ||||||
|       that.isExamEnd = true |  | ||||||
|       that.isManual = true |  | ||||||
|     } else { |  | ||||||
|       const param302: string = Reflect.get(judgeUI.judgeConfigObj, '302') |  | ||||||
|       const param342: string = Reflect.get(judgeUI.judgeConfigObj, '342') |  | ||||||
|       const param512: string[] = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); |  | ||||||
|       if (judgeUI.singlePlay) { |  | ||||||
|         // 单机模式 |  | ||||||
|         dConsole.info(JudgeTag + ' 单机模式结束 => ', judgeUI.isAllProjectsEnd) |  | ||||||
|         if (judgeUI.isAllProjectsEnd && judgeUI.jl >= examMileage) { |  | ||||||
|           //   成绩合格 |  | ||||||
|           if (totalScore >= passingScore && !that.isEndTip) { |  | ||||||
|             if (judgeUI.examSubject == '3' && (param342 === "0" || param342 === "2" || !param342) && (param302 !== "6" && param302 !== "7" && param302 !== "8")) { |  | ||||||
|               if (param512[7] !== "0") { |  | ||||||
|                 // clearTimeout(that.deductedPopShowTimer) |  | ||||||
|                 // that.avPlayer?.playAudio(['voice/综合评判.mp3']) |  | ||||||
|                 // judgeUI.isDeductedPopShow = true |  | ||||||
|                 // judgeUI.defaultTabIndex = 1 |  | ||||||
|                 // that.isEndTip = true |  | ||||||
|                 return |  | ||||||
|               } |  | ||||||
|             } else { |  | ||||||
|               await examJudgeEndExam() |  | ||||||
|               that.isExamEnd = true |  | ||||||
|               return |  | ||||||
|             } |  | ||||||
|           } else { |  | ||||||
|             if (judgeUI.examSubject == '3' && (param302 === "4" || param302 === "5" || param302 === "7" || param302 === "8")) { |  | ||||||
|               await examJudgeEndExam() |  | ||||||
|               that.isExamEnd = true |  | ||||||
|               return |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|           await examJudgeEndExam() |  | ||||||
|           that.isExamEnd = true |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       else { |  | ||||||
|         //   非单机模式 |  | ||||||
|         //成绩不合格 |  | ||||||
|         if (totalScore < passingScore) { |  | ||||||
|           //科目三不合格报靠边停车 |  | ||||||
|           if (judgeUI.examSubject == '3' && param302 === "1") { |  | ||||||
|             that.avPlayer?.playAudio([`voice/考试结束.mp3`]); |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           await examJudgeEndExam() |  | ||||||
|           that.isExamEnd = true |  | ||||||
|           return |  | ||||||
|         } |  | ||||||
|         //   成绩合格 |  | ||||||
|         if (judgeUI.isAllProjectsEnd && totalScore >= passingScore && !that.isEndTip) { |  | ||||||
|           // 科目二成绩合格 |  | ||||||
|           if (judgeUI.examSubject == '2') { |  | ||||||
|             await examJudgeEndExam() |  | ||||||
|             that.isExamEnd = true |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           //考试里程判断 |  | ||||||
|           if (judgeUI.examSubject == '3' && judgeUI.jl < examMileage) { |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           //考试合格自动退出 |  | ||||||
|           if (judgeUI.examSubject == '3' && (param302 === "4" || param302 === "7") || param302 === "8") { |  | ||||||
|             await examJudgeEndExam() |  | ||||||
|             that.isExamEnd = true |  | ||||||
|             return |  | ||||||
|           } |  | ||||||
|           if (judgeUI.examSubject == '3' && (param342 === "0" || param342 === "2") && |  | ||||||
|             (param302 !== "6" && param302 !== "7" && param302 !== "8")) { |  | ||||||
|             if (param512[7] !== "0") { |  | ||||||
|               clearTimeout(that.deductedPopShowTimer) |  | ||||||
|               judgeUI.isDeductedPopShow = false |  | ||||||
|               that.avPlayer?.playAudio(['voice/综合评判.mp3']) |  | ||||||
|               judgeUI.isDeductedPopShow = true |  | ||||||
|               judgeUI.defaultTabIndex = 1 |  | ||||||
|               that.isEndTip = true |  | ||||||
|             } |  | ||||||
|           } else { |  | ||||||
|             await examJudgeEndExam() |  | ||||||
|             that.isExamEnd = true |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -379,6 +278,7 @@ export class BaseJudge { | |||||||
|     //联网模式下:项目没有做完、当前分数大于及格分;手动结束直接退出 |     //联网模式下:项目没有做完、当前分数大于及格分;手动结束直接退出 | ||||||
|     if (!judgeUI.singlePlay && that.isManual && !judgeUI.isAllProjectsEnd && judgeUI.totalScore >= judgeUI.passingScore) { |     if (!judgeUI.singlePlay && that.isManual && !judgeUI.isAllProjectsEnd && judgeUI.totalScore >= judgeUI.passingScore) { | ||||||
|       that.avPlayer?.playAudio(['voice/empty.mp3'], true, () => { |       that.avPlayer?.playAudio(['voice/empty.mp3'], true, () => { | ||||||
|  |         this.isUdpEnd = true | ||||||
|         router.back(); |         router.back(); | ||||||
|       }) |       }) | ||||||
|       return |       return | ||||||
| @ -387,7 +287,21 @@ export class BaseJudge { | |||||||
|       this.isUdpEnd = true |       this.isUdpEnd = true | ||||||
|       try { |       try { | ||||||
|         if (!judgeUI.singlePlay) { |         if (!judgeUI.singlePlay) { | ||||||
|           DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { judgeUdpEnd: true } }) |           DifferentialAndSignal.sendMsg({ type: WorkerMessageDataType.JudgeSend, data: { | ||||||
|  |             judgeUdpEnd: this.isUdpEnd, | ||||||
|  |             judgeExamEnd: true, | ||||||
|  |             performInfo: that.performInfo, | ||||||
|  |             business: { | ||||||
|  |               totalScore: that.judgeUI.totalScore, | ||||||
|  |               kfArr: that.judgeUI.kfArr, | ||||||
|  |               startTime: that.judgeUI.udpStartTIme, | ||||||
|  |               xmmcSingleCode: that.xmmcSingleCode, | ||||||
|  |               kmItems: that.kmItems, | ||||||
|  |               examTime: that.judgeUI.examTime, | ||||||
|  |               cdsbInfoObj: that.judgeUI.cdsbInfoObj!, | ||||||
|  |               xmdm: that.xmdm, | ||||||
|  |               xmxh: that.xmxh | ||||||
|  |             } } }) | ||||||
|         } |         } | ||||||
|       } catch (e) { |       } catch (e) { | ||||||
|         console.info(JudgeTag, JSON.stringify(e)) |         console.info(JudgeTag, JSON.stringify(e)) | ||||||
| @ -494,6 +408,7 @@ export class BaseJudge { | |||||||
|             if (score <= (judgeUI.examSubject === "3" ? 10 : 20)) { |             if (score <= (judgeUI.examSubject === "3" ? 10 : 20)) { | ||||||
|               if (judgeUI.kfArr.length - 1 === index) { |               if (judgeUI.kfArr.length - 1 === index) { | ||||||
|                 that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { |                 that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { | ||||||
|  |                   this.isUdpEnd = true | ||||||
|                   router.back(); |                   router.back(); | ||||||
|                 }) |                 }) | ||||||
|                 throw new Error('End Loop') |                 throw new Error('End Loop') | ||||||
| @ -501,6 +416,7 @@ export class BaseJudge { | |||||||
|               that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`]) |               that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`]) | ||||||
|             } else { |             } else { | ||||||
|               that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { |               that.avPlayer?.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => { | ||||||
|  |                 this.isUdpEnd = true | ||||||
|                 router.back(); |                 router.back(); | ||||||
|               }) |               }) | ||||||
|               throw new Error('End Loop') |               throw new Error('End Loop') | ||||||
| @ -513,6 +429,7 @@ export class BaseJudge { | |||||||
|     } else { |     } else { | ||||||
|       that.avPlayer?.playAudio([voiceURL], true, () => { |       that.avPlayer?.playAudio([voiceURL], true, () => { | ||||||
|         setTimeout(() => { |         setTimeout(() => { | ||||||
|  |           this.isUdpEnd = true | ||||||
|           router.back(); |           router.back(); | ||||||
|         }, param302 === "8" ? 3000 : 0) |         }, param302 === "8" ? 3000 : 0) | ||||||
|       }) |       }) | ||||||
|  | |||||||
| @ -172,10 +172,11 @@ export default class JudgeBusiness { | |||||||
|     this.judgeUI.sd = ((param350 == 0 ? this.plcData.gps.sd : this.plcData.sensor.cs) as number * 1.852).toFixed(0) + '' |     this.judgeUI.sd = ((param350 == 0 ? this.plcData.gps.sd : this.plcData.sensor.cs) as number * 1.852).toFixed(0) + '' | ||||||
|     this.judgeUI.dw = (Math.floor(this.plcData.sensor.dw as number) || 0) + '' |     this.judgeUI.dw = (Math.floor(this.plcData.sensor.dw as number) || 0) + '' | ||||||
| 
 | 
 | ||||||
|     if (!this.judgeBusiness.getIsUdpEnd()) { |  | ||||||
|     DifferentialAndSignal.sendMsg({ |     DifferentialAndSignal.sendMsg({ | ||||||
|       type: WorkerMessageDataType.JudgeSend, data: { |       type: WorkerMessageDataType.JudgeSend, data: { | ||||||
|         performInfo: this.performInfo, |         performInfo: this.performInfo, | ||||||
|  |         judgeUdpEnd: this.judgeBusiness.getIsUdpEnd(), | ||||||
|  |         judgeExamEnd: this.isExamEnd, | ||||||
|         business: { |         business: { | ||||||
|           totalScore: this.judgeUI.totalScore, |           totalScore: this.judgeUI.totalScore, | ||||||
|           kfArr: this.judgeUI.kfArr, |           kfArr: this.judgeUI.kfArr, | ||||||
| @ -189,7 +190,6 @@ export default class JudgeBusiness { | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     if (!this.isExamEnd) { |     if (!this.isExamEnd) { | ||||||
|       await examJudgeRealExam(this.plcData) |       await examJudgeRealExam(this.plcData) | ||||||
|  | |||||||
| @ -35,7 +35,8 @@ class JudgeUdpBusiness { | |||||||
|   private serialIndex: number = 1 |   private serialIndex: number = 1 | ||||||
|   public business: JudgeUDPData | null = null |   public business: JudgeUDPData | null = null | ||||||
|   public performInfo: JudgePerformInfo | null = null |   public performInfo: JudgePerformInfo | null = null | ||||||
|   public isEnd: boolean = false |   public isUDPEnd: boolean = false | ||||||
|  |   public isExamEnd: boolean = false | ||||||
| 
 | 
 | ||||||
|   constructor() { |   constructor() { | ||||||
|     if (!JudgeUdpBusiness.instance) { |     if (!JudgeUdpBusiness.instance) { | ||||||
| @ -75,7 +76,7 @@ class JudgeUdpBusiness { | |||||||
|     fyj = Math.floor(fyj > 0 ? (fyj * 100) : (fyj * 100 + 65536)) |     fyj = Math.floor(fyj > 0 ? (fyj * 100) : (fyj * 100 + 65536)) | ||||||
|     let examType = this.carInfo.examSubject === "2" ? "2" : "3" |     let examType = this.carInfo.examSubject === "2" ? "2" : "3" | ||||||
| 
 | 
 | ||||||
|     dConsole.info("扣分", this.business) |     dConsole.info("小红球过程数据", this.isExamEnd, this.business) | ||||||
| 
 | 
 | ||||||
|     const arr: number[][] = [ |     const arr: number[][] = [ | ||||||
|     //考生号 |     //考生号 | ||||||
| @ -85,7 +86,7 @@ class JudgeUdpBusiness { | |||||||
|       //科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间 |       //科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间 | ||||||
|       NumberToByteArray(`${examType}${this.business.startTime}`, 4 * 8), |       NumberToByteArray(`${examType}${this.business.startTime}`, 4 * 8), | ||||||
|       // 消息序号 |       // 消息序号 | ||||||
|       NumberToByteArray(this.isEnd ? 0 : this.serialIndex, 2 * 8), |       NumberToByteArray(this.isExamEnd ? 0 : this.serialIndex, 2 * 8), | ||||||
|       translateSignals, |       translateSignals, | ||||||
|       NumberToByteArray(tempSd * 100, 2 * 8), |       NumberToByteArray(tempSd * 100, 2 * 8), | ||||||
|       NumberToByteArray(plcData.sensor.fdjzs / 100, 8), |       NumberToByteArray(plcData.sensor.fdjzs / 100, 8), | ||||||
| @ -123,7 +124,7 @@ class JudgeUdpBusiness { | |||||||
|       //摩托压线 Byte[20], |       //摩托压线 Byte[20], | ||||||
|       NumberToByteArray(0, 20 * 8), |       NumberToByteArray(0, 20 * 8), | ||||||
|       //考试用时 |       //考试用时 | ||||||
|       NumberToByteArray(this.business.startTime, 4 * 8), |       NumberToByteArray(this.business.examTime, 4 * 8), | ||||||
|       //项目用时 |       //项目用时 | ||||||
|       NumberToByteArray(FillZero(0, 2), 2 * 8), |       NumberToByteArray(FillZero(0, 2), 2 * 8), | ||||||
|       //设备信号状态 |       //设备信号状态 | ||||||
| @ -133,11 +134,11 @@ class JudgeUdpBusiness { | |||||||
|     arr.forEach(itemArr => { |     arr.forEach(itemArr => { | ||||||
|       result = result.concat(itemArr) |       result = result.concat(itemArr) | ||||||
|     }) |     }) | ||||||
|     if (this.isEnd) { |     if (this.isExamEnd) { | ||||||
|       this.serialIndex = 1 |       this.serialIndex = 1 | ||||||
|       this.business = null |       this.business = null | ||||||
|       this.performInfo = null |       this.performInfo = null | ||||||
|       this.isEnd = false |       this.isExamEnd = false | ||||||
|     } else { |     } else { | ||||||
|       this.serialIndex += 1 |       this.serialIndex += 1 | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -58,9 +58,10 @@ workerPort.onmessage = async (e: MessageEvents) => { | |||||||
|     } |     } | ||||||
|     case WorkerMessageDataType.JudgeSend: { |     case WorkerMessageDataType.JudgeSend: { | ||||||
|       let data = result.data as JudgeData |       let data = result.data as JudgeData | ||||||
|       JudgeUdpBusinessInstance.business = data.business || null |       JudgeUdpBusinessInstance.business = data.business ?? null | ||||||
|       JudgeUdpBusinessInstance.performInfo = data.performInfo || null |       JudgeUdpBusinessInstance.performInfo = data.performInfo ?? null | ||||||
|       JudgeUdpBusinessInstance.isEnd = data.judgeUdpEnd || false |       JudgeUdpBusinessInstance.isUDPEnd = data.judgeUdpEnd ?? false | ||||||
|  |       JudgeUdpBusinessInstance.isExamEnd = data.judgeExamEnd ?? false | ||||||
|       break |       break | ||||||
|     } |     } | ||||||
|     case WorkerMessageDataType.CenterSend: { |     case WorkerMessageDataType.CenterSend: { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user