Merge remote-tracking branch 'origin/api10' into api10

This commit is contained in:
lv 2025-03-28 11:34:26 +08:00
commit 40e7655d87
9 changed files with 289 additions and 183 deletions

View File

@ -121,7 +121,7 @@ export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath
interface UploadExamProgressDataParams {
carId: string
examinationRoomId: string
type: string
type: number
time: string
cardNo: string
examData: string

View File

@ -1,3 +1,4 @@
import common from '@ohos.app.ability.common';
// ------------------------------
// 基础共用类型
// ------------------------------
@ -210,6 +211,12 @@ export interface Plc {
vision: Vision,
radar: Radar,
extend: object
//轨迹回放需要
method?:string
itemno:string
type:1|2
serial:1|2
}
interface Qfsj {
@ -242,6 +249,8 @@ export interface DrvexamType extends BaseExamFields {
ksxtbh?: string;
ksysfzmhm?: string;
Ksy2sfzmhm?: string;
ksdd:string
kslx:string
}
@ -410,9 +419,113 @@ export interface ProjectRoads{
param_12?:string[]
}
interface MAPPOINT{
point_no: number,
gps_e: number,
gps_n: number,
point_no_f: number,
point_type: number,
road_code: string,
gps_e_Location: number
gps_n_Location: number
f_gps_e: number,
f_gps_n: number,
passed: number
}
interface MAPITEMPOINTITEM {
point_no: number,
itemno: number,
itemno1: number,
subname: string
}
export interface JudgeUI{
context: common.UIAbilityContext;
idCard:string
startFullTime:string
mapPointArr: MAPPOINT[]
mapPointItemArr: MAPITEMPOINTITEM[]
judgeConfigObj:object
projectsObj:ProjectInfos
lsh:string
totalScore:number
passingScore:number
serialNumber:string
xldm:string
kslx:string
ksdd:string
isAllProjectsEnd:boolean
examSubject:string
singlePlay:boolean
examMileage:string
jl:number
isDeductedPopShow:boolean
defaultTabIndex:number
isDwztRight:boolean
draw:boolean
sd:string
dw:string
}
export interface Km3JudgeInitConfig{
map_point: MAPPOINT[]
map_point_item: MAPITEMPOINTITEM[]
iteminfo:[]
roads:string
sharps:string
}
export interface Ksjs{
// 累计前进距离
qjjl?: number,
// 累计倒车距离
dcjl?: number
d1?: number
d2?: number
d3?: number
d4?: number
d5?: number
d6?: number
}
export interface CDSBInfo{
kdid?: string
sbbh?: string
sbbm?: string
itemsno?: string
modelKey?: string
xmdm?:string,
xmxh?:string
}
// export const defaultCdsbInfoObj:DefaultJudgeConfigObj = {
//
// }
export interface JudgeUI_I{
context:common.UIAbilityContext
}
/****** 评判开始考试数据*****/
export interface JudgeBeginObj{
exam:0|1
}
export interface DistanceClass{
setTimeData:(n:number)=> void
}
export interface WR {
message?: string
code?: number
keystr?: string
}

View File

@ -50,7 +50,8 @@ import {
UploadExamMileage,
AmplifyItem,
ProjectRoads,
JudgeCallBacData
JudgeCallBacData,
JudgeUI
} from '../model';
import { GetSyncData } from '../utils/table/Operation';
import dayTs from '../utils/Date';
@ -99,8 +100,8 @@ struct Index {
@State projectsObj: ProjectInfos = {}
@State projectsCenterObj: ProjectInfo = {}
@State markRuleListObj: MarkRule = {}
@State cdsbInfoObj: CDSBInfo = {}
@State itemInfoObj: CDSBInfo = {}
@State cdsbInfoObj?: CDSBInfo = {}
@State itemInfoObj?: object = {}
@State timer: number = 0
@State judgeConfig: SyssetConfig[] = []
@State judgeConfigObj: object = defaultJudgeConfigObj
@ -114,7 +115,7 @@ struct Index {
//监管线路代码
@State xldm: string = ''
//监管接口序列号
@State serialNumber: number|string = 0
@State serialNumber: string = ''
@State syssetParam623: boolean = false;
@State syssetParam211: string = '';
@State carType: string = ''
@ -143,7 +144,8 @@ struct Index {
@State currentXmdm: string = ''
// 必考项目除靠边停车是否全部完成
@State isRequiredProjectsEnd: boolean = false;
// @State isAllProjectsEnd: boolean = false;
@State isAllProjectsEnd: boolean = false;
@State draw: boolean = false;
@State lane: LANE = { road: '', num: 0, count: 0 }
//定位差分状态时候正常
@State isDwztRight: boolean = true;
@ -162,7 +164,7 @@ struct Index {
@State carInfo: CarInfoType = {}
@State isErrorMsgEnd: boolean = false
@State disConnectErrorOpen: boolean = false
private context = getContext(this) as common.UIAbilityContext;
public context = getContext(this) as common.UIAbilityContext;
async aboutToDisappear() {
clearInterval(this.mileageTimer)
@ -177,7 +179,6 @@ struct Index {
// this.startHourTime = await getCurrentHourTime()
this.startTime = dayTs().format("HHmmssSSS")
this.startExamTime = time
setInterval(async () => {
this.time = GetCurrentTime();
this.examTime += 1;
@ -308,10 +309,10 @@ struct Index {
const value = decodeURIComponent(sys.v_value)
if (v_no_num >= 10 && v_no_num <= 900) {
const name =
syssetJudgeConfigArr.push({
key: v_no_num, value: value,
name: decodeURI(sys.v_name)
})
syssetJudgeConfigArr.push({
key: v_no_num, value: value,
name: decodeURI(sys.v_name)
})
}
//623 考试中是否可以查看轨迹画面(0-否+1-是)
@ -530,7 +531,9 @@ struct Index {
// 评判相关初始化
async initJudge() {
const judge = new Judge(this);
const test:JudgeUI = this;
const judge = new Judge(test);
// await judge.init<typeof Index>()
await judge.onJudgeFn(async (judgeData:JudgeCallBacData) => {
// const { xmmcStr, carztStr, kfArr } = judgeData;
this.xmmcStr = judgeData.xmmcStr;
@ -1213,7 +1216,7 @@ struct Index {
}
getProjectColor(project: ProjectInfo) {
const type = project.type;
const type = project.type;
switch (type) {
case '1':
return '#E6DECF';
@ -1468,3 +1471,5 @@ struct Index {
}
}
}
export const JudgePage = Index

View File

@ -203,7 +203,7 @@ export async function examCalcGpsDistance(param: {
jd2: number,
wd2: number,
h: number
}) {
}):Promise<number> {
const { jd1, wd1, jd2, wd2, h } = param
const temp = libJudgeSdk.examCalcGpsDistance(jd1, wd1, jd2, wd2, h);
return await temp;

View File

@ -32,6 +32,7 @@ export interface MarkRule {
xmmcStr?: string
desc?: string
xmdm?: string
type?: 0 | 1 | 2
}
export interface KF{

View File

@ -3,11 +3,10 @@ import router from '@ohos.router';
import util from '@ohos.util';
import buffer from '@ohos.buffer';
import { testKm2Items, testKm3Items, testMarkRules } from './dataTest/index';
import { EXAMDATA, KSJS, SOUND } from './api/judgeSDK';
import { EXAMDATA, KSJS, Project, SOUND } from './api/judgeSDK';
import VoiceAnnounce from './utils/voiceAnnouncements';
import FileModel from './utils/fileModel';
import FilePhoto from './utils/filePhoto';
import FileLog from './utils/fileLog';
import JudgeTask from './utils/judgeTask';
import { judgeConfig } from './utils/judgeConfig';
@ -41,45 +40,51 @@ import {
examJudgeSoundEnd,
examJudgeVersion
} from './api/index';
import { writeObjectOut } from '../../api/judge';
import { writeObjectOut, uploadExamProgressData } from '../../api/judge';
import { saveStartRecordVideo } from '../../utils/Video';
import common from '@ohos.app.ability.common';
import { Array2Byte, convertGpsCoord2, deepClone, fillZero, string2Bytes } from './utils/Common';
import { GetCurrentTime, StringToASCII } from '../../utils/Common';
import UsbService from '../../utils/USB';
import FileUtils from '../../utils/FileUtils';
import { BaseInfoType, CarInfoType } from '../../model';
import { BaseInfoType, CarInfoType, JudgeUI, Km3JudgeInitConfig ,ProjectInfo,Plc,DistanceClass,Ksjs,MarkRule,RegulatoryInterfaceParams,DrvexamType,WR} from '../../model';
const judgeTag = 'SURENJUN_JUDGE'
type GetKm3JudgeInitConfig = ()=> Promise<Km3JudgeInitConfig>
export default class Judge {
// 断网数据补传
uploadDisConnectData = async () => {
const { isJudgeDisConnect, fileLog, fileUtil } = this;
if (!isJudgeDisConnect) {
if (!this.isJudgeDisConnect) {
return
}
const folderPath = fileLog.folderPath
const examDataStr = await fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
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 examData = JSON.parse(examDataStr)
const code = await writeObjectOut(examData);
const code = await writeObjectOut(JSON.parse(examDataStr));
}
}
//上传无锡所过程数据
uploadProgressData = async () => {
const carInfo = AppStorage.get<CarInfoType>('carInfo')
const { judgeUI, fileUtil, fileLog } = this;
const { idCard, startFullTime } = judgeUI
const { carId, examinationRoomId } = carInfo
const judgeUI = this.judgeUI
const fileUtil = this.fileUtil
const fileLog = this.fileLog
const carId = carInfo.carId
const examinationRoomId = carInfo.examinationRoomId
const folderPath = fileLog.folderPath
const base64 = new util.Base64();
const time = await GetCurrentTime();
const endTime = await GetCurrentTime(1)
let examDataBase64
const time = GetCurrentTime();
const endTime = GetCurrentTime(1)
let examDataBase64: string = ''
//TODO try catch报错待优化
const examDataStr: string = await fileUtil.readFile(`${folderPath}/wuxi_progress_data.txt`);
const examDataStr: string = await this.fileUtil.readFile(`${folderPath}/wuxi_progress_data.txt`);
try {
let tempBuff = buffer.alloc(examDataStr.length, examDataStr)
let examData: Uint8Array = new Uint8Array(tempBuff.buffer)
@ -91,13 +96,13 @@ export default class Judge {
try {
await uploadExamProgressData({
time,
carId,
examinationRoomId,
examData: examDataBase64,
type: 1,
cardNo: idCard,
examStartTime: startFullTime,
time,
cardNo: judgeUI.idCard,
examData: examDataBase64,
examStartTime: judgeUI.startFullTime,
examEndTime: endTime,
})
} catch (e) {
@ -106,28 +111,20 @@ export default class Judge {
console.info(judgeTag, '过程数据文件上传 end')
}
//获取科目三的评判初始化配置
getKm3JudgeInitConfig = async () => {
const { judgeUI, getModelData } = this;
const { mapPointArr, mapPointItemArr } = judgeUI;
getKm3JudgeInitConfig:GetKm3JudgeInitConfig = async () => {
return {
map_point: mapPointArr,
map_point_item: mapPointItemArr,
map_point: this.judgeUI.mapPointArr,
map_point_item: this.judgeUI.mapPointItemArr,
//科目三暂时为空
iteminfo: [],
roads: getModelData('km3/Roads.txt'),
sharps: getModelData('km3/Sharps.txt')
roads: this.getModelData('km3/Roads.txt'),
sharps: this.getModelData('km3/Sharps.txt')
}
}
// 处理特殊参数配置
handleSEP = async (code: number) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo')
const {
judgeUI:{
judgeConfigObj
}, avPlayer
} = this;
const { examSubject } = carInfo;
const judgeConfigObj = this.judgeUI.judgeConfigObj
const avPlayer = this.avPlayer
switch (code) {
//结束考试方式
case 306:
@ -140,79 +137,87 @@ export default class Judge {
}
public plcStr: string
private context: common.UIAbilityContext
private judgeUI
public judgeUI: JudgeUI
// 检测扣分、结束项目时该项目是否开始
checkProjectIsStart = async (xmdm, currentType: 1 | 2, kf?: KF) => {
checkProjectIsStart = async (xmdm:number, currentType: 1 | 2, kf?: KF) => {
if (xmdm == 20) {
return true
}
const { judgeTask, beginProject, pointsDedute, uploadProgressPhoto, endProject, checkExamIsEnd, totalScore } = this;
const { projectsObj, passingScore:passingGrade } = this.judgeUI
const { isUpload } = projectsObj[xmdm];
const judgeUI= this.judgeUI;
const judgeTask= this.judgeTask;
const projectsObj = this.judgeUI.projectsObj
const currentProject:ProjectInfo = Reflect.get(projectsObj, xmdm)
const isUpload = currentProject.isUpload
//如果项目没有开始
console.info('surenjun isUpload=>', isUpload)
if (!isUpload) {
console.info(judgeTag, '项目补传开始')
//项目开始补传
judgeTask.addTask(async () => {
await beginProject(xmdm)
await this.beginProject(xmdm)
}, {
isDelay: true
})
judgeTask.addTask(async () => {
await uploadProgressPhoto(xmdm)
await this.uploadProgressPhoto(xmdm)
}, {
isDelay: true
})
this.judgeUI.projectsObj[xmdm].isUpload = true;
currentProject.isUpload = true;
Reflect.set(this.judgeUI.projectsObj,xmdm,currentProject)
//扣分补传
if (currentType == 2) {
judgeTask.addTask(async () => {
await pointsDedute(xmdm, kf)
await this.pointsDedute(xmdm, kf)
}, {
isDelay: true
})
}
//扣分补传判断是否合格 不合格补传项目结束
if (currentType == 1 || (currentType == 2 && totalScore < passingGrade)) {
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
judgeTask.addTask(async () => {
await endProject(xmdm)
await this.endProject(xmdm)
}, {
isDelay: true
})
this.judgeUI.projectsObj[xmdm].isEnd = true;
currentProject.isEnd = true;
Reflect.set(this.judgeUI.projectsObj,xmdm,currentProject)
}
judgeTask.addTask(async () => {
checkExamIsEnd()
this.checkExamIsEnd()
})
return false;
} else {
return true
}
}
private fileLog
private fileLog: FileLog
//人工扣分
public setJudgeMark = async (itemno, serial, type = 1) => {
await examJudgeArtificialMark(itemno * 1, serial, type);
public setJudgeMark = async (itemno:string, serial:string, type = 1) => {
await examJudgeArtificialMark(Number(itemno), serial, type);
console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`)
await this.fileLog.setExamJudgeData({
const str = JSON.stringify({
method: 'examJudgeArtificialMark',
itemno: itemno * 1,
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);
await this.fileLog.setExamJudgeData({
const str = JSON.stringify({
method: 'examJudgeArtificialItem',
itemno: Number(itemno),
type
})
await this.fileLog.setExamJudgeData(str)
console.info(judgeTag, `人工评判${type == 1 ? '进入' : '取消'}项目-${itemno}`)
}
private filePath: string
@ -263,23 +268,23 @@ export default class Judge {
private serialIndex: number
private fileUtil: FileUtils
private judgeTask: JudgeTask
private tempData: any
private tempData: Plc
//实时计算gps经纬度距离
handDistance = async () => {
const { jd, wd, hxj, dwzt, jdzt } = this.tempData.gps;
const tJD = convertGpsCoord2(jd)
const tWD = convertGpsCoord2(wd)
const { prevJd, prevWd } = this
if (prevJd && dwzt == 4 && jdzt == 3) {
const dwzt = this.tempData.gps.dwzt;
const jdzt = this.tempData.gps.jdzt;
const tJD = convertGpsCoord2(this.tempData.gps.jd)
const tWD = convertGpsCoord2(this.tempData.gps.wd)
if (this.prevJd && dwzt == 4 && jdzt == 3) {
const distance = await examCalcGpsDistance({
jd1: prevJd,
wd1: prevWd,
jd1: this.prevJd,
wd1: this.prevWd,
jd2: tJD,
wd2: tWD,
h: hxj || 1,
h: (this.tempData.gps.hxj) || 1,
})
const distanceClass = AppStorage.get('distanceClass')
distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1)
const distanceClass = AppStorage.get<DistanceClass>('distanceClass')
distanceClass?.setTimeData( Number(((distance / 100).toFixed(2))) )
}
this.prevJd = tJD;
this.prevWd = tWD;
@ -290,9 +295,18 @@ export default class Judge {
// 校验考试是否结束
checkExamIsEnd =
async (isManual?: boolean) => {
const { judgeUI, avPlayer, isExamEnd, isEndTip, ksjs } = this;
const { isAllProjectsEnd, examSubject, singlePlay, totalScore, judgeConfigObj, passingScore, examMileage, jl } =
judgeUI;
const judgeUI = this.judgeUI
const avPlayer = this.avPlayer
const isExamEnd = this.isExamEnd
const isEndTip = this.isEndTip
const isAllProjectsEnd = judgeUI.isAllProjectsEnd
const examSubject = judgeUI.examSubject
const singlePlay = judgeUI.singlePlay
const totalScore = Number(judgeUI.totalScore)
const judgeConfigObj = judgeUI.judgeConfigObj
const examMileage = Number(judgeUI.examMileage)
const passingScore = Number(judgeUI.examMileage)
const jl = judgeUI.jl
if (isExamEnd) {
return
@ -305,9 +319,9 @@ export default class Judge {
this.isExamEnd = true
this.isManual = true
} else {
const param302 = judgeConfigObj['302'];
const param342 = judgeConfigObj['342'];
const param512 = (judgeConfigObj['512'] || '').split(',');
const param302:number = Reflect.get(judgeConfigObj,'302')
const param342:number = Reflect.get(judgeConfigObj,'342')
const param512:number[] =( Reflect.get(judgeConfigObj,'512') || '').split(',');
//单机模式
if (singlePlay) {
@ -315,8 +329,8 @@ export default class Judge {
if (isAllProjectsEnd && jl >= examMileage) {
//成绩合格
if (totalScore >= passingGrade && !isEndTip) {
if (examSubject == 3 && (param342 == 0 || param342 == 2) &&
(param302 != 6 || param302 != 7 || param302 != 8)) {
if (examSubject == '3' && (param342 == 0 || param342 == 2) &&
(param302 != 6 && param302 != 7 && param302 != 8 )) {
if (param512[7] != 0) {
clearTimeout(this.deductedPopShowTimer)
avPlayer.playAudio(['voice/综合评判.mp3'])
@ -331,7 +345,7 @@ export default class Judge {
return
}
} else {
if (examSubject == 3 && (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8)) {
if (examSubject == '3' && (param302 == 4 || param302 == 5 || param302 == 7 || param302 == 8)) {
await examJudgeEndExam()
this.isExamEnd = true
return
@ -344,7 +358,7 @@ export default class Judge {
//成绩不合格
if (totalScore < passingGrade) {
//科目三不合格报靠边停车
if (examSubject == 3 && param302 == 1) {
if (examSubject == '3' && param302 == 1) {
avPlayer.playAudio([`voice/考试结束.mp3`]);
return
}
@ -355,26 +369,26 @@ export default class Judge {
//成绩合格
if (isAllProjectsEnd && totalScore >= passingGrade && !isEndTip) {
if (examSubject == 2) {
if (examSubject == '2') {
await examJudgeEndExam()
this.isExamEnd = true
return
}
//考试里程判断
if (examSubject == 3 && jl < examMileage) {
if (examSubject == '3' && jl < examMileage) {
return
}
//考试合格自动退出
if (examSubject == 3 && (param302 == 4 || param302 == 7) || param302 == 8) {
if (examSubject == '3' && (param302 == 4 || param302 == 7) || param302 == 8) {
await examJudgeEndExam()
this.isExamEnd = true
return
}
if (examSubject == 3 && (param342 == 0 || param342 == 2) &&
(param302 != 6 || param302 != 7 || param302 != 8)) {
if (examSubject == '3' && (param342 == 0 || param342 == 2) &&
(param302 != 6 && param302 != 7 && param302 != 8)) {
if (param512[7] != 0) {
clearTimeout(this.deductedPopShowTimer)
this.judgeUI.isDeductedPopShow = false
@ -391,75 +405,47 @@ export default class Judge {
}
}
}
private ksjs: {
// 累计前进距离
qjjl: number,
// 累计倒车距离
dcjl: number
d1: number
d2: number
d3: number
d4: number
d5: number
d6: number
}
private kfArr: {
//项目名称
xmmcStr: string,
xmdm: string | number,
//扣分描述
desc: string,
//扣分
score: string
//无锡所扣分代码
markcatalog: string
markserial: string
kfxh: string
type: 0 | 1 | 2
}[]
private km2ItemsStatus: any[]
private ksjs: Ksjs
private kfArr: MarkRule[]
//所有的科目考试项目(大车&小车)
private testKmItems: any
private plcData: any
private plcData: Plc
// 获取plc数据
getPlcData = async (plc: string) => {
const { fileLog, mndgStr, rmndg } = this;
await fileLog.setPlcProgressData(plc)
await this.fileLog.setPlcProgressData(plc)
//plc字符串转化成评判初始化数据
const tempData = await plcStrToJson(plc);
//模拟灯光回放时刻
tempData.sensor.rmndg = rmndg;
tempData.sensor.rmndg = this.rmndg;
//模拟灯灯光灯光项目
tempData.sensor.mndg = mndgStr;
tempData.sensor.mndg = this.mndgStr;
//plc字符串转化成无锡所过程数据
const wuXiDataStr = await plcStrToWXJson(plc)
this.plcData = tempData
await fileLog.setExamJudgeWuxiProgressData(wuXiDataStr)
await this.fileLog.setExamJudgeWuxiProgressData(wuXiDataStr)
this.tempData = tempData
this.plcStr = plc;
this.mndgStr = '';
this.rmndg = 0;
AppStorage.setOrCreate('msgStr', plc)
return tempData
}
// 处理udp plc信号
handleUdp = async (msg) => {
handleUdp = async (msg:string) => {
console.info('plc信号', msg)
// const { fileLog, getPlcData, usbService, isUdpEnd, isExamEnd, judgeUI } = this
const stachArr = msg.split(',')
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
return
}
const plcData = await this.getPlcData(msg);
// 4.过程数据
await this.fileLog.setExamJudgeData(plcData)
await this.fileLog.setExamJudgeData(JSON.stringify(plcData))
//检测到有无锡所设备接入,需要发送特定的数据,供检测
if (this.usbService.isWXUSBDevice) {
const str = await senorToWXDataStr(msg);
this.usbService.sendUSB(str)
}
const param350 = this.judgeUI.judgeConfigObj['350']
// if (this.usbService.isWXUSBDevice) {
// const str = await senorToWXDataStr(msg);
// this.usbService.sendUSB(str)
// }
const param350:number = Reflect.get(this.judgeUI.judgeConfigObj,'350')
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
//TODO 暂时关闭差分检测异常
@ -468,7 +454,6 @@ export default class Judge {
await examJudgeRealExam(plcData)
}
let udpIndex = AppStorage.get<number>('udpIndex');
let [prevJd, preWd] = [0, 0]
if (udpIndex % 5 === 0 && !this.isUdpEnd) {
// TODO UPD缺失
// const judgeUdp = globalThis.judgeUdp
@ -478,7 +463,7 @@ export default class Judge {
AppStorage.setOrCreate('udpIndex', udpIndex++)
}
// 处理轨迹plc信号
handleTrajectoryUdp = async (strArr) => {
handleTrajectoryUdp = async (strArr:string[]) => {
// const { fileLog, setJudgeItem, setJudgeMark, endExam } = this;
let num = 2;
const judgeTimer = setInterval(async () => {
@ -489,7 +474,7 @@ export default class Judge {
this.checkExamIsEnd(true)
return
}
const msg = JSON.parse(strArr[num]);
const msg :Plc= JSON.parse(strArr[num]);
num++
// 4.过程数据
this.tempData = msg
@ -521,43 +506,41 @@ export default class Judge {
// 调代理接口是否断网了
private isJudgeDisConnect: boolean;
// 项目开始接口同步
beginProject = async (ksxm) => {
beginProject = async (ksxm:number) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo');
const { examSubject, plateNo } = carInfo;
const { judgeUI, fileLog, getSbbm, xmxh, filePath } = this;
const { lsh, idCard, serialNumber, projectsObj, ksdd, kslx, xldm } = judgeUI
const time = await GetCurrentTime();
const project = projectsObj[ksxm]
const sbxh = getSbbm(ksxm, xmxh)
const data = {
const judgeUI = this.judgeUI
const time = GetCurrentTime();
const project:ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm)
const sbxh = this.getSbbm(ksxm, this.xmxh)
const drvexam:DrvexamType = {
lsh:judgeUI.lsh,
kskm: carInfo.examSubject,
sfzmhm: judgeUI.idCard,
ksxm: project.projectCodeCenter,
sbxh,
ksxl: judgeUI.xldm,
kchp: encodeURI(carInfo.plateNo),
ksdd: encodeURI(judgeUI.ksdd),
kslx: encodeURI(judgeUI.kslx) || '',
kssj: time
}
const data:RegulatoryInterfaceParams = {
//系统类别 接口序列号 接口标识
xtlb: '17',
jkxlh: serialNumber,
jkxlh: judgeUI.serialNumber,
jkid: '17C52',
drvexam: {
// 考试科目 身份证号码
lsh,
kskm: examSubject,
sfzmhm: idCard,
ksxm: project.projectCodeCenter,
sbxh,
ksxl: xldm,
kchp: encodeURI(plateNo),
// 开始时间
ksdd: encodeURI(ksdd),
kslx: encodeURI(kslx) || '',
kssj: time
}
drvexam
}
const { code } = await this.sendWriteObjectOut(data, filePath)
const temp:WR = await this.sendWriteObjectOut(data, this.filePath)
console.info(judgeTag, '项目开始 end')
if (code === 2300007) {
if (temp.code === 2300007) {
this.isJudgeDisConnect = true;
}
promptWxCode('17C52', code)
promptWxCode('17C52', temp.code)
}
// 项目结束接口同步
endProject = async (ksxm) => {
endProject = async (ksxm:number) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo');
const { examSubject, plateNo, carNo } = carInfo;
const { judgeUI, fileLog, getSbxh, xmxh, getSbbm, filePath } = this;
@ -598,8 +581,9 @@ export default class Judge {
}
private videoData: any
private disConnectNum: number = 0;
//调用监管接口
sendWriteObjectOut = async (data, filePath) => {
sendWriteObjectOut = async (data:RegulatoryInterfaceParams, filePath:string) => {
const temp = await writeObjectOut(data, filePath);
console.log("wzj", JSON.stringify(temp))
//断网&网络超时次数计算
@ -654,7 +638,7 @@ export default class Judge {
console.info(judgeTag, '上传照片 end')
}
constructor(judgeUI) {
constructor(judgeUI: JudgeUI) {
this.serialIndex = 1;
this.judgeUI = judgeUI
//语音播放工具
@ -961,8 +945,7 @@ export default class Judge {
//差分事件
case 11: {
const { type } = nongps
this.checkDwzt(type)
this.checkDwzt(nongps.type)
}
default:
break;
@ -1580,10 +1563,13 @@ export default class Judge {
const sbxh = currentCdsb.sbbh || '0000000000'
return sbxh
}
getSbbm = (ksxm, xmxh) => {
const { judgeUI } = this;
const { cdsbInfoObj, projectsObj, examSubject } = judgeUI;
const project = projectsObj[ksxm]
getSbbm = (ksxm:number, xmxh:string) => {
const judgeUI = this.judgeUI;
const cdsbInfoObj = judgeUI.cdsbInfoObj;
const projectsObj = judgeUI.projectsObj;
const {examSubject = judgeUI.examSubject;
const project = Reflect.get(projectsObj, ksxm);
//科目三不需要
if (examSubject == 3) {
return undefined
@ -1594,7 +1580,7 @@ export default class Judge {
const projectKey = `${ksxm}_${xmxh}`;
const currentCdsb = cdsbInfoObj[projectKey] || {};
const sbxh = currentCdsb.sbbm || '00000000'
return sbxh
// return sbxh
}
// 中心所有项目转换
getTranslateProject = () => {
@ -1788,7 +1774,6 @@ export default class Judge {
this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`, this.context)
}
const { examSubject, projectsObj } = this.judgeUI
// if(examSubject == 3){
// //不做模拟灯光,需要做上车准备 =>(请上车准备)
// if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){

View File

@ -42,9 +42,9 @@ export default class FileLog {
this.plcDataFd = await this.fileUtil.editFile(`${this.folderPath}/plc_data.txt`, JSON.stringify(str), this.plcDataFd);
}
// 过程评判json数据
public setExamJudgeData = async (str: Object) => {
public setExamJudgeData = async (str: string) => {
this.examJudgeDataFd =
await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, JSON.stringify(str), this.examJudgeDataFd);
await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, str, this.examJudgeDataFd);
}
// 过程评判回调数据
public setExamJudgeCallbackData = async (str: string) => {

View File

@ -736,4 +736,6 @@ export const defaultJudgeConfigObj:DefaultJudgeConfigObj = {
param_387: '0',
//监管模式有扣分续考0-否++1-是+把上次未考完的扣分带下来重新考试)
param_432: '1'
}
}

View File

@ -4,7 +4,7 @@ const TAG = 'SURENJUN_JUDGE'
interface DelayConfig{
isDelay: boolean
delayTime: number
delayTime?: number
}
interface QUEUE {