doc
curtis
2026-03-19 beac355a0f1b5f75020760c36061283e44e9636c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
import * as fs from 'fs';
import * as path from 'path';
 
export function applyDataMixins(cls: any) {
 
    cls.prototype.Get_HelpFile = function(): string {
        let Result = String(this.HelpFile);
        return Result;
    };
 
    cls.prototype.Set_HelpFile = function(Value: string): void {
        this.HelpFile = String(Value);
    };
 
    cls.prototype.DocNoIsExistImg = function(DocNopath: string): boolean {
        let i: number;
        let ST: any;
        let Result = false;
        ST = new this.TStringList();
        if (fs.existsSync(DocNopath + '\\Context.dat')) {   /////20190319 Hong 當有空的Docno目錄時會掛掉,增加這行
            ST.LoadFromFile(DocNopath + '\\Context.dat');
        }
        for (i = 0; i < ST.Count; i++) {
            if (this.ISExistImg(DocNopath + ST.Strings[i])) {
                Result = false;
                return Result; // Exit;
                // Break;
            }
        }
        Result = true;
        return Result;
    };
 
    cls.prototype.HTTPSClientCertificateValidate = function(Sender: any, X509Certificate: any, Validate: { val: boolean }): void {
        Validate.val = true;
    };
 
    cls.prototype.HTTPSClientRedirection = function(Sender: any, OldURL: string, NewURL: { val: string }, AllowRedirection: { val: boolean }): void {
        AllowRedirection.val = true;
    };
 
    cls.prototype.GetServerDate = function(): boolean {
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/servertimeforocx', '', this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            this.ServerDate = this.Memo1.Lines.Strings[1];
            this.ServerTime = this.ServerDate.substring(8, 14); // Copy(ServerDate,9,6)
            this.ServerDate = this.ServerDate.substring(0, 8); // Copy(ServerDate,1,8)
            this.Balance = this.GetBalance(this.ServerTime); //Server 跟Local的時間差
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf1 = function(): boolean { //取系統設定資訊Mode1 DOC_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
 
        ColumeStr = 'WORK_NO,DOC_NO,DOC_U_DESC,DOC_TYPE,DOC_VERSION,FORM_PAGES,START_DATE,STOP_DATE,IS_DOC_DIV,IS_IN_WH';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=1&col='+Doc_Inf_Colume+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
 
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=1&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
 
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.Doc_Inf_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf2 = function(): boolean { //取系統設定資訊Mode2  DM_FORM_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        ColumeStr = 'WORK_NO,MAIN_FORM_ID,DOC_VERSION,DEPE_FORM_ID,MUTEX_FORM_ID';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=2&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=2&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.DM_FORM_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf3 = function(): boolean { //取系統設定資訊mode3  FORM_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        //ColumeStr := 'T1.WORK_NO,T1.FORM_ID,T1.DOC_KIND,T1.DOC_NO,T1.DOC_VERSION,T1.FORM_NAME,T1.FORM_DESC,T1.DIVISION,T1.ANCHOR,T1.MAX_PAGE,T1.FORM_HEIGHT,T1.FORM_WIDTH,T1.MERGE_IMAGE,T1.CC_FORM_ID,T1.CC_MERGE_FORMID,T2.DOC_TYPE'; {T1.CC_FORM_ID,T1.CC_MERGE_FORMID,}
        ColumeStr = 'T1.WORK_NO,T1.FORM_ID,T1.DOC_NO,T1.DOC_VERSION,T1.FORM_NAME,T1.FORM_DESC,T1.DIVISION,T1.ANCHOR,T1.MAX_PAGE,T1.FORM_HEIGHT,T1.FORM_WIDTH,T1.IS_PRINT,T2.DOC_TYPE'; //{T1.CC_FORM_ID,T1.CC_MERGE_FORMID,}
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=3&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=3&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.FORM_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf4 = function(): boolean { //取系統設定資訊mode4  CHECK_RULE_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        ColumeStr = 'WORK_NO,CHECK_NO,CHECK_RULE_DESC,MESG_SHOW_TYPE,MESG_DISP_TYPE,CHECK_MESG,SCAN_MODE';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=4&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=4&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.CHECK_RULE_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        this.CheckRule2OMRErrInfo();
        return Result;
    };
 
    cls.prototype.GetSetInf5 = function(): boolean { //取系統設定資訊mode5  MEMO_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        ColumeStr = 'T1.WORK_NO,T1.MEMO_TYPE,T1.MEMO_CONTENT,T2.MEMO_TYPE_NAME';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=5&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=5&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.MEMO_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf6 = function(): boolean { //取系統設定資訊mode5  WORK_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        ColumeStr = 'WORK_NO,PARA_NO,PARA_CONTENT';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=5&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=6&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.WORK_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.GetSetInf7 = function(): boolean { //取系統設定資訊mode5  LASTEST_FORM_INF
        let ColumeStr: string;
        let S: any;
        let EnCodeDateTime: string;
        //SELECT FORM_ID,DOC_NO,DOC_VERSION FROM FORM_INF WHERE (DOC_NO,DOC_VERSION) in (SELECT DOC_NO, MAX(DOC_VERSION) FROM FORM_INF GROUP BY DOC_NO) ORDER BY DOC_NO
 
        let Result = false;     // http://192.168.0.101:8080/fbnp/servlet/CWC01?act=getservertime
        EnCodeDateTime = this.En_DecryptionStr_Base64('E', this.ServerDate + this.GetBalance2Time(this.Balance), this.Mpskey);
        ColumeStr = 'FORM_ID,DOC_NO';
        //If not ProcessServlet(HTTPSClient,FURL+'servlet/CWC02 ','checktime='+EnCodeDateTime+'&mode=5&col='+ColumeStr+'&workno='+FWork_No,FReWrite.Text,Memo1) Then
        if (!this.ProcessServlet_Get(this.HTTPSClient, this.FUrl + 'service/imgpsc/IMGPSC01/tables', 'checktime=' + EnCodeDateTime + '&mode=7&col=' + this.En_DecryptionStr_Base64('E', ColumeStr, this.Mpskey) + '&work_no=' + this.FWork_no, this.FReWrite, this.Memo1, false)) {
            this.HttpErrStr = this._Msg('錯誤代碼:') + this.HttpError.HttpErrorCode.toString() + ',' + this.HttpError.HttpReason;
            Result = false;
            return Result; // Exit;
        }
        if (this.Memo1.Lines.Strings[0] === '1') {
            this.HttpErrStr = this._Msg('錯誤原因:') + this.Memo1.Lines.Strings[1];
            Result = false;
            return Result; // Exit;
        }
        else if (this.Memo1.Lines.Strings[0] === '0') {
            S = new this.TStringList();
            S.Text = this.Memo1.Lines.Text;
            this.SetSQLData(ColumeStr, S, this.LASTEST_FORM_INF_List);
            S.Free();
            Result = true;
        }
        else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/CW00/login.js"></script>') >= 0) {
            this.HttpErrStr = this._Msg('錯誤原因:') + this._Msg('閒置過久或被登出,請重新登入');
            Result = false;
            return Result; // Exit;
        }
        return Result;
    };
 
    cls.prototype.SetIn_WH_DocNo = function(): void { //將要入庫的DocNo抽出來另存入list裡
        let i: number;
        for (i = 1; i < this.Doc_Inf_List.Count; i++) {
            if (this.GetSQLData(this.Doc_Inf_List, 'IS_IN_WH', i) === 'Y') {
                this.IN_WH_DocNoList.Add(this.GetSQLData(this.Doc_Inf_List, 'DOC_NO', i));
            }
        }
        // {Showmessage(IN_WH_DocNoList.Text);
        // StringtoFile(IN_WH_DocNoList.Text,'D:\121.txt');}
    };
 
    cls.prototype.DeleteDocNoFile = function(Path: string, DocNo: string): boolean {  //刪除指定DocNo文件
        let i: number;
        let FName: string;
        let Result = false;
        for (i = this.ContextList.Count - 1; i >= 0; i--) {
            FName = this.ContextList.Strings[i];
            if (DocNo === this.FormCode2DocNo(this.FileName2FormCode(FName))) {
                if (fs.existsSync(Path + FName)) fs.unlinkSync(Path + FName); // DeleteFile(Path+FName);
                this.ContextList.Delete(i);
                this.Context_DocnoList.Delete(i);
                Result = true; //有刪到指定文件
            }
        }
        this.ContextList.SaveToFile(Path + 'Context.dat');
        this.Context_DocnoList.SaveToFile(Path + 'Context_DocNo.dat');
        this.ReSortFileName(Path);
        this.ContextList.LoadFromFile(Path + 'Context.dat');
        this.Context_DocnoList.LoadFromFile(Path + 'Context_DocNo.dat');
        if (fs.existsSync(Path + 'CustomDocNo.dat')) {
            this.Cust_DocNoList.LoadFromFile(Path + 'CustomDocNo.dat');
        }
        return Result;
    };
 
    cls.prototype.DeleteShowFile = function(Path: string): void { //刪除顯示中的影像
        let i: number;
        let DelFile: string;
        for (i = 0; i < this.NowShowFileList.Count; i++) {
            DelFile = this.NowShowFileList.Strings[i];
            if (fs.existsSync(Path + DelFile)) fs.unlinkSync(Path + DelFile); // DeleteFile(Path+DelFile);
            this.SetContextList('D', -1, this.NowCaseno, this.NowDocNo, DelFile);
        }
    };
 
    cls.prototype.GetDataDocNoPage = function(MainDocNo: string, MainVersion: string): number {  //取記錄的文件_版本頁數
        let P: string;
        let Result = 0;
        if (this.FindSQLData(this.Doc_Inf_List, 'FORM_PAGES', 'DOC_NO,DOC_VERSION', MainDocNo + ',' + MainVersion, 0, this.FindResult)) {
            P = this.GetFindResult('FORM_PAGES');
            if (P !== '') {
                Result = parseInt(P, 10);
            } else {
                Result = 0;
            }
        }
        return Result;
    };
 
    cls.prototype.CheckCaseDocNoPage = function(CaseID: string, DocNo: string, Version: string, Pages: number): number { //取案件裡的文件_版本頁數
        let i: number, n: number, Count: number;
        let S: any, S2: any;
        let FormCode: string, iPage: string;
        let docInt = 0, tempInt = 0;
        let v: number, v2: number;
 
        Count = 0;
        docInt = 0;
        tempInt = 0;
        S = new this.TStringList();
        S2 = new this.TStringList();
        //ShowMessage('page='+IntToStr(Pages));
        try {
            S.LoadFromFile(this.ImageSavePath + CaseID + '\\upload\\Context.dat');
            S2.LoadFromFile(this.ImageSavePath + CaseID + '\\upload\\DocDir.dat'); //2017 1220 改成只承認第一份的
 
            for (i = 1; i <= Pages; i++) { //從0到pages-1  改成 1到pages 20170316 這樣可以修改檢核的頁數問題
                iPage = this.Add_Zoo(i, 2);
                for (n = 0; n < S.Count; n++) {
                    if (this.FWH_category === 'N' && this.FIs_In_Wh === 'Y') {
                        if (this.ISExistImg(this.ImageSavePath + CaseID + '\\upload\\' + S.Strings[n])) {
                            continue;
                        }
                    }
 
                    if (S2.Strings[n].length > 8 && S2.Strings[n].indexOf(DocNo) !== -1) { //2017 1220 改成只承認第一份的
                        //LogFile1.LogToFile(logTimeString+'有進'+docno+','+S2.Strings[n]+IntToStr(Pos(DocNo,S2.Strings[n])));
                        v = S2.Strings[n].indexOf('(');
                        v2 = S2.Strings[n].indexOf(')');
                        tempInt = parseInt(S2.Strings[n].substring(v + 1, v2), 10);
 
                        if (docInt === 0) {
                            docInt = tempInt;
                        }
                        if (docInt !== tempInt) {
                            //LogFile1.LogToFile(logTimeString+'docInt='+IntToStr(docInt)+',tempInt='+IntToStr(tempInt));
                            return Count; // Break returning Count
                        }
                    }
 
                    FormCode = this.FileName2FormCode(S.Strings[n]);
                    //LogFile1.LogToFile(logTimeString+'S.Strings[n]='+S.Strings[n]);
                    //Showmessage('1:'+version+','+FormCode2Version(FormCode)+','+DocNo+','+FormCode2DocNo(FormCode)+','+iPage+','+FormCode2Page(FormCode));
                    //LogFile1.LogToFile(logTimeString+'FormCode='+FormCode);
                    this.LogFile1.LogToFile(this.logTimeString() + 'CheckCaseDocNoPage caseno=' + CaseID + ',' + Version + ',' + this.FormCode2Version(FormCode) + ',' + DocNo + ',' + this.FormCode2DocNo(FormCode) + ',' + iPage + ',' + this.FormCode2Page(FormCode));
                    //ShowMessage(DocNo+','+IntToStr(docInt)+','+IntToStr(tempInt));
                    //LogFile1.LogToFile(logTimeString+'FormCode='+FormCode);
                    if (Version === this.FormCode2Version(FormCode) && DocNo === this.FormCode2DocNo(FormCode) && iPage === this.FormCode2Page(FormCode)) {
                        this.LogFile1.LogToFile(this.logTimeString() + 'CheckCaseDocNoPage caseno=' + CaseID + ',' + Version + ',' + this.FormCode2Version(FormCode) + ',' + DocNo + ',' + this.FormCode2DocNo(FormCode) + ',' + iPage + ',' + this.FormCode2Page(FormCode));
                        //Showmessage(version+','+DocNo+',iPage='+iPage);
                        //Showmessage(inttostr(Count+1));
                        Count++;
                        break;   //找到了...離開
                    }
                }
            }
        } finally {
            S.Free();
            S2.Free();
        }
        return Count;
    };
 
    cls.prototype.TransCaseID = function(Path: string, CaseID: string, MainCase: boolean): boolean { //傳送案件
        let i: number, n: number, v: number;
        let ZipFileList: any;
        let UpFormID: string;
        let pages: number;
        let TransName: string;
        let MaskPath: string;
        let HaveMask = false;
        let S: string;
        let SendData: string;
        let Doc_Data = '', Doc_Data1 = '';
        let In_Doc1 = '', In_Doc2 = '';
        let AttachYN: string; //是否有附件 Y:有 N:沒有
 
        let ST1: any, ST2: any, ST3: any;
        let str1 = '', str2 = '';
        let must_formidStr = '';
        let last_add_formidstr = '';
        let ScanListStr = '';
        let casepath: string;
        let filesizeInt = 0;
        let case_page: string;
        let Fname: string;
        let FileRec: any;
 
        let Result = true;
        TransName = CaseID;
        MaskPath = Path + 'MaskImg\\';
        if (fs.existsSync(Path + 'Context.dat')) {
            this.ContextList.LoadFromFile(Path + 'Context.dat');
            this.Context_DocnoList.LoadFromFile(Path + 'Context_DocNo.dat');
        }
 
        if (fs.existsSync(Path + 'CustomDocNo.dat')) {
            this.Cust_DocNoList.LoadFromFile(Path + 'CustomDocNo.dat');
        }
 
        pages = this.ContextList.Count;
        case_page = pages.toString();
        if (this.FMode === 'NSCAN' || this.FMode === 'ESCAN' || this.FMode === 'ASCAN' || this.FMode === 'DSCAN' || this.FMode === 'SSCAN' || this.FMode === 'MSCAN' || this.FMode === 'RI_SCAN' || this.FMode === 'RSCAN') {
            //Showmessage('1');
            UpFormID = this.GetCaseFormID(Path);
            //{if UpformID = '' then             //20131213  yuu說不管主form
            //begin
            //  Showmessage(_msg('取不到主FormID!!'));
            //  Result := False;
            //  DataLoading(False,False);
            //  Exit;
            //end;}
        }
 
        this.CaseResort2Scanlist(Path); //檔名照設定排序產生scanlist.dat
        //CaseResort(Path);  //檔名照設定排序
        this.CreateFormID_FormName(Path, CaseID);  //產生FormID_FormName.dat
        this.CreateDocNo_DocName(Path, CaseID); //產生DocNo_Name.dat
        Doc_Data = this.CreateDocNo_Info(CaseID);  //產生保管袋文件 Docno,份數,頁數;Docno,份數,頁數 的回傳字串
        Doc_Data1 = this.CreateCustDocNo_Info(CaseID);  //產生自定文件 Docname,份數,頁數;Docno,份數,頁數 的回傳字串
        In_Doc1 = this.CreateDocnoFrom_Info(CaseID); //產生被引進的保管袋文件資訊  Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
        In_Doc2 = this.CreateCustDocNoFrom_Info(CaseID);   //產生被引進的自定文件資訊  Docno[tab]份數[tab]案件編號#13#10Docno[tab]份數[tab]案件編號
        AttachYN = this.CreateAttach_Info(CaseID); //是否還有附件 Y:有 N:沒有
        this.ReadCaseIndex(Path);
        //LoanDoc := 'Y';
        //產生遮罩影像
        //  if FWork_No = 'CW' then
        //    HaveMask := Case2Mask(Path,MaskPath);
        //產生遮罩影像
        // S := S +#13+'5-->'+ Timetostr(now);
 
        ///////必要formid 20170315 start  //////////////////////////////
        must_formidStr = '';
        last_add_formidstr = '';
        ST1 = new this.TStringList();
        ST1.LoadFromFile(Path + 'FormCode_Name.dat');
        //ShowMessage(ST1.Text);
        //ShowMessage(LastInitFormidList.Text);
        ST2 = new this.TStringList();
        ST3 = new this.TStringList();
 
        for (i = 0; i < ST1.Count; i++) {
            if (ST1.Strings[i].indexOf('_') !== 0 && ST1.Strings[i].indexOf('_') !== -1) {
                str1 = ST1.Strings[i].substring(0, ST1.Strings[i].indexOf('_'));
                ST2.Add(str1);
                must_formidStr = must_formidStr + str1 + '@#,';
            }
        }
        must_formidStr = must_formidStr.substring(0, must_formidStr.length - 3);
        //ShowMessage('must_formidStr='+must_formidStr);
        //ShowMessage('AST2='+ST2.Text);
 
 
        for (i = 0; i < this.LastInitFormidList.Count; i++) {
            if (ST2.IndexOf(this.LastInitFormidList.Strings[i]) !== -1) {
                ST2.Delete(ST2.IndexOf(this.LastInitFormidList.Strings[i]));
            }
        }
        //ShowMessage('BST2='+ST2.Text);
        for (i = 0; i < ST2.Count; i++) {
            last_add_formidstr = last_add_formidstr + ST2.Strings[i] + '@#,';
        }
        last_add_formidstr = last_add_formidstr.substring(0, last_add_formidstr.length - 3);
 
        ST3.LoadFromFile(Path + 'scanlist.dat');
        for (i = 0; i < ST3.Count; i++) {
            if (ScanListStr === '') {
                ScanListStr = this.FileName2FormCode(ST3.Strings[i]);
            } else {
                ScanListStr = `${ScanListStr},${this.FileName2FormCode(ST3.Strings[i])}`;
            }
        }
 
        ST1.Free();
        ST2.Free();
        ST3.Free();
        //ShowMessage('last_add_formidstr='+last_add_formidstr);
        ///////必要formid 20170315 end //////////////////////////
 
        ///保留外部影像  start///////////////////////////////
        casepath = Path.substring(0, Path.indexOf('Upload'));
        //ShowMessage('casepath='+casepath);
        //FIsExternal:='Y';
        if (this.FMode === 'ESCAN' && this.FIsExternal === 'Y') {
            if (fs.existsSync(casepath + 'Download\\FirstImg.zip')) {
                fs.copyFileSync(casepath + 'Download\\FirstImg.zip', Path + 'FirstImg.zip');
            }
            else {
                fs.copyFileSync(casepath + 'Download\\' + CaseID + '.zip', Path + 'FirstImg.zip');
            }
        }
        ///保留外部影像  end///////////////////////////////
 
        //file_size 計算  就先不做 20170316
        filesizeInt = 0;
 
 
        //////壓檔/////
        this.ZipMainFile(Path, Path, 'Img.zip');
        if (HaveMask) {
            this.ZipMaskFile(Path, MaskPath, Path, 'MaskImg.zip');  //有遮罩設定的才產生
        }
        /////壓檔////
        ///檢查上傳的zip大小////
        Fname = Path + 'Img.zip';
 
        // FindFirst(FName, faAnyfile, FileRec);
        // NodeJS equivalent using fs.statSync
        let stat = fs.statSync(Fname);
 
        //FMaxUploadSize
        //ShowMessage(IntToStr(FileRec.Size));
        //Result:=False;
        //exit;           //目前上傳檔案大小為xxMB,已超過50MB,無法上傳    %.3f  ,[FileRec.Size / 1048576]
        if (stat.size > parseInt(this.FMaxUploadSize, 10) * 1048576) { // 檢查檔案大小
            this.Showmessage(this.Format(this._Msg('%s目前上傳檔案大小為%.3fMB,已超過%sMB,無法上傳'), [CaseID, stat.size / 1048576, this.FMaxUploadSize]));
            //ShowMessage(Format('%s目前上傳檔案大小為%.3fMB,已超過'+FMaxUploadSize+'MB,無法上傳',[caseid,FileRec.Size / 1048576]) );
            Result = false;
            return Result; // Exit;
        }
        ///檢查上傳的zip大小////
        //ShowMessage('last_add_formidstr='+last_add_formidstr);
        if (!this.GetFtpinfo(CaseID, 'upload')) {   //取案件上傳方式
            //Showmessage(_Msg()Inttostr(HttpError.HttpErrorCode)+' '+HttpError.HttpReason+'.');
            this.DownFileErrStr = this._Msg('取案件上傳資訊失敗!!') + this.HttpErrStr;
            Result = false;
            return Result; // Exit;
        }
        SendData = 'data=' + this.HTTPEncode(this.UTF8Encode(this.FData))
            + '&verify=' + this.FVerify
            + '&form_id=' + UpFormID
            + '&loan_doc=' + this.Case_loandoc
            + '&case_no=' + TransName
            + '&doc_data=' + this.HTTPEncode(this.UTF8Encode(Doc_Data))
            + '&doc_data1=' + this.HTTPEncode(this.UTF8Encode(Doc_Data1))
            + '&attach=' + AttachYN
            + '&case_page=' + case_page
            + '&file_size=' + filesizeInt.toString()
            + '&must_formid=' + must_formidStr  //擁有的 formid
            + '&last_add_formid=' + last_add_formidstr   //當次新加的 formid
            + '&form_code=' + ScanListStr      //scanlist.dat 表單代號
            + '&ftp_image_path=' + this.FFtpExtraPath   //加傳FTP目錄  HTTP上傳時會是空白
            + '&in_doc1=' + this.HTTPEncode(this.UTF8Encode(In_Doc1))
            + '&in_doc2=' + this.HTTPEncode(this.UTF8Encode(In_Doc2));
 
        if (this.TransMode === this.TTransMode.tsHttp) {
            ////上傳/////
            this.ShowText = CaseID + this._Msg('資料上傳中(Http),請稍候');
            this.DataLoading(true, true);
            if (!this.upFile(this.HTTPSClient, this.FUrl, 'service/imgpsc/IMGPSC02/caseupload', SendData, 'file', Path + 'Img.zip', this.FReWrite, this.Memo1, false)) {
                this.Showmessage(this.HttpError.HttpErrorCode.toString() + ' ' + this.HttpError.HttpReason + '.');
                Result = false;
                return Result; // Exit;
            }
            if (this.Memo1.Lines.Strings[0] === '1') {
                this.Showmessage(this.Format(this._Msg('') + this._Msg(''), [CaseID]) + this.Memo1.Lines.Strings[1] + '。');
                Result = false;
                return Result; // Exit;
            }
            else if (this.Memo1.Lines.Text.indexOf('<script type="text/javascript" src="scripts/IMGPS00/login.js"></script>') > 0) {
                this.Showmessage(this.Format(this._Msg('') + this._Msg('') + this._Msg('閒置過久或被登出,請重新登入'), [CaseID]));
                Result = false;
                return Result; // Exit;
            }
            ////上傳////
        } else if (this.TransMode === this.TTransMode.tsFtp) {
            this.ShowText = CaseID + this._Msg('資料上傳中(Ftp),請稍候');
            this.DataLoading(true, true);
            this.SetFtpInfo();
            try {
                if (!this.IIS_Ftp.FtpsConnect()) {
                    this.Showmessage(this.Format('無法連上Ftp主機,錯誤原因:%s', [this.FtpErrReason]));
                    Result = false;
                    return Result; // Exit;
                }
                if (!this.IIS_Ftp.FtpsToMain(this.FFtpExtraPath, CaseID + '.zip', Path + 'Img.zip', this.display1)) {
                    this.Showmessage(this.Format(this._Msg('上傳案件(%s)時,發生錯誤,錯誤原因:%s'), [CaseID, this.FtpErrStr]));
                    Result = false;
                    return Result; // Exit;
                }
 
                if (!this.FtpCaseComplete(SendData)) {    //Ftp上傳後通知完成
                    this.Showmessage(this.Format(this._Msg('通知案件(%s)Ftp上傳完成時,發生錯誤!!'), [CaseID]) + this.HttpErrStr);
                    Result = false;
                    return Result; // Exit;
                }
            } finally {
                this.IIS_Ftp.FtpsClose();
            }
        }
 
        if (this.FMode === 'ESCAN') {    //上傳舊件引入檔案      //20140616 原本先搬舊件再搬新件,改為先搬新件再搬舊件
            if (!this.TransOldCaseFile(this.ImageSavePath + CaseID + '\\')) {
                Result = false;
                return Result; // Exit;
            }
        }
        // 呼叫Server完成 /////
        //{If not CaseComplete(Path,CaseID,MainCase) Then
        //begin
        //  Showmessage(_Msg('通知案件傳送完成時,網路發生錯誤!!')+HttpErrStr);
        //  DataLoading(False,False);
        //  Result := False;
        //  Exit;
        //end;  }
        /// 呼叫Server完成////
 
        ////刪檔////
        //_DelTree(Path);  //會只刪TransPath
        //ShowMessage('STOP');
        this._DelTree(this.ImageSavePath + CaseID);
        this.SetCaseList('D', -1, CaseID);
        ////刪檔////
        return Result;
    };
 
    ['Set_caseid', 'Set_data', 'Set_c_docnolist', 'Set_fixfilelist', 'Set_oldcaseinfo'].forEach(p => {
        cls.prototype[p] = function(v: string) {
            let fieldName = 'F' + p.substring(4).replace('caseid', 'CaseID').replace('data', 'Data').replace('c_docnolist', 'C_DocNoList').replace('fixfilelist', 'FixFileList').replace('oldcaseinfo', 'OldCaseInfo');
            this[fieldName] = v;
        };
        cls.prototype['Get_' + p.substring(4)] = function() {
            let fieldName = 'F' + p.substring(4).replace('caseid', 'CaseID').replace('data', 'Data').replace('c_docnolist', 'C_DocNoList').replace('fixfilelist', 'FixFileList').replace('oldcaseinfo', 'OldCaseInfo');
            return this[fieldName];
        };
    });
 
    cls.prototype.Set_is_oldcase = function(v: string) { this.FIs_OldCase = v.toUpperCase(); };
    cls.prototype.Get_is_oldcase = function() { return this.FIs_OldCase; };
 
    cls.prototype.Set_casenolength = function(v: string) { this.FCaseNoLength = v === '' ? 0 : parseInt(v, 10); this.CaseIDLength = this.FCaseNoLength; };
    cls.prototype.Get_casenolength = function() { return this.FCaseNoLength.toString(); };
 
    cls.prototype.Set_filesizelimit = function(v: string) { this.FFileSizeLimit = v === '' ? 5120 : parseInt(v, 10); };
    cls.prototype.Get_filesizelimit = function() { return this.FFileSizeLimit.toString(); };
 
    cls.prototype.Set_check_main_form = function(v: string) { this.FCheck_main_form = v; };
    cls.prototype.Get_check_main_form = function() { return this.FCheck_main_form; };
 
    cls.prototype.Set_WH_CATEGORY = function(v: string) { this.FWH_category = v; };
    cls.prototype.Get_WH_CATEGORY = function() { return this.FWH_category; };
 
    cls.prototype.Set_isExternal = function(v: string) { this.FIsExternal = v; };
    cls.prototype.Get_isExternal = function() { return this.FIsExternal; };
 
    cls.prototype.Set_imgdelete = function(v: string) { this.FImgDelete = v; };
    cls.prototype.Get_imgdelete = function() { return this.FImgDelete; };
 
    cls.prototype.Set_custdocyn = function(v: string) { this.FCustDocYN = v.toUpperCase(); };
    cls.prototype.Get_custdocyn = function() { return this.FCustDocYN; };
 
    cls.prototype.Set_printyn = function(v: string) { this.FPrintyn = v.toUpperCase(); };
    cls.prototype.Get_printyn = function() { return this.FPrintyn; };
 
    cls.prototype.Set_work_no = function(v: string) { this.FWork_no = v; };
    cls.prototype.Get_work_no = function() { return this.FWork_no; };
 
    cls.prototype.Set_verify = function(v: string) { this.FVerify = v; };
    cls.prototype.Get_verify = function() { return this.FVerify; };
 
    cls.prototype.Set_userunit = function(v: string) { this.FUserUnit = v; };
    cls.prototype.Get_userunit = function() { return this.FUserUnit; };
 
    cls.prototype.Set_username = function(v: string) { this.FUserName = v; };
    cls.prototype.Get_username = function() { return this.FUserName; };
 
    cls.prototype.Set_userid = function(v: string) { this.FUserID = v; };
    cls.prototype.Get_userid = function() { return this.FUserID; };
 
    cls.prototype.Set_useproxy = function(v: string) { this.FUseProxy = v.toUpperCase(); };
    cls.prototype.Get_useproxy = function() { return this.FUseProxy; };
 
    cls.prototype.Set_url = function(v: string) { this.FUrl = v; };
    cls.prototype.Get_url = function() { return this.FUrl; };
 
    cls.prototype.Set_rewrite = function(v: string) { this.FReWrite = v; };
    cls.prototype.Get_rewrite = function() { return this.FReWrite; };
 
    cls.prototype.Set_modename = function(v: string) { this.FModeName = v; };
    cls.prototype.Get_modename = function() { return this.FModeName; };
 
    cls.prototype.Set_mode = function(v: string) { this.FMode = v.toUpperCase(); };
    cls.prototype.Get_mode = function() { return this.FMode; };
 
    cls.prototype.Set_loandoc_value = function(v: string) { this.FLoanDoc_Value = v; };
    cls.prototype.Get_loandoc_value = function() { return this.FLoanDoc_Value; };
 
    cls.prototype.Set_loandoc_enable = function(v: string) { this.FLoanDoc_Enable = v; };
    cls.prototype.Get_loandoc_enable = function() { return this.FLoanDoc_Enable; };
 
    cls.prototype.Set_language = function(v: string) {
        this.FLanguage = v.toLowerCase();
        if (this.FLanguage === 'zh-tw') {
            this.FLanguage = 'zh_tw';
        }
    };
    cls.prototype.Get_language = function() { return this.FLanguage; };
 
    cls.prototype.Set_is_in_wh = function(v: string) { this.FIs_In_Wh = v.toUpperCase(); };
    cls.prototype.Get_is_in_wh = function() { return this.FIs_In_Wh; };
 
    cls.prototype.Set_c_docnamelist = function(v: string) { this.FC_DocNameList = v; };
    cls.prototype.Get_c_docnamelist = function() { return this.FC_DocNameList; };
 
    cls.prototype.DataLoading = function(Loading: boolean, UseTimer: boolean): void {
        if (Loading) {
            // Screen.Cursor := -11;
            if (UseTimer) {
                this.Panel22.Caption = this.ShowText;
                this.Panel22.Left = Math.floor(this.Panel9.Width / 2) - Math.floor(this.Panel22.Width / 2);
                this.Panel22.Top = Math.floor(this.Panel9.Height / 2) - Math.floor(this.Panel22.Height / 2);
                this.Panel22.Visible = true;
                this.Timer2.Enabled = true;
            } else {
                this.Panel8.Left = Math.floor(this.Panel9.Width / 2) - Math.floor(this.Panel8.Width / 2);
                this.Panel8.Top = Math.floor(this.Panel9.Height / 2) - Math.floor(this.Panel8.Height / 2);
                this.Panel8.Visible = true;
            }
            this.Application.ProcessMessages();
            this.Panel1.Enabled = false;
            this.Panel2.Enabled = false;
        } else {
            this.Panel22.Visible = false;
            this.Panel8.Visible = false;
            this.Timer2.Enabled = false;
            this.Panel1.Enabled = true;
            this.Panel2.Enabled = true;
            // Screen.Cursor := 0;
        }
    };
 
    cls.prototype.ReduceLogFile = function(): void {
        let ST1: any;
        let I: number;
        ST1 = new this.TStringList();
        if (fs.existsSync(this.LngPath + 'IMGPSCheck.log')) {
            ST1.LoadFromFile(this.LngPath + 'IMGPSCheck.log');
            if (ST1.Count > 100000) {
                for (I = 0; I <= 10000; I++) {
                    ST1.Delete(0);
                }
                ST1.SaveToFile(this.LngPath + 'IMGPSCheck.log');
            }
        }
        ST1.Free();
    };
 
    cls.prototype.ClearCaseIndex = function(): void {
        this.AddCredit1RG.Enabled = false;
        this.AddCredit1RG.ItemIndex = -1;
    };
 
}