Compare commits
	
		
			2 Commits
		
	
	
		
			be462d6877
			...
			a7c85152a4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | a7c85152a4 | ||
|  | 86cf3f58d3 | 
| @ -53,11 +53,9 @@ export default class EntryAbility extends UIAbility { | ||||
| 
 | ||||
|   async onWindowStageCreate(windowStage: window.WindowStage) { | ||||
|     console.log(EntryTag, "onWindowStageCreate", "窗口创建完成") | ||||
|     try { | ||||
|       await UseAuth(this.context) | ||||
|       const windowClass = await windowStage.getMainWindow(); | ||||
|     let rect = windowClass.getWindowProperties().windowRect | ||||
|     let width = rect.width | ||||
|     let height = rect.height | ||||
|       AppStorage.setOrCreate<CarInfoType>('carInfo', {}) | ||||
|       AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {}) | ||||
|       AppStorage.setOrCreate<string>('lsh', '0000000000000') | ||||
| @ -66,11 +64,10 @@ export default class EntryAbility extends UIAbility { | ||||
|       AppStorage.setOrCreate<string>('deviceNo', "") //设备号 | ||||
|       AppStorage.setOrCreate<BaseInfoType>('baseInfo', { | ||||
|         hasAuth: false, | ||||
|       version: GlobalConfig.version.sz.km2[0] || "", | ||||
|       judgeVersion: GlobalConfig.version.sz.km2[1] || "", | ||||
|         // version: GlobalConfig.version.sz.km2[0] || "", | ||||
|         // judgeVersion: GlobalConfig.version.sz.km2[1] || "", | ||||
|         tcpSendNum: 0, | ||||
|         videoVersion: '1.0', | ||||
|       ratio: width / height, //适配比例 | ||||
|         pathDir: this.context.filesDir, | ||||
|         context: this.context, | ||||
|         isJudgeInitBool: false, | ||||
| @ -86,6 +83,9 @@ export default class EntryAbility extends UIAbility { | ||||
|           await windowClass.setWindowSystemBarEnable([]) //全屏 | ||||
|         } | ||||
|       } | ||||
|     } catch (e) { | ||||
|       console.error("onWindowStageCreate error", e) | ||||
|     } | ||||
|     windowStage.loadContent('pages/Index', (err, data) => { | ||||
|       if (err.code) { | ||||
|         hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||||
|  | ||||
| @ -79,8 +79,9 @@ export interface CommonType { | ||||
| // 基础信息 | ||||
| export interface BaseInfoType { | ||||
|   hasAuth?: boolean, | ||||
|   version?: string, | ||||
|   judgeVersion?: string, | ||||
| 
 | ||||
|   // version?: string, | ||||
|   // judgeVersion?: string, | ||||
|   tcpSendNum?: number, | ||||
|   videoVersion?: string, | ||||
|   ratio?: number, | ||||
|  | ||||
| @ -3,7 +3,7 @@ import router from '@ohos.router'; | ||||
| 
 | ||||
| import { HomeTag, InitTableTag, JudgeConfig } from '../config'; | ||||
| import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| import { BaseInfoType } from '../model/Common'; | ||||
| import { BaseInfoType, EnvironmentConfigurationType } from '../model/Common'; | ||||
| import { | ||||
|   CarInfoType, | ||||
|   ES_CARINFOType, | ||||
| @ -37,7 +37,6 @@ struct Index { | ||||
|   @State deviceId: string = ''; | ||||
|   @State angle: number = 0 | ||||
|   @State dialogRatio: number = 0.8 | ||||
|   @State ratio: number = 1700 / 960 | ||||
|   @State delLoading: boolean = false | ||||
|   @State initParamFlag: boolean = false | ||||
|   @State fd: number = -1; | ||||
| @ -47,6 +46,7 @@ struct Index { | ||||
|   @State initWork: boolean = false | ||||
|   @State status: string = "开始" | ||||
|   @State base64Img: string = "" | ||||
|   @State config: EnvironmentConfigurationType = {} | ||||
|   // 请求网络表等待弹窗 | ||||
|   customDialogController: CustomDialogController = new CustomDialogController({ | ||||
|     builder: CarLoadingComponent(), | ||||
| @ -59,19 +59,10 @@ struct Index { | ||||
|   private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context) | ||||
|   private timeInfo: TimeSynchronizationRspBody = {} | ||||
| 
 | ||||
|   @Styles | ||||
|   commStyle(){ | ||||
|     .width(220 * this.ratio * this.dialogRatio) | ||||
|     .height(69 * this.ratio * this.dialogRatio) | ||||
|     .backgroundImage($r('app.media.button_nor')) | ||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|   } | ||||
| 
 | ||||
|   async aboutToAppear() { | ||||
|     dConsole.log("权限首页 aboutToAppear") | ||||
|     const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO") | ||||
|     dConsole.log(HomeTag, "读取carinfo", result) | ||||
|     this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4 | ||||
|     this.angle = 0 | ||||
|     AppStorage.set('lsh', '1111111111111') | ||||
|     JudgeEmitterInstance.init() | ||||
| @ -93,6 +84,7 @@ struct Index { | ||||
|       this.isPlay = true | ||||
|     } | ||||
|     this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')! | ||||
|     this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')! | ||||
|     this.initParams() | ||||
| 
 | ||||
|     AppStorage.setOrCreate('singlePlay', false) | ||||
| @ -147,8 +139,8 @@ struct Index { | ||||
|     const param: InitializeTheCentralTableType = { | ||||
|       carId: this.carInfo?.carId, | ||||
|       examinationRoomId: this.carInfo?.examinationRoomId, | ||||
|       judgeVersion: this.baseInfo?.judgeVersion, | ||||
|       shellVersion: this.baseInfo?.version || "", | ||||
|       judgeVersion: this.config?.judgeVersion, | ||||
|       shellVersion: this.config?.version || "", | ||||
|       paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid, | ||||
|       kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid, | ||||
|       mode: this.timeInfo?.mode, | ||||
| @ -255,8 +247,8 @@ struct Index { | ||||
|       }) | ||||
| 
 | ||||
|       BottomMessageComponent({ | ||||
|         version: this.baseInfo.version, | ||||
|         judgeVersion: this.baseInfo.judgeVersion, | ||||
|         version: this.config.version, | ||||
|         judgeVersion: this.config.judgeVersion, | ||||
|         hasAuth: this.baseInfo.hasAuth, | ||||
|         examCarNumber: this.deviceId, | ||||
|         versionClick: () => { | ||||
|  | ||||
| @ -3,9 +3,9 @@ import { GlobalConfig, HomeTag } from '../../config'; | ||||
| import Prompt from '@system.prompt'; | ||||
| import { | ||||
|   ApiResponseType, | ||||
|   BaseInfoType, | ||||
|   CarConfigurationParamsType, | ||||
|   CarInfoType, | ||||
|   EnvironmentConfigurationType, | ||||
|   ObtainCarExamInfoParams, | ||||
|   ObtainCarExamInfoRspBody, | ||||
|   TimeSynchronizationParams, | ||||
| @ -56,7 +56,7 @@ export async function GetCarInfo(): Promise<CarInfoType> { | ||||
|     if (res.obtainCarExamInfoRsp && res.obtainCarExamInfoRsp.body) { | ||||
|       const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body! | ||||
|       carInfo.plateNo = decodeURIComponent(carInfo.plateNo) | ||||
|       dConsole.log("Worker received message car", JSON.stringify(carInfo)) | ||||
|       // dConsole.log("Worker received message car", JSON.stringify(carInfo)) | ||||
|       AppStorage.setOrCreate('carInfo', carInfo) | ||||
|       return carInfo | ||||
|     } | ||||
| @ -73,12 +73,12 @@ export async function GetCarInfo(): Promise<CarInfoType> { | ||||
| //获取时间同步 | ||||
| export async function SetCurrentTime(): Promise<void> { | ||||
|   let deviceNo: string = AppStorage.get<string>('deviceNo')!; | ||||
|   let baseInfo: BaseInfoType = AppStorage.get<BaseInfoType>('baseInfo')! | ||||
|   let config: EnvironmentConfigurationType = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')! | ||||
|   let params: TimeSynchronizationParams = { | ||||
|     time: dayTs(new Date()).format("YYYY-MM-DD HH:mm:ss"), | ||||
|     deviceNo, | ||||
|     version: baseInfo.version!, | ||||
|     judgeVersion: baseInfo.judgeVersion! | ||||
|     version: config.version!, | ||||
|     judgeVersion: config.judgeVersion! | ||||
|   } | ||||
|   let res: ApiResponseType = await timeSynchronization(params); | ||||
|   if (res.timeSynchronizationRsp?.body) { | ||||
|  | ||||
| @ -692,6 +692,8 @@ export struct JudgePage { | ||||
| 
 | ||||
|         //   操作区域,分数显示区域 | ||||
|         OperatingAreaComponent({ | ||||
|           kfArr: this.kfArr, | ||||
|           isAllProjectsEnd: this.isAllProjectsEnd, | ||||
|           totalScore: this.totalScore, | ||||
|           kszp: this.kszp, | ||||
|           examSubject: this.examSubject, | ||||
|  | ||||
| @ -182,7 +182,7 @@ export default class JudgeBusiness { | ||||
|     this.judgeUI.sd = ((param350 == 0 ? this.plcData.gps.sd : this.plcData.sensor.cs) as number * 1.852).toFixed(0) + '' | ||||
|     this.judgeUI.dw = (Math.floor(this.plcData.sensor.dw as number) || 0) + '' | ||||
| 
 | ||||
|     dConsole.info("小红球过程数据1", this.judgeBusiness.getIsUdpEnd(), this.judgeUI.kfArr) | ||||
|     // dConsole.info("小红球过程数据1", this.judgeBusiness.getIsUdpEnd(), this.judgeUI.kfArr) | ||||
| 
 | ||||
| 
 | ||||
|     DifferentialAndSignal.sendMsg({ | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| import { JudgeConfig, JudgeTag } from '../../config'; | ||||
| import { | ||||
|   BaseInfoType, | ||||
|   CAR_INFO, | ||||
|   CarInfoType, | ||||
|   CDSBInfo, | ||||
|   EnvironmentConfigurationType, | ||||
|   ExaminerInfoType, | ||||
|   ItemInfo, | ||||
|   ItemInfos, | ||||
| @ -431,7 +431,7 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl { | ||||
|     }) | ||||
|     const initInfo: JudgeInitObj = { | ||||
|       sdkver: await examJudgeVersion(), | ||||
|       appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "", | ||||
|       appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "", | ||||
|       kskm: Number(carInfo?.examSubject || "2"), | ||||
|       kchp: carInfo?.plateNo || "", | ||||
|       kchm: Number(carInfo?.carId || ""), | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| import { JudgeConfig, JudgeTag } from '../../config'; | ||||
| import { | ||||
|   BaseInfoType, | ||||
|   CAR_INFO, | ||||
|   CarInfoType, | ||||
|   CDSBInfo, | ||||
|   EnvironmentConfigurationType, | ||||
|   ExaminerInfoType, | ||||
|   ItemInfo, | ||||
|   ItemInfos, | ||||
| @ -129,7 +129,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl { | ||||
|     const mark: MarkRule[] = Object.values(markRuleListObj) | ||||
|     const initInfo: JudgeInitObj = { | ||||
|       sdkver: await examJudgeVersion(), | ||||
|       appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "", | ||||
|       appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "", | ||||
|       kskm: Number(carInfo?.examSubject || "2"), | ||||
|       kchp: carInfo?.plateNo || "", | ||||
|       kchm: Number(carInfo?.carId || ""), | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { DefaultJudgeConfigObj } from '../../../model/index' | ||||
| import { DefaultJudgeConfigObj, MarkRule } from '../../../model/index' | ||||
| import Prompt from '@system.prompt' | ||||
| 
 | ||||
| @Component | ||||
| @ -8,6 +8,8 @@ export default struct OperatingAreaComponent { | ||||
|   @Prop examSubject: string | ||||
|   @Prop singlePlay: boolean | ||||
|   @Prop judgeConfigObj: DefaultJudgeConfigObj | ||||
|   @Prop kfArr: MarkRule[] | ||||
|   @Prop isAllProjectsEnd: boolean | ||||
|   // 信号查看 | ||||
|   signalViewingClick: () => void = () => { | ||||
|   } | ||||
| @ -112,6 +114,14 @@ export default struct OperatingAreaComponent { | ||||
|         .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) | ||||
|         .backgroundImageSize({ width: '100%', height: '100%' }) | ||||
|         .onClick(() => { | ||||
|           //考试未结束且有扣分,不允许退出 | ||||
|           if (!this.singlePlay && Reflect.get(this.judgeConfigObj, '344') == "1" && this.kfArr.length > 0 && !this.isAllProjectsEnd) { | ||||
|             Prompt.showToast({ | ||||
|               message: '考试未结束且有扣分,不允许手动退出!', | ||||
|               duration: 4000 | ||||
|             }); | ||||
|             return | ||||
|           } | ||||
|           if (Reflect.get(this.judgeConfigObj, '353') == '0') { | ||||
|             // this.endExamDialogController.open() | ||||
|             this.endTheExamClick() | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import router from '@ohos.router' | ||||
| import { BaseInfoType, CarInfoType } from '../model/Common' | ||||
| import { BaseInfoType, CarInfoType, EnvironmentConfigurationType } from '../model/Common' | ||||
| import HeaderComponent from './compontents/Header' | ||||
| import BottomMessageComponent from './Index/BottomMessage' | ||||
| 
 | ||||
| @ -10,10 +10,12 @@ struct SettingPage { | ||||
|   @State url: string = '' | ||||
|   @State baseInfo: BaseInfoType = {} | ||||
|   @State carInfo: CarInfoType = {} | ||||
|   @State config: EnvironmentConfigurationType = {} | ||||
| 
 | ||||
|   aboutToAppear() { | ||||
|     this.carInfo = AppStorage.get<CarInfoType>('carInfo')! | ||||
|     this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')! | ||||
|     this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')! | ||||
|   } | ||||
| 
 | ||||
|   build() { | ||||
| @ -49,8 +51,8 @@ struct SettingPage { | ||||
| 
 | ||||
|       Column() { | ||||
|         BottomMessageComponent({ | ||||
|           version: this.baseInfo.version, | ||||
|           judgeVersion: this.baseInfo.judgeVersion, | ||||
|           version: this.config.version, | ||||
|           judgeVersion: this.config.judgeVersion, | ||||
|           hasAuth: this.baseInfo.hasAuth, | ||||
|           examCarNumber: this.carInfo.carNo, | ||||
|         }) | ||||
|  | ||||
| @ -13,7 +13,10 @@ import { OverWriteFile, ReadFileContent } from '../utils/Common'; | ||||
| @Entry | ||||
| @Component | ||||
| struct TerminalInfoPage { | ||||
|   @State config: EnvironmentConfigurationType = {} | ||||
|   @State config: EnvironmentConfigurationType = { | ||||
|     version: "2024.08.21.01", | ||||
|     judgeVersion: "2024.08.1" | ||||
|   } | ||||
|   @State isProcessing: boolean = false; | ||||
|   @State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt' | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
| @ -23,9 +26,14 @@ struct TerminalInfoPage { | ||||
|     dConsole.log(TerminalInfoTag, "data", data) | ||||
|     if (data) { | ||||
|       this.config = JSON.parse(data) | ||||
|       if (!this.config.version) { | ||||
|         this.config.version = "2024.08.21.01" | ||||
|       } | ||||
|       if (!this.config.judgeVersion) { | ||||
|         this.config.judgeVersion = "2024.08.1" | ||||
|       } | ||||
|       AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config) | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   async aboutToDisappear() { | ||||
|  | ||||
| @ -272,7 +272,7 @@ export function CloseFile(fd: number): Promise<boolean> { | ||||
| export function EditFile(fd: number, data: string): Promise<boolean> { | ||||
|   return new Promise((resolve, reject) => { | ||||
|     try { | ||||
|       console.log(LogTag, "写入数据:" + data) | ||||
|       // console.log(LogTag, "写入数据:" + data) | ||||
|       fs.writeSync(fd, data + "\n") | ||||
|       resolve(true) | ||||
|     } catch (e) { | ||||
|  | ||||
| @ -75,7 +75,7 @@ class logWorker { | ||||
| 
 | ||||
|   // 过程数据写入 | ||||
|   writeProcessData(type: ProcessDataEnumType, data: string) { | ||||
|     dConsole.log(LogTag, "传入过程数据", data) | ||||
|     // dConsole.log(LogTag, "传入过程数据", data) | ||||
|     let params: LogWorkerMessage = { | ||||
|       type: WorkerMessageType.WriteProcessData, | ||||
|       data, | ||||
|  | ||||
| @ -3,9 +3,7 @@ import { CarInfoType, CenterCallBackMsgType, EnvironmentConfigurationType, ExamD | ||||
| import { FillZero, NumberToByteArray } from '../Common'; | ||||
| import UdpClient, { MsgExt } from '../UdpUtils'; | ||||
| import { CenterUdpTag, UDPTag } from '../../config'; | ||||
| import { dConsole } from '../LogWorker'; | ||||
| 
 | ||||
| const Tag = "CenterUDPBusiness" | ||||
| 
 | ||||
| // 中心UDP业务逻辑 | ||||
| class CenterUDPBusiness { | ||||
| @ -46,12 +44,12 @@ class CenterUDPBusiness { | ||||
|       carNo: this.carInfo.carNo!, | ||||
|       placeId: this.carInfo.examinationRoomId! | ||||
|     } | ||||
|     dConsole.info(Tag, "发送中心数据", data) | ||||
|     // dConsole.info(Tag, "发送中心数据", data) | ||||
|     this.udp.sendMsgExt(data, lsh); | ||||
|   } | ||||
| 
 | ||||
|   sendMsgExt(id: number, body: number[], lsh: number) { | ||||
|     dConsole.info("中心udp", id, body, lsh) | ||||
|     // dConsole.info("中心udp", id, body, lsh) | ||||
|     this.udp.sendMsgExt({ | ||||
|       id: id, | ||||
|       list: body, | ||||
|  | ||||
| @ -42,7 +42,7 @@ function checkLsh() { | ||||
| 
 | ||||
| 
 | ||||
| workerPort.onmessage = async (e: MessageEvents) => { | ||||
|   console.log(WorkerTag, `Worker received message: ${e.data}`); | ||||
|   // console.log(WorkerTag, `Worker received message: ${e.data}`); | ||||
|   const result: WorkerMessage = JSON.parse(e.data); | ||||
|   switch (result.type) { | ||||
|     case WorkerMessageDataType.Init: { | ||||
|  | ||||
| @ -30,7 +30,7 @@ workerPort.onmessage = (e: MessageEvents) => { | ||||
|   } | ||||
|   // 写过程数据 | ||||
|   if (result.type === WorkerMessageType.WriteProcessData && result.processDataType) { | ||||
|     console.log(LogTag, "work收到过程数据") | ||||
|     // console.log(LogTag, "work收到过程数据") | ||||
|     WriteProcessData(result.processDataType, result.data || "") | ||||
|   } | ||||
|   //   关闭过程数据 | ||||
| @ -95,7 +95,7 @@ async function InitExam(dirName: string) { | ||||
| 
 | ||||
| // 写过程数据 | ||||
| async function WriteProcessData(type: ProcessDataEnumType, data: string) { | ||||
|   console.log(LogTag, "推入过程数据", type, data) | ||||
|   // console.log(LogTag, "推入过程数据", type, data) | ||||
|   if (fileFdArr.length === 0) { | ||||
|     return | ||||
|   } | ||||
| @ -109,7 +109,6 @@ async function WriteProcessData(type: ProcessDataEnumType, data: string) { | ||||
| async function processQueue() { | ||||
|   isProcessing = true; | ||||
|   while (writeQueue.length > 0 && isProcessing) { | ||||
|     console.log(LogTag, "处理过程数据") | ||||
|     const item = writeQueue.shift()!; | ||||
|     const index = Number(item.type); | ||||
|     try { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user