fix: 优化一些错误
This commit is contained in:
parent
d836b58f9a
commit
4319805f45
@ -10,7 +10,6 @@ import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon';
|
|||||||
import { uploadExamMileage } from '../api/judge';
|
import { uploadExamMileage } from '../api/judge';
|
||||||
import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
|
import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
|
||||||
import MsgPopup from './compontents/judge/MsgPopup';
|
import MsgPopup from './compontents/judge/MsgPopup';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CARINFO,
|
CARINFO,
|
||||||
CDSBInfo,
|
CDSBInfo,
|
||||||
@ -18,44 +17,32 @@ import {
|
|||||||
MAPITEMPOINTITEM,
|
MAPITEMPOINTITEM,
|
||||||
MAPPOINT,
|
MAPPOINT,
|
||||||
MarkRule,
|
MarkRule,
|
||||||
Project,
|
Project, SYSTEMPARMARR
|
||||||
ProjectObj,
|
|
||||||
SYSTEMPARMARR
|
|
||||||
} from './judgeSDK/api/judgeSDK.d';
|
} from './judgeSDK/api/judgeSDK.d';
|
||||||
|
|
||||||
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
import { judgeConfig } from './judgeSDK/utils/judgeConfig';
|
||||||
|
|
||||||
import SignDisplayCom from './compontents/signDisplayCom';
|
import SignDisplayCom from './compontents/signDisplayCom';
|
||||||
import {
|
import {
|
||||||
|
AmplifyItem,
|
||||||
CarInfoType,
|
CarInfoType,
|
||||||
CommonType,
|
CDSBInfos, DefaultJudgeConfigObj,
|
||||||
ES_CARINFOType,
|
ES_CARINFOType,
|
||||||
KfdmType,
|
ItemInfos,
|
||||||
MA_CDSBINFOType,
|
JudgeBeginObj,
|
||||||
|
JudgeCallBacData,
|
||||||
|
JudgeInitObj,
|
||||||
|
JudgeUI, MA_CDSBINFOType,
|
||||||
MA_ITEMINFOType,
|
MA_ITEMINFOType,
|
||||||
MA_MAP_POINT_ITEMType,
|
MA_MAP_POINT_ITEMType,
|
||||||
MA_MAP_POINTType,
|
MA_MAP_POINTType, MA_SYSTEMPARMType,
|
||||||
MA_MARKRULEType,
|
|
||||||
MA_SYSTEMPARMType,
|
|
||||||
MASYSSETTableType,
|
|
||||||
RouteParamsType,
|
|
||||||
User,
|
|
||||||
SYSSET,
|
|
||||||
SyssetConfig,
|
|
||||||
ProjectInfo,
|
|
||||||
ProjectInfos,
|
|
||||||
ProjectCenterInfos,
|
|
||||||
JudgeInitObj,
|
|
||||||
JudgeBeginObj,
|
|
||||||
UploadExamMileage,
|
|
||||||
AmplifyItem,
|
|
||||||
ProjectRoads,
|
|
||||||
JudgeCallBacData,
|
|
||||||
JudgeUI,
|
|
||||||
CDSBInfos,
|
|
||||||
ItemInfos,
|
|
||||||
MarkRules,
|
MarkRules,
|
||||||
DefaultJudgeConfigObj
|
MASYSSETTableType, ProjectInfo,
|
||||||
|
ProjectInfos,
|
||||||
|
ProjectRoads,
|
||||||
|
RouteParamsType,
|
||||||
|
SYSSET,
|
||||||
|
SyssetConfig, User
|
||||||
} from '../model';
|
} from '../model';
|
||||||
import { GetSyncData } from '../utils/table/Operation';
|
import { GetSyncData } from '../utils/table/Operation';
|
||||||
import dayTs from '../utils/Date';
|
import dayTs from '../utils/Date';
|
||||||
@ -251,7 +238,6 @@ struct Index {
|
|||||||
async initStudent() {
|
async initStudent() {
|
||||||
const students = await GetSyncData<User>('USER')
|
const students = await GetSyncData<User>('USER')
|
||||||
const stuInfo = students[0];
|
const stuInfo = students[0];
|
||||||
// const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl, xldm } = stuInfo;
|
|
||||||
this.name = stuInfo.xm || '测试考生';
|
this.name = stuInfo.xm || '测试考生';
|
||||||
this.idCard = stuInfo.sfzmhm || '01234567891010';
|
this.idCard = stuInfo.sfzmhm || '01234567891010';
|
||||||
this.lsh = this.singlePlay ? '0000000000000' : stuInfo.lsh;
|
this.lsh = this.singlePlay ? '0000000000000' : stuInfo.lsh;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import libJudgeSdk from "libjudgesdk.so"
|
import libJudgeSdk from 'libjudgesdk.so';
|
||||||
|
import { JudgeInitObj } from '../../../model';
|
||||||
|
|
||||||
// import libJudgeSdk from '@ohos.judgesdk'
|
// import libJudgeSdk from '@ohos.judgesdk'
|
||||||
/**
|
/**
|
||||||
@ -24,7 +25,7 @@ export async function examJudgeVersion(): Promise<string> {
|
|||||||
* @params callBack 日志操作回调
|
* @params callBack 日志操作回调
|
||||||
* @desc 设置评判日志级别和日志回调函数
|
* @desc 设置评判日志级别和日志回调函数
|
||||||
*/
|
*/
|
||||||
export async function examJudgeSetLogCallback(level: number, handleLog: Function): Promise<string> {
|
export async function examJudgeSetLogCallback(level: number, handleLog: Function): Promise<number> {
|
||||||
const temp: number = libJudgeSdk.examJudgeSetLogCallback(level, handleLog);
|
const temp: number = libJudgeSdk.examJudgeSetLogCallback(level, handleLog);
|
||||||
return await handle(temp, 'examJudgeSetLogCallback')
|
return await handle(temp, 'examJudgeSetLogCallback')
|
||||||
}
|
}
|
||||||
@ -33,7 +34,7 @@ export async function examJudgeSetLogCallback(level: number, handleLog: Function
|
|||||||
*
|
*
|
||||||
* @desc评判初始化
|
* @desc评判初始化
|
||||||
*/
|
*/
|
||||||
export async function examJudgeInit(data) {
|
export async function examJudgeInit(data: JudgeInitObj) {
|
||||||
const str = JSON.stringify(data);
|
const str = JSON.stringify(data);
|
||||||
const temp: number = libJudgeSdk.examJudgeInit(str, str.length);
|
const temp: number = libJudgeSdk.examJudgeInit(str, str.length);
|
||||||
return await handle(temp, 'examJudgeInit')
|
return await handle(temp, 'examJudgeInit')
|
||||||
@ -180,11 +181,14 @@ export async function examJudgeSetPerformCallback(fn) {
|
|||||||
interface SoundParam {
|
interface SoundParam {
|
||||||
//项目代码
|
//项目代码
|
||||||
xmdm: number,
|
xmdm: number,
|
||||||
|
|
||||||
//语音码
|
//语音码
|
||||||
code: string,
|
code: string,
|
||||||
|
|
||||||
//语音类型
|
//语音类型
|
||||||
type: 0 | 1,
|
type: 0 | 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function examJudgeSoundEnd(param: SoundParam) {
|
export async function examJudgeSoundEnd(param: SoundParam) {
|
||||||
const temp: number = libJudgeSdk.examJudgeSoundEnd(param.xmdm, param.code, param.type);
|
const temp: number = libJudgeSdk.examJudgeSoundEnd(param.xmdm, param.code, param.type);
|
||||||
return await handle(temp, 'examJudgeSoundEnd')
|
return await handle(temp, 'examJudgeSoundEnd')
|
||||||
@ -202,6 +206,7 @@ interface DistanceParam{
|
|||||||
wd2: number,
|
wd2: number,
|
||||||
h: number
|
h: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function examCalcGpsDistance(param: DistanceParam): Promise<number> {
|
export async function examCalcGpsDistance(param: DistanceParam): Promise<number> {
|
||||||
const temp: number = libJudgeSdk.examCalcGpsDistance(param.jd1, param.wd1, param.jd2, param.wd2, param.h);
|
const temp: number = libJudgeSdk.examCalcGpsDistance(param.jd1, param.wd1, param.jd2, param.wd2, param.h);
|
||||||
return temp
|
return temp
|
||||||
@ -212,7 +217,7 @@ export async function examCalcGpsDistance(param:DistanceParam):Promise<number> {
|
|||||||
* @desc通用处理函数
|
* @desc通用处理函数
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async function handle(temp:number, fnName:string): Promise<string> {
|
async function handle(temp: number, fnName: string): Promise<number> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (temp == 0) {
|
if (temp == 0) {
|
||||||
resolve(temp);
|
resolve(temp);
|
||||||
|
|||||||
@ -2,29 +2,21 @@ import systemTime from '@ohos.systemDateTime';
|
|||||||
import router from '@ohos.router';
|
import router from '@ohos.router';
|
||||||
import util from '@ohos.util';
|
import util from '@ohos.util';
|
||||||
import buffer from '@ohos.buffer';
|
import buffer from '@ohos.buffer';
|
||||||
import { testKm2Items, testKm3Items, testMarkRules } from './dataTest/index';
|
import { testKm2Items, testKm3Items } from './dataTest/index';
|
||||||
import { EXAMDATA, KSJS, Project, SOUND } from './api/judgeSDK';
|
import { KSJS } from './api/judgeSDK';
|
||||||
import VoiceAnnounce from './utils/voiceAnnouncements';
|
import VoiceAnnounce from './utils/voiceAnnouncements';
|
||||||
import FileModel from './utils/fileModel';
|
import FileModel from './utils/fileModel';
|
||||||
import FilePhoto from './utils/filePhoto';
|
import FilePhoto from './utils/filePhoto';
|
||||||
import FileLog from './utils/fileLog';
|
import FileLog from './utils/fileLog';
|
||||||
import JudgeTask from './utils/judgeTask';
|
import JudgeTask from './utils/judgeTask';
|
||||||
import { judgeConfig } from './utils/judgeConfig';
|
import { judgeConfig } from './utils/judgeConfig';
|
||||||
import { KF, LANE } from '../judgeSDK/api/judgeSDK.d';
|
import { LANE } from '../judgeSDK/api/judgeSDK.d';
|
||||||
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getCarStatus,
|
getCarStatus, getCenterProjectStatus, plcStrToJson,
|
||||||
getCarStatusType,
|
|
||||||
getCenterProjectStatus,
|
|
||||||
getDwStatusType,
|
|
||||||
getKmProjectCancelVoice,
|
|
||||||
getKmProjectVoice,
|
|
||||||
getTranslateSignals,
|
|
||||||
plcStrToJson,
|
|
||||||
plcStrToWXJson,
|
plcStrToWXJson,
|
||||||
promptWxCode,
|
promptWxCode
|
||||||
senorToWXDataStr
|
|
||||||
} from './utils/judgeCommon';
|
} from './utils/judgeCommon';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -42,15 +34,44 @@ import {
|
|||||||
examJudgeVersion
|
examJudgeVersion
|
||||||
} from './api/index';
|
} from './api/index';
|
||||||
|
|
||||||
import { writeObjectOut, uploadExamProgressData } from '../../api/judge';
|
import { uploadExamProgressData, writeObjectOut } from '../../api/judge';
|
||||||
import { saveStartRecordVideo,endRecordVideo } from '../../utils/Video';
|
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { Array2Byte, convertGpsCoord2, deepClone, fillZero, string2Bytes } from './utils/Common';
|
import { convertGpsCoord2, deepClone } from './utils/Common';
|
||||||
import { GetCurrentTime, StringToASCII } from '../../utils/Common';
|
import { GetCurrentTime } from '../../utils/Common';
|
||||||
import UsbService from '../../utils/USB';
|
import UsbService from '../../utils/USB';
|
||||||
import FileUtils from '../../utils/FileUtils';
|
import FileUtils from '../../utils/FileUtils';
|
||||||
import { BaseInfoType, CarInfoType, JudgeUI, Km3JudgeInitConfig ,ProjectInfo,Plc,DistanceClass,Ksjs,MarkRule,RegulatoryInterfaceParams,DrvexamType,RecordHandleType,WR,CDSBInfo,ItemInfo,JudgeInitObj,RouteParamsType,ExaminerInfoType,JudgeBeginObj,JudgeKsxm,JudgeKfxm,JudgeSound,JudgeSoundB,JudgeEventKf,JudgeKsjs,JudgeXmjs,JudgeCallBackData,KmItems,KmItem,
|
import {
|
||||||
JudgeConfigObj,User,TKmItem,JudgePerformInfo,JudgeUdpKf} from '../../model';
|
BaseInfoType,
|
||||||
|
CarInfoType,
|
||||||
|
CDSBInfo,
|
||||||
|
DistanceClass,
|
||||||
|
DrvexamType,
|
||||||
|
ExaminerInfoType,
|
||||||
|
ItemInfo,
|
||||||
|
JudgeBeginObj,
|
||||||
|
JudgeCallBackData,
|
||||||
|
JudgeConfigObj,
|
||||||
|
JudgeEventKf,
|
||||||
|
JudgeInitObj,
|
||||||
|
JudgeKfxm,
|
||||||
|
JudgeKsjs,
|
||||||
|
JudgeKsxm,
|
||||||
|
JudgePerformInfo,
|
||||||
|
JudgeSound, JudgeUI,
|
||||||
|
JudgeXmjs,
|
||||||
|
Km3JudgeInitConfig,
|
||||||
|
KmItem,
|
||||||
|
KmItems, MarkRule,
|
||||||
|
Plc,
|
||||||
|
ProjectInfo,
|
||||||
|
RecordHandleType,
|
||||||
|
RegulatoryInterfaceParams,
|
||||||
|
RouteParamsType,
|
||||||
|
TKmItem,
|
||||||
|
User,
|
||||||
|
WR
|
||||||
|
} from '../../model';
|
||||||
|
|
||||||
const judgeTag = 'SURENJUN_JUDGE'
|
const judgeTag = 'SURENJUN_JUDGE'
|
||||||
|
|
||||||
@ -62,19 +83,109 @@ type GetKfStr = (code:string) => MarkRule
|
|||||||
type GetDqxmStr = (xmdm: number) => string
|
type GetDqxmStr = (xmdm: number) => string
|
||||||
|
|
||||||
type TJudgeBeginObj = JudgeBeginObj
|
type TJudgeBeginObj = JudgeBeginObj
|
||||||
|
|
||||||
export default class Judge {
|
export default class Judge {
|
||||||
// 断网数据补传
|
public plcStr: string
|
||||||
uploadDisConnectData = async () => {
|
public judgeUI: JudgeUI
|
||||||
if (!this.isJudgeDisConnect) {
|
//获取科目三的评判初始化配置
|
||||||
return
|
getKm3JudgeInitConfig: GetKm3JudgeInitConfig = async () => {
|
||||||
}
|
return {
|
||||||
const folderPath = this.fileLog.folderPath
|
map_point: this.judgeUI.mapPointArr,
|
||||||
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
|
map_point_item: this.judgeUI.mapPointItemArr,
|
||||||
const examDataArr = examDataStr.split('\n');
|
//科目三暂时为空
|
||||||
for (let examDataStr of examDataArr) {
|
iteminfo: [],
|
||||||
const code = await writeObjectOut(JSON.parse(examDataStr));
|
roads: this.getModelData('km3/Roads.txt'),
|
||||||
|
sharps: this.getModelData('km3/Sharps.txt')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private context: common.UIAbilityContext
|
||||||
|
private fileLog: FileLog
|
||||||
|
//人工扣分
|
||||||
|
public setJudgeMark = async (itemno: string, serial: string, type = 1) => {
|
||||||
|
await examJudgeArtificialMark(Number(itemno), serial, type);
|
||||||
|
console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`)
|
||||||
|
const str = JSON.stringify({
|
||||||
|
method: 'examJudgeArtificialMark',
|
||||||
|
itemno: Number(itemno),
|
||||||
|
serial,
|
||||||
|
type
|
||||||
|
})
|
||||||
|
await this.fileLog.setExamJudgeData(str)
|
||||||
|
console.info(judgeTag, `人工扣分-${itemno}-${serial}`)
|
||||||
|
}
|
||||||
|
//人工操作项目
|
||||||
|
public setJudgeItem = async (itemno: string, type: 1 | 2) => {
|
||||||
|
// const { fileLog } = this;
|
||||||
|
await examJudgeArtificialItem(Number(itemno), type);
|
||||||
|
const str = JSON.stringify({
|
||||||
|
method: 'examJudgeArtificialItem',
|
||||||
|
itemno: Number(itemno),
|
||||||
|
type
|
||||||
|
})
|
||||||
|
await this.fileLog.setExamJudgeData(str)
|
||||||
|
console.info(judgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`)
|
||||||
|
}
|
||||||
|
private filePath: string
|
||||||
|
private totalScore: number
|
||||||
|
private prevJd: number = 0
|
||||||
|
private prevWd: number = 0
|
||||||
|
private dwztNum: number = 0
|
||||||
|
private folderPath: string
|
||||||
|
private modelPath: string
|
||||||
|
private avPlayer: VoiceAnnounce
|
||||||
|
// 处理特殊参数配置
|
||||||
|
handleSEP = async (code: number) => {
|
||||||
|
const judgeConfigObj = this.judgeUI.judgeConfigObj
|
||||||
|
const avPlayer = this.avPlayer
|
||||||
|
switch (code) {
|
||||||
|
//结束考试方式
|
||||||
|
case 306:
|
||||||
|
if (judgeConfigObj[code] == 5) {
|
||||||
|
//靠边停车
|
||||||
|
avPlayer.playAudio(['voice/406001.mp3'])
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private carztStr: string
|
||||||
|
private rmndg: 0 | 1
|
||||||
|
private mndgStr: string | undefined
|
||||||
|
// 模拟灯光
|
||||||
|
setMndg = async (mndgStr: string) => {
|
||||||
|
this.mndgStr = mndgStr
|
||||||
|
}
|
||||||
|
private xmmcStr: string
|
||||||
|
private xmmcCode: string
|
||||||
|
private xmmcSingleCode: string
|
||||||
|
private xmmcEndCode?: string
|
||||||
|
private xmdm: string | number
|
||||||
|
private xmxh: string
|
||||||
|
private fileModel: FileModel
|
||||||
|
private filePhoto: FilePhoto
|
||||||
|
// 过程照片拍照
|
||||||
|
getPhoto = async (empty?: boolean) => {
|
||||||
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
||||||
|
//单机模式返回空照片
|
||||||
|
if (singlePlay) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
|
const photoBase64 = await this.filePhoto.getPhoto();
|
||||||
|
console.info(judgeTag, '拍照完成')
|
||||||
|
return photoBase64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private usbService: UsbService
|
||||||
|
//是否是考试模式
|
||||||
|
private isExam: boolean
|
||||||
|
//考试是否结束了
|
||||||
|
private isExamEnd: boolean
|
||||||
|
// 是否发送udp
|
||||||
|
private isUdpEnd: boolean = false
|
||||||
|
//是否手动结束考试
|
||||||
|
private isManual: boolean
|
||||||
|
//UDP服务序列号
|
||||||
|
private serialIndex: number
|
||||||
|
private fileUtil: FileUtils
|
||||||
//上传无锡所过程数据
|
//上传无锡所过程数据
|
||||||
uploadProgressData = async () => {
|
uploadProgressData = async () => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo = AppStorage.get<CarInfoType>('carInfo')
|
||||||
@ -116,34 +227,7 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
console.info(judgeTag, '过程数据文件上传 end')
|
console.info(judgeTag, '过程数据文件上传 end')
|
||||||
}
|
}
|
||||||
//获取科目三的评判初始化配置
|
private judgeTask: JudgeTask
|
||||||
getKm3JudgeInitConfig:GetKm3JudgeInitConfig = async () => {
|
|
||||||
return {
|
|
||||||
map_point: this.judgeUI.mapPointArr,
|
|
||||||
map_point_item: this.judgeUI.mapPointItemArr,
|
|
||||||
//科目三暂时为空
|
|
||||||
iteminfo: [],
|
|
||||||
roads: this.getModelData('km3/Roads.txt'),
|
|
||||||
sharps: this.getModelData('km3/Sharps.txt')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 处理特殊参数配置
|
|
||||||
handleSEP = async (code: number) => {
|
|
||||||
const judgeConfigObj = this.judgeUI.judgeConfigObj
|
|
||||||
const avPlayer = this.avPlayer
|
|
||||||
switch (code) {
|
|
||||||
//结束考试方式
|
|
||||||
case 306:
|
|
||||||
if (judgeConfigObj[code] == 5) {
|
|
||||||
//靠边停车
|
|
||||||
avPlayer.playAudio(['voice/406001.mp3'])
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public plcStr: string
|
|
||||||
private context: common.UIAbilityContext
|
|
||||||
public judgeUI: JudgeUI
|
|
||||||
// 检测扣分、结束项目时该项目是否开始
|
// 检测扣分、结束项目时该项目是否开始
|
||||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
|
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
|
||||||
if (xmdm == 20) {
|
if (xmdm == 20) {
|
||||||
@ -198,82 +282,6 @@ export default class Judge {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private fileLog: FileLog
|
|
||||||
|
|
||||||
//人工扣分
|
|
||||||
public setJudgeMark = async (itemno:string, serial:string, type = 1) => {
|
|
||||||
await examJudgeArtificialMark(Number(itemno), serial, type);
|
|
||||||
console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`)
|
|
||||||
const str = JSON.stringify({
|
|
||||||
method: 'examJudgeArtificialMark',
|
|
||||||
itemno: Number(itemno),
|
|
||||||
serial,
|
|
||||||
type
|
|
||||||
})
|
|
||||||
await this.fileLog.setExamJudgeData(str)
|
|
||||||
console.info(judgeTag, `人工扣分-${itemno}-${serial}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
//人工操作项目
|
|
||||||
public setJudgeItem = async (itemno: string, type: 1 | 2) => {
|
|
||||||
// const { fileLog } = this;
|
|
||||||
await examJudgeArtificialItem(Number(itemno), type);
|
|
||||||
const str = JSON.stringify({
|
|
||||||
method: 'examJudgeArtificialItem',
|
|
||||||
itemno: Number(itemno),
|
|
||||||
type
|
|
||||||
})
|
|
||||||
await this.fileLog.setExamJudgeData(str)
|
|
||||||
console.info(judgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`)
|
|
||||||
}
|
|
||||||
private filePath: string
|
|
||||||
private totalScore: number
|
|
||||||
private prevJd: number = 0
|
|
||||||
private prevWd: number = 0
|
|
||||||
private dwztNum: number = 0
|
|
||||||
private folderPath: string
|
|
||||||
private modelPath: string
|
|
||||||
private avPlayer: VoiceAnnounce
|
|
||||||
private carztStr: string
|
|
||||||
private rmndg: 0 | 1
|
|
||||||
private mndgStr: string | undefined
|
|
||||||
// 模拟灯光
|
|
||||||
setMndg = async (mndgStr: string) => {
|
|
||||||
this.mndgStr = mndgStr
|
|
||||||
}
|
|
||||||
private xmmcStr: string
|
|
||||||
private xmmcCode: string
|
|
||||||
private xmmcSingleCode: string
|
|
||||||
private xmmcEndCode?: string
|
|
||||||
private xmdm: string | number
|
|
||||||
private xmxh: string
|
|
||||||
private fileModel: FileModel
|
|
||||||
private filePhoto: FilePhoto
|
|
||||||
// 过程照片拍照
|
|
||||||
getPhoto = async (empty?: boolean) => {
|
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
|
||||||
//单机模式返回空照片
|
|
||||||
if (singlePlay) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
const photoBase64 = await this.filePhoto.getPhoto();
|
|
||||||
console.info(judgeTag, '拍照完成')
|
|
||||||
return photoBase64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private usbService: UsbService
|
|
||||||
//是否是考试模式
|
|
||||||
private isExam: boolean
|
|
||||||
//考试是否结束了
|
|
||||||
private isExamEnd: boolean
|
|
||||||
// 是否发送udp
|
|
||||||
private isUdpEnd: boolean = false
|
|
||||||
//是否手动结束考试
|
|
||||||
private isManual: boolean
|
|
||||||
//UDP服务序列号
|
|
||||||
private serialIndex: number
|
|
||||||
private fileUtil: FileUtils
|
|
||||||
private judgeTask: JudgeTask
|
|
||||||
private tempData: Plc
|
private tempData: Plc
|
||||||
//实时计算gps经纬度距离
|
//实时计算gps经纬度距离
|
||||||
handDistance = async () => {
|
handDistance = async () => {
|
||||||
@ -504,13 +512,25 @@ export default class Judge {
|
|||||||
// TODO 定时器缺失
|
// TODO 定时器缺失
|
||||||
// globalThis.judgeTimer = judgeTimer;
|
// globalThis.judgeTimer = judgeTimer;
|
||||||
}
|
}
|
||||||
//当前科目二的考试项目
|
|
||||||
// private currentKm2ItemsObj: any
|
|
||||||
//本地轨迹回放地址
|
//本地轨迹回放地址
|
||||||
private trajectoryPath: string
|
private trajectoryPath: string
|
||||||
|
//当前科目二的考试项目
|
||||||
|
// private currentKm2ItemsObj: any
|
||||||
private isTrajectoryOpen: boolean;
|
private isTrajectoryOpen: boolean;
|
||||||
// 调代理接口是否断网了
|
// 调代理接口是否断网了
|
||||||
private isJudgeDisConnect: boolean;
|
private isJudgeDisConnect: boolean;
|
||||||
|
// 断网数据补传
|
||||||
|
uploadDisConnectData = async () => {
|
||||||
|
if (!this.isJudgeDisConnect) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const folderPath = this.fileLog.folderPath
|
||||||
|
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
|
||||||
|
const examDataArr = examDataStr.split('\n');
|
||||||
|
for (let examDataStr of examDataArr) {
|
||||||
|
const code = await writeObjectOut(JSON.parse(examDataStr));
|
||||||
|
}
|
||||||
|
}
|
||||||
// 项目开始接口同步
|
// 项目开始接口同步
|
||||||
beginProject = async (ksxm: number) => {
|
beginProject = async (ksxm: number) => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
@ -586,7 +606,6 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
private videoData: RecordHandleType
|
private videoData: RecordHandleType
|
||||||
private disConnectNum: number = 0;
|
private disConnectNum: number = 0;
|
||||||
|
|
||||||
//调用监管接口
|
//调用监管接口
|
||||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||||
const temp = await writeObjectOut(data, filePath);
|
const temp = await writeObjectOut(data, filePath);
|
||||||
@ -702,7 +721,9 @@ export default class Judge {
|
|||||||
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => {
|
||||||
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
const cdsb: CDSBInfo = Reflect.get(itemInfoObj, cdsbKey);
|
||||||
const model = this.getModelData(`${examType}/${cdsb.modelKey}.txt`)
|
const model = this.getModelData(`${examType}/${cdsb.modelKey}.txt`)
|
||||||
const temp:ItemInfo = {xmdm:cdsb.xmdm,xmxh:cdsb.xmxh,model}
|
const temp: ItemInfo = {
|
||||||
|
xmdm: cdsb.xmdm, xmxh: cdsb.xmxh, model
|
||||||
|
}
|
||||||
return temp
|
return temp
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -769,7 +790,9 @@ export default class Judge {
|
|||||||
const passingScore = judgeUI.passingScore
|
const passingScore = judgeUI.passingScore
|
||||||
|
|
||||||
const ksxm: JudgeKsxm[] = projects.map(project => {
|
const ksxm: JudgeKsxm[] = projects.map(project => {
|
||||||
const temp:JudgeKsxm = {xmdm: Number(project.projectCode), xmxh: ''}
|
const temp: JudgeKsxm = {
|
||||||
|
xmdm: Number(project.projectCode), xmxh: ''
|
||||||
|
}
|
||||||
return temp
|
return temp
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -779,7 +802,9 @@ export default class Judge {
|
|||||||
})) || [];
|
})) || [];
|
||||||
|
|
||||||
const kfxm: JudgeKfxm[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
const kfxm: JudgeKfxm[] = isDdxk ? (ddxkKfArr?.map(kf => {
|
||||||
return { xmdm:Number(kf.split(',')[0]), kfdm:kf.split(',')[1]} as JudgeKfxm
|
return {
|
||||||
|
xmdm: Number(kf.split(',')[0]), kfdm: kf.split(',')[1]
|
||||||
|
} as JudgeKfxm
|
||||||
})) : []
|
})) : []
|
||||||
|
|
||||||
const beginInfo: JudgeBeginObj = {
|
const beginInfo: JudgeBeginObj = {
|
||||||
@ -947,7 +972,9 @@ export default class Judge {
|
|||||||
//考试结束
|
//考试结束
|
||||||
case 5:
|
case 5:
|
||||||
this.ksjs = ksjs;
|
this.ksjs = ksjs;
|
||||||
await fileLog.setExamJudgeData(JSON.stringify({method: 'examJudgeEndExam'}))
|
await fileLog.setExamJudgeData(JSON.stringify({
|
||||||
|
method: 'examJudgeEndExam'
|
||||||
|
}))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//项目取消
|
//项目取消
|
||||||
@ -1026,7 +1053,8 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更改考试状态
|
// 更改考试状态
|
||||||
goVoiceAnnounce = async (event:number, xmdm:number, kf:JudgeEventKf[], xmjs:JudgeXmjs, ksjs:JudgeKsjs, xmxh:string) => {
|
goVoiceAnnounce =
|
||||||
|
async (event: number, xmdm: number, kf: JudgeEventKf[], xmjs: JudgeXmjs, ksjs: JudgeKsjs, xmxh: string) => {
|
||||||
|
|
||||||
const beginProject = this.beginProject
|
const beginProject = this.beginProject
|
||||||
const pointsDedute = this.pointsDedute
|
const pointsDedute = this.pointsDedute
|
||||||
@ -1078,11 +1106,15 @@ export default class Judge {
|
|||||||
judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目开始-${xmdm}-${project.name}`)
|
console.info(judgeTag, `项目开始-${xmdm}-${project.name}`)
|
||||||
await beginProject(xmdm)
|
await beginProject(xmdm)
|
||||||
}, {isDelay: true})
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
judgeTask.addTask(async () => {
|
judgeTask.addTask(async () => {
|
||||||
console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
|
console.info(judgeTag, `项目-${xmdm}-上传照片 start`)
|
||||||
await uploadProgressPhoto(xmdm)
|
await uploadProgressPhoto(xmdm)
|
||||||
}, {isDelay: true})
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
project.isUpload = true;
|
project.isUpload = true;
|
||||||
Reflect.set(this.judgeUI.projects, xmdm, project)
|
Reflect.set(this.judgeUI.projects, xmdm, project)
|
||||||
}
|
}
|
||||||
@ -1231,7 +1263,12 @@ export default class Judge {
|
|||||||
ksdd: encodeURI(ksdd),
|
ksdd: encodeURI(ksdd),
|
||||||
kfsj: time
|
kfsj: time
|
||||||
}
|
}
|
||||||
const data:RegulatoryInterfaceParams = {xtlb: '17', jkxlh: serialNumber, jkid: '17C53', drvexam}
|
const data: RegulatoryInterfaceParams = {
|
||||||
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C53',
|
||||||
|
drvexam
|
||||||
|
}
|
||||||
console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
|
console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm)
|
||||||
|
|
||||||
const temp = await this.sendWriteObjectOut(data, filePath);
|
const temp = await this.sendWriteObjectOut(data, filePath);
|
||||||
@ -1307,7 +1344,8 @@ export default class Judge {
|
|||||||
if (examSubject == '3') {
|
if (examSubject == '3') {
|
||||||
if (totalScore < passingScore) {
|
if (totalScore < passingScore) {
|
||||||
//考试不合格;考试模式,自动退出;
|
//考试不合格;考试模式,自动退出;
|
||||||
if (param302 == '4' || param302 =='5' || param302 == '7' || param302 == '8') {}
|
if (param302 == '4' || param302 == '5' || param302 == '7' || param302 == '8') {
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//考试合格
|
//考试合格
|
||||||
}
|
}
|
||||||
@ -1372,7 +1410,12 @@ export default class Judge {
|
|||||||
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'),
|
||||||
}
|
}
|
||||||
|
|
||||||
const data:RegulatoryInterfaceParams = {xtlb: '17',jkxlh: serialNumber,jkid: '17C56', drvexam}
|
const data: RegulatoryInterfaceParams = {
|
||||||
|
xtlb: '17',
|
||||||
|
jkxlh: serialNumber,
|
||||||
|
jkid: '17C56',
|
||||||
|
drvexam
|
||||||
|
}
|
||||||
let backTimeOut = setTimeout(() => {
|
let backTimeOut = setTimeout(() => {
|
||||||
router.back()
|
router.back()
|
||||||
}, 90 * 1000)
|
}, 90 * 1000)
|
||||||
@ -1651,7 +1694,6 @@ export default class Judge {
|
|||||||
const sbxh: string = currentCdsb.sbbh || '0000000000'
|
const sbxh: string = currentCdsb.sbbh || '0000000000'
|
||||||
return sbxh
|
return sbxh
|
||||||
}
|
}
|
||||||
|
|
||||||
getSbbm: GetgSbbm = (ksxm, xmxh) => {
|
getSbbm: GetgSbbm = (ksxm, xmxh) => {
|
||||||
const judgeUI = this.judgeUI;
|
const judgeUI = this.judgeUI;
|
||||||
const cdsbInfoObj = judgeUI.cdsbInfoObj;
|
const cdsbInfoObj = judgeUI.cdsbInfoObj;
|
||||||
@ -1675,7 +1717,9 @@ export default class Judge {
|
|||||||
const tempItems: TKmItem[] = (examSubject == '2' ? testKm2Items : testKm3Items).map(item => {
|
const tempItems: TKmItem[] = (examSubject == '2' ? testKm2Items : testKm3Items).map(item => {
|
||||||
const kmItem: KmItem = Reflect.get(this.kmItems, item.code)
|
const kmItem: KmItem = Reflect.get(this.kmItems, item.code)
|
||||||
const status = getCenterProjectStatus(kmItem.status)
|
const status = getCenterProjectStatus(kmItem.status)
|
||||||
const temp:TKmItem = {code: item.code, status}
|
const temp: TKmItem = {
|
||||||
|
code: item.code, status
|
||||||
|
}
|
||||||
return temp
|
return temp
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import media from '@ohos.multimedia.media';
|
import media from '@ohos.multimedia.media';
|
||||||
import Prompt from '@system.prompt';
|
import Prompt from '@system.prompt';
|
||||||
import url from '@ohos.url';
|
|
||||||
import fileuri from "@ohos.file.fileuri";
|
|
||||||
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
|
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
|
import { BusinessError } from '@ohos.base';
|
||||||
|
|
||||||
const TAG = 'VoiceAnnounce'
|
const TAG = 'VoiceAnnounce'
|
||||||
|
|
||||||
@ -33,12 +32,13 @@ export default class VoiceAnnounce {
|
|||||||
|
|
||||||
const tempUrls: Queue[] = urls.map((url, index) => {
|
const tempUrls: Queue[] = urls.map((url, index) => {
|
||||||
const callback: Function | undefined = (index === urls.length - 1) ? callbackFn : undefined
|
const callback: Function | undefined = (index === urls.length - 1) ? callbackFn : undefined
|
||||||
const temp:Queue = {url, callback}
|
const temp: Queue = {
|
||||||
|
url, callback
|
||||||
|
}
|
||||||
return temp
|
return temp
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (shit) {
|
if (shit) {
|
||||||
//队列清空,重新初始化
|
//队列清空,重新初始化
|
||||||
this.isStopped = true;
|
this.isStopped = true;
|
||||||
@ -175,7 +175,8 @@ class AVPlayer {
|
|||||||
|
|
||||||
// 注册avplayer回调函数
|
// 注册avplayer回调函数
|
||||||
setAVPlayerCallback(callBack: Function) {
|
setAVPlayerCallback(callBack: Function) {
|
||||||
this.avPlayer.on('error', (err) => {
|
this.avPlayer.on('error', (err: BusinessError) => {
|
||||||
|
console.log(TAG, '播放器错误', JSON.stringify(err))
|
||||||
this.avPlayer && this.avPlayer.stop()
|
this.avPlayer && this.avPlayer.stop()
|
||||||
this.avPlayer && this.avPlayer.reset()
|
this.avPlayer && this.avPlayer.reset()
|
||||||
this.avPlayer && this.avPlayer.release()
|
this.avPlayer && this.avPlayer.release()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user