小红球udp

This commit is contained in:
lixiao 2025-10-24 12:09:53 +08:00
parent c1893eb185
commit cf866ffa7f
4 changed files with 31 additions and 10 deletions

View File

@ -1,5 +1,6 @@
import {
CarInfoType,
CDSBInfos,
CenterCallBackMsgType,
EnvironmentConfigurationType,
JudgeConfigObjKmItems,
@ -11,8 +12,12 @@ export interface JudgeUDPData {
totalScore: number
kfArr: MarkRule[]
startTime: string
examTime: number
xmmcSingleCode: string
kmItems: JudgeConfigObjKmItems
cdsbInfoObj: CDSBInfos
xmxh: string
xmdm: number | string
}
export enum WorkerMessageDataType {

View File

@ -104,7 +104,7 @@ export class BaseJudge {
* @param judgeUI
* @param that
*/
async changeExamStatus(event: number, xmdm: number, kf: MarkRule[], judgeUI: JudgePage, that: JudgeBusiness) {
async changeExamStatus(event: number, xmdm: number, xmxh: string, kf: MarkRule[], judgeUI: JudgePage, that: JudgeBusiness) {
switch (event) {
case 1: {
const param512: JudgeConfigObj = (Reflect.get(judgeUI.judgeConfigObj, '512') || '').split(',');
@ -129,7 +129,7 @@ export class BaseJudge {
// }, {
// isDelay: true
// })
ProjectStart(xmdm, that.xmxh, judgeUI)
ProjectStart(xmdm, xmxh, judgeUI)
UploadProgressPhoto(xmdm, that.plcData!, judgeUI)
}
// this.judgeUI.projectsObj[xmdm].isUpload = true
@ -153,7 +153,7 @@ export class BaseJudge {
// }, {
// isDelay: true
// })
ProjectEnd(xmdm, that.xmxh, judgeUI)
ProjectEnd(xmdm, xmxh, judgeUI)
// }
// }
dConsole.log(JudgeTag, ExamProcessDataTag, "项目结束判定3")
@ -188,7 +188,11 @@ export class BaseJudge {
// })
DeductPoints(Number(currentKf.xmdm), currentKf, that.xmmcEndCode || "", judgeUI)
if (judgeUI.totalScore < judgeUI.passingScore) {
ProjectEnd(xmdm, that.xmxh, judgeUI)
try {
ProjectEnd(xmdm, xmxh, judgeUI)
} catch (e) {
dConsole.info(e)
}
}
// }
break
@ -536,7 +540,7 @@ export class BaseJudge {
// // }, {
// // isDelay: true
// // })
// ProjectStart(xmdm, that.xmxh, judgeUI)
// ProjectStart(xmdm, xmxh, judgeUI)
// UploadProgressPhoto(xmdm, that.plcData!, judgeUI)
// currentProject.isUpload = true;
// Reflect.set(judgeUI.projectsObj, xmdm, currentProject)
@ -819,7 +823,7 @@ export class BaseJudge {
xmmcStr: that.xmmcStr, carztStr: that.carztStr, kfArr: judgeUI.kfArr
});
// TODO 语音播报
this.changeExamStatus(event, xmdm, judgeUI.kfArr!, judgeUI, that);
this.changeExamStatus(event, xmdm,xmxh, judgeUI.kfArr!, judgeUI, that);
// 更新ui
if (event == 1 || event == 2 || event == 3 || event == 6) {
judgeUI.projectsObj = JSON.parse(JSON.stringify(judgeUI.projectsObj))

View File

@ -181,7 +181,11 @@ export default class JudgeBusiness {
kfArr: this.judgeUI.kfArr,
startTime: this.judgeUI.udpStartTIme,
xmmcSingleCode: this.xmmcSingleCode,
kmItems: this.kmItems
kmItems: this.kmItems,
examTime: this.judgeUI.examTime,
cdsbInfoObj: this.judgeUI.cdsbInfoObj!,
xmdm: this.xmdm,
xmxh: this.xmxh
}
}
})

View File

@ -1,5 +1,6 @@
import {
CarInfoType,
CDSBInfo,
EnvironmentConfigurationType,
Gps,
JudgePerformInfo,
@ -55,7 +56,7 @@ class JudgeUdpBusiness {
: this.lsh,
13));
const ascksyhArr = StringToASCII('0000000000000')
const ascsbxhArr = StringToASCII('00000000')
const ascsbxhArr = StringToASCII(this.getSbxh(this.business.xmdm, this.business.xmxh))
const plcData = await this.getPlcData(msg);
let param: number[] = [plcData.sensor.zfxd, plcData.sensor.yfxd, plcData.sensor.shtd, plcData.sensor.ygd, plcData.sensor.jgd, plcData.sensor.skd, plcData.sensor.dh1, plcData.sensor.dh2, plcData.sensor.lhq, plcData.sensor.jsc, plcData.sensor.ssc, plcData.sensor.fsc, plcData.sensor.lb, plcData.sensor.mkg, plcData.sensor.aqd]
@ -112,7 +113,7 @@ class JudgeUdpBusiness {
//扣分值
NumberToByteArray(100 - Math.abs(this.business.totalScore), 2 * 8),
//扣分数量
NumberToByteArray(this.business.kfArr.length, 2 * 8),
NumberToByteArray(this.business.kfArr.length, 8),
//n个扣分序号
this.business.kfArr.map(kf => NumberToByteArray(kf.kfxh!, 8)[0]),
//牵引车第二gps精度、纬度
@ -466,6 +467,13 @@ class JudgeUdpBusiness {
gps,
}
}
private getSbxh(ksxm: string | number, xmxh: string) {
const projectKey = `${ksxm}_${xmxh}`;
const currentCdsb: CDSBInfo = Reflect.get(this.business!.cdsbInfoObj, projectKey);
const sbxh = currentCdsb?.sbbh || '0000000000'
return sbxh
}
}