refactor: 更新类型定义,优化代码可读性

This commit is contained in:
wangzhongjie 2025-04-11 10:15:49 +08:00
commit 365199bf28
14 changed files with 312 additions and 320 deletions

View File

@ -4,13 +4,13 @@
{
"name": "default",
"material": {
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer",
"storePassword": "0000001BF61E21FB976B39E89B0A4C96C700B26D123A135B19960F46FB1AD287C476CBC184970AADEAE427",
"certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.cer",
"storePassword": "0000001BDF3D6712C5DDDFE933D0E21935169EA3D5DC7B026A4ACB4F78E0CF373149FAAD4EC525D78BD7A3",
"keyAlias": "debugKey",
"keyPassword": "0000001B1780EFE659F33C63102C1B0B4C88158F0C099302DEFA08FD4D797DA70DF2B7EE539D79F697B31D",
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b",
"keyPassword": "0000001B4790F814C62AF4BDC57BB201C1FDD7B28DDEC3B93521D2961E829CCFE82E9B4A743C2A2FAAD672",
"profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12"
"storeFile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p12"
}
}
],

View File

@ -66,7 +66,6 @@ export default class EntryAbility extends UIAbility {
AppStorage.setOrCreate('windowClass', windowClass)
await windowClass.setWindowSystemBarEnable([]) //全屏
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');

View File

@ -293,7 +293,7 @@ export interface ProjectInfo {
//无锡所项目代码
projectCodeCenter?: string
//项目简写
abbreviation?: string
abbreviation: string
///项目是否考过了
isEnd?: boolean,
@ -381,7 +381,8 @@ export interface MarkRule {
score?: number
xmmcStr?: string
desc?: string
type?: 0 | 1 | 2
xmdm?: string
type?: 0 | 1 | 2 | 3
}
export interface UploadExamMileage {
@ -393,9 +394,9 @@ export interface UploadExamMileage {
}
export interface SYSSET {
v_no?: string,
v_name?: string,
v_value?: string
v_no: string,
v_name: string,
v_value: string
/** 轨迹文件 **/
key?: number;
name?: string;
@ -442,7 +443,7 @@ export interface JudgeUI {
mapPointItemArr: MAPITEMPOINTITEM[]
systemparmArr: SYSTEMPARMARR[]
carinfoArr: CARINFO[]
kfArr: JudgeEventKf[]
kfArr: MarkRule[]
judgeConfigObj: object
judgeConfig: SyssetConfig[]
projectsObj: ESObject
@ -592,7 +593,7 @@ export interface JudgeInitObj extends Km3JudgeInitConfig {
carmodel: string
allitems: ItemInfo[]
iteminfo?: ItemInfo[]
systemparm: MA_SYSTEMPARMType[]
systemparm: SYSTEMPARMARR[]
mark: MarkRule[]
sysset: SyssetConfig[]
itemInfoObj?: ItemInfos

View File

@ -127,12 +127,12 @@ export interface ES_CARINFOType {
// 'id', 'no1', 'no2', 'no3', 'txt1', 'txt2', 'txt3'
export interface MA_SYSTEMPARMType {
id?: string
no1?: string
no2?: string
no3?: string
txt1?: string
txt2?: string
txt3?: string
no1: string
no2: string
no3: string
txt1: string
txt2: string
txt3: string
NO1?: number,
NO2?: number,
NO3?: number,
@ -143,33 +143,33 @@ export interface MA_SYSTEMPARMType {
// 'id', 'sbbm', 'itemsno', 'sbbh', 'kdid', 'bk3'
export interface MA_CDSBINFOType {
id?: string
sbbm?: string
itemsno?: string
sbbh?: string
kdid?: string
bk3?: string
id: string
sbbm: string
itemsno: string
sbbh: string
kdid: string
bk3: string
}
// 'id', 'cininfo', 'setup9', 'nextinfo', 'setup7', 'setup8', 'setup5', 'carlist', 'setup6', 'setup3',
// 'setup4', 'setup1', 'setup2', 'itemsno', 'end_cardsno', 'freqinfo'
export interface MA_ITEMINFOType {
id?: string
cininfo?: string
setup9?: string
nextinfo?: string
setup7?: string
setup8?: string
setup5?: string
carlist?: string
setup6?: string
setup3?: string
setup4?: string
setup1?: string
setup2?: string
itemsno?: string
end_cardsno?: string
freqinfo?: string
id: string
cininfo: string
setup9: string
nextinfo: string
setup7: string
setup8: string
setup5: string
carlist: string
setup6: string
setup3: string
setup4: string
setup1: string
setup2: string
itemsno: string
end_cardsno: string
freqinfo: string
}
// 'id', 'point_no', 'point_no_f', 'gps_e', 'gps_e_location', 'gps_n', 'gps_n_location', 'f_gps_e',

View File

@ -24,6 +24,7 @@ import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness';
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
import { LoadingDialog } from './Index/Loading';
@Entry
@ -39,13 +40,22 @@ struct Index {
@State dialogRatio: number = 0.8
@State ratio: number = 1700 / 960
@State delLoading: boolean = false
@State loading: boolean = false
@State initParamFlag: boolean = false
@State fd: number = -1;
@State carInfo: CarInfoType = {};
@State num: number = 0;
private context = getContext(this) as common.UIAbilityContext;
errorDialog: CustomDialogController = new CustomDialogController({
private fileHelper: FileHelper = new FileHelper(this.context)
private interval = -1;
private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context)
private timeInfo: TimeSynchronizationRspBody = {}
private loadingDialog: CustomDialogController = new CustomDialogController({
builder: LoadingDialog(),
customStyle: true,
alignment: DialogAlignment.Center,
autoCancel: false
})
private errorDialog: CustomDialogController = new CustomDialogController({
builder: errorMsgDialog({
title: AppStorage.get('title'),
type: AppStorage.get('type'),
@ -56,60 +66,7 @@ struct Index {
}),
customStyle: true,
alignment: DialogAlignment.Center,
},
)
private fileHelper: FileHelper = new FileHelper(this.context)
private interval = -1;
private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context)
private timeInfo: TimeSynchronizationRspBody = {}
async aboutToAppear() {
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
this.initParamFlag = false
this.delLoading = false
this.dialogVisible = false
this.angle = 0
this.loading = false
AppStorage.set('lsh', '1111111111111')
// TODO 未改
// globalThis.errorDialog = this.errorDialog
// globalThis.udpEvent = new UdpEvent();
JudgeEmitterInstance.init()
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
res.forEach((element) => {
if (element.v_no === "305") {
delPic(Number(element.v_value), 1, this.context)
delPic(Number(element.v_value), 2, this.context)
}
});
});
}
async onPageShow(): Promise<void> {
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
UseAuth(this.context).then(() => {
this.initParams()
}).catch(() => {
});
if (this.singlePlay == undefined || this.singlePlay == null) {
this.context.resourceManager.getRawFileContent("welcome.wav")
.then(() => {
this.avPlayer.playAudio(['welcome.wav'])
})
.catch((error: BusinessError) => {
console.log("getRawFileContent promise error is " + error);
});
this.singlePlay = false
AppStorage.setOrCreate('singlePlay', false)
}
this.num = 0
AppStorage.setOrCreate('lsh', '1111111111111')
}
})
@Styles
commStyle(){
@ -120,14 +77,40 @@ struct Index {
// .margin({ bottom: 12 * this.ratio })
}
async aboutToAppear() {
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
this.angle = 0
AppStorage.set('lsh', '1111111111111')
// TODO 未改
// globalThis.errorDialog = this.errorDialog
JudgeEmitterInstance.init()
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
res.forEach((element) => {
if (element.v_no === "305") {
delPic(Number(element.v_value), 1, this.context)
delPic(Number(element.v_value), 2, this.context)
}
});
});
}
async onPageShow(): Promise<void> {
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
await UseAuth(this.context)
this.initParams()
AppStorage.setOrCreate('singlePlay', false)
this.context.resourceManager.getRawFileContent("welcome.wav")
.then(() => {
this.avPlayer.playAudio(['welcome.wav'])
})
.catch((error: BusinessError) => {
console.log("getRawFileContent promise error is " + error);
});
this.num = 0
AppStorage.setOrCreate('lsh', '1111111111111')
}
async testXMLToJSONInWorker() {
if (this.loading) {
return
}
// let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1
// console.log('mode',mode)
const param: InitializeTheCentralTableType = {
carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId,
@ -141,10 +124,8 @@ struct Index {
centerHost: this.timeInfo?.url,
singlePlay: this.singlePlay
}
this.loading = true
// getSingleCenterTable(param).then((ret) => {
InitializeTheCentralTable(param).then((ret) => {
this.loadingDialog.close()
if (ret) {
GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => {
data.forEach(sys => {
@ -166,10 +147,8 @@ struct Index {
}
})
});
}
})
}
async heartMsg() {
@ -206,8 +185,7 @@ struct Index {
}
async initParams() {
//设置plc udp 同步requesthost
console.log("test1111")
ObtainUdpBusinessInstance.init();
CenterUDPBusinessInstance.init();
CenterUDPBusinessInstance.startHeartBeat()
@ -216,7 +194,6 @@ struct Index {
AppStorage.setOrCreate('signNum', data.body[1])
}
},)
this.loading = false
await GetDeviceInfo(this.context)
await GetCarInfo()
// getTCP()
@ -226,9 +203,6 @@ struct Index {
this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')!
DrivingDataStorage.init(this.context)
DrivingDataStorage.initializeTheDrivingDataFolder()
setTimeout(() => {
this.initParamFlag = true
}, 3000)
JudgeUdpBusinessInstance.init()
// TODO 摄像头遮挡
// takePhotoFn(this.context)
@ -256,9 +230,6 @@ struct Index {
// name: 'button_media.wav'
// })
// deleteAllPicturesFn()
// if (this.loading) {
// return
// }
router.pushUrl({
url: 'pages/Settings',
}, router.RouterMode.Single);
@ -283,19 +254,12 @@ struct Index {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') })
.margin({ left: 80 * this.ratio })
.onClick(async () => {
this.loadingDialog.open()
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
// ||!this.initParamFlag
if (this.loading) {
// this.errorDialog.open()
return
}
setTimeout(() => {
this.angle = 360
}, 1000)
this.angle = 0
if (!this.timeInfo) {
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '时间同步接口连接失败')
@ -304,7 +268,7 @@ struct Index {
message: `时间同步接口连接失败`,
duration: 3000
});
this.loading = false
this.loadingDialog.close()
return
}
if (!this.carInfo) {
@ -315,21 +279,16 @@ struct Index {
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '车辆信息接口获取失败')
this.errorDialog.open()
this.loading = false
this.loadingDialog.close()
return
}
this.testXMLToJSONInWorker()
})
}
if (this.singlePlay) {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') })
.margin({ left: 80 * this.ratio })
.onClick(() => {
if (this.loading) {
return
}
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
@ -356,9 +315,6 @@ struct Index {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') })
.margin({ right: 80 * this.ratio })
.onClick(() => {
if (this.loading) {
return
}
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
@ -414,7 +370,7 @@ struct Index {
.margin({ bottom: 10 })
}.height(100)
//
if (this.dialogVisible) {
Flex({ justifyContent: FlexAlign.Center }) {
Text('确认是否退出应用')
@ -486,41 +442,10 @@ struct Index {
.backgroundColor('#E6E3DF')
.borderRadius(19 * this.ratio)
}
if (this.loading) {
Column() {
Image($r('app.media.open_loading'))
.width(200 * this.ratio)
.rotate({ angle: this.angle })
.height(200 * this.ratio)
.animation({
duration: 5000, // 动画时长
curve: Curve.EaseOut, // 动画曲线
delay: 500, // 动画延迟
iterations: -1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
})
.margin({ top: 30 * this.ratio })
Image($r('app.media.car'))
.width(80 * this.ratio)
.height(80 * this.ratio)
.position({ x: 288 * this.ratio, y: 89 * this.ratio })
Text('获取考车信息,请稍候……')
.fontSize(24 * this.ratio)
.margin({ top: 20 * this.ratio })
.fontWeight(400)
}
.visibility(this.loading ? Visibility.Visible : Visibility.Hidden)
.width(660 * this.ratio)
.height(360 * this.ratio)
.position({ x: 150 * this.ratio, y: 98 * this.ratio })
.backgroundColor('#E6E3DF')
.borderRadius(19 * this.ratio)
}
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.SpaceBetween)
.backgroundImagePosition({ x: 0, y: 0 })
.backgroundImage($r('app.media.index_bg'))
.backgroundImageSize({ width: '100%', height: '100%' })
}

View File

@ -0,0 +1,39 @@
@CustomDialog
export struct LoadingDialog {
@State
private angle: number = 0
private controller: CustomDialogController
aboutToAppear(): void {
animateTo({
duration: 5000, // 动画时长
curve: Curve.EaseOut, // 动画曲线
iterations: -1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
}, () => {
this.angle += 360
})
}
build() {
Column() {
Image($r('app.media.open_loading'))
.width(200)
.rotate({ angle: this.angle })
.height(200)
.margin({ top: 30 })
Image($r('app.media.car'))
.width(80)
.height(80)
.position({ x: 288, y: 89 })
Text('获取考车信息,请稍候……')
.fontSize(24)
.margin({ top: 20 })
.fontWeight(400)
}
.width(660)
.height(360)
.backgroundColor('#E6E3DF')
.borderRadius(19)
}
}

View File

@ -11,38 +11,44 @@ import { uploadExamMileage } from '../api/judge';
import DwztErrorPopup from './compontents/judge/DwztErrorPopup';
import MsgPopup from './compontents/judge/MsgPopup';
import {
CARINFO,
CDSBInfo,
LANE,
MAPITEMPOINTITEM,
MAPPOINT,
MarkRule,
Project, SYSTEMPARMARR
CARINFO,
CDSBInfo,
LANE,
MAPITEMPOINTITEM,
MAPPOINT,
Project,
SYSTEMPARMARR
} from './judgeSDK/api/judgeSDK.d';
import { JudgeConfig } from './judgeSDK/utils/judgeConfig';
import SignDisplayCom from './compontents/SignDisplayCom';
import {
AmplifyItem,
CarInfoType,
CDSBInfos, DefaultJudgeConfigObj,
ES_CARINFOType,
ItemInfos,
JudgeBeginObj,
JudgeCallBacData,
JudgeInitObj,
JudgeUI, MA_CDSBINFOType,
MA_ITEMINFOType,
MA_MAP_POINT_ITEMType,
MA_MAP_POINTType, MA_SYSTEMPARMType,
MarkRules,
MASYSSETTableType, ProjectInfo,
ProjectInfos,
ProjectRoads,
RouteParamsType,
SYSSET,
SyssetConfig, User
AmplifyItem,
CarInfoType,
CDSBInfos,
DefaultJudgeConfigObj,
ES_CARINFOType,
ItemInfos,
JudgeBeginObj,
JudgeCallBacData,
JudgeInitObj,
JudgeUI,
MA_CDSBINFOType,
MA_ITEMINFOType,
MA_MAP_POINT_ITEMType,
MA_MAP_POINTType,
MA_SYSTEMPARMType,
MarkRules,
MASYSSETTableType,
ProjectInfo,
ProjectInfos,
ProjectRoads,
RouteParamsType,
SYSSET,
SyssetConfig,
User,
MarkRule
} from '../model';
import { GetSyncData } from '../utils/table/Operation';
import dayTs from '../utils/Date';
@ -149,7 +155,7 @@ struct Index {
@State mileageTimer: number = 0;
@State passingScore: number = 80
@State dwztErrorVisible: boolean = false;
@State popTimer: number = 0;
@State popTimer: number | null = 0;
@State carlist: string = ''
@State errorMsg: string = ''
@State carInfo: CarInfoType = {}
@ -163,8 +169,8 @@ struct Index {
async aboutToAppear() {
const time = GetCurrentTime()
this.carInfo = AppStorage.get<CarInfoType>('carInfo')
this.singlePlay = AppStorage.get<boolean>('singlePlay')
this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
this.singlePlay = AppStorage.get<boolean>('singlePlay')!
this.startTime = time.split(' ')[1]
this.startFullTime = GetCurrentTime(1);
// this.startHourTime = await getCurrentHourTime()
@ -185,7 +191,7 @@ struct Index {
//初始化相关数据库表
async initDb() {
this.examSubject = this.carInfo.examSubject;
this.examSubject = this.carInfo.examSubject!;
// const { isTrajectoryOpen, trajectoryPath } = judgeConfig
await this.initStudent();
await this.initCar();
@ -218,18 +224,18 @@ struct Index {
// const result = await getSyncData('ES_CARINFO')
const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO")
const carInfo = result[0] || {};
this.carName = decodeURI(carInfo.carclass)
this.carType = carInfo.kscx
this.carName = decodeURI(carInfo.carclass!)
this.carType = carInfo.kscx!
this.carinfoArr.push({
CARID: carInfo.carid,
CARID: carInfo.carid!,
IPADDR: '',
CARCLASS: decodeURI(carInfo.carclass),
KSCX: carInfo.kscx,
CARCLASS: decodeURI(carInfo.carclass!),
KSCX: carInfo.kscx!,
// CARNAME: decodeURI(carInfo.carname),
CARNAME: "",
FLAG: carInfo.flag,
BK1: carInfo.bk1,
BK2: carInfo.bk2,
FLAG: carInfo.flag!,
BK1: carInfo.bk1!,
BK2: carInfo.bk2!,
})
console.info('surenjun =>carinfoArrr', JSON.stringify(this.carinfoArr))
}
@ -247,7 +253,7 @@ struct Index {
this.ksxl = stuInfo.ksxl;
this.wayno = Number(stuInfo.ksxl);
this.xldm = stuInfo.xldm;
this.kslx = stuInfo.kslx;
this.kslx = stuInfo.kslx!;
}
// 获取扣分代码信息
@ -256,14 +262,14 @@ struct Index {
markRuleParams.forEach(mark => {
const tempObj: MarkRule = {
itemno: mark.itemno * 1,
itemno: Number(mark.itemno),
markcatalog: mark.markcatalog,
markshow: decodeURI(mark.markshow),
markreal: mark.markreal * 1,
markshow: decodeURI(mark.markshow!),
markreal: Number(mark.markreal!),
markserial: mark.markserial,
kfxh: mark.kfxh,
OnlyOneKind: mark.onlyoneid * 1,
NoCancelId: mark.nocancelid * 1,
OnlyOneKind: Number(mark.onlyoneid!),
NoCancelId: Number(mark.nocancelid!),
GPS_SID: mark.gps_sid == 0 ? false : true
}
@ -287,21 +293,21 @@ struct Index {
// const { isTrajectoryOpen } = judgeConfig
const syssetJudgeConfigArr: SyssetConfig[] = []
syssetParams.forEach((sys: SYSSET) => {
syssetParams.forEach((sys: SYSSET | MASYSSETTableType) => {
if (JudgeConfig.isTrajectoryOpen) {
sys.v_no = String(sys.key);
sys.v_name = sys.name;
sys.v_value = sys.value
sys.v_no = String((sys as SYSSET).key!);
sys.v_name = (sys as SYSSET).name!;
sys.v_value = (sys as SYSSET).value!
}
// const { v_no, v_value } = sys;
const v_no_num = Number(sys.v_no)
const value = decodeURIComponent(sys.v_value)
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)
name: decodeURI(sys.v_name!)
})
}
@ -323,43 +329,38 @@ struct Index {
//364 绕车一周评判时机(1-开始考试后判 2-开始考试前判)
if (sys.v_no == '364' && sys.v_value == "2") {
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
// const { sczb, kfdm } = currentParams;
const kfdm = currentParams.kfdm;
currentParams.kfdm.forEach(kf => {
// const { xmdm, kfdm } = kf
currentParams.kfdm?.forEach(kf => {
const currentKf: MarkRule = Reflect.get(this.markRuleListObj, `${kf.xmdm}_${kf.kfdm}`)
const currentProject: ProjectInfo = Reflect.get(this.projectsObj, kf.xmdm)
// 过滤考前绕车一周上车准备的扣分
if (currentParams.sczb == "1" && kf.xmdm == 1) {
return
}
this.kfArr.push({
//扣分项目名称
xmmcStr: currentProject.name,
xmdm: kf.xmdm,
xmdm: kf.xmdm + "",
desc: currentKf.markshow,
score: currentKf.markreal,
markcatalog: currentKf.markcatalog,
markserial: currentKf.markserial,
kfxh: currentKf.kfxh
})
this.totalScore += currentKf.markreal * 1;
this.totalScore += Number(currentKf!.markreal);
})
const project_1 = Reflect.get(this.projectsObj, 1)
project_1.type = kfdm.length ? '4' : '3';
const project_1: ProjectInfo = Reflect.get(this.projectsObj, 1)
project_1.type = kfdm!.length ? '4' : '3';
Reflect.set(this.projectsObj, 1, project_1)
}
Reflect.set(this.judgeConfigObj, sys.v_no, value)
Reflect.set(this.judgeConfigObj, sys.v_no!, value)
});
this.judgeConfig = syssetJudgeConfigArr;
}
//初始化systemParam表
async initSystemParam(sysParam?: MA_SYSTEMPARMType[]) {
async initSystemParam(sysParam?: MA_SYSTEMPARMType []) {
let systemParms: MA_SYSTEMPARMType[] = sysParam || await GetSyncData<MA_SYSTEMPARMType>('MA_SYSTEMPARM')
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
@ -377,12 +378,12 @@ struct Index {
let carNo = '', allItems: string[] = [];
systemParms.forEach((systemParm) => {
if (JudgeConfig.isTrajectoryOpen) {
systemParm.no1 = systemParm.NO1 + '';
systemParm.no2 = systemParm.NO2 + '';
systemParm.no3 = systemParm.NO3 + '';
systemParm.txt1 = systemParm.TXT1;
systemParm.txt2 = systemParm.TXT2;
systemParm.txt3 = systemParm.TXT3;
systemParm.no1 = systemParm.NO1! + '';
systemParm.no2 = systemParm.NO2! + '';
systemParm.no3 = systemParm.NO3! + '';
systemParm.txt1 = systemParm.TXT1!;
systemParm.txt2 = systemParm.TXT2!;
systemParm.txt3 = systemParm.TXT3!;
}
// const { no1, no2, no3, } = systemParm;
const txt1 = decodeURI(systemParm.txt1)
@ -493,7 +494,7 @@ struct Index {
xmdm,
xmxh: key.split('~')[1],
}
Reflect.set(this.cdsbInfoObj, newKey, cdsbInfo)
Reflect.set(this.cdsbInfoObj!, newKey, cdsbInfo)
}
})
}
@ -510,7 +511,7 @@ struct Index {
const xmdm = Number(key.split('~')[0])
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
if (currentProject && (carlistArr.length == 0 || carlistArr.includes(carlist))) {
Reflect.set(this.itemInfoObj, newKey, {
Reflect.set(this.itemInfoObj!, newKey, {
modelKey: newKey,
xmdm,
xmxh: key.split('~')[1],
@ -526,9 +527,9 @@ struct Index {
// await judge.init<typeof Index>()
await judge.onJudgeFn(async (judgeData: JudgeCallBacData) => {
// const { xmmcStr, carztStr, kfArr } = judgeData;
this.xmmcStr = judgeData.xmmcStr;
this.carztStr = judgeData.carztStr;
this.kfArr = judgeData.kfArr;
this.xmmcStr = judgeData.xmmcStr || "";
this.carztStr = judgeData.carztStr || "";
this.kfArr = judgeData.kfArr || [];
});
return judge
}
@ -542,7 +543,7 @@ struct Index {
if (config_432 != '0' || this.examSubject == "2") {
//断点续考判断
let currentParams: RouteParamsType = router.getParams() as RouteParamsType;
const examItems: string = currentParams?.examItems;
const examItems: string | undefined = currentParams?.examItems;
// 2024-01-03 16:29:26;0;20300,;2,4^2,4;null;
if (examItems !== '' && examItems !== undefined) {
console.info('surenjun examItems=>', JSON.stringify(examItems))
@ -588,7 +589,7 @@ struct Index {
markserial: currentKf.markserial,
kfxh: currentKf.kfxh
})
this.totalScore += currentKf.markreal * 1;
this.totalScore += Number(currentKf.markreal!)
})
this.ddxkKfArr = ddxkKfArr
this.ddxkTime = Date.parse(startTime);
@ -609,7 +610,7 @@ struct Index {
gps_n: Number(item.gps_n),
point_no_f: Number(item.point_no_f),
point_type: Number(item.point_type),
road_code: item.road_code,
road_code: item.road_code!,
gps_e_Location: Number(item.gps_e_location),
gps_n_Location: Number(item.gps_n_location),
f_gps_e: Number(item.f_gps_e),
@ -628,7 +629,7 @@ struct Index {
point_no: Number(item.point_no),
itemno: Number(item.itemno),
itemno1: Number(item.itemno1),
subname: item.subname
subname: item.subname!
})
})
}
@ -652,9 +653,9 @@ struct Index {
this.carInfo.examSubject = this.examSubject
this.singlePlay = beginDataObj.exam == 0;
this.carName = initDataObj.name;
await this.initSystemParam(initDataObj.systemparm)
await this.initSystemParam(initDataObj.systemparm as MA_SYSTEMPARMType[])
await this.initMarkRules(initDataObj.mark);
await this.initSysset(initDataObj.sysset);
await this.initSysset(initDataObj.sysset as SYSSET[]);
}
// 上传考试里程
@ -663,8 +664,8 @@ struct Index {
const carInfo = this.carInfo
await uploadExamMileage({
carId: carInfo.carId,
examinationRoomId: carInfo.examinationRoomId,
carId: carInfo.carId!,
examinationRoomId: carInfo.examinationRoomId!,
lsh: this.lsh,
kskssj: this.startExamTime,
kslc: this.jl
@ -833,7 +834,7 @@ struct Index {
//#FF7566 #00FFD5 #E6DECF
// Text(this.projectsObj[item[0].projectCode])
Text(item[0].abbreviation)
.fontSize(item[0].abbreviation.length > 5 ? 28 : 32)
.fontSize(item[0].abbreviation!.length > 5 ? 28 : 32)
.fontColor(this.getProjectColor(item[0]))
}
.backgroundImage($rawfile('judge/project_item.png'), ImageRepeat.NoRepeat)
@ -1058,12 +1059,16 @@ struct Index {
//科目三人工扣分弹窗
if (this.isDeductedPopShow && this.examSubject == '3' && Reflect.get(this.judgeConfigObj, '342') == '0') {
DeductedPopup({
defaultTabIndex: this.defaultTabIndex,
currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => {
const project: ProjectInfo = Reflect.get(this.projectsObj, projectKey)
return project.type == '2' ? project.projectCode : undefined
}).filter(project => project !== undefined),
// currentItems: Reflect.ownKeys(this.projectsObj).map(projectKey => {
// const project: ProjectInfo = Reflect.get(this.projectsObj, projectKey)
// return project.type == '2' ? project.projectCode : undefined
// }).filter(project => project !== undefined),
currentItems: Object.entries(this.projectsObj).filter((item: [string, ProjectInfo]) => {
return item[1].type === '2'
}).map((item: [string, ProjectInfo]) => item[1].projectCode!),
markRules: this.manualMarkRules,
closePopup: () => {
this.isDeductedPopShow = false;
@ -1071,7 +1076,6 @@ struct Index {
},
confirmMark: async (itemno: string, serial: string) => {
clearTimeout(this.popTimer)
this.popTimer = null
this.popTimer = setTimeout(async () => {
const judge = this.judge
await judge.setJudgeMark(itemno, serial);
@ -1114,7 +1118,6 @@ struct Index {
amplifyImgIndex: this.amplifiedImgIndex,
confirmAmplify: async (amplify: AmplifyItem) => {
clearTimeout(this.popTimer)
this.popTimer = null
this.popTimer = setTimeout(async () => {
const judge = this.judge
await judge.setJudgeItem(amplify.projectCode, 1);
@ -1229,14 +1232,12 @@ struct Index {
//人工项目操作
async setManualProjectFn(index: number) {
const judgeConfigObj = this.judgeConfigObj;
const isManualProjectIn = this.isManualProjectIn;
const getIsExitManualProject = this.getIsExitManualProject;
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
const projectsObj = this.projectsObj;
const projectCode = Reflect.get(artSubject3ProjectsCodesArr, index)
const projectCode = artSubject3ProjectsCodesArr[index]
if (index === 5) {
console.info('surenjun 靠边停车状态=> ', getIsExitManualProject(index))
}
@ -1457,6 +1458,7 @@ struct Index {
if (Reflect.get(this.judgeConfigObj, '342') == '0') {
return true
}
return false
} else {
return false
}

View File

@ -2,11 +2,10 @@ import { JudgeConfig } from '../../judgeSDK/utils/judgeConfig';
import common from '@ohos.app.ability.common';
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
import { MarkRule } from '../../judgeSDK/api/judgeSDK.d';
import { writeObjectOut } from '../../../api/judge';
import JudgeTask from '../../judgeSDK/utils/judgeTask';
import FilePhoto from '../../judgeSDK/utils/filePhoto';
import { CarInfoType, MASYSSETTableType, RegulatoryInterfaceParams, User } from '../../../model';
import { CarInfoType, MarkRule, MASYSSETTableType, RegulatoryInterfaceParams, User } from '../../../model';
import { GetCurrentTime } from '../../../utils/Common';
import FileUtils from '../../../utils/FileUtils';
import { GetSyncData } from '../../../utils/table/Operation';
@ -336,7 +335,7 @@ export default struct DeductedPopup {
kfxh: mark.kfxh,
OnlyOneKind: Number(mark.onlyoneid),
NoCancelId: Number(mark.nocancelid),
GPS_SID: mark.gps_sid == 0 ? false : true
GPS_SID: mark.gps_sid == 0 ? false : true,
}
if (mark.itemno == 1 && Number(mark.markserial) > 100 && Number(mark.markserial) < 200) {

View File

@ -1,4 +1,4 @@
import { MarkRule } from '../../judgeSDK/api/judgeSDK';
import { MarkRule } from '../../../model';
import EndPoPup from './EndPopup';
interface SEL {

View File

@ -1,25 +1,52 @@
@Component
export default struct DwztErrorPop{
export default struct DwztErrorPop {
constructor() {
super()
}
private title:string = ''
private cancelFn:(event?: ClickEvent) => void
private confirmFn:(event?: ClickEvent) => void
private title: string = ''
private cancelFn: (event?: ClickEvent) => void = () => {
}
private confirmFn: (event?: ClickEvent) => void = () => {
}
build(){
Column(){
Column(){
Text(this.title).fontSize(36).margin({bottom:20}).lineHeight(50)
Row(){}.height(100)
Row(){
Text('继续考试').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(95).fontSize(28).fontColor('#FFF').textAlign(TextAlign.Center).onClick(this.cancelFn)
Text('结束考试').backgroundImage($rawfile('judge/end-btn.png'),ImageRepeat.NoRepeat).backgroundImageSize({width:'100%',height:'100%'}).width(250).height(95).fontSize(28).fontColor('#FFF').textAlign(TextAlign.Center).margin({left:45}).onClick(this.confirmFn)
}.margin({top:20})
}.width('75%').height('70%').padding(15).backgroundColor('#E6E3DF').borderRadius(38).position({y:'12%',x:'12.5%'}).justifyContent(FlexAlign.Center)
build() {
Column() {
Column() {
Text(this.title).fontSize(36).margin({ bottom: 20 }).lineHeight(50)
Row() {
}.height(100)
}.width('100%').height('100%').position({y:0}).backgroundColor('rgba(0,0,0,0.7)')
Row() {
Text('继续考试')
.backgroundImage($rawfile('judge/end-btn.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(250)
.height(95)
.fontSize(28)
.fontColor('#FFF')
.textAlign(TextAlign.Center)
.onClick(this.cancelFn)
Text('结束考试')
.backgroundImage($rawfile('judge/end-btn.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' })
.width(250)
.height(95)
.fontSize(28)
.fontColor('#FFF')
.textAlign(TextAlign.Center)
.margin({ left: 45 })
.onClick(this.confirmFn)
}.margin({ top: 20 })
}
.width('75%')
.height('70%')
.padding(15)
.backgroundColor('#E6E3DF')
.borderRadius(38)
.position({ y: '12%', x: '12.5%' })
.justifyContent(FlexAlign.Center)
}.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.7)')
}
}

View File

@ -6,7 +6,7 @@ export default struct MsgPopup{
}
private title:string = ''
private confirmFn:(event?: ClickEvent) => void
private confirmFn:(event?: ClickEvent) => void = () => {}
build(){
Column(){

View File

@ -13,7 +13,7 @@ import { JudgeBeginObj, JudgeInitObj, Plc } from '../../../model';
* @desc 获取版本信息
**/
export async function examJudgeVersion(): Promise<string> {
return await libJudgeSdk.examJudgeVersion();
return libJudgeSdk.examJudgeVersion();
}
/**

View File

@ -15,22 +15,22 @@ export interface Project {
}
export interface MarkRule {
itemno?: number
markcatalog?: string
markshow?: string
markserial?: string
markstandard?: number,
markreal?: number
kfxh?: string
onlyoneid?: number
OnlyOneKind?: number
nocancelid?: number
NoCancelId?: number
gps_sid?: number,
GPS_SID?:boolean
score?:number
xmmcStr?: string
desc?: string
itemno: number
markcatalog: string
markshow: string
markserial: string
markstandard: number,
markreal: number
kfxh: string
onlyoneid: number
OnlyOneKind: number
nocancelid: number
NoCancelId: number
gps_sid: number,
GPS_SID:boolean
score:number
xmmcStr: string
desc: string
xmdm?: number
type?: 0 | 1 | 2
}

View File

@ -397,7 +397,7 @@ export default class Judge {
}
}
private ksjs?: JudgeKSJS
private kfArr?: JudgeEventKf[]
private kfArr?: MarkRule[]
//所有的科目考试项目(大车&小车)
private kmItems: JudgeConfigObjKmItems
private plcData?: Plc
@ -607,7 +607,7 @@ export default class Judge {
promptWxCode('17C55', temp.code || 0)
}
// 检测扣分、结束项目时该项目是否开始
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: MarkRule) => {
if (xmdm == 20) {
return true
}
@ -939,10 +939,10 @@ export default class Judge {
//扣分
case 3:
const thisKf = this.getKfStr(`${kf.xmdm}_${kf.kfdm}`)
const kfObj: JudgeEventKf = {
const kfObj: MarkRule = {
//扣分项目名称
xmmcStr: this.getDqxmStr(kf.xmdm),
xmdm: kf.xmdm,
xmdm: kf.xmdm + "",
//扣分描述
desc: thisKf.desc,
//扣分分数
@ -954,7 +954,7 @@ export default class Judge {
//扣分类型
type: kf.type
}
//扣分信息
//扣分信息
this.kfArr.push(kfObj)
this.judgeUI.totalScore += thisKf.score * 1;
if (kf.xmdm != 20) {
@ -1055,7 +1055,7 @@ export default class Judge {
}
// 更改考试状态
goVoiceAnnounce =
async (event: number, xmdm: number, kf: JudgeEventKf[], xmjs: JudgeXMJS, ksjs: JudgeKSJS, xmxh: string) => {
async (event: number, xmdm: number, kf: MarkRule[], xmjs: JudgeXMJS, ksjs: JudgeKSJS, xmxh: string) => {
const beginProject = this.beginProject
const pointsDedute = this.pointsDedute
@ -1088,21 +1088,21 @@ export default class Judge {
const project: ProjectInfo = Reflect.get(projectsObj, xmdm)
const code = project.projectCodeCenter;
const isEnd = project.isEnd;
// const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane, xmxh)
// if (!ignoreVoiceCodeArr.includes(code)) {
// if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){
// //倒出入库、桩考\进项目语音控制
// }else{
// kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true)
// }
// }
// const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane, xmxh)
// if (!ignoreVoiceCodeArr.includes(code)) {
// if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){
// //倒出入库、桩考\进项目语音控制
// }else{
// kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true)
// }
// }
setTimeout(() => {
if (Reflect.get(param512, 7) != 0) {
clearTimeout(this.deductedPopShowTimer)
this.judgeUI.isDeductedPopShow = true
}
}, 200)
//项目已考不上传监管信息
//项目已考不上传监管信息
if (!isEnd) {
judgeTask.addTask(async () => {
console.info(judgeTag, `项目开始-${xmdm}-${project.name}`)
@ -1158,17 +1158,17 @@ export default class Judge {
// 扣分
case 3:
console.info('surenjun', '扣分开始')
//扣分时实时播报语音0-否+1-是)
//扣分时实时播报语音0-否+1-是)
const currentKf = kf[kfLen -1];
if (JudgeConfig.kfVoiceOpen || (examSubject == '2' && judgeConfigObj['618'] == '1') ||
(examSubject == '3' && judgeConfigObj['418'] == '1')) {
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`])
}
const isStart = await checkProjectIsStart(currentKf.xmdm, 2, currentKf);
const isStart = await checkProjectIsStart(Number(currentKf.xmdm), 2, currentKf);
if (isStart) {
await judgeTask.addTask(async () => {
console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`)
await pointsDedute(currentKf.xmdm, currentKf)
await pointsDedute(Number(currentKf.xmdm), currentKf)
}, {
isDelay: true
})
@ -1182,7 +1182,7 @@ export default class Judge {
// 考试结束
case 5:
console.info(judgeTag, '考试结束')
//关闭录像
//关闭录像
const singlePlay = AppStorage.get<boolean>('singlePlay')
if (!singlePlay) {
await endRecordVideo(this.videoData)
@ -1192,8 +1192,8 @@ export default class Judge {
AppStorage.setOrCreate('isJudge', false)
await handEndExam(ksjs)
})
// TODO待修改
// clearInterval(globalThis.judgeTimer)
// TODO待修改
// clearInterval(globalThis.judgeTimer)
break
default:
break
@ -1210,7 +1210,7 @@ export default class Judge {
}
}
// 考试扣分
pointsDedute = async (ksxm: number, kf: JudgeEventKf) => {
pointsDedute = async (ksxm: number, kf: MarkRule) => {
const carInfo = AppStorage.get<CarInfoType>('carInfo');
const examSubject = carInfo.examSubject
const plateNo = carInfo.plateNo
@ -1812,7 +1812,7 @@ export default class Judge {
case 4:
this.judgeUI.isDwztRight = false;
//差分异常上报
//差分异常上报
break;
}
}