fix: 优化拍照逻辑
This commit is contained in:
parent
3938e0761f
commit
829cb9e576
@ -4,7 +4,7 @@ import window from '@ohos.window';
|
|||||||
import { GlobalConfig } from '../config/global';
|
import { GlobalConfig } from '../config/global';
|
||||||
import Want from '@ohos.app.ability.Want';
|
import Want from '@ohos.app.ability.Want';
|
||||||
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
|
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
|
||||||
import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoType } from '../model';
|
import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoType, VideoConfig } from '../model';
|
||||||
import DB from '../utils/DbSql';
|
import DB from '../utils/DbSql';
|
||||||
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
|
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
|
||||||
import { InitTable } from '../utils/table/Operation';
|
import { InitTable } from '../utils/table/Operation';
|
||||||
@ -20,7 +20,7 @@ export default class EntryAbility extends UIAbility {
|
|||||||
await DB.init(this.context)
|
await DB.init(this.context)
|
||||||
try {
|
try {
|
||||||
let fileUtil = new FileUtils(this.context)
|
let fileUtil = new FileUtils(this.context)
|
||||||
// 一些地址配置
|
// 读取系统设置参数
|
||||||
const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt');
|
const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt');
|
||||||
if (data !== '' && data !== undefined) {
|
if (data !== '' && data !== undefined) {
|
||||||
const result: EnvironmentConfigurationType = JSON.parse(data)
|
const result: EnvironmentConfigurationType = JSON.parse(data)
|
||||||
@ -32,6 +32,12 @@ export default class EntryAbility extends UIAbility {
|
|||||||
const host = `http://${result.centerIp}:${result.centerPort}`
|
const host = `http://${result.centerIp}:${result.centerPort}`
|
||||||
AppStorage.setOrCreate<string>("host", host)
|
AppStorage.setOrCreate<string>("host", host)
|
||||||
}
|
}
|
||||||
|
// 读取视频配置
|
||||||
|
const videoData = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
|
||||||
|
if (videoData !== '' && videoData !== undefined) {
|
||||||
|
const videoConfig: VideoConfig = JSON.parse(videoData)
|
||||||
|
AppStorage.setOrCreate<VideoConfig>("VideoConfig", videoConfig)
|
||||||
|
}
|
||||||
await InitTable()
|
await InitTable()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(EntryTag, 'sql first error', e)
|
console.error(EntryTag, 'sql first error', e)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ 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 { JudgeConfig, JudgeTag } from '../config';
|
import { JudgeConfig, JudgeTag } from '../config';
|
||||||
|
import JudgeAndProjectComponent from './Judge/components/JudgeAndProject';
|
||||||
import {
|
import {
|
||||||
AmplifyItem,
|
AmplifyItem,
|
||||||
CARINFO,
|
CARINFO,
|
||||||
@ -30,6 +30,8 @@ import {
|
|||||||
MarkRule,
|
MarkRule,
|
||||||
MarkRules,
|
MarkRules,
|
||||||
MASYSSETTableType,
|
MASYSSETTableType,
|
||||||
|
PerLane,
|
||||||
|
ProcessDataEnumType,
|
||||||
Project,
|
Project,
|
||||||
ProjectInfo,
|
ProjectInfo,
|
||||||
ProjectInfos,
|
ProjectInfos,
|
||||||
@ -37,23 +39,20 @@ import {
|
|||||||
SYSSET,
|
SYSSET,
|
||||||
SyssetConfig,
|
SyssetConfig,
|
||||||
SYSTEMPARMARR,
|
SYSTEMPARMARR,
|
||||||
User,
|
User
|
||||||
ProcessDataEnumType,
|
|
||||||
PerLane
|
|
||||||
} 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';
|
||||||
import { GetCurrentTime } from '../utils/Common';
|
import { GetCurrentTime } from '../utils/Common';
|
||||||
import FileUtils from '../utils/FileUtils';
|
import FileUtils from '../utils/FileUtils';
|
||||||
import SignalTrajectoryDialog from './Judge/SignalTrajectoryDialog';
|
import SignalTrajectoryDialog from './Judge/components/SignalTrajectoryDialog';
|
||||||
import { DefaultJudgeConfigData, InitialPerLane, ProcessDataMock } from '../mock';
|
import { DefaultJudgeConfigData, InitialPerLane } from '../mock';
|
||||||
import { dConsole } from '../utils/LogWorker';
|
import { dConsole } from '../utils/LogWorker';
|
||||||
import ConfirmDialog from './compontents/ConfirmDialog';
|
import ConfirmDialog from './compontents/ConfirmDialog';
|
||||||
import CarLoadingDialog from './compontents/CarLoading';
|
import CarLoadingDialog from './compontents/CarLoading';
|
||||||
import HeaderComponent from './compontents/Header';
|
import HeaderComponent from './compontents/Header';
|
||||||
import MessageComponent from './Judge/Message';
|
import MessageComponent from './Judge/components/Message';
|
||||||
import OperatingAreaComponent from './Judge/OperatingArea';
|
import OperatingAreaComponent from './Judge/components/OperatingArea';
|
||||||
import JudgeAndProjectComponent from './Judge/JudgeAndProject';
|
|
||||||
import { GetIsExitManualProject } from './Judge/utils';
|
import { GetIsExitManualProject } from './Judge/utils';
|
||||||
import { InitMapPoint, InitMapPointItem } from './Judge/TableUtils';
|
import { InitMapPoint, InitMapPointItem } from './Judge/TableUtils';
|
||||||
|
|
||||||
@ -148,9 +147,6 @@ struct JudgePage {
|
|||||||
@State isErrorMsgEnd: boolean = false
|
@State isErrorMsgEnd: boolean = false
|
||||||
@State disConnectErrorOpen: boolean = false
|
@State disConnectErrorOpen: boolean = false
|
||||||
@State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane
|
@State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane
|
||||||
laneSignalChange(){
|
|
||||||
dConsole.log("车道信号变化1",this.laneSignal)
|
|
||||||
}
|
|
||||||
public context = getContext(this) as common.UIAbilityContext;
|
public context = getContext(this) as common.UIAbilityContext;
|
||||||
// 信号查看弹窗
|
// 信号查看弹窗
|
||||||
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
|
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
|
||||||
@ -201,6 +197,10 @@ struct JudgePage {
|
|||||||
customStyle: true
|
customStyle: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
laneSignalChange() {
|
||||||
|
dConsole.log("车道信号变化1", this.laneSignal)
|
||||||
|
}
|
||||||
|
|
||||||
async aboutToDisappear() {
|
async aboutToDisappear() {
|
||||||
this.generateExamRecordsDialogController.close()
|
this.generateExamRecordsDialogController.close()
|
||||||
clearInterval(this.mileageTimer)
|
clearInterval(this.mileageTimer)
|
||||||
@ -250,7 +250,7 @@ struct JudgePage {
|
|||||||
|
|
||||||
//是否开启轨迹回放模式
|
//是否开启轨迹回放模式
|
||||||
if (JudgeConfig.isTrajectoryOpen) {
|
if (JudgeConfig.isTrajectoryOpen) {
|
||||||
this.initTrajectoryParam(JudgeConfig.trajectoryPath)
|
this.initTrajectoryParam()
|
||||||
} else {
|
} else {
|
||||||
await this.initSystemParam()
|
await this.initSystemParam()
|
||||||
await this.initMarkRules();
|
await this.initMarkRules();
|
||||||
@ -638,11 +638,10 @@ struct JudgePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化本地systemparam表、markrule表
|
// 初始化本地systemparam表、markrule表
|
||||||
async initTrajectoryParam(trajectoryPath: string) {
|
async initTrajectoryParam() {
|
||||||
const isTrajectoryOpen = JudgeConfig.isTrajectoryOpen
|
|
||||||
//轨迹回放读取 systemparam表、markrule表
|
//轨迹回放读取 systemparam表、markrule表
|
||||||
const fileUtil = new FileUtils(this.context);
|
const fileUtil = new FileUtils(this.context);
|
||||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
const folderPath = await fileUtil.initFolder(JudgeConfig.trajectoryPath);
|
||||||
const str = await fileUtil.readFile(folderPath);
|
const str = await fileUtil.readFile(folderPath);
|
||||||
const strArr = str.split('\n');
|
const strArr = str.split('\n');
|
||||||
const initData = strArr[0]
|
const initData = strArr[0]
|
||||||
@ -652,7 +651,7 @@ struct JudgePage {
|
|||||||
const beginDataObj: JudgeBeginObj = JSON.parse(beginData)
|
const beginDataObj: JudgeBeginObj = JSON.parse(beginData)
|
||||||
|
|
||||||
const examSubject = this.carInfo.examSubject;
|
const examSubject = this.carInfo.examSubject;
|
||||||
this.examSubject = (isTrajectoryOpen ? (initDataObj.kskm) : examSubject) + '';
|
this.examSubject = (JudgeConfig.isTrajectoryOpen ? (initDataObj.kskm) : examSubject) + '';
|
||||||
this.carInfo.examSubject = this.examSubject
|
this.carInfo.examSubject = this.examSubject
|
||||||
this.singlePlay = beginDataObj.exam == 0;
|
this.singlePlay = beginDataObj.exam == 0;
|
||||||
this.carName = initDataObj.name;
|
this.carName = initDataObj.name;
|
||||||
@ -789,8 +788,7 @@ struct JudgePage {
|
|||||||
confirmMark: async (item: string, serial: string) => {
|
confirmMark: async (item: string, serial: string) => {
|
||||||
clearTimeout(this.popTimer)
|
clearTimeout(this.popTimer)
|
||||||
this.popTimer = setTimeout(async () => {
|
this.popTimer = setTimeout(async () => {
|
||||||
const judge = this.judge
|
await this.judge.setJudgeMark(item, serial);
|
||||||
await judge.setJudgeMark(item, serial);
|
|
||||||
this.isDeductedPopShow = false
|
this.isDeductedPopShow = false
|
||||||
this.popTimer = null;
|
this.popTimer = null;
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -806,8 +804,7 @@ struct JudgePage {
|
|||||||
confirmAmplify: async (amplify: AmplifyItem) => {
|
confirmAmplify: async (amplify: AmplifyItem) => {
|
||||||
clearTimeout(this.popTimer)
|
clearTimeout(this.popTimer)
|
||||||
this.popTimer = setTimeout(async () => {
|
this.popTimer = setTimeout(async () => {
|
||||||
const judge = this.judge
|
await this.judge.setJudgeItem(amplify.projectCode, 1);
|
||||||
await judge.setJudgeItem(amplify.projectCode, 1);
|
|
||||||
this.isAmplifyPopShow = false
|
this.isAmplifyPopShow = false
|
||||||
this.popTimer = null;
|
this.popTimer = null;
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -856,7 +853,6 @@ struct JudgePage {
|
|||||||
const isManualProjectIn = this.isManualProjectIn;
|
const isManualProjectIn = this.isManualProjectIn;
|
||||||
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
|
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
|
||||||
const projectsObj = this.projectsObj;
|
const projectsObj = this.projectsObj;
|
||||||
|
|
||||||
const projectCode = artSubject3ProjectsCodesArr[index]
|
const projectCode = artSubject3ProjectsCodesArr[index]
|
||||||
let sideParkingStatus = GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane)
|
let sideParkingStatus = GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane)
|
||||||
if (index === 5) {
|
if (index === 5) {
|
||||||
@ -888,8 +884,7 @@ struct JudgePage {
|
|||||||
this.amplifiedImgIndex = index;
|
this.amplifiedImgIndex = index;
|
||||||
this.isAmplifyPopShow = true
|
this.isAmplifyPopShow = true
|
||||||
} else {
|
} else {
|
||||||
const judge = this.judge
|
await this.judge.setJudgeItem(projectCode, 1);
|
||||||
await judge.setJudgeItem(projectCode, 1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (index === 5) {
|
if (index === 5) {
|
||||||
|
|||||||
@ -2,13 +2,6 @@ import libJudgeSdk from '@ohos.judgesdk';
|
|||||||
import { DistanceParam, JudgeBeginObj, JudgeInitObj, PLCType } from '../../model';
|
import { DistanceParam, JudgeBeginObj, JudgeInitObj, PLCType } from '../../model';
|
||||||
import { dConsole } from '../../utils/LogWorker';
|
import { dConsole } from '../../utils/LogWorker';
|
||||||
|
|
||||||
/**
|
|
||||||
* 苏仁君
|
|
||||||
* @date 2023/04/10
|
|
||||||
* @desc 调用c++评判库
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @desc 获取版本信息
|
* @desc 获取版本信息
|
||||||
@ -122,12 +115,7 @@ export async function examJudgeBeginExam(data: JudgeBeginObj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* @params level:日志等级,infoStr:日志信息,len:数据长度
|
|
||||||
* @desc处理日志文件
|
|
||||||
*/
|
|
||||||
// export function handleLog(level, infoStr, len) {
|
|
||||||
// //TODO
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @desc结束考试
|
* @desc结束考试
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { JudgeTag } from '../../config';
|
import { JudgeTag } from '../../../config/index';
|
||||||
import { DefaultJudgeConfigObj, LANE, MarkRule, ProjectInfo, ProjectInfos } from '../../model';
|
import { DefaultJudgeConfigObj, LANE, MarkRule, ProjectInfo, ProjectInfos } from '../../../model/index';
|
||||||
import { CutArray } from '../../utils/Common';
|
import { CutArray } from '../../../utils/Common';
|
||||||
import { dConsole } from '../../utils/LogWorker';
|
import { dConsole } from '../../../utils/LogWorker';
|
||||||
import { GetIsEndManualProject, GetIsExitManualProject } from './utils';
|
import { GetIsEndManualProject, GetIsExitManualProject } from '../utils';
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default struct JudgeAndProjectComponent {
|
export default struct JudgeAndProjectComponent {
|
||||||
@ -190,7 +190,7 @@ export default struct JudgeAndProjectComponent {
|
|||||||
ListItem() {
|
ListItem() {
|
||||||
Text(project.name) {
|
Text(project.name) {
|
||||||
}
|
}
|
||||||
.fontColor(this.getProjectColor(Reflect.get(this.projectsObj,project.projectCode)))
|
.fontColor(this.getProjectColor(Reflect.get(this.projectsObj, project.projectCode)))
|
||||||
.margin({ bottom: 2 })
|
.margin({ bottom: 2 })
|
||||||
.fontSize(24)
|
.fontSize(24)
|
||||||
}.margin({ bottom: 2 })
|
}.margin({ bottom: 2 })
|
||||||
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 科目三手动扣分确认对话框
|
||||||
|
*/
|
||||||
@CustomDialog
|
@CustomDialog
|
||||||
export default struct ManualConfirmationOfSubjectThreeProjectsDialog {
|
export default struct ManualConfirmationOfSubjectThreeProjectsDialog {
|
||||||
private controller?: CustomDialogController
|
private controller?: CustomDialogController
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { DefaultJudgeConfigObj } from '../../model'
|
import { DefaultJudgeConfigObj } from '../../../model/index'
|
||||||
import { FormatTimeFlexible } from '../../utils/Common'
|
import { FormatTimeFlexible } from '../../../utils/Common'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default struct MessageComponent {
|
export default struct MessageComponent {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { DefaultJudgeConfigObj } from '../../model'
|
import { DefaultJudgeConfigObj } from '../../../model/index'
|
||||||
import Prompt from '@system.prompt'
|
import Prompt from '@system.prompt'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -1,19 +1,18 @@
|
|||||||
import { PerLane } from '../../model'
|
import { PerLane } from '../../../model/index'
|
||||||
import { dConsole } from '../../utils/LogWorker'
|
import { dConsole } from '../../../utils/LogWorker'
|
||||||
import SignalDisplayComponent from '../compontents/SignalDisplay'
|
import SignalDisplayComponent from '../../compontents/SignalDisplay'
|
||||||
import TabComponent from '../compontents/Tab'
|
import TabComponent from '../../compontents/Tab'
|
||||||
|
|
||||||
@CustomDialog
|
@CustomDialog
|
||||||
export default struct SignalTrajectoryDialog {
|
export default struct SignalTrajectoryDialog {
|
||||||
@State active: number = 0
|
@State active: number = 0
|
||||||
@Link @Watch("laneSignalChange") laneSignal: PerLane
|
@Link @Watch("laneSignalChange") laneSignal: PerLane
|
||||||
|
private controller?: CustomDialogController
|
||||||
|
|
||||||
laneSignalChange() {
|
laneSignalChange() {
|
||||||
dConsole.log("车道信号变化222", this.laneSignal)
|
dConsole.log("车道信号变化222", this.laneSignal)
|
||||||
}
|
}
|
||||||
|
|
||||||
private controller?: CustomDialogController
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
// Scroll() {
|
// Scroll() {
|
||||||
|
|
||||||
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 科目三手动扣分弹窗
|
||||||
|
*/
|
||||||
@CustomDialog
|
@CustomDialog
|
||||||
export default struct SubjectThreeManualDeductionOfPointsDialog {
|
export default struct SubjectThreeManualDeductionOfPointsDialog {
|
||||||
private controller?: CustomDialogController
|
private controller?: CustomDialogController
|
||||||
@ -11,11 +11,16 @@ import {
|
|||||||
ProjectInfos,
|
ProjectInfos,
|
||||||
ProjectRoads,
|
ProjectRoads,
|
||||||
Radar,
|
Radar,
|
||||||
|
VideoConfig,
|
||||||
Vision
|
Vision
|
||||||
} from '../../model';
|
} from '../../model';
|
||||||
import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common';
|
import { ArrayToByteArray, NumberToByteArray } from '../../utils/Common';
|
||||||
import dayTs from '../../utils/Date';
|
import dayTs from '../../utils/Date';
|
||||||
import { dConsole } from '../../utils/LogWorker';
|
import { dConsole } from '../../utils/LogWorker';
|
||||||
|
import common from '@ohos.app.ability.common';
|
||||||
|
import { JudgeConfig, JudgeTag } from '../../config';
|
||||||
|
import { takePhoto } from '../../utils/Video';
|
||||||
|
import Prompt from '@system.prompt';
|
||||||
|
|
||||||
|
|
||||||
// 中心信号转换
|
// 中心信号转换
|
||||||
@ -831,4 +836,5 @@ export const GetIsEndManualProject = (index: number, artSubject3Projects: string
|
|||||||
return projectName
|
return projectName
|
||||||
}
|
}
|
||||||
return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`;
|
return (type == '3' || type == '4') ? `${projectName}_red` : `${projectName}_green`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import testNapi from '@ohos.idcard';
|
|||||||
import IDCardSDK from '@ohos.idcard';
|
import IDCardSDK from '@ohos.idcard';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
import FilePhoto from './judgeSDK/utils/filePhoto';
|
|
||||||
|
|
||||||
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
|
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
|
||||||
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
|
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
|
||||||
@ -37,7 +36,7 @@ import { BusinessError } from '@ohos.base';
|
|||||||
import { GetSyncData, SqlInsertTable } from '../utils/table/Operation';
|
import { GetSyncData, SqlInsertTable } from '../utils/table/Operation';
|
||||||
import { CheckSignal, GetCurrentUserKeyValue, InitializeExamProcessData } from './UserInfo/utils';
|
import { CheckSignal, GetCurrentUserKeyValue, InitializeExamProcessData } from './UserInfo/utils';
|
||||||
import dayTs from '../utils/Date';
|
import dayTs from '../utils/Date';
|
||||||
import { GetCurrentTime, NumberToByteArray } from '../utils/Common';
|
import { GetCurrentTime, GetPhotoBase64, NumberToByteArray } from '../utils/Common';
|
||||||
import DB from '../utils/DbSql';
|
import DB from '../utils/DbSql';
|
||||||
import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
|
import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
|
||||||
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
||||||
@ -154,17 +153,6 @@ struct UserInfoPage {
|
|||||||
@State startExam: boolean = false
|
@State startExam: boolean = false
|
||||||
@State singlePlay: boolean = false
|
@State singlePlay: boolean = false
|
||||||
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||||
private filePhoto!: FilePhoto
|
|
||||||
// 过程照片拍照
|
|
||||||
getPhoto = async () => {
|
|
||||||
//单机模式返回空照片
|
|
||||||
if (this.singlePlay) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
const photoBase64: string = (await this.filePhoto.getPhoto()) || "";
|
|
||||||
return photoBase64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private avPlayer!: VoiceAnnounce
|
private avPlayer!: VoiceAnnounce
|
||||||
private labelBlocks: LabelBlockType[] = [
|
private labelBlocks: LabelBlockType[] = [
|
||||||
{ label: '考生姓名', key: 'xm' },
|
{ label: '考生姓名', key: 'xm' },
|
||||||
@ -229,7 +217,6 @@ struct UserInfoPage {
|
|||||||
this.startExam = false
|
this.startExam = false
|
||||||
this.updateTimeLimit = false
|
this.updateTimeLimit = false
|
||||||
this.currentUser = EmptyCandidateObject
|
this.currentUser = EmptyCandidateObject
|
||||||
this.filePhoto = new FilePhoto(this.context);
|
|
||||||
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
|
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
|
||||||
dConsole.log("this.singlePlay", this.singlePlay)
|
dConsole.log("this.singlePlay", this.singlePlay)
|
||||||
this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')!
|
this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')!
|
||||||
@ -907,7 +894,7 @@ struct UserInfoPage {
|
|||||||
dConsole.log(StartExamTag, "开始考试")
|
dConsole.log(StartExamTag, "开始考试")
|
||||||
const startHourTime = dayTs().format("HHmmssSSS")
|
const startHourTime = dayTs().format("HHmmssSSS")
|
||||||
AppStorage.setOrCreate('startHourTime', startHourTime)
|
AppStorage.setOrCreate('startHourTime', startHourTime)
|
||||||
const photoBase64 = await this.getPhoto();
|
const photoBase64 = await GetPhotoBase64(this.context);
|
||||||
if (photoBase64 == '') {
|
if (photoBase64 == '') {
|
||||||
dConsole.log(StartExamTag, "拍照失败")
|
dConsole.log(StartExamTag, "拍照失败")
|
||||||
this.startExamDialogController.close()
|
this.startExamDialogController.close()
|
||||||
|
|||||||
@ -75,6 +75,8 @@ struct VideoConfigPage {
|
|||||||
const folderPath = await this.fileUtil.initFolder(`/config`);
|
const folderPath = await this.fileUtil.initFolder(`/config`);
|
||||||
dConsole.log(this.oldVideoConfig.videoNum, this.videoConfig.videoNum, "查看")
|
dConsole.log(this.oldVideoConfig.videoNum, this.videoConfig.videoNum, "查看")
|
||||||
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.videoConfig))
|
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.videoConfig))
|
||||||
|
AppStorage.setOrCreate<VideoConfig>("VideoConfig", this.videoConfig)
|
||||||
|
this.fileUtil.closeFile(`${folderPath}/config3.txt`)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFileHandleCode(td: number): Promise<Boolean> {
|
async getFileHandleCode(td: number): Promise<Boolean> {
|
||||||
|
|||||||
@ -4,9 +4,8 @@ import common from '@ohos.app.ability.common';
|
|||||||
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
|
||||||
import { writeObjectOut } from '../../../api/judge';
|
import { writeObjectOut } from '../../../api/judge';
|
||||||
import JudgeTask from '../../judgeSDK/utils/judgeTask';
|
import JudgeTask from '../../judgeSDK/utils/judgeTask';
|
||||||
import FilePhoto from '../../judgeSDK/utils/filePhoto';
|
|
||||||
import { CarInfoType, MarkRule, MASYSSETTableType, RegulatoryInterfaceParams, User } from '../../../model';
|
import { CarInfoType, MarkRule, MASYSSETTableType, RegulatoryInterfaceParams, User } from '../../../model';
|
||||||
import { GetCurrentTime } from '../../../utils/Common';
|
import { GetCurrentTime, GetPhotoBase64 } from '../../../utils/Common';
|
||||||
import FileUtils from '../../../utils/FileUtils';
|
import FileUtils from '../../../utils/FileUtils';
|
||||||
import { GetSyncData } from '../../../utils/table/Operation';
|
import { GetSyncData } from '../../../utils/table/Operation';
|
||||||
import { dConsole } from '../../../utils/LogWorker';
|
import { dConsole } from '../../../utils/LogWorker';
|
||||||
@ -69,17 +68,6 @@ export default struct DeductedPopup {
|
|||||||
}
|
}
|
||||||
private context = getContext(this) as common.UIAbilityContext;
|
private context = getContext(this) as common.UIAbilityContext;
|
||||||
private judgeTask!: JudgeTask
|
private judgeTask!: JudgeTask
|
||||||
private filePhoto!: FilePhoto
|
|
||||||
// 过程照片拍照
|
|
||||||
getPhoto = async (empty?: boolean) => {
|
|
||||||
//单机模式返回空照片
|
|
||||||
if (this.singlePlay) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
const photoBase64: string = await this.filePhoto.getPhoto() || "";
|
|
||||||
return photoBase64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private avPlayer!: VoiceAnnounce
|
private avPlayer!: VoiceAnnounce
|
||||||
|
|
||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
@ -87,8 +75,6 @@ export default struct DeductedPopup {
|
|||||||
this.singlePlay = AppStorage.get<boolean>('singlePlay')!
|
this.singlePlay = AppStorage.get<boolean>('singlePlay')!
|
||||||
this.avPlayer = new VoiceAnnounce(this.context);
|
this.avPlayer = new VoiceAnnounce(this.context);
|
||||||
this.judgeTask = new JudgeTask();
|
this.judgeTask = new JudgeTask();
|
||||||
const mediaTest = new FilePhoto(this.context);
|
|
||||||
this.filePhoto = mediaTest
|
|
||||||
//上车准备
|
//上车准备
|
||||||
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
||||||
// const { isTrajectoryOpen } = judgeConfig;
|
// const { isTrajectoryOpen } = judgeConfig;
|
||||||
@ -205,7 +191,7 @@ export default struct DeductedPopup {
|
|||||||
// const { examSubject, plateNo, carNo } = carInfo;
|
// const { examSubject, plateNo, carNo } = carInfo;
|
||||||
const time = GetCurrentTime();
|
const time = GetCurrentTime();
|
||||||
dConsole.info('surenjun uploadProgressPhoto',)
|
dConsole.info('surenjun uploadProgressPhoto',)
|
||||||
const photoBase64 = await this.getPhoto()
|
const photoBase64 = await GetPhotoBase64(this.context)
|
||||||
const photoData: RegulatoryInterfaceParams = {
|
const photoData: RegulatoryInterfaceParams = {
|
||||||
xtlb: '17',
|
xtlb: '17',
|
||||||
jkxlh: this.serialNumber.toString(),
|
jkxlh: this.serialNumber.toString(),
|
||||||
@ -279,7 +265,7 @@ export default struct DeductedPopup {
|
|||||||
//考试结束
|
//考试结束
|
||||||
async endFn() {
|
async endFn() {
|
||||||
const time = GetCurrentTime();
|
const time = GetCurrentTime();
|
||||||
const photoBase64 = await this.getPhoto()
|
const photoBase64 = await GetPhotoBase64(this.context)
|
||||||
const endData: RegulatoryInterfaceParams = {
|
const endData: RegulatoryInterfaceParams = {
|
||||||
xtlb: '17',
|
xtlb: '17',
|
||||||
jkxlh: this.serialNumber.toString(),
|
jkxlh: this.serialNumber.toString(),
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import buffer from '@ohos.buffer';
|
|||||||
|
|
||||||
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 JudgeTask from './utils/judgeTask';
|
import JudgeTask from './utils/judgeTask';
|
||||||
import { JudgeConfig, JudgeTag } from '../../config';
|
import { JudgeConfig, JudgeTag } from '../../config';
|
||||||
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
import { GetSyncData, SqlInsertTable } from '../../utils/table/Operation';
|
||||||
@ -14,7 +13,7 @@ import { uploadExamProgressData, writeObjectOut } from '../../api/judge';
|
|||||||
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video';
|
import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
|
|
||||||
import { ConvertDdmmToDecimalDegrees, DeepClone, GetCurrentTime } from '../../utils/Common';
|
import { ConvertDdmmToDecimalDegrees, DeepClone, GetCurrentTime, GetPhotoBase64 } from '../../utils/Common';
|
||||||
import UsbService from '../../utils/USB';
|
import UsbService from '../../utils/USB';
|
||||||
import FileUtils from '../../utils/FileUtils';
|
import FileUtils from '../../utils/FileUtils';
|
||||||
import {
|
import {
|
||||||
@ -164,19 +163,6 @@ export default class Judge {
|
|||||||
private xmdm: string | number = ""
|
private xmdm: string | number = ""
|
||||||
private xmxh: string = ""
|
private xmxh: string = ""
|
||||||
private fileModel?: FileModel
|
private fileModel?: FileModel
|
||||||
private filePhoto?: FilePhoto
|
|
||||||
// 过程照片拍照
|
|
||||||
getPhoto = async (empty?: boolean) => {
|
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
|
||||||
//单机模式返回空照片
|
|
||||||
if (singlePlay) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
const photoBase64 = await this.filePhoto?.getPhoto();
|
|
||||||
dConsole.info(JudgeTag, '拍照完成')
|
|
||||||
return photoBase64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private usbService: UsbService
|
private usbService: UsbService
|
||||||
//是否是考试模式
|
//是否是考试模式
|
||||||
private isExam: boolean
|
private isExam: boolean
|
||||||
@ -184,48 +170,6 @@ export default class Judge {
|
|||||||
private isExamEnd: boolean
|
private isExamEnd: boolean
|
||||||
// 是否发送udp
|
// 是否发送udp
|
||||||
private isUdpEnd: boolean = false
|
private isUdpEnd: boolean = false
|
||||||
// 处理udp plc信号
|
|
||||||
handleUdp = async (msg: string) => {
|
|
||||||
const stachArr = msg.split(',')
|
|
||||||
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const gpsPart = msg.split("#END$GPS,")[1];
|
|
||||||
const gpsStatus = gpsPart.split(",")[0];
|
|
||||||
if (gpsStatus === "4") {
|
|
||||||
dConsole.log(JudgeTag, "差分状态正常", gpsStatus)
|
|
||||||
this.judgeUI.isDwztRight = true
|
|
||||||
} else {
|
|
||||||
dConsole.log(JudgeTag, "差分状态异常", gpsStatus)
|
|
||||||
this.judgeUI.isDwztRight = false
|
|
||||||
}
|
|
||||||
this.judgeUI.isDwztRight
|
|
||||||
const plcData = await this.getPlcData(msg);
|
|
||||||
// 4.过程数据
|
|
||||||
// await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
|
|
||||||
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(plcData))
|
|
||||||
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
|
||||||
// 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 暂时关闭差分检测异常
|
|
||||||
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
|
||||||
if (!this.isExamEnd) {
|
|
||||||
await examJudgeRealExam(plcData)
|
|
||||||
}
|
|
||||||
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
|
|
||||||
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
|
||||||
// TODO UPD缺失
|
|
||||||
// const judgeUdp = globalThis.judgeUdp
|
|
||||||
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
|
||||||
// judgeUdp.send(bytes)
|
|
||||||
// }
|
|
||||||
// AppStorage.setOrCreate('udpIndex', udpIndex++)
|
|
||||||
}
|
|
||||||
//是否手动结束考试
|
//是否手动结束考试
|
||||||
private isManual: boolean = false
|
private isManual: boolean = false
|
||||||
//UDP服务序列号
|
//UDP服务序列号
|
||||||
@ -270,60 +214,6 @@ export default class Judge {
|
|||||||
dConsole.info(JudgeTag, '过程数据文件上传 end')
|
dConsole.info(JudgeTag, '过程数据文件上传 end')
|
||||||
}
|
}
|
||||||
private judgeTask: JudgeTask
|
private judgeTask: JudgeTask
|
||||||
// 检测扣分、结束项目时该项目是否开始
|
|
||||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
|
||||||
if (xmdm == 20) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
const judgeUI = this.judgeUI;
|
|
||||||
const judgeTask = this.judgeTask;
|
|
||||||
const projectsObj: object = this.judgeUI.projectsObj
|
|
||||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
|
||||||
const isUpload = currentProject.isUpload
|
|
||||||
|
|
||||||
//如果项目没有开始
|
|
||||||
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
|
||||||
if (!isUpload) {
|
|
||||||
dConsole.info(JudgeTag, '项目补传开始')
|
|
||||||
//项目开始补传
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.beginProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.uploadProgressPhoto(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isUpload = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
//扣分补传
|
|
||||||
if (currentType == 2) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.pointsDedute(xmdm, kf!)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//扣分补传判断是否合格 不合格补传项目结束
|
|
||||||
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.endProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isEnd = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
}
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
this.checkExamIsEnd()
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private tempData?: PLCType
|
private tempData?: PLCType
|
||||||
//实时计算gps经纬度距离
|
//实时计算gps经纬度距离
|
||||||
handDistance = async () => {
|
handDistance = async () => {
|
||||||
@ -374,40 +264,47 @@ export default class Judge {
|
|||||||
AppStorage.setOrCreate('msgStr', plc)
|
AppStorage.setOrCreate('msgStr', plc)
|
||||||
return tempData
|
return tempData
|
||||||
}
|
}
|
||||||
// 处理轨迹plc信号
|
// 处理udp plc信号
|
||||||
handleTrajectoryUdp = async (strArr: string[]) => {
|
handleUdp = async (msg: string) => {
|
||||||
let num = 2;
|
const stachArr = msg.split(',')
|
||||||
const judgeTimer = setInterval(async () => {
|
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
||||||
const msgStr = strArr[num];
|
return
|
||||||
if (msgStr == '') {
|
}
|
||||||
dConsole.info(JudgeTag, '模拟数据考试结束')
|
const gpsPart = msg.split("#END$GPS,")[1];
|
||||||
clearInterval(judgeTimer)
|
const gpsStatus = gpsPart.split(",")[0];
|
||||||
this.checkExamIsEnd(true)
|
if (gpsStatus === "4") {
|
||||||
return
|
dConsole.log(JudgeTag, "差分状态正常", gpsStatus)
|
||||||
}
|
this.judgeUI.isDwztRight = true
|
||||||
const msg: PLCType = JSON.parse(strArr[num]);
|
} else {
|
||||||
num++
|
dConsole.log(JudgeTag, "差分状态异常", gpsStatus)
|
||||||
// 4.过程数据
|
this.judgeUI.isDwztRight = false
|
||||||
this.tempData = msg
|
}
|
||||||
// this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
|
this.judgeUI.isDwztRight
|
||||||
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
|
const plcData = await this.getPlcData(msg);
|
||||||
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
// 4.过程数据
|
||||||
this.plcData = msg
|
// await this.fileLog?.setExamJudgeData(JSON.stringify(plcData))
|
||||||
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
dConsole.writeProcessData(ProcessDataEnumType.JudgeExamData, JSON.stringify(plcData))
|
||||||
AppStorage.setOrCreate('msgStr', '')
|
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
||||||
if (msg.method === 'examJudgeArtificialItem') {
|
// if (this.usbService.isWXUSBDevice) {
|
||||||
this.setJudgeItem(msg.itemno, msg.type)
|
// const str = await senorToWXDataStr(msg);
|
||||||
}
|
// this.usbService.sendUSB(str)
|
||||||
if (msg.method === 'examJudgeArtificialMark') {
|
// }
|
||||||
this.setJudgeItem(msg.itemno, msg.serial)
|
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) + ''
|
||||||
await examJudgeRealExam(msg)
|
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
||||||
// const bytes = await this.getMessageHeartbeat();
|
//TODO 暂时关闭差分检测异常
|
||||||
// bytes && globalThis.judgeUdp.send(bytes)
|
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
||||||
|
if (!this.isExamEnd) {
|
||||||
}, 200)
|
await examJudgeRealExam(plcData)
|
||||||
// TODO 定时器缺失
|
}
|
||||||
// globalThis.judgeTimer = judgeTimer;
|
// let udpIndex = AppStorage.get<number>('udpIndex') || 0;
|
||||||
|
// if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
||||||
|
// TODO UPD缺失
|
||||||
|
// const judgeUdp = globalThis.judgeUdp
|
||||||
|
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
||||||
|
// judgeUdp.send(bytes)
|
||||||
|
// }
|
||||||
|
// AppStorage.setOrCreate('udpIndex', udpIndex++)
|
||||||
}
|
}
|
||||||
private isEndTip: boolean = false;
|
private isEndTip: boolean = false;
|
||||||
//本地轨迹回放地址
|
//本地轨迹回放地址
|
||||||
@ -427,6 +324,32 @@ export default class Judge {
|
|||||||
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
|
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||||
|
private lane: LANE = {
|
||||||
|
road: '', num: 0, count: 0
|
||||||
|
}
|
||||||
|
private disConnectNum: number = 0;
|
||||||
|
//调用监管接口
|
||||||
|
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||||
|
const temp = await writeObjectOut(data, filePath, this.context);
|
||||||
|
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
|
||||||
|
//断网&网络超时次数计算
|
||||||
|
if (temp.code == 2300007 || temp.code == 2300028) {
|
||||||
|
this.disConnectNum += 1;
|
||||||
|
if (this.disConnectNum < 5) {
|
||||||
|
return await this.sendWriteObjectOut(data, filePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.disConnectNum >= 5) {
|
||||||
|
dConsole.info('surenjun', '123')
|
||||||
|
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
||||||
|
this.judgeUI.disConnectErrorOpen = true
|
||||||
|
}
|
||||||
|
|
||||||
|
this.disConnectNum = 0
|
||||||
|
return temp
|
||||||
|
}
|
||||||
// 项目开始接口同步
|
// 项目开始接口同步
|
||||||
beginProject = async (ksxm: number) => {
|
beginProject = async (ksxm: number) => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
@ -501,7 +424,7 @@ export default class Judge {
|
|||||||
const time = GetCurrentTime();
|
const time = GetCurrentTime();
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const plcData = this.plcData
|
const plcData = this.plcData
|
||||||
const photoBase64 = await this.getPhoto();
|
const photoBase64 = await GetPhotoBase64(this.context);
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
|
|
||||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm)
|
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm)
|
||||||
@ -530,32 +453,6 @@ export default class Judge {
|
|||||||
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
|
UploadRegulatoryCodeConversion('17C54', temp.code || 0)
|
||||||
dConsole.info(JudgeTag, '上传照片 end')
|
dConsole.info(JudgeTag, '上传照片 end')
|
||||||
}
|
}
|
||||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
|
||||||
private lane: LANE = {
|
|
||||||
road: '', num: 0, count: 0
|
|
||||||
}
|
|
||||||
private disConnectNum: number = 0;
|
|
||||||
//调用监管接口
|
|
||||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
|
||||||
const temp = await writeObjectOut(data, filePath, this.context);
|
|
||||||
dConsole.log(JudgeTag, "wzj", JSON.stringify(temp))
|
|
||||||
//断网&网络超时次数计算
|
|
||||||
if (temp.code == 2300007 || temp.code == 2300028) {
|
|
||||||
this.disConnectNum += 1;
|
|
||||||
if (this.disConnectNum < 5) {
|
|
||||||
return await this.sendWriteObjectOut(data, filePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.disConnectNum >= 5) {
|
|
||||||
dConsole.info('surenjun', '123')
|
|
||||||
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
|
||||||
this.judgeUI.disConnectErrorOpen = true
|
|
||||||
}
|
|
||||||
|
|
||||||
this.disConnectNum = 0
|
|
||||||
return temp
|
|
||||||
}
|
|
||||||
private videoData?: RecordHandleType
|
private videoData?: RecordHandleType
|
||||||
//当前科目二的考试项目
|
//当前科目二的考试项目
|
||||||
private deductedPopShowTimer: number = 0;
|
private deductedPopShowTimer: number = 0;
|
||||||
@ -674,6 +571,95 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 检测扣分、结束项目时该项目是否开始
|
||||||
|
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
|
||||||
|
if (xmdm == 20) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const judgeUI = this.judgeUI;
|
||||||
|
const judgeTask = this.judgeTask;
|
||||||
|
const projectsObj: object = this.judgeUI.projectsObj
|
||||||
|
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||||
|
const isUpload = currentProject.isUpload
|
||||||
|
|
||||||
|
//如果项目没有开始
|
||||||
|
dConsole.info(JudgeTag, 'surenjun isUpload=>', isUpload)
|
||||||
|
if (!isUpload) {
|
||||||
|
dConsole.info(JudgeTag, '项目补传开始')
|
||||||
|
//项目开始补传
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.beginProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.uploadProgressPhoto(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isUpload = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
//扣分补传
|
||||||
|
if (currentType == 2) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.pointsDedute(xmdm, kf!)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//扣分补传判断是否合格 不合格补传项目结束
|
||||||
|
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.endProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isEnd = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
}
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
this.checkExamIsEnd()
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理轨迹plc信号
|
||||||
|
handleTrajectoryUdp = async (strArr: string[]) => {
|
||||||
|
let num = 2;
|
||||||
|
const judgeTimer = setInterval(async () => {
|
||||||
|
const msgStr = strArr[num];
|
||||||
|
if (msgStr == '') {
|
||||||
|
dConsole.info(JudgeTag, '模拟数据考试结束')
|
||||||
|
clearInterval(judgeTimer)
|
||||||
|
this.checkExamIsEnd(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const msg: PLCType = JSON.parse(strArr[num]);
|
||||||
|
num++
|
||||||
|
// 4.过程数据
|
||||||
|
this.tempData = msg
|
||||||
|
// this.judgeUI.isDwztRight = (msg?.gps?.dwzt == 4 && msg?.gps?.jdzt == 3);
|
||||||
|
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
|
||||||
|
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
|
||||||
|
this.plcData = msg
|
||||||
|
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
|
||||||
|
AppStorage.setOrCreate('msgStr', '')
|
||||||
|
if (msg.method === 'examJudgeArtificialItem') {
|
||||||
|
this.setJudgeItem(msg.itemno, msg.type)
|
||||||
|
}
|
||||||
|
if (msg.method === 'examJudgeArtificialMark') {
|
||||||
|
this.setJudgeItem(msg.itemno, msg.serial)
|
||||||
|
}
|
||||||
|
await examJudgeRealExam(msg)
|
||||||
|
// const bytes = await this.getMessageHeartbeat();
|
||||||
|
// bytes && globalThis.judgeUdp.send(bytes)
|
||||||
|
|
||||||
|
}, 200)
|
||||||
|
// TODO 定时器缺失
|
||||||
|
// globalThis.judgeTimer = judgeTimer;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(judgeUI: JudgeUI) {
|
constructor(judgeUI: JudgeUI) {
|
||||||
this.serialIndex = 1;
|
this.serialIndex = 1;
|
||||||
@ -686,7 +672,6 @@ export default class Judge {
|
|||||||
this.fileUtil = new FileUtils(judgeUI.context)
|
this.fileUtil = new FileUtils(judgeUI.context)
|
||||||
this.judgeTask = new JudgeTask()
|
this.judgeTask = new JudgeTask()
|
||||||
this.usbService = new UsbService();
|
this.usbService = new UsbService();
|
||||||
this.filePhoto = new FilePhoto(judgeUI.context);
|
|
||||||
this.kfArr = judgeUI.kfArr
|
this.kfArr = judgeUI.kfArr
|
||||||
this.xmmcStr = '';
|
this.xmmcStr = '';
|
||||||
this.xmmcCode = '';
|
this.xmmcCode = '';
|
||||||
@ -785,7 +770,6 @@ export default class Judge {
|
|||||||
// 获取开始考试数据
|
// 获取开始考试数据
|
||||||
getJudgeBeginData = async () => {
|
getJudgeBeginData = async () => {
|
||||||
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
const examinerInfo = AppStorage.get<ExaminerInfoType>('examinerInfo')
|
||||||
// const code = examinerInfo.code
|
|
||||||
const examinerName = examinerInfo?.name || ""
|
const examinerName = examinerInfo?.name || ""
|
||||||
|
|
||||||
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
|
||||||
@ -1407,7 +1391,6 @@ export default class Judge {
|
|||||||
|
|
||||||
const judgeUI = this.judgeUI
|
const judgeUI = this.judgeUI
|
||||||
const ksjs = this.ksjs
|
const ksjs = this.ksjs
|
||||||
const getPhoto = this.getPhoto
|
|
||||||
const avPlayer = this.avPlayer
|
const avPlayer = this.avPlayer
|
||||||
const kfArr = this.kfArr
|
const kfArr = this.kfArr
|
||||||
const filePath = this.filePath
|
const filePath = this.filePath
|
||||||
@ -1423,7 +1406,7 @@ export default class Judge {
|
|||||||
//TODO 断网考试结束补传
|
//TODO 断网考试结束补传
|
||||||
// await uploadDisConnectData();
|
// await uploadDisConnectData();
|
||||||
const time = GetCurrentTime();
|
const time = GetCurrentTime();
|
||||||
const photoBase64 = await getPhoto();
|
const photoBase64 = await GetPhotoBase64(this.context);
|
||||||
const d1 = ksjs?.d1 || 0;
|
const d1 = ksjs?.d1 || 0;
|
||||||
const d2 = ksjs?.d2 || 0;
|
const d2 = ksjs?.d2 || 0;
|
||||||
const d3 = ksjs?.d3 || 0;
|
const d3 = ksjs?.d3 || 0;
|
||||||
@ -1862,14 +1845,11 @@ export default class Judge {
|
|||||||
const judgeUI = this.judgeUI;
|
const judgeUI = this.judgeUI;
|
||||||
|
|
||||||
const name = judgeUI.name
|
const name = judgeUI.name
|
||||||
const lsh = judgeUI.lsh
|
|
||||||
const idCard = judgeUI.idCard
|
|
||||||
const kssycs = judgeUI.kssycs
|
const kssycs = judgeUI.kssycs
|
||||||
const manualMarkRules = judgeUI.manualMarkRules
|
const manualMarkRules = judgeUI.manualMarkRules
|
||||||
|
|
||||||
|
|
||||||
const getJudgeBeginData = this.getJudgeBeginData;
|
const getJudgeBeginData = this.getJudgeBeginData;
|
||||||
const handDistance = this.getJudgeBeginData;
|
|
||||||
const handleTrajectoryUdp = this.handleTrajectoryUdp;
|
const handleTrajectoryUdp = this.handleTrajectoryUdp;
|
||||||
const isTrajectoryOpen = this.isTrajectoryOpen;
|
const isTrajectoryOpen = this.isTrajectoryOpen;
|
||||||
const trajectoryPath = this.trajectoryPath;
|
const trajectoryPath = this.trajectoryPath;
|
||||||
|
|||||||
@ -1,50 +0,0 @@
|
|||||||
import { takePhoto } from '../../../utils/Video';
|
|
||||||
import promptAction from '@ohos.promptAction';
|
|
||||||
import { JudgeConfig } from '../../../config';
|
|
||||||
import FileUtils from '../../../utils/FileUtils';
|
|
||||||
import { VideoConfig } from '../../../model/Common';
|
|
||||||
import common from '@ohos.app.ability.common';
|
|
||||||
import { dConsole } from '../../../utils/LogWorker';
|
|
||||||
|
|
||||||
export default class FilePhoto {
|
|
||||||
private params!: VideoConfig
|
|
||||||
private context!: common.UIAbilityContext
|
|
||||||
public getPhoto = async () => {
|
|
||||||
if (!JudgeConfig.isPhotoOpen) {
|
|
||||||
return ''
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
dConsole.info('surenjun', '拍照开始')
|
|
||||||
const res = await takePhoto(this.params, this.context, 'pz/', 2);
|
|
||||||
dConsole.info('surenjun', '拍照结束' + JSON.stringify(res))
|
|
||||||
return res.base64
|
|
||||||
} catch (e) {
|
|
||||||
dConsole.error('surenjun =>拍照异常' + JSON.stringify(e))
|
|
||||||
promptAction.showToast({
|
|
||||||
message: '拍照异常,请联系工程人员!',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: common.UIAbilityContext) {
|
|
||||||
(async () => {
|
|
||||||
//TODO 309参数 获取拍照摄像头拍照通道
|
|
||||||
const fileUtil = new FileUtils(context)
|
|
||||||
const strConfig =
|
|
||||||
await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt');
|
|
||||||
const config: VideoConfig = JSON.parse(strConfig as string)
|
|
||||||
this.params = {
|
|
||||||
userName: config.userName,
|
|
||||||
pwd: config.pwd,
|
|
||||||
ip: config.ip,
|
|
||||||
port: config.port,
|
|
||||||
rlls: config.rlls,
|
|
||||||
pztd: config.pztd,
|
|
||||||
}
|
|
||||||
this.context = context
|
|
||||||
})()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +1,13 @@
|
|||||||
import dayTs from './Date';
|
import dayTs from './Date';
|
||||||
import fs from '@ohos.file.fs';
|
import fs from '@ohos.file.fs';
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import { CommonFileTag } from '../config';
|
import { CommonFileTag, JudgeConfig, JudgeTag } from '../config';
|
||||||
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
|
||||||
import Prompt from '@system.prompt';
|
import Prompt from '@system.prompt';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
|
import { dConsole } from './LogWorker';
|
||||||
|
import { takePhoto } from './Video';
|
||||||
|
import { VideoConfig } from '../model';
|
||||||
|
|
||||||
enum timeType {
|
enum timeType {
|
||||||
fulltime = 1
|
fulltime = 1
|
||||||
@ -322,4 +325,30 @@ export async function UseAuth(context: common.UIAbilityContext): Promise<boolean
|
|||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取拍照图片
|
||||||
|
*/
|
||||||
|
export const GetPhotoBase64 = async (context: common.UIAbilityContext): Promise<string> => {
|
||||||
|
// 获取视频参数
|
||||||
|
const videoConfig = AppStorage.get<VideoConfig>('videoConfig');
|
||||||
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||||
|
if (!JudgeConfig.isPhotoOpen || singlePlay) {
|
||||||
|
return ""
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
dConsole.info(JudgeTag, '拍照开始')
|
||||||
|
const res = await takePhoto(videoConfig, context, 'pz/', 2);
|
||||||
|
dConsole.info(JudgeTag, '拍照完成')
|
||||||
|
return res.base64
|
||||||
|
} catch (e) {
|
||||||
|
dConsole.error(JudgeTag, '拍照异常' + JSON.stringify(e))
|
||||||
|
Prompt.showToast({
|
||||||
|
message: '拍照异常,请检查摄像头是否正常',
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user