小红球udp
This commit is contained in:
parent
b6c153443a
commit
021d60144c
@ -1,4 +1,5 @@
|
|||||||
import { CarInfoType, CenterCallBackMsgType, EnvironmentConfigurationType, UDPParamType } from '.';
|
import { CarInfoType, CenterCallBackMsgType, EnvironmentConfigurationType, JudgePerformInfo, UDPParamType } from '.';
|
||||||
|
import JudgeBusiness from '../pages/Judge/JudgeBusiness';
|
||||||
|
|
||||||
interface WorkerMessageData {
|
interface WorkerMessageData {
|
||||||
config?: EnvironmentConfigurationType;
|
config?: EnvironmentConfigurationType;
|
||||||
@ -7,7 +8,9 @@ interface WorkerMessageData {
|
|||||||
otherMessage?: OtherMessageType;
|
otherMessage?: OtherMessageType;
|
||||||
singlePlay?: boolean
|
singlePlay?: boolean
|
||||||
judgeUdp?: string
|
judgeUdp?: string
|
||||||
judgeUdpEnd?: string
|
judgeUdpEnd?: string,
|
||||||
|
performInfo?: JudgePerformInfo,
|
||||||
|
business?: JudgeBusiness
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkerMessage {
|
export interface WorkerMessage {
|
||||||
@ -17,9 +20,9 @@ export interface WorkerMessage {
|
|||||||
|
|
||||||
|
|
||||||
export interface OtherMessageType {
|
export interface OtherMessageType {
|
||||||
signNum: number;
|
signNum?: number;
|
||||||
statue: string;
|
statue?: string;
|
||||||
lsh: string;
|
lsh?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorkerBackMessage {
|
export interface WorkerBackMessage {
|
||||||
|
|||||||
@ -144,6 +144,7 @@ export struct JudgePage {
|
|||||||
@State isErrorMsgEnd: boolean = false
|
@State isErrorMsgEnd: boolean = false
|
||||||
@State disConnectErrorOpen: boolean = false
|
@State disConnectErrorOpen: boolean = false
|
||||||
@State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane
|
@State @Watch("laneSignalChange") laneSignal: PerLane = InitialPerLane
|
||||||
|
public examTime: number = 0
|
||||||
public context = getContext(this) as common.UIAbilityContext;
|
public context = getContext(this) as common.UIAbilityContext;
|
||||||
// 信号查看弹窗
|
// 信号查看弹窗
|
||||||
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
|
signalTrajectoryDialogController: CustomDialogController = new CustomDialogController({
|
||||||
@ -552,6 +553,62 @@ export struct JudgePage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//人工项目操作
|
||||||
|
async setManualProjectFn(index: number) {
|
||||||
|
const isManualProjectIn = this.isManualProjectIn;
|
||||||
|
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
|
||||||
|
const projectsObj = this.projectsObj;
|
||||||
|
const projectCode = artSubject3ProjectsCodesArr[index]
|
||||||
|
let sideParkingStatus = GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane)
|
||||||
|
if (index === 5) {
|
||||||
|
dConsole.info(JudgeTag, 'surenjun 靠边停车状态=> ', sideParkingStatus)
|
||||||
|
}
|
||||||
|
const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode)
|
||||||
|
if (sideParkingStatus) {
|
||||||
|
// 正在进行的项目 取消项目
|
||||||
|
if (isManualProjectIn && currentProject.type == '2') {
|
||||||
|
//判断人工是否能取消项目 && 当前项目有扣分的不能取消
|
||||||
|
if (Reflect.get(this.judgeConfigObj, '340') == 1) {
|
||||||
|
// TODO
|
||||||
|
// await this.judge.setJudgeItem(projectCode, 2);
|
||||||
|
Prompt.showToast({
|
||||||
|
message: '项目取消',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 靠边停车时候可以触发
|
||||||
|
if (Reflect.get(this.judgeConfigObj, '343') === '0') {
|
||||||
|
const xmmcStr = this.xmmcStr;
|
||||||
|
if (xmmcStr == '无' || xmmcStr == '') {
|
||||||
|
//512[6] 人工项目按钮放大确认
|
||||||
|
const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(',');
|
||||||
|
dConsole.info(JudgeTag, 'surenjun', param512)
|
||||||
|
if (param512[6] !== '0') {
|
||||||
|
this.amplifiedImgIndex = index;
|
||||||
|
this.isAmplifyPopShow = true
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
// await this.judge.setJudgeItem(projectCode, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (index === 5) {
|
||||||
|
Prompt.showToast({
|
||||||
|
message: `${xmmcStr}未结束,不允许靠边停车`,
|
||||||
|
duration: 8000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.amplifiedImgIndex = index;
|
||||||
|
this.isAmplifyPopShow = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 信号区域
|
// 信号区域
|
||||||
@Builder
|
@Builder
|
||||||
logoExpansionBuilder() {
|
logoExpansionBuilder() {
|
||||||
@ -591,6 +648,9 @@ export struct JudgePage {
|
|||||||
jl: this.jl,
|
jl: this.jl,
|
||||||
wayno: this.wayno,
|
wayno: this.wayno,
|
||||||
judgeConfigObj: this.judgeConfigObj,
|
judgeConfigObj: this.judgeConfigObj,
|
||||||
|
onTimeUpdate: (time) => {
|
||||||
|
this.examTime = time
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// 扣分列表和评判列表
|
// 扣分列表和评判列表
|
||||||
JudgeAndProjectComponent({
|
JudgeAndProjectComponent({
|
||||||
@ -727,59 +787,5 @@ export struct JudgePage {
|
|||||||
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
|
.height('100%').backgroundColor('#000').justifyContent(FlexAlign.Start)
|
||||||
}
|
}
|
||||||
|
|
||||||
//人工项目操作
|
|
||||||
async setManualProjectFn(index: number) {
|
|
||||||
const isManualProjectIn = this.isManualProjectIn;
|
|
||||||
const artSubject3ProjectsCodesArr = this.artSubject3ProjectsCodesArr;
|
|
||||||
const projectsObj = this.projectsObj;
|
|
||||||
const projectCode = artSubject3ProjectsCodesArr[index]
|
|
||||||
let sideParkingStatus = GetIsExitManualProject(index, this.judgeConfigObj, this.artSubject3ProjectsCodesArr, this.projectsObj, this.carztStr, this.isManualProjectIn, this.isProjectIn, this.jl, this.examMileage, this.isRequiredProjectsEnd, this.lane)
|
|
||||||
if (index === 5) {
|
|
||||||
dConsole.info(JudgeTag, 'surenjun 靠边停车状态=> ', sideParkingStatus)
|
|
||||||
}
|
|
||||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, projectCode)
|
|
||||||
if (sideParkingStatus) {
|
|
||||||
// 正在进行的项目 取消项目
|
|
||||||
if (isManualProjectIn && currentProject.type == '2') {
|
|
||||||
//判断人工是否能取消项目 && 当前项目有扣分的不能取消
|
|
||||||
if (Reflect.get(this.judgeConfigObj, '340') == 1) {
|
|
||||||
// TODO
|
|
||||||
// await this.judge.setJudgeItem(projectCode, 2);
|
|
||||||
Prompt.showToast({
|
|
||||||
message: '项目取消',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 靠边停车时候可以触发
|
|
||||||
if (Reflect.get(this.judgeConfigObj, '343') === '0') {
|
|
||||||
const xmmcStr = this.xmmcStr;
|
|
||||||
if (xmmcStr == '无' || xmmcStr == '') {
|
|
||||||
//512[6] 人工项目按钮放大确认
|
|
||||||
const param512: string[] = (Reflect.get(this.judgeConfigObj, '512') || '').split(',');
|
|
||||||
dConsole.info(JudgeTag, 'surenjun', param512)
|
|
||||||
if (param512[6] !== '0') {
|
|
||||||
this.amplifiedImgIndex = index;
|
|
||||||
this.isAmplifyPopShow = true
|
|
||||||
} else {
|
|
||||||
// TODO
|
|
||||||
// await this.judge.setJudgeItem(projectCode, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (index === 5) {
|
|
||||||
Prompt.showToast({
|
|
||||||
message: `${xmmcStr}未结束,不允许靠边停车`,
|
|
||||||
duration: 8000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.amplifiedImgIndex = index;
|
|
||||||
this.isAmplifyPopShow = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ export default class JudgeBusiness {
|
|||||||
public ksjs?: JudgeKSJS
|
public ksjs?: JudgeKSJS
|
||||||
public plcData?: PLCType
|
public plcData?: PLCType
|
||||||
public totalScore: number = -1
|
public totalScore: number = -1
|
||||||
private judgeUI: JudgePage
|
public judgeUI: JudgePage
|
||||||
private tempData?: PLCType
|
private tempData?: PLCType
|
||||||
// 是否发送udp
|
// 是否发送udp
|
||||||
private judgeBusiness: BaseJudgeImpl
|
private judgeBusiness: BaseJudgeImpl
|
||||||
@ -173,7 +173,9 @@ export default class JudgeBusiness {
|
|||||||
if (this.udpCount % 5 === 0 && !this.isExamEnd) {
|
if (this.udpCount % 5 === 0 && !this.isExamEnd) {
|
||||||
DifferentialAndSignal.sendMsg({
|
DifferentialAndSignal.sendMsg({
|
||||||
type: "data", data: {
|
type: "data", data: {
|
||||||
judgeUdp: msg
|
judgeUdp: msg,
|
||||||
|
performInfo: this.performInfo,
|
||||||
|
business: this as JudgeBusiness
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,10 +13,12 @@ export default struct MessageComponent {
|
|||||||
@Prop wayno: number
|
@Prop wayno: number
|
||||||
@Prop judgeConfigObj: DefaultJudgeConfigObj
|
@Prop judgeConfigObj: DefaultJudgeConfigObj
|
||||||
@State timer: number = -1
|
@State timer: number = -1
|
||||||
|
onTimeUpdate?: (time: number) => void
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
this.timer = setInterval(async () => {
|
this.timer = setInterval(async () => {
|
||||||
this.examTime += 1;
|
this.examTime += 1;
|
||||||
|
this.onTimeUpdate?.(this.examTime)
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -965,6 +965,7 @@ struct UserInfoPage {
|
|||||||
try {
|
try {
|
||||||
const temp = await writeObjectOut(param, "", this.context);
|
const temp = await writeObjectOut(param, "", this.context);
|
||||||
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
|
AppStorage.setOrCreate('lsh', this.currentUser.lsh)
|
||||||
|
dConsole.info(UserInfoTag, this.currentUser.lsh ,this.currentUser)
|
||||||
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
|
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
|
||||||
AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo)
|
AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo)
|
||||||
return temp
|
return temp
|
||||||
|
|||||||
@ -88,6 +88,19 @@ export function ArrayToByteArray(array: number[]): Uint8Array {
|
|||||||
* @returns 返回字节数组
|
* @returns 返回字节数组
|
||||||
*/
|
*/
|
||||||
export function NumberToByteArray(number: number | string, len: number): number[] {
|
export function NumberToByteArray(number: number | string, len: number): number[] {
|
||||||
|
if (len === 8) {
|
||||||
|
return [...new Uint8Array([Number(number)])]
|
||||||
|
}
|
||||||
|
if (len === 16) {
|
||||||
|
return [...new Uint8Array(new Uint16Array([Number(number)]).buffer)]
|
||||||
|
}
|
||||||
|
if (len === 32) {
|
||||||
|
return [...new Uint8Array(new Uint32Array([Number(number)]).buffer)]
|
||||||
|
} else {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let str = Math.floor(Number(number)).toString(2);
|
let str = Math.floor(Number(number)).toString(2);
|
||||||
if (str.length > len) {
|
if (str.length > len) {
|
||||||
console.log('数据长度不对~~');
|
console.log('数据长度不对~~');
|
||||||
|
|||||||
@ -11,11 +11,13 @@ interface MsgExt {
|
|||||||
placeId: string,
|
placeId: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateHead(param: MsgExt): number[] {
|
function generateHead(param: MsgExt, lsh: number): number[] {
|
||||||
let lshNo = AppStorage.get<string>("lsh")
|
// let a = new Uint16Array(StringToASCII(`${param.id}${FillZero(param.placeId, 3)}`))
|
||||||
let a = new Uint16Array(StringToASCII(`${param.id}${FillZero(param.placeId, 3)}`))
|
let a = new Uint8Array(new Uint16Array([Number(`${param.id}${FillZero(param.placeId, 3)}`)]).buffer)
|
||||||
let b = new Uint32Array(StringToASCII(`${FillZero(param.carNo, 4)}${lshNo}`))
|
// let b = new Uint32Array(StringToASCII(`${FillZero(param.carNo, 4)}${lsh}`))
|
||||||
let c = new Uint16Array(param.list.length)
|
let b = new Uint8Array(new Uint32Array([Number(`${FillZero(param.carNo, 4)}${lsh}`)]).buffer)
|
||||||
|
// let c = new Uint16Array(param.list.length)
|
||||||
|
let c = new Uint8Array(new Uint16Array(param.list.length).buffer)
|
||||||
return [...a, ...b, ...c];
|
return [...a, ...b, ...c];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,27 +85,34 @@ export default class UdpClient {
|
|||||||
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
// console.log(UDPTag, "udp发送成功", JSON.stringify(res))
|
||||||
}).catch((e: BusinessError) => {
|
}).catch((e: BusinessError) => {
|
||||||
console.error(UDPTag, "udp发送失败", JSON.stringify(e))
|
console.error(UDPTag, "udp发送失败", JSON.stringify(e))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装消息
|
// 组装消息
|
||||||
setWholeMsg(params: MsgExt): ArrayBuffer {
|
setWholeMsg(params: MsgExt, lsh: number): ArrayBuffer {
|
||||||
let head = generateHead(params);
|
try {
|
||||||
let headJudge = exclusive(head);
|
let head = generateHead(params, lsh);
|
||||||
let body = params.list;
|
let headJudge = exclusive(head);
|
||||||
let bodyJudge = exclusive(body);
|
let body = params.list;
|
||||||
let end = [13, 10];
|
let bodyJudge = exclusive(body);
|
||||||
const arr = [...head, ...headJudge, ...body, ...bodyJudge, ...end]
|
let end = [13, 10];
|
||||||
return new Uint8Array(arr).buffer
|
const arr = [...head, ...headJudge, ...body, ...bodyJudge, ...end]
|
||||||
|
return new Uint8Array(arr).buffer
|
||||||
|
} catch (e) {
|
||||||
|
dConsole.error("lixiao", e)
|
||||||
|
return new Uint8Array([]).buffer
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
sendMsgExt(param: MsgExt) {
|
sendMsgExt(param: MsgExt, lsh: number) {
|
||||||
dConsole.info(UDPTag, "小红球数据", param)
|
dConsole.info(UDPTag, "组装前小红球数据", param, lsh)
|
||||||
const msgData = this.setWholeMsg(param)
|
const msgData = this.setWholeMsg(param, lsh)
|
||||||
|
dConsole.info(UDPTag, "组装后小红球数据", msgData.byteLength)
|
||||||
this.sendMsg(msgData)
|
this.sendMsg(msgData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import {
|
|||||||
CarInfoType,
|
CarInfoType,
|
||||||
EnvironmentConfigurationType,
|
EnvironmentConfigurationType,
|
||||||
Gps,
|
Gps,
|
||||||
|
JudgePerformInfo,
|
||||||
PLCDataType,
|
PLCDataType,
|
||||||
ProjectDataType,
|
ProjectDataType,
|
||||||
ProjectItemType,
|
ProjectItemType,
|
||||||
@ -19,6 +20,8 @@ import { SerialNumberInstance } from '../SerialNumber';
|
|||||||
import { GetDwStatusType, GetTranslateSignals } from '../../pages/Judge/utils';
|
import { GetDwStatusType, GetTranslateSignals } from '../../pages/Judge/utils';
|
||||||
import { testKm2Items, testKm3Items } from '../../mock';
|
import { testKm2Items, testKm3Items } from '../../mock';
|
||||||
import { dConsole } from '../LogWorker';
|
import { dConsole } from '../LogWorker';
|
||||||
|
import dayTs from '../Date';
|
||||||
|
import JudgeBusiness from '../../pages/Judge/JudgeBusiness';
|
||||||
|
|
||||||
// import { examCalcGpsDistance } from '../../pages/Judge/JudgeUtils';
|
// import { examCalcGpsDistance } from '../../pages/Judge/JudgeUtils';
|
||||||
|
|
||||||
@ -32,9 +35,8 @@ class JudgeUdpBusiness {
|
|||||||
private singlePlay: boolean = false
|
private singlePlay: boolean = false
|
||||||
private lsh: string = ""
|
private lsh: string = ""
|
||||||
private serialIndex: number = 1
|
private serialIndex: number = 1
|
||||||
|
private udpLsh: number = 0
|
||||||
// private carNo: string = ""
|
private initDate = dayTs(new Date()).format().split(" ")[0]
|
||||||
// private examinationRoomId: string = ""
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!JudgeUdpBusiness.instance) {
|
if (!JudgeUdpBusiness.instance) {
|
||||||
@ -43,14 +45,14 @@ class JudgeUdpBusiness {
|
|||||||
return JudgeUdpBusiness.instance
|
return JudgeUdpBusiness.instance
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMessageHeartbeat(msg: string, isEnd: boolean = false): Promise<number[]> {
|
async getMessageHeartbeat(business: JudgeBusiness, msg: string, performInfo: JudgePerformInfo, isEnd: boolean = false): Promise<number[]> {
|
||||||
let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit
|
let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit
|
||||||
const asclshArr = StringToASCII(FillZero(
|
const asclshArr = StringToASCII(FillZero(
|
||||||
this.singlePlay
|
this.singlePlay
|
||||||
? '1111111111111'
|
? '0000000000000'
|
||||||
: this.lsh,
|
: this.lsh,
|
||||||
13));
|
13));
|
||||||
const ascksyhArr = StringToASCII(this.carInfo.examSubject === '2' ? '0000000000000' : '1111111111111')
|
const ascksyhArr = StringToASCII('0000000000000')
|
||||||
const ascsbxhArr = StringToASCII('00000000')
|
const ascsbxhArr = StringToASCII('00000000')
|
||||||
|
|
||||||
const plcData = await this.getPlcData(msg);
|
const plcData = await this.getPlcData(msg);
|
||||||
@ -87,9 +89,9 @@ class JudgeUdpBusiness {
|
|||||||
NumberToByteArray(translateJd, 4 * 8),
|
NumberToByteArray(translateJd, 4 * 8),
|
||||||
NumberToByteArray(translateWd, 4 * 8), NumberToByteArray(1, 8),
|
NumberToByteArray(translateWd, 4 * 8), NumberToByteArray(1, 8),
|
||||||
//GPS东向距离
|
//GPS东向距离
|
||||||
NumberToByteArray(0, 4 * 8),
|
NumberToByteArray(performInfo.dxjl < 0 ? performInfo.dxjl + 4294967296 : performInfo.dxjl, 4 * 8),
|
||||||
//GPS北向距离
|
//GPS北向距离
|
||||||
NumberToByteArray(0, 4 * 8),
|
NumberToByteArray(performInfo.bxjl < 0 ? performInfo.bxjl + 4294967296 : performInfo.bxjl, 4 * 8),
|
||||||
//航向角
|
//航向角
|
||||||
NumberToByteArray(plcData.gps.hxj * 100, 2 * 8),
|
NumberToByteArray(plcData.gps.hxj * 100, 2 * 8),
|
||||||
//俯仰角
|
//俯仰角
|
||||||
@ -103,16 +105,13 @@ class JudgeUdpBusiness {
|
|||||||
//场地设备编号
|
//场地设备编号
|
||||||
ascsbxhArr.map(sbxh => NumberToByteArray(sbxh, 8)[0]),
|
ascsbxhArr.map(sbxh => NumberToByteArray(sbxh, 8)[0]),
|
||||||
//本次考试行驶距离
|
//本次考试行驶距离
|
||||||
NumberToByteArray(0, 2 * 8),
|
NumberToByteArray(Math.floor(performInfo.dcjl + performInfo.qjjl) / 100, 2 * 8),
|
||||||
//扣分值
|
//扣分值
|
||||||
NumberToByteArray(0, 2 * 8),
|
NumberToByteArray(100 - Math.abs(business.totalScore), 2 * 8),
|
||||||
//扣分数
|
//扣分数量
|
||||||
NumberToByteArray(0, 2 * 8),
|
NumberToByteArray(business.judgeUI.kfArr.length, 2 * 8),
|
||||||
//扣分项数量
|
|
||||||
NumberToByteArray(0, 8),
|
|
||||||
//n个扣分序号
|
//n个扣分序号
|
||||||
// [].map(kf => string2Bytes(kf.markcatalog, 8)),
|
business.judgeUI.kfArr.map(kf => NumberToByteArray(kf.kfxh, 8)[0]),
|
||||||
[],
|
|
||||||
//牵引车第二gps精度、纬度
|
//牵引车第二gps精度、纬度
|
||||||
NumberToByteArray(0, 4 * 8), NumberToByteArray(0, 4 * 8),
|
NumberToByteArray(0, 4 * 8), NumberToByteArray(0, 4 * 8),
|
||||||
//牵引车第二航向角
|
//牵引车第二航向角
|
||||||
@ -120,7 +119,7 @@ class JudgeUdpBusiness {
|
|||||||
//摩托压线 Byte[20],
|
//摩托压线 Byte[20],
|
||||||
NumberToByteArray(0, 20 * 8),
|
NumberToByteArray(0, 20 * 8),
|
||||||
//考试用时
|
//考试用时
|
||||||
NumberToByteArray(FillZero(0, 4), 4 * 8),
|
NumberToByteArray(business.judgeUI.examTime, 4 * 8),
|
||||||
//项目用时
|
//项目用时
|
||||||
NumberToByteArray(FillZero(0, 2), 2 * 8),
|
NumberToByteArray(FillZero(0, 2), 2 * 8),
|
||||||
//设备信号状态
|
//设备信号状态
|
||||||
@ -145,13 +144,20 @@ class JudgeUdpBusiness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendData(bytes: number[]) {
|
sendData(bytes: number[]) {
|
||||||
dConsole.info("lixiao", this.carInfo.carNo, this.carInfo.examinationRoomId)
|
let now = dayTs(new Date()).format().split(" ")[0]
|
||||||
|
if (now === this.initDate) {
|
||||||
|
this.udpLsh++
|
||||||
|
} else {
|
||||||
|
this.initDate = now
|
||||||
|
this.udpLsh = 0
|
||||||
|
}
|
||||||
|
dConsole.info("lixiao", this.udpLsh)
|
||||||
this.udp.sendMsgExt({
|
this.udp.sendMsgExt({
|
||||||
id: 45,
|
id: 45,
|
||||||
list: bytes,
|
list: bytes,
|
||||||
carNo: this.carInfo.carNo!,
|
carNo: this.carInfo.carNo!,
|
||||||
placeId: this.carInfo!.examinationRoomId!
|
placeId: this.carInfo!.examinationRoomId!,
|
||||||
})
|
}, this.udpLsh)
|
||||||
}
|
}
|
||||||
|
|
||||||
//申请远程扣分查询
|
//申请远程扣分查询
|
||||||
@ -185,6 +191,7 @@ class JudgeUdpBusiness {
|
|||||||
this.carInfo = carInfo
|
this.carInfo = carInfo
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
dConsole.info("lixiao udp", config.udplocalIp!, '8080', carInfo.udpAddress!, carInfo.hintPort!)
|
||||||
this.udp.create(config.udplocalIp!, '8080', carInfo.udpAddress!, carInfo.hintPort!).then(resolve).catch(reject)
|
this.udp.create(config.udplocalIp!, '8080', carInfo.udpAddress!, carInfo.hintPort!).then(resolve).catch(reject)
|
||||||
// ObtainUdpBusinessInstance.onMsg(async (msg: string) => {
|
// ObtainUdpBusinessInstance.onMsg(async (msg: string) => {
|
||||||
// let prevJd = 0, preWd = 0
|
// let prevJd = 0, preWd = 0
|
||||||
@ -249,11 +256,7 @@ class JudgeUdpBusiness {
|
|||||||
let a = NumberToByteArray(Number(`${params.id}${FillZero(params.placeId, 3)}`), 2 * 8);
|
let a = NumberToByteArray(Number(`${params.id}${FillZero(params.placeId, 3)}`), 2 * 8);
|
||||||
let b = NumberToByteArray(Number(`${FillZero(params.carNo, 4)}${lshNo}`), 4 * 8);
|
let b = NumberToByteArray(Number(`${FillZero(params.carNo, 4)}${lshNo}`), 4 * 8);
|
||||||
let c = NumberToByteArray(params.list.length, 2 * 8);
|
let c = NumberToByteArray(params.list.length, 2 * 8);
|
||||||
let result: number[] = []
|
return [...a, ...b, ...c];
|
||||||
a?.forEach(item => result.push(item))
|
|
||||||
b?.forEach(item => result.push(item))
|
|
||||||
c?.forEach(item => result.push(item))
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private setMessageExclusive(tmpList: Array<number>) {
|
private setMessageExclusive(tmpList: Array<number>) {
|
||||||
|
|||||||
@ -29,11 +29,11 @@ workerPort.onmessage = async (e: MessageEvents) => {
|
|||||||
CenterUDPBusinessInstance.changeKeyValue(result.data.otherMessage!)
|
CenterUDPBusinessInstance.changeKeyValue(result.data.otherMessage!)
|
||||||
}
|
}
|
||||||
if (result.data.judgeUdp) {
|
if (result.data.judgeUdp) {
|
||||||
let data = await JudgeUdpBusinessInstance.getMessageHeartbeat(result.data.judgeUdp!)
|
let data = await JudgeUdpBusinessInstance.getMessageHeartbeat(result.data.business!, result.data.judgeUdp!, result.data.performInfo!)
|
||||||
JudgeUdpBusinessInstance.sendData(data)
|
JudgeUdpBusinessInstance.sendData(data)
|
||||||
}
|
}
|
||||||
if (result.data.judgeUdpEnd) {
|
if (result.data.judgeUdpEnd) {
|
||||||
let data = await JudgeUdpBusinessInstance.getMessageHeartbeat(result.data.judgeUdp!, true)
|
let data = await JudgeUdpBusinessInstance.getMessageHeartbeat(result.data.business!, result.data.judgeUdp!, result.data.performInfo!, true)
|
||||||
JudgeUdpBusinessInstance.sendData(data)
|
JudgeUdpBusinessInstance.sendData(data)
|
||||||
}
|
}
|
||||||
// 如果外部有这个消息进来就开始给中心发送,暂时看不需要
|
// 如果外部有这个消息进来就开始给中心发送,暂时看不需要
|
||||||
@ -61,7 +61,7 @@ function initFn(result: WorkerMessage) {
|
|||||||
CenterUDPBusinessInstance.startHeartBeat()
|
CenterUDPBusinessInstance.startHeartBeat()
|
||||||
// 初始化考试过程UDP
|
// 初始化考试过程UDP
|
||||||
dConsole.info("lixiao 初始化", result.data.carInfo)
|
dConsole.info("lixiao 初始化", result.data.carInfo)
|
||||||
JudgeUdpBusinessInstance.init(result.data.config!, result.data.carInfo!, result?.data.singlePlay || false, result.data.otherMessage!.lsh)
|
JudgeUdpBusinessInstance.init(result.data.config!, result.data.carInfo!, result?.data.singlePlay || false, result.data.otherMessage!.lsh!)
|
||||||
// 初始化档位信号串口
|
// 初始化档位信号串口
|
||||||
if (result.data.config?.carType !== "2") {
|
if (result.data.config?.carType !== "2") {
|
||||||
SerialPortService.init()
|
SerialPortService.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user