大车逻辑优化

This commit is contained in:
lixiao 2025-03-27 17:53:32 +08:00
parent 82d59217aa
commit 6a0ad1e7f1
3 changed files with 58 additions and 35 deletions

View File

@ -329,7 +329,7 @@ struct Index {
projectCode: no2 + '', projectCode: no2 + '',
projectCodeCenter: txt2, projectCodeCenter: txt2,
// 白考夜间行驶非必考 // 白考夜间行驶非必考
isRequired, isRequired: (this.mode === 2 && no2 == 11) ? false : isRequired,
//是否考过了 //是否考过了
isEnd: !(this.mode === 2 && no2 == 13 && this.kssycs != '1'), isEnd: !(this.mode === 2 && no2 == 13 && this.kssycs != '1'),
//项目开始数据是否上传过 //项目开始数据是否上传过
@ -1013,6 +1013,9 @@ struct Index {
case '4': case '4':
return '#FF7566'; return '#FF7566';
break; break;
case '5':
return '#FF7566'
break;
default: default:
return '#E6DECF'; return '#E6DECF';
break; break;
@ -1077,53 +1080,48 @@ struct Index {
// 获取是否能人工进项目 // 获取是否能人工进项目
getIsExitManualProject = (index: number) => { getIsExitManualProject = (index: number) => {
const { const projectCode = this.artSubject3ProjectsCodesArr[index];
judgeConfigObj, if (this.projectsObj[projectCode] === undefined) {
artSubject3ProjectsCodesArr,
projectsObj,
carztStr,
isManualProjectIn,
isProjectIn,
getProjectIsInRoad
} = this;
const projectCode = artSubject3ProjectsCodesArr[index];
if (projectsObj[projectCode] === undefined) {
return false return false
} }
const projectType = projectsObj[projectCode].type; const projectType = this.projectsObj[projectCode].type;
//不允许人工触发的项目列表,以","分隔 //不允许人工触发的项目列表,以","分隔
const unExitManualProjects = judgeConfigObj['332'].split(',') || []; const unExitManualProjects = this.judgeConfigObj['332'].split(',') || [];
//直线行驶中不进其他考试项目(0-否 1-是) //直线行驶中不进其他考试项目(0-否 1-是)
const param348 = judgeConfigObj['348'] || '0', const param348 = this.judgeConfigObj['348'] || '0',
//里程不够允许手工点靠边停车0-否 1-是) //里程不够允许手工点靠边停车0-否 1-是)
param387 = judgeConfigObj['387'] || '0', param387 = this.judgeConfigObj['387'] || '0',
//里程不够不报靠边停车0-否+1-是+2-必考项目未完成且里程不够不报项目) //里程不够不报靠边停车0-否+1-是+2-必考项目未完成且里程不够不报项目)
param319 = judgeConfigObj['319'] || '0', param319 = this.judgeConfigObj['319'] || '0',
//人工项目是否能取消 1:可取消; //人工项目是否能取消 1:可取消;
param340 = judgeConfigObj['340'] || '0', param340 = this.judgeConfigObj['340'] || '0',
//307参数里设置的项目项目已经做过后续不能人工触发 //307参数里设置的项目项目已经做过后续不能人工触发
param307 = (judgeConfigObj['307'] || '').split(','); param307 = (this.judgeConfigObj['307'] || '').split(',');
//非行驶状态(没有速度),人工项目不能触发(按钮灰色) //非行驶状态(没有速度),人工项目不能触发(按钮灰色)
if (carztStr === '停车') { if (this.carztStr === '停车') {
console.log("lixiao getIsExitManualProject 停车", index)
return false return false
} }
//车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能) //车上是否能进行人工操作(0-能1-不能人工评判2-不能人工进项目3-都不能)
if (judgeConfigObj['342'] === '3' || judgeConfigObj['342'] === '2') { if (this.judgeConfigObj['342'] === '3' || this.judgeConfigObj['342'] === '2') {
console.log("lixiao getIsExitManualProject 车上是否能进行人工操作", index)
return false return false
} }
//不允许人工触发的项目列表 //不允许人工触发的项目列表
if (unExitManualProjects.includes(artSubject3ProjectsCodesArr[index])) { if (unExitManualProjects.includes(this.artSubject3ProjectsCodesArr[index])) {
console.log("lixiao getIsExitManualProject 不允许人工触发的项目列表", index)
return false return false
} }
//项目进行中不能人工触发 //项目进行中不能人工触发
if (isProjectIn) { if (this.isProjectIn) {
console.log("lixiao getIsExitManualProject 项目进行中不能人工触发")
if (param340 == 1) { if (param340 == 1) {
if (isManualProjectIn && (projectsObj[projectCode].type == '2')) { if (this.isManualProjectIn && (this.projectsObj[projectCode].type == '2')) {
return true return true
} else { } else {
return false return false
@ -1133,17 +1131,20 @@ struct Index {
} }
//项目路段信息判断 //项目路段信息判断
if (!getProjectIsInRoad(projectCode + '')) { if (!this.getProjectIsInRoad(projectCode + '')) {
console.log("lixiao getIsExitManualProject 项目路段信息判断", index)
return false return false
} }
//@ts-ignore 直线行驶中不进其他考试项目(0-否 1-是) //@ts-ignore 直线行驶中不进其他考试项目(0-否 1-是)
if (param348 == '0' && projectsObj['9']?.type == 2) { if (param348 == '0' && projectsObj['9']?.type == 2) {
console.log("lixiao getIsExitManualProject 直线行驶中不进其他考试项目", index)
return index === 0 ? true : false return index === 0 ? true : false
} }
//项目已经做过,后续不能人工触发 //项目已经做过,后续不能人工触发
if (param307.includes(projectCode) && (projectType == '3' || projectType == '4')) { if (param307.includes(projectCode) && (projectType == '3' || projectType == '4')) {
console.log("lixiao getIsExitManualProject 项目已经做过", index)
return false return false
} }
@ -1153,6 +1154,7 @@ struct Index {
//里程是否达标 && 必考项目是否全完成 //里程是否达标 && 必考项目是否全完成
return jl >= Number(examMileage) && isRequiredProjectsEnd return jl >= Number(examMileage) && isRequiredProjectsEnd
} }
console.log("lixiao getIsExitManualProject true", index)
return true return true
} }
// 判断项目是否在当前路段号 // 判断项目是否在当前路段号

View File

@ -23,6 +23,7 @@ export interface User {
ksy2sfzmhm: string ksy2sfzmhm: string
kslx?: string kslx?: string
jdxx?: string jdxx?: string
czlx?: number
} }
export interface VideoConfig { export interface VideoConfig {

View File

@ -54,6 +54,7 @@ import {
examJudgeVersion examJudgeVersion
} from './api/index'; } from './api/index';
import { getSyncData, upDateTableByArray } from '../../common/service/initable'; import { getSyncData, upDateTableByArray } from '../../common/service/initable';
import { Logger } from '../../common/utils/tempLogger';
const judgeTag = 'SURENJUN_JUDGE' const judgeTag = 'SURENJUN_JUDGE'
@ -824,6 +825,9 @@ export default class Judge {
//项目开始 //项目开始
case 1: case 1:
judgeUI.projectsObj[xmdm].type = '2'; judgeUI.projectsObj[xmdm].type = '2';
if (this.judgeUI.mode === 2) {
judgeUI.projectsObj[xmdm].ykType = '2';
}
if (isManualProjectIn) { if (isManualProjectIn) {
//手动项目是否在进行中 //手动项目是否在进行中
this.judgeUI.isManualProjectIn = true this.judgeUI.isManualProjectIn = true
@ -842,17 +846,22 @@ export default class Judge {
this.xmmcEndCode = xmmcCode this.xmmcEndCode = xmmcCode
this.xmdm = xmdm; this.xmdm = xmdm;
this.xmxh = xmxh; this.xmxh = xmxh;
this.judgeUI.isProjectIn = true if(xmdm != 13) {
this.judgeUI.isProjectIn = true
}
break; break;
//项目结束 //项目结束
case 2: { case 2: {
const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter;
judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3'); judgeUI.projectsObj[xmdm].type = (xmjs.xmhg === 0 ? '4' : '3');
if (this.judgeUI.mode === 2) {
judgeUI.projectsObj[xmdm].ykType = (xmjs.xmhg === 0 ? '4' : '3');
}
//计算项目是否全部结束 //计算项目是否全部结束
this.judgeUI.isProjectIn = (Reflect.ownKeys(judgeUI.projectsObj).filter( this.judgeUI.isProjectIn = Reflect.ownKeys(judgeUI.projectsObj).filter(projectKey => {
projectKey => judgeUI.projectsObj[projectKey].type == '2').length return judgeUI.projectsObj[projectKey].type == '2' || judgeUI.projectsObj[projectKey].ykType == '2'
) > 0; }).length > 0;
if (isManualProjectIn) { if (isManualProjectIn) {
this.judgeUI.isManualProjectIn = false this.judgeUI.isManualProjectIn = false
} }
@ -888,7 +897,11 @@ export default class Judge {
if (kf.xmdm != 20) { if (kf.xmdm != 20) {
const type = judgeUI.projectsObj[kf.xmdm].type; const type = judgeUI.projectsObj[kf.xmdm].type;
judgeUI.projectsObj[kf.xmdm].type = (type == 3 || type == 4) ? '4' : '5'; judgeUI.projectsObj[kf.xmdm].type = (type == 3 || type == 4) ? '4' : '5';
if (judgeUI.mode === 2) {
judgeUI.projectsObj[kf.xmdm].ykType = (type == 3 || type == 4) ? '4' : '5';
}
} }
console.log("lixiao koufen", JSON.stringify(judgeUI.projectsObj[kf.xmdm]));
break; break;
//考车状态 //考车状态
@ -913,6 +926,9 @@ export default class Judge {
const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode); const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode);
// avPlayer.playAudio([`voice/${voiceCode}.mp3`],true) // avPlayer.playAudio([`voice/${voiceCode}.mp3`],true)
this.judgeUI.projectsObj[xmdm].type = '1'; this.judgeUI.projectsObj[xmdm].type = '1';
if (judgeUI.mode === 2) {
this.judgeUI.projectsObj[xmdm].ykType = '1';
}
this.testKmItems[xmmcCode].status = '1'; this.testKmItems[xmmcCode].status = '1';
break; break;
} }
@ -951,6 +967,9 @@ export default class Judge {
this.xmxh = xmxh; this.xmxh = xmxh;
this.xmmcSingleCode = xmmcSingleCode; this.xmmcSingleCode = xmmcSingleCode;
judgeUI.projectsObj[xmdm].type = '2'; judgeUI.projectsObj[xmdm].type = '2';
if (judgeUI.mode === 2) {
judgeUI.projectsObj[xmdm].ykType = '2';
}
} }
break; break;
@ -1465,7 +1484,7 @@ export default class Judge {
const {fourInOneScreen:{ const {fourInOneScreen:{
gpsDigit gpsDigit
}} = judgeConfig }} = judgeConfig
const examType = examSubject == 2 ? 2 : 3 const examType = 3
const {sensor,gps} = tempData; const {sensor,gps} = tempData;
if (tempData.sensor === undefined) { if (tempData.sensor === undefined) {
return return
@ -1652,26 +1671,27 @@ export default class Judge {
// 所有考试项目数量 项目已考项目数量 // 所有考试项目数量 项目已考项目数量
let allProjectNum = 0, allEndProjectsNum = 0; let allProjectNum = 0, allEndProjectsNum = 0;
Reflect.ownKeys(projectsObj).forEach(projectKey => { Reflect.ownKeys(projectsObj).forEach(projectKey => {
const {type,isRequired} = projectsObj[projectKey]; console.info(judgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj[projectKey]));
const {type,isRequired,ykType} = projectsObj[projectKey];
allProjectNum += 1; allProjectNum += 1;
if (type == 3 || type == 4) { if (type == 3 || type == 4 || ykType == 3 || ykType == 4) {
allEndProjectsNum += 1; allEndProjectsNum += 1;
} }
if (isRequired) { if (isRequired) {
projectNum += 1; projectNum += 1;
if (type == 3 || type == 4) { if (type == 3 || type == 4 || ykType == 3 || ykType == 4) {
endProjectsNum += 1; endProjectsNum += 1;
} }
} }
}) })
console.info(judgeTag, '项目状态projectsObj:' + JSON.stringify(projectsObj));
console.info(judgeTag, '所有考试项目数量:' + allProjectNum) console.info(judgeTag, '所有考试项目数量:' + allProjectNum)
console.info(judgeTag, '必考项目数量:' + projectNum) console.info(judgeTag, '必考项目数量:' + projectNum)
console.info(judgeTag, '必考项目已考数量:' + endProjectsNum) console.info(judgeTag, '必考项目已考数量:' + endProjectsNum)
//必考项目除靠边停车是否全部完成 //必考项目除靠边停车是否全部完成
this.judgeUI.isRequiredProjectsEnd = (projectNum - endProjectsNum === 0) this.judgeUI.isRequiredProjectsEnd = (projectNum - endProjectsNum === 0)
console.info(judgeTag, '必考项目除靠边停车是否全部完成:' + this.judgeUI.isRequiredProjectsEnd)
this.judgeUI.isAllProjectsEnd = (allProjectNum - allEndProjectsNum === 0) this.judgeUI.isAllProjectsEnd = (allProjectNum - allEndProjectsNum === 0)
console.info(judgeTag, '所有考试项目是否全部完成:' + this.judgeUI.isAllProjectsEnd)
} }
// 检测差分状态 // 检测差分状态