1 |
96a2080c
|
gaqhf
|
using System;
|
2 |
|
|
using System.Collections.Generic;
|
3 |
|
|
using System.ComponentModel;
|
4 |
|
|
using System.Data;
|
5 |
|
|
using System.Drawing;
|
6 |
|
|
using System.Linq;
|
7 |
|
|
using System.Text;
|
8 |
|
|
using System.Threading.Tasks;
|
9 |
|
|
using System.Windows.Forms;
|
10 |
|
|
using Microsoft.VisualBasic;
|
11 |
1278ba59
|
gaqhf
|
using DevExpress.XtraEditors.Repository;
|
12 |
|
|
using DevExpress.XtraEditors.Controls;
|
13 |
|
|
using DevExpress.XtraEditors;
|
14 |
23eb98bf
|
gaqhf
|
using System.Globalization;
|
15 |
|
|
using System.Threading;
|
16 |
|
|
using System.IO;
|
17 |
d19ae675
|
gaqhf
|
using Ingr.RAD2D;
|
18 |
|
|
using Converter.BaseModel;
|
19 |
b8e2644e
|
gaqhf
|
using Converter.SPPID.Properties;
|
20 |
|
|
using Converter.SPPID.DB;
|
21 |
|
|
using Converter.SPPID.Util;
|
22 |
|
|
using Converter.SPPID.Form;
|
23 |
|
|
using Converter.SPPID.Model;
|
24 |
ea54adc8
|
gaqhf
|
using Plaice;
|
25 |
|
|
using Llama;
|
26 |
|
|
|
27 |
96a2080c
|
gaqhf
|
|
28 |
b8e2644e
|
gaqhf
|
namespace Converter.SPPID
|
29 |
96a2080c
|
gaqhf
|
{
|
30 |
|
|
public partial class ConverterForm : DevExpress.XtraBars.Ribbon.RibbonForm
|
31 |
|
|
{
|
32 |
bca86986
|
gaqhf
|
private Dictionary<string, SPPID_Document> _DicDocuments = new Dictionary<string, SPPID_Document>();
|
33 |
4314b3f3
|
gaqhf
|
private List<SPPID_Document> _Documents = new List<SPPID_Document>();
|
34 |
|
|
public List<SPPID_Document> Documents { get { return _Documents; } }
|
35 |
bca86986
|
gaqhf
|
private DataTable _ConverterDT = new DataTable();
|
36 |
|
|
private DataTable _SPPIDSymbolPathDT = new DataTable();
|
37 |
635a8747
|
gaqhf
|
private DataTable _SPPIDUnitDT = new DataTable();
|
38 |
e88aae98
|
gaqhf
|
private DataTable _SPPIDAttributeDT = new DataTable();
|
39 |
23eb98bf
|
gaqhf
|
private RepositoryItemComboBox templateComboBox;
|
40 |
|
|
|
41 |
bca86986
|
gaqhf
|
|
42 |
|
|
private DataTable _ID2SymbolDT = new DataTable();
|
43 |
4b4dbca9
|
gaqhf
|
private DataTable _ID2ChildSymbolDT = new DataTable();
|
44 |
bca86986
|
gaqhf
|
private DataTable _ID2LineDT = new DataTable();
|
45 |
1efc25a3
|
gaqhf
|
private DataTable _ID2AttributeDT = new DataTable();
|
46 |
306a0af9
|
gaqhf
|
private DataTable _ID2DrawingAttributeDT = new DataTable();
|
47 |
bca86986
|
gaqhf
|
private DataTable _ID2LinePropertyDT = new DataTable();
|
48 |
f1c9dbaa
|
gaqhf
|
private DataTable _ID2SymbolTypeDT = new DataTable();
|
49 |
4d2571ab
|
gaqhf
|
private DataTable _ID2SymbolTable = new DataTable();
|
50 |
f1c9dbaa
|
gaqhf
|
|
51 |
bca86986
|
gaqhf
|
|
52 |
|
|
private List<SymbolMapping> symbolMappings = new List<SymbolMapping>();
|
53 |
4b4dbca9
|
gaqhf
|
private List<ChildSymbolMapping> childSymbolMappings = new List<ChildSymbolMapping>();
|
54 |
bca86986
|
gaqhf
|
private List<LineMapping> lineMappings = new List<LineMapping>();
|
55 |
|
|
private List<LineNumberMapping> lineNumberMappings = new List<LineNumberMapping>();
|
56 |
1efc25a3
|
gaqhf
|
private List<AttributeMapping> attributeMappings = new List<AttributeMapping>();
|
57 |
bca86986
|
gaqhf
|
|
58 |
ea54adc8
|
gaqhf
|
string TemplatePath;
|
59 |
|
|
|
60 |
96a2080c
|
gaqhf
|
public ConverterForm()
|
61 |
|
|
{
|
62 |
|
|
InitializeComponent();
|
63 |
1278ba59
|
gaqhf
|
|
64 |
b048c104
|
gaqhf
|
CultureInfo culture = CultureInfo.GetCultureInfo("ko");
|
65 |
|
|
Msg.Culture = culture;
|
66 |
23eb98bf
|
gaqhf
|
|
67 |
ea54adc8
|
gaqhf
|
this._SPPIDUnitDT = SPPIDUtil.GetUnitInfo();
|
68 |
|
|
TemplatePath = SPPIDUtil.T_OPTIONSETTING_Value("PID Template Path");
|
69 |
|
|
|
70 |
bca86986
|
gaqhf
|
InitUsedDataTable();
|
71 |
1278ba59
|
gaqhf
|
InitGridControl();
|
72 |
fab4f207
|
gaqhf
|
InitID2Project();
|
73 |
1278ba59
|
gaqhf
|
}
|
74 |
|
|
|
75 |
bca86986
|
gaqhf
|
private void InitUsedDataTable()
|
76 |
1278ba59
|
gaqhf
|
{
|
77 |
bca86986
|
gaqhf
|
// Converter Table
|
78 |
|
|
DataColumn col = _ConverterDT.Columns.Add("colDrawingFileName");
|
79 |
1278ba59
|
gaqhf
|
col.Caption = "Drawing File Name";
|
80 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colDrawingFilePath");
|
81 |
0d8062b2
|
gaqhf
|
col.Caption = "DrawingFilePath";
|
82 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colUnit");
|
83 |
1278ba59
|
gaqhf
|
col.Caption = "Unit";
|
84 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colTemplate");
|
85 |
1278ba59
|
gaqhf
|
col.Caption = "Template";
|
86 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colDrawingNumber");
|
87 |
1278ba59
|
gaqhf
|
col.Caption = "Drawing Number";
|
88 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colDrawingName");
|
89 |
1278ba59
|
gaqhf
|
col.Caption = "Drawing Name";
|
90 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colStatus");
|
91 |
1278ba59
|
gaqhf
|
col.Caption = "Status";
|
92 |
bca86986
|
gaqhf
|
col = _ConverterDT.Columns.Add("colUID");
|
93 |
|
|
|
94 |
|
|
col = _ID2LineDT.Columns.Add("UID");
|
95 |
|
|
col = _ID2LineDT.Columns.Add("Name");
|
96 |
|
|
col.Caption = "Name";
|
97 |
|
|
col = _ID2LineDT.Columns.Add("Type");
|
98 |
|
|
col.Caption = "Type";
|
99 |
|
|
col = _ID2LineDT.Columns.Add("SPPID_SYMBOL_PATH");
|
100 |
|
|
col.Caption = "SPPID Symbol Path";
|
101 |
|
|
col = _ID2LineDT.Columns.Add("Clear");
|
102 |
|
|
col.Caption = "";
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
private void InitGridControl()
|
106 |
|
|
{
|
107 |
|
|
#region Converter Page
|
108 |
|
|
gridViewConverter.OptionsSelection.MultiSelect = true;
|
109 |
|
|
gridViewConverter.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
|
110 |
|
|
|
111 |
|
|
gridControlConverter.DataSource = _ConverterDT;
|
112 |
1278ba59
|
gaqhf
|
|
113 |
|
|
templateComboBox = new RepositoryItemComboBox();
|
114 |
|
|
templateComboBox.TextEditStyle = TextEditStyles.DisableTextEditor;
|
115 |
635a8747
|
gaqhf
|
templateComboBox.EditValueChanged += templateComboBox_EditValueChanged;
|
116 |
1278ba59
|
gaqhf
|
gridControlConverter.RepositoryItems.Add(templateComboBox);
|
117 |
|
|
gridViewConverter.Columns["colTemplate"].ColumnEdit = templateComboBox;
|
118 |
|
|
|
119 |
635a8747
|
gaqhf
|
gridViewConverter.Columns["colUnit"].OptionsColumn.AllowEdit = false;
|
120 |
1278ba59
|
gaqhf
|
gridViewConverter.Columns["colDrawingFileName"].OptionsColumn.AllowEdit = false;
|
121 |
|
|
gridViewConverter.Columns["colUnit"].OptionsColumn.ReadOnly = true;
|
122 |
|
|
gridViewConverter.Columns["colStatus"].OptionsColumn.AllowEdit = false;
|
123 |
0d8062b2
|
gaqhf
|
gridViewConverter.Columns["colDrawingFilePath"].Visible = false;
|
124 |
1278ba59
|
gaqhf
|
gridViewConverter.Columns["colUID"].Visible = false;
|
125 |
|
|
|
126 |
|
|
gridViewConverter.BestFitColumns();
|
127 |
|
|
#endregion
|
128 |
|
|
}
|
129 |
f1c9dbaa
|
gaqhf
|
|
130 |
635a8747
|
gaqhf
|
private void templateComboBox_EditValueChanged(object sender, EventArgs e)
|
131 |
|
|
{
|
132 |
|
|
gridViewConverter.CloseEditor();
|
133 |
|
|
gridViewConverter.UpdateCurrentRow();
|
134 |
|
|
}
|
135 |
|
|
|
136 |
|
|
private void gridViewConverter_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
|
137 |
|
|
{
|
138 |
|
|
if (e.Column.Name == "colcolTemplate")
|
139 |
|
|
{
|
140 |
|
|
gridViewConverter.ShowEditor();
|
141 |
|
|
(gridViewConverter.ActiveEditor as ComboBoxEdit).ShowPopup();
|
142 |
|
|
}
|
143 |
|
|
else if (e.Column.Name == "colcolUnit")
|
144 |
|
|
{
|
145 |
|
|
UnitForm unitForm = new UnitForm(_SPPIDUnitDT);
|
146 |
|
|
if (unitForm.ShowDialog() == DialogResult.OK)
|
147 |
|
|
{
|
148 |
|
|
gridViewConverter.SetRowCellValue(e.RowHandle, e.Column, unitForm.SelectedUnit);
|
149 |
|
|
gridViewConverter.CloseEditor();
|
150 |
|
|
gridViewConverter.UpdateCurrentRow();
|
151 |
|
|
}
|
152 |
|
|
}
|
153 |
|
|
}
|
154 |
1278ba59
|
gaqhf
|
|
155 |
8847ea67
|
gaqhf
|
private void btnID2DB_Click(object sender, EventArgs e)
|
156 |
23eb98bf
|
gaqhf
|
{
|
157 |
8847ea67
|
gaqhf
|
ID2DBSetting form = new ID2DBSetting();
|
158 |
e7427d3c
|
gaqhf
|
DialogResult dialogResult = form.ShowDialog();
|
159 |
8847ea67
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
160 |
|
|
_ProjectInfo.DefaultPath = Settings.Default.ProjectPath;
|
161 |
|
|
_ProjectInfo.DBType = (ID2DB_Type)Settings.Default.ProjectDBType;
|
162 |
|
|
_ProjectInfo.ServerIP = Settings.Default.ProjectServerIP;
|
163 |
|
|
_ProjectInfo.Port = Settings.Default.ProjectPort;
|
164 |
|
|
_ProjectInfo.DBUser = Settings.Default.ProjectDBUser;
|
165 |
|
|
_ProjectInfo.DBPassword = Settings.Default.ProjectDBPassword;
|
166 |
|
|
|
167 |
e7427d3c
|
gaqhf
|
if (dialogResult == DialogResult.OK)
|
168 |
23eb98bf
|
gaqhf
|
{
|
169 |
fab4f207
|
gaqhf
|
if (InitID2Project())
|
170 |
|
|
MessageBox.Show(Msg.SuccessProjectSelect, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
171 |
|
|
else
|
172 |
23eb98bf
|
gaqhf
|
MessageBox.Show(Msg.FailProjectSelect, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
fab4f207
|
gaqhf
|
private bool InitID2Project()
|
177 |
23eb98bf
|
gaqhf
|
{
|
178 |
ec0c7045
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
179 |
fab4f207
|
gaqhf
|
if (Project_DB.ConnTestAndCreateTable())
|
180 |
23eb98bf
|
gaqhf
|
{
|
181 |
fab4f207
|
gaqhf
|
_ProjectInfo.Enable = true;
|
182 |
8847ea67
|
gaqhf
|
labelDBType.Text = _ProjectInfo.DBType.ToString();
|
183 |
|
|
labelDBType.AppearanceItemCaption.ForeColor = Color.Blue;
|
184 |
23eb98bf
|
gaqhf
|
labelID2ProjectName.Text = _ProjectInfo.Name;
|
185 |
|
|
labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Blue;
|
186 |
|
|
labelID2ProjectStatus.Text = Msg.ConnectionSuccessful;
|
187 |
|
|
labelID2ProjectStatus.AppearanceItemCaption.ForeColor = Color.Blue;
|
188 |
fab4f207
|
gaqhf
|
layoutControlGroupSPPIDDB.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
|
189 |
|
|
layoutControlGroupItemMapping.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
|
190 |
23eb98bf
|
gaqhf
|
}
|
191 |
|
|
else
|
192 |
|
|
{
|
193 |
fab4f207
|
gaqhf
|
_ProjectInfo.Enable = false;
|
194 |
da84b14b
|
gaqhf
|
labelDBType.Text = " ";
|
195 |
23eb98bf
|
gaqhf
|
labelID2ProjectName.Text = " ";
|
196 |
|
|
labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Red;
|
197 |
|
|
labelID2ProjectStatus.Text = Msg.ConnectionFail;
|
198 |
|
|
labelID2ProjectStatus.AppearanceItemCaption.ForeColor = Color.Red;
|
199 |
fab4f207
|
gaqhf
|
layoutControlGroupSPPIDDB.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
200 |
|
|
layoutControlGroupItemMapping.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
201 |
bca86986
|
gaqhf
|
}
|
202 |
fab4f207
|
gaqhf
|
|
203 |
bca86986
|
gaqhf
|
InitMapping();
|
204 |
|
|
InitSPPIDDB();
|
205 |
|
|
|
206 |
|
|
return _ProjectInfo.Enable;
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
private void InitMapping()
|
210 |
|
|
{
|
211 |
|
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
212 |
|
|
if (_ProjectInfo.Enable)
|
213 |
|
|
{
|
214 |
4d2571ab
|
gaqhf
|
if (_ID2SymbolTable != null)
|
215 |
|
|
{
|
216 |
|
|
_ID2SymbolTable.Dispose();
|
217 |
|
|
_ID2SymbolTable = null;
|
218 |
|
|
}
|
219 |
|
|
_ID2SymbolTable = Project_DB.SelectID2SymbolTable();
|
220 |
7e680366
|
gaqhf
|
|
221 |
|
|
if (_ID2SymbolTypeDT != null)
|
222 |
|
|
{
|
223 |
|
|
_ID2SymbolTypeDT.Dispose();
|
224 |
|
|
_ID2SymbolTypeDT = null;
|
225 |
|
|
}
|
226 |
|
|
_ID2SymbolTypeDT = Project_DB.SelectSymbolType();
|
227 |
bca86986
|
gaqhf
|
InitID2Symbol();
|
228 |
|
|
InitID2Line();
|
229 |
|
|
InitID2LineNumber();
|
230 |
1efc25a3
|
gaqhf
|
InitID2Attribute();
|
231 |
306a0af9
|
gaqhf
|
InitID2DrawingAttribute();
|
232 |
e00e891d
|
gaqhf
|
|
233 |
|
|
InitETCSetting();
|
234 |
|
|
}
|
235 |
|
|
}
|
236 |
fbdb9f2a
|
gaqhf
|
|
237 |
e00e891d
|
gaqhf
|
private void InitETCSetting()
|
238 |
|
|
{
|
239 |
|
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
240 |
|
|
if (_ProjectInfo.Enable)
|
241 |
|
|
{
|
242 |
7cbb1038
|
gaqhf
|
DataTable dt = Project_DB.SelectSetting();
|
243 |
|
|
foreach (DataRow item in dt.Rows)
|
244 |
|
|
{
|
245 |
|
|
string settingType = item["SettingType"].ToString();
|
246 |
|
|
if (settingType == "ETCSetting")
|
247 |
|
|
SPPIDUtil.ConvertToETCSetting(item["JsonString"].ToString());
|
248 |
|
|
else if (settingType == "GridSetting")
|
249 |
|
|
SPPIDUtil.ConvertToGridSetting(item["JsonString"].ToString());
|
250 |
|
|
}
|
251 |
bca86986
|
gaqhf
|
}
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
private void InitID2Symbol()
|
255 |
|
|
{
|
256 |
|
|
using (DataTable symbolDT = Project_DB.SelectProjectSymbol())
|
257 |
|
|
{
|
258 |
|
|
symbolMappings.Clear();
|
259 |
|
|
_ID2SymbolDT = symbolDT;
|
260 |
|
|
_ID2SymbolDT.Columns.Add("Clear");
|
261 |
|
|
_ID2SymbolDT.Columns["Clear"].Caption = "";
|
262 |
|
|
foreach (DataRow row in symbolDT.Rows)
|
263 |
|
|
{
|
264 |
|
|
symbolMappings.Add(new SymbolMapping()
|
265 |
|
|
{
|
266 |
|
|
UID = row["UID"] == null ? "" : row["UID"].ToString(),
|
267 |
|
|
SYMBOLNAME = row["Name"] == null ? "" : row["Name"].ToString(),
|
268 |
|
|
SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString(),
|
269 |
cf924377
|
gaqhf
|
LEADERLINE = DBNull.Value.Equals(row["LEADERLINE"]) ? false : (bool)row["LEADERLINE"]
|
270 |
bca86986
|
gaqhf
|
});
|
271 |
|
|
}
|
272 |
4b4dbca9
|
gaqhf
|
|
273 |
|
|
MergeID2ChildSymbol();
|
274 |
|
|
}
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
private void MergeID2ChildSymbol()
|
278 |
|
|
{
|
279 |
|
|
using (DataTable childSymbolDT = Project_DB.SelectProjectChildSymbol())
|
280 |
|
|
{
|
281 |
|
|
childSymbolMappings.Clear();
|
282 |
|
|
_ID2ChildSymbolDT = childSymbolDT;
|
283 |
|
|
_ID2ChildSymbolDT.Columns.Add("Clear");
|
284 |
|
|
_ID2ChildSymbolDT.Columns["Clear"].Caption = "";
|
285 |
|
|
foreach (DataRow row in childSymbolDT.Rows)
|
286 |
|
|
{
|
287 |
|
|
childSymbolMappings.Add(new ChildSymbolMapping()
|
288 |
|
|
{
|
289 |
|
|
UID = row["UID"] == null ? "" : row["UID"].ToString(),
|
290 |
|
|
SYMBOLNAME = row["Name"] == null ? "" : row["Name"].ToString(),
|
291 |
|
|
SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString(),
|
292 |
|
|
});
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
_ID2SymbolDT.Merge(_ID2ChildSymbolDT);
|
296 |
bca86986
|
gaqhf
|
}
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
private void InitID2Line()
|
300 |
|
|
{
|
301 |
|
|
using (DataTable lineTypes = Project_DB.SelectProjectLine())
|
302 |
|
|
{
|
303 |
|
|
lineMappings.Clear();
|
304 |
|
|
_ID2LineDT.Rows.Clear();
|
305 |
|
|
foreach (DataRow row in lineTypes.Rows)
|
306 |
|
|
{
|
307 |
|
|
DataRow newRow = _ID2LineDT.NewRow();
|
308 |
|
|
newRow["UID"] = row["UID"] == null ? "" : row["UID"].ToString();
|
309 |
|
|
newRow["Name"] = row["Name"] == null ? "" : row["Name"].ToString();
|
310 |
|
|
newRow["Type"] = "Line";
|
311 |
|
|
newRow["SPPID_SYMBOL_PATH"] = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString();
|
312 |
|
|
_ID2LineDT.Rows.Add(newRow);
|
313 |
|
|
|
314 |
|
|
lineMappings.Add(new LineMapping()
|
315 |
|
|
{
|
316 |
|
|
UID = row["UID"] == null ? "" : row["UID"].ToString(),
|
317 |
|
|
LINENAME = row["Name"] == null ? "" : row["Name"].ToString(),
|
318 |
|
|
SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString(),
|
319 |
|
|
});
|
320 |
|
|
}
|
321 |
|
|
}
|
322 |
|
|
}
|
323 |
|
|
|
324 |
|
|
private void InitID2LineNumber()
|
325 |
|
|
{
|
326 |
|
|
using (DataTable linePropertiesDT = Project_DB.SelectProjectLineProperties())
|
327 |
|
|
{
|
328 |
|
|
lineNumberMappings.Clear();
|
329 |
|
|
_ID2LinePropertyDT = linePropertiesDT;
|
330 |
|
|
_ID2LinePropertyDT.Columns.Add("Type");
|
331 |
|
|
foreach (DataRow row in linePropertiesDT.Rows)
|
332 |
|
|
{
|
333 |
|
|
row["Type"] = "Line Property";
|
334 |
|
|
lineNumberMappings.Add(new LineNumberMapping()
|
335 |
|
|
{
|
336 |
|
|
UID = row["UID"] == null ? "" : row["UID"].ToString(),
|
337 |
|
|
DisplayName = row["DisplayName"] == null ? "" : row["DisplayName"].ToString(),
|
338 |
|
|
SPPIDATTRIBUTENAME = row["SPPID_ATTRIBUTE"] == null ? "" : row["SPPID_ATTRIBUTE"].ToString(),
|
339 |
|
|
SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString()
|
340 |
|
|
});
|
341 |
|
|
}
|
342 |
|
|
}
|
343 |
|
|
}
|
344 |
|
|
|
345 |
1efc25a3
|
gaqhf
|
private void InitID2Attribute()
|
346 |
bca86986
|
gaqhf
|
{
|
347 |
1efc25a3
|
gaqhf
|
using (DataTable attributeDT = Project_DB.SelectProjectAttribute())
|
348 |
bca86986
|
gaqhf
|
{
|
349 |
1efc25a3
|
gaqhf
|
attributeMappings.Clear();
|
350 |
|
|
_ID2AttributeDT = attributeDT;
|
351 |
|
|
_ID2AttributeDT.Columns.Add("Clear");
|
352 |
|
|
_ID2AttributeDT.Columns["Clear"].Caption = "";
|
353 |
|
|
foreach (DataRow row in attributeDT.Rows)
|
354 |
bca86986
|
gaqhf
|
{
|
355 |
1efc25a3
|
gaqhf
|
attributeMappings.Add(new AttributeMapping()
|
356 |
bca86986
|
gaqhf
|
{
|
357 |
|
|
UID = row["UID"] == null ? "" : row["UID"].ToString(),
|
358 |
|
|
DisplayAttribute = row["DisplayAttribute"] == null ? "" : row["DisplayAttribute"].ToString(),
|
359 |
|
|
Type = row["Type"] == null ? "" : row["Type"].ToString(),
|
360 |
|
|
SPPIDATTRIBUTENAME = row["SPPID_ATTRIBUTE"] == null ? "" : row["SPPID_ATTRIBUTE"].ToString(),
|
361 |
1a3a74a8
|
gaqhf
|
SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString(),
|
362 |
1ba9c671
|
gaqhf
|
Location = DBNull.Value.Equals(row["LOCATION"]) ? Model.Location.None : (Location)row["LOCATION"],
|
363 |
1ecaaba8
|
gaqhf
|
LeaderLine = DBNull.Value.Equals(row["LEADERLINE"]) ? false : (bool)row["LEADERLINE"],
|
364 |
|
|
IsText = DBNull.Value.Equals(row["ISTEXT"]) ? false : (bool)row["ISTEXT"]
|
365 |
bca86986
|
gaqhf
|
});
|
366 |
|
|
}
|
367 |
23eb98bf
|
gaqhf
|
}
|
368 |
|
|
}
|
369 |
|
|
|
370 |
306a0af9
|
gaqhf
|
private void InitID2DrawingAttribute()
|
371 |
|
|
{
|
372 |
|
|
using (DataTable drawingAttributeDT = Project_DB.SelectDrawingProjectAttribute())
|
373 |
|
|
{
|
374 |
|
|
_ID2DrawingAttributeDT = drawingAttributeDT;
|
375 |
|
|
}
|
376 |
|
|
}
|
377 |
|
|
|
378 |
fab4f207
|
gaqhf
|
private void InitSPPIDDB()
|
379 |
23eb98bf
|
gaqhf
|
{
|
380 |
12b7a2a8
|
gaqhf
|
buttonEditDefaultUnit.TextChanged -= new EventHandler(buttonEditDefaultUnit_TextChanged);
|
381 |
|
|
comboBoxEditDefaultTemplate.SelectedIndexChanged -= new EventHandler(comboBoxEditDefaultTemplate_SelectedIndexChanged);
|
382 |
|
|
|
383 |
ec0c7045
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
384 |
fab4f207
|
gaqhf
|
if (_ProjectInfo.Enable)
|
385 |
|
|
{
|
386 |
|
|
DataTable dt = Project_DB.SelectSPPID_DB_INFO();
|
387 |
ec0c7045
|
gaqhf
|
if (dt.Columns.Count > 0 && dt.Rows.Count > 0)
|
388 |
|
|
SPPIDUtil.ConvertToSPPIDInfo(dt.Rows[0][0].ToString());
|
389 |
|
|
else
|
390 |
|
|
SPPID_DBInfo.Clear();
|
391 |
fab4f207
|
gaqhf
|
}
|
392 |
ec0c7045
|
gaqhf
|
|
393 |
635a8747
|
gaqhf
|
templateComboBox.Items.Clear();
|
394 |
d73c791c
|
gaqhf
|
comboBoxEditDefaultTemplate.SelectedIndex = -1;
|
395 |
|
|
comboBoxEditDefaultTemplate.Properties.Items.Clear();
|
396 |
|
|
buttonEditDefaultUnit.Text = "";
|
397 |
|
|
|
398 |
ec0c7045
|
gaqhf
|
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
399 |
23eb98bf
|
gaqhf
|
if (_SPPIDInfo.Enable)
|
400 |
|
|
{
|
401 |
|
|
labelSPPIDPlantName.Text = _SPPIDInfo.SelectedPlant;
|
402 |
|
|
labelSPPIDPlantName.AppearanceItemCaption.ForeColor = Color.Blue;
|
403 |
|
|
labelSPPIDDBStatus.Text = Msg.ConnectionSuccessful;
|
404 |
|
|
labelSPPIDDBStatus.AppearanceItemCaption.ForeColor = Color.Blue;
|
405 |
635a8747
|
gaqhf
|
|
406 |
|
|
if (!string.IsNullOrEmpty(TemplatePath))
|
407 |
d73c791c
|
gaqhf
|
{
|
408 |
|
|
List<string> templateFiles = Directory.GetFiles(TemplatePath, "*.pid").ToList().Select(filePath => Path.GetFileName(filePath)).ToList();
|
409 |
|
|
templateComboBox.Items.AddRange(templateFiles);
|
410 |
|
|
comboBoxEditDefaultTemplate.Properties.Items.AddRange(templateFiles);
|
411 |
|
|
}
|
412 |
|
|
|
413 |
e88aae98
|
gaqhf
|
if (_SPPIDAttributeDT != null)
|
414 |
|
|
{
|
415 |
|
|
_SPPIDAttributeDT.Dispose();
|
416 |
|
|
_SPPIDAttributeDT = null;
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
_SPPIDAttributeDT = SPPID_DB.GetSPPIDAttribute();
|
420 |
|
|
if (_SPPIDAttributeDT != null)
|
421 |
|
|
{
|
422 |
|
|
_SPPIDAttributeDT.Columns["DISPLAYNAME"].ColumnName = "DISPLAY NAME";
|
423 |
|
|
}
|
424 |
12b7a2a8
|
gaqhf
|
|
425 |
|
|
if (!string.IsNullOrEmpty(Settings.Default.DefaultTemplate) && comboBoxEditDefaultTemplate.Properties.Items.Contains(Settings.Default.DefaultTemplate))
|
426 |
|
|
comboBoxEditDefaultTemplate.SelectedItem = Settings.Default.DefaultTemplate;
|
427 |
|
|
|
428 |
|
|
// Unit 있는지 없는지 검사 필요
|
429 |
|
|
if (!string.IsNullOrEmpty(Settings.Default.DefaultUnit))
|
430 |
|
|
buttonEditDefaultUnit.Text = Settings.Default.DefaultUnit;
|
431 |
23eb98bf
|
gaqhf
|
}
|
432 |
|
|
else
|
433 |
|
|
{
|
434 |
|
|
labelSPPIDPlantName.Text = " ";
|
435 |
|
|
labelSPPIDPlantName.AppearanceItemCaption.ForeColor = Color.Red;
|
436 |
|
|
labelSPPIDDBStatus.Text = Msg.ConnectionFail;
|
437 |
|
|
labelSPPIDDBStatus.AppearanceItemCaption.ForeColor = Color.Red;
|
438 |
|
|
}
|
439 |
bca86986
|
gaqhf
|
|
440 |
635a8747
|
gaqhf
|
_DicDocuments.Clear();
|
441 |
|
|
_ConverterDT.Rows.Clear();
|
442 |
bca86986
|
gaqhf
|
InitSPPIDSymbolTreeTable();
|
443 |
12b7a2a8
|
gaqhf
|
|
444 |
|
|
buttonEditDefaultUnit.TextChanged += new EventHandler(buttonEditDefaultUnit_TextChanged);
|
445 |
|
|
comboBoxEditDefaultTemplate.SelectedIndexChanged += new EventHandler(comboBoxEditDefaultTemplate_SelectedIndexChanged);
|
446 |
23eb98bf
|
gaqhf
|
}
|
447 |
|
|
|
448 |
bca86986
|
gaqhf
|
private void InitSPPIDSymbolTreeTable()
|
449 |
23eb98bf
|
gaqhf
|
{
|
450 |
26c6f818
|
gaqhf
|
try
|
451 |
|
|
{
|
452 |
|
|
_SPPIDSymbolPathDT = new DataTable();
|
453 |
|
|
_SPPIDSymbolPathDT.Columns.Add("ID");
|
454 |
|
|
_SPPIDSymbolPathDT.Columns.Add("Parent");
|
455 |
|
|
_SPPIDSymbolPathDT.Columns.Add("Name");
|
456 |
|
|
_SPPIDSymbolPathDT.Columns.Add("FullPath");
|
457 |
bca86986
|
gaqhf
|
|
458 |
ea54adc8
|
gaqhf
|
string symbolPath = SPPIDUtil.T_OPTIONSETTING_Value("Catalog Explorer root path");
|
459 |
|
|
DirectoryInfo info = new DirectoryInfo(symbolPath);
|
460 |
|
|
_SPPIDSymbolPathDT.Rows.Add(new object[] { "0", "-1", info.Name });
|
461 |
|
|
loop(info, "0", symbolPath);
|
462 |
26c6f818
|
gaqhf
|
}
|
463 |
|
|
catch (Exception ex)
|
464 |
23eb98bf
|
gaqhf
|
{
|
465 |
26c6f818
|
gaqhf
|
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
|
466 |
23eb98bf
|
gaqhf
|
}
|
467 |
bca86986
|
gaqhf
|
}
|
468 |
23eb98bf
|
gaqhf
|
|
469 |
bca86986
|
gaqhf
|
private void loop(DirectoryInfo parentInfo, string parentUID, string defaultPath)
|
470 |
|
|
{
|
471 |
|
|
DirectoryInfo[] infos = parentInfo.GetDirectories();
|
472 |
|
|
foreach (DirectoryInfo info in infos)
|
473 |
|
|
{
|
474 |
|
|
string uid = Guid.NewGuid().ToString();
|
475 |
|
|
_SPPIDSymbolPathDT.Rows.Add(new object[] { uid, parentUID, info.Name });
|
476 |
|
|
loop(info, uid, defaultPath);
|
477 |
|
|
|
478 |
|
|
FileInfo[] files = info.GetFiles("*.sym");
|
479 |
|
|
foreach (FileInfo fileInfo in files)
|
480 |
|
|
{
|
481 |
|
|
_SPPIDSymbolPathDT.Rows.Add(new object[] { Guid.NewGuid().ToString(), uid, fileInfo.Name, fileInfo.FullName.Replace(defaultPath, "") });
|
482 |
|
|
}
|
483 |
|
|
}
|
484 |
23eb98bf
|
gaqhf
|
}
|
485 |
|
|
|
486 |
1278ba59
|
gaqhf
|
private void btnLoadFile_Click(object sender, EventArgs e)
|
487 |
|
|
{
|
488 |
0a111e7d
|
gaqhf
|
List< BaseModel.Document> validationFailDocs = new List<BaseModel.Document>();
|
489 |
ec0c7045
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
490 |
d73c791c
|
gaqhf
|
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
491 |
|
|
if (!_ProjectInfo.Enable || !_SPPIDInfo.Enable)
|
492 |
23eb98bf
|
gaqhf
|
{
|
493 |
d73c791c
|
gaqhf
|
MessageBox.Show(Msg.PleaseSetProjectInfo, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
494 |
23eb98bf
|
gaqhf
|
return;
|
495 |
|
|
}
|
496 |
1278ba59
|
gaqhf
|
|
497 |
171142c5
|
gaqhf
|
xtraOpenFileDialog.InitialDirectory = _ProjectInfo.TempDirPath;
|
498 |
23eb98bf
|
gaqhf
|
if (xtraOpenFileDialog.ShowDialog() == DialogResult.OK)
|
499 |
1278ba59
|
gaqhf
|
{
|
500 |
23eb98bf
|
gaqhf
|
foreach (string fileName in xtraOpenFileDialog.FileNames)
|
501 |
1278ba59
|
gaqhf
|
{
|
502 |
7e680366
|
gaqhf
|
SPPID_Document document = new SPPID_Document(fileName, _ID2SymbolTypeDT);
|
503 |
4314b3f3
|
gaqhf
|
|
504 |
68e9394a
|
gaqhf
|
document.SymbolTable = _ID2SymbolTable;
|
505 |
|
|
document.SymbolMappings = symbolMappings;
|
506 |
|
|
document.ChildSymbolMappings = childSymbolMappings;
|
507 |
|
|
document.LineMappings = lineMappings;
|
508 |
|
|
document.LineNumberMappings = lineNumberMappings;
|
509 |
|
|
document.AttributeMappings = attributeMappings;
|
510 |
|
|
document.ETCSetting = ETCSetting.GetInstance();
|
511 |
|
|
document.SetSPPIDInfo();
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
if (!document.SetSPPIDMapping())
|
515 |
|
|
{
|
516 |
|
|
document.Enable = false;
|
517 |
|
|
document.MappingValidation = false;
|
518 |
|
|
}
|
519 |
|
|
|
520 |
bca86986
|
gaqhf
|
DataRow[] rows = _ConverterDT.Select(string.Format("colDrawingFilePath = '{0}'", fileName));
|
521 |
0d8062b2
|
gaqhf
|
if (rows.Length == 0)
|
522 |
|
|
{
|
523 |
f9cc5190
|
gaqhf
|
DataRow row = _ConverterDT.NewRow();
|
524 |
0d8062b2
|
gaqhf
|
row["colDrawingFileName"] = Path.GetFileNameWithoutExtension(fileName);
|
525 |
|
|
row["colDrawingFilePath"] = fileName;
|
526 |
|
|
row["colDrawingNumber"] = document.DWGNAME;
|
527 |
|
|
row["colDrawingName"] = document.DWGNAME;
|
528 |
|
|
if (document.Enable)
|
529 |
|
|
row["colStatus"] = "Ready";
|
530 |
|
|
else
|
531 |
|
|
row["colStatus"] = "Error";
|
532 |
|
|
row["colUID"] = "";
|
533 |
d73c791c
|
gaqhf
|
if (comboBoxEditDefaultTemplate.SelectedIndex > -1)
|
534 |
12b7a2a8
|
gaqhf
|
row["colTemplate"] = comboBoxEditDefaultTemplate.SelectedItem;
|
535 |
d73c791c
|
gaqhf
|
if (!string.IsNullOrEmpty(buttonEditDefaultUnit.Text))
|
536 |
|
|
row["colUnit"] = buttonEditDefaultUnit.Text;
|
537 |
|
|
|
538 |
bca86986
|
gaqhf
|
_ConverterDT.Rows.Add(row);
|
539 |
442bd51e
|
gaqhf
|
|
540 |
|
|
if (document.Enable && document.Validation && document.MappingValidation)
|
541 |
|
|
gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
|
542 |
0d8062b2
|
gaqhf
|
}
|
543 |
f9cc5190
|
gaqhf
|
else
|
544 |
|
|
{
|
545 |
|
|
foreach (DataRow row in rows)
|
546 |
|
|
{
|
547 |
|
|
if (document.Enable)
|
548 |
|
|
row["colStatus"] = "Ready";
|
549 |
|
|
else
|
550 |
|
|
row["colStatus"] = "Error";
|
551 |
d73c791c
|
gaqhf
|
|
552 |
|
|
if (comboBoxEditDefaultTemplate.SelectedIndex > -1)
|
553 |
|
|
row["colTemplate"] = comboBoxEditDefaultTemplate.SelectedItem;
|
554 |
|
|
if (!string.IsNullOrEmpty(buttonEditDefaultUnit.Text))
|
555 |
|
|
row["colUnit"] = buttonEditDefaultUnit.Text;
|
556 |
442bd51e
|
gaqhf
|
|
557 |
|
|
if (document.Enable && document.Validation && document.MappingValidation)
|
558 |
|
|
gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
|
559 |
f9cc5190
|
gaqhf
|
}
|
560 |
|
|
}
|
561 |
0d8062b2
|
gaqhf
|
if (!_DicDocuments.ContainsKey(fileName))
|
562 |
|
|
_DicDocuments.Add(fileName, null);
|
563 |
|
|
|
564 |
68e9394a
|
gaqhf
|
if (!document.Validation || !document.MappingValidation)
|
565 |
0a111e7d
|
gaqhf
|
validationFailDocs.Add(document);
|
566 |
e613d0e8
|
gaqhf
|
|
567 |
0d8062b2
|
gaqhf
|
_DicDocuments[fileName] = document;
|
568 |
1278ba59
|
gaqhf
|
}
|
569 |
0a111e7d
|
gaqhf
|
if (validationFailDocs.Count > 0)
|
570 |
|
|
{
|
571 |
|
|
MessageForm messageForm = new MessageForm(validationFailDocs);
|
572 |
|
|
messageForm.ShowDialog();
|
573 |
|
|
}
|
574 |
1278ba59
|
gaqhf
|
}
|
575 |
65a1ed4b
|
gaqhf
|
}
|
576 |
17f2a3a7
|
gaqhf
|
|
577 |
5a9396ae
|
humkyung
|
/// <summary>
|
578 |
|
|
/// 선택한 도면의 정보를 로딩한다
|
579 |
|
|
/// </summary>
|
580 |
|
|
/// <param name="sender"></param>
|
581 |
|
|
/// <param name="e"></param>
|
582 |
1278ba59
|
gaqhf
|
private void btnRun_Click(object sender, EventArgs e)
|
583 |
|
|
{
|
584 |
d73c791c
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
585 |
|
|
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
586 |
|
|
if (!_ProjectInfo.Enable || !_SPPIDInfo.Enable)
|
587 |
|
|
{
|
588 |
|
|
MessageBox.Show(Msg.PleaseSetProjectInfo, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
589 |
|
|
return;
|
590 |
|
|
}
|
591 |
|
|
|
592 |
6924abc6
|
gaqhf
|
if (gridViewConverter.GetSelectedRows().Length == 0)
|
593 |
e0bb889b
|
gaqhf
|
{
|
594 |
|
|
MessageBox.Show(Msg.SelectDocument, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
595 |
6924abc6
|
gaqhf
|
return;
|
596 |
e0bb889b
|
gaqhf
|
}
|
597 |
154d8f43
|
gaqhf
|
DataTable tDrawing = Project_DB.SelectDrawings();
|
598 |
5a9396ae
|
humkyung
|
this._Documents.Clear();
|
599 |
17f2a3a7
|
gaqhf
|
foreach (int rowHandle in gridViewConverter.GetSelectedRows())
|
600 |
|
|
{
|
601 |
|
|
string _FilePath = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingFilePath");
|
602 |
|
|
string _Unit = gridViewConverter.GetRowCellDisplayText(rowHandle, "colUnit");
|
603 |
|
|
string _Template = gridViewConverter.GetRowCellDisplayText(rowHandle, "colTemplate");
|
604 |
|
|
string _DrawingNumber = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingNumber");
|
605 |
|
|
string _DrawingName = gridViewConverter.GetRowCellDisplayText(rowHandle, "colDrawingName");
|
606 |
154d8f43
|
gaqhf
|
|
607 |
|
|
DataRow[] rows = tDrawing.Select(string.Format("NAME = '{0}'", Path.GetFileNameWithoutExtension(_FilePath) + ".png"));
|
608 |
|
|
if (rows.Length != 1)
|
609 |
|
|
continue;
|
610 |
|
|
|
611 |
17f2a3a7
|
gaqhf
|
SPPID_Document document = _DicDocuments[_FilePath];
|
612 |
|
|
document.Unit = _Unit;
|
613 |
|
|
document.Template = _Template;
|
614 |
|
|
document.DrawingNumber = _DrawingNumber;
|
615 |
|
|
document.DrawingName = _DrawingName;
|
616 |
154d8f43
|
gaqhf
|
document.UID = rows[0]["UID"].ToString();
|
617 |
712860bb
|
gaqhf
|
|
618 |
4d2571ab
|
gaqhf
|
document.SymbolTable = _ID2SymbolTable;
|
619 |
712860bb
|
gaqhf
|
document.SymbolMappings = symbolMappings;
|
620 |
|
|
document.ChildSymbolMappings = childSymbolMappings;
|
621 |
|
|
document.LineMappings = lineMappings;
|
622 |
|
|
document.LineNumberMappings = lineNumberMappings;
|
623 |
|
|
document.AttributeMappings = attributeMappings;
|
624 |
|
|
document.ETCSetting = ETCSetting.GetInstance();
|
625 |
|
|
document.SetSPPIDInfo();
|
626 |
|
|
|
627 |
e3e2d41f
|
gaqhf
|
if (document.SetSPPIDMapping() && document.Enable)
|
628 |
5a9396ae
|
humkyung
|
this._Documents.Add(document);
|
629 |
17f2a3a7
|
gaqhf
|
}
|
630 |
5dfb8a24
|
gaqhf
|
|
631 |
154d8f43
|
gaqhf
|
if (_Documents.Count > 50)
|
632 |
|
|
checkEditCloseDocument.Checked = true;
|
633 |
|
|
|
634 |
|
|
tDrawing.Dispose();
|
635 |
d19ae675
|
gaqhf
|
DialogResult = DialogResult.OK;
|
636 |
96a2080c
|
gaqhf
|
}
|
637 |
23eb98bf
|
gaqhf
|
|
638 |
|
|
private void btnSPPIDDB_Click(object sender, EventArgs e)
|
639 |
|
|
{
|
640 |
|
|
SPPID_DB_SettingForm form = new SPPID_DB_SettingForm();
|
641 |
|
|
if (form.ShowDialog() == DialogResult.OK)
|
642 |
fab4f207
|
gaqhf
|
InitSPPIDDB();
|
643 |
23eb98bf
|
gaqhf
|
}
|
644 |
df4559fc
|
gaqhf
|
|
645 |
|
|
private void btnItemMapping_Click(object sender, EventArgs e)
|
646 |
|
|
{
|
647 |
ec0c7045
|
gaqhf
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
648 |
d73c791c
|
gaqhf
|
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
649 |
|
|
if (!_ProjectInfo.Enable || !_SPPIDInfo.Enable)
|
650 |
df4559fc
|
gaqhf
|
{
|
651 |
d73c791c
|
gaqhf
|
MessageBox.Show(Msg.PleaseSetProjectInfo, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
652 |
df4559fc
|
gaqhf
|
return;
|
653 |
|
|
}
|
654 |
|
|
|
655 |
306a0af9
|
gaqhf
|
MappingForm form = new MappingForm(_ID2SymbolDT,_SPPIDSymbolPathDT, _ID2LineDT, _ID2LinePropertyDT, _ID2AttributeDT, _SPPIDAttributeDT, _ID2DrawingAttributeDT);
|
656 |
df4559fc
|
gaqhf
|
form.ShowDialog();
|
657 |
bca86986
|
gaqhf
|
InitMapping();
|
658 |
df4559fc
|
gaqhf
|
}
|
659 |
4314b3f3
|
gaqhf
|
private List<int> prevSelectedList = new List<int>();
|
660 |
|
|
|
661 |
|
|
private void gridViewConverter_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
662 |
|
|
{
|
663 |
|
|
if (e.Action == CollectionChangeAction.Add)
|
664 |
|
|
{
|
665 |
|
|
string _Unit = gridViewConverter.GetRowCellDisplayText(e.ControllerRow, "colUnit");
|
666 |
|
|
string _Template = gridViewConverter.GetRowCellDisplayText(e.ControllerRow, "colTemplate");
|
667 |
|
|
|
668 |
|
|
if (string.IsNullOrEmpty(_Unit) || string.IsNullOrEmpty(_Template))
|
669 |
|
|
gridViewConverter.UnselectRow(e.ControllerRow);
|
670 |
|
|
}
|
671 |
|
|
else if (e.Action == CollectionChangeAction.Refresh)
|
672 |
|
|
{
|
673 |
|
|
foreach (int rowHandle in gridViewConverter.GetSelectedRows())
|
674 |
|
|
{
|
675 |
|
|
string _Unit = gridViewConverter.GetRowCellDisplayText(rowHandle, "colUnit");
|
676 |
|
|
string _Template = gridViewConverter.GetRowCellDisplayText(rowHandle, "colTemplate");
|
677 |
|
|
|
678 |
|
|
if (string.IsNullOrEmpty(_Unit) || string.IsNullOrEmpty(_Template))
|
679 |
|
|
gridViewConverter.UnselectRow(rowHandle);
|
680 |
|
|
}
|
681 |
|
|
|
682 |
|
|
List<int> selectedRowHandleList = gridViewConverter.GetSelectedRows().ToList();
|
683 |
|
|
var firstNotSecond = prevSelectedList.Except(selectedRowHandleList).ToList();
|
684 |
|
|
var secondNotFirst = selectedRowHandleList.Except(prevSelectedList).ToList();
|
685 |
635a8747
|
gaqhf
|
|
686 |
4314b3f3
|
gaqhf
|
if (!firstNotSecond.Any() && !secondNotFirst.Any())
|
687 |
|
|
{
|
688 |
|
|
this.gridViewConverter.SelectionChanged -= new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
|
689 |
|
|
gridViewConverter.ClearSelection();
|
690 |
|
|
this.gridViewConverter.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(this.gridViewConverter_SelectionChanged);
|
691 |
|
|
}
|
692 |
|
|
}
|
693 |
|
|
|
694 |
|
|
prevSelectedList = gridViewConverter.GetSelectedRows().ToList();
|
695 |
|
|
}
|
696 |
d73c791c
|
gaqhf
|
|
697 |
|
|
private void buttonEditDefaulUnit_ButtonClick(object sender, ButtonPressedEventArgs e)
|
698 |
|
|
{
|
699 |
|
|
UnitForm unitForm = new UnitForm(_SPPIDUnitDT);
|
700 |
|
|
if (unitForm.ShowDialog() == DialogResult.OK)
|
701 |
|
|
{
|
702 |
|
|
buttonEditDefaultUnit.Text = unitForm.SelectedUnit;
|
703 |
|
|
}
|
704 |
|
|
}
|
705 |
02a45794
|
gaqhf
|
|
706 |
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
707 |
|
|
{
|
708 |
|
|
List<BaseModel.Document> validationFailDocs = new List<BaseModel.Document>();
|
709 |
|
|
Project_Info _ProjectInfo = Project_Info.GetInstance();
|
710 |
|
|
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
711 |
|
|
if (!_ProjectInfo.Enable || !_SPPIDInfo.Enable)
|
712 |
|
|
{
|
713 |
|
|
MessageBox.Show(Msg.PleaseSetProjectInfo, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
714 |
|
|
return;
|
715 |
|
|
}
|
716 |
|
|
|
717 |
|
|
foreach (DataRow row in _ConverterDT.Rows)
|
718 |
|
|
{
|
719 |
|
|
string fileName = row["colDrawingFilePath"].ToString();
|
720 |
7e680366
|
gaqhf
|
SPPID_Document document = new SPPID_Document(fileName, _ID2SymbolTypeDT);
|
721 |
68e9394a
|
gaqhf
|
document.SymbolTable = _ID2SymbolTable;
|
722 |
|
|
document.SymbolMappings = symbolMappings;
|
723 |
|
|
document.ChildSymbolMappings = childSymbolMappings;
|
724 |
|
|
document.LineMappings = lineMappings;
|
725 |
|
|
document.LineNumberMappings = lineNumberMappings;
|
726 |
|
|
document.AttributeMappings = attributeMappings;
|
727 |
|
|
document.ETCSetting = ETCSetting.GetInstance();
|
728 |
|
|
document.SetSPPIDInfo();
|
729 |
|
|
|
730 |
|
|
|
731 |
|
|
if (!document.SetSPPIDMapping())
|
732 |
|
|
{
|
733 |
|
|
document.Enable = false;
|
734 |
|
|
document.MappingValidation = false;
|
735 |
|
|
}
|
736 |
|
|
|
737 |
02a45794
|
gaqhf
|
row["colDrawingNumber"] = document.DWGNAME;
|
738 |
|
|
row["colDrawingName"] = document.DWGNAME;
|
739 |
|
|
if (document.Enable)
|
740 |
|
|
row["colStatus"] = "Ready";
|
741 |
|
|
else
|
742 |
|
|
row["colStatus"] = "Error";
|
743 |
|
|
|
744 |
|
|
if (!_DicDocuments.ContainsKey(fileName))
|
745 |
|
|
_DicDocuments.Add(fileName, null);
|
746 |
|
|
|
747 |
68e9394a
|
gaqhf
|
if (!document.Validation || !document.MappingValidation)
|
748 |
02a45794
|
gaqhf
|
validationFailDocs.Add(document);
|
749 |
|
|
|
750 |
|
|
_DicDocuments[fileName] = document;
|
751 |
442bd51e
|
gaqhf
|
|
752 |
|
|
if (document.Enable && document.Validation && document.MappingValidation)
|
753 |
|
|
gridViewConverter.SelectRow(gridViewConverter.GetRowHandle(_ConverterDT.Rows.IndexOf(row)));
|
754 |
02a45794
|
gaqhf
|
}
|
755 |
|
|
|
756 |
|
|
|
757 |
|
|
if (validationFailDocs.Count > 0)
|
758 |
|
|
{
|
759 |
|
|
MessageForm messageForm = new MessageForm(validationFailDocs);
|
760 |
|
|
messageForm.ShowDialog();
|
761 |
|
|
}
|
762 |
|
|
}
|
763 |
12b7a2a8
|
gaqhf
|
|
764 |
|
|
private void buttonEditDefaultUnit_TextChanged(object sender, EventArgs e)
|
765 |
|
|
{
|
766 |
|
|
Settings.Default.DefaultUnit = buttonEditDefaultUnit.Text;
|
767 |
|
|
Settings.Default.Save();
|
768 |
|
|
}
|
769 |
|
|
|
770 |
|
|
private void comboBoxEditDefaultTemplate_SelectedIndexChanged(object sender, EventArgs e)
|
771 |
|
|
{
|
772 |
|
|
Settings.Default.DefaultTemplate = comboBoxEditDefaultTemplate.SelectedItem.ToString();
|
773 |
|
|
Settings.Default.Save();
|
774 |
|
|
}
|
775 |
8847ea67
|
gaqhf
|
|
776 |
|
|
|
777 |
96a2080c
|
gaqhf
|
}
|
778 |
|
|
} |