diff --git a/entry/src/main/ets/api/judge.ets b/entry/src/main/ets/api/judge.ets index 90851aa2..b80c0bf6 100644 --- a/entry/src/main/ets/api/judge.ets +++ b/entry/src/main/ets/api/judge.ets @@ -25,36 +25,33 @@ interface WR { } // 通用监管接口 -export async function writeObjectOut(params, filePath?: string): Promise { - const singlePlay = globalThis.singlePlay +export async function writeObjectOut(params: ESObject, filePath?: string): Promise { + const singlePlay: boolean = AppStorage.get('singlePlay') if (singlePlay) { return { code: 1 } } console.log('testsqlTag0') //获取监管接口地址路径 - if (!globalThis.JGPATH) { - console.log('testsqlTag1') + if (!globalThis.JGHOST) { const syssetParams = await getSyncData('MA_SYSSET') || []; - console.log('testsqlTag2') - //@ts-ignore syssetParams.forEach(sys => { if (sys.v_no == '839') { //是否是新监管 - globalThis.isJGNew = sys.v_value == '3' + // globalThis.isJGNew = sys.v_value == '3' + AppStorage.setOrCreate('isJGNew', sys.v_value == '3') } if (sys.v_no == '900') { - globalThis.JGHOST = validateIP(decodeURIComponent(sys.v_value)) + // globalThis.JGHOST = validateIP(decodeURIComponent(sys.v_value)) + AppStorage.setOrCreate('JGHOST', validateIP(decodeURIComponent(sys.v_value))) } }) } const { xtlb, jkxlh, jkid, drvexam } = params; - console.log('testsqlTag3') - + const isJGNew: boolean = AppStorage.get('isJGNew') //新监管调用 - if (globalThis.isJGNew) { - + if (isJGNew) { return await writeObjectOutNew(params, filePath) } drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp) @@ -76,8 +73,9 @@ export async function writeObjectOut(params, filePath?: string): Promise { } //对象转换成xml + const JGHOST: string = AppStorage.get("JGHOST") const temp = await request({ - host: globalThis.JGHOST as string, + host: JGHOST, url: '/dems_ws/services/TmriOutAccess?wsdl', data: ` = { @@ -21,21 +21,21 @@ interface WR { code: number } -export default async function writeObjectOutNew(data, filePath): Promise { - const context=AppStorage.get('context') +export default async function writeObjectOutNew(data, filePath: string): Promise { + const context: common.UIAbilityContext = AppStorage.get('context') const fileUtil = new FileUtil(context); - const { jkid, drvexam } = data; - const basic = await getBasicConfig(jkid); - const params = await getParams(jkid, drvexam); - const { wglb, jkxlh, glbm, jgbh, sjbs } = basic; + // const { jkid, drvexam } = data; + const basic = await getBasicConfig(data.jkid); + const params = await getParams(data.jkid, data.drvexam); + // const { wglb, jkxlh, glbm, jgbh, sjbs } = basic; if (filePath) { await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ - wglb, - jkxlh, - glbm, - jgbh, - sjbs, + wglb: basic.wglb, + jkxlh: basic.jkxlh, + glbm: basic.glbm, + jgbh: basic.jgbh, + sjbs: basic.sjbs, data: params.data, file: { ...params.file, param: [] @@ -62,11 +62,11 @@ export default async function writeObjectOutNew(data, filePath): Promise { > - ${wglb} - ${jkxlh} - ${glbm} - ${jgbh} - ${sjbs} + ${basic.wglb} + ${basic.jkxlh} + ${basic.glbm} + ${basic.jgbh} + ${basic.sjbs} ${JSON.stringify(params.data)} ${JSON.stringify(params.file)} @@ -84,8 +84,8 @@ export default async function writeObjectOutNew(data, filePath): Promise { return temp } -export async function getParams(jkid, drvexam) { - const examSubject = globalThis.carInfo.examSubject; +export async function getParams(jkid: string, drvexam: DrvexamType): Promise { + const examSubject: number = globalThis.carInfo.examSubject; switch (jkid) { //开始考试 case '17C51': @@ -95,7 +95,7 @@ export async function getParams(jkid, drvexam) { param: { sfzmhm: drvexam.sfzmhm, kchp: decodeURI(drvexam.kchp), - kskm: examSubject, + kskm: examSubject.toString(), ksxl: examSubject == 3 ? drvexam.ksxl : undefined, kssj: drvexam.kssj } @@ -103,7 +103,12 @@ export async function getParams(jkid, drvexam) { file: { sjbs: gjxlhObj[jkid], // param: [{ field: '', data: examSubject == 2 ? encodeURIComponent(drvexam.zp) : drvexam.zp }] - param: [{ field: '', data: drvexam.zp }] + param: [ + { + field: '', + data: drvexam.zp + } + ] } } //项目开始 @@ -114,12 +119,12 @@ export async function getParams(jkid, drvexam) { param: { sfzmhm: drvexam.sfzmhm, kskm: drvexam.kskm, - ksxm: drvexam.ksxm, ksxl: examSubject == 3 ? drvexam.ksxl : undefined, kchp: decodeURI(drvexam.kchp), //TODO 待验证 科目三无 sbbh: examSubject == 3 ? undefined : drvexam.sbxh, - kssj: drvexam.kssj + kssj: drvexam.kssj, + ksxm: drvexam.ksxm, } }, file: { @@ -137,7 +142,7 @@ export async function getParams(jkid, drvexam) { kfsj: drvexam.kfsj, kfxm: drvexam.kfxm, kfxmmx: drvexam.kfxmmx, - kskm: examSubject, + kskm: examSubject.toString(), ksxm: drvexam.ksxm, sfzmhm: drvexam.sfzmhm } @@ -172,7 +177,7 @@ export async function getParams(jkid, drvexam) { param: { czlx: drvexam.czlx, jssj: drvexam.jssj, - kskm: examSubject, + kskm: examSubject.toString(), ksxl: drvexam.ksxl, sbbh: examSubject == 3 ? undefined : drvexam.sbxh, ksxm: drvexam.ksxm, @@ -192,7 +197,7 @@ export async function getParams(jkid, drvexam) { ghks: "0", jssj: drvexam.jssj, kscj: drvexam.kscj, - kskm: examSubject, + kskm: examSubject.toString(), kslc: drvexam.kslc, sfzmhm: drvexam.sfzmhm }, @@ -210,11 +215,9 @@ async function getBasicConfig(jkid) { const examSubject = globalThis.carInfo.examSubject; const syssetParam = await getSyncData('MA_SYSSET'); let syssetObj = {}; - //@ts-ignore syssetParam.forEach(sys => { syssetObj[sys.v_no] = decodeURIComponent(sys.v_value) }); - return { //外挂类别 wglb: examSubject == 2 ? "700203" : "700204", diff --git a/entry/src/main/ets/model/CarCheck.ets b/entry/src/main/ets/model/CarCheck.ets index 7fa1ea66..b241929f 100644 --- a/entry/src/main/ets/model/CarCheck.ets +++ b/entry/src/main/ets/model/CarCheck.ets @@ -18,11 +18,13 @@ export interface CarConfigurationParams { body: Record; } +// 车辆信息 export interface CarInfoType { carId?: string; examinationRoomId?: string; plateNo?: string; carNo?: string; + examSubject?: string; } diff --git a/entry/src/main/ets/model/Judge.ets b/entry/src/main/ets/model/Judge.ets index 7254b7bb..02575f50 100644 --- a/entry/src/main/ets/model/Judge.ets +++ b/entry/src/main/ets/model/Judge.ets @@ -1,13 +1,98 @@ +// ------------------------------ +// 基础共用类型 +// ------------------------------ + +/** 基础考试字段 */ +interface BaseExamFields { + kchp?: string; + sfzmhm?: string; + ksxl?: string; + kssj?: string; + kskm?: string; + ksxm?: string; + kscj?: string; + kslc?: string; + dwlc?: string; + zpsj?: string; + jssj?: string; + czlx?: string; + cs?: string; +} + +// ------------------------------ +// 独立接口 +// ------------------------------ + +/** Amplify 项目配置 */ export interface AmplifyItem { name: string; projectCode: string; projectCodeCenter: string; } +/** UDP 通信参数 */ export interface UDPParamType { id?: number; list?: number[]; carNo?: string; placeId?: string; sendCallback?: () => void; +} + +/** 扣分代码项 */ +export interface KfdmType { + xmdm: number; + kfdm: string; + markreal: number; + markcatalog: string; + score: number; +} + +// ------------------------------ +// 考试评判相关类型 +// ------------------------------ + +/** 评判文件数据项 */ +interface JudgeFileParam { + field?: string; + data?: string; +} + +/** 评判请求参数 */ +export interface GetJudgeParamsType { + data?: JudgeData; + file?: JudgeFile; +} + +/** 评判数据主体 */ +interface JudgeData { + sjbs?: string; + param?: JudgeParams; +} + +/** 考试评判参数 */ +interface JudgeParams extends BaseExamFields { + sbbh?: string; + kffs?: string; + kfsj?: string; + kfxm?: string; + kfxmmx?: string; + ghks?: string; +} + +/** 评判文件结构 */ +interface JudgeFile { + sjbs?: string; + param?: JudgeFileParam[]; +} + +/** 考试过程数据 */ +export interface DrvexamType extends BaseExamFields { + zp?: string; + sbxh?: string; + kffs?: string; + kfsj?: string; + kfxm?: string; + kfxmmx?: string; + ghks?: string; } \ No newline at end of file diff --git a/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets b/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets index 1eea85d2..471dff72 100644 --- a/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets +++ b/entry/src/main/ets/pages/compontents/judge/BoardPrePareSetPopup.ets @@ -8,6 +8,7 @@ import { MarkRule, SYSSET } from '../../judgeSDK/api/judgeSDK.d'; import { writeObjectOut } from '../../../api/judge'; import JudgeTask from '../../judgeSDK/utils/judgeTask'; import FilePhoto from '../../judgeSDK/utils/filePhoto'; +import { CarInfoType, KfdmType } from '../../../model'; interface SEL { fontColor: string @@ -27,13 +28,7 @@ export default struct DeductedPopup { @State ksxl: string = '' @State score: number = 100; @State judgeConfigObj: { [k: string]: any } = {} - @State kfdmArr: { - xmdm: number, - kfdm: string, - markreal: number, - markcatalog: string - score: number - }[] = [] + @State kfdmArr: KfdmType[] = [] //开始考试前判绕车一周评判是否开启 @State isOpen: boolean = false //监管序列号 @@ -51,27 +46,26 @@ export default struct DeductedPopup { @State manualMarkRules: MarkRule[] = [] @State lineBg: Array = ['#4D4136', '#26231E'] @State selectedLine: number = undefined - @State carInfo: object = {} + @State carInfo: CarInfoType = {} @State singlePlay: boolean = false @State selectedLineStyle: SEL = { fontColor: '#FFF', bgColor: '#B36E00' } + private context = getContext(this) as common.UIAbilityContext; + private judgeTask: JudgeTask + private filePhoto: FilePhoto // 过程照片拍照 getPhoto = async (empty?: boolean) => { //单机模式返回空照片 if (this.singlePlay) { return '' } else { - const { filePhoto } = this; - const photoBase64 = await filePhoto.getPhoto(); + const photoBase64 = await this.filePhoto.getPhoto(); return photoBase64 } } - private context = getContext(this) as common.UIAbilityContext; - private judgeTask: JudgeTask - private filePhoto: FilePhoto - private avPlayer + private avPlayer: VoiceAnnounce async aboutToAppear() { this.carInfo = AppStorage.get('carInfo') @@ -82,8 +76,7 @@ export default struct DeductedPopup { this.filePhoto = mediaTest //上车准备 // this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+'')) - const { isTrajectoryOpen } = judgeConfig; - if (isTrajectoryOpen) { + if (judgeConfig.isTrajectoryOpen) { await this.initDb() } else { await this.initSysset() @@ -595,10 +588,8 @@ export default struct DeductedPopup { private closePopup: Function = () => { } - private confirmMark: Function = (itemno: number, serial: string) => { } - private endLoading: Function = () => { } } \ No newline at end of file