新评判重构
This commit is contained in:
parent
46730847ee
commit
9617c63ebb
@ -447,8 +447,8 @@ export interface JudgeUI {
|
||||
startFullTime: string
|
||||
mapPointArr: MAPPOINT[]
|
||||
mapPointItemArr: MAPITEMPOINTITEM[]
|
||||
systemparmArr: SYSTEMPARMARR[]
|
||||
carinfoArr: CARINFO[]
|
||||
systemparmArr: SYSTEM_PARAM[]
|
||||
carinfoArr: CAR_INFO[]
|
||||
kfArr: MarkRule[]
|
||||
judgeConfigObj: DefaultJudgeConfigObj
|
||||
judgeConfig: SyssetConfig[]
|
||||
@ -532,16 +532,22 @@ export interface CDSBInfo {
|
||||
xmxh?: string
|
||||
}
|
||||
|
||||
export interface SYSTEMPARMARR {
|
||||
NO1: number,
|
||||
NO2: number,
|
||||
NO3: number,
|
||||
TXT1: string,
|
||||
TXT2: string,
|
||||
TXT3: string,
|
||||
export interface SYSTEM_PARAM {
|
||||
NO1?: number,
|
||||
NO2?: number,
|
||||
NO3?: number,
|
||||
TXT1?: string,
|
||||
TXT2?: string,
|
||||
TXT3?: string,
|
||||
no1?: number,
|
||||
no2?: number,
|
||||
no3?: number,
|
||||
txt1?: string
|
||||
txt2?: string
|
||||
txt3?: string
|
||||
}
|
||||
|
||||
export interface CARINFO {
|
||||
export interface CAR_INFO {
|
||||
CARID: string,
|
||||
IPADDR: string,
|
||||
CARCLASS: string,
|
||||
@ -550,7 +556,6 @@ export interface CARINFO {
|
||||
FLAG: string,
|
||||
BK1: string,
|
||||
BK2: string
|
||||
X_MCH: string,
|
||||
}
|
||||
|
||||
export interface KmItem {
|
||||
@ -597,12 +602,12 @@ export interface JudgeInitObj extends Km3JudgeInitConfig {
|
||||
carmodel: string
|
||||
allitems: ItemInfo[]
|
||||
iteminfo?: ItemInfo[]
|
||||
systemparm: SYSTEMPARMARR[]
|
||||
systemparm: SYSTEM_PARAM[]
|
||||
mark: MarkRule[]
|
||||
sysset: SyssetConfig[]
|
||||
itemInfoObj?: ItemInfos
|
||||
carlist: string
|
||||
carinfo: CARINFO[]
|
||||
carinfo: CAR_INFO[]
|
||||
|
||||
}
|
||||
|
||||
@ -857,6 +862,9 @@ export interface Project {
|
||||
//
|
||||
isEnd: boolean,
|
||||
isUpload: boolean
|
||||
// 下面是大车使用的
|
||||
isRequired?: boolean
|
||||
ykType?: '1' | '2' | '3' | '4' | '5'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import { JudgeConfig, JudgeTag } from '../config';
|
||||
import JudgeAndProjectComponent from './Judge/components/JudgeAndProject';
|
||||
import {
|
||||
AmplifyItem,
|
||||
CARINFO,
|
||||
CAR_INFO,
|
||||
CarInfoType,
|
||||
CDSBInfo,
|
||||
CDSBInfos,
|
||||
@ -37,7 +37,7 @@ import {
|
||||
RouteParamsType,
|
||||
SYSSET,
|
||||
SyssetConfig,
|
||||
SYSTEMPARMARR,
|
||||
SYSTEM_PARAM,
|
||||
User
|
||||
} from '../model';
|
||||
import { GetSyncData } from '../utils/table/Operation';
|
||||
@ -57,7 +57,7 @@ import { InitMapPoint, InitMapPointItem } from './Judge/TableUtils';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct JudgePage {
|
||||
export struct JudgePage {
|
||||
@State wayno: number = 0
|
||||
@State isDdxk: boolean = false;
|
||||
//开始时间
|
||||
@ -78,7 +78,7 @@ struct JudgePage {
|
||||
@State singlePlay: boolean = false;
|
||||
@State totalScore: number = 100
|
||||
//模拟考试项目
|
||||
@State projects: ProjectInfo[] = []
|
||||
@State projects: Project[] = []
|
||||
@State projectsObj: ProjectInfos = {}
|
||||
@State projectsCenterObj: ProjectInfos = {}
|
||||
@State markRuleListObj: MarkRules = {}
|
||||
@ -113,9 +113,9 @@ struct JudgePage {
|
||||
@State artSubject3ProjectsCodesArr: string[] = ['3', '9', '4', '10', '12', '11']
|
||||
@State manualMarkRules: MarkRule[] = []
|
||||
//科目三评判初始化数据
|
||||
@State systemparmArr: SYSTEMPARMARR[] = []
|
||||
@State systemparmArr: SYSTEM_PARAM[] = []
|
||||
@State mapPointItemArr: MAPITEMPOINTITEM[] = []
|
||||
@State carinfoArr: CARINFO[] = []
|
||||
@State carinfoArr: CAR_INFO[] = []
|
||||
@State mapPointArr: MAPPOINT[] = []
|
||||
//手动项目是否在进行中
|
||||
@State isManualProjectIn: boolean = false;
|
||||
@ -206,7 +206,6 @@ struct JudgePage {
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
dConsole.log(JudgeTag, "JudgePage aboutToAppear")
|
||||
this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
|
||||
this.singlePlay = AppStorage.get<boolean>('singlePlay')!
|
||||
this.startFullTime = dayTs().format("YYYYMMDDHHmmss");
|
||||
@ -283,7 +282,6 @@ struct JudgePage {
|
||||
FLAG: carInfo.flag!,
|
||||
BK1: carInfo.bk1!,
|
||||
BK2: carInfo.bk2!,
|
||||
X_MCH: carInfo.x_mch!,
|
||||
})
|
||||
dConsole.info(JudgeTag, 'surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr))
|
||||
}
|
||||
@ -403,8 +401,8 @@ struct JudgePage {
|
||||
}
|
||||
|
||||
//初始化systemParam表
|
||||
async initSystemParam(sysParam?: MA_SYSTEMPARMType []) {
|
||||
let systemParms: MA_SYSTEMPARMType[] = sysParam || await GetSyncData<MA_SYSTEMPARMType>('MA_SYSTEMPARM')
|
||||
async initSystemParam(sysParam?: SYSTEM_PARAM[]) {
|
||||
let systemParams: SYSTEM_PARAM[] = sysParam || await GetSyncData<SYSTEM_PARAM>('MA_SYSTEMPARM')
|
||||
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
//小车车型列表
|
||||
@ -416,73 +414,72 @@ struct JudgePage {
|
||||
let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item);
|
||||
dConsole.info(JudgeTag, 'surenjun kStringArr', JSON.stringify(kStringArr))
|
||||
let isInExam = kStringArr.length > 0;
|
||||
let carNo = '', allItems: string[] = [];
|
||||
systemParms.forEach((systemParm) => {
|
||||
let carNo: number, allItems: string[] = [];
|
||||
systemParams.forEach((systemParam) => {
|
||||
if (JudgeConfig.isTrajectoryOpen) {
|
||||
systemParm.no1 = systemParm.NO1! + '';
|
||||
systemParm.no2 = systemParm.NO2! + '';
|
||||
systemParm.no3 = systemParm.NO3! + '';
|
||||
systemParm.txt1 = systemParm.TXT1!;
|
||||
systemParm.txt2 = systemParm.TXT2!;
|
||||
systemParm.txt3 = systemParm.TXT3!;
|
||||
systemParam.no1 = systemParam.NO1!;
|
||||
systemParam.no2 = systemParam.NO2!;
|
||||
systemParam.no3 = systemParam.NO3!;
|
||||
systemParam.txt1 = systemParam.TXT1!;
|
||||
systemParam.txt2 = systemParam.TXT2!;
|
||||
systemParam.txt3 = systemParam.TXT3!;
|
||||
}
|
||||
const txt1 = decodeURI(systemParm.txt1 || "")
|
||||
const txt2 = decodeURI(systemParm.txt2 || "")
|
||||
const txt1 = decodeURI(systemParam.txt1 || "")
|
||||
const txt2 = decodeURI(systemParam.txt2 || "")
|
||||
|
||||
const no1 = systemParm.no1;
|
||||
const no2 = systemParm.no2;
|
||||
const no3 = systemParm.no3;
|
||||
const no1 = systemParam.no1;
|
||||
const no2 = systemParam.no2;
|
||||
const no3 = systemParam.no3;
|
||||
|
||||
//获取当前考车的no2
|
||||
if (systemParm.no1 == "3" && systemParm.no3 == "1") {
|
||||
if (no1 == 3 && no3 == 1) {
|
||||
if (txt1 === this.carName) {
|
||||
carNo = systemParm?.no2 || ""
|
||||
this.carlist = carNo
|
||||
carNo = no2!
|
||||
}
|
||||
}
|
||||
|
||||
//获取及格分数线
|
||||
if (systemParm.no1 == "3" && systemParm.no3 == "3" && carNo === systemParm.no2) {
|
||||
if (no1 == 3 && no3 == 3 && carNo === no2) {
|
||||
this.passingScore = Number(txt1) || 0;
|
||||
}
|
||||
//根据车型获取应行驶里程数
|
||||
if (systemParm.no1 == "3" && systemParm.no3 == "15" && carNo === systemParm.no2) {
|
||||
this.examMileage = ((decodeURI(systemParm.txt1 || "")) || '').split('^')[0];
|
||||
if (no1 == 3 && no3 == 15 && carNo === no2) {
|
||||
this.examMileage = ((decodeURI(systemParam.txt1 || "")) || '').split('^')[0];
|
||||
}
|
||||
//获取当前考车的考试项目
|
||||
if (carNo !== '' && systemParm.no1 == "3" && systemParm.no2 == carNo && systemParm.no3 == "10") {
|
||||
allItems = decodeURIComponent(systemParm.txt1 || "").split(',').filter(txt => txt !== '')
|
||||
if (carNo && no1 === 3 && no2 == carNo && no3 === 10) {
|
||||
allItems = decodeURIComponent(systemParam.txt1 || "").split(',').filter(txt => txt !== '')
|
||||
dConsole.info(JudgeTag, '考试项目', allItems)
|
||||
}
|
||||
if (
|
||||
//科目二获取项目
|
||||
(this.examSubject == "2" && allItems.length && systemParm.no1 == '6' && allItems.includes(systemParm?.no2 || ""))
|
||||
(this.examSubject == "2" && allItems.length && no1 === 6 && allItems.includes(no2 + "" || ""))
|
||||
||
|
||||
//科目三获取项目
|
||||
(this.examSubject == "3" && systemParm.no1 == "6")
|
||||
(this.examSubject == "3" && no1 === 6)
|
||||
) {
|
||||
const name = decodeURI(systemParm.txt1 || "")
|
||||
const name = decodeURI(systemParam.txt1 || "")
|
||||
//小车过滤掉 夜间模拟行驶
|
||||
if (sCarTypes.includes(this.carType) && name === '夜间行驶') {
|
||||
if (name === '夜间行驶') {
|
||||
return
|
||||
}
|
||||
const currentProject: ProjectInfo = {
|
||||
const currentProject: Project = {
|
||||
name,
|
||||
abbreviation: decodeURI(systemParm.txt3 || ""),
|
||||
projectCode: no2,
|
||||
abbreviation: decodeURI(systemParam.txt3 || ""),
|
||||
projectCode: no2 + '',
|
||||
projectCodeCenter: txt2,
|
||||
//是否是必考 加减档设置成非必考
|
||||
isRequired: no2 == '14' ? false : allItems.includes(no2 + ''),
|
||||
isRequired: no2 === 14 ? false : allItems.includes(no2 + ''),
|
||||
//是否考过了
|
||||
isEnd: false,
|
||||
//项目开始数据是否上传过
|
||||
isUpload: false,
|
||||
}
|
||||
const no2Num = Number(systemParm.no2)
|
||||
const no2Num = Number(no2)
|
||||
//真实监管下发考试项目
|
||||
if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
|
||||
dConsole.info(JudgeTag, 'surenjun =>', txt2)
|
||||
dConsole.info(JudgeTag, 'surenjun => no2', systemParm.no2)
|
||||
dConsole.info(JudgeTag, 'surenjun => no2', no2)
|
||||
currentProject.type = '3'
|
||||
currentProject.isUpload = true
|
||||
currentProject.isEnd = true
|
||||
@ -493,14 +490,15 @@ struct JudgePage {
|
||||
this.projects.push(currentProject);
|
||||
}
|
||||
this.systemparmArr.push({
|
||||
NO1: Number(systemParm.no1),
|
||||
NO2: Number(systemParm.no2),
|
||||
NO3: Number(systemParm.no3),
|
||||
TXT1: decodeURIComponent(systemParm.txt1 || ""),
|
||||
TXT2: decodeURIComponent(systemParm.txt2 || ""),
|
||||
TXT3: decodeURIComponent(systemParm.txt3 || ""),
|
||||
NO1: Number(no1),
|
||||
NO2: Number(no2),
|
||||
NO3: Number(no3),
|
||||
TXT1: decodeURIComponent(systemParam.txt1 || ""),
|
||||
TXT2: decodeURIComponent(systemParam.txt2 || ""),
|
||||
TXT3: decodeURIComponent(systemParam.txt3 || ""),
|
||||
})
|
||||
})
|
||||
|
||||
dConsole.log(JudgeTag, "考试项目", JSON.stringify(this.projects))
|
||||
if (!this.projects.length) {
|
||||
Prompt.showToast({
|
||||
@ -648,7 +646,7 @@ struct JudgePage {
|
||||
this.carInfo.examSubject = this.examSubject
|
||||
this.singlePlay = beginDataObj.exam == 0;
|
||||
this.carName = initDataObj.name;
|
||||
await this.initSystemParam(initDataObj.systemparm as MA_SYSTEMPARMType[])
|
||||
await this.initSystemParam(initDataObj.systemparm)
|
||||
await this.initMarkRules(initDataObj.mark);
|
||||
await this.initSysset(initDataObj.sysset as SYSSET[]);
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import {
|
||||
import FileUtils from '../../utils/FileUtils'
|
||||
import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements'
|
||||
import common from '@ohos.app.ability.common'
|
||||
import { JudgeStartFn } from './JudgeStart'
|
||||
import { LargeJudge, RouterParam, SmallJudge } from './JudgeStart'
|
||||
import { dConsole } from '../../utils/LogWorker'
|
||||
import { JudgeTag } from '../../config'
|
||||
import { examJudgeRealExam } from './JudgeSDKUtils'
|
||||
@ -22,6 +22,8 @@ import { JudgingFn, SetJudgeItem } from './JudgeIng'
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
|
||||
import { PlcStrToJson, PlcStrToWXJson } from './utils'
|
||||
import { JudgeEndFn } from './JudgeEnd'
|
||||
import { BaseJudge } from './Typing'
|
||||
import router from '@ohos.router'
|
||||
|
||||
export default class JudgeBusiness {
|
||||
public mndgStr: string | undefined
|
||||
@ -60,11 +62,18 @@ export default class JudgeBusiness {
|
||||
private tempData?: PLCType
|
||||
// 是否发送udp
|
||||
private isUdpEnd: boolean = false
|
||||
judgeBusiness: BaseJudge
|
||||
|
||||
constructor(judgeUI: JudgeUI) {
|
||||
this.judgeUI = judgeUI
|
||||
this.fileUtil = new FileUtils(judgeUI.context)
|
||||
this.avPlayer = new VoiceAnnounce(this.context);
|
||||
const carType = AppStorage.get<string>("carType")
|
||||
if (carType === '1' || carType === '2') {
|
||||
this.judgeBusiness = new SmallJudge()
|
||||
} else {
|
||||
this.judgeBusiness = new LargeJudge()
|
||||
}
|
||||
}
|
||||
|
||||
// 单机轨迹模式
|
||||
@ -96,11 +105,16 @@ export default class JudgeBusiness {
|
||||
}, 200)
|
||||
}
|
||||
|
||||
public async JudgeInit() {
|
||||
let currentParams: RouterParam = router.getParams() as RouterParam;
|
||||
this.judgeBusiness.JudgeInit(currentParams.mode, this.judgeUI.carName)
|
||||
}
|
||||
|
||||
// 开始考试
|
||||
public async JudgeStart(callBack: Function) {
|
||||
// 处理考试前需要做的业务
|
||||
// 调用开始考试
|
||||
JudgeStartFn(callBack, this.judgeUI, this)
|
||||
this.judgeBusiness.JudgeStart(callBack, this.judgeUI, this)
|
||||
// 处理PLC数据
|
||||
// 处理实时udp里的plc信号
|
||||
DifferentialAndSignal.onMsg((data: string) => {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { JudgeConfig, JudgeTag } from '../../config';
|
||||
import {
|
||||
BaseInfoType,
|
||||
CARINFO,
|
||||
CAR_INFO,
|
||||
CarInfoType,
|
||||
CDSBInfo,
|
||||
ExaminerInfoType,
|
||||
@ -21,7 +21,8 @@ import {
|
||||
ProjectInfo,
|
||||
RouteParamsType,
|
||||
SyssetConfig,
|
||||
SYSTEMPARMARR
|
||||
SYSTEM_PARAM,
|
||||
Project
|
||||
} from '../../model';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { dConsole } from '../../utils/LogWorker';
|
||||
@ -33,217 +34,729 @@ import {
|
||||
examJudgeSetRealExamCallback,
|
||||
examJudgeVersion
|
||||
} from './JudgeSDKUtils';
|
||||
import FileModel from '../judgeSDK/utils/fileModel';
|
||||
import JudgeBusiness from './JudgeBusiness';
|
||||
import { saveStartRecordVideo } from '../../utils/Video';
|
||||
import router from '@ohos.router';
|
||||
import systemTime from '@ohos.systemTime';
|
||||
import { GetModelData } from './utils';
|
||||
import { BaseJudge, GetSysSetResult } from './Typing';
|
||||
import { GetSyncData } from '../../utils/table/Operation';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
|
||||
export const JudgeStartFn = async (callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) => {
|
||||
const name = judgeUI.name
|
||||
const kssycs = judgeUI.kssycs
|
||||
const manualMarkRules = judgeUI.manualMarkRules
|
||||
// 处理单机模式
|
||||
const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen;
|
||||
const isJudgeInitBool = AppStorage.get<boolean>('isJudgeInitBool');
|
||||
const trajectoryPath = JudgeConfig.trajectoryPath;
|
||||
let strArr: string[] = [];
|
||||
if (isTrajectoryOpen) {
|
||||
const folderPath = await that.fileUtil.initFolder(trajectoryPath);
|
||||
const str: string = await that.fileUtil.readFile(folderPath)
|
||||
strArr = str.split('\n')
|
||||
}
|
||||
//日志回调
|
||||
dConsole.info(JudgeTag, '1.进入评判入口')
|
||||
await examJudgeSetLogCallback(6, async (level: number, info: string, len: number) => {
|
||||
dConsole.log(JudgeTag, '评判日志:' + info)
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info)
|
||||
})
|
||||
|
||||
dConsole.info(JudgeTag, '2.注册日志回调完成')
|
||||
|
||||
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await GetJudgeInitData(judgeUI.context, judgeUI.markRuleListObj, judgeUI.carType, judgeUI.carName, judgeUI.systemparmArr, judgeUI.carinfoArr, judgeUI.examSubject, judgeUI.itemInfoObj, judgeUI.judgeConfig, judgeUI.carlist, judgeUI.mapPointArr, judgeUI.mapPointItemArr);
|
||||
//相关评判初始化只做一次
|
||||
if (!isJudgeInitBool) {
|
||||
dConsole.log(JudgeTag, "评判初始化参数", initInfo)
|
||||
await examJudgeInit(initInfo);
|
||||
AppStorage.setOrCreate('isJudgeInitBool', true)
|
||||
dConsole.info(JudgeTag, '4.评判初始化完成')
|
||||
}
|
||||
AppStorage.setOrCreate('isJudge', true)
|
||||
// 2.评判过程回调
|
||||
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
|
||||
// 评判回调日志
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData, strData)
|
||||
dConsole.info(JudgeTag, '评判回调数据', strData)
|
||||
await that.Judging(strData, callBack)
|
||||
})
|
||||
await examJudgeSetPerformCallback(async (info: string) => {
|
||||
dConsole.info('评判实时数据', info)
|
||||
that.performInfo = JSON.parse(info)
|
||||
const jl = Math.floor((that.performInfo.qjjl + that.performInfo.dcjl) / 100);
|
||||
if (jl > Number(judgeUI.examMileage)) {
|
||||
that.JudgeEnd()
|
||||
}
|
||||
judgeUI.jl = jl
|
||||
judgeUI.laneSignal = that.performInfo.lane
|
||||
})
|
||||
let beginExamInfo: JudgeBeginObj | undefined = undefined
|
||||
// 3.开始考试
|
||||
if (isTrajectoryOpen) {
|
||||
beginExamInfo = JSON.parse(strArr[1])
|
||||
beginExamInfo && (beginExamInfo.replay = 1)
|
||||
} else {
|
||||
beginExamInfo = await GetJudgeBeginData(judgeUI.projects, judgeUI.carType, judgeUI.kssycs, judgeUI.isDdxk, judgeUI.ddxkTime, judgeUI.projectsCenterObj, judgeUI.ddxkKsxmArr, judgeUI.ddxkKfArr, judgeUI.passingScore, judgeUI.wayno, judgeUI.name, judgeUI.lsh, judgeUI.idCard, that.isExam)
|
||||
}
|
||||
if (beginExamInfo) {
|
||||
await examJudgeBeginExam(beginExamInfo);
|
||||
}
|
||||
dConsole.info(JudgeTag, '6.开始考试注册完成')
|
||||
that.avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
|
||||
if (!judgeUI.singlePlay) {
|
||||
that.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, that.context)
|
||||
}
|
||||
judgeUI.draw = true
|
||||
// 处理单机泡轨迹模式
|
||||
if (isTrajectoryOpen) {
|
||||
that.SingleMachineTrajectory(strArr)
|
||||
return
|
||||
}
|
||||
export interface RouterParam {
|
||||
mode: number
|
||||
score: number
|
||||
kString: string
|
||||
wayno: number
|
||||
}
|
||||
|
||||
// 获取评判开始考试数据
|
||||
const GetJudgeBeginData = async (projects: ProjectInfo[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) => {
|
||||
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
||||
const examinerName = examinerInfo?.name || ""
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
const sczb = currentParams.sczb;
|
||||
const kfdm = currentParams.kfdm;
|
||||
const ksxm: JudgeKSXM[] = projects.map(project => {
|
||||
const temp: JudgeKSXM = {
|
||||
xmdm: Number(project.projectCode), xmxh: ''
|
||||
|
||||
export class SmallJudge implements BaseJudge {
|
||||
public async JudgeInit(mode: number, carName: string): Promise<GetSysSetResult> {
|
||||
const systemParams = await GetSyncData<SYSTEM_PARAM>('MA_SYSTEMPARM')
|
||||
let currentParams: RouterParam = router.getParams() as RouterParam;
|
||||
let totalScore: number
|
||||
let wayno: number
|
||||
let mockLight: boolean
|
||||
let carlist: string
|
||||
let passingScore: number
|
||||
let examMileage: string
|
||||
let projectsObj: Array<Project>
|
||||
let projectsCenterObj: Array<String>
|
||||
let ddxkKsxmArr: Array<string>
|
||||
let singlePlay: boolean = AppStorage.get("singlePlay")
|
||||
let systemparmArr: Array<SYSTEM_PARAM> = []
|
||||
let projects: Array<Project> = []
|
||||
let examSubject: string = ""
|
||||
if (mode === 2) {
|
||||
totalScore = Number(currentParams.score) || totalScore
|
||||
}
|
||||
if (singlePlay) {
|
||||
wayno = currentParams.wayno || 1;
|
||||
}
|
||||
if (singlePlay) {
|
||||
wayno = Number(currentParams.wayno) || 1;
|
||||
}
|
||||
//真实监管下发的项目
|
||||
let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item);
|
||||
let isInExam = kStringArr.length > 0;
|
||||
let carNo: number, allItems: string[] = [];
|
||||
systemParams.forEach((systemParam) => {
|
||||
if (JudgeConfig.isTrajectoryOpen) {
|
||||
systemParam.no1 = systemParam.NO1!;
|
||||
systemParam.no2 = systemParam.NO2!;
|
||||
systemParam.no3 = systemParam.NO3!;
|
||||
systemParam.txt1 = systemParam.TXT1!;
|
||||
systemParam.txt2 = systemParam.TXT2!;
|
||||
systemParam.txt3 = systemParam.TXT3!;
|
||||
}
|
||||
const txt1 = decodeURI(systemParam.txt1 || "")
|
||||
const txt2 = decodeURI(systemParam.txt2 || "")
|
||||
|
||||
const no1 = systemParam.no1;
|
||||
const no2 = systemParam.no2;
|
||||
const no3 = systemParam.no3;
|
||||
|
||||
//获取当前考车的no2
|
||||
if (no1 == 3 && no3 == 1) {
|
||||
if (txt1 === carName) {
|
||||
carNo = no2
|
||||
}
|
||||
}
|
||||
|
||||
//获取及格分数线
|
||||
if (no1 == 3 && no3 == 3 && carNo === no2) {
|
||||
passingScore = Number(txt1) || 0;
|
||||
}
|
||||
//根据车型获取应行驶里程数
|
||||
if (no1 == 3 && no3 == 15 && carNo === no2) {
|
||||
examMileage = ((decodeURI(systemParam.txt1 || "")) || '').split('^')[0];
|
||||
}
|
||||
//获取当前考车的考试项目
|
||||
if (carNo && no1 === 3 && no2 == carNo && no3 === 10) {
|
||||
allItems = decodeURIComponent(systemParam.txt1 || "").split(',').filter(txt => txt !== '')
|
||||
dConsole.info(JudgeTag, '考试项目', allItems)
|
||||
}
|
||||
if (
|
||||
//科目二获取项目
|
||||
(examSubject == "2" && allItems.length && no1 === 6 && allItems.includes(no2 + "" || ""))
|
||||
||
|
||||
//科目三获取项目
|
||||
(examSubject == "3" && no1 === 6)
|
||||
) {
|
||||
const name = decodeURI(systemParam.txt1 || "")
|
||||
//小车过滤掉 夜间模拟行驶
|
||||
if (name === '夜间行驶') {
|
||||
return
|
||||
}
|
||||
const currentProject: Project = {
|
||||
name,
|
||||
abbreviation: decodeURI(systemParam.txt3 || ""),
|
||||
projectCode: no2 + '',
|
||||
projectCodeCenter: txt2,
|
||||
//是否是必考 加减档设置成非必考
|
||||
isRequired: no2 === 14 ? false : allItems.includes(no2 + ''),
|
||||
//是否考过了
|
||||
isEnd: false,
|
||||
//项目开始数据是否上传过
|
||||
isUpload: false,
|
||||
}
|
||||
const no2Num = Number(no2)
|
||||
//真实监管下发考试项目
|
||||
if (isInExam && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
|
||||
dConsole.info(JudgeTag, 'surenjun =>', txt2)
|
||||
dConsole.info(JudgeTag, 'surenjun => no2', no2)
|
||||
currentProject.type = '3'
|
||||
currentProject.isUpload = true
|
||||
currentProject.isEnd = true
|
||||
ddxkKsxmArr.push(txt2)
|
||||
}
|
||||
Reflect.set(projectsObj, no2Num, currentProject)
|
||||
Reflect.set(projectsCenterObj, txt2, currentProject)
|
||||
projects.push(currentProject);
|
||||
}
|
||||
systemparmArr.push({
|
||||
NO1: Number(no1),
|
||||
NO2: Number(no2),
|
||||
NO3: Number(no3),
|
||||
TXT1: decodeURIComponent(systemParam.txt1 || ""),
|
||||
TXT2: decodeURIComponent(systemParam.txt2 || ""),
|
||||
TXT3: decodeURIComponent(systemParam.txt3 || ""),
|
||||
})
|
||||
})
|
||||
if (!projects.length) {
|
||||
promptAction.showToast({
|
||||
message: '读取数据库信息失败,请重新联网更新!',
|
||||
duration: 8000
|
||||
});
|
||||
dConsole.log(JudgeTag, "router back3")
|
||||
router.back();
|
||||
}
|
||||
return temp
|
||||
})
|
||||
const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => {
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode)
|
||||
return Number(currentProject.projectCode)
|
||||
})) || [];
|
||||
const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
||||
return {
|
||||
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
||||
} as JudgeKFXM
|
||||
})) : []
|
||||
const beginInfo: JudgeBeginObj = {
|
||||
kgid: '012',
|
||||
kgxm: decodeURI(examinerName || ''),
|
||||
exam: isExam ? 1 : 0,
|
||||
//是否回放
|
||||
replay: 0,
|
||||
//生成的轨迹文件
|
||||
track: '',
|
||||
xm: name,
|
||||
sex: 0,
|
||||
kslsh: lsh,
|
||||
sfzmhm: idCard,
|
||||
ksyy: '',
|
||||
kscx: carType,
|
||||
kkcs: Number(kssycs) || 2,
|
||||
sfyk: 0,
|
||||
ykkkcs: 1,
|
||||
wayno: Number(wayno),
|
||||
czlx: 0,
|
||||
kskssj: await systemTime.getCurrentTime(),
|
||||
passing: Number(passingScore),
|
||||
ksxm,
|
||||
//断点续考
|
||||
ddxk: isDdxk ? 1 : 0,
|
||||
ddkssj: ddxkTime || 0,
|
||||
ykxm,
|
||||
kfxm,
|
||||
yklc: 0,
|
||||
special: [],
|
||||
sczb: (sczb === undefined || sczb == '0') ? 0 : 1,
|
||||
sczbkf: kfdm,
|
||||
dmndg: false,
|
||||
mfxx: false,
|
||||
mfxxn: false
|
||||
totalScore,
|
||||
wayno,
|
||||
mockLight,
|
||||
carlist,
|
||||
passingScore,
|
||||
examMileage,
|
||||
projectsObj,
|
||||
projectsCenterObj,
|
||||
ddxkKsxmArr,
|
||||
singlePlay,
|
||||
systemparmArr,
|
||||
projects,
|
||||
}
|
||||
}
|
||||
dConsole.info(JudgeTag, '5.获取开始考试数据完成')
|
||||
return beginInfo
|
||||
}
|
||||
|
||||
// 获取评判初始化数据
|
||||
const GetJudgeInitData = async (context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEMPARMARR[], carinfoArr: CARINFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) => {
|
||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||
const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3'
|
||||
public async JudgeStart(callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) {
|
||||
const name = judgeUI.name
|
||||
const kssycs = judgeUI.kssycs
|
||||
const manualMarkRules = judgeUI.manualMarkRules
|
||||
// 处理单机模式
|
||||
const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen;
|
||||
const isJudgeInitBool = AppStorage.get<boolean>('isJudgeInitBool');
|
||||
const trajectoryPath = JudgeConfig.trajectoryPath;
|
||||
let strArr: string[] = [];
|
||||
if (isTrajectoryOpen) {
|
||||
const folderPath = await that.fileUtil.initFolder(trajectoryPath);
|
||||
const str: string = await that.fileUtil.readFile(folderPath)
|
||||
strArr = str.split('\n')
|
||||
}
|
||||
//日志回调
|
||||
dConsole.info(JudgeTag, '1.进入评判入口')
|
||||
await examJudgeSetLogCallback(6, async (level: number, info: string, len: number) => {
|
||||
dConsole.log(JudgeTag, '评判日志:' + info)
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info)
|
||||
})
|
||||
|
||||
let allitems: ItemInfo[] = [];
|
||||
if (examSubject == '2' && itemInfoObj) {
|
||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
||||
const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context)
|
||||
const temp: ItemInfo = {
|
||||
xmdm: cdsb?.xmdm || 0,
|
||||
xmxh: cdsb?.xmxh || "",
|
||||
model: model || ""
|
||||
dConsole.info(JudgeTag, '2.注册日志回调完成')
|
||||
|
||||
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.GetJudgeInitData(judgeUI.context, judgeUI.markRuleListObj, judgeUI.carType, judgeUI.carName, judgeUI.systemparmArr, judgeUI.carinfoArr, judgeUI.examSubject, judgeUI.itemInfoObj, judgeUI.judgeConfig, judgeUI.carlist, judgeUI.mapPointArr, judgeUI.mapPointItemArr);
|
||||
//相关评判初始化只做一次
|
||||
if (!isJudgeInitBool) {
|
||||
dConsole.log(JudgeTag, "评判初始化参数", initInfo)
|
||||
await examJudgeInit(initInfo);
|
||||
AppStorage.setOrCreate('isJudgeInitBool', true)
|
||||
dConsole.info(JudgeTag, '4.评判初始化完成')
|
||||
}
|
||||
AppStorage.setOrCreate('isJudge', true)
|
||||
// 2.评判过程回调
|
||||
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
|
||||
// 评判回调日志
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData, strData)
|
||||
dConsole.info(JudgeTag, '评判回调数据', strData)
|
||||
await that.Judging(strData, callBack)
|
||||
})
|
||||
await examJudgeSetPerformCallback(async (info: string) => {
|
||||
dConsole.info('评判实时数据', info)
|
||||
that.performInfo = JSON.parse(info)
|
||||
const jl = Math.floor((that.performInfo.qjjl + that.performInfo.dcjl) / 100);
|
||||
if (jl > Number(judgeUI.examMileage)) {
|
||||
that.JudgeEnd()
|
||||
}
|
||||
judgeUI.jl = jl
|
||||
judgeUI.laneSignal = that.performInfo.lane
|
||||
})
|
||||
let beginExamInfo: JudgeBeginObj | undefined = undefined
|
||||
// 3.开始考试
|
||||
if (isTrajectoryOpen) {
|
||||
beginExamInfo = JSON.parse(strArr[1])
|
||||
beginExamInfo && (beginExamInfo.replay = 1)
|
||||
} else {
|
||||
beginExamInfo = await this.GetJudgeBeginData(judgeUI.projects, judgeUI.carType, judgeUI.kssycs, judgeUI.isDdxk, judgeUI.ddxkTime, judgeUI.projectsCenterObj, judgeUI.ddxkKsxmArr, judgeUI.ddxkKfArr, judgeUI.passingScore, judgeUI.wayno, judgeUI.name, judgeUI.lsh, judgeUI.idCard, that.isExam)
|
||||
}
|
||||
if (beginExamInfo) {
|
||||
await examJudgeBeginExam(beginExamInfo);
|
||||
}
|
||||
dConsole.info(JudgeTag, '6.开始考试注册完成')
|
||||
that.avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
|
||||
if (!judgeUI.singlePlay) {
|
||||
that.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, that.context)
|
||||
}
|
||||
judgeUI.draw = true
|
||||
// 处理单机泡轨迹模式
|
||||
if (isTrajectoryOpen) {
|
||||
that.SingleMachineTrajectory(strArr)
|
||||
return
|
||||
}
|
||||
};
|
||||
|
||||
public async GetJudgeBeginData(projects: ProjectInfo[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) {
|
||||
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
||||
const examinerName = examinerInfo?.name || ""
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
const sczb = currentParams.sczb;
|
||||
const kfdm = currentParams.kfdm;
|
||||
const ksxm: JudgeKSXM[] = projects.map(project => {
|
||||
const temp: JudgeKSXM = {
|
||||
xmdm: Number(project.projectCode), xmxh: ''
|
||||
}
|
||||
return temp
|
||||
})
|
||||
}
|
||||
|
||||
//获取版本号
|
||||
const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => {
|
||||
const current: MarkRule = Reflect.get(markRuleListObj, ruleKey)
|
||||
return current
|
||||
})
|
||||
const initInfo: JudgeInitObj = {
|
||||
sdkver: await examJudgeVersion(),
|
||||
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",
|
||||
kskm: Number(carInfo?.examSubject || "2"),
|
||||
kchp: carInfo?.plateNo || "",
|
||||
kchm: Number(carInfo?.carId || ""),
|
||||
kscx: carType,
|
||||
cxcode: '1',
|
||||
name: carName,
|
||||
carmodel: GetModelData(`${examType}/${carType}.txt`, context) || "",
|
||||
allitems,
|
||||
iteminfo: [],
|
||||
systemparm: systemparmArr,
|
||||
mark,
|
||||
sysset: judgeConfig,
|
||||
itemInfoObj,
|
||||
carlist: carlist,
|
||||
carinfo: carinfoArr,
|
||||
const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => {
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode)
|
||||
return Number(currentProject.projectCode)
|
||||
})) || [];
|
||||
const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
||||
return {
|
||||
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
||||
} as JudgeKFXM
|
||||
})) : []
|
||||
const beginInfo: JudgeBeginObj = {
|
||||
kgid: '012',
|
||||
kgxm: decodeURI(examinerName || ''),
|
||||
exam: isExam ? 1 : 0,
|
||||
//是否回放
|
||||
replay: 0,
|
||||
//生成的轨迹文件
|
||||
track: '',
|
||||
xm: name,
|
||||
sex: 0,
|
||||
kslsh: lsh,
|
||||
sfzmhm: idCard,
|
||||
ksyy: '',
|
||||
kscx: carType,
|
||||
kkcs: Number(kssycs) || 2,
|
||||
sfyk: 0,
|
||||
ykkkcs: 1,
|
||||
wayno: Number(wayno),
|
||||
czlx: 0,
|
||||
kskssj: await systemTime.getCurrentTime(),
|
||||
passing: Number(passingScore),
|
||||
ksxm,
|
||||
//断点续考
|
||||
ddxk: isDdxk ? 1 : 0,
|
||||
ddkssj: ddxkTime || 0,
|
||||
ykxm,
|
||||
kfxm,
|
||||
yklc: 0,
|
||||
special: [],
|
||||
sczb: (sczb === undefined || sczb == '0') ? 0 : 1,
|
||||
sczbkf: kfdm,
|
||||
dmndg: false,
|
||||
mfxx: false,
|
||||
mfxxn: false
|
||||
}
|
||||
dConsole.info(JudgeTag, '5.获取开始考试数据完成')
|
||||
return beginInfo
|
||||
};
|
||||
let km3Config: Km3JudgeInitConfig = {}
|
||||
if (examSubject == '3') {
|
||||
km3Config = {
|
||||
map_point: mapPointArr,
|
||||
map_point_item: mapPointItemArr,
|
||||
//科目三暂时为空
|
||||
|
||||
public async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) {
|
||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||
const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3'
|
||||
|
||||
let allitems: ItemInfo[] = [];
|
||||
if (examSubject == '2' && itemInfoObj) {
|
||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
||||
const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context)
|
||||
const temp: ItemInfo = {
|
||||
xmdm: cdsb?.xmdm || 0,
|
||||
xmxh: cdsb?.xmxh || "",
|
||||
model: model || ""
|
||||
}
|
||||
return temp
|
||||
})
|
||||
}
|
||||
|
||||
//获取版本号
|
||||
const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => {
|
||||
const current: MarkRule = Reflect.get(markRuleListObj, ruleKey)
|
||||
return current
|
||||
})
|
||||
const initInfo: JudgeInitObj = {
|
||||
sdkver: await examJudgeVersion(),
|
||||
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",
|
||||
kskm: Number(carInfo?.examSubject || "2"),
|
||||
kchp: carInfo?.plateNo || "",
|
||||
kchm: Number(carInfo?.carId || ""),
|
||||
kscx: carType,
|
||||
cxcode: '1',
|
||||
name: carName,
|
||||
carmodel: GetModelData(`${examType}/${carType}.txt`, context) || "",
|
||||
allitems,
|
||||
iteminfo: [],
|
||||
roads: GetModelData('km3/Roads.txt', context) || "",
|
||||
sharps: GetModelData('km3/Sharps.txt', context) || ""
|
||||
systemparm: systemparmArr,
|
||||
mark,
|
||||
sysset: judgeConfig,
|
||||
itemInfoObj,
|
||||
carlist: carlist,
|
||||
carinfo: carinfoArr,
|
||||
};
|
||||
initInfo.map_point = km3Config.map_point
|
||||
initInfo.map_point_item = km3Config.map_point_item
|
||||
initInfo.iteminfo = km3Config.iteminfo
|
||||
initInfo.roads = km3Config.roads
|
||||
initInfo.sharps = km3Config.sharps
|
||||
}
|
||||
// 获取科目三的评判配置
|
||||
dConsole.info(JudgeTag, '3.获取评判初始化数据完成')
|
||||
return initInfo
|
||||
let km3Config: Km3JudgeInitConfig = {}
|
||||
if (examSubject == '3') {
|
||||
km3Config = {
|
||||
map_point: mapPointArr,
|
||||
map_point_item: mapPointItemArr,
|
||||
//科目三暂时为空
|
||||
iteminfo: [],
|
||||
roads: GetModelData('km3/Roads.txt', context) || "",
|
||||
sharps: GetModelData('km3/Sharps.txt', context) || ""
|
||||
};
|
||||
initInfo.map_point = km3Config.map_point
|
||||
initInfo.map_point_item = km3Config.map_point_item
|
||||
initInfo.iteminfo = km3Config.iteminfo
|
||||
initInfo.roads = km3Config.roads
|
||||
initInfo.sharps = km3Config.sharps
|
||||
}
|
||||
// 获取科目三的评判配置
|
||||
dConsole.info(JudgeTag, '3.获取评判初始化数据完成')
|
||||
return initInfo
|
||||
};
|
||||
}
|
||||
|
||||
export const GetModelData = (modelName: string, context: common.UIAbilityContext): string => {
|
||||
try {
|
||||
return new FileModel(context).getModelContent(JudgeConfig.modelPath, modelName);
|
||||
} catch (e) {
|
||||
// 可根据实际需求,返回空字符串或抛出异常
|
||||
dConsole.error(JudgeTag, `获取模型数据失败: ${modelName}`, e.message)
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
export class LargeJudge implements BaseJudge {
|
||||
public async JudgeInit(mode: number, carName: string): Promise<GetSysSetResult> {
|
||||
const systemParams = await GetSyncData<SYSTEM_PARAM>('MA_SYSTEMPARM')
|
||||
let currentParams: RouterParam = router.getParams() as RouterParam;
|
||||
let totalScore: number
|
||||
let wayno: number
|
||||
let mockLight: boolean
|
||||
let carlist: string
|
||||
let passingScore: number
|
||||
let examMileage: string
|
||||
let projectsObj: Array<Project>
|
||||
let projectsCenterObj: Array<String>
|
||||
let ddxkKsxmArr: Array<string>
|
||||
let singlePlay: boolean = AppStorage.get("singlePlay")
|
||||
let systemparmArr: Array<SYSTEM_PARAM> = []
|
||||
let projects: Array<Project> = []
|
||||
if (mode === 2) {
|
||||
totalScore = Number(currentParams.score) || totalScore
|
||||
}
|
||||
if (singlePlay) {
|
||||
wayno = currentParams.wayno || 1;
|
||||
}
|
||||
//真实监管下发的项目
|
||||
let kStringArr: string[] = (currentParams.kString?.split(',') || []).filter(item => item);
|
||||
// 单机模式下增驾进模拟灯光
|
||||
mockLight = kStringArr.includes("41700") || singlePlay && mode === 3
|
||||
|
||||
let isInExam = kStringArr.length > 0;
|
||||
|
||||
// const {isTrajectoryOpen} = judgeConfig
|
||||
|
||||
let carNo = '', allItems: string[] = [];
|
||||
systemParams.forEach((systemParam: SYSTEM_PARAM) => {
|
||||
const no1 = systemParam.no1;
|
||||
const no2 = systemParam.no2;
|
||||
const no3 = systemParam.no3;
|
||||
|
||||
const txt1 = decodeURI(systemParam.txt1)
|
||||
//获取当前考车的no2
|
||||
if (no1 == 3 && no3 == 1 && txt1 === carName) {
|
||||
carNo = no2 + ''
|
||||
carlist = carNo
|
||||
}
|
||||
//获取及格分数线
|
||||
if (no1 == 3 && no3 == 3 && Number(carNo) == no2) {
|
||||
passingScore = Number(txt1) || 0;
|
||||
}
|
||||
//根据车型获取应行驶里程数
|
||||
if (no1 == 3 && no3 == 15 && Number(carNo) == no2) {
|
||||
let mileage = (decodeURI(systemParam.txt1) || '').split('^')
|
||||
if (mode === 1) {
|
||||
examMileage = mileage[1]
|
||||
} else if (mode === 2) {
|
||||
examMileage = mileage[2]
|
||||
} else {
|
||||
examMileage = mileage[0]
|
||||
}
|
||||
}
|
||||
// 满分学习里程
|
||||
if (mode === 5 && no1 == 3 && no2 == Number(carNo) && no3 == 63) {
|
||||
let data = decodeURI(systemParam.txt1)?.split("^")
|
||||
examMileage = data[1] || examMileage
|
||||
}
|
||||
//获取当前考车的考试项目
|
||||
if (mode === 2 && no1 == 3 && no2 == Number(carNo) && no3 == 46) {
|
||||
// 夜考必考项目读取
|
||||
allItems = decodeURIComponent(systemParam.txt1).split(',').filter(txt => txt !== '')
|
||||
} else if (mode !== 2 && no1 == 3 && no2 == Number(carNo) && no3 == 10) {
|
||||
// 其他模式必考项目获取
|
||||
allItems = decodeURIComponent(systemParam.txt1).split(',').filter(txt => txt !== '')
|
||||
} else if (mode == 5 && no1 == 3 && no2 == Number(carNo) && no3 == 63) {
|
||||
// 满分学习项目
|
||||
let data = decodeURI(systemParam.txt1)?.split("^")
|
||||
allItems = data[0]?.split(",").filter(item => item !== "") || []
|
||||
}
|
||||
})
|
||||
systemParams.forEach((systemParam) => {
|
||||
// if (isTrajectoryOpen) {
|
||||
// systemParam.no1 = systemParam.NO1;
|
||||
// systemParam.no2 = systemParam.NO2;
|
||||
// systemParam.no3 = systemParam.NO3;
|
||||
// systemParam.txt1 = systemParam.TXT1;
|
||||
// systemParam.txt2 = systemParam.TXT2;
|
||||
// systemParam.txt3 = systemParam.TXT3;
|
||||
// }
|
||||
const no1 = systemParam.no1;
|
||||
const no2 = systemParam.no2;
|
||||
const no3 = systemParam.no3;
|
||||
const txt2 = decodeURI(systemParam.txt2)
|
||||
|
||||
if (no1 == 6) {
|
||||
const name = decodeURI(systemParam.txt1)
|
||||
// 白考过滤掉夜间行驶
|
||||
if (mode !== 2 && no2 == 13) {
|
||||
return
|
||||
}
|
||||
// 模拟夜间驾驶(灯光)
|
||||
if (!mockLight && no2 == 41) {
|
||||
return
|
||||
}
|
||||
let isRequired = (mode === 5 && allItems.length === 0) || allItems.includes(no2 + '')
|
||||
let isEnd = false
|
||||
let isUpload = false
|
||||
|
||||
// 夜考除夜间行驶其他项目不需要重复上传
|
||||
if (mode === 2 && no2 != 13) {
|
||||
isUpload = true
|
||||
}
|
||||
// 加减档自动完成,为非必须项目
|
||||
if (no2 == 14) {
|
||||
isRequired = false
|
||||
}
|
||||
const currentProject: Project = {
|
||||
name,
|
||||
abbreviation: decodeURI(systemParam.txt3),
|
||||
projectCode: no2 + '',
|
||||
projectCodeCenter: txt2,
|
||||
// 白考夜间行驶非必考
|
||||
isRequired,
|
||||
//是否考过了
|
||||
isEnd,
|
||||
//项目开始数据是否上传过
|
||||
isUpload,
|
||||
}
|
||||
// 夜考时
|
||||
if (mode === 2 && no2 != 13) {
|
||||
currentProject.ykType = isRequired ? "1" : "3"
|
||||
currentProject.isEnd = !allItems.includes(no2 + '')
|
||||
}
|
||||
projectsObj[no2*1] = currentProject
|
||||
projectsCenterObj[txt2] = currentProject
|
||||
projects.push(currentProject);
|
||||
|
||||
// 真实监管下发考试项目, 夜考模式不进此逻辑
|
||||
if (isInExam && mode !== 2 && !(kStringArr.includes(txt2) || kStringArr.includes(no2 + ''))) {
|
||||
projectsObj[no2*1].type = '3'
|
||||
projectsObj[no2*1].isUpload = true
|
||||
projectsObj[no2*1].isEnd = true
|
||||
projectsCenterObj[txt2].type = '3'
|
||||
projectsCenterObj[txt2].isUpload = true
|
||||
projectsCenterObj[txt2].isEnd = true
|
||||
ddxkKsxmArr.push(txt2)
|
||||
}
|
||||
}
|
||||
systemparmArr.push({
|
||||
NO1: Number(no1),
|
||||
NO2: Number(no2),
|
||||
NO3: Number(no3),
|
||||
TXT1: decodeURIComponent(systemParam.txt1),
|
||||
TXT2: decodeURIComponent(systemParam.txt2),
|
||||
TXT3: decodeURIComponent(systemParam.txt3),
|
||||
})
|
||||
})
|
||||
if (!projects.length) {
|
||||
promptAction.showToast({
|
||||
message: '读取数据库信息失败,请重新联网更新!',
|
||||
duration: 8000
|
||||
});
|
||||
router.back();
|
||||
}
|
||||
return {
|
||||
totalScore,
|
||||
wayno,
|
||||
mockLight,
|
||||
carlist,
|
||||
passingScore,
|
||||
examMileage,
|
||||
projectsObj,
|
||||
projectsCenterObj,
|
||||
ddxkKsxmArr,
|
||||
singlePlay,
|
||||
systemparmArr,
|
||||
projects,
|
||||
}
|
||||
}
|
||||
|
||||
public async JudgeStart(callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) {
|
||||
const name = judgeUI.name
|
||||
const kssycs = judgeUI.kssycs
|
||||
// 处理远程扣分使用
|
||||
const manualMarkRules = judgeUI.manualMarkRules
|
||||
// 处理单机模式
|
||||
const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen;
|
||||
const isJudgeInitBool = AppStorage.get<boolean>('isJudgeInitBool');
|
||||
const trajectoryPath = JudgeConfig.trajectoryPath;
|
||||
let strArr: string[] = [];
|
||||
if (isTrajectoryOpen) {
|
||||
const folderPath = await that.fileUtil.initFolder(trajectoryPath);
|
||||
const str: string = await that.fileUtil.readFile(folderPath)
|
||||
strArr = str.split('\n')
|
||||
}
|
||||
//日志回调
|
||||
dConsole.info(JudgeTag, '1.进入评判入口')
|
||||
await examJudgeSetLogCallback(6, async (level: number, info: string, len: number) => {
|
||||
dConsole.log(JudgeTag, '评判日志:' + info)
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeLogData, info)
|
||||
})
|
||||
|
||||
dConsole.info(JudgeTag, '2.注册日志回调完成')
|
||||
|
||||
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.GetJudgeInitData(judgeUI.context, judgeUI.markRuleListObj, judgeUI.carType, judgeUI.carName, judgeUI.systemparmArr, judgeUI.carinfoArr, judgeUI.examSubject, judgeUI.itemInfoObj, judgeUI.judgeConfig, judgeUI.carlist, judgeUI.mapPointArr, judgeUI.mapPointItemArr);
|
||||
//相关评判初始化只做一次
|
||||
if (!isJudgeInitBool) {
|
||||
dConsole.log(JudgeTag, "评判初始化参数", initInfo)
|
||||
await examJudgeInit(initInfo);
|
||||
AppStorage.setOrCreate('isJudgeInitBool', true)
|
||||
dConsole.info(JudgeTag, '4.评判初始化完成')
|
||||
}
|
||||
AppStorage.setOrCreate('isJudge', true)
|
||||
// 2.评判过程回调
|
||||
await examJudgeSetRealExamCallback(async (strData: string, len: number) => {
|
||||
// 评判回调日志
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeProgressCallbackData, strData)
|
||||
dConsole.info(JudgeTag, '评判回调数据', strData)
|
||||
await that.Judging(strData, callBack)
|
||||
})
|
||||
await examJudgeSetPerformCallback(async (info: string) => {
|
||||
dConsole.info('评判实时数据', info)
|
||||
that.performInfo = JSON.parse(info)
|
||||
const jl = Math.floor((that.performInfo.qjjl + that.performInfo.dcjl) / 100);
|
||||
if (jl > Number(judgeUI.examMileage)) {
|
||||
that.JudgeEnd()
|
||||
}
|
||||
judgeUI.jl = jl
|
||||
judgeUI.laneSignal = that.performInfo.lane
|
||||
})
|
||||
let beginExamInfo: JudgeBeginObj | undefined = undefined
|
||||
// 3.开始考试
|
||||
if (isTrajectoryOpen) {
|
||||
beginExamInfo = JSON.parse(strArr[1])
|
||||
beginExamInfo && (beginExamInfo.replay = 1)
|
||||
} else {
|
||||
beginExamInfo = await this.GetJudgeBeginData(judgeUI.projects, judgeUI.carType, judgeUI.kssycs, judgeUI.isDdxk, judgeUI.ddxkTime, judgeUI.projectsCenterObj, judgeUI.ddxkKsxmArr, judgeUI.ddxkKfArr, judgeUI.passingScore, judgeUI.wayno, judgeUI.name, judgeUI.lsh, judgeUI.idCard, that.isExam)
|
||||
}
|
||||
if (beginExamInfo) {
|
||||
await examJudgeBeginExam(beginExamInfo);
|
||||
}
|
||||
dConsole.info(JudgeTag, '6.开始考试注册完成')
|
||||
that.avPlayer?.playAudio([judgeUI.singlePlay ? 'voice/ksks.wav' : 'voice/监管成功.mp3'])
|
||||
if (!judgeUI.singlePlay) {
|
||||
that.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, that.context)
|
||||
}
|
||||
judgeUI.draw = true
|
||||
// 处理单机泡轨迹模式
|
||||
if (isTrajectoryOpen) {
|
||||
that.SingleMachineTrajectory(strArr)
|
||||
return
|
||||
}
|
||||
};
|
||||
|
||||
public async GetJudgeBeginData(projects: ProjectInfo[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) {
|
||||
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
||||
const examinerName = examinerInfo?.name || ""
|
||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||
const sczb = currentParams.sczb;
|
||||
const kfdm = currentParams.kfdm;
|
||||
const ksxm: JudgeKSXM[] = projects.map(project => {
|
||||
const temp: JudgeKSXM = {
|
||||
xmdm: Number(project.projectCode), xmxh: ''
|
||||
}
|
||||
return temp
|
||||
})
|
||||
const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => {
|
||||
const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode)
|
||||
return Number(currentProject.projectCode)
|
||||
})) || [];
|
||||
const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
||||
return {
|
||||
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
||||
} as JudgeKFXM
|
||||
})) : []
|
||||
const beginInfo: JudgeBeginObj = {
|
||||
kgid: '012',
|
||||
kgxm: decodeURI(examinerName || ''),
|
||||
exam: isExam ? 1 : 0,
|
||||
//是否回放
|
||||
replay: 0,
|
||||
//生成的轨迹文件
|
||||
track: '',
|
||||
xm: name,
|
||||
sex: 0,
|
||||
kslsh: lsh,
|
||||
sfzmhm: idCard,
|
||||
ksyy: '',
|
||||
kscx: carType,
|
||||
kkcs: Number(kssycs) || 2,
|
||||
sfyk: 0,
|
||||
ykkkcs: 1,
|
||||
wayno: Number(wayno),
|
||||
czlx: 0,
|
||||
kskssj: await systemTime.getCurrentTime(),
|
||||
passing: Number(passingScore),
|
||||
ksxm,
|
||||
//断点续考
|
||||
ddxk: isDdxk ? 1 : 0,
|
||||
ddkssj: ddxkTime || 0,
|
||||
ykxm,
|
||||
kfxm,
|
||||
yklc: 0,
|
||||
special: [],
|
||||
sczb: (sczb === undefined || sczb == '0') ? 0 : 1,
|
||||
sczbkf: kfdm,
|
||||
dmndg: false,
|
||||
mfxx: false,
|
||||
mfxxn: false
|
||||
}
|
||||
dConsole.info(JudgeTag, '5.获取开始考试数据完成')
|
||||
return beginInfo
|
||||
};
|
||||
|
||||
public async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) {
|
||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||
const examType = carInfo?.examSubject == '2' ? 'km2' : 'km3'
|
||||
|
||||
let allitems: ItemInfo[] = [];
|
||||
if (examSubject == '2' && itemInfoObj) {
|
||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
||||
const model = GetModelData(`${examType}/${cdsb.modelKey}.txt`, context)
|
||||
const temp: ItemInfo = {
|
||||
xmdm: cdsb?.xmdm || 0,
|
||||
xmxh: cdsb?.xmxh || "",
|
||||
model: model || ""
|
||||
}
|
||||
return temp
|
||||
})
|
||||
}
|
||||
|
||||
//获取版本号
|
||||
const mark: MarkRule[] = Reflect.ownKeys(markRuleListObj).map(ruleKey => {
|
||||
const current: MarkRule = Reflect.get(markRuleListObj, ruleKey)
|
||||
return current
|
||||
})
|
||||
const initInfo: JudgeInitObj = {
|
||||
sdkver: await examJudgeVersion(),
|
||||
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "",
|
||||
kskm: Number(carInfo?.examSubject || "2"),
|
||||
kchp: carInfo?.plateNo || "",
|
||||
kchm: Number(carInfo?.carId || ""),
|
||||
kscx: carType,
|
||||
cxcode: '1',
|
||||
name: carName,
|
||||
carmodel: GetModelData(`${examType}/${carType}.txt`, context) || "",
|
||||
allitems,
|
||||
iteminfo: [],
|
||||
systemparm: systemparmArr,
|
||||
mark,
|
||||
sysset: judgeConfig,
|
||||
itemInfoObj,
|
||||
carlist: carlist,
|
||||
carinfo: carinfoArr,
|
||||
};
|
||||
let km3Config: Km3JudgeInitConfig = {}
|
||||
if (examSubject == '3') {
|
||||
km3Config = {
|
||||
map_point: mapPointArr,
|
||||
map_point_item: mapPointItemArr,
|
||||
//科目三暂时为空
|
||||
iteminfo: [],
|
||||
roads: GetModelData('km3/Roads.txt', context) || "",
|
||||
sharps: GetModelData('km3/Sharps.txt', context) || ""
|
||||
};
|
||||
initInfo.map_point = km3Config.map_point
|
||||
initInfo.map_point_item = km3Config.map_point_item
|
||||
initInfo.iteminfo = km3Config.iteminfo
|
||||
initInfo.roads = km3Config.roads
|
||||
initInfo.sharps = km3Config.sharps
|
||||
}
|
||||
// 获取科目三的评判配置
|
||||
dConsole.info(JudgeTag, '3.获取评判初始化数据完成')
|
||||
return initInfo
|
||||
};
|
||||
}
|
||||
23
entry/src/main/ets/pages/Judge/Typing.ets
Normal file
23
entry/src/main/ets/pages/Judge/Typing.ets
Normal file
@ -0,0 +1,23 @@
|
||||
import { JudgeUI, Project, SYSTEM_PARAM, } from '../../model'
|
||||
import JudgeBusiness from './JudgeBusiness'
|
||||
|
||||
|
||||
export interface GetSysSetResult {
|
||||
totalScore: number
|
||||
wayno: number
|
||||
mockLight: boolean
|
||||
carlist: string
|
||||
passingScore: number
|
||||
examMileage: string
|
||||
projectsObj: Array<Project>
|
||||
projectsCenterObj: Array<String>
|
||||
ddxkKsxmArr: Array<string>
|
||||
singlePlay: boolean
|
||||
systemparmArr: Array<SYSTEM_PARAM>
|
||||
projects: Array<Project>
|
||||
}
|
||||
|
||||
export interface BaseJudge {
|
||||
JudgeInit: (mode: number, carName: string) => Promise<GetSysSetResult>
|
||||
JudgeStart: (callBack: Function, judgeUI: JudgeUI, that: JudgeBusiness) => void
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
import { JudgeTag } from '../../../config/index';
|
||||
import { DefaultJudgeConfigObj, LANE, MarkRule, ProjectInfo, ProjectInfos } from '../../../model/index';
|
||||
import { DefaultJudgeConfigObj, LANE, MarkRule, Project, ProjectInfo, ProjectInfos } from '../../../model/index';
|
||||
import { CutArray } from '../../../utils/Common';
|
||||
import { dConsole } from '../../../utils/LogWorker';
|
||||
import { GetIsEndManualProject, GetIsExitManualProject } from '../utils';
|
||||
@ -13,7 +13,7 @@ export default struct JudgeAndProjectComponent {
|
||||
@Prop sd: string
|
||||
@Prop @Watch("scrollLengthChange") kfArr: MarkRule[]
|
||||
@Prop examSubject: string
|
||||
@Prop projects: ProjectInfo[]
|
||||
@Prop projects: Project[]
|
||||
@Prop artSubject3Projects: string[]
|
||||
@Prop artSubject3ProjectsCodesArr: string[]
|
||||
@Prop projectsObj: ProjectInfos
|
||||
|
||||
@ -6,9 +6,12 @@ import {
|
||||
DefaultJudgeConfigObj,
|
||||
ExtendType,
|
||||
Gps,
|
||||
JudgeSound,
|
||||
LANE,
|
||||
MarkRule,
|
||||
PLCType,
|
||||
ProcessDataEnumType,
|
||||
Project,
|
||||
ProjectInfo,
|
||||
ProjectInfos,
|
||||
ProjectRoads,
|
||||
@ -18,7 +21,11 @@ import {
|
||||
import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common';
|
||||
import dayTs from '../../utils/Date';
|
||||
import { dConsole } from '../../utils/LogWorker';
|
||||
import FileModel from '../judgeSDK/utils/fileModel';
|
||||
import VoiceAnnounce from '../judgeSDK/utils/voiceAnnouncements';
|
||||
import { examJudgeSoundEnd } from './JudgeSDKUtils';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { JudgeConfig, JudgeTag } from '../../config';
|
||||
|
||||
|
||||
// 中心信号转换
|
||||
@ -860,23 +867,23 @@ export const CurrentProjectConversion = (code: number, projectsObj: object): str
|
||||
* @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 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`]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查差分
|
||||
@ -903,4 +910,17 @@ export const DetectingDifferences = async (type: number, avPlayer: VoiceAnnounce
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆模型
|
||||
*/
|
||||
export const GetModelData = (modelName: string, context: common.UIAbilityContext): string => {
|
||||
try {
|
||||
return new FileModel(context).getModelContent(JudgeConfig.modelPath, modelName) || "";
|
||||
} catch (e) {
|
||||
// 可根据实际需求,返回空字符串或抛出异常
|
||||
dConsole.error(JudgeTag, `获取模型数据失败: ${modelName}`, e.message)
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
@ -75,7 +75,7 @@ import {
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker';
|
||||
import { dConsole } from '../../utils/LogWorker';
|
||||
import { testKm2Items, testKm3Items } from '../../mock';
|
||||
|
||||
import { JudgePage } from '../Judge'
|
||||
|
||||
type GetKm3JudgeInitConfig = () => Promise<Km3JudgeInitConfig>
|
||||
type GetgSbbm = (ksxm: number, xmxh: string) => string
|
||||
@ -85,7 +85,7 @@ type GetDqxmStr = (xmdm: number) => string
|
||||
|
||||
export default class Judge {
|
||||
public plcStr: string = ""
|
||||
public judgeUI: JudgeUI
|
||||
public judgeUI: JudgePage
|
||||
//获取科目三的评判初始化配置
|
||||
getKm3JudgeInitConfig: GetKm3JudgeInitConfig = async () => {
|
||||
return {
|
||||
@ -654,7 +654,7 @@ export default class Judge {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(judgeUI: JudgeUI) {
|
||||
constructor(judgeUI: JudgePage) {
|
||||
this.serialIndex = 1;
|
||||
this.judgeUI = judgeUI
|
||||
//语音播放工具
|
||||
@ -894,7 +894,6 @@ export default class Judge {
|
||||
//项目结束
|
||||
case 2: {
|
||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm)
|
||||
dConsole.log(JudgeTag, "项目结束判定", xmdm, project)
|
||||
const xmmcCode = project.projectCodeCenter || "";
|
||||
project.type = (xmjs.xmhg === 0 ? '4' : '3')
|
||||
|
||||
@ -1006,8 +1005,8 @@ export default class Judge {
|
||||
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 xmmcCode: string = Reflect.get(judgeUI.projectsObj, xmdm).projectCodeCenter;
|
||||
const xmmcSingleCode: string = Reflect.get(judgeUI.projectsObj, xmdm).projectCode;
|
||||
const kmItem: KmItem = Reflect.get(this.kmItems, xmmcCode)
|
||||
const xmmcStr = project?.name || "";
|
||||
kmItem.status = 2;
|
||||
@ -1097,11 +1096,9 @@ export default class Judge {
|
||||
|
||||
// 项目结束
|
||||
case 2: {
|
||||
dConsole.log(JudgeTag, "项目结束判定1")
|
||||
const project: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||
const projectIsEnd = project.isEnd;
|
||||
const isStart = await this.checkProjectIsStart(xmdm, 1);
|
||||
dConsole.log(JudgeTag, "项目结束判定2")
|
||||
if (isStart) {
|
||||
//项目结束了就不再生成数据
|
||||
dConsole.info(JudgeTag + ' projectIsEnd =>', projectIsEnd)
|
||||
@ -1116,20 +1113,12 @@ export default class Judge {
|
||||
})
|
||||
}
|
||||
}
|
||||
dConsole.log(JudgeTag, "项目结束判定3")
|
||||
try {
|
||||
const param512: JudgeConfigObj = (Reflect.get(judgeConfigObj, '512') || '').split(',');
|
||||
if (!this.judgeUI.isProjectIn) {
|
||||
this.deductedPopShowTimer = setTimeout(() => {
|
||||
this.judgeUI.isDeductedPopShow = false
|
||||
}, (Reflect.get(param512!, 5) || 0) * 1000)
|
||||
}
|
||||
} catch (e) {
|
||||
dConsole.error(JudgeTag, "项目结束后弹窗定时器异常", e)
|
||||
if (!this.judgeUI.isProjectIn) {
|
||||
this.deductedPopShowTimer = setTimeout(() => {
|
||||
this.judgeUI.isDeductedPopShow = false
|
||||
}, (Reflect.get(param512!, 5) || 0) * 1000)
|
||||
}
|
||||
|
||||
project.isEnd = true;
|
||||
dConsole.log(JudgeTag, "项目结束判定4")
|
||||
// Reflect.set(this.judgeUI.projectsObj, xmdm, project)
|
||||
break;
|
||||
}
|
||||
@ -1186,7 +1175,6 @@ export default class Judge {
|
||||
// })
|
||||
// }, 500)
|
||||
//统计必考项目完成数量
|
||||
dConsole.log(JudgeTag, "项目结束判定统计项目")
|
||||
await this.setCountItems();
|
||||
await checkExamIsEnd()
|
||||
}
|
||||
@ -1640,7 +1628,6 @@ export default class Judge {
|
||||
}
|
||||
// 统计必考项目、所有项目、已考数量
|
||||
setCountItems = async () => {
|
||||
dConsole.log(JudgeTag, "项目结束判定,统计考试项目")
|
||||
const projectsObj: object = this.judgeUI.projectsObj;
|
||||
//必考项目数量 必考项目已考数量
|
||||
let projectNum = 0, endProjectsNum = 0;
|
||||
@ -1736,7 +1723,7 @@ export default class Judge {
|
||||
dConsole.info(JudgeTag, '2.注册日志回调完成')
|
||||
|
||||
let initInfo: JudgeInitObj = isTrajectoryOpen ? JSON.parse(strArr[0]) : await this.getJudgeInitData();
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(initInfo))
|
||||
// await fileLog?.setExamJudgeData(JSON.stringify(initInfo))
|
||||
//相关评判初始化只做一次
|
||||
if (!isJudgeInitBool) {
|
||||
dConsole.log(JudgeTag, "评判初始化参数", initInfo)
|
||||
@ -1780,7 +1767,6 @@ export default class Judge {
|
||||
} else {
|
||||
beginExamInfo = await getJudgeBeginData()
|
||||
}
|
||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(beginExamInfo))
|
||||
if (beginExamInfo) {
|
||||
await examJudgeBeginExam(beginExamInfo);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user