fix: 济南后置机方案

This commit is contained in:
wangzhongjie 2025-02-21 15:38:00 +08:00
parent 912f5636db
commit 0d6b3c7c07
2 changed files with 27 additions and 32 deletions

View File

@ -1,8 +1,8 @@
import { getSyncData } from '../common/service/initable'; import { getSyncData } from '../common/service/initable';
import request from "../common/utils/request" import request from '../common/utils/request';
let baseHost = globalThis.host;
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import FileLog from '../pages/judgeSDK/utils/fileLog';
let baseHost = globalThis.host;
//监管接口序列号映射 //监管接口序列号映射
const gjxlhObj = { const gjxlhObj = {
@ -28,9 +28,15 @@ export default async function writeObjectOutNew(data,filePath): Promise<WR> {
if (filePath) { if (filePath) {
await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({
wglb,jkxlh,glbm,jgbh,sjbs, wglb,
jkxlh,
glbm,
jgbh,
sjbs,
data: params.data, data: params.data,
file:{...params.file,param:[]}, file: {
...params.file, param: []
},
})); }));
} }

View File

@ -13,13 +13,13 @@
* limitations under the License. * limitations under the License.
*/ */
// @ts-ignore
import socket, { UDPSocket } from '@ohos.net.socket'; import socket, { UDPSocket } from '@ohos.net.socket';
import { Array2Byte, dateFormat, fillZero, string2Bytes } from '../utils/tools'; import { Array2Byte, dateFormat, fillZero, string2Bytes } from '../utils/tools';
import FileUtil from '../../common/utils/File'; import FileUtil from '../../common/utils/File';
import prompt from '@ohos.prompt'; import prompt from '@ohos.prompt';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { getUDP } from './GlobalUdp'; import { getUDP } from './GlobalUdp';
import UdpByOne from './UdpByOne';
const TAG = '[UdpDemo.UdpClient]' const TAG = '[UdpDemo.UdpClient]'
@ -47,7 +47,6 @@ export default class UdpClientByCenter {
private isWorking: Boolean = false private isWorking: Boolean = false
private plcUdpError = false; private plcUdpError = false;
private initParam private initParam
private UPDOne: any
constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { constructor(udplocalIp: string, udplocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
this.localIp = udplocalIp this.localIp = udplocalIp
@ -58,7 +57,6 @@ export default class UdpClientByCenter {
} }
this.udp = socket.constructUDPSocketInstance(); this.udp = socket.constructUDPSocketInstance();
this.initPath() this.initPath()
this.UPDOne = new UdpByOne()
} }
getStatus() { getStatus() {
@ -257,16 +255,10 @@ export default class UdpClientByCenter {
list.push(arr[i]) list.push(arr[i])
} }
this.stashFn({ this.stashFn({
id, id, length, body: list, sendId: this.sendId
length,
body: list,
sendId: this.sendId
}) })
callback({ callback({
id, id, length, body: list, sendId: this.sendId
length,
body: list,
sendId: this.sendId
}) })
@ -298,15 +290,12 @@ export default class UdpClientByCenter {
}) })
} }
// TODO 赋值onMessage_1
//plc //plc
onMessage_1(callback?) { onMessage_1(callback?) {
this.onMessage_1Callback = callback; this.onMessage_1Callback = callback;
this.UPDOne.receiveMsg(callback); this.udp && this.udp.on('message', this.message_1Fn);
// this.udp && this.udp.on('message', this.message_1Fn);
} }
closeMessage_1() { closeMessage_1() {
console.info('surenjun', 'getUDP关闭udp message监听事件') console.info('surenjun', 'getUDP关闭udp message监听事件')
this.udp.off('message', this.message_1Fn); this.udp.off('message', this.message_1Fn);