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", "name": "default",
"material": { "material": {
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer", "certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.cer",
"storePassword": "0000001BF61E21FB976B39E89B0A4C96C700B26D123A135B19960F46FB1AD287C476CBC184970AADEAE427", "storePassword": "0000001BDF3D6712C5DDDFE933D0E21935169EA3D5DC7B026A4ACB4F78E0CF373149FAAD4EC525D78BD7A3",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001B1780EFE659F33C63102C1B0B4C88158F0C099302DEFA08FD4D797DA70DF2B7EE539D79F697B31D", "keyPassword": "0000001B4790F814C62AF4BDC57BB201C1FDD7B28DDEC3B93521D2961E829CCFE82E9B4A743C2A2FAAD672",
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b", "profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p7b",
"signAlg": "SHA256withECDSA", "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) AppStorage.setOrCreate('windowClass', windowClass)
await windowClass.setWindowSystemBarEnable([]) //全屏 await windowClass.setWindowSystemBarEnable([]) //全屏
windowStage.loadContent('pages/Index', (err, data) => { windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) { if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); 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 projectCodeCenter?: string
//项目简写 //项目简写
abbreviation?: string abbreviation: string
///项目是否考过了 ///项目是否考过了
isEnd?: boolean, isEnd?: boolean,
@ -381,7 +381,8 @@ export interface MarkRule {
score?: number score?: number
xmmcStr?: string xmmcStr?: string
desc?: string desc?: string
type?: 0 | 1 | 2 xmdm?: string
type?: 0 | 1 | 2 | 3
} }
export interface UploadExamMileage { export interface UploadExamMileage {
@ -393,9 +394,9 @@ export interface UploadExamMileage {
} }
export interface SYSSET { export interface SYSSET {
v_no?: string, v_no: string,
v_name?: string, v_name: string,
v_value?: string v_value: string
/** 轨迹文件 **/ /** 轨迹文件 **/
key?: number; key?: number;
name?: string; name?: string;
@ -442,7 +443,7 @@ export interface JudgeUI {
mapPointItemArr: MAPITEMPOINTITEM[] mapPointItemArr: MAPITEMPOINTITEM[]
systemparmArr: SYSTEMPARMARR[] systemparmArr: SYSTEMPARMARR[]
carinfoArr: CARINFO[] carinfoArr: CARINFO[]
kfArr: JudgeEventKf[] kfArr: MarkRule[]
judgeConfigObj: object judgeConfigObj: object
judgeConfig: SyssetConfig[] judgeConfig: SyssetConfig[]
projectsObj: ESObject projectsObj: ESObject
@ -592,7 +593,7 @@ export interface JudgeInitObj extends Km3JudgeInitConfig {
carmodel: string carmodel: string
allitems: ItemInfo[] allitems: ItemInfo[]
iteminfo?: ItemInfo[] iteminfo?: ItemInfo[]
systemparm: MA_SYSTEMPARMType[] systemparm: SYSTEMPARMARR[]
mark: MarkRule[] mark: MarkRule[]
sysset: SyssetConfig[] sysset: SyssetConfig[]
itemInfoObj?: ItemInfos itemInfoObj?: ItemInfos

View File

@ -127,12 +127,12 @@ export interface ES_CARINFOType {
// 'id', 'no1', 'no2', 'no3', 'txt1', 'txt2', 'txt3' // 'id', 'no1', 'no2', 'no3', 'txt1', 'txt2', 'txt3'
export interface MA_SYSTEMPARMType { export interface MA_SYSTEMPARMType {
id?: string id?: string
no1?: string no1: string
no2?: string no2: string
no3?: string no3: string
txt1?: string txt1: string
txt2?: string txt2: string
txt3?: string txt3: string
NO1?: number, NO1?: number,
NO2?: number, NO2?: number,
NO3?: number, NO3?: number,
@ -143,33 +143,33 @@ export interface MA_SYSTEMPARMType {
// 'id', 'sbbm', 'itemsno', 'sbbh', 'kdid', 'bk3' // 'id', 'sbbm', 'itemsno', 'sbbh', 'kdid', 'bk3'
export interface MA_CDSBINFOType { export interface MA_CDSBINFOType {
id?: string id: string
sbbm?: string sbbm: string
itemsno?: string itemsno: string
sbbh?: string sbbh: string
kdid?: string kdid: string
bk3?: string bk3: string
} }
// 'id', 'cininfo', 'setup9', 'nextinfo', 'setup7', 'setup8', 'setup5', 'carlist', 'setup6', 'setup3', // 'id', 'cininfo', 'setup9', 'nextinfo', 'setup7', 'setup8', 'setup5', 'carlist', 'setup6', 'setup3',
// 'setup4', 'setup1', 'setup2', 'itemsno', 'end_cardsno', 'freqinfo' // 'setup4', 'setup1', 'setup2', 'itemsno', 'end_cardsno', 'freqinfo'
export interface MA_ITEMINFOType { export interface MA_ITEMINFOType {
id?: string id: string
cininfo?: string cininfo: string
setup9?: string setup9: string
nextinfo?: string nextinfo: string
setup7?: string setup7: string
setup8?: string setup8: string
setup5?: string setup5: string
carlist?: string carlist: string
setup6?: string setup6: string
setup3?: string setup3: string
setup4?: string setup4: string
setup1?: string setup1: string
setup2?: string setup2: string
itemsno?: string itemsno: string
end_cardsno?: string end_cardsno: string
freqinfo?: string freqinfo: string
} }
// 'id', 'point_no', 'point_no_f', 'gps_e', 'gps_e_location', 'gps_n', 'gps_n_location', 'f_gps_e', // '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 { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness'; import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness';
import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
import { LoadingDialog } from './Index/Loading';
@Entry @Entry
@ -39,13 +40,22 @@ struct Index {
@State dialogRatio: number = 0.8 @State dialogRatio: number = 0.8
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@State delLoading: boolean = false @State delLoading: boolean = false
@State loading: boolean = false
@State initParamFlag: boolean = false @State initParamFlag: boolean = false
@State fd: number = -1; @State fd: number = -1;
@State carInfo: CarInfoType = {}; @State carInfo: CarInfoType = {};
@State num: number = 0; @State num: number = 0;
private context = getContext(this) as common.UIAbilityContext; 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({ builder: errorMsgDialog({
title: AppStorage.get('title'), title: AppStorage.get('title'),
type: AppStorage.get('type'), type: AppStorage.get('type'),
@ -56,60 +66,7 @@ struct Index {
}), }),
customStyle: true, customStyle: true,
alignment: DialogAlignment.Center, 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 @Styles
commStyle(){ commStyle(){
@ -120,14 +77,40 @@ struct Index {
// .margin({ bottom: 12 * this.ratio }) // .margin({ bottom: 12 * this.ratio })
} }
async testXMLToJSONInWorker() { async aboutToAppear() {
if (this.loading) { this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
return 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)
}
});
});
} }
// let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1
// console.log('mode',mode) 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() {
const param: InitializeTheCentralTableType = { const param: InitializeTheCentralTableType = {
carId: this.carInfo?.carId, carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId, examinationRoomId: this.carInfo?.examinationRoomId,
@ -141,10 +124,8 @@ struct Index {
centerHost: this.timeInfo?.url, centerHost: this.timeInfo?.url,
singlePlay: this.singlePlay singlePlay: this.singlePlay
} }
this.loading = true
// getSingleCenterTable(param).then((ret) => {
InitializeTheCentralTable(param).then((ret) => { InitializeTheCentralTable(param).then((ret) => {
this.loadingDialog.close()
if (ret) { if (ret) {
GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => { GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => {
data.forEach(sys => { data.forEach(sys => {
@ -166,10 +147,8 @@ struct Index {
} }
}) })
}); });
} }
}) })
} }
async heartMsg() { async heartMsg() {
@ -206,8 +185,7 @@ struct Index {
} }
async initParams() { async initParams() {
//设置plc udp 同步requesthost console.log("test1111")
ObtainUdpBusinessInstance.init(); ObtainUdpBusinessInstance.init();
CenterUDPBusinessInstance.init(); CenterUDPBusinessInstance.init();
CenterUDPBusinessInstance.startHeartBeat() CenterUDPBusinessInstance.startHeartBeat()
@ -216,7 +194,6 @@ struct Index {
AppStorage.setOrCreate('signNum', data.body[1]) AppStorage.setOrCreate('signNum', data.body[1])
} }
},) },)
this.loading = false
await GetDeviceInfo(this.context) await GetDeviceInfo(this.context)
await GetCarInfo() await GetCarInfo()
// getTCP() // getTCP()
@ -226,9 +203,6 @@ struct Index {
this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')! this.timeInfo = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')!
DrivingDataStorage.init(this.context) DrivingDataStorage.init(this.context)
DrivingDataStorage.initializeTheDrivingDataFolder() DrivingDataStorage.initializeTheDrivingDataFolder()
setTimeout(() => {
this.initParamFlag = true
}, 3000)
JudgeUdpBusinessInstance.init() JudgeUdpBusinessInstance.init()
// TODO 摄像头遮挡 // TODO 摄像头遮挡
// takePhotoFn(this.context) // takePhotoFn(this.context)
@ -256,9 +230,6 @@ struct Index {
// name: 'button_media.wav' // name: 'button_media.wav'
// }) // })
// deleteAllPicturesFn() // deleteAllPicturesFn()
// if (this.loading) {
// return
// }
router.pushUrl({ router.pushUrl({
url: 'pages/Settings', url: 'pages/Settings',
}, router.RouterMode.Single); }, router.RouterMode.Single);
@ -283,19 +254,12 @@ struct Index {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') })
.margin({ left: 80 * this.ratio }) .margin({ left: 80 * this.ratio })
.onClick(async () => { .onClick(async () => {
this.loadingDialog.open()
// this.vocObj.playAudio({ // this.vocObj.playAudio({
// type: 1, // type: 1,
// name: 'button_media.wav' // name: 'button_media.wav'
// }) // })
// ||!this.initParamFlag // ||!this.initParamFlag
if (this.loading) {
// this.errorDialog.open()
return
}
setTimeout(() => {
this.angle = 360
}, 1000)
this.angle = 0
if (!this.timeInfo) { if (!this.timeInfo) {
AppStorage.setOrCreate('type', 1) AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '时间同步接口连接失败') AppStorage.setOrCreate('title', '时间同步接口连接失败')
@ -304,7 +268,7 @@ struct Index {
message: `时间同步接口连接失败`, message: `时间同步接口连接失败`,
duration: 3000 duration: 3000
}); });
this.loading = false this.loadingDialog.close()
return return
} }
if (!this.carInfo) { if (!this.carInfo) {
@ -315,21 +279,16 @@ struct Index {
AppStorage.setOrCreate('type', 1) AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '车辆信息接口获取失败') AppStorage.setOrCreate('title', '车辆信息接口获取失败')
this.errorDialog.open() this.errorDialog.open()
this.loading = false this.loadingDialog.close()
return return
} }
this.testXMLToJSONInWorker() this.testXMLToJSONInWorker()
}) })
} }
if (this.singlePlay) { if (this.singlePlay) {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') }) imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') })
.margin({ left: 80 * this.ratio }) .margin({ left: 80 * this.ratio })
.onClick(() => { .onClick(() => {
if (this.loading) {
return
}
// this.vocObj.playAudio({ // this.vocObj.playAudio({
// type: 1, // type: 1,
// name: 'button_media.wav' // name: 'button_media.wav'
@ -356,9 +315,6 @@ struct Index {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') }) imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') })
.margin({ right: 80 * this.ratio }) .margin({ right: 80 * this.ratio })
.onClick(() => { .onClick(() => {
if (this.loading) {
return
}
// this.vocObj.playAudio({ // this.vocObj.playAudio({
// type: 1, // type: 1,
// name: 'button_media.wav' // name: 'button_media.wav'
@ -414,7 +370,7 @@ struct Index {
.margin({ bottom: 10 }) .margin({ bottom: 10 })
}.height(100) }.height(100)
//
if (this.dialogVisible) { if (this.dialogVisible) {
Flex({ justifyContent: FlexAlign.Center }) { Flex({ justifyContent: FlexAlign.Center }) {
Text('确认是否退出应用') Text('确认是否退出应用')
@ -486,41 +442,10 @@ struct Index {
.backgroundColor('#E6E3DF') .backgroundColor('#E6E3DF')
.borderRadius(19 * this.ratio) .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%') .width('100%')
.height('100%') .height('100%')
.justifyContent(FlexAlign.SpaceBetween) .justifyContent(FlexAlign.SpaceBetween)
.backgroundImagePosition({ x: 0, y: 0 })
.backgroundImage($r('app.media.index_bg')) .backgroundImage($r('app.media.index_bg'))
.backgroundImageSize({ width: '100%', height: '100%' }) .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

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

View File

@ -2,11 +2,10 @@ import { JudgeConfig } from '../../judgeSDK/utils/judgeConfig';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
import { MarkRule } from '../../judgeSDK/api/judgeSDK.d';
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 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 { GetCurrentTime } 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';
@ -336,7 +335,7 @@ export default struct DeductedPopup {
kfxh: mark.kfxh, kfxh: mark.kfxh,
OnlyOneKind: Number(mark.onlyoneid), OnlyOneKind: Number(mark.onlyoneid),
NoCancelId: Number(mark.nocancelid), 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) { 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'; import EndPoPup from './EndPopup';
interface SEL { interface SEL {

View File

@ -1,4 +1,3 @@
@Component @Component
export default struct DwztErrorPop { export default struct DwztErrorPop {
constructor() { constructor() {
@ -6,19 +5,47 @@ export default struct DwztErrorPop{
} }
private title: string = '' private title: string = ''
private cancelFn:(event?: ClickEvent) => void private cancelFn: (event?: ClickEvent) => void = () => {
private confirmFn:(event?: ClickEvent) => void }
private confirmFn: (event?: ClickEvent) => void = () => {
}
build() { build() {
Column() { Column() {
Column() { Column() {
Text(this.title).fontSize(36).margin({ bottom: 20 }).lineHeight(50) Text(this.title).fontSize(36).margin({ bottom: 20 }).lineHeight(50)
Row(){}.height(100)
Row() { 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) }.height(100)
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)
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 }) }.margin({ top: 20 })
}.width('75%').height('70%').padding(15).backgroundColor('#E6E3DF').borderRadius(38).position({y:'12%',x:'12.5%'}).justifyContent(FlexAlign.Center) }
.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)') }.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 title:string = ''
private confirmFn:(event?: ClickEvent) => void private confirmFn:(event?: ClickEvent) => void = () => {}
build(){ build(){
Column(){ Column(){

View File

@ -13,7 +13,7 @@ import { JudgeBeginObj, JudgeInitObj, Plc } from '../../../model';
* @desc 获取版本信息 * @desc 获取版本信息
**/ **/
export async function examJudgeVersion(): Promise<string> { 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 { export interface MarkRule {
itemno?: number itemno: number
markcatalog?: string markcatalog: string
markshow?: string markshow: string
markserial?: string markserial: string
markstandard?: number, markstandard: number,
markreal?: number markreal: number
kfxh?: string kfxh: string
onlyoneid?: number onlyoneid: number
OnlyOneKind?: number OnlyOneKind: number
nocancelid?: number nocancelid: number
NoCancelId?: number NoCancelId: number
gps_sid?: number, gps_sid: number,
GPS_SID?:boolean GPS_SID:boolean
score?:number score:number
xmmcStr?: string xmmcStr: string
desc?: string desc: string
xmdm?: number xmdm?: number
type?: 0 | 1 | 2 type?: 0 | 1 | 2
} }

View File

@ -397,7 +397,7 @@ export default class Judge {
} }
} }
private ksjs?: JudgeKSJS private ksjs?: JudgeKSJS
private kfArr?: JudgeEventKf[] private kfArr?: MarkRule[]
//所有的科目考试项目(大车&小车) //所有的科目考试项目(大车&小车)
private kmItems: JudgeConfigObjKmItems private kmItems: JudgeConfigObjKmItems
private plcData?: Plc private plcData?: Plc
@ -607,7 +607,7 @@ export default class Judge {
promptWxCode('17C55', temp.code || 0) 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) { if (xmdm == 20) {
return true return true
} }
@ -939,10 +939,10 @@ export default class Judge {
//扣分 //扣分
case 3: case 3:
const thisKf = this.getKfStr(`${kf.xmdm}_${kf.kfdm}`) const thisKf = this.getKfStr(`${kf.xmdm}_${kf.kfdm}`)
const kfObj: JudgeEventKf = { const kfObj: MarkRule = {
//扣分项目名称 //扣分项目名称
xmmcStr: this.getDqxmStr(kf.xmdm), xmmcStr: this.getDqxmStr(kf.xmdm),
xmdm: kf.xmdm, xmdm: kf.xmdm + "",
//扣分描述 //扣分描述
desc: thisKf.desc, desc: thisKf.desc,
//扣分分数 //扣分分数
@ -1055,7 +1055,7 @@ export default class Judge {
} }
// 更改考试状态 // 更改考试状态
goVoiceAnnounce = 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 beginProject = this.beginProject
const pointsDedute = this.pointsDedute const pointsDedute = this.pointsDedute
@ -1164,11 +1164,11 @@ export default class Judge {
(examSubject == '3' && judgeConfigObj['418'] == '1')) { (examSubject == '3' && judgeConfigObj['418'] == '1')) {
avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`]) 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) { if (isStart) {
await judgeTask.addTask(async () => { await judgeTask.addTask(async () => {
console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`) console.info(judgeTag, `项目扣分-${currentKf.markcatalog}-${currentKf.desc}`)
await pointsDedute(currentKf.xmdm, currentKf) await pointsDedute(Number(currentKf.xmdm), currentKf)
}, { }, {
isDelay: true isDelay: true
}) })
@ -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 carInfo = AppStorage.get<CarInfoType>('carInfo');
const examSubject = carInfo.examSubject const examSubject = carInfo.examSubject
const plateNo = carInfo.plateNo const plateNo = carInfo.plateNo