개정판 128c844f
dev issue #1240 : get drawing list
Change-Id: Ia856ca0ce242ee081dcc536296934b8ad2ead609
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
358 | 358 |
} |
359 | 359 |
private void SetBlockReferenceRotation(ObjectId objectId, double rotation) |
360 | 360 |
{ |
361 |
|
|
362 | 361 |
Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; |
363 | 362 |
Database acCurDb = acDoc.Database; |
364 | 363 |
Editor acDocEd = acDoc.Editor; |
DTI_PID/APIDConverter/DB/Project_DB.cs | ||
---|---|---|
584 | 584 |
|
585 | 585 |
return strConn; |
586 | 586 |
} |
587 |
|
|
588 | 587 |
public static string GetAvevaConnectionString_Reports() |
589 | 588 |
{ |
590 | 589 |
string strConn = string.Empty; |
... | ... | |
600 | 599 |
|
601 | 600 |
return strConn; |
602 | 601 |
} |
603 |
|
|
604 | 602 |
public static string GetAvevaConnectionString_Admin() |
605 | 603 |
{ |
606 | 604 |
string strConn = string.Empty; |
... | ... | |
616 | 614 |
|
617 | 615 |
return strConn; |
618 | 616 |
} |
619 |
|
|
620 | 617 |
public static string GetDirectiveValue(string name) |
621 | 618 |
{ |
622 | 619 |
string result = null; |
... | ... | |
639 | 636 |
|
640 | 637 |
return result; |
641 | 638 |
} |
642 |
|
|
643 | 639 |
public static DataTable GetDrawingTemplate() |
644 | 640 |
{ |
645 | 641 |
DataTable dt = new DataTable(); |
... | ... | |
659 | 655 |
|
660 | 656 |
return dt; |
661 | 657 |
} |
662 |
|
|
663 | 658 |
public static DataTable SelectStandardSymbolTable() |
664 | 659 |
{ |
665 | 660 |
DataTable dt = new DataTable(); |
... | ... | |
732 | 727 |
|
733 | 728 |
return dt; |
734 | 729 |
} |
730 |
public static DataTable SelectDrawingTable() |
|
731 |
{ |
|
732 |
DataTable dt = new DataTable(); |
|
735 | 733 |
|
734 |
using (SqlConnection connection = new SqlConnection()) |
|
735 |
{ |
|
736 |
connection.ConnectionString = GetAvevaConnectionString_Reports(); |
|
737 |
connection.Open(); |
|
738 |
using (SqlCommand cmd = connection.CreateCommand()) |
|
739 |
{ |
|
740 |
cmd.CommandText = string.Format(@" |
|
741 |
SELECT DrawingId, XDNLABEL, XDSLABEL FROM {0} |
|
742 |
;", "SynchroniseDetails"); |
|
743 |
|
|
744 |
using (SqlDataReader dr = cmd.ExecuteReader()) |
|
745 |
dt.Load(dr); |
|
746 |
} |
|
747 |
connection.Close(); |
|
748 |
} |
|
749 |
|
|
750 |
return dt; |
|
751 |
} |
|
736 | 752 |
#endregion |
737 | 753 |
|
738 | 754 |
} |
DTI_PID/APIDConverter/Form/APIDConverter.cs | ||
---|---|---|
102 | 102 |
|
103 | 103 |
if (dia.ShowDialog() == DialogResult.OK) |
104 | 104 |
{ |
105 |
DataTable drawingTable = Project_DB.SelectDrawingTable(); |
|
106 |
|
|
105 | 107 |
foreach (var fileName in dia.FileNames) |
106 | 108 |
{ |
107 | 109 |
Document document = new Document(fileName, ID2SymbolTypeTable); |
... | ... | |
110 | 112 |
if (rows.Length == 0) |
111 | 113 |
{ |
112 | 114 |
DataRow row = _ConverterDT.NewRow(); |
113 |
row["colDrawingFileName"] = Path.GetFileNameWithoutExtension(fileName); |
|
115 |
string drawingName = Path.GetFileNameWithoutExtension(fileName); |
|
116 |
row["colDrawingFileName"] = drawingName; |
|
114 | 117 |
row["colDrawingFilePath"] = fileName; |
115 | 118 |
if (document.Enable) |
116 | 119 |
row["colStatus"] = "Ready"; |
... | ... | |
118 | 121 |
row["colStatus"] = "Error"; |
119 | 122 |
row["colUID"] = ""; |
120 | 123 |
|
124 |
row["colDrawingNumber"] = drawingName; |
|
125 |
row["colSheetNumber"] = GetSheetNumber(drawingTable, drawingName); |
|
126 |
|
|
121 | 127 |
_ConverterDT.Rows.Add(row); |
122 | 128 |
|
123 | 129 |
if (document.Enable) |
... | ... | |
145 | 151 |
} |
146 | 152 |
} |
147 | 153 |
|
154 |
private string GetSheetNumber(DataTable drawingTable, string drawingName) |
|
155 |
{ |
|
156 |
string result = string.Empty; |
|
157 |
List<DataRow> rows = drawingTable.Select(string.Format("XDNLABEL = '{0}'", drawingName)).ToList(); |
|
158 |
if (rows.Count != 0) |
|
159 |
{ |
|
160 |
int index = 1; |
|
161 |
while (true) |
|
162 |
{ |
|
163 |
DataRow row = rows.Find(x => !DBNull.Value.Equals(x["XDSLABEL"]) && x["XDSLABEL"].ToString() == index.ToString()); |
|
164 |
if (row == null) |
|
165 |
{ |
|
166 |
result = index.ToString(); |
|
167 |
break; |
|
168 |
} |
|
169 |
} |
|
170 |
} |
|
171 |
return result; |
|
172 |
} |
|
173 |
|
|
148 | 174 |
private void APIDConverter_Load(object sender, EventArgs e) |
149 | 175 |
{ |
150 | 176 |
Project_Info project = Project_Info.GetInstance(); |
내보내기 Unified diff