Browse Source

增加communication相关通讯内容

main
hulei 1 week ago
parent
commit
309a4242bd
16 changed files with 1487 additions and 148 deletions
  1. 31
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/CommonSettings.ts
  2. 119
    122
      ant-design-pro-vue3/src/views/front/develop/Communication/Message.ts
  3. 1
    1
      ant-design-pro-vue3/src/views/front/develop/Communication/MessageHelper/MsgBitMap.ts
  4. 1
    1
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/IPackage.ts
  5. 1
    1
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858301.ts
  6. 9
    10
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858302.ts
  7. 209
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858303.ts
  8. 203
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858304.ts
  9. 237
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/MsgPackage.ts
  10. 140
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/MsgXml01.ts
  11. 13
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/PackageOptions.ts
  12. 21
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/Package/PackageType.ts
  13. 104
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/SocketListener/BufferManager.ts
  14. 393
    0
      ant-design-pro-vue3/src/views/front/develop/Communication/SocketListener/SocketManager.ts
  15. 4
    8
      ant-design-pro-vue3/src/views/front/develop/ServiceProxy.Ext/ServiceHelper/TradeHandle.ts
  16. 1
    5
      ant-design-pro-vue3/src/views/front/platfrom/common/RunningParameters/PlatformSettings.ts

+ 31
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/CommonSettings.ts View File

@@ -0,0 +1,31 @@
1
+// 模拟 ConfigManager 类和 ConfigType 枚举
2
+enum ConfigType {
3
+    System
4
+}
5
+
6
+class ConfigManager {
7
+    private static instance: ConfigManager;
8
+    private constructor() { }
9
+
10
+    static GetInstance(): ConfigManager {
11
+        if (!this.instance) {
12
+            this.instance = new ConfigManager();
13
+        }
14
+        return this.instance;
15
+    }
16
+
17
+    GetConfigValue(key: string, type: ConfigType): string {
18
+        // 这里应该实现实际的配置读取逻辑
19
+        // 目前只是返回一个默认值
20
+        return "defaultKey";
21
+    }
22
+}
23
+
24
+export default class CommonSettings {
25
+    /**
26
+     * 通讯采用的加密方式
27
+     */
28
+    static get KeyStr(): string {
29
+        return ConfigManager.GetInstance().GetConfigValue("KeyStr", ConfigType.System);
30
+    }
31
+}

+ 119
- 122
ant-design-pro-vue3/src/views/front/develop/Communication/Message.ts View File

@@ -24,6 +24,7 @@ export enum BitMap {
24 24
 }
