dev #2
@ -4,7 +4,6 @@ import {
|
||||
JudgeKSJS,
|
||||
JudgePerformInfo,
|
||||
LANE,
|
||||
MarkRule,
|
||||
PLCType,
|
||||
ProcessDataEnumType,
|
||||
RecordHandleType,
|
||||
@ -23,6 +22,7 @@ import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSigna
|
||||
import { PlcStrToJson, PlcStrToWXJson } from './utils'
|
||||
import { BaseJudgeImpl, SetJudgeItem } from './BaseJudgeBussines'
|
||||
import { JudgePage } from '../Judge';
|
||||
import { JudgeUdpBusinessInstance } from '../../utils/business/JudgeUdpBusiness'
|
||||
|
||||
export default class JudgeBusiness {
|
||||
public mndgStr: string | undefined
|
||||
@ -60,8 +60,8 @@ export default class JudgeBusiness {
|
||||
private judgeUI: JudgePage
|
||||
private tempData?: PLCType
|
||||
// 是否发送udp
|
||||
private isUdpEnd: boolean = false
|
||||
private judgeBusiness: BaseJudgeImpl
|
||||
private udpCount: number = 0
|
||||
|
||||
constructor(judgeUI: JudgePage) {
|
||||
this.judgeUI = judgeUI
|
||||
@ -138,8 +138,9 @@ export default class JudgeBusiness {
|
||||
|
||||
// 处理PLC数据
|
||||
private async HandlePLCData(msg: string) {
|
||||
this.udpCount++
|
||||
const plcArr = msg.split(',')
|
||||
if (plcArr[0] != '#DN_GD' || this.isUdpEnd) {
|
||||
if (plcArr[0] != '#DN_GD' || this.isExamEnd) {
|
||||
return
|
||||
}
|
||||
const gpsPart = msg.split("#END$GPS,")[1];
|
||||
@ -170,6 +171,12 @@ export default class JudgeBusiness {
|
||||
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
|
||||
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) + ''
|
||||
|
||||
if (this.udpCount % 5 === 0 && !this.isExamEnd) {
|
||||
const bytes = await JudgeUdpBusinessInstance.getMessageHeartbeat(msg);
|
||||
JudgeUdpBusinessInstance.sendData(bytes)
|
||||
}
|
||||
|
||||
if (!this.isExamEnd) {
|
||||
await examJudgeRealExam(this.plcData)
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ export default class UdpClient {
|
||||
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
||||
}
|
||||
}).then(res => {
|
||||
// console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
||||
console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
||||
}).catch((e: BusinessError) => {
|
||||
console.error(UDPTag, "udp发送失败", JSON.stringify(e))
|
||||
})
|
||||
|
||||
@ -43,6 +43,7 @@ class CenterUDPBusiness {
|
||||
console.log(CenterUdpTag, "心跳", JSON.stringify(this.carInfo))
|
||||
// 组装消息,一秒发送一次
|
||||
this.timer = setInterval(() => {
|
||||
console.log(CenterUdpTag, "发送心跳")
|
||||
// 生成流水号
|
||||
SerialNumberInstance.generate()
|
||||
// console.log(CenterUdpTag, "流水号生成")
|
||||
|
||||
@ -50,7 +50,7 @@ function initFn(result: WorkerMessage) {
|
||||
// 中心心跳
|
||||
CenterUDPBusinessInstance.startHeartBeat()
|
||||
// 初始化考试过程UDP
|
||||
// JudgeUdpBusinessInstance.init(result.config, result.carInfo, result?.singlePlay || false, result.otherMessage.lsh)
|
||||
JudgeUdpBusinessInstance.init(result.config, result.carInfo, result?.singlePlay || false, result.otherMessage.lsh)
|
||||
// 初始化档位信号串口
|
||||
if (result.config.carType !== "2") {
|
||||
SerialPortService.init()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user