Compare commits

...

2 Commits

Author SHA1 Message Date
wangzhongjie
a7c85152a4 fix: 评判版本修改 2025-10-30 15:59:57 +08:00
wangzhongjie
86cf3f58d3 fix: 删除不必要的打印 2025-10-29 17:56:52 +08:00
16 changed files with 85 additions and 73 deletions

View File

@ -53,11 +53,9 @@ export default class EntryAbility extends UIAbility {
async onWindowStageCreate(windowStage: window.WindowStage) { async onWindowStageCreate(windowStage: window.WindowStage) {
console.log(EntryTag, "onWindowStageCreate", "窗口创建完成") console.log(EntryTag, "onWindowStageCreate", "窗口创建完成")
try {
await UseAuth(this.context) await UseAuth(this.context)
const windowClass = await windowStage.getMainWindow(); const windowClass = await windowStage.getMainWindow();
let rect = windowClass.getWindowProperties().windowRect
let width = rect.width
let height = rect.height
AppStorage.setOrCreate<CarInfoType>('carInfo', {}) AppStorage.setOrCreate<CarInfoType>('carInfo', {})
AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {}) AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {})
AppStorage.setOrCreate<string>('lsh', '0000000000000') AppStorage.setOrCreate<string>('lsh', '0000000000000')
@ -66,11 +64,10 @@ export default class EntryAbility extends UIAbility {
AppStorage.setOrCreate<string>('deviceNo', "") //设备号 AppStorage.setOrCreate<string>('deviceNo', "") //设备号
AppStorage.setOrCreate<BaseInfoType>('baseInfo', { AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
hasAuth: false, hasAuth: false,
version: GlobalConfig.version.sz.km2[0] || "", // version: GlobalConfig.version.sz.km2[0] || "",
judgeVersion: GlobalConfig.version.sz.km2[1] || "", // judgeVersion: GlobalConfig.version.sz.km2[1] || "",
tcpSendNum: 0, tcpSendNum: 0,
videoVersion: '1.0', videoVersion: '1.0',
ratio: width / height, //适配比例
pathDir: this.context.filesDir, pathDir: this.context.filesDir,
context: this.context, context: this.context,
isJudgeInitBool: false, isJudgeInitBool: false,
@ -86,6 +83,9 @@ export default class EntryAbility extends UIAbility {
await windowClass.setWindowSystemBarEnable([]) //全屏 await windowClass.setWindowSystemBarEnable([]) //全屏
} }
} }
} catch (e) {
console.error("onWindowStageCreate error", e)
}
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

@ -79,8 +79,9 @@ export interface CommonType {
// 基础信息 // 基础信息
export interface BaseInfoType { export interface BaseInfoType {
hasAuth?: boolean, hasAuth?: boolean,
version?: string,
judgeVersion?: string, // version?: string,
// judgeVersion?: string,
tcpSendNum?: number, tcpSendNum?: number,
videoVersion?: string, videoVersion?: string,
ratio?: number, ratio?: number,

View File

@ -3,7 +3,7 @@ import router from '@ohos.router';
import { HomeTag, InitTableTag, JudgeConfig } from '../config'; import { HomeTag, InitTableTag, JudgeConfig } from '../config';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { BaseInfoType } from '../model/Common'; import { BaseInfoType, EnvironmentConfigurationType } from '../model/Common';
import { import {
CarInfoType, CarInfoType,
ES_CARINFOType, ES_CARINFOType,
@ -37,7 +37,6 @@ struct Index {
@State deviceId: string = ''; @State deviceId: string = '';
@State angle: number = 0 @State angle: number = 0
@State dialogRatio: number = 0.8 @State dialogRatio: number = 0.8
@State ratio: number = 1700 / 960
@State delLoading: boolean = false @State delLoading: boolean = false
@State initParamFlag: boolean = false @State initParamFlag: boolean = false
@State fd: number = -1; @State fd: number = -1;
@ -47,6 +46,7 @@ struct Index {
@State initWork: boolean = false @State initWork: boolean = false
@State status: string = "开始" @State status: string = "开始"
@State base64Img: string = "" @State base64Img: string = ""
@State config: EnvironmentConfigurationType = {}
// 请求网络表等待弹窗 // 请求网络表等待弹窗
customDialogController: CustomDialogController = new CustomDialogController({ customDialogController: CustomDialogController = new CustomDialogController({
builder: CarLoadingComponent(), builder: CarLoadingComponent(),
@ -59,19 +59,10 @@ struct Index {
private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context) private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context)
private timeInfo: TimeSynchronizationRspBody = {} 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() { async aboutToAppear() {
dConsole.log("权限首页 aboutToAppear") dConsole.log("权限首页 aboutToAppear")
const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO") const result = await GetSyncData<ES_CARINFOType>("ES_CARINFO")
dConsole.log(HomeTag, "读取carinfo", result) dConsole.log(HomeTag, "读取carinfo", result)
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
this.angle = 0 this.angle = 0
AppStorage.set('lsh', '1111111111111') AppStorage.set('lsh', '1111111111111')
JudgeEmitterInstance.init() JudgeEmitterInstance.init()
@ -93,6 +84,7 @@ struct Index {
this.isPlay = true this.isPlay = true
} }
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')! this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
this.initParams() this.initParams()
AppStorage.setOrCreate('singlePlay', false) AppStorage.setOrCreate('singlePlay', false)
@ -147,8 +139,8 @@ struct Index {
const param: InitializeTheCentralTableType = { const param: InitializeTheCentralTableType = {
carId: this.carInfo?.carId, carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId, examinationRoomId: this.carInfo?.examinationRoomId,
judgeVersion: this.baseInfo?.judgeVersion, judgeVersion: this.config?.judgeVersion,
shellVersion: this.baseInfo?.version || "", shellVersion: this.config?.version || "",
paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid, paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid,
kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid, kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid,
mode: this.timeInfo?.mode, mode: this.timeInfo?.mode,
@ -255,8 +247,8 @@ struct Index {
}) })
BottomMessageComponent({ BottomMessageComponent({
version: this.baseInfo.version, version: this.config.version,
judgeVersion: this.baseInfo.judgeVersion, judgeVersion: this.config.judgeVersion,
hasAuth: this.baseInfo.hasAuth, hasAuth: this.baseInfo.hasAuth,
examCarNumber: this.deviceId, examCarNumber: this.deviceId,
versionClick: () => { versionClick: () => {

View File

@ -3,9 +3,9 @@ import { GlobalConfig, HomeTag } from '../../config';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import { import {
ApiResponseType, ApiResponseType,
BaseInfoType,
CarConfigurationParamsType, CarConfigurationParamsType,
CarInfoType, CarInfoType,
EnvironmentConfigurationType,
ObtainCarExamInfoParams, ObtainCarExamInfoParams,
ObtainCarExamInfoRspBody, ObtainCarExamInfoRspBody,
TimeSynchronizationParams, TimeSynchronizationParams,
@ -56,7 +56,7 @@ export async function GetCarInfo(): Promise<CarInfoType> {
if (res.obtainCarExamInfoRsp && res.obtainCarExamInfoRsp.body) { if (res.obtainCarExamInfoRsp && res.obtainCarExamInfoRsp.body) {
const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body! const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body!
carInfo.plateNo = decodeURIComponent(carInfo.plateNo) 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) AppStorage.setOrCreate('carInfo', carInfo)
return carInfo return carInfo
} }
@ -73,12 +73,12 @@ export async function GetCarInfo(): Promise<CarInfoType> {
//获取时间同步 //获取时间同步
export async function SetCurrentTime(): Promise<void> { export async function SetCurrentTime(): Promise<void> {
let deviceNo: string = AppStorage.get<string>('deviceNo')!; let deviceNo: string = AppStorage.get<string>('deviceNo')!;
let baseInfo: BaseInfoType = AppStorage.get<BaseInfoType>('baseInfo')! let config: EnvironmentConfigurationType = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
let params: TimeSynchronizationParams = { let params: TimeSynchronizationParams = {
time: dayTs(new Date()).format("YYYY-MM-DD HH:mm:ss"), time: dayTs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
deviceNo, deviceNo,
version: baseInfo.version!, version: config.version!,
judgeVersion: baseInfo.judgeVersion! judgeVersion: config.judgeVersion!
} }
let res: ApiResponseType = await timeSynchronization(params); let res: ApiResponseType = await timeSynchronization(params);
if (res.timeSynchronizationRsp?.body) { if (res.timeSynchronizationRsp?.body) {

View File

@ -692,6 +692,8 @@ export struct JudgePage {
// 操作区域,分数显示区域 // 操作区域,分数显示区域
OperatingAreaComponent({ OperatingAreaComponent({
kfArr: this.kfArr,
isAllProjectsEnd: this.isAllProjectsEnd,
totalScore: this.totalScore, totalScore: this.totalScore,
kszp: this.kszp, kszp: this.kszp,
examSubject: this.examSubject, examSubject: this.examSubject,

View File

@ -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.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) + '' 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({ DifferentialAndSignal.sendMsg({

View File

@ -1,9 +1,9 @@
import { JudgeConfig, JudgeTag } from '../../config'; import { JudgeConfig, JudgeTag } from '../../config';
import { import {
BaseInfoType,
CAR_INFO, CAR_INFO,
CarInfoType, CarInfoType,
CDSBInfo, CDSBInfo,
EnvironmentConfigurationType,
ExaminerInfoType, ExaminerInfoType,
ItemInfo, ItemInfo,
ItemInfos, ItemInfos,
@ -431,7 +431,7 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl {
}) })
const initInfo: JudgeInitObj = { const initInfo: JudgeInitObj = {
sdkver: await examJudgeVersion(), sdkver: await examJudgeVersion(),
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "", appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "",
kskm: Number(carInfo?.examSubject || "2"), kskm: Number(carInfo?.examSubject || "2"),
kchp: carInfo?.plateNo || "", kchp: carInfo?.plateNo || "",
kchm: Number(carInfo?.carId || ""), kchm: Number(carInfo?.carId || ""),

View File

@ -1,9 +1,9 @@
import { JudgeConfig, JudgeTag } from '../../config'; import { JudgeConfig, JudgeTag } from '../../config';
import { import {
BaseInfoType,
CAR_INFO, CAR_INFO,
CarInfoType, CarInfoType,
CDSBInfo, CDSBInfo,
EnvironmentConfigurationType,
ExaminerInfoType, ExaminerInfoType,
ItemInfo, ItemInfo,
ItemInfos, ItemInfos,
@ -129,7 +129,7 @@ export class SmallJudge extends BaseJudge implements BaseJudgeImpl {
const mark: MarkRule[] = Object.values(markRuleListObj) const mark: MarkRule[] = Object.values(markRuleListObj)
const initInfo: JudgeInitObj = { const initInfo: JudgeInitObj = {
sdkver: await examJudgeVersion(), sdkver: await examJudgeVersion(),
appver: AppStorage.get<BaseInfoType>('baseInfo')?.version || "", appver: AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfigurationType')?.version || "",
kskm: Number(carInfo?.examSubject || "2"), kskm: Number(carInfo?.examSubject || "2"),
kchp: carInfo?.plateNo || "", kchp: carInfo?.plateNo || "",
kchm: Number(carInfo?.carId || ""), kchm: Number(carInfo?.carId || ""),

View File

@ -1,4 +1,4 @@
import { DefaultJudgeConfigObj } from '../../../model/index' import { DefaultJudgeConfigObj, MarkRule } from '../../../model/index'
import Prompt from '@system.prompt' import Prompt from '@system.prompt'
@Component @Component
@ -8,6 +8,8 @@ export default struct OperatingAreaComponent {
@Prop examSubject: string @Prop examSubject: string
@Prop singlePlay: boolean @Prop singlePlay: boolean
@Prop judgeConfigObj: DefaultJudgeConfigObj @Prop judgeConfigObj: DefaultJudgeConfigObj
@Prop kfArr: MarkRule[]
@Prop isAllProjectsEnd: boolean
// 信号查看 // 信号查看
signalViewingClick: () => void = () => { signalViewingClick: () => void = () => {
} }
@ -112,6 +114,14 @@ export default struct OperatingAreaComponent {
.backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat) .backgroundImage($rawfile('judge/anniu_nor.png'), ImageRepeat.NoRepeat)
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => { .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') { if (Reflect.get(this.judgeConfigObj, '353') == '0') {
// this.endExamDialogController.open() // this.endExamDialogController.open()
this.endTheExamClick() this.endTheExamClick()

View File

@ -1,5 +1,5 @@
import router from '@ohos.router' import router from '@ohos.router'
import { BaseInfoType, CarInfoType } from '../model/Common' import { BaseInfoType, CarInfoType, EnvironmentConfigurationType } from '../model/Common'
import HeaderComponent from './compontents/Header' import HeaderComponent from './compontents/Header'
import BottomMessageComponent from './Index/BottomMessage' import BottomMessageComponent from './Index/BottomMessage'
@ -10,10 +10,12 @@ struct SettingPage {
@State url: string = '' @State url: string = ''
@State baseInfo: BaseInfoType = {} @State baseInfo: BaseInfoType = {}
@State carInfo: CarInfoType = {} @State carInfo: CarInfoType = {}
@State config: EnvironmentConfigurationType = {}
aboutToAppear() { aboutToAppear() {
this.carInfo = AppStorage.get<CarInfoType>('carInfo')! this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')! this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')!
this.config = AppStorage.get<EnvironmentConfigurationType>('EnvironmentConfiguration')!
} }
build() { build() {
@ -49,8 +51,8 @@ struct SettingPage {
Column() { Column() {
BottomMessageComponent({ BottomMessageComponent({
version: this.baseInfo.version, version: this.config.version,
judgeVersion: this.baseInfo.judgeVersion, judgeVersion: this.config.judgeVersion,
hasAuth: this.baseInfo.hasAuth, hasAuth: this.baseInfo.hasAuth,
examCarNumber: this.carInfo.carNo, examCarNumber: this.carInfo.carNo,
}) })

View File

@ -13,7 +13,10 @@ import { OverWriteFile, ReadFileContent } from '../utils/Common';
@Entry @Entry
@Component @Component
struct TerminalInfoPage { struct TerminalInfoPage {
@State config: EnvironmentConfigurationType = {} @State config: EnvironmentConfigurationType = {
version: "2024.08.21.01",
judgeVersion: "2024.08.1"
}
@State isProcessing: boolean = false; @State isProcessing: boolean = false;
@State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt' @State IpConfigFilePath: string = GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
@ -23,9 +26,14 @@ struct TerminalInfoPage {
dConsole.log(TerminalInfoTag, "data", data) dConsole.log(TerminalInfoTag, "data", data)
if (data) { if (data) {
this.config = JSON.parse(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) AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", this.config)
} }
} }
async aboutToDisappear() { async aboutToDisappear() {

View File

@ -272,7 +272,7 @@ export function CloseFile(fd: number): Promise<boolean> {
export function EditFile(fd: number, data: string): Promise<boolean> { export function EditFile(fd: number, data: string): Promise<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
console.log(LogTag, "写入数据:" + data) // console.log(LogTag, "写入数据:" + data)
fs.writeSync(fd, data + "\n") fs.writeSync(fd, data + "\n")
resolve(true) resolve(true)
} catch (e) { } catch (e) {

View File

@ -75,7 +75,7 @@ class logWorker {
// 过程数据写入 // 过程数据写入
writeProcessData(type: ProcessDataEnumType, data: string) { writeProcessData(type: ProcessDataEnumType, data: string) {
dConsole.log(LogTag, "传入过程数据", data) // dConsole.log(LogTag, "传入过程数据", data)
let params: LogWorkerMessage = { let params: LogWorkerMessage = {
type: WorkerMessageType.WriteProcessData, type: WorkerMessageType.WriteProcessData,
data, data,

View File

@ -3,9 +3,7 @@ import { CarInfoType, CenterCallBackMsgType, EnvironmentConfigurationType, ExamD
import { FillZero, NumberToByteArray } from '../Common'; import { FillZero, NumberToByteArray } from '../Common';
import UdpClient, { MsgExt } from '../UdpUtils'; import UdpClient, { MsgExt } from '../UdpUtils';
import { CenterUdpTag, UDPTag } from '../../config'; import { CenterUdpTag, UDPTag } from '../../config';
import { dConsole } from '../LogWorker';
const Tag = "CenterUDPBusiness"
// 中心UDP业务逻辑 // 中心UDP业务逻辑
class CenterUDPBusiness { class CenterUDPBusiness {
@ -46,12 +44,12 @@ class CenterUDPBusiness {
carNo: this.carInfo.carNo!, carNo: this.carInfo.carNo!,
placeId: this.carInfo.examinationRoomId! placeId: this.carInfo.examinationRoomId!
} }
dConsole.info(Tag, "发送中心数据", data) // dConsole.info(Tag, "发送中心数据", data)
this.udp.sendMsgExt(data, lsh); this.udp.sendMsgExt(data, lsh);
} }
sendMsgExt(id: number, body: number[], lsh: number) { sendMsgExt(id: number, body: number[], lsh: number) {
dConsole.info("中心udp", id, body, lsh) // dConsole.info("中心udp", id, body, lsh)
this.udp.sendMsgExt({ this.udp.sendMsgExt({
id: id, id: id,
list: body, list: body,

View File

@ -42,7 +42,7 @@ function checkLsh() {
workerPort.onmessage = async (e: MessageEvents) => { 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); const result: WorkerMessage = JSON.parse(e.data);
switch (result.type) { switch (result.type) {
case WorkerMessageDataType.Init: { case WorkerMessageDataType.Init: {

View File

@ -30,7 +30,7 @@ workerPort.onmessage = (e: MessageEvents) => {
} }
// 写过程数据 // 写过程数据
if (result.type === WorkerMessageType.WriteProcessData && result.processDataType) { if (result.type === WorkerMessageType.WriteProcessData && result.processDataType) {
console.log(LogTag, "work收到过程数据") // console.log(LogTag, "work收到过程数据")
WriteProcessData(result.processDataType, result.data || "") WriteProcessData(result.processDataType, result.data || "")
} }
// 关闭过程数据 // 关闭过程数据
@ -95,7 +95,7 @@ async function InitExam(dirName: string) {
// 写过程数据 // 写过程数据
async function WriteProcessData(type: ProcessDataEnumType, data: string) { async function WriteProcessData(type: ProcessDataEnumType, data: string) {
console.log(LogTag, "推入过程数据", type, data) // console.log(LogTag, "推入过程数据", type, data)
if (fileFdArr.length === 0) { if (fileFdArr.length === 0) {
return return
} }
@ -109,7 +109,6 @@ async function WriteProcessData(type: ProcessDataEnumType, data: string) {
async function processQueue() { async function processQueue() {
isProcessing = true; isProcessing = true;
while (writeQueue.length > 0 && isProcessing) { while (writeQueue.length > 0 && isProcessing) {
console.log(LogTag, "处理过程数据")
const item = writeQueue.shift()!; const item = writeQueue.shift()!;
const index = Number(item.type); const index = Number(item.type);
try { try {