25 25
 export default class Message {
26 26
 
27
+
27 28
     static cconv(fileData: string): string {
28 29
         throw new Error("Method not implemented.");
29 30
     }
@@ -123,7 +124,7 @@ export default class Message {
123 124
         let result = '';
124 125
         if (this._fdDict[fdName]) {
125 126
             const decoder = new TextDecoder();
126
-            result = decoder.decode(this._fdDict[fdName]);
127
+            // result = decoder.decode(this._fdDict[fdName]);//hulei  zheg fdDict属性不明确
127 128
         }
128 129
         return result;
129 130
     }
@@ -161,8 +162,8 @@ export default class Message {
161 162
     //     }
162 163
 
163 164
     // }
164
-    private static BitMapInstance(): MsgBitMap {
165
-        switch (BitMapType) {
165
+    get BitMapInstance(): MsgBitMap {
166
+        switch (this.BitMapType) {
166 167
             case BitMap.Server:
167 168
                 return MsgBitMap.Instance_Server;
168 169
             case BitMap.Agn:
@@ -193,12 +194,12 @@ export default class Message {
193 194
     */
194 195
     public Init(type?: BitMap): void {
195 196
         if (type === undefined) {
196
-            this._fdDict.Clear();
197
-            this._fileData = string.Empty;
197
+            // this._fdDict.Clear();hulei 这里情况的操作是Dictionary的方法 需要寻找代替的类型
198
+            this._fileData = null;
198 199
             // //TransitNode = TransitType.CallServer; //初始化默认为CallServer
199 200
             // //BitMapType = type;
200 201
             this.CustomizeTransitEntry = null;
201
-            Extra = new Dictionary<string, object>();
202
+            // Extra = new Dictionary<string, object>();
202 203
         } else {
203 204
             // this._fdDict = {};
204 205
             // this._fileData = '';
@@ -209,8 +210,119 @@ export default class Message {
209 210
         }
210 211
 
211 212
     }
213
+    public anilyzeFd(msgData: Uint8Array): boolean {
214
+        // 拆解位图,报文数据区格式为 5位报文类型+8/16位位图区域+有效数据区
215
+        // 标志位,是否采用128位位图
216
+        const isBitmap128 = msgData[5].toString(2).padStart(8, '0').startsWith('1');
217
+        let bitMap = '';
218
+        const msgBit = new Uint8Array(isBitmap128 ? 16 : 8);
219
+        msgBit.set(msgData.slice(5, 5 + msgBit.length));
220
+        // 扩展16位字符串转换为128位01格式的位图字符串
221
+        for (const bytes of msgBit) {
222
+            bitMap += bytes.toString(2).padStart(8, '0');
223
+        }
224
+        // 拆解数据部分
225
+        const startIndex = 5 + (isBitmap128 ? 16 : 8);
226
+        const data = new Uint8Array(msgData.length - startIndex);
227
+        data.set(msgData.slice(startIndex));
228
+        let curPosition = 0;
229
+        // 日志内容
230
+        const logInfo: string[] = [];
231
+        logInfo.push("解包数据:");
232
+        logInfo.push(`解包位图:[${bitMap}]`);
233
+        try {
234
+            // 循环解包
235
+            for (let i = 0; i < bitMap.length; i++) {
236
+                if (bitMap[i] === '1') {
237
+                    // 第一位为标志位
238
+                    if (i + 1 === 1) {
239
+                        continue;
240
+                    }
241
+                    const fdName = (i + 1).toString().padStart(3, '0') + "0";
212 242
 
213
-
243
+                    if (!this.BitMapInstance.FdBitMap[fdName]) {
244
+                        continue;
245
+                    }
246
+                    // 先清理组包数据,否则解析子域会产生数据交错
247
+                    clearFd(i + 1);
248
+                    const item = this.BitMapInstance.FdBitMap[fdName];
249
+                    let tmp: Uint8Array | null = null;
250
+                    switch (item.FieldType) {
251
+                        case "-1":
252
+                            break;
253
+                        case "0":
254
+                            // 定长域
255
+                            tmp = new Uint8Array(item.Length);
256
+                            // 截取数据区域,判定新位置
257
+                            tmp.set(data.slice(curPosition, curPosition + item.Length));
258
+                            curPosition += item.Length;
259
+                            break;
260
+                        default:
261
+                            // 变长域
262
+                            // 获取数据长度
263
+                            const len = parseInt(item.FieldType, 10);
264
+                            tmp = new Uint8Array(len);
265
+                            tmp.set(data.slice(curPosition, curPosition + len));
266
+                            curPosition += len;
267
+                            // 获取数据部分
268
+                            const length = parseInt(encodingToString(tmp), 10);
269
+                            tmp = new Uint8Array(length);
270
+                            tmp.set(data.slice(curPosition, curPosition + length));
271
+                            curPosition += length;
272
+                            break;
273
+                    }
274
+                    if (!tmp) continue;
275
+                    // 记录日志
276
+                    const value = encodingToString(tmp);
277
+                    logInfo.push(`第${(i + 1).toString().padStart(3, '0')}域:[${value}]`);
278
+                    if (!item.Children || item.Children.length === 0) {
279
+                        // // 生僻字处理,字符类型FD需要检查
280
+                        // if ("056".includes(item.Type) && hasCconvKey(value)) {
281
+                        //     const val = item.RealValue ? item.RealValue(value) : value;
282
+                        //     const newVal = item.FormatValue ? item.FormatValue(cconv(val as string, false)) : val;
283
+                        //     tmp = encodingGetBytes(newVal);
284
+                        // }//hulei 生僻字处理暂时放弃
285
+                        // if (fdDict.hasOwnProperty(item.Code)) { //hulei typescript中是否有类似于wpf的 Dictionary类型
286
+                        //     fdDict[item.Code] = tmp;
287
+                        // } else {
288
+                        //     fdDict[item.Code] = tmp;
289
+                        // }
290
+                    } else {
291
+                        // 循环给子域赋值,子域暂时只存在定长域
292
+                        let index = 0;
293
+                        for (const child of item.Children) {
294
+                            if (index >= tmp.length) break;
295
+                            // 子域为定长
296
+                            const childLen = Math.min(index + child.Length, tmp.length) - index;
297
+                            const childData = new Uint8Array(childLen);
298
+                            childData.set(tmp.slice(index, index + childLen));
299
+                            index += childData.length;
300
+                            const chindValue = encodingToString(childData);
301
+                            // // 生僻字处理,字符类型FD需要检查
302
+                            // if ("056".includes(child.Type) && hasCconvKey(chindValue)) {
303
+                            //     const val = child.RealValue ? child.RealValue(chindValue) : chindValue;
304
+                            //     const newVal = child.FormatValue ? child.FormatValue(cconv(val as string, false)) : val;
305
+                            //     childData = encodingGetBytes(newVal);
306
+                            // }hulei 生僻字处理暂时放弃
307
+                            // if (fdDict.hasOwnProperty(child.Code)) {//hulei typescript中是否有类似于wpf的 Dictionary类型
308
+                            //     fdDict[child.Code] = childData;
309
+                            // } else {
310
+                            //     fdDict[child.Code] = childData;
311
+                            // }
312
+                        }
313
+                    }
314
+                }
315
+            }
316
+            // 解包完成后将解析数据写入交易日志文件
317
+            communicationInfo(logInfo.join('\n'));
318
+            return true;
319
+        } catch (e) {
320
+            // 解包失败
321
+            logInfo.push(`解包出错:${(e as Error).message}`);
322
+            communicationInfo(logInfo.join('\n'));
323
+            return false;
324
+        }
325
+    }
214 326
     // 以下是各域的定义,保持与C#代码相同的命名规范
215 327
     get Fd1(): string { return this.getFdVaule('0010').toString() }
216 328
     set Fd1(value: string) { this.setFdValue('0010', value) }
@@ -476,121 +588,6 @@ export default class Message {
476 588
     }
477 589
     // 实现剩余所有域...
478 590
     // 按照相同模式实现Fd21到Fd47的所有域
479
-
480
-
481
-
482
-    public static anilyzeFd(msgData: Uint8Array): boolean {
483
-        // 拆解位图,报文数据区格式为 5位报文类型+8/16位位图区域+有效数据区
484
-        // 标志位,是否采用128位位图
485
-        const isBitmap128 = msgData[5].toString(2).padStart(8, '0').startsWith('1');
486
-        let bitMap = '';
487
-        const msgBit = new Uint8Array(isBitmap128 ? 16 : 8);
488
-        msgBit.set(msgData.slice(5, 5 + msgBit.length));
489
-        // 扩展16位字符串转换为128位01格式的位图字符串
490
-        for (const bytes of msgBit) {
491
-            bitMap += bytes.toString(2).padStart(8, '0');
492
-        }
493
-        // 拆解数据部分
494
-        const startIndex = 5 + (isBitmap128 ? 16 : 8);
495
-        const data = new Uint8Array(msgData.length - startIndex);
496
-        data.set(msgData.slice(startIndex));
497
-        let curPosition = 0;
498
-        // 日志内容
499
-        const logInfo: string[] = [];
500
-        logInfo.push("解包数据:");
501
-        logInfo.push(`解包位图:[${bitMap}]`);
502
-        try {
503
-            // 循环解包
504
-            for (let i = 0; i < bitMap.length; i++) {
505
-                if (bitMap[i] === '1') {
506
-                    // 第一位为标志位
507
-                    if (i + 1 === 1) {
508
-                        continue;
509
-                    }
510
-                    const fdName = (i + 1).toString().padStart(3, '0') + "0";
511
-                    if (!this.BitMapInstance.FdBitMap[fdName]) {
512
-                        continue;
513
-                    }
514
-                    // 先清理组包数据,否则解析子域会产生数据交错
515
-                    clearFd(i + 1);
516
-                    const item = this.BitMapInstance.FdBitMap[fdName];
517
-                    let tmp: Uint8Array | null = null;
518
-                    switch (item.FieldType) {
519
-                        case "-1":
520
-                            break;
521
-                        case "0":
522
-                            // 定长域
523
-                            tmp = new Uint8Array(item.Length);
524
-                            // 截取数据区域,判定新位置
525
-                            tmp.set(data.slice(curPosition, curPosition + item.Length));
526
-                            curPosition += item.Length;
527
-                            break;
528
-                        default:
529
-                            // 变长域
530
-                            // 获取数据长度
531
-                            const len = parseInt(item.FieldType, 10);
532
-                            tmp = new Uint8Array(len);
533
-                            tmp.set(data.slice(curPosition, curPosition + len));
534
-                            curPosition += len;
535
-                            // 获取数据部分
536
-                            const length = parseInt(encodingToString(tmp), 10);
537
-                            tmp = new Uint8Array(length);
538
-                            tmp.set(data.slice(curPosition, curPosition + length));
539
-                            curPosition += length;
540
-                            break;
541
-                    }
542
-                    if (!tmp) continue;
543
-                    // 记录日志
544
-                    const value = encodingToString(tmp);
545
-                    logInfo.push(`第${(i + 1).toString().padStart(3, '0')}域:[${value}]`);
546
-                    if (!item.Children || item.Children.length === 0) {
547
-                        // // 生僻字处理,字符类型FD需要检查
548
-                        // if ("056".includes(item.Type) && hasCconvKey(value)) {
549
-                        //     const val = item.RealValue ? item.RealValue(value) : value;
550
-                        //     const newVal = item.FormatValue ? item.FormatValue(cconv(val as string, false)) : val;
551
-                        //     tmp = encodingGetBytes(newVal);
552
-                        // }//hulei 生僻字处理暂时放弃
553
-                        if (fdDict.hasOwnProperty(item.Code)) {
554
-                            fdDict[item.Code] = tmp;
555
-                        } else {
556
-                            fdDict[item.Code] = tmp;
557
-                        }
558
-                    } else {
559
-                        // 循环给子域赋值,子域暂时只存在定长域
560
-                        let index = 0;
561
-                        for (const child of item.Children) {
562
-                            if (index >= tmp.length) break;
563
-                            // 子域为定长
564
-                            const childLen = Math.min(index + child.Length, tmp.length) - index;
565
-                            const childData = new Uint8Array(childLen);
566
-                            childData.set(tmp.slice(index, index + childLen));
567
-                            index += childData.length;
568
-                            const chindValue = encodingToString(childData);
569
-                            // // 生僻字处理,字符类型FD需要检查
570
-                            // if ("056".includes(child.Type) && hasCconvKey(chindValue)) {
571
-                            //     const val = child.RealValue ? child.RealValue(chindValue) : chindValue;
572
-                            //     const newVal = child.FormatValue ? child.FormatValue(cconv(val as string, false)) : val;
573
-                            //     childData = encodingGetBytes(newVal);
574
-                            // }hulei 生僻字处理暂时放弃
575
-                            if (fdDict.hasOwnProperty(child.Code)) {
576
-                                fdDict[child.Code] = childData;
577
-                            } else {
578
-                                fdDict[child.Code] = childData;
579
-                            }
580
-                        }
581
-                    }
582
-                }
583
-            }
584
-            // 解包完成后将解析数据写入交易日志文件
585
-            communicationInfo(logInfo.join('\n'));
586
-            return true;
587
-        } catch (e) {
588
-            // 解包失败
589
-            logInfo.push(`解包出错:${(e as Error).message}`);
590
-            communicationInfo(logInfo.join('\n'));
591
-            return false;
592
-        }
593
-    }
594 591
 }
595 592
 function clearFd(arg0: number) {
596 593
     throw new Error('Function not implemented.');

+ 1
- 1
ant-design-pro-vue3/src/views/front/develop/Communication/MessageHelper/MsgBitMap.ts View File

@@ -88,7 +88,7 @@ export class MsgBitMap {
88 88
     private static _instance_Agn: MsgBitMap
89 89
     private static _instance_Cnaps2: MsgBitMap
90 90
 
91
-    public static FdBitMap: Record<string, FdItem> = {}
91
+    FdBitMap: Record<string, FdItem> = {}
92 92
 
93 93
     private constructor() { }
94 94
 

+ 1
- 1
ant-design-pro-vue3/src/views/front/develop/Communication/Package/IPackage.ts View File

@@ -3,7 +3,7 @@ import Message from "@/views/front/develop/Communication/Message";
3 3
 /**
4 4
  * 报文打包解包接口
5 5
  */
6
-export interface IPackage {
6
+export default interface IPackage {
7 7
     /**
8 8
      * 组包操作
9 9
      * @param msg 核心返回数据包

+ 1
- 1
ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858301.ts View File

@@ -1,6 +1,6 @@
1 1
 import Message from "@/views/front/develop/Communication/Message";
2 2
 import PlatformLogger from "@/views/front/platfrom/common/LogSystem/PlatformLogger";
3
-import { IPackage } from './IPackage'
3
+import IPackage from './IPackage'
4 4
 import LoginUserInfo from "@/views/front/platfrom/common/RunningParameters/LoginUserInfo";
5 5
 
6 6
 /**

+ 9
- 10
ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858302.ts View File

@@ -1,9 +1,8 @@
1 1
 import Message from "@/views/front/develop/Communication/Message";
2 2
 import PlatformLogger from "@/views/front/platfrom/common/LogSystem/PlatformLogger";
3
-import { PlatformSettings } from './PlatformSettings'
4
-import { IPackage } from './IPackage'
5
-import { MsgPackage } from './MsgPackage'
6
-import { CommonSettings } from './CommonSettings'
3
+import IPackage from './IPackage'
4
+import MsgPackage from "@/views/front/develop/Communication/Package/MsgPackage"
5
+import CommonSettings from "@/views/front/develop/Communication/CommonSettings";
7 6
 
8 7
 /**
9 8
  * 8583 128域类型报文,Tuxedo通讯方式的组包,解包处理。
@@ -34,7 +33,7 @@ export class Msg858302 implements IPackage {
34 33
             returnData = this.doIntegrate(msg)
35 34
         } catch (ex) {
36 35
             // 写错误信息
37
-            PlatformLogger.systemErrorInfo("组包发生异常:", ex)
36
+            PlatformLogger.SystemErrorInfo("组包发生异常:", ex)
38 37
             throw ex
39 38
         }
40 39
         return returnData
@@ -114,7 +113,7 @@ export class Msg858302 implements IPackage {
114 113
             }
115 114
 
116 115
             // 加密报文数据区
117
-            MsgPackage.encrypt(msgData, new TextEncoder().encode(CommonSettings.keyStr), 1)
116
+            MsgPackage.Encrypt(msgData, new TextEncoder().encode(CommonSettings.KeyStr), 1)
118 117
 
119 118
             // 合并组包数据
120 119
             // tuxedo报文头前面没有8位的报文长度
@@ -138,7 +137,7 @@ export class Msg858302 implements IPackage {
138 137
             totalMsgData[totalMsgData.length - 1] = fileFlag
139 138
         } catch (ex) {
140 139
             // 写错误信息
141
-            PlatformLogger.systemErrorInfo("组包发生异常!", ex)
140
+            PlatformLogger.SystemErrorInfo("组包发生异常!", ex)
142 141
             throw ex
143 142
         }
144 143
         return totalMsgData
@@ -154,8 +153,8 @@ export class Msg858302 implements IPackage {
154 153
         const clnm = "".padStart(5, ' ')         //5位   空串
155 154
         const svcnm = "".padStart(15, ' ')       //15位  Tuxedo交易服务名
156 155
         const reqtype = "4"                      //1位   "4"
157
-        const branchNo = msg.fd3.padStart(10, ' ') //10位   机构编号
158
-        const tty = msg.fd10.padStart(12, ' ')   //12位   终端号
156
+        const branchNo = msg.Fd3.padStart(10, ' ') //10位   机构编号
157
+        const tty = msg.Fd10.padStart(12, ' ')   //12位   终端号
159 158
         const titaOr8583 = "8"                   //1位   代码中的值 8'
160 159
         const cbs = "".padStart(10, ' ')         //10位  空串
161 160
         const macflg = "".padStart(1, ' ')       //1位   空串
@@ -196,7 +195,7 @@ export class Msg858302 implements IPackage {
196 195
             }
197 196
         } catch (ex) {
198 197
             // 写错误信息
199
-            PlatformLogger.systemErrorInfo("解析报文失败!", ex)
198
+            PlatformLogger.SystemErrorInfo("解析报文失败!", ex)
200 199
             throw ex
201 200
         }
202 201
     }

+ 209
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858303.ts View File

@@ -0,0 +1,209 @@
1
+// 定义相关接口
2
+interface Message {
3
+    FileFlag: boolean;
4
+    BitMapInstance: {
5
+        FdBitMap: Map<string, FdItem>;
6
+    };
7
+    IntegrateFd(bitMapByte: Uint8Array): Uint8Array;
8
+    GetFdFormatValue(code: string): string;
9
+}
10
+
11
+interface FdItem {
12
+    Code: string;
13
+    FieldType: string;
14
+    Length: number;
15
+    Children?: FdItem[];
16
+}
17
+
18
+// 模拟 PlatformSettings 类
19
+class PlatformSettings {
20
+    static Encoding = {
21
+        getBytes: (str: string) => new TextEncoder().encode(str),
22
+        getString: (bytes: Uint8Array) => new TextDecoder().decode(bytes)
23
+    };
24
+}
25
+
26
+// 模拟 PlatformLogger 类
27
+class PlatformLogger {
28
+    static CommunicationInfo(info: string) {
29
+        console.log(info);
30
+    }
31
+
32
+    static SystemErrorInfo(message: string, ex: any) {
33
+        console.error(message, ex);
34
+    }
35
+}
36
+
37
+export class Msg858303 {
38
+    private static instance: Msg858303;
39
+
40
+    private constructor() {}
41
+
42
+    public static GetInstance(): Msg858303 {
43
+        if (!this.instance) {
44
+            this.instance = new Msg858303();
45
+        }
46
+        return this.instance;
47
+    }
48
+
49
+    public Integrate(msg: Message): Uint8Array {
50
+        let returnData: Uint8Array | null = null;
51
+
52
+        try {
53
+            returnData = this.DoIntegrate(msg);
54
+        } catch (ex) {
55
+            throw ex;
56
+        }
57
+        return returnData!;
58
+    }
59
+
60
+    public Analyze(msg: Message, data: Uint8Array): boolean {
61
+        try {
62
+            this.DoAnalyze(msg, data);
63
+        } catch (ex) {
64
+            return false;
65
+        }
66
+        return true;
67
+    }
68
+
69
+    private DoIntegrate(msg: Message): Uint8Array {
70
+        let msgData: Uint8Array;
71
+        let totalLen: number;
72
+        let strLen: string;
73
+        let msgDataLen: number;
74
+        let msgTitle: string;
75
+        let msgKindByte: Uint8Array;
76
+        let bitMapByte = new Uint8Array(16);
77
+        let bitDataByte: Uint8Array;
78
+        let totalMsgData: Uint8Array;
79
+
80
+        let fileFlag: number;
81
+        if (msg.FileFlag) {
82
+            fileFlag = 0x7f;
83
+        } else {
84
+            fileFlag = 0xff;
85
+        }
86
+
87
+        try {
88
+            msgKindByte = PlatformSettings.Encoding.getBytes("     ");
89
+            bitDataByte = msg.IntegrateFd(bitMapByte);
90
+
91
+            msgDataLen = msgKindByte.length + bitMapByte.length + bitDataByte.length;
92
+            totalLen = msgDataLen + 63;
93
+            strLen = totalLen.toString().padStart(8, '0');
94
+            msgTitle = msgDataLen.toString().padStart(4, '0');
95
+            msgTitle = "0000" + "MDBS1" + "    ";
96
+            msgTitle = msgTitle.padEnd(63, ' ');
97
+
98
+            msgData = new Uint8Array(msgDataLen);
99
+            for (let i = 0; i < msgData.length; i++) {
100
+                if (i < msgKindByte.length) {
101
+                    msgData[i] = msgKindByte[i];
102
+                } else if (i < msgKindByte.length + bitMapByte.length) {
103
+                    msgData[i] = bitMapByte[i - msgKindByte.length];
104
+                } else {
105
+                    msgData[i] = bitDataByte[i - msgKindByte.length - bitMapByte.length];
106
+                }
107
+            }
108
+
109
+            let len8 = PlatformSettings.Encoding.getBytes(strLen);
110
+            let msgTitleByte = PlatformSettings.Encoding.getBytes(msgTitle);
111
+            totalMsgData = new Uint8Array(len8.length + msgTitleByte.length + msgData.length);
112
+            for (let j = 0; j < totalMsgData.length; j++) {
113
+                if (j < len8.length) {
114
+                    totalMsgData[j] = len8[j];
115
+                } else if (j < len8.length + msgTitleByte.length) {
116
+                    totalMsgData[j] = msgTitleByte[j - len8.length];
117
+                } else {
118
+                    totalMsgData[j] = msgData[j - len8.length - msgTitleByte.length];
119
+                }
120
+            }
121
+            // 设置文件标志位
122
+            // totalMsgData[totalMsgData.length - 1] = fileFlag;
123
+        } catch (ex) {
124
+            throw ex;
125
+        }
126
+        return totalMsgData;
127
+    }
128
+
129
+    private GetBitData(msg: Message, bitMap: Uint8Array): string {
130
+        let curData = "";
131
+        let tmpStr = "";
132
+        let logStr = "";
133
+
134
+        try {
135
+            let bitStr = "0".padStart(128, '0');
136
+            let bitByte = PlatformSettings.Encoding.getBytes(bitStr);
137
+            bitByte[0] = PlatformSettings.Encoding.getBytes("1")[0];
138
+
139
+            for (let i = 1; i < 128; i++) {
140
+                curData = "";
141
+                logStr += this.GetBitItemData(msg, i + 1, curData);
142
+
143
+                if (curData !== "") {
144
+                    bitByte[i] = PlatformSettings.Encoding.getBytes("1")[0];
145
+                    curData = curData.replace(/\0/g, ' ').replace(/\n/g, ' ').replace(/\r/g, ' ');
146
+                    tmpStr += curData;
147
+                }
148
+            }
149
+
150
+            bitStr = PlatformSettings.Encoding.getString(bitByte);
151
+            PlatformLogger.CommunicationInfo("\n请求数据:\n" + logStr);
152
+
153
+            for (let j = 0; j < 16; j++) {
154
+                let k = j * 8;
155
+                bitMap[j] = parseInt(bitStr.substring(k, k + 8), 2);
156
+            }
157
+        } catch (ex) {
158
+            PlatformLogger.SystemErrorInfo("获取8583位图数据出现异常!", ex);
159
+            throw ex;
160
+        }
161
+        return tmpStr;
162
+    }
163
+
164
+    private static GetBitItemData(msg: Message, i: number, curData: string): string {
165
+        let result = "";
166
+        let fdName = i.toString().padStart(3, '0') + "0";
167
+        if (!msg.BitMapInstance.FdBitMap.has(fdName)) {
168
+            throw new Error(`Fd报文定义集合中未找到Code等于[${fdName}]的域定义!`);
169
+        }
170
+        let fdItem = msg.BitMapInstance.FdBitMap.get(fdName)!;
171
+
172
+        if (!fdItem.Children || fdItem.Children.length === 0) {
173
+            result = msg.GetFdFormatValue(fdItem.Code);
174
+        } else {
175
+            let child = "";
176
+            fdItem.Children.forEach(item => {
177
+                child += msg.GetFdFormatValue(item.Code);
178
+            });
179
+            result = child;
180
+        }
181
+
182
+        switch (fdItem.FieldType) {
183
+            case "-1":
184
+                result = "";
185
+                break;
186
+            case "0":
187
+                // 定长域
188
+                break;
189
+            default:
190
+                let len = parseInt(fdItem.FieldType);
191
+                let data = PlatformSettings.Encoding.getBytes(result);
192
+                if (data.length > 0) {
193
+                    if (data.length > fdItem.Length) {
194
+                        let tmp = new Uint8Array(fdItem.Length);
195
+                        tmp.set(data.subarray(0, fdItem.Length));
196
+                        data = tmp;
197
+                    }
198
+                    result = data.length.toString().padStart(len, '0') + PlatformSettings.Encoding.getString(data);
199
+                }
200
+                break;
201
+        }
202
+        curData = result;
203
+        return `Fd${i + 1}:[${curData}]\n`;
204
+    }
205
+
206
+    private DoAnalyze(msg: Message, data: Uint8Array): void {
207
+        // 原代码未实现具体逻辑,可根据需求补充
208
+    }
209
+}

+ 203
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/Msg858304.ts View File

@@ -0,0 +1,203 @@
1
+// 定义相关接口
2
+interface Message {
3
+    FileFlag: boolean;
4
+    FileData: string;
5
+    Fd3: string;
6
+    Fd10: string;
7
+    Fd12: string;
8
+    IntegrateFd(bitMapData: Uint8Array): Uint8Array;
9
+    AnilyzeFd(msgData: Uint8Array): boolean;
10
+}
11
+
12
+// 模拟 PlatformSettings 类
13
+class PlatformSettings {
14
+    static Encoding = {
15
+        getBytes: (str: string) => new TextEncoder().encode(str),
16
+        getString: (bytes: Uint8Array) => new TextDecoder().decode(bytes)
17
+    };
18
+}
19
+
20
+// 模拟 PlatformLogger 类
21
+class PlatformLogger {
22
+    static SystemErrorInfo(message: string, ex: any) {
23
+        console.error(`${message}`, ex);
24
+    }
25
+
26
+    static CommunicationInfo(info: string) {
27
+        console.log(info);
28
+    }
29
+}
30
+
31
+// 模拟 LoginUserInfo
32
+const LoginUserInfo = {
33
+    KinbrNo: "",
34
+    TtyName: ""
35
+};
36
+
37
+// 模拟 MsgParames
38
+const MsgParames = {
39
+    MsgType: "",
40
+    KeyStr: ""
41
+};
42
+
43
+// 模拟 MsgPackage
44
+const MsgPackage = {
45
+    Encrypt: (data: Uint8Array, key: Uint8Array, mode: number) => {
46
+        // 加密逻辑待实现
47
+    }
48
+};
49
+
50
+// 模拟 CommonSettings
51
+const CommonSettings = {
52
+    KeyStr: ""
53
+};
54
+
55
+export class Msg858304 {
56
+    private static instance: Msg858304;
57
+
58
+    private constructor() {}
59
+
60
+    static GetInstance(): Msg858304 {
61
+        if (!this.instance) {
62
+            this.instance = new Msg858304();
63
+        }
64
+        return this.instance;
65
+    }
66
+
67
+    Integrate(msg: Message): Uint8Array {
68
+        let returnData: Uint8Array | null = null;
69
+
70
+        try {
71
+            returnData = this.DoIntegrate(msg);
72
+        } catch (ex) {
73
+            PlatformLogger.SystemErrorInfo("组包发生异常:", ex);
74
+            throw ex;
75
+        }
76
+        return returnData!;
77
+    }
78
+
79
+    Analyze(msg: Message, data: Uint8Array): boolean {
80
+        try {
81
+            this.DoAnalyze(msg, data);
82
+        } catch (ex) {
83
+            return false;
84
+        }
85
+        return true;
86
+    }
87
+
88
+    private DoIntegrate(msg: Message): Uint8Array {
89
+        let msgData: Uint8Array;
90
+        let totalLen: number;
91
+        let strLen: string;
92
+        let msgDataLen: number;
93
+        let msgTitle: string;
94
+        let msgKindByte: Uint8Array;
95
+        let bitMapByte = new Uint8Array(16);
96
+        let bitDataByte: Uint8Array;
97
+        let totalMsgData: Uint8Array;
98
+
99
+        const fileFlag = msg.FileFlag ? 0x7f : 0xff;
100
+
101
+        try {
102
+            msgKindByte = PlatformSettings.Encoding.getBytes("00000");
103
+            bitDataByte = msg.IntegrateFd(bitMapByte);
104
+
105
+            msgDataLen = msgKindByte.length + bitMapByte.length + bitDataByte.length;
106
+            totalLen = msgDataLen + 60;
107
+            strLen = totalLen.toString().padStart(8, '0');
108
+            msgTitle = msgDataLen.toString().padStart(4, '0').padStart(60, ' ');
109
+
110
+            msgData = new Uint8Array(msgDataLen);
111
+            for (let i = 0; i < msgData.length; i++) {
112
+                if (i < msgKindByte.length) {
113
+                    msgData[i] = msgKindByte[i];
114
+                } else if (i < msgKindByte.length + bitMapByte.length) {
115
+                    msgData[i] = bitMapByte[i - msgKindByte.length];
116
+                } else {
117
+                    msgData[i] = bitDataByte[i - msgKindByte.length - bitMapByte.length];
118
+                }
119
+            }
120
+
121
+            // 模拟加密
122
+            // MsgPackage.Encrypt(msgData, PlatformSettings.Encoding.getBytes(CommonSettings.KeyStr), 1);
123
+
124
+            const len8 = PlatformSettings.Encoding.getBytes(strLen);
125
+            const msgTitleByte = PlatformSettings.Encoding.getBytes(msgTitle);
126
+            totalMsgData = new Uint8Array(len8.length + msgTitleByte.length + msgData.length + 1);
127
+            for (let j = 0; j < totalMsgData.length - 1; j++) {
128
+                if (j < len8.length) {
129
+                    totalMsgData[j] = len8[j];
130
+                } else if (j < len8.length + msgTitleByte.length) {
131
+                    totalMsgData[j] = msgTitleByte[j - len8.length];
132
+                } else {
133
+                    totalMsgData[j] = msgData[j - len8.length - msgTitleByte.length];
134
+                }
135
+            }
136
+            totalMsgData[totalMsgData.length - 1] = fileFlag;
137
+
138
+            if (msg.FileFlag) {
139
+                const file = PlatformSettings.Encoding.getBytes(msg.FileData);
140
+                const lenData = PlatformSettings.Encoding.getBytes(file.length.toString().padStart(8, '0'));
141
+                const fileName = PlatformSettings.Encoding.getBytes((LoginUserInfo.KinbrNo + LoginUserInfo.TtyName).padEnd(30));
142
+                const ret = new Uint8Array(totalMsgData.length + fileName.length + lenData.length + file.length + 1);
143
+                ret.set(totalMsgData, 0);
144
+                ret.set(fileName, totalMsgData.length);
145
+                ret.set(lenData, totalMsgData.length + fileName.length);
146
+                ret.set(file, totalMsgData.length + fileName.length + lenData.length);
147
+                ret[ret.length - 1] = 0xff;
148
+                totalMsgData = ret;
149
+            }
150
+        } catch (ex) {
151
+            PlatformLogger.SystemErrorInfo("组包发生异常!", ex);
152
+            throw ex;
153
+        }
154
+        return totalMsgData;
155
+    }
156
+
157
+    private GetMsgT(msg: Message, msgDataLen: string): string {
158
+        let clnm = "".padStart(5, ' ');
159
+        let svcnm = "".padStart(15, ' ');
160
+        let reqtype = "4";
161
+        let branchNo = msg.Fd3.padLeft(10, ' ');
162
+        let tty = msg.Fd10.padLeft(12, ' ');
163
+        let titaOr8583 = "8";
164
+        let cbs = "".padStart(10, ' ');
165
+        let macflg = "".padStart(1, ' ');
166
+        let mac = "".padStart(8, ' ');
167
+        let result = "0";
168
+        let len = msgDataLen.padLeft(4, '0');
169
+
170
+        return clnm + svcnm + reqtype + branchNo + tty + titaOr8583 + cbs + macflg + mac + result + len;
171
+    }
172
+
173
+    private DoAnalyze(msg: Message, returnData: Uint8Array): void {
174
+        try {
175
+            const ret = returnData.slice(8);
176
+            const msg60 = ret.slice(0, 60);
177
+            const tmpLen = msg60.slice(56, 60);
178
+            let msgDataLen = parseInt(PlatformSettings.Encoding.getString(tmpLen), 10);
179
+
180
+            if (msgDataLen > 68) {
181
+                msgDataLen -= 68;
182
+            }
183
+
184
+            const msgData = ret.slice(60, 60 + msgDataLen);
185
+            // 模拟解密
186
+            // MsgPackage.Encrypt(msgData, PlatformSettings.Encoding.getBytes(CommonSettings.KeyStr), 0);
187
+
188
+            if (!msg.AnilyzeFd(msgData)) {
189
+                throw new Error("8583通讯解包操作失败!具体情况请查看日志!");
190
+            }
191
+
192
+            const fileLen = returnData.length - 68 - msgDataLen - 38 - 1;
193
+            if (fileLen > 0) {
194
+                const fileData = returnData.slice(68 + msgDataLen + 38 + 1);
195
+                msg.FileData = PlatformSettings.Encoding.getString(fileData);
196
+                PlatformLogger.CommunicationInfo("\n文件数据:\n" + msg.FileData);
197
+            }
198
+        } catch (ex) {
199
+            PlatformLogger.SystemErrorInfo("解析报文失败!", ex);
200
+            throw ex;
201
+        }
202
+    }
203
+}

+ 237
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/MsgPackage.ts View File

@@ -0,0 +1,237 @@
1
+import Message from "@/views/front/develop/Communication/Message";
2
+import PlatformLogger from "@/views/front/platfrom/common/LogSystem/PlatformLogger";
3
+import IPackage from './IPackage'
4
+import { ServiceSettings } from "@/views/front/develop/ServiceProxy.Ext/ServiceSettings"
5
+import TradeHandle from '../../ServiceProxy.Ext/ServiceHelper/TradeHandle'
6
+import { PlatformSettings } from "@/views/front/platfrom/common/RunningParameters/PlatformSettings";
7
+import { PrintManagerHandle } from "@/views/front/develop/ServiceProxy.Ext/ServiceHelper/PrintManagerHandle";
8
+import SocketManager from "@/views/front/develop/Communication/SocketListener/SocketManager"
9
+import { Msg858301 } from "./Msg858301";
10
+import { Msg858302 } from "./Msg858302";
11
+import { Msg858303 } from "./Msg858303";
12
+import { MsgXml01 } from "./MsgXml01";
13
+
14
+// 定义相关类型
15
+enum PackageType {
16
+    Msg858301,
17
+    Msg858302,
18
+    Msg858304,
19
+    MsgXml01
20
+}
21
+
22
+export default class MsgPackage {
23
+    // hulei 报文类型集合 根据不同的报文类型获取不同的单例模型 原文件中是Dictionary类型字典 typescript中没有对应的类型 这里可以自定义Dictionary类型
24
+    static PackageList: {} = {//[key in PackageType]: IPackage
25
+        // [PackageType.Msg858301]: {
26
+
27
+        // },
28
+        // [PackageType.Msg858302]: {
29
+        //     Msg858302.getInstance(),
30
+        // },
31
+        // [PackageType.Msg858304]: {
32
+        //     Msg858303.getInstance(),
33
+        // },
34
+        // [PackageType.MsgXml01]: {
35
+        //     MsgXml01.getInstance(),
36
+        // }
37
+    };
38
+
39
+    static Trade(msg: Message, packageType: PackageType, transit: string): boolean {
40
+        let integrateData: Uint8Array;
41
+        let totalData: Uint8Array;
42
+        let returnData: Uint8Array;
43
+        let fileData: Uint8Array = new Uint8Array(0);
44
+        let retunValue = false;
45
+
46
+        if (!this.PackageList[packageType]) {
47
+            PlatformLogger.TradeErrorInfo("MsgPackage.Trade:不支持的报文类型!-->" + PackageType[packageType], null);
48
+            return false;
49
+        }
50
+
51
+        try {
52
+            const packageObj = this.PackageList[packageType];
53
+            integrateData = packageObj.integrate(msg);
54
+
55
+            const fileName = msg.Fd3.replace(/\s/g, '') + msg.Fd10.replace(/\s/g, '');
56
+            const watch = new Date();
57
+            let list: Uint8Array<ArrayBufferLike>[];
58
+
59
+            if (ServiceSettings.IsRecordPrintData) {
60
+                const msgType = msg.IsMainTrade ? PackageType[packageType] : '';
61
+                try {
62
+                    const encoder = new TextEncoder();
63
+
64
+                    TradeHandle.DoTrade(transit, integrateData, msg.Fd3, fileName, encoder.encode(msg.fileData), null, msg.SerialNumber, msgType).then(x => {
65
+                        list = x;
66
+                    })
67
+                } catch {
68
+                    list = [];
69
+                }
70
+
71
+                if (msg.IsMainTrade && (list.length === 0)) {
72
+                    for (let i = 0; i < 3; i++) {
73
+                        try {
74
+                            const data = PrintManagerHandle.GetPrintExtDataById(msg.SerialNumber);
75
+                            if (data) {
76
+                                PlatformLogger.SystemInfo("MsgPackage:主通讯补偿成功!" + msg.SerialNumber);
77
+                                // list = [data.Message];
78
+                                // if (data.MsgFile && data.MsgFile.length > 0) {
79
+                                //     list.push(data.MsgFile);
80
+                                // }打印的数据暂时不处理hulei
81
+                                break;
82
+                            }
83
+                        } catch (ex) {
84
+                            PlatformLogger.SystemErrorInfo("MsgPackage:主通讯补偿失败!" + msg.SerialNumber, ex);
85
+                        }
86
+                        setTimeout(() => { }, 200);
87
+                    }
88
+                    TradeHandle.WriteImportantLog("主通讯触发补偿", msg.SerialNumber, (list.length > 0 ? "成功" : "失败"), "DoTrade", "2", SocketManager.GetLocalIpAddressList());
89
+                }
90
+            } else {
91
+                const encoder = new TextEncoder();
92
+                // PlatformSettings.Encoding.getBytes(msg.fileData) 用encoder.encode(msg.fileData) 代替hulei
93
+                TradeHandle.DoTrade(transit, integrateData, msg.Fd3, fileName, encoder.encode(msg.fileData), null, msg.SerialNumber).then(
94
+                    X => {
95
+                        list = X
96
+
97
+                    }
98
+                )
99
+
100
+            }
101
+
102
+            const endTime = new Date();
103
+            const elapsedMilliseconds = endTime.getTime() - watch.getTime();
104
+            if (elapsedMilliseconds > 2000) {
105
+                TradeHandle.WriteImportantLog("通讯时间统计", elapsedMilliseconds.toString(), msg.Fd16, "DoTrade", "2", "0.0.0.0");//hulei获取IP地址 暂时注销SocketManager.GetLocalIpAddressList().join(',')
106
+            }
107
+
108
+            msg.IsMainTrade = false;
109
+            returnData = list[0];
110
+
111
+            if (list.length > 1) {
112
+                fileData = list[1];
113
+            }
114
+
115
+            let fileDataFlag = 0;
116
+            if (returnData && returnData.length > 0) {
117
+                if (returnData.length < 20) {
118
+                    PlatformLogger.SystemErrorInfo(`MsgPackage:返回报文长度太短,无法获取附件标志!长度: ${returnData.length}`, new Error());
119
+                }
120
+                fileDataFlag = returnData[20];
121
+            } else {
122
+                msg.Fd12 = "COMM";
123
+                return false;
124
+            }
125
+
126
+            msg.fileFlag = false;
127
+            totalData = new Uint8Array(returnData.length + fileData.length);
128
+            totalData.set(returnData, 0);
129
+            totalData.set(fileData, returnData.length);
130
+
131
+            retunValue = packageObj.analyze(msg, totalData);
132
+        } catch (ex) {
133
+            PlatformLogger.SystemErrorInfo("Trade: 函数出错. ", ex);
134
+            return false;
135
+        }
136
+
137
+        return retunValue;
138
+    }
139
+
140
+    static Encrypt(myData: Uint8Array, key: Uint8Array, flg: number): boolean {
141
+        if (true) return true;
142
+
143
+        const klen = key.length;
144
+        try {
145
+            for (let i = 0; i < myData.length; i++) {
146
+                if (flg === 1) {
147
+                    if ((myData[i] + key[i % klen]) > 255) {
148
+                        const value = (myData[i] + key[i % klen]).toString(2);
149
+                        myData[i] = parseInt(value.slice(-8), 2);
150
+                    } else {
151
+                        myData[i] = myData[i] + key[i % klen];
152
+                    }
153
+                } else {
154
+                    if (myData[i] < key[i % klen]) {
155
+                        const value = myData[i].toString(2).padStart(8, '0');
156
+                        myData[i] = parseInt('1' + value, 2) - key[i % klen];
157
+                    } else {
158
+                        myData[i] = myData[i] - key[i % klen];
159
+                    }
160
+                }
161
+            }
162
+        } catch (ex) {
163
+            PlatformLogger.SystemErrorInfo("加密解密出错!", ex);
164
+            throw ex;
165
+        }
166
+        return true;
167
+    }
168
+
169
+    static Clone(obj: Message, source: Message): void {
170
+        for (const key in source) {
171
+            if (source.hasOwnProperty(key)) {
172
+                (obj as any)[key] = (source as any)[key];
173
+            }
174
+        }
175
+    }
176
+
177
+    static CheckByte(data: Uint8Array): void {
178
+        if (!data || data.length === 0) return;
179
+
180
+        for (let i = 0; i < data.length; i++) {
181
+            if (data[i] < 128) continue;
182
+
183
+            if (i + 1 >= data.length) continue;
184
+
185
+            const tmpData = new Uint8Array([data[i], data[i + 1]]);
186
+            const decoder = new TextDecoder('utf-8');
187
+            // const tmpStr = PlatformSettings.Encoding.getString(tmpData);//hulei 原始逻辑需要引用到系统system.IO中的getstring()  将字节转换成string
188
+            const tmpStr = decoder.decode(tmpData);
189
+            if (this.IsSbc(tmpStr) && !this.IsChinese(tmpStr)) {//判断是否全是全角和中文
190
+                i++;
191
+                continue;
192
+            }
193
+
194
+            if (data[i] >= 0x81 && data[i] <= 0xa0) {
195
+                if (i + 1 >= data.length) continue;
196
+                if (data[i + 1] < 0x40 || data[i + 1] > 0xfe) {
197
+                    data[i] = 61;
198
+                    continue;
199
+                }
200
+                i++;
201
+            } else if (data[i] >= 0xa1 && data[i] <= 0xa9) {
202
+                if (i + 1 >= data.length) continue;
203
+                if (data[i + 1] < 0xa1 || data[i + 1] > 0xef) {
204
+                    data[i] = 61;
205
+                    continue;
206
+                }
207
+                i++;
208
+            } else if (data[i] >= 0xaa && data[i] <= 0xfe) {
209
+                if (i + 1 >= data.length) continue;
210
+                if (data[i + 1] < 0x40) {
211
+                    data[i] = 61;
212
+                    continue;
213
+                } else if (data[i + 1] > 0xa0) {
214
+                    if (data[i] >= 0xb0 && data[i] <= 0xf7) {
215
+                        if (data[i + 1] < 0xa1 || data[i + 1] > 0xfe) {
216
+                            data[i] = 61;
217
+                            continue;
218
+                        }
219
+                    }
220
+                }
221
+                i++;
222
+            } else {
223
+                data[i] = 61;
224
+            }
225
+        }
226
+    }
227
+
228
+    private static IsSbc(str: string): boolean {
229
+        return str.length * 2 === new TextEncoder().encode(str).length;
230
+    }
231
+
232
+    private static IsChinese(word: string): boolean {
233
+        if (!word) return false;
234
+        const rx = /^[\u4e00-\u9fa5]$/;
235
+        return rx.test(word);
236
+    }
237
+}

+ 140
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/MsgXml01.ts View File

@@ -0,0 +1,140 @@
1
+// 定义 Message 接口
2
+interface Message {
3
+    Fd16: string;
4
+    Fd96_Q: string;
5
+    Fd5: string;
6
+    Fd6: string;
7
+    Fd2: string;
8
+    Fd7: string;
9
+    Fd12: string;
10
+    FileData: string;
11
+}
12
+
13
+// 模拟 PlatformSettings 类
14
+class PlatformSettings {
15
+    static Encoding = {
16
+        GetBytes: (str: string): Uint8Array => {
17
+            return new TextEncoder().encode(str);
18
+        },
19
+        GetString: (bytes: Uint8Array): string => {
20
+            return new TextDecoder('gbk').decode(bytes);
21
+        }
22
+    };
23
+}
24
+
25
+// 模拟 PlatformLogger 类
26
+class PlatformLogger {
27
+    static SystemErrorInfo(message: string, ex: Error) {
28
+        console.error(`${message}`, ex);
29
+    }
30
+
31
+    static CommunicationInfo(info: string) {
32
+        console.log(info);
33
+    }
34
+}
35
+
36
+export class MsgXml01 {
37
+    private static instance: MsgXml01;
38
+
39
+    private constructor() {}
40
+
41
+    static GetInstance(): MsgXml01 {
42
+        if (!this.instance) {
43
+            this.instance = new MsgXml01();
44
+        }
45
+        return this.instance;
46
+    }
47
+
48
+    Integrate(msg: Message): Uint8Array {
49
+        let totalMsgData: Uint8Array;
50
+        let dataPartLength: Uint8Array;
51
+        let dataPart: Uint8Array;
52
+
53
+        try {
54
+            const xmlFirstLine = '<?xml version="1.0" encoding="GBK"?>';
55
+            const upTagBegin = '<service>';
56
+            const xmlHeader = this.Msg8583ToHeader(msg);
57
+            const xmlData = msg.FileData;
58
+            const upTagEnd = '</service>';
59
+            const dataPartStr = xmlFirstLine + upTagBegin + xmlHeader + xmlData + upTagEnd;
60
+
61
+            dataPart = PlatformSettings.Encoding.GetBytes(dataPartStr);
62
+            const dataPartLengthInt = dataPart.length;
63
+            const dataPartLengthStr = dataPartLengthInt.toString().padStart(8, '0');
64
+            dataPartLength = PlatformSettings.Encoding.GetBytes(dataPartLengthStr);
65
+
66
+            totalMsgData = new Uint8Array(8 + dataPartLengthInt);
67
+            for (let j = 0; j < totalMsgData.length; j++) {
68
+                if (j < 8) {
69
+                    totalMsgData[j] = dataPartLength[j];
70
+                } else {
71
+                    totalMsgData[j] = dataPart[j - 8];
72
+                }
73
+            }
74
+        } catch (ex) {
75
+            PlatformLogger.SystemErrorInfo('组包发生异常!', ex as Error);
76
+            throw ex;
77
+        }
78
+
79
+        return totalMsgData;
80
+    }
81
+
82
+    private Msg8583ToHeader(msg: Message): string {
83
+        let result = '<SysHead>';
84
+        result += `<Txcode>${msg.Fd16.trim()}</Txcode>`;
85
+        result += `<FrontTrace>${msg.Fd96_Q.trim()}</FrontTrace>`;
86
+        result += `<Txdate>${msg.Fd5.trim()}</Txdate>`;
87
+        result += `<Txtime>${msg.Fd6.trim()}</Txtime>`;
88
+        result += `<InstNo>${msg.Fd2.trim()}</InstNo>`;
89
+        result += `<UserNo>${msg.Fd7.trim()}</UserNo>`;
90
+        result += '</SysHead>';
91
+        return result;
92
+    }
93
+
94
+    Analyze(msg: Message, data: Uint8Array): boolean {
95
+        try {
96
+            this.DoAnalyze(msg, data);
97
+            return true;
98
+        } catch (ex) {
99
+            return false;
100
+        }
101
+    }
102
+
103
+    DoAnalyze(msg: Message, returnData: Uint8Array): void {
104
+        try {
105
+            let xmlDataLen = 0;
106
+            const tmpLen = returnData.slice(0, 8);
107
+            xmlDataLen = parseInt(PlatformSettings.Encoding.GetString(tmpLen), 10);
108
+
109
+            const ret = returnData.slice(8, 8 + xmlDataLen);
110
+            const xmlStr = PlatformSettings.Encoding.GetString(ret);
111
+            PlatformLogger.CommunicationInfo('\n返回报文数据:\n' + xmlStr);
112
+
113
+            // 模拟 XML 解析
114
+            const xmlDoc = this.parseXML(xmlStr);
115
+            const node = xmlDoc.querySelector('/service/SysHead');
116
+            if (node) {
117
+                const childNodes = node.childNodes;
118
+                msg.Fd16 = childNodes[0].textContent || '';
119
+                msg.Fd5 = childNodes[1].textContent || '';
120
+                msg.Fd6 = childNodes[2].textContent || '';
121
+                msg.Fd2 = childNodes[3].textContent || '';
122
+                msg.Fd7 = childNodes[4].textContent || '';
123
+                msg.Fd12 = childNodes[5].textContent || '';
124
+            }
125
+
126
+            const nodeOfBody = xmlDoc.querySelector('/service/Body');
127
+            if (nodeOfBody) {
128
+                msg.FileData = nodeOfBody.outerHTML;
129
+            }
130
+        } catch (ex) {
131
+            PlatformLogger.SystemErrorInfo('解析报文失败!', ex as Error);
132
+            throw ex;
133
+        }
134
+    }
135
+
136
+    private parseXML(xmlStr: string): Document {
137
+        const parser = new DOMParser();
138
+        return parser.parseFromString(xmlStr, 'text/xml');
139
+    }
140
+}

+ 13
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/PackageOptions.ts View File

@@ -0,0 +1,13 @@
1
+/**
2
+ * 支持的报文组装方式
3
+ */
4
+export enum PackageOptions {
5
+    /**
6
+     * 客户端组组解包 
7
+     */
8
+    PackageOnClient,
9
+    /**
10
+     * 服务端组组解包 
11
+     */
12
+    PackageOnServer
13
+}

+ 21
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/Package/PackageType.ts View File

@@ -0,0 +1,21 @@
1
+/**
2
+ * 支持的报文组装类型
3
+ */
4
+export enum PackageType {
5
+    /**
6
+     *  使用858301报文
7
+     */
8
+    Msg858301,
9
+    /**
10
+     *  使用858302报文
11
+     */
12
+    Msg858302,
13
+    /**
14
+     * 使用858304报文
15
+     */
16
+    Msg858304,
17
+    /**
18
+     * 反假币xml报文
19
+     */
20
+    MsgXml01
21
+}

+ 104
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/SocketListener/BufferManager.ts View File

@@ -0,0 +1,104 @@
1
+export class BufferManager {
2
+    private m_receiveBuffer: Uint8Array;
3
+    private m_sendBuffer: Uint8Array;
4
+
5
+    private m_maxRequest: number;
6
+    private m_receiveBufferSize: number;
7
+    private m_sendBufferSize: number;
8
+
9
+    private m_bufferBlockIndex: number;
10
+    private m_bufferBlockIndexStack: number[];
11
+
12
+    private static Locker = {};
13
+
14
+    constructor(maxRequest: number, receivevBufferSize: number, sendBufferSize: number) {
15
+        this.m_maxRequest = maxRequest;
16
+        this.m_receiveBufferSize = receivevBufferSize;
17
+        this.m_sendBufferSize = sendBufferSize;
18
+
19
+        this.m_bufferBlockIndex = 0;
20
+        this.m_bufferBlockIndexStack = new Array<number>(maxRequest);
21
+
22
+        this.m_receiveBuffer = new Uint8Array(this.m_receiveBufferSize * this.m_maxRequest);
23
+        this.m_sendBuffer = new Uint8Array(this.m_sendBufferSize * this.m_maxRequest);
24
+    }
25
+
26
+    get ReceiveBufferSize(): number {
27
+        return this.m_receiveBufferSize;
28
+    }
29
+
30
+    get SendBufferSize(): number {
31
+        return this.m_sendBufferSize;
32
+    }
33
+
34
+    get ReceiveBuffer(): Uint8Array {
35
+        return this.m_receiveBuffer;
36
+    }
37
+
38
+    get SendBuffer(): Uint8Array {
39
+        return this.m_sendBuffer;
40
+    }
41
+
42
+    FreeBufferBlockIndex(bufferBlockIndex: number): void {
43
+        if (bufferBlockIndex >= this.m_maxRequest || bufferBlockIndex < 0) {
44
+            return;
45
+        }
46
+
47
+        // 使用 JavaScript 的闭包模拟锁
48
+        const lock = () => {
49
+            if (this.m_bufferBlockIndexStack.includes(bufferBlockIndex)) {
50
+                return;
51
+            }
52
+            this.m_bufferBlockIndexStack.push(bufferBlockIndex);
53
+        };
54
+        lock();
55
+    }
56
+
57
+    GetBufferBlockIndex(): number {
58
+        // 使用 JavaScript 的闭包模拟锁
59
+        const lock = () => {
60
+            let blockIndex = -1;
61
+
62
+            if (this.m_bufferBlockIndexStack.length > 0) {
63
+                blockIndex = this.m_bufferBlockIndexStack.pop()!;
64
+            } else {
65
+                if (this.m_bufferBlockIndex < this.m_maxRequest) {
66
+                    blockIndex = this.m_bufferBlockIndex++;
67
+                }
68
+            }
69
+
70
+            return blockIndex;
71
+        };
72
+        return lock();
73
+    }
74
+
75
+    GetReceiveBufferOffset(bufferBlockIndex: number): number {
76
+        if (bufferBlockIndex >= this.m_maxRequest) {
77
+            throw new Error(`�����������������:${this.m_maxRequest.toString()}`);
78
+        }
79
+
80
+        if (bufferBlockIndex < 0) {
81
+            return 0;
82
+        }
83
+
84
+        return bufferBlockIndex * this.m_receiveBufferSize;
85
+    }
86
+
87
+    GetSendBufferOffset(bufferBlockIndex: number): number {
88
+        if (bufferBlockIndex >= this.m_maxRequest) {
89
+            throw new Error(`�����������������:${this.m_maxRequest.toString()}`);
90
+        }
91
+
92
+        if (bufferBlockIndex < 0) {
93
+            return 0;
94
+        }
95
+
96
+        return bufferBlockIndex * this.m_sendBufferSize;
97
+    }
98
+
99
+    Clear(): void {
100
+        this.m_bufferBlockIndexStack = [];
101
+        this.m_receiveBuffer = new Uint8Array(0);
102
+        this.m_sendBuffer = new Uint8Array(0);
103
+    }
104
+}

+ 393
- 0
ant-design-pro-vue3/src/views/front/develop/Communication/SocketListener/SocketManager.ts View File

@@ -0,0 +1,393 @@
1
+// 模拟 BufferManager 类
2
+import { BufferManager } from './BufferManager';
3
+
4
+// 模拟事件处理函数类型
5
+type EventHandler<T> = (sender: any, args: T) => void;
6
+
7
+// 模拟事件参数类
8
+class ServerPortEventArgs {
9
+    constructor(public port: number) { }
10
+}
11
+
12
+class DataReceivedEventArgs {
13
+    constructor(public data: Uint8Array) { }
14
+}
15
+
16
+class DataSendEventArgs {
17
+    constructor(public sendLength: number) { }
18
+}
19
+
20
+class SocketErrorEventArgs {
21
+    constructor(public error: Error, public operation: string) { }
22
+}
23
+
24
+// 模拟 Socket 操作枚举
25
+enum SocketOperation {
26
+    Bind,
27
+    Connect,
28
+    Send
29
+}
30
+
31
+// 模拟 Socket 类
32
+class Socket {
33
+    constructor() { }
34
+    IsBound = false;
35
+    Close() { }
36
+    Bind(endPoint: any) { }
37
+    Listen(backlog: number) { }
38
+    BeginConnect(endPoint: any, callback: (ar: any) => void, state: any) { }
39
+    EndConnect(ar: any) { }
40
+    BeginSend(data: Uint8Array, offset: number, length: number, flags: number, callback: (ar: any) => void, state: any) { }
41
+    EndSend(ar: any) { return 0; }
42
+    Connect(endPoint: any) { }
43
+    Send(data: Uint8Array, offset: number, length: number, flags: number) { return 0; }
44
+    Shutdown(how: any) { }
45
+}
46
+
47
+// 模拟 ManualResetEvent 类
48
+class ManualResetEvent {
49
+    constructor(private initialState: boolean) { }
50
+    Reset() { }
51
+    Set() { }
52
+    WaitOne() { }
53
+    Close() { }
54
+}
55
+
56
+// 模拟 Func 类型
57
+type Func<TResult> = () => TResult;
58
+
59
+export default class SocketManager {
60
+    static GetLocalIpAddressList() {
61
+        return
62
+    }
63
+    private m_ListenningSockets: Map<number, Socket> = new Map();
64
+    private static Locker = {};
65
+    private m_BufferManager: BufferManager;
66
+    private m_ThresholdValue = 102400;
67
+
68
+    private m_SuspendAllSend = false;
69
+    private m_StopAllSend = false;
70
+    private m_MaxListenningRequest: number;
71
+    private m_SendControl: ManualResetEvent;
72
+    private m_SendBufferSize: number;
73
+    private m_ReceiveBufferSize: number;
74
+    private m_SendTimeOut: number;
75
+    private m_ReceiveTimeOut: number;
76
+
77
+    // 事件
78
+    public ServerStart: EventHandler<ServerPortEventArgs> | null = null;
79
+    public ServerStop: EventHandler<ServerPortEventArgs> | null = null;
80
+    public SendStart: EventHandler | null = null;
81
+    public SendCompleted: EventHandler | null = null;
82
+    public DataReceived: EventHandler<DataReceivedEventArgs> | null = null;
83
+    public Sending: EventHandler<DataSendEventArgs> | null = null;
84
+    public ErrorHappened: EventHandler<SocketErrorEventArgs> | null = null;
85
+
86
+    constructor(maxClientCount = 200, receiveBufferSize = 12400, sendBufferSize = 0, receiveTimeOut = 0, sendTimeOut = 0) {
87
+        this.m_MaxListenningRequest = maxClientCount;
88
+        this.m_SendBufferSize = sendBufferSize;
89
+        this.m_ReceiveBufferSize = receiveBufferSize;
90
+        this.m_SendTimeOut = sendTimeOut;
91
+        this.m_ReceiveTimeOut = receiveTimeOut;
92
+        this.m_BufferManager = new BufferManager(maxClientCount, receiveBufferSize, sendBufferSize);
93
+        this.m_SendControl = new ManualResetEvent(true);
94
+    }
95
+
96
+    get MaxListenningRequest(): number {
97
+        return this.m_MaxListenningRequest;
98
+    }
99
+
100
+    get SendBufferSize(): number {
101
+        return this.m_SendBufferSize;
102
+    }
103
+
104
+    set SendBufferSize(value: number) {
105
+        this.m_SendBufferSize = value;
106
+    }
107
+
108
+    get ReceiveBufferSize(): number {
109
+        return this.m_ReceiveBufferSize;
110
+    }
111
+
112
+    set ReceiveBufferSize(value: number) {
113
+        this.m_ReceiveBufferSize = value;
114
+    }
115
+
116
+    get SendTimeOut(): number {
117
+        return this.m_SendTimeOut;
118
+    }
119
+
120
+    set SendTimeOut(value: number) {
121
+        this.m_SendTimeOut = value;
122
+    }
123
+
124
+    get ReceiveTimeOut(): number {
125
+        return this.m_ReceiveTimeOut;
126
+    }
127
+
128
+    set ReceiveTimeOut(value: number) {
129
+        this.m_ReceiveTimeOut = value;
130
+    }
131
+
132
+    get ThresholdValue(): number {
133
+        return this.m_ThresholdValue;
134
+    }
135
+
136
+    get SuspendAllSend(): boolean {
137
+        return this.m_SuspendAllSend;
138
+    }
139
+
140
+    set SuspendAllSend(value: boolean) {
141
+        if (value) {
142
+            this.m_SendControl.Reset();
143
+        } else {
144
+            this.m_SendControl.Set();
145
+        }
146
+        this.m_SuspendAllSend = value;
147
+    }
148
+
149
+    get StopAllSend(): boolean {
150
+        return this.m_StopAllSend;
151
+    }
152
+
153
+    set StopAllSend(value: boolean) {
154
+        if (value && this.SuspendAllSend) {
155
+            this.SuspendAllSend = false;
156
+        }
157
+        this.m_StopAllSend = value;
158
+    }
159
+
160
+    StartListenning(port: number, async = true): boolean {
161
+        const socket = this.GetSocket(0, 0);
162
+
163
+        try {
164
+            if (!socket.IsBound) {
165
+                // 模拟锁
166
+                (() => {
167
+                    if (!socket.IsBound) {
168
+                        socket.Bind(this.GetIpv4EndPoint(port));
169
+                        socket.Listen(this.m_MaxListenningRequest);
170
+                        this.m_ListenningSockets.set(port, socket);
171
+                        this.OnServerStart(port);
172
+                        this.StartReceive(socket, async);
173
+                    }
174
+                })();
175
+            }
176
+        } catch (se) {
177
+            socket.Close();
178
+            this.OnErrorHappened(se as Error, SocketOperation.Bind);
179
+            return false;
180
+        }
181
+
182
+        return true;
183
+    }
184
+
185
+    StartListenningBatch(ports: number[]): void {
186
+        ports.forEach(port => {
187
+            this.StartListenning(port);
188
+        });
189
+    }
190
+
191
+    StopListenning(onlyCloseSocket: boolean): void {
192
+        const dic = new Map(this.m_ListenningSockets);
193
+        this.m_ListenningSockets.clear();
194
+
195
+        dic.forEach((socket, port) => {
196
+            socket.Close();
197
+            this.OnServerStop(port);
198
+        });
199
+
200
+        if (!onlyCloseSocket) {
201
+            this.m_BufferManager.Clear();
202
+            this.m_SendControl.Close();
203
+        }
204
+    }
205
+
206
+    Send(hostNameOrAddress: string, port: number, data: Uint8Array, async = true): void {
207
+        if (!data) {
208
+            throw new Error('�������ݲ���Ϊ��');
209
+        }
210
+
211
+        const endPoint = this.GetIpv4EndPoint(hostNameOrAddress, port);
212
+        this.Send(endPoint, data, async);
213
+    }
214
+
215
+    Send(endPoint: any, data: Uint8Array, async: boolean): void {
216
+        if (!data) {
217
+            throw new Error('�������ݲ���Ϊ��');
218
+        }
219
+
220
+        const socket = this.GetSocket(this.m_SendTimeOut, 0);
221
+
222
+        try {
223
+            this.OnSendStart();
224
+
225
+            if (async) {
226
+                this.SendAsync(socket, endPoint, data);
227
+            } else {
228
+                this.SendSynchronize(socket, endPoint, data);
229
+            }
230
+        } catch (se) {
231
+            socket.Close();
232
+            this.OnErrorHappened(se as Error, SocketOperation.Connect);
233
+        }
234
+    }
235
+
236
+    SendSynchronize(socket: Socket, endPoint: any, data: Uint8Array): void {
237
+        socket.Connect(endPoint);
238
+        this.SendDataInternal(socket, data);
239
+    }
240
+
241
+    SendDataInternal(socket: Socket, data: Uint8Array): void {
242
+        socket.Send(data, 0, data.length, 0);
243
+
244
+        try {
245
+            socket.Shutdown(0);
246
+        } catch (ex) { }
247
+
248
+        socket.Close();
249
+        this.FireSendEvents(0);
250
+    }
251
+
252
+    SendAsync(socket: Socket, endPoint: any, data: Uint8Array): void {
253
+        socket.BeginConnect(endPoint, (ar: any) => {
254
+            try {
255
+                socket.EndConnect(ar);
256
+            } catch (se) {
257
+                socket.Close();
258
+                this.OnErrorHappened(se as Error, SocketOperation.Connect);
259
+                return;
260
+            }
261
+
262
+            this.SendDataInternal(socket, data);
263
+        }, null);
264
+    }
265
+
266
+    SendWithFunc(hostNameOrAddress: string, port: number, dataGetterFunc: Func<Uint8Array>): void {
267
+        if (!dataGetterFunc) return;
268
+
269
+        const endPoint = this.GetIpv4EndPoint(hostNameOrAddress, port);
270
+        this.SendEndPointWithFunc(endPoint, dataGetterFunc);
271
+    }
272
+
273
+    SendEndPointWithFunc(endPoint: any, dataGetterFunc: Func<Uint8Array>): void {
274
+        if (!endPoint) {
275
+            throw new Error('Զ���ս�㲻��Ϊ��');
276
+        }
277
+
278
+        const sendSocket = this.GetSocket(this.SendTimeOut, 0);
279
+        this.OnSendStart();
280
+
281
+        try {
282
+            sendSocket.BeginConnect(endPoint, (ar: any) => {
283
+                try {
284
+                    sendSocket.EndConnect(ar);
285
+                } catch (se) {
286
+                    this.OnErrorHappened(se as Error, SocketOperation.Connect);
287
+                    sendSocket.Close();
288
+                    return;
289
+                }
290
+
291
+                const callback = this.GetSendCallback(sendSocket, dataGetterFunc);
292
+                this.SendDataInternalWithCallback(sendSocket, callback, dataGetterFunc);
293
+            }, null);
294
+        } catch (se) {
295
+            sendSocket.Close();
296
+            this.OnErrorHappened(se as Error, SocketOperation.Connect);
297
+        }
298
+    }
299
+
300
+    GetSendCallback(sendSocket: Socket, dataGetterFunc: Func<Uint8Array>): (ar: any) => void {
301
+        return (receiveResult: any) => {
302
+            const sendLength = sendSocket.EndSend(receiveResult);
303
+
304
+            this.OnSending(sendLength);
305
+            this.SendDataInternalWithCallback(sendSocket, this.GetSendCallback(sendSocket, dataGetterFunc), dataGetterFunc);
306
+        };
307
+    }
308
+
309
+    SendDataInternalWithCallback(sendSocket: Socket, callback: (ar: any) => void, dataGetterFunc: Func<Uint8Array>): void {
310
+        if (this.m_SuspendAllSend) {
311
+            this.m_SendControl.WaitOne();
312
+        }
313
+
314
+        const data = dataGetterFunc();
315
+
316
+        if (this.m_StopAllSend) {
317
+            sendSocket.Close();
318
+            return;
319
+        }
320
+
321
+        if (!data || data.length === 0) {
322
+            this.FireSendEvents(0);
323
+            sendSocket.Close();
324
+            return;
325
+        }
326
+
327
+        sendSocket.BeginSend(data, 0, data.length, 0, callback, null);
328
+    }
329
+
330
+    FireSendEvents(socketError: number): void {
331
+        if (socketError === 0) {
332
+            this.OnSendCompleted();
333
+        } else {
334
+            this.OnErrorHappened(new Error(`Socket error: ${socketError}`), SocketOperation.Send);
335
+        }
336
+    }
337
+
338
+    StartReceive(listenningSocket: Socket, async: boolean): void {
339
+        // 由于原代码截断,此处简单实现
340
+        console.log('Start receiving...');
341
+    }
342
+
343
+    private GetSocket(sendTimeOut: number, receiveTimeOut: number): Socket {
344
+        return new Socket();
345
+    }
346
+
347
+    private GetIpv4EndPoint(port: number): any;
348
+    private GetIpv4EndPoint(hostNameOrAddress: string, port: number): any;
349
+    private GetIpv4EndPoint(arg1: string | number, port?: number): any {
350
+        // 简单模拟
351
+        return {};
352
+    }
353
+
354
+    private OnServerStart(port: number): void {
355
+        if (this.ServerStart) {
356
+            this.ServerStart(this, new ServerPortEventArgs(port));
357
+        }
358
+    }
359
+
360
+    private OnServerStop(port: number): void {
361
+        if (this.ServerStop) {
362
+            this.ServerStop(this, new ServerPortEventArgs(port));
363
+        }
364
+    }
365
+
366
+    private OnSendStart(): void {
367
+        if (this.SendStart) {
368
+            this.SendStart(this, null);
369
+        }
370
+    }
371
+
372
+    private OnSendCompleted(): void {
373
+        if (this.SendCompleted) {
374
+            this.SendCompleted(this, null);
375
+        }
376
+    }
377
+
378
+    private OnSending(sendLength: number): void {
379
+        if (this.Sending) {
380
+            this.Sending(this, new DataSendEventArgs(sendLength));
381
+        }
382
+    }
383
+
384
+    private OnErrorHappened(error: Error, operation: SocketOperation): void {
385
+        if (this.ErrorHappened) {
386
+            this.ErrorHappened(this, new SocketErrorEventArgs(error, SocketOperation[operation]));
387
+        }
388
+    }
389
+
390
+    Dispose(): void {
391
+        this.StopListenning(false);
392
+    }
393
+}

+ 4
- 8
ant-design-pro-vue3/src/views/front/develop/ServiceProxy.Ext/ServiceHelper/TradeHandle.ts View File

@@ -21,6 +21,9 @@ export enum Transit {
21 21
 }
22 22
 
23 23
 export default class TradeHandle {
24
+    static WriteImportantLog(arg0: string, SerialNumber: any, arg2: string, arg3: string, arg4: string, arg5: any) {
25
+        //hulei 需要实现该方法
26
+    }
24 27
     /**
25 28
      * 获取8583域定义
26 29
      */
@@ -69,14 +72,7 @@ export default class TradeHandle {
69 72
      * 按照参数指示与外端进行通讯交互
70 73
      */
71 74
     static async DoTrade(
72
-        transit: string,
73
-        integrateData: Uint8Array,
74
-        kinBrno: string,
75
-        fileName: string,
76
-        fileData: Uint8Array,
77
-        args: any[],
78
-        serialNo: string
79
-    ): Promise<Uint8Array[]> {
75
+        transit: string, integrateData: Uint8Array, kinBrno: string, fileName: string, fileData: Uint8Array, args: any[], serialNo: string, msgType?: string): Promise<Uint8Array[]> {
80 76
         const result: Uint8Array[] = []
81 77
         try {
82 78
             const entity = new TransitEntity()

+ 1
- 5
ant-design-pro-vue3/src/views/front/platfrom/common/RunningParameters/PlatformSettings.ts View File

@@ -1,4 +1,5 @@
1 1
 // 假设 ConfigManager 和 PlatformLogger 已经在其他地方定义
2
+import PlatformLogger from "@/views/front/platfrom/common/LogSystem/PlatformLogger";
2 3
 class ConfigManager {
3 4
     private static instance: ConfigManager;
4 5
     private constructor() { }
@@ -21,11 +22,6 @@ enum ConfigType {
21 22
     System
22 23
 }
23 24
 
24
-export default class PlatformLogger {
25
-    public static SystemErrorInfo(message: string, error: Error): void {
26
-        console.error(message, error);
27
-    }
28
-}
29 25
 
30 26
 export class PlatformSettings {
31 27
     private static _encoding: BufferEncoding;

Loading…
Cancel
Save