-
Notifications
You must be signed in to change notification settings - Fork 0
/
CADObjectEditCtrl.cs
1497 lines (1280 loc) · 74.5 KB
/
CADObjectEditCtrl.cs
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
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.Interop.Common;
using Autodesk.AutoCAD.Geometry;
using DevComponents.DotNetBar.SuperGrid;
using System.Runtime.InteropServices;
using DevComponents.DotNetBar;
using aApp = Autodesk.AutoCAD.ApplicationServices.Application;
using Autodesk.AutoCAD.EditorInput;
using HR.Data;
namespace CHXQ.XMManager
{
public partial class CADObjectEditCtrl : UserControl
{
private AcadApplication AcadApp = null;
private IPipeDataCtrl pPipeDataCtrl = null;
public CADObjectEditCtrl()
{
InitializeComponent();
AcadApp = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");
//AcadApp.BeginOpen += new _DAcadApplicationEvents_BeginOpenEventHandler(AcadApp_BeginOpen);
//AcadApp.EndOpen += new _DAcadApplicationEvents_EndOpenEventHandler(AcadApp_EndOpen);
//aApp.DocumentManager.MdiActiveDocument.Editor.PointMonitor += new Autodesk.AutoCAD.EditorInput.PointMonitorEventHandler(Editor_PointMonitor);
// AcadApp.AppActivate += new _DAcadApplicationEvents_AppActivateEventHandler(AcadApp_AppActivate);
//CmbDataType.SelectedIndexChanged += new EventHandler(CmbDataType_SelectedIndexChanged);
//CmbDataBase.SelectedIndexChanged += new EventHandler(CmbDataBase_SelectedIndexChanged);
//DgvImportError.CellClick += new EventHandler<DevComponents.DotNetBar.SuperGrid.GridCellClickEventArgs>(DgvImportError_CellClick);
//DgvQueryResult.CellClick += new EventHandler<GridCellClickEventArgs>(DgvQueryResult_CellClick);
//DgvImportError.CellClick += new DataGridViewCellEventHandler(DgvImportError_CellClick);
//bar1.Text = "导入不成功数据";
//DgvImportError.AllowUserToResizeRows = false;
/* QueryItem ManholeItem2 = new QueryItem() { QueryItemName = "检查井", QueryClassName = "PS_Manhole" };
ManholeItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
//new QueryField() { FieldName = "ID", ItemName = "编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "物探点号" , pDataType= DataType.text}
};
//BtnQueryError_Click
BtnManholeItem2.Tag = ManholeItem2;
BtnManholeItem2.Click += new EventHandler(BtnQueryError_Click);
QueryItem PipePointItem2 = new QueryItem() { QueryItemName = "管线点", QueryClassName = "PS_VIRTUAL_POINT" };
PipePointItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
// new QueryField() { FieldName = "ID", ItemName = "编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "物探点号" , pDataType= DataType.text}
};
BtnPipePointItem2.Tag = PipePointItem2;
BtnPipePointItem2.Click += new EventHandler(BtnQueryError_Click);
QueryItem COMBItem2 = new QueryItem() { QueryItemName = "雨水口", QueryClassName = "PS_COMB" };
COMBItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
//new QueryField() { FieldName = "ID", ItemName = "编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "物探点号" , pDataType= DataType.text}
};
BtnCOMBItem2.Tag = COMBItem2;
QueryItem OUTFALLItem2 = new QueryItem() { QueryItemName = "排放口", QueryClassName = "PS_OUTFALL" };
OUTFALLItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
// new QueryField() { FieldName = "ID", ItemName = "编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "物探点号" , pDataType= DataType.text}
};
BtnOUTFALLItem2.Tag = OUTFALLItem2;
BtnOUTFALLItem2.Click += new EventHandler(BtnQueryError_Click);
QueryItem PUMPItem2 = new QueryItem() { QueryItemName = "泵站前池", QueryClassName = "PS_PUMP_STORAGE" };
PUMPItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
// new QueryField() { FieldName = "ID", ItemName = "编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "物探点号" , pDataType= DataType.text}
};
BtnPUMPItem2.Tag = PUMPItem2;
BtnPUMPItem2.Click += new EventHandler(BtnQueryError_Click);
QueryItem PipeItem2 = new QueryItem() { QueryItemName = "圆管", QueryClassName = "PS_Pipe" };
PipeItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
new QueryField() { FieldName = "US_SURVEY_ID", ItemName = "起点点号" , pDataType= DataType.text},
new QueryField() { FieldName = "DS_SURVEY_ID", ItemName = "终点点号" , pDataType= DataType.text},
new QueryField() { FieldName = "WIDTH", ItemName = "管径" , pDataType= DataType.text}
};
BtnPipeItem2.Tag = PipeItem2;
BtnPipeItem2.Click += new EventHandler(BtnQueryError_Click);
QueryItem CanalItem2 = new QueryItem() { QueryItemName = "渠箱", QueryClassName = "PS_CANAL" };
CanalItem2.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ID", ItemName = "序号" , pDataType= DataType.text},
new QueryField() { FieldName = "US_SURVEY_ID", ItemName = "起点点号" , pDataType= DataType.text},
new QueryField() { FieldName = "DS_SURVEY_ID", ItemName = "终点点号" , pDataType= DataType.text},
new QueryField() { FieldName = "WIDTH", ItemName = "管宽" , pDataType= DataType.text},
new QueryField() { FieldName = "HEIGHT", ItemName = "管高" , pDataType= DataType.text}
};
BtnCanal2.Tag = CanalItem2;
BtnCanal2.Click += new EventHandler(BtnQueryError_Click);
BtnNewPipe.Tag = new PipeLineCtrl();
BtnCanal.Tag = new CANALCtrl();
BtnFLAP.Tag=new FLAPCtrl();
BtnWEIR.Tag=new WEIRCtrl();
BtnSLUICE.Tag = new SLUICECtrl();
BtnManhole.Tag = new MANHOLECtrl();
BtnComb.Tag = new COMBCtrl();
BtnOutFall.Tag = new OUTFALLCtrl();
BtnVPipePoint.Tag = new PipePointCtrl();
BtnPUMP.Tag = new PUMPCtrl(); */
AcadDoc = AcadApp.ActiveDocument;
acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
//bar1.Text = "数据查询";
AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
AcadDoc.ObjectErased += new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
//aApp.DocumentManager.MdiActiveDocument.Editor.PromptedForSelection += new Autodesk.AutoCAD.EditorInput.PromptSelectionResultEventHandler(Editor_PromptedForSelection);
//SelectionAdded
//aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded += new SelectionAddedEventHandler(Editor_SelectionAdded);
}
public void AddSelectionChangedEvent()
{
AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
}
public void RemoveSelectionChangedEvent()
{
AcadDoc.SelectionChanged -= new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
}
private void AcadDoc_ObjectErased(int ObjectId)
{
/*
if (pPipeDataCtrl == null) return;
IPipeData CPipeData = pPipeDataCtrl.GetData();
try
{
// aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded -= new SelectionAddedEventHandler(Editor_SelectionAdded);
AcadDoc.SelectionChanged -= new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
CPipeData.Delete();
AcadDoc.ObjectErased -= new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
//Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
CPipeData.DeleteCADObject(acDoc);
AcadDoc.ObjectErased += new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
//AcadDoc.Save();
pPipeDataCtrl.Clear();
}
catch (Exception ex)
{
}
finally
{
AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
AcadDoc.ObjectErased += new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
//aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded += new SelectionAddedEventHandler(Editor_SelectionAdded);
} */
}
private string GetPointObjectID(AcadEntity pAcadObject)
{
if (pAcadObject == null) return "";
AcadDictionary pAcadDictionary = pAcadObject.GetExtensionDictionary();
if (pAcadDictionary.Count == 1)
{
AcadXRecord pAcadXRecord = pAcadDictionary.Item(0) as AcadXRecord;
string ID = pAcadXRecord.Name;
return ID;
//}
}
return string.Empty;
}
/* void Editor_SelectionAdded(object sender, SelectionAddedEventArgs e)
{
//SelectedCADObj = null;
//if (!BtnPick.Checked) return;
try
{
AcadDocument AcadDoc = AcadApp.ActiveDocument;
if (e.AddedObjects.Count == 0) return;
AcadEntity pAcadEntity = AcadDoc.ObjectIdToObject(e.AddedObjects[e.AddedObjects.Count - 1].ObjectId.OldId) as AcadEntity;
if (pAcadEntity == null) return;
if (SelectedCADObj != null && SelectedCADObj.Equals(pAcadEntity)) return;
SelectedCADObj = pAcadEntity;
AcadDictionary pAcadDictionary = SelectedCADObj.GetExtensionDictionary();
if (pAcadDictionary.Count > 1)
{
AcadXRecord pAcadXRecord1 = pAcadDictionary.Item(1) as AcadXRecord;
AcadXRecord pAcadXRecord2 = pAcadDictionary.Item(0) as AcadXRecord;
string TableName, ID;
if (pAcadXRecord1.Name.StartsWith("PS_"))
{
TableName = pAcadXRecord1.Name;
ID = pAcadXRecord2.Name;
}
else
{
TableName = pAcadXRecord2.Name;
ID = pAcadXRecord1.Name;
}
string sql = string.Format("select * from {0} where ID='{1}'", TableName, ID);
string ItemName = GetItemNameByClassname(TableName);
if (ItemName == string.Empty) return;
if (pPipeDataCtrl == null)
SwitchControl(ItemName);
else if (pPipeDataCtrl != null && !pPipeDataCtrl.DataType.Equals(ItemName))
SwitchControl(ItemName);
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
if (pTable.Rows.Count > 0 && pPipeData != null && pPipeDataCtrl != null)
{
pPipeData.FillValueByRow(pTable.Rows[0], TableName);
pPipeDataCtrl.SetData(pPipeData);
this.Refresh();
}
}
}
catch (Exception ex)
{
}
}
*/
void AcadApp_EndOpen(string FileName)
{
//AcadDoc = AcadApp.ActiveDocument;
//AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
//aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded += new SelectionAddedEventHandler(Editor_SelectionAdded);
}
//void AcadApp_AppActivate()
//{
// AcadDoc = AcadApp.ActiveDocument;
// AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
//}
/*
private void DgvQueryResult_CellClick(object sender, GridCellClickEventArgs e)
{
GridRow pGridRow = e.GridCell.GridRow;
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
if (pGridRow == null) return;
//QueryItem pQueryItem = DgvQueryResult.Tag as QueryItem;
string TableName = (DgvQueryResult.PrimaryGrid.Tag as DataTable).TableName;
string ID = pGridRow.Cells["序号"].Value.ToString();
try
{
string sql = string.Format("select * from {0} where objectID={1}", TableName, ID);
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
string ItemName = DgvQueryResult.Text;
if (pPipeDataCtrl == null)
SwitchControl(ItemName);
if (pPipeDataCtrl != null && !pPipeDataCtrl.DataType.Equals(ItemName))
SwitchControl(ItemName);
if (pTable.Rows.Count > 0 && pPipeData != null)
{
pPipeData.FillValueByRow(pTable.Rows[0], TableName);
pPipeDataCtrl.SetData(pPipeData);
pPipeDataCtrl.ZoomTo();
pPipeDataCtrl.IsErrorData = false;
this.Refresh();
}
}
finally
{ }
}
*/
/*
private void DgvImportError_CellClick(object sender, DevComponents.DotNetBar.SuperGrid.GridCellClickEventArgs e)
{
GridRow pGridRow = e.GridCell.GridRow;
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
if (pGridRow == null) return;
string ID = pGridRow.Cells["序号"].Value.ToString();
//QueryItem pQueryItem = DgvImportError.Tag as QueryItem;
DataTable pTable = DgvImportError.PrimaryGrid.Tag as DataTable;
string TableName = pGridRow.Tag.ToString();
//if (pTable.Columns.Contains("ClassName"))
//{
// TableName = pGridRow.Cells["ClassName"].Value.ToString();
//}
try
{
string sql = string.Format("select * from {0} where ID='{1}'", TableName, ID);
pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
string ItemName = GetItemNameByClassname(TableName);
//string ItemName = pQueryItem.QueryItemName;
if (pPipeDataCtrl == null)
SwitchControl(ItemName);
if (pPipeDataCtrl != null && !pPipeDataCtrl.DataType.Equals(ItemName))
SwitchControl(ItemName);
if (pTable.Rows.Count > 0 && pPipeData != null)
{
pPipeData.FillValueByRow(pTable.Rows[0], TableName);
pPipeDataCtrl.SetData(pPipeData);
this.Refresh();
pPipeDataCtrl.ZoomTo();
pPipeDataCtrl.IsErrorData = true;
}
}
catch (Exception ex)
{ }
finally
{ }
}*/
private void BindTableToGrid(GridPanel DataGrid, DataTable pTable)
{
DataTable ntable = pTable;
pTable = ntable.DefaultView.ToTable();
DataGrid.Columns.Clear();
DataGrid.Rows.Clear();
DataGrid.Tag = pTable;
foreach (DataColumn pColumn in pTable.Columns)
{
DataGrid.Columns.Add(new GridColumn(pColumn.ColumnName));
}
foreach (DataRow pRow in pTable.Rows)
{
GridRow pGridRow = new GridRow(pRow.ItemArray);
//if (pTable.Columns)
pGridRow.Tag = pTable.TableName;
DataGrid.Rows.Add(pGridRow);
}
}
[System.Runtime.InteropServices.DllImport("user32")]
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
const int MOUSEEVENTF_LEFTUP = 0x0004;
private IPipeData pPipeData = null;
private void SwitchControl(string ObjectType)
{
if (pPipeDataCtrl != null)
{
if (pPipeDataCtrl is PCPointCtrl && ObjectType.Equals("点"))
return;
else if (pPipeDataCtrl is PipeLineCtrl && ObjectType.Equals("线"))
return;
}
panelEx3.SuspendLayout();
panelEx3.Controls.Clear();
// string TableName = (CmbDataType.SelectedItem as ErrorTable).Name;
if (ObjectType.Equals("点") )
{
pPipeDataCtrl = new PCPointCtrl(this);
//pPipeDataCtrl.DataType = ObjectType;
// panelEx3.Controls.Add(pPipeDataCtrl as UserControl);
//pPipeData = new MANHOLE();
}
else if (ObjectType.Equals("线") )
{
pPipeDataCtrl = new PipeLineCtrl(this);
//pPipeDataCtrl.DataType = ObjectType;
//pPipeData = new PIPELineClass();
}
else
{
pPipeDataCtrl = null;
//pPipeData = null;
}
if (pPipeDataCtrl != null)
{
(pPipeDataCtrl as UserControl).Dock = DockStyle.Fill;
panelEx3.Controls.Add(pPipeDataCtrl as UserControl);
}
panelEx3.ResumeLayout();
}
private AcadDocument AcadDoc = null;
Autodesk.AutoCAD.ApplicationServices.Document acDoc =null;
protected override void OnLoad(EventArgs e)
{
/* ErrorTable[] ErrorTables = new ErrorTable[]
{ new ErrorTable() { Name = "检查井", TableName = "PS_MANHOLE" },
new ErrorTable(){Name = "雨水口", TableName = "PS_COMB"},
new ErrorTable(){Name = "排放口", TableName = "PS_OUTFALL"},
new ErrorTable(){Name = "管线点", TableName = "PS_VIRTUAL_POINT"},
new ErrorTable(){Name = "泵站前池", TableName = "PS_PUMP_STORAGE"},
new ErrorTable(){Name = "圆管", TableName = "PS_PIPE"}
};*/
QueryItem ManholeItem = new QueryItem() { QueryItemName = "检查井", QueryClassName = "PS_Manhole" };
ManholeItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "检查井编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "SYSTEM_TYPE", ItemName = "属性" , pDataType= DataType.text},
new QueryField() { FieldName = "GROUND_LEVEL", ItemName = "井盖高程" , pDataType= DataType.number},
new QueryField() { FieldName = "INVERT_LEVEL", ItemName = "井底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "WATER_LEVEL", ItemName = "水位高程" , pDataType= DataType.number},
new QueryField() { FieldName = "SEDIMENT_DEPTH", ItemName = "淤积深度" , pDataType= DataType.number},
new QueryField() { FieldName = "COVER_MATERIAL", ItemName = "井盖材质" , pDataType= DataType.text},
new QueryField() { FieldName = "MANHOLE_MATERIAL", ItemName = "井室材质" , pDataType= DataType.text},
new QueryField() { FieldName = "BOTTOM_TYPE", ItemName = "井底形式" , pDataType= DataType.text},
new QueryField() { FieldName = "MANHOLE_SHAPE", ItemName = "井室类型" , pDataType= DataType.text},
new QueryField() { FieldName = "MANHOLE_SIZE", ItemName = "井室尺寸" , pDataType= DataType.text},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
QueryItem PipePointItem = new QueryItem() { QueryItemName = "管线点", QueryClassName = "PS_VIRTUAL_POINT" };
PipePointItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "管线点编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SYSTEM_TYPE", ItemName = "属性" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "GROUND_LEVEL", ItemName = "地面高程" , pDataType= DataType.number},
new QueryField() { FieldName = "INVERT_LEVEL", ItemName = "底部高程" , pDataType= DataType.number},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
QueryItem COMBItem = new QueryItem() { QueryItemName = "雨水口", QueryClassName = "PS_COMB" };
COMBItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "雨水口编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "GROUND_LEVEL", ItemName = "地面高程" , pDataType= DataType.number},
new QueryField() { FieldName = "INVERT_LEVEL", ItemName = "底部高程" , pDataType= DataType.number},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
QueryItem OUTFALLItem = new QueryItem() { QueryItemName = "排放口", QueryClassName = "PS_OUTFALL" };
OUTFALLItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "排放口编码" , pDataType= DataType.text},
new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "SYSTEM_TYPE", ItemName = "属性" , pDataType= DataType.text},
new QueryField() { FieldName = "GROUND_LEVEL", ItemName = "地面高程" , pDataType= DataType.number},
new QueryField() { FieldName = "INVERT_LEVEL", ItemName = "底部高程" , pDataType= DataType.number},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
QueryItem PUMPItem = new QueryItem() { QueryItemName = "泵站前池", QueryClassName = "PS_PUMP_STORAGE" };
PUMPItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "泵站前池编码" , pDataType= DataType.text},
// new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "SYSTEM_TYPE", ItemName = "属性" , pDataType= DataType.text},
new QueryField() { FieldName = "GROUND_LEVEL", ItemName = "地面高程" , pDataType= DataType.number},
new QueryField() { FieldName = "Bottom_LEVEL", ItemName = "池底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "Bottom_AREA", ItemName = "池底面积" , pDataType= DataType.number},
new QueryField() { FieldName = "Top_LEVEL", ItemName = "池顶高程" , pDataType= DataType.number},
new QueryField() { FieldName = "Top_AREA", ItemName = "池顶面积" , pDataType= DataType.number},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
QueryItem PipeItem = new QueryItem() { QueryItemName = "圆管", QueryClassName = "PS_Pipe" };
PipeItem.QueryFields = new QueryField[] {
new QueryField() { FieldName = "ObjectID", ItemName = "序号" , pDataType= DataType.number},
new QueryField() { FieldName = "ID", ItemName = "圆管编码" , pDataType= DataType.text},
// new QueryField() { FieldName = "SURVEY_ID", ItemName = "摸查点号" , pDataType= DataType.text},
new QueryField() { FieldName = "SYSTEM_TYPE", ItemName = "属性" , pDataType= DataType.text},
new QueryField() { FieldName = "US_OBJECT_ID", ItemName = "上游点编码" , pDataType= DataType.text},
new QueryField() { FieldName = "DS_OBJECT_ID", ItemName = "下游点编码" , pDataType= DataType.text},
new QueryField() { FieldName = "Width", ItemName = "管径" , pDataType= DataType.number},
new QueryField() { FieldName = "PIPE_LENGTH", ItemName = "管长" , pDataType= DataType.number},
new QueryField() { FieldName = "US_POINT_INVERT_LEVEL", ItemName = "上游井底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "US_INVERT_LEVEL", ItemName = "上游管底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "DS_POINT_INVERT_LEVEL", ItemName = "下游井底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "DS_INVERT_LEVEL", ItemName = "下游管底高程" , pDataType= DataType.number},
new QueryField() { FieldName = "SEDIMENT_DEPTH", ItemName = "淤积深度" , pDataType= DataType.number},
new QueryField() { FieldName = "MATERIAL", ItemName = "材质" , pDataType= DataType.text},
new QueryField() { FieldName = "ROAD_NAME", ItemName = "所在道路" , pDataType= DataType.text}
};
//CmbDataBase.Items.AddRange(new QueryItem[] { ManholeItem, PipePointItem, COMBItem, OUTFALLItem, PUMPItem, PipeItem });
//CmbDataType.Items.AddRange(new QueryItem[] { ManholeItem2, PipePointItem2, COMBItem2, OUTFALLItem2, PUMPItem2, PipeItem2 });
/* foreach (ErrorTable pErrorTable in ErrorTables)
{
string sql = string.Format("select ObjectID as 序号,ID as 编号,ErrorMsg as 错误信息 from {0}", pErrorTable.TableName);
DataTable pTable= SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
if (pTable.Rows.Count > 0)
{
CmbDataType.Items.Add(new ErrorTable() { Name = pErrorTable.Name, TableName = pErrorTable.TableName, Table = pTable });
}
}*/
//CmbDataType.SelectedIndex = 0;
// CmbDataBase.SelectedIndex = 0;
}
[DllImport("user32.dll", EntryPoint = "keybd_event", SetLastError = true)]
public static extern void keybd_event(Keys bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
private AcadEntity SelectedCADObj = null;
private bool IsPointID(string ID)
{
string sql = string.Format("select CO_X,CO_Y from Points where ID='{0}'", ID);
IDataBase pDataBase = SysDBUnitiy.OleDataBase;
DataTable pTable = pDataBase.ExecuteQuery(sql).Tables[0];
return pTable.Rows.Count > 0;
/* if (ID.StartsWith("YS") || ID.StartsWith("WS"))
return true;
else
return false;*/
}
private void AcadDoc_SelectionChanged()
{
SelectedCADObj = null;
//if (!BtnPick.Checked) return;
// AcadDocument AcadDoc = AcadApp.ActiveDocument;
AcadSelectionSet pAcadSelectionSets = AcadDoc.PickfirstSelectionSet;
if (pAcadSelectionSets.Count == 0)
{
pPipeDataCtrl.Clear();
return;
}
SelectedCADObj = pAcadSelectionSets.Item(pAcadSelectionSets.Count-1);
AcadDictionary pAcadDictionary = SelectedCADObj.GetExtensionDictionary();
if (pAcadDictionary.Count == 1)
{
AcadXRecord pAcadXRecord = pAcadDictionary.Item(0) as AcadXRecord;
string ID = pAcadXRecord.Name;
string ClassName = "Points";
string sql = string.Format("select * from {0} where ID='{1}'", ClassName, ID);
string ControlType;
if (!IsPointID(ID))
{
ClassName = "PS_PIPE";
sql = string.Format("select * from {0} where ID='{1}'", ClassName, ID);
pPipeData = new PIPELineClass();
ControlType = "线";
// SwitchControl("线");
}
else
{
pPipeData = new PCPoint();
ControlType = "点";
//SwitchControl("点");
}
// string ItemName = GetItemNameByClassname(TableName);
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
if (pTable.Rows.Count > 0)
{
SwitchControl(ControlType);
pPipeData.FillValueByRow(pTable.Rows[0]);
pPipeDataCtrl.SetData(pPipeData);
this.Refresh();
}
else
{
MessageBox.Show("该图元信息数据库中不存在","提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
panelEx3.Controls.Clear();
}
}
}
private string GetItemNameByClassname(string ClassName)
{
string sql = string.Format("select TableName from tableconfig where TableClassName='{0}'", ClassName.ToUpper());
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
if (pTable.Rows.Count == 0) return string.Empty;
else
return pTable.Rows[0][0].ToString();
}
private void BtnZoom_Click(object sender, EventArgs e)
{
if (pPipeDataCtrl != null)
{
//Point pPoint = pPipeDataCtrl.GetPoint();
try
{
pPipeDataCtrl.ZoomTo();
}
catch (Exception ex)
{
MessageBox.Show("定位失败", ex.Message);
}
}
}
private void BtnSave_Click(object sender, EventArgs e)
{
if (pPipeDataCtrl == null) return;
IPipeData pPipeData = pPipeDataCtrl.GetData();
//string ClassName = pPipeData.CurClass;
if (string.IsNullOrEmpty(pPipeData.ID))
{
string[] Errors= pPipeData.Verification();
if (Errors.Length == 0)
{
pPipeData.ID = Guid.NewGuid().ToString("N");
try
{
pPipeData.AddNew();
pPipeData.DrawCADObject(AcadDoc);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"保存出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
//AcadDoc.Save();
pPipeDataCtrl.SetData(pPipeData);
//pPipeData.Delete();
//GridRow pGridRow = DgvImportError.ActiveRow as GridRow;
//DgvImportError.PrimaryGrid.Rows.Remove(pGridRow);
MessageBox.Show("保存成功", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
else
{
ErrorItemFrm pDlg = new ErrorItemFrm(Errors);
pDlg.ShowDialog();
return;
}
}
else
{
string[] Errors = pPipeData.Verification();
if (Errors.Length == 0)
{
//if (SelectedCADObj != null)
// SelectedCADObj.Delete();
try
{
//aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded -= new SelectionAddedEventHandler(Editor_SelectionAdded);
AcadDoc.SelectionChanged -= new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
//Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
if (pPipeData is IPCPoint)
{
IPCPoint NewPoint=pPipeData as IPCPoint;
IPCPoint OldPoint = new PCPoint();
OldPoint.GetDataByID(pPipeData.ID);
OldPoint.DeleteCADObject(acDoc);
pPipeData.Update();
NewPoint.DrawCADObject(AcadDoc);
IPIPELine[] PipeLines = (pPipeData as IPipePoint).GetConnLines();
foreach (IPIPELine pPIPELine in PipeLines)
{
if (pPIPELine.US_OBJECT_ID.Equals(pPipeData.ID))
{
string OldUSType = pPIPELine.US_SURVEY_ID.Substring(0, 1);
string NewUSType = (pPipeData as IPCPoint).SURVEY_ID.Substring(0, 1);
pPIPELine.US_SURVEY_ID = (pPipeData as IPCPoint).SURVEY_ID;
if (!OldUSType.Equals(NewUSType))
{
IPIPELine pOldLine = new PIPELineClass();
pOldLine.GetDataByID(pPIPELine.ID);
pOldLine.DeleteCADObject(acDoc);
pPIPELine.DrawCADObject(AcadDoc);
}
}
else if (pPIPELine.DS_OBJECT_ID.Equals(pPipeData.ID))
pPIPELine.DS_SURVEY_ID = (pPipeData as IPCPoint).SURVEY_ID;
pPIPELine.Update();
}
if (OldPoint.X != NewPoint.X||OldPoint.Y!=NewPoint.Y)
{
if (PipeLines.Length == 0) return;
foreach (IPIPELine pPIPELine in PipeLines)
{
pPIPELine.DeleteCADObject(acDoc);
pPIPELine.DrawCADObject(AcadDoc);
}
}
}
else
{
IPIPELine pOldLine = new PIPELineClass();
pOldLine.GetDataByID(pPipeData.ID);
pOldLine.DeleteCADObject(acDoc);
pPipeData.Update();
pPipeData.DrawCADObject(AcadDoc);
}
MessageBox.Show("保存成功", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (pPipeDataCtrl is PCPointCtrl)
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
// aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded += new SelectionAddedEventHandler(Editor_SelectionAdded);
}
}
else
{
ErrorItemFrm pDlg = new ErrorItemFrm(Errors);
pDlg.ShowDialog();
return;
}
}
}
private void BtnQueryError_Click(object sender, EventArgs e)
{
ButtonItem pButtonItem = sender as ButtonItem;
if (pButtonItem.Tag == null) return;
//DgvImportError.Text = pButtonItem.Text;
QueryItem pQueryItem = pButtonItem.Tag as QueryItem;
string ItemName = pQueryItem.QueryItemName;
string TableName = pQueryItem.QueryClassName;
string Fields = string.Empty;
QueryField[] QueryFields = pQueryItem.QueryFields;
foreach (QueryField pQueryField in QueryFields)
{
if (!pQueryField.FieldName.Equals(pQueryField.ItemName))
Fields += string.Format("{0} as {1},", pQueryField.FieldName, pQueryField.ItemName);
else
Fields += string.Format(" {0},", pQueryField.FieldName);
}
Fields = Fields.TrimEnd(',');
//string sql = string.Format("select ObjectID as 序号,ID as 编号,ErrorMsg as 错误信息 from {0}_2", TableName);
string sql = string.Format("select {0} from {1} ", Fields, TableName);
/* DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
DgvQueryResult.PrimaryGrid.DataSource = pTable;*/
// Fields += ",ErrorMsg as 错误信息";
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
pTable.TableName = TableName;
//DgvImportError.Text = ItemName;
//DgvImportError.Tag = pQueryItem;
//DgvImportError.PrimaryGrid.Rows.Clear();
//DgvImportError.PrimaryGrid.Columns.Clear();
//DgvImportError.PrimaryGrid.DataSource = pTable;
//BindTableToGrid(DgvImportError.PrimaryGrid, pTable);
}
private void BtnNewLine_Click(object sender, EventArgs e)
{
SwitchControl("线");
}
private void BtnDelete_Click(object sender, EventArgs e)
{
if (pPipeDataCtrl == null) return;
IPipeData pPipeData = pPipeDataCtrl.GetData();
if (MessageBox.Show("是否删除当前要素", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
== DialogResult.Cancel)
return;
try
{
// aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded -= new SelectionAddedEventHandler(Editor_SelectionAdded);
AcadDoc.SelectionChanged -= new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
pPipeData.Delete();
//Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
AcadDoc.ObjectErased -= new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
pPipeData.DeleteCADObject(acDoc);
AcadDoc.ObjectErased += new _DAcadDocumentEvents_ObjectErasedEventHandler(AcadDoc_ObjectErased);
//AcadDoc.Save();
pPipeDataCtrl.Clear();
}
catch (Exception ex)
{
}
finally
{
AcadDoc.SelectionChanged += new _DAcadDocumentEvents_SelectionChangedEventHandler(AcadDoc_SelectionChanged);
//aApp.DocumentManager.MdiActiveDocument.Editor.SelectionAdded += new SelectionAddedEventHandler(Editor_SelectionAdded);
}
}
private void BtnNewPoint_Click(object sender, EventArgs e)
{
//ButtonItem pButtonItem = sender as ButtonItem;
//if (pButtonItem.Tag == null) return;
/* panelEx3.SuspendLayout();
panelEx3.Controls.Clear();
pPipeDataCtrl = new PCPointCtrl();
(pPipeDataCtrl as UserControl).Dock = DockStyle.Fill;
panelEx3.Controls.Add(pPipeDataCtrl as UserControl);
pPipeDataCtrl.Clear();
*/
//pPipeDataCtrl.SetNewID();
//pPipeData = new PCPoint();
SwitchControl("点");
pPipeDataCtrl.Clear();
}
private void BtnLineLenght_Click(object sender, EventArgs e)
{
SetLenhtDlg pSetLenhtDlg = new SetLenhtDlg();
if (pSetLenhtDlg.ShowDialog() == DialogResult.OK)
{
double lenght = pSetLenhtDlg.Lenght;
string sql = string.Format("select ID as 编码,lenght as 长度,类别,ClassName from V_Line_US_DS where lenght>{0}", lenght);
DataTable pTable = SysDBUnitiy.OleDataBase.ExecuteQuery(sql).Tables[0];
//BindTableToGrid(DgvImportError.PrimaryGrid, pTable);
}
}
private void BtnDataImport_Click(object sender, EventArgs e)
{
AddDataFrm pAddDataFrm = new AddDataFrm();
if (pAddDataFrm.ShowDialog() != DialogResult.OK) return;
//pWork.RunWorkerAsync(pAddDataFrm.pWorkArgument);
pProgressFrm = HR.Controls.ProgressFrm.GetInstance();
pProgressFrm.CanCancle = false;
//pProgressFrm.FormClosed += new FormClosedEventHandler(pProgressFrm_FormClosed);
pProgressFrm.SetProgressStyle(ProgressBarStyle.Blocks);
pProgressFrm.Text = "数据导入";
PWork_DoWork(pAddDataFrm.pWorkArgument);
}
void pWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
pProgressFrm.SafeCallCloseDialog();
}
private HR.Controls.ProgressFrm pProgressFrm = null;
private void PWork_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
Progressup(e.ProgressPercentage);
}
//private BackgroundWorker pWork = null;
delegate void Progressupdelegate(int value);
delegate void Labeldelegate(string msg);
private void Progressup(int value)
{
pProgressFrm.SafeCallDisplayProgress(value);
}
private void Labelup(string msg)
{
pProgressFrm.SafeCallDisplayText(msg);
}
private DataRow IsExistSURVEYID(string SURVEYID)
{
string sql = string.Format("select * from Points where SURVEY_ID='{0}'", SURVEYID);
IDataBase pDataBase = SysDBUnitiy.OleDataBase;
System.Data.DataTable pTable = pDataBase.ExecuteQuery(sql).Tables[0];
if (pTable.Rows.Count == 0) return null;
return pTable.Rows[0];
}
private void PWork_DoWork(WorkArgument pWorkArgument)
{
//pProgressFrm.TopMost = true;
pProgressFrm.ShowDialog();
//WorkArgument pWorkArgument = e.Argument as WorkArgument;
string ExcelPath = pWorkArgument.ExcelPath;
double MinX, MinY, MaxX, MaxY;
//string[] MinPoint = System.Configuration.ConfigurationSettings.AppSettings["MinPoint"].Split(',');
MinX = double.Parse(CIni.ReadINI("XYExtent", "MinX"));
MinY = double.Parse(CIni.ReadINI("XYExtent", "MinY"));
//string[] MaxPoint = System.Configuration.ConfigurationSettings.AppSettings["MaxPoint"].Split(',');
MaxX = double.Parse(CIni.ReadINI("XYExtent", "MaxX"));
MaxY = double.Parse(CIni.ReadINI("XYExtent", "MaxY"));
DataTable PCTable = null;
if (!string.IsNullOrEmpty(ExcelPath))
PCTable = ExcelClass.ReadExcelFile(ExcelPath);
Dictionary<string, DataRow> CoordBHTable = new Dictionary<string, DataRow>();
if (!string.IsNullOrEmpty(pWorkArgument.CoordExcelpath))
{
DataTable CoordTable = ExcelClass.ReadExcelFile(pWorkArgument.CoordExcelpath);
CoordTable.Columns[0].ColumnName = "ID";
//CoordTable.PrimaryKey = new DataColumn[] { CoordTable.Columns[0] };
DataRow FirstRow = CoordTable.Rows[0];
for (int j = 1; j < FirstRow.ItemArray.Length; j++)
{
string value = FirstRow.ItemArray[j].ToString();
double V_num = 0;
if (double.TryParse(value, out V_num))
{
if (V_num > MinX && V_num < MaxX)
{
CoordTable.Columns[j].ColumnName = "CO_X";
}
else if (V_num > MinY && V_num < MaxY)
{
CoordTable.Columns[j].ColumnName = "CO_Y";
}
else
CoordTable.Columns[j].ColumnName = "CO_Z";
}
}
foreach (DataRow pCoordRow in CoordTable.Rows)
{
string key = pCoordRow["ID"].ToString();
if (!CoordBHTable.ContainsKey(key))
CoordBHTable.Add(key, pCoordRow);
}
}
try
{
if (PCTable != null)
{
DataTable ErrorTable = PCTable.Clone();
if (!ErrorTable.Columns.Contains("错误消息"))
ErrorTable.Columns.Add("错误消息");
#region 循环遍历表
//int SumCount = PCTable.Rows.Count;
//int CurNum =0;
DataTable PCTab2 = PCTable.Copy();
for (int i = 0; i < PCTable.Rows.Count; i++)
{
//CurNum++;
DataRow pDataRow = PCTable.Rows[i];
try
{
//Labelup(string.Format("正在导入第: {0}/{1}条", i, PCTable.Rows.Count));
pProgressFrm.SafeCallDisplayText(string.Format("正在导入第: {0}/{1}条管段", i, PCTable.Rows.Count));