dev #2
@ -204,7 +204,7 @@ export struct JudgePage {
|
||||
async aboutToDisappear() {
|
||||
this.generateExamRecordsDialogController.close()
|
||||
this.signalTrajectoryDialogController.close()
|
||||
this.judgeBusiness.close()
|
||||
// this.judgeBusiness.close()
|
||||
clearInterval(this.mileageTimer)
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ import { endRecordVideo, saveStartRecordVideo } from '../../utils/Video'
|
||||
import router from '@ohos.router'
|
||||
import { GetSyncData, UpdateTableByArray } from '../../utils/table/Operation'
|
||||
import { CurrentProjectConversion, DeductionProjectConversion, DetectingDifferences, GetCarStatus } from './utils'
|
||||
import { DifferentialSignal } from '../../utils/business/DifferentialSignal'
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
|
||||
|
||||
|
||||
@ -73,7 +72,11 @@ export const SetJudgeItem = async (itemno: string, type: 1 | 2) => {
|
||||
}
|
||||
|
||||
export class BaseJudge {
|
||||
protected isUdpEnd: boolean = false
|
||||
private isUdpEnd: boolean = false
|
||||
|
||||
getIsUdpEnd() {
|
||||
return this.isUdpEnd
|
||||
}
|
||||
|
||||
async goJudgeVoice(sound: JudgeSound, avPlayer: VoiceAnnounce) {
|
||||
dConsole.info(JudgeTag, 'surenjun code=>', JSON.stringify(sound.code))
|
||||
|
||||
@ -22,9 +22,7 @@ import { examJudgeRealExam } from './JudgeSDKUtils'
|
||||
import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker'
|
||||
import { PlcStrToJson, PlcStrToWXJson } from './utils'
|
||||
import { BaseJudgeImpl, SetJudgeItem } from './BaseJudgeBussines'
|
||||
import { JudgePage } from '../Judge';
|
||||
import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusiness'
|
||||
import { ObtainUdpBusinessInstance } from '../../utils/business/ObtainUdpBusiness'
|
||||
import { JudgePage } from '../Judge'
|
||||
|
||||
export default class JudgeBusiness {
|
||||
public mndgStr: string | undefined
|
||||
@ -63,13 +61,6 @@ export default class JudgeBusiness {
|
||||
private tempData?: PLCType
|
||||
// 是否发送udp
|
||||
private judgeBusiness: BaseJudgeImpl
|
||||
private onObdCallback = (data: string) => {
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
if (result.type === WorkerBackMessageType.ObtainUdpData) {
|
||||
this.HandlePLCData(result.data as string)
|
||||
dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string)
|
||||
}
|
||||
}
|
||||
|
||||
constructor(judgeUI: JudgePage) {
|
||||
this.judgeUI = judgeUI
|
||||
@ -138,10 +129,22 @@ export default class JudgeBusiness {
|
||||
this.judgeBusiness.JudgeEnd(this.judgeUI, this, isManual)
|
||||
}
|
||||
|
||||
close() {
|
||||
DifferentialAndSignal.offMsg(this.onObdCallback)
|
||||
}
|
||||
|
||||
private onObdCallback = (data: string) => {
|
||||
const result: WorkerBackMessage = JSON.parse(data)
|
||||
if (result.type === WorkerBackMessageType.ObtainUdpData) {
|
||||
this.HandlePLCData(result.data as string)
|
||||
dConsole.writeProcessData(ProcessDataEnumType.PlcData, result.data as string)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理PLC数据
|
||||
private async HandlePLCData(msg: string) {
|
||||
const plcArr = msg.split(',')
|
||||
if (plcArr[0] != '#DN_GD' || this.isExamEnd) {
|
||||
if (plcArr[0] != '#DN_GD' || this.judgeBusiness.getIsUdpEnd()) {
|
||||
return
|
||||
}
|
||||
const gpsPart = msg.split("#END$GPS,")[1];
|
||||
@ -172,6 +175,9 @@ 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)
|
||||
|
||||
|
||||
DifferentialAndSignal.sendMsg({
|
||||
type: WorkerMessageDataType.JudgeSend, data: {
|
||||
performInfo: this.performInfo,
|
||||
@ -195,9 +201,5 @@ export default class JudgeBusiness {
|
||||
await examJudgeRealExam(this.plcData)
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
DifferentialAndSignal.offMsg(this.onObdCallback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,8 +40,8 @@ export class LargeJudge extends BaseJudge implements BaseJudgeImpl {
|
||||
private mockLight: boolean = false
|
||||
private mode: number = 1
|
||||
|
||||
getIsUdpEnd() {
|
||||
return super.isUdpEnd
|
||||
getIsUdpEnd(): boolean {
|
||||
return super.getIsUdpEnd()
|
||||
}
|
||||
|
||||
public async JudgeInit(judgeUI: JudgePage, that: JudgeBusiness): Promise<GetSysSetResult> {
|
||||
|
||||
@ -36,10 +36,8 @@ import systemDateTime from '@ohos.systemDateTime';
|
||||
import { testKm2Items, testKm3Items } from '../../mock/Judge';
|
||||
|
||||
export class SmallJudge extends BaseJudge implements BaseJudgeImpl {
|
||||
|
||||
|
||||
getIsUdpEnd() {
|
||||
return super.isUdpEnd
|
||||
getIsUdpEnd(): boolean {
|
||||
return super.getIsUdpEnd()
|
||||
}
|
||||
|
||||
public async GetJudgeBeginData(projects: Project[], carType: string, kssycs: string, isDdxk: boolean, ddxkTime: number, projectsCenterObj: Object, ddxkKsxmArr: string[], ddxkKfArr: string[], passingScore: number, wayno: number, name: string, lsh: string, idCard: string, isExam: boolean) {
|
||||
|
||||
@ -14,9 +14,8 @@ import {
|
||||
} from '../../model';
|
||||
|
||||
import { JudgeConfig } from '../../config';
|
||||
import { FillZero, FormatTimeFlexible, NumberToByteArray, StringToASCII } from '../Common';
|
||||
import { FillZero, NumberToByteArray, StringToASCII } from '../Common';
|
||||
import UdpClient, { MsgExt } from '../UdpUtils';
|
||||
import { CenterUDPBusinessInstance } from './CenterUdpBusiness';
|
||||
import systemTime from '@ohos.systemDateTime';
|
||||
import { SerialNumberInstance } from '../SerialNumber';
|
||||
import { GetCenterProjectStatus, GetDwStatusType, GetTranslateSignals } from '../../pages/Judge/utils';
|
||||
@ -28,15 +27,15 @@ const Tag = "JudgeUdpBusiness"
|
||||
|
||||
class JudgeUdpBusiness {
|
||||
private static instance: JudgeUdpBusiness
|
||||
public business: JudgeUDPData | null = null
|
||||
public performInfo: JudgePerformInfo | null = null
|
||||
public isUDPEnd: boolean = false
|
||||
public isExamEnd: boolean = false
|
||||
private udp: UdpClient = new UdpClient()
|
||||
private carInfo: CarInfoType = {}
|
||||
private singlePlay: boolean = false
|
||||
private lsh: string = ""
|
||||
private serialIndex: number = 1
|
||||
public business: JudgeUDPData | null = null
|
||||
public performInfo: JudgePerformInfo | null = null
|
||||
public isUDPEnd: boolean = false
|
||||
public isExamEnd: boolean = false
|
||||
|
||||
constructor() {
|
||||
if (!JudgeUdpBusiness.instance) {
|
||||
@ -75,8 +74,8 @@ class JudgeUdpBusiness {
|
||||
let fyj = Number(plcData.gps.fyj.toFixed(2))
|
||||
fyj = Math.floor(fyj > 0 ? (fyj * 100) : (fyj * 100 + 65536))
|
||||
let examType = this.carInfo.examSubject === "2" ? "2" : "3"
|
||||
dConsole.info("小红球过程数据2", this.isExamEnd, this.business.kfArr)
|
||||
|
||||
dConsole.info("小红球过程数据", this.isExamEnd, this.business)
|
||||
|
||||
const arr: number[][] = [
|
||||
//考生号
|
||||
@ -112,7 +111,7 @@ class JudgeUdpBusiness {
|
||||
//本次考试行驶距离
|
||||
NumberToByteArray(Math.floor(this.performInfo.dcjl! + this.performInfo.qjjl!) / 100, 2 * 8),
|
||||
//扣分值
|
||||
NumberToByteArray(100 - Math.abs(this.business.totalScore), 2 * 8),
|
||||
NumberToByteArray(100 - Math.abs(this.business.totalScore < 0 ? 0 : this.business.totalScore), 2 * 8),
|
||||
//扣分数量
|
||||
NumberToByteArray(this.business.kfArr.length, 8),
|
||||
//n个扣分序号
|
||||
|
||||
@ -134,7 +134,7 @@ function getDataFn(config: EnvironmentConfigurationType) {
|
||||
JudgeUdpBusinessInstance.sendData(byte, udpLsh)
|
||||
}
|
||||
udpIndex++
|
||||
// console.log(SerialPortTag, "处理完的档位信号", data)
|
||||
console.log(SerialPortTag, "后置机消息", data)
|
||||
workerPort.postMessage(
|
||||
JSON.stringify({
|
||||
type: WorkerBackMessageType.ObtainUdpData,
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"lockfileVersion": 2,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {
|
||||
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3",
|
||||
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19"
|
||||
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19",
|
||||
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3"
|
||||
},
|
||||
"packages": {
|
||||
"@ohos/crypto-js@2.0.3": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ=="
|
||||
},
|
||||
"@ohos/hypium@1.0.19": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ=="
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
|
||||
"registryType": "ohpm"
|
||||
},
|
||||
"@ohos/crypto-js@2.0.3": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
|
||||
"registryType": "ohpm"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user