错误修改
This commit is contained in:
parent
313998c531
commit
284de0a0e3
@ -136,7 +136,7 @@ export async function uploadExamProgressData(params: UploadExamProgressDataParam
|
|||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return request({
|
return request<object>({
|
||||||
url: '/der2/services/exam/uploadExamDataFile.ws',
|
url: '/der2/services/exam/uploadExamDataFile.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<uploadExamDataFileReq>
|
<uploadExamDataFileReq>
|
||||||
|
|||||||
@ -108,7 +108,7 @@ interface GetPhotosForOtherParams {
|
|||||||
|
|
||||||
//参数下发读表接口
|
//参数下发读表接口
|
||||||
export async function getPhotosForOther(params: GetPhotosForOtherParams) {
|
export async function getPhotosForOther(params: GetPhotosForOtherParams) {
|
||||||
return request({
|
return request<object>({
|
||||||
url: '/der2/services/third/getPhotosForOther.ws',
|
url: '/der2/services/third/getPhotosForOther.ws',
|
||||||
data: `<?xml version="1.0" encoding="utf-8"?><getBmzpReq><head><time>${params.time}</time></head><body><sfzmhm>${params.sfzmhm}</sfzmhm><kskm>2</kskm><zptype>${params.zptype}</zptype><ksrq>${params.ksrq}</ksrq></body></getBmzpReq>`,
|
data: `<?xml version="1.0" encoding="utf-8"?><getBmzpReq><head><time>${params.time}</time></head><body><sfzmhm>${params.sfzmhm}</sfzmhm><kskm>2</kskm><zptype>${params.zptype}</zptype><ksrq>${params.ksrq}</ksrq></body></getBmzpReq>`,
|
||||||
method: http.RequestMethod.POST,
|
method: http.RequestMethod.POST,
|
||||||
@ -118,7 +118,7 @@ export async function getPhotosForOther(params: GetPhotosForOtherParams) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function setVideoText() {
|
export async function setVideoText() {
|
||||||
return request({
|
return request<object>({
|
||||||
url: 'http://admin:12345qwe@192.168.36.94/PSIA/Custom/SelfExt/OSD/channels/2/textOverlay',
|
url: 'http://admin:12345qwe@192.168.36.94/PSIA/Custom/SelfExt/OSD/channels/2/textOverlay',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<TextOverlayList><TextOverlay><id>1</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>1222</displayText></TextOverlay><TextOverlay><id>2</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>2222</displayText></TextOverlay><TextOverlay><id>3</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>4</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>5</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>6</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>7</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>8</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay></TextOverlayList>`,
|
<TextOverlayList><TextOverlay><id>1</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>1222</displayText></TextOverlay><TextOverlay><id>2</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>2222</displayText></TextOverlay><TextOverlay><id>3</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>4</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>5</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>6</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>7</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>8</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay></TextOverlayList>`,
|
||||||
|
|||||||
@ -34,10 +34,10 @@ export interface AmplifyItem {
|
|||||||
|
|
||||||
/** UDP 通信参数 */
|
/** UDP 通信参数 */
|
||||||
export interface UDPParamType {
|
export interface UDPParamType {
|
||||||
id?: number;
|
id: number;
|
||||||
list?: number[];
|
list: number[];
|
||||||
carNo?: string;
|
carNo: string;
|
||||||
placeId?: string;
|
placeId: string;
|
||||||
sendCallback?: () => void;
|
sendCallback?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,11 +74,11 @@ export function ArrayToByteArray(array: number[]): Uint8Array {
|
|||||||
* @param len 字节数
|
* @param len 字节数
|
||||||
* @returns 返回字节数组
|
* @returns 返回字节数组
|
||||||
*/
|
*/
|
||||||
export function NumberToByteArray(number: number, len: number): number[] | undefined {
|
export function NumberToByteArray(number: number, len: number): number[] {
|
||||||
let str = Math.floor(number).toString(2);
|
let str = Math.floor(number).toString(2);
|
||||||
if (str.length > len) {
|
if (str.length > len) {
|
||||||
console.log('数据长度不对~~');
|
console.log('数据长度不对~~');
|
||||||
return;
|
return [];
|
||||||
}
|
}
|
||||||
const byteString = FillZero(str, len);
|
const byteString = FillZero(str, len);
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,9 @@ function dealCenterCode(message: string, isNewCenter: boolean = false): CenterCo
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Request<T extends Object>(options: RequestOption): Promise<T | CenterCodeResult> {
|
type RequestResult = Object | object | string | CenterCodeResult
|
||||||
|
|
||||||
|
export default function Request<T extends RequestResult>(options: RequestOption): Promise<T> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const instance = http.createHttp()
|
const instance = http.createHttp()
|
||||||
const baseURL = options.host || base
|
const baseURL = options.host || base
|
||||||
@ -136,7 +138,7 @@ export default function Request<T extends Object>(options: RequestOption): Promi
|
|||||||
}
|
}
|
||||||
if (result['Envelope'] !== undefined) {
|
if (result['Envelope'] !== undefined) {
|
||||||
const msgXml: string = result['Envelope']['Body']['writeObjectOutResponse']['return'];
|
const msgXml: string = result['Envelope']['Body']['writeObjectOutResponse']['return'];
|
||||||
resolve(dealCenterCode(msgXml, options.isNewCenter))
|
resolve(dealCenterCode(msgXml, options.isNewCenter) as T)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!options.xml) {
|
if (!options.xml) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export default class UdpClient {
|
|||||||
cb(result)
|
cb(result)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.udp.on("error", (err) => {
|
this.udp?.on("error", (err) => {
|
||||||
console.log(UDPTag, 'udp error', JSON.stringify(err))
|
console.log(UDPTag, 'udp error', JSON.stringify(err))
|
||||||
this.errorEvents.forEach(cb => {
|
this.errorEvents.forEach(cb => {
|
||||||
cb(err)
|
cb(err)
|
||||||
@ -58,8 +58,8 @@ export default class UdpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bindUdp(): Promise<void> {
|
bindUdp(): Promise<void> | undefined {
|
||||||
return this.udp.bind({
|
return this.udp?.bind({
|
||||||
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
address: this.localIp, port: parseInt(this.localIpPort), family: 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ export default class UdpClient {
|
|||||||
await this.bindUdp()
|
await this.bindUdp()
|
||||||
}
|
}
|
||||||
|
|
||||||
close(): Promise<void> {
|
close(): Promise<void> | undefined {
|
||||||
this.messageEvents = []
|
this.messageEvents = []
|
||||||
this.errorEvents = []
|
this.errorEvents = []
|
||||||
this.dealMethod = undefined
|
this.dealMethod = undefined
|
||||||
@ -84,8 +84,8 @@ export default class UdpClient {
|
|||||||
this.dealMethod = fun
|
this.dealMethod = fun
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMsg(data: ArrayBuffer | string): Promise<void> {
|
sendMsg(data: ArrayBuffer | string): Promise<void> | undefined {
|
||||||
return this.udp.send({
|
return this.udp?.send({
|
||||||
data,
|
data,
|
||||||
address: {
|
address: {
|
||||||
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
address: this.oppositeIp, port: parseInt(this.oppositeIpPort), family: 1
|
||||||
|
|||||||
@ -8,13 +8,13 @@ import { UDPTag } from '../../config';
|
|||||||
// 中心UDP业务逻辑
|
// 中心UDP业务逻辑
|
||||||
class CenterUDPBusiness {
|
class CenterUDPBusiness {
|
||||||
private static instance: CenterUDPBusiness
|
private static instance: CenterUDPBusiness
|
||||||
private udp: UdpClient
|
private udp: UdpClient = new UdpClient()
|
||||||
private timer: number = -1
|
private timer: number = -1
|
||||||
private headLength: number = 9
|
private headLength: number = 9
|
||||||
private sendId: number = 0
|
private sendId: number = 0
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!CenterUDPBusiness.instance) {
|
if (CenterUDPBusiness.instance) {
|
||||||
CenterUDPBusiness.instance = this
|
CenterUDPBusiness.instance = this
|
||||||
}
|
}
|
||||||
return CenterUDPBusiness.instance
|
return CenterUDPBusiness.instance
|
||||||
@ -45,14 +45,19 @@ class CenterUDPBusiness {
|
|||||||
let headJudge = this.setMessageExclusive(head);
|
let headJudge = this.setMessageExclusive(head);
|
||||||
let bodyJudge = this.setMessageExclusive(params.list);
|
let bodyJudge = this.setMessageExclusive(params.list);
|
||||||
let end = [13, 10];
|
let end = [13, 10];
|
||||||
const arr: Array<number> = [...head, ...headJudge, ...params.list, ...bodyJudge, ...end]
|
const arr: number[] = []
|
||||||
|
head.forEach(item => arr.push(item))
|
||||||
|
headJudge.forEach(item => arr.push(item))
|
||||||
|
params.list?.forEach(item => arr.push(item))
|
||||||
|
bodyJudge.forEach(item => arr.push(item))
|
||||||
|
end.forEach(item => arr.push(item))
|
||||||
return this.array2Byte(arr).buffer
|
return this.array2Byte(arr).buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
private array2Byte(array: Array<number>) {
|
private array2Byte(array: Array<number>) {
|
||||||
const buf = new ArrayBuffer(array.length);
|
const buf = new ArrayBuffer(array.length);
|
||||||
const view = new Uint8Array(buf);
|
const view = new Uint8Array(buf);
|
||||||
for (let i = 0; i != array.length; ++i) {
|
for (let i = 0; i = array.length; ++i) {
|
||||||
view[i] = array[i] & 0xFF;
|
view[i] = array[i] & 0xFF;
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
@ -62,7 +67,11 @@ class CenterUDPBusiness {
|
|||||||
let a = string2Bytes(Number(`${params.id}${fillZero(params.placeId, 3)}`), 2 * 8);
|
let a = string2Bytes(Number(`${params.id}${fillZero(params.placeId, 3)}`), 2 * 8);
|
||||||
let b = string2Bytes(Number(`${fillZero(params.carNo, 4)}${AppStorage.get('lshNo')}`), 4 * 8);
|
let b = string2Bytes(Number(`${fillZero(params.carNo, 4)}${AppStorage.get('lshNo')}`), 4 * 8);
|
||||||
let c = string2Bytes(params.list.length, 2 * 8);
|
let c = string2Bytes(params.list.length, 2 * 8);
|
||||||
return [...a, ...b, ...c];
|
let result: number[] = []
|
||||||
|
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>) {
|
||||||
@ -93,12 +102,12 @@ class CenterUDPBusiness {
|
|||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
||||||
}
|
}
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
const data: UDPParamType = {
|
const data: UDPParamType = {
|
||||||
id: 31,
|
id: 31,
|
||||||
list: tmpList,
|
list: tmpList,
|
||||||
carNo: carInfo.carNo,
|
carNo: carInfo.carNo!,
|
||||||
placeId: carInfo.examinationRoomId
|
placeId: carInfo.examinationRoomId!
|
||||||
}
|
}
|
||||||
const param = this.setWholeMsg(data)
|
const param = this.setWholeMsg(data)
|
||||||
this.udp.sendMsg(param);
|
this.udp.sendMsg(param);
|
||||||
@ -117,9 +126,9 @@ class CenterUDPBusiness {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
let result: EnvironmentConfigurationType =
|
let result: EnvironmentConfigurationType =
|
||||||
AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")
|
AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")!
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
this.udp.create(result.udplocalIp, '8800', carInfo?.udpAddress, carInfo?.messagePort)
|
this.udp.create(result.udplocalIp!, '8800', carInfo.udpAddress!, carInfo.messagePort!)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject)
|
.catch(reject)
|
||||||
this.udp.setDealMethod(this.dealMsg)
|
this.udp.setDealMethod(this.dealMsg)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ function string2Bytes(num: number | string, len: number) {
|
|||||||
let str = (Math.floor(Number(num))).toString(2);
|
let str = (Math.floor(Number(num))).toString(2);
|
||||||
if (str.length > len) {
|
if (str.length > len) {
|
||||||
console.log('数据长度不对~~');
|
console.log('数据长度不对~~');
|
||||||
return
|
return []
|
||||||
}
|
}
|
||||||
let byteString = FillZero(str, len);
|
let byteString = FillZero(str, len);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ function string2Bytes(num: number | string, len: number) {
|
|||||||
|
|
||||||
class JudgeUdpBusiness {
|
class JudgeUdpBusiness {
|
||||||
private static instance: JudgeUdpBusiness
|
private static instance: JudgeUdpBusiness
|
||||||
private udp: UdpClient
|
private udp: UdpClient = new UdpClient()
|
||||||
private currentUdpIndex = 0;
|
private currentUdpIndex = 0;
|
||||||
public udpIndex = 0;
|
public udpIndex = 0;
|
||||||
|
|
||||||
@ -81,7 +81,11 @@ class JudgeUdpBusiness {
|
|||||||
let a = string2Bytes(Number(`${params.id}${fillZero(params.placeId, 3)}`), 2 * 8);
|
let a = string2Bytes(Number(`${params.id}${fillZero(params.placeId, 3)}`), 2 * 8);
|
||||||
let b = string2Bytes(Number(`${fillZero(params.carNo, 4)}${AppStorage.get('lshNo')}`), 4 * 8);
|
let b = string2Bytes(Number(`${fillZero(params.carNo, 4)}${AppStorage.get('lshNo')}`), 4 * 8);
|
||||||
let c = string2Bytes(params.list.length, 2 * 8);
|
let c = string2Bytes(params.list.length, 2 * 8);
|
||||||
return [...a, ...b, ...c];
|
let result: number[] = []
|
||||||
|
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>) {
|
||||||
@ -231,7 +235,7 @@ class JudgeUdpBusiness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMessageHeartbeat(msg: string): Promise<number[]> {
|
async getMessageHeartbeat(msg: string): Promise<number[]> {
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit
|
let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit
|
||||||
const asclshArr = StringToASCII(FillZero(
|
const asclshArr = StringToASCII(FillZero(
|
||||||
AppStorage.get<boolean>("singlePlay")
|
AppStorage.get<boolean>("singlePlay")
|
||||||
@ -240,7 +244,7 @@ class JudgeUdpBusiness {
|
|||||||
13));
|
13));
|
||||||
const ascksyhArr = StringToASCII(carInfo.examSubject === '2' ? '0000000000000' : '1111111111111')
|
const ascksyhArr = StringToASCII(carInfo.examSubject === '2' ? '0000000000000' : '1111111111111')
|
||||||
const ascsbxhArr = StringToASCII('00000000')
|
const ascsbxhArr = StringToASCII('00000000')
|
||||||
const serialIndex = AppStorage.get<number>("serialIndex")
|
const serialIndex = AppStorage.get<number>("serialIndex")!
|
||||||
const plcData = await this.getPlcData(msg);
|
const plcData = await this.getPlcData(msg);
|
||||||
let param: number[] = Object.entries(plcData.sensor)
|
let param: number[] = Object.entries(plcData.sensor)
|
||||||
.filter((item: [string, number]) => {
|
.filter((item: [string, number]) => {
|
||||||
@ -328,13 +332,13 @@ class JudgeUdpBusiness {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendData(bytes: number[]) {
|
sendData(bytes: number[]) {
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
if (this.udpIndex > this.currentUdpIndex) {
|
if (this.udpIndex > this.currentUdpIndex) {
|
||||||
this.udp.sendMsgExt({
|
this.udp.sendMsgExt({
|
||||||
id: 45,
|
id: 45,
|
||||||
list: bytes,
|
list: bytes,
|
||||||
carNo: carInfo.carNo,
|
carNo: carInfo.carNo!,
|
||||||
placeId: carInfo.examinationRoomId
|
placeId: carInfo.examinationRoomId!
|
||||||
})
|
})
|
||||||
this.currentUdpIndex = this.udpIndex
|
this.currentUdpIndex = this.udpIndex
|
||||||
}
|
}
|
||||||
@ -342,24 +346,24 @@ class JudgeUdpBusiness {
|
|||||||
|
|
||||||
//申请远程扣分查询
|
//申请远程扣分查询
|
||||||
askKf(directives: number) {
|
askKf(directives: number) {
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
CenterUDPClientInstance.sendData({
|
CenterUDPClientInstance.sendData({
|
||||||
id: 35,
|
id: 35,
|
||||||
list: [directives],
|
list: [directives],
|
||||||
carNo: carInfo.carNo,
|
carNo: carInfo.carNo!,
|
||||||
placeId: carInfo.examinationRoomId,
|
placeId: carInfo.examinationRoomId!,
|
||||||
})
|
})
|
||||||
console.info('surenjun', `考车查询扣分项目内容,请求指令为:${directives}`)
|
console.info('surenjun', `考车查询扣分项目内容,请求指令为:${directives}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//确定远程扣分
|
//确定远程扣分
|
||||||
confirmKf(directives: number, code: number) {
|
confirmKf(directives: number, code: number) {
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
CenterUDPClientInstance.sendData({
|
CenterUDPClientInstance.sendData({
|
||||||
id: 37,
|
id: 37,
|
||||||
list: [directives, code],
|
list: [directives, code],
|
||||||
carNo: carInfo.carNo,
|
carNo: carInfo.carNo!,
|
||||||
placeId: carInfo.examinationRoomId
|
placeId: carInfo.examinationRoomId!
|
||||||
})
|
})
|
||||||
console.info('surenjun', `考车发送确定扣分指令,指令为:${directives}`)
|
console.info('surenjun', `考车发送确定扣分指令,指令为:${directives}`)
|
||||||
}
|
}
|
||||||
@ -368,9 +372,9 @@ class JudgeUdpBusiness {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
let result: EnvironmentConfigurationType =
|
let result: EnvironmentConfigurationType =
|
||||||
AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")
|
AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")!
|
||||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')
|
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||||
this.udp.create(result.udplocalIp, '8080', carInfo.udpAddress, carInfo.hintPort).then(resolve).catch(reject)
|
this.udp.create(result.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
|
||||||
|
|
||||||
@ -378,8 +382,8 @@ class JudgeUdpBusiness {
|
|||||||
if (stashArr[0] != '#DN_GD') {
|
if (stashArr[0] != '#DN_GD') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const udpIndex = AppStorage.get<number>("udpIndex");
|
const udpIndex = AppStorage.get<number>("udpIndex")!;
|
||||||
const isJudge = AppStorage.get<boolean>("isJudge");
|
const isJudge = AppStorage.get<boolean>("isJudge")!;
|
||||||
if (udpIndex % 5 === 0 && !isJudge) {
|
if (udpIndex % 5 === 0 && !isJudge) {
|
||||||
const bytes = await this.getMessageHeartbeat(msg);
|
const bytes = await this.getMessageHeartbeat(msg);
|
||||||
const msgArr: string[] = msg.split(',');
|
const msgArr: string[] = msg.split(',');
|
||||||
|
|||||||
@ -21,22 +21,22 @@ class JudgeEmitter {
|
|||||||
}
|
}
|
||||||
private kfContent: Function = () => {
|
private kfContent: Function = () => {
|
||||||
}
|
}
|
||||||
private directives: string
|
private directives: string = ''
|
||||||
|
|
||||||
//监听开始考试
|
//监听开始考试
|
||||||
public onBeginExam(callBack?: Function) {
|
public onBeginExam(callBack: Function) {
|
||||||
console.info('surenjun', '注册远程开始考试事件')
|
console.info('surenjun', '注册远程开始考试事件')
|
||||||
this.beginExamCallBack = callBack
|
this.beginExamCallBack = callBack
|
||||||
}
|
}
|
||||||
|
|
||||||
//监听结束考试
|
//监听结束考试
|
||||||
public onEndExam(callBack?: Function) {
|
public onEndExam(callBack: Function) {
|
||||||
console.info('surenjun', '注册远程结束考试事件')
|
console.info('surenjun', '注册远程结束考试事件')
|
||||||
this.endExamCallBack = callBack
|
this.endExamCallBack = callBack
|
||||||
}
|
}
|
||||||
|
|
||||||
//监听扣分处理
|
//监听扣分处理
|
||||||
public onKfExam(callBack?: Function) {
|
public onKfExam(callBack: Function) {
|
||||||
console.info('surenjun', '注册远程扣分考试事件')
|
console.info('surenjun', '注册远程扣分考试事件')
|
||||||
this.kfContent = callBack
|
this.kfContent = callBack
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user