From 8c314ba65e65e379a692733e78de14a65943e7a6 Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Fri, 31 Oct 2025 10:09:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8D=95=E6=9C=BA=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/oh-package-lock.json5 | 2 +- entry/src/main/ets/config/LogEnum.ets | 3 + entry/src/main/ets/model/Judge.ets | 25 ++ .../ets/pages/Judge/BaseJudgeBussines.ets | 115 +------- .../main/ets/pages/Judge/JudgeBusiness.ets | 4 +- .../ets/pages/Judge/LargeJudgeBusiness.ets | 247 +++++++++--------- .../ets/pages/Judge/ProcessDataProcessing.ets | 15 ++ .../ets/pages/Judge/ProcessDataTaskPool.ets | 10 +- .../ets/pages/Judge/SmallJudgeBusiness.ets | 4 +- .../ets/workers/DifferentialCorrection.ets | 11 +- oh-package-lock.json5 | 14 +- 11 files changed, 196 insertions(+), 254 deletions(-) diff --git a/entry/oh-package-lock.json5 b/entry/oh-package-lock.json5 index d5892e3..3f4c904 100644 --- a/entry/oh-package-lock.json5 +++ b/entry/oh-package-lock.json5 @@ -1,5 +1,5 @@ { - "lockfileVersion": 1, + "lockfileVersion": 2, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": {}, "packages": {} diff --git a/entry/src/main/ets/config/LogEnum.ets b/entry/src/main/ets/config/LogEnum.ets index 0407a07..a98d175 100644 --- a/entry/src/main/ets/config/LogEnum.ets +++ b/entry/src/main/ets/config/LogEnum.ets @@ -87,3 +87,6 @@ export const QueueTag = '[Queue]' // 考试过程数据 export const ExamProcessDataTag = '[ExamProcessData]'; +// 远程扣分 +export const RemoteDeductionTag = '[RemoteDeduction]'; + diff --git a/entry/src/main/ets/model/Judge.ets b/entry/src/main/ets/model/Judge.ets index a859ca0..89a6b98 100644 --- a/entry/src/main/ets/model/Judge.ets +++ b/entry/src/main/ets/model/Judge.ets @@ -1,4 +1,29 @@ import common from '@ohos.app.ability.common'; +import { JudgePage } from '../pages/Judge'; +import JudgeBusiness from '../pages/Judge/JudgeBusiness'; + + +export interface GetSysSetResult { + totalScore: number + wayno: number + carlist: string + passingScore: number + examMileage: string + projectsObj: ProjectInfos + projectsCenterObj: ProjectInfos + ddxkKsxmArr: Array + singlePlay: boolean + systemparmArr: Array + projects: Array +} + +export interface BaseJudgeImpl { + getIsUdpEnd: () => boolean + JudgeInit: (judgeUI: JudgePage, that: JudgeBusiness) => Promise + JudgeStart: (callBack: Function, judgeUI: JudgePage, that: JudgeBusiness) => void + Judging: (strData: string, callBack: Function, judgeUI: JudgePage, that: JudgeBusiness) => void + JudgeEnd: (judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) => void +} // ------------------------------ diff --git a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets index 8d81952..b6ee13e 100644 --- a/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets +++ b/entry/src/main/ets/pages/Judge/BaseJudgeBussines.ets @@ -7,10 +7,7 @@ import { KmItem, MarkRule, ProcessDataEnumType, - Project, ProjectInfo, - ProjectInfos, - SYSTEM_PARAM, User, WorkerMessageDataType, WR @@ -39,28 +36,6 @@ import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSigna import dayTs from '../../utils/Date' -export interface GetSysSetResult { - totalScore: number - wayno: number - carlist: string - passingScore: number - examMileage: string - projectsObj: ProjectInfos - projectsCenterObj: ProjectInfos - ddxkKsxmArr: Array - singlePlay: boolean - systemparmArr: Array - projects: Array -} - -export interface BaseJudgeImpl { - getIsUdpEnd: () => boolean - JudgeInit: (judgeUI: JudgePage, that: JudgeBusiness) => Promise - JudgeStart: (callBack: Function, judgeUI: JudgePage, that: JudgeBusiness) => void - Judging: (strData: string, callBack: Function, judgeUI: JudgePage, that: JudgeBusiness) => void - JudgeEnd: (judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) => void -} - export const SetJudgeItem = async (itemno: string, type: 1 | 2) => { await examJudgeArtificialItem(Number(itemno), type); const str = JSON.stringify({ @@ -110,7 +85,9 @@ export class BaseJudge { */ async changeExamStatus(event: number, xmdm: number, xmxh: string, kf: MarkRule[], judgeUI: JudgePage, that: JudgeBusiness) { switch (event) { + // 项目开始 case 1: { + dConsole.log(JudgeTag, "项目开始判定") const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) setTimeout(() => { @@ -121,45 +98,17 @@ export class BaseJudge { }, 200) if (!project.isEnd) { that.xmmcSingleCode = "0"; - // judgeTask.addTask(async () => { - // console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) - // await beginProject(xmdm, xmxh) - // }, { - // isDelay: true - // }) - // judgeTask.addTask(async () => { - // console.info(judgeTag, `项目-${xmdm}-上传照片 start`) - // await uploadProgressPhoto(xmdm) - // }, { - // isDelay: true - // }) ProjectStart(xmdm, xmxh, judgeUI) UploadProgressPhoto(xmdm, that.plcData!, judgeUI) } - // this.judgeUI.projectsObj[xmdm].isUpload = true break; } + // 项目结束 case 2: { dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定1") const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) - // const isStart = await this.checkProjectIsStart(xmdm, 1, judgeUI, that, kf) - - // if (isStart) { - // // 项目结束了就不再生成数据 - // dConsole.info(JudgeTag, ExamProcessDataTag, ' 项目是否结束 =>', project.isEnd) - // if (!project.isEnd) { - // judgeTask.addTask(async () => { - // dConsole.info(JudgeTag, `项目结束-${xmdm}-${project.name}`) - // await endProject(xmdm); - // this.xmmcSingleCode = '0'; - // this.xmmcEndCode = undefined; - // }, { - // isDelay: true - // }) ProjectEnd(xmdm, xmxh, judgeUI) - // } - // } dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定3") try { const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(','); @@ -175,6 +124,7 @@ export class BaseJudge { dConsole.log(JudgeTag, "项目结束判定4") break; } + // 扣分 case 3: { dConsole.log(JudgeTag, "扣分开始") const currentKf = kf[kf.length -1]; @@ -201,6 +151,7 @@ export class BaseJudge { // } break } + // 考试结束 case 5: { dConsole.log(JudgeTag, QueueTag, "考试结束") const singlePlay = AppStorage.get('singlePlay') @@ -479,59 +430,6 @@ export class BaseJudge { } } - /** - * 检测扣分、结束项目时该项目是否开始 - */ - // async checkProjectIsStart(xmdm: number, currentType: 1 | 2, judgeUI: JudgePage, that: JudgeBusiness, kf?: MarkRule[]): Promise { - // if (xmdm == 20) { - // return true - // } - // const currentProject: ProjectInfo = Reflect.get(judgeUI.projectsObj, xmdm) - // - // if (!currentProject.isUpload) { - // dConsole.info(JudgeTag, '项目补传开始') - // // judgeTask.addTask(async () => { - // // await this.beginProject(xmdm) - // // }, { - // // isDelay: true - // // }) - // // judgeTask.addTask(async () => { - // // await this.uploadProgressPhoto(xmdm) - // // }, { - // // isDelay: true - // // }) - // ProjectStart(xmdm, xmxh, judgeUI) - // UploadProgressPhoto(xmdm, that.plcData!, judgeUI) - // currentProject.isUpload = true; - // Reflect.set(judgeUI.projectsObj, xmdm, currentProject) - // if (currentType == 2) { - // //项目结束需要等补传完毕 - // // judgeTask.addTask(async () => { - // // await this.pointsDedute(xmdm, kf!) - // // }, { - // // isDelay: true - // // })\ - // const currentKf = kf[kf.length -1]; - // DeductPoints(Number(currentKf.xmdm), currentKf, that.xmmcEndCode || "", judgeUI) - // } - // //扣分补传判断是否合格 不合格补传项目结束 - // if (currentType == 1 || (currentType == 2 && that.totalScore < judgeUI.passingScore)) { - // // judgeTask.addTask(async () => { - // // await this.endProject(xmdm) - // // }, { - // // isDelay: true - // // }) - // ProjectEnd(xmdm, that.xmxh, judgeUI) - // currentProject.isEnd = true; - // Reflect.set(judgeUI.projectsObj, xmdm, currentProject) - // } - // // judgeTask.addTask(async () => { - // // this.checkExamIsEnd() - // // }) - // return false; - // } - // return true - // } async judgeStart(callBack: Function, judgeUI: JudgePage, that: JudgeBusiness, beginExamInfo: JudgeBeginObj, initInfo: JudgeInitObj) { this.isUdpEnd = false @@ -793,7 +691,6 @@ export class BaseJudge { } async judgeEnd(judgeUI: JudgePage, that: JudgeBusiness, isManual?: boolean) { - dConsole.info(JudgeTag, '收到远程结束考试消息3') const isAllProjectsEnd = judgeUI.isAllProjectsEnd const examSubject = judgeUI.examSubject const singlePlay = judgeUI.singlePlay @@ -807,7 +704,6 @@ export class BaseJudge { return } if (isManual) { - dConsole.log(JudgeTag, '收到远程结束考试消息5') judgeUI.generateExamRecordsDialogController.close() // 考试不合格 await examJudgeEndExam() @@ -817,7 +713,6 @@ export class BaseJudge { const param302: number = Reflect.get(judgeConfigObj, '302') const param342: number = Reflect.get(judgeConfigObj, '342') const param512: number[] = (Reflect.get(judgeConfigObj, '512') || '').split(','); - dConsole.log(JudgeTag, '收到远程结束考试消息4') //单机模式 if (singlePlay) { dConsole.info(JudgeTag + ' 单机模式结束 => ', isAllProjectsEnd) diff --git a/entry/src/main/ets/pages/Judge/JudgeBusiness.ets b/entry/src/main/ets/pages/Judge/JudgeBusiness.ets index 90267d3..d41c32a 100644 --- a/entry/src/main/ets/pages/Judge/JudgeBusiness.ets +++ b/entry/src/main/ets/pages/Judge/JudgeBusiness.ets @@ -1,4 +1,5 @@ import { + BaseJudgeImpl, EnvironmentConfigurationType, JudgeConfigObjKmItems, JudgeKSJS, @@ -21,7 +22,7 @@ import { JudgeTag } from '../../config' import { examJudgeArtificialMark, examJudgeRealExam } from './JudgeSDKUtils' import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' import { PlcStrToJson, PlcStrToWXJson } from './utils' -import { BaseJudgeImpl, SetJudgeItem } from './BaseJudgeBussines' +import { SetJudgeItem } from './BaseJudgeBussines' import { JudgePage } from '../Judge' import dayTs from '../../utils/Date' @@ -131,7 +132,6 @@ export default class JudgeBusiness { // 结束考试 public JudgeEnd(isManual?: boolean) { - dConsole.info(JudgeTag, '收到远程结束考试消息1') this.judgeBusiness.JudgeEnd(this.judgeUI, this, isManual) } diff --git a/entry/src/main/ets/pages/Judge/LargeJudgeBusiness.ets b/entry/src/main/ets/pages/Judge/LargeJudgeBusiness.ets index ef53d82..4f15a8f 100644 --- a/entry/src/main/ets/pages/Judge/LargeJudgeBusiness.ets +++ b/entry/src/main/ets/pages/Judge/LargeJudgeBusiness.ets @@ -1,10 +1,12 @@ import { JudgeConfig, JudgeTag } from '../../config'; import { - BaseInfoType, + BaseJudgeImpl, CAR_INFO, CarInfoType, CDSBInfo, + EnvironmentConfigurationType, ExaminerInfoType, + GetSysSetResult, ItemInfo, ItemInfos, JudgeBeginObj, @@ -21,8 +23,7 @@ import { ProjectInfos, RouteParamsType, SyssetConfig, - SYSTEM_PARAM, - EnvironmentConfigurationType + SYSTEM_PARAM } from '../../model'; import common from '@ohos.app.ability.common'; import { dConsole } from '../../utils/LogWorker'; @@ -30,7 +31,7 @@ import { examJudgeVersion } from './JudgeSDKUtils'; import JudgeBusiness from './JudgeBusiness'; import router from '@ohos.router'; import { GetModelData } from './utils'; -import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines'; +import { BaseJudge } from './BaseJudgeBussines'; import { GetSyncData } from '../../utils/table/Operation'; import promptAction from '@ohos.promptAction'; import { JudgePage } from '../Judge'; @@ -45,126 +46,6 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { return super.getIsUdpEnd() } - private async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) { - const examinerInfo = AppStorage.get('examinerInfo') - const examinerName = examinerInfo?.name || "" - let currentParams: RouteParamsType = router.getParams() as RouteParamsType; - const sczb = currentParams.sczb; - const kfdm = currentParams.kfdm; - const ksxm: JudgeKSXM[] = projects.map(project => { - const temp: JudgeKSXM = { - xmdm: Number(project.projectCode), xmxh: '' - } - return temp - }) - const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => { - const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode) - return Number(currentProject.projectCode) - })) || []; - const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => { - return { - xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1] - } as JudgeKFXM - })) : [] - const beginInfo: JudgeBeginObj = { - kgid: '012', - kgxm: decodeURI(examinerName || ''), - exam: isExam ? 1 : 0, - //是否回放 - replay: 0, - //生成的轨迹文件 - track: '', - xm: name, - sex: 0, - kslsh: lsh, - sfzmhm: idCard, - ksyy: '', - kscx: carType, - kkcs: Number(kssycs) || 2, - sfyk: 0, - ykkkcs: 1, - wayno: Number(wayno), - czlx: 0, - kskssj: await systemDateTime.getCurrentTime(), - passing: Number(passingScore), - ksxm, - //断点续考 - ddxk: isDdxk ? 1 : 0, - ddkssj: ddxkTime || 0, - ykxm, - kfxm, - yklc: 0, - special: [], - sczb: (sczb === undefined || sczb == '0') ? 0 : 1, - sczbkf: kfdm, - dmndg: this.mockLight, - mfxx: this.mode === 5, - zeng: this.mode === 3 || this.mode === 4 - } - dConsole.info(JudgeTag, '5.获取开始考试数据完成') - return beginInfo - }; - - private async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { - const carInfo = AppStorage.get('carInfo'); - - let allitems: ItemInfo[] = []; - if (examSubject == '2' && itemInfoObj) { - const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { - const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); - const model = await GetModelData(`/${cdsb.modelKey}.txt`, context); - const temp: ItemInfo = { - xmdm: cdsb?.xmdm || 0, - xmxh: cdsb?.xmxh || "", - model: model || "" - }; - return temp; - }); - // 等待所有的 Promise 解析完成 - allitems = await Promise.all(promiseItems); - } - - const mark: MarkRule[] = Object.values(markRuleListObj) - const initInfo: JudgeInitObj = { - sdkver: await examJudgeVersion(), - appver: AppStorage.get('EnvironmentConfigurationType')?.version || "", - kskm: Number(carInfo?.examSubject || "2"), - kchp: carInfo?.plateNo || "", - kchm: Number(carInfo?.carId || ""), - kscx: carType, - cxcode: '1', - name: carName, - carmodel: await GetModelData(`/${carType}.txt`, context) || "", - allitems, - iteminfo: [], - systemparm: systemparmArr, - mark, - sysset: judgeConfig, - itemInfoObj, - carlist: carlist, - carinfo: carinfoArr, - }; - let km3Config: Km3JudgeInitConfig = {} - if (examSubject == '3') { - km3Config = { - map_point: mapPointArr, - map_point_item: mapPointItemArr, - //科目三暂时为空 - iteminfo: [], - roads: await GetModelData('/Roads.txt', context) || "", - sharps: await GetModelData('/Sharps.txt', context) || "" - }; - initInfo.map_point = km3Config.map_point - initInfo.map_point_item = km3Config.map_point_item - initInfo.iteminfo = km3Config.iteminfo - initInfo.roads = km3Config.roads - initInfo.sharps = km3Config.sharps - } - // 获取科目三的评判配置 - dConsole.info(JudgeTag, '3.获取评判初始化数据完成') - return initInfo - }; - public async JudgeInit(judgeUI: JudgePage, that: JudgeBusiness): Promise { const systemParams = await GetSyncData('MA_SYSTEMPARM') let currentParams: RouteParamsType = router.getParams() as RouteParamsType; @@ -465,5 +346,123 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { super.judgeEnd(judgeUI, that, isManual) }; + private async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) { + const examinerInfo = AppStorage.get('examinerInfo') + const examinerName = examinerInfo?.name || "" + let currentParams: RouteParamsType = router.getParams() as RouteParamsType; + const sczb = currentParams.sczb; + const kfdm = currentParams.kfdm; + const ksxm: JudgeKSXM[] = projects.map(project => { + const temp: JudgeKSXM = { + xmdm: Number(project.projectCode), xmxh: '' + } + return temp + }) + const ykxm: number[] = (ddxkKsxmArr?.map(projectCenterCode => { + const currentProject: ProjectInfo = Reflect.get(projectsCenterObj, projectCenterCode) + return Number(currentProject.projectCode) + })) || []; + const kfxm: JudgeKFXM[] = isDdxk ? (ddxkKfArr?.map(kf => { + return { + xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1] + } as JudgeKFXM + })) : [] + const beginInfo: JudgeBeginObj = { + kgid: '012', + kgxm: decodeURI(examinerName || ''), + exam: isExam ? 1 : 0, + //是否回放 + replay: 0, + //生成的轨迹文件 + track: '', + xm: name, + sex: 0, + kslsh: lsh, + sfzmhm: idCard, + ksyy: '', + kscx: carType, + kkcs: Number(kssycs) || 2, + sfyk: 0, + ykkkcs: 1, + wayno: Number(wayno), + czlx: 0, + kskssj: await systemDateTime.getCurrentTime(), + passing: Number(passingScore), + ksxm, + //断点续考 + ddxk: isDdxk ? 1 : 0, + ddkssj: ddxkTime || 0, + ykxm, + kfxm, + yklc: 0, + special: [], + sczb: (sczb === undefined || sczb == '0') ? 0 : 1, + sczbkf: kfdm, + dmndg: this.mockLight, + mfxx: this.mode === 5, + zeng: this.mode === 3 || this.mode === 4 + } + dConsole.info(JudgeTag, '5.获取开始考试数据完成') + return beginInfo + }; + private async GetJudgeInitData(context: common.UIAbilityContext, markRuleListObj: object, carType: string, carName: string, systemparmArr: SYSTEM_PARAM[], carinfoArr: CAR_INFO[], examSubject: string, itemInfoObj: ItemInfos, judgeConfig: SyssetConfig[], carlist: string, mapPointArr: MAPPOINT[], mapPointItemArr: MAPITEMPOINTITEM[]) { + const carInfo = AppStorage.get('carInfo'); + + let allitems: ItemInfo[] = []; + if (examSubject == '2' && itemInfoObj) { + const promiseItems = Reflect.ownKeys(itemInfoObj).map(async cdsbKey => { + const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey); + const model = await GetModelData(`/${cdsb.modelKey}.txt`, context); + const temp: ItemInfo = { + xmdm: cdsb?.xmdm || 0, + xmxh: cdsb?.xmxh || "", + model: model || "" + }; + return temp; + }); + // 等待所有的 Promise 解析完成 + allitems = await Promise.all(promiseItems); + } + + const mark: MarkRule[] = Object.values(markRuleListObj) + const initInfo: JudgeInitObj = { + sdkver: await examJudgeVersion(), + appver: AppStorage.get('EnvironmentConfigurationType')?.version || "", + kskm: Number(carInfo?.examSubject || "2"), + kchp: carInfo?.plateNo || "", + kchm: Number(carInfo?.carId || ""), + kscx: carType, + cxcode: '1', + name: carName, + carmodel: await GetModelData(`/${carType}.txt`, context) || "", + allitems, + iteminfo: [], + systemparm: systemparmArr, + mark, + sysset: judgeConfig, + itemInfoObj, + carlist: carlist, + carinfo: carinfoArr, + }; + let km3Config: Km3JudgeInitConfig = {} + if (examSubject == '3') { + km3Config = { + map_point: mapPointArr, + map_point_item: mapPointItemArr, + //科目三暂时为空 + iteminfo: [], + roads: await GetModelData('/Roads.txt', context) || "", + sharps: await GetModelData('/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 + }; } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets b/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets index 4486db3..48ae183 100644 --- a/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets +++ b/entry/src/main/ets/pages/Judge/ProcessDataProcessing.ets @@ -24,6 +24,9 @@ import { ProcessDataTaskPoolInstance } from './ProcessDataTaskPool'; * beginProject 项目开始 */ export const ProjectStart = (ksxm: number, xmxh: string, judgeUI: JudgePage) => { + if (judgeUI.singlePlay) { + return + } const carInfo = AppStorage.get('carInfo')!; const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) const sbxh = getSBXH(ksxm, xmxh, judgeUI.cdsbInfoObj!, judgeUI.projectsObj, carInfo.examSubject!); @@ -55,6 +58,9 @@ export const ProjectStart = (ksxm: number, xmxh: string, judgeUI: JudgePage) => * uploadProgressPhoto 上传过程照片 */ export const UploadProgressPhoto = async (ksxm: number, plcData: PLCType, judgeUI: JudgePage) => { + if (judgeUI.singlePlay) { + return + } const photoBase64 = await GetPhotoBase64(judgeUI.context); const carInfo = AppStorage.get('carInfo'); const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) @@ -85,6 +91,9 @@ export const UploadProgressPhoto = async (ksxm: number, plcData: PLCType, judgeU * pointsDedute 扣分补传 */ export const DeductPoints = (ksxm: number, kf: MarkRule, xmmcEndCode: string, judgeUI: JudgePage) => { + if (judgeUI.singlePlay) { + return + } const carInfo = AppStorage.get('carInfo')!; const examSubject = carInfo.examSubject const lsh = judgeUI.lsh @@ -148,6 +157,9 @@ export const DeductPoints = (ksxm: number, kf: MarkRule, xmmcEndCode: string, ju * endProject 结束项目 */ export const ProjectEnd = (ksxm: number, xmxh: string, judgeUI: JudgePage) => { + if (judgeUI.singlePlay) { + return + } const carInfo = AppStorage.get('carInfo')!; const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm) const sbxh = carInfo.examSubject == '3' ? undefined : getSBXH(ksxm, xmxh, judgeUI.cdsbInfoObj!, judgeUI.projectsObj!, carInfo.examSubject!); @@ -181,6 +193,9 @@ export const ProjectEnd = (ksxm: number, xmxh: string, judgeUI: JudgePage) => { * @returns */ export const TheExamIsOver = async (judgeUI: JudgePage, that: JudgeBusiness, callback: ProgressCallback) => { + if (judgeUI.singlePlay) { + return + } const carInfo: CarInfoType = AppStorage.get("carInfo")! const photoBase64 = await GetPhotoBase64(judgeUI.context); const ksjs = that.ksjs! diff --git a/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets b/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets index 8cc8f3e..48c75a3 100644 --- a/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets +++ b/entry/src/main/ets/pages/Judge/ProcessDataTaskPool.ets @@ -101,7 +101,7 @@ export class ProcessDataTaskPool { jkid: taskData.jkid, drvexam: drvexam, }; - + dConsole.writeProcessData(ProcessDataEnumType.WuxiExam, JSON.stringify(obj)); await this.processSingleTaskWithRetries(taskData, callback); @@ -215,13 +215,9 @@ export const ProcessDataTaskPoolInstance = new ProcessDataTaskPool(); @Concurrent export async function uploadWorkerTask(data: RegulatoryInterfaceParams): Promise { - let singlePlay: boolean = false; let isJGNew = false; try { - const sendProcessData = async (data: RegulatoryInterfaceParams, singlePlay: boolean, isJGNew: boolean): Promise => { - if (singlePlay) { - return { code: "1" } - } + const sendProcessData = async (data: RegulatoryInterfaceParams, isJGNew: boolean): Promise => { if (isJGNew) { // 调用新监管 } @@ -241,7 +237,7 @@ export async function uploadWorkerTask(data: RegulatoryInterfaceParams): Promise xml: true }) as WR } - const response = await sendProcessData(data, singlePlay, isJGNew); + const response = await sendProcessData(data, isJGNew); return response; } catch (err) { const error = err as Error; diff --git a/entry/src/main/ets/pages/Judge/SmallJudgeBusiness.ets b/entry/src/main/ets/pages/Judge/SmallJudgeBusiness.ets index 0b8da64..a911dbc 100644 --- a/entry/src/main/ets/pages/Judge/SmallJudgeBusiness.ets +++ b/entry/src/main/ets/pages/Judge/SmallJudgeBusiness.ets @@ -1,10 +1,12 @@ import { JudgeConfig, JudgeTag } from '../../config'; import { + BaseJudgeImpl, CAR_INFO, CarInfoType, CDSBInfo, EnvironmentConfigurationType, ExaminerInfoType, + GetSysSetResult, ItemInfo, ItemInfos, JudgeBeginObj, @@ -28,7 +30,7 @@ import { examJudgeVersion } from './JudgeSDKUtils'; import JudgeBusiness from './JudgeBusiness'; import router from '@ohos.router'; import { GetModelData } from './utils'; -import { BaseJudge, BaseJudgeImpl, GetSysSetResult } from './BaseJudgeBussines'; +import { BaseJudge } from './BaseJudgeBussines'; import { GetSyncData } from '../../utils/table/Operation'; import promptAction from '@ohos.promptAction'; import { JudgePage } from '../Judge'; diff --git a/entry/src/main/ets/workers/DifferentialCorrection.ets b/entry/src/main/ets/workers/DifferentialCorrection.ets index 1636201..90a8b69 100644 --- a/entry/src/main/ets/workers/DifferentialCorrection.ets +++ b/entry/src/main/ets/workers/DifferentialCorrection.ets @@ -1,6 +1,6 @@ // 处理worker线程的消息tcp拿差分改正数,udp给后置机 import worker, { ErrorEvent, MessageEvents, ThreadWorkerGlobalScope } from '@ohos.worker'; -import { SerialPortTag, WorkerTag } from '../config'; +import { RemoteDeductionTag, SerialPortTag, WorkerTag } from '../config'; import { CenterCallBackMsgType, CenterData, @@ -176,24 +176,27 @@ function getDataFn(config: EnvironmentConfigurationType) { } // 中心UDP回执消息 CenterUDPBusinessInstance.onMsg((data: CenterCallBackMsgType) => { - // TODO - // 需要观察 checkLsh() switch (Number(data.id)) { case 32: + // 远程扣分和停考指令 signNum = data.body![1] if (Number(data.body![0]) === 5) { + console.log(RemoteDeductionTag, `接收到平台扣分请求,请求指令为:${data.body[1]}`) kfDirective = data.body![1] JudgeUdpBusinessInstance.askKf(data.body![1], udpLsh) } else if (Number(data.body![0]) === 6) { + console.log(RemoteDeductionTag, `接收到平台停考指令,请求指令为:${data.body[1]}`) JudgeUdpBusinessInstance.askStopExam(data.body![1], udpLsh) } else if (Number(data.body![0]) === 11) { + console.log(RemoteDeductionTag, '远程开始考试指令下发') workerPort.postMessage( JSON.stringify({ type: WorkerBackMessageType.RemoteStartExam } as WorkerBackMessage) ) } else if (Number(data.body![0]) === 12) { + console.log(RemoteDeductionTag, '远程结束考试指令下发') workerPort.postMessage( JSON.stringify({ type: WorkerBackMessageType.RemoteEndExam @@ -204,6 +207,7 @@ function getDataFn(config: EnvironmentConfigurationType) { } break case 36: + // 远程扣分内容 workerPort.postMessage( JSON.stringify({ type: WorkerBackMessageType.RemoteKf, @@ -212,6 +216,7 @@ function getDataFn(config: EnvironmentConfigurationType) { ) break case 39: { + // 远程停考确认 let lsh = data.body.map(byte => String.fromCharCode(byte)).join("") if (lsh === JudgeUdpBusinessInstance.getLsh()) { workerPort.postMessage( diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index f76874c..d61f840 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -1,18 +1,20 @@ { - "lockfileVersion": 1, + "lockfileVersion": 2, "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "specifiers": { "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" }, "packages": { - "@ohos/crypto-js@2.0.3": { - "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", - "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==" - }, "@ohos/hypium@1.0.19": { "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", - "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==" + "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", + "registryType": "ohpm" + }, + "@ohos/crypto-js@2.0.3": { + "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", + "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", + "registryType": "ohpm" } } } \ No newline at end of file