개정판 2e1e3c12
dev issue #000 : edit name
Change-Id: Ia01703ee65279b93c9b2e3ed628609350db819d8
DTI_PID/SPPIDConverter_AutoModeling/ConverterForm.cs | ||
---|---|---|
28 | 28 |
private RepositoryItemComboBox templateComboBox; |
29 | 29 |
|
30 | 30 |
ProjectInfo _ProjectInfo = ProjectInfo.GetInstance(); |
31 |
SPPIDInfo _SPPIDInfo = SPPIDInfo.GetInstance();
|
|
31 |
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
|
32 | 32 |
|
33 | 33 |
public ConverterForm() |
34 | 34 |
{ |
DTI_PID/SPPIDConverter_AutoModeling/DB/DB.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Data; |
|
7 |
using System.Globalization; |
|
8 |
using System.IO; |
|
9 |
using Oracle.ManagedDataAccess.Client; |
|
10 |
|
|
11 |
namespace Converter.SPPID.AutoModeling.DB |
|
12 |
{ |
|
13 |
public class DB |
|
14 |
{ |
|
15 |
private const string oConnString = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST ={0}" + @")(PORT = {1}))(CONNECT_DATA = (SERVICE_NAME = {2})))"; |
|
16 |
|
|
17 |
public static bool CheckAndSetSPPIDInfo() |
|
18 |
{ |
|
19 |
bool bResult = false; |
|
20 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
21 |
try |
|
22 |
{ |
|
23 |
if (dbInfo.DBType == "ORACLE") |
|
24 |
{ |
|
25 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
26 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
27 |
|
|
28 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
29 |
{ |
|
30 |
conn.Open(); |
|
31 |
if (conn.State == System.Data.ConnectionState.Open) |
|
32 |
{ |
|
33 |
using (OracleCommand cmd = new OracleCommand()) |
|
34 |
{ |
|
35 |
cmd.Connection = conn; |
|
36 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT NAME, PATH FROM {0}.T_ROOTITEM", dbInfo.Site); |
|
37 |
|
|
38 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
39 |
{ |
|
40 |
while (reader.Read()) |
|
41 |
{ |
|
42 |
dbInfo.Plant = reader["NAME"].ToString(); |
|
43 |
dbInfo.PlantPath = reader["PATH"].ToString(); |
|
44 |
} |
|
45 |
|
|
46 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, @"SELECT SP_SCHEMA_TYPE, USERNAME |
|
47 |
FROM {0}.T_DB_DATA DB_DATA |
|
48 |
INNER JOIN {0}.T_ROOTITEM ROOTITEM ON DB_DATA.SP_ROOTITEMID = ROOTITEM.SP_ID |
|
49 |
WHERE ROOTITEM.NAME = '{1}'", dbInfo.Site, dbInfo.Plant); |
|
50 |
|
|
51 |
|
|
52 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
53 |
{ |
|
54 |
DataTable dt = new DataTable(); |
|
55 |
adapter.SelectCommand = cmd; |
|
56 |
adapter.Fill(dt); |
|
57 |
|
|
58 |
foreach (DataRow row in dt.Rows) |
|
59 |
{ |
|
60 |
string sType = row["SP_SCHEMA_TYPE"].ToString(); |
|
61 |
switch (sType) |
|
62 |
{ |
|
63 |
case "SPPIDDATA_DICTIONARY": |
|
64 |
dbInfo.PlantPIDDic = row["USERNAME"].ToString(); |
|
65 |
break; |
|
66 |
case "DATA_DICTIONARY": |
|
67 |
dbInfo.PlantDic = row["USERNAME"].ToString(); |
|
68 |
break; |
|
69 |
case "SPAPLANT": |
|
70 |
dbInfo.Plant = row["USERNAME"].ToString(); |
|
71 |
break; |
|
72 |
case "SPPID": |
|
73 |
dbInfo.PlantPID = row["USERNAME"].ToString(); |
|
74 |
break; |
|
75 |
default: |
|
76 |
break; |
|
77 |
} |
|
78 |
} |
|
79 |
bResult = true; |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
} |
|
85 |
} |
|
86 |
else |
|
87 |
{ |
|
88 |
|
|
89 |
} |
|
90 |
} |
|
91 |
catch (Exception ex) |
|
92 |
{ |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
return bResult; |
|
97 |
} |
|
98 |
|
|
99 |
public static bool SetPlantDBSetting() |
|
100 |
{ |
|
101 |
bool bResult = false; |
|
102 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
103 |
try |
|
104 |
{ |
|
105 |
if (dbInfo.DBType == "ORACLE") |
|
106 |
{ |
|
107 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
108 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
109 |
|
|
110 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
111 |
{ |
|
112 |
conn.Open(); |
|
113 |
if (conn.State == System.Data.ConnectionState.Open) |
|
114 |
{ |
|
115 |
using (OracleCommand cmd = new OracleCommand()) |
|
116 |
{ |
|
117 |
cmd.Connection = conn; |
|
118 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, @"SELECT SP_SCHEMA_TYPE, USERNAME |
|
119 |
FROM {0}.T_DB_DATA DB_DATA |
|
120 |
INNER JOIN {0}.T_ROOTITEM ROOTITEM ON DB_DATA.SP_ROOTITEMID = ROOTITEM.SP_ID |
|
121 |
WHERE ROOTITEM.NAME = '{1}'", dbInfo.Site, dbInfo.SelectedPlant); |
|
122 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
123 |
{ |
|
124 |
DataTable dt = new DataTable(); |
|
125 |
adapter.SelectCommand = cmd; |
|
126 |
adapter.Fill(dt); |
|
127 |
|
|
128 |
foreach (DataRow row in dt.Rows) |
|
129 |
{ |
|
130 |
string sType = row["SP_SCHEMA_TYPE"].ToString(); |
|
131 |
switch (sType) |
|
132 |
{ |
|
133 |
case "SPPIDDATA_DICTIONARY": |
|
134 |
dbInfo.PlantPIDDic = row["USERNAME"].ToString(); |
|
135 |
break; |
|
136 |
case "DATA_DICTIONARY": |
|
137 |
dbInfo.PlantDic = row["USERNAME"].ToString(); |
|
138 |
break; |
|
139 |
case "SPAPLANT": |
|
140 |
dbInfo.Plant = row["USERNAME"].ToString(); |
|
141 |
break; |
|
142 |
case "SPPID": |
|
143 |
dbInfo.PlantPID = row["USERNAME"].ToString(); |
|
144 |
break; |
|
145 |
default: |
|
146 |
break; |
|
147 |
} |
|
148 |
bResult = true; |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
|
|
158 |
} |
|
159 |
} |
|
160 |
catch (Exception ex) |
|
161 |
{ |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
return bResult; |
|
166 |
} |
|
167 |
|
|
168 |
public static List<string> GetPlantList() |
|
169 |
{ |
|
170 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
171 |
List<string> plantList = new List<string>(); |
|
172 |
try |
|
173 |
{ |
|
174 |
if (dbInfo.DBType == "ORACLE") |
|
175 |
{ |
|
176 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
177 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
178 |
|
|
179 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
180 |
{ |
|
181 |
conn.Open(); |
|
182 |
if (conn.State == System.Data.ConnectionState.Open) |
|
183 |
{ |
|
184 |
using (OracleCommand cmd = new OracleCommand()) |
|
185 |
{ |
|
186 |
cmd.Connection = conn; |
|
187 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT NAME, PATH FROM {0}.T_ROOTITEM", dbInfo.Site); |
|
188 |
|
|
189 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
190 |
{ |
|
191 |
while (reader.Read()) |
|
192 |
{ |
|
193 |
plantList.Add(reader["NAME"].ToString()); |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
} |
|
200 |
else |
|
201 |
{ |
|
202 |
|
|
203 |
} |
|
204 |
} |
|
205 |
catch (Exception ex) |
|
206 |
{ |
|
207 |
|
|
208 |
} |
|
209 |
|
|
210 |
return plantList; |
|
211 |
} |
|
212 |
|
|
213 |
public static DataTable GetUnitTree() |
|
214 |
{ |
|
215 |
DataTable dt = new DataTable(); |
|
216 |
try |
|
217 |
{ |
|
218 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
219 |
|
|
220 |
if (dbInfo.DBType == "ORACLE") |
|
221 |
{ |
|
222 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
223 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
224 |
|
|
225 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
226 |
{ |
|
227 |
conn.Open(); |
|
228 |
if (conn.State == System.Data.ConnectionState.Open) |
|
229 |
{ |
|
230 |
string sQuery = string.Format(CultureInfo.CurrentCulture, |
|
231 |
@"SELECT SP_ID, PARENTID, NAME |
|
232 |
FROM {0}.T_PLANTGROUP |
|
233 |
START WITH PARENTID='-1' |
|
234 |
CONNECT BY PRIOR SP_ID=PARENTID", dbInfo.Plant); |
|
235 |
|
|
236 |
using (OracleCommand cmd = new OracleCommand(sQuery, conn)) |
|
237 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
238 |
{ |
|
239 |
adapter.SelectCommand = cmd; |
|
240 |
adapter.Fill(dt); |
|
241 |
} |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
else |
|
246 |
{ |
|
247 |
|
|
248 |
} |
|
249 |
} |
|
250 |
catch (Exception ex) |
|
251 |
{ |
|
252 |
|
|
253 |
} |
|
254 |
|
|
255 |
return dt; |
|
256 |
} |
|
257 |
|
|
258 |
public static string GetPlantPID_T_OPTIONSETTING_Value(string name) |
|
259 |
{ |
|
260 |
string TemplatePath = string.Empty; |
|
261 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
262 |
try |
|
263 |
{ |
|
264 |
if (dbInfo.DBType == "ORACLE") |
|
265 |
{ |
|
266 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
267 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
268 |
|
|
269 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
270 |
{ |
|
271 |
conn.Open(); |
|
272 |
if (conn.State == System.Data.ConnectionState.Open) |
|
273 |
{ |
|
274 |
using (OracleCommand cmd = new OracleCommand()) |
|
275 |
{ |
|
276 |
cmd.Connection = conn; |
|
277 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT VALUE FROM {0}.T_OPTIONSETTING WHERE NAME = '{1}'", dbInfo.PlantPID, name); |
|
278 |
|
|
279 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
280 |
{ |
|
281 |
while (reader.Read()) |
|
282 |
{ |
|
283 |
TemplatePath = reader["VALUE"].ToString(); |
|
284 |
break; |
|
285 |
} |
|
286 |
} |
|
287 |
} |
|
288 |
} |
|
289 |
} |
|
290 |
} |
|
291 |
else |
|
292 |
{ |
|
293 |
|
|
294 |
} |
|
295 |
|
|
296 |
} |
|
297 |
catch (Exception ex) |
|
298 |
{ |
|
299 |
|
|
300 |
} |
|
301 |
|
|
302 |
return TemplatePath; |
|
303 |
} |
|
304 |
|
|
305 |
public static List<string> GetSPPIDAttribute() |
|
306 |
{ |
|
307 |
List<string> attributes = new List<string>(); |
|
308 |
SPPIDInfo dbInfo = SPPIDInfo.GetInstance(); |
|
309 |
try |
|
310 |
{ |
|
311 |
if (dbInfo.DBType == "ORACLE") |
|
312 |
{ |
|
313 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
314 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
315 |
|
|
316 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
317 |
{ |
|
318 |
conn.Open(); |
|
319 |
if (conn.State == System.Data.ConnectionState.Open) |
|
320 |
{ |
|
321 |
using (OracleCommand cmd = new OracleCommand()) |
|
322 |
{ |
|
323 |
cmd.Connection = conn; |
|
324 |
|
|
325 |
// 정리 필요 |
|
326 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPMENT"); |
|
327 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
328 |
{ |
|
329 |
DataTable dt = reader.GetSchemaTable(); |
|
330 |
foreach (DataRow row in dt.Rows) |
|
331 |
attributes.Add(row["ColumnName"].ToString()); |
|
332 |
} |
|
333 |
|
|
334 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_NOZZLE"); |
|
335 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
336 |
{ |
|
337 |
DataTable dt = reader.GetSchemaTable(); |
|
338 |
foreach (DataRow row in dt.Rows) |
|
339 |
attributes.Add(row["ColumnName"].ToString()); |
|
340 |
} |
|
341 |
|
|
342 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPINGCOMP"); |
|
343 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
344 |
{ |
|
345 |
DataTable dt = reader.GetSchemaTable(); |
|
346 |
foreach (DataRow row in dt.Rows) |
|
347 |
attributes.Add(row["ColumnName"].ToString()); |
|
348 |
} |
|
349 |
|
|
350 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPERUN"); |
|
351 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
352 |
{ |
|
353 |
|
|
354 |
DataTable dt = reader.GetSchemaTable(); |
|
355 |
foreach (DataRow row in dt.Rows) |
|
356 |
attributes.Add(row["ColumnName"].ToString()); |
|
357 |
} |
|
358 |
|
|
359 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INSTRUMENT"); |
|
360 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
361 |
{ |
|
362 |
DataTable dt = reader.GetSchemaTable(); |
|
363 |
foreach (DataRow row in dt.Rows) |
|
364 |
attributes.Add(row["ColumnName"].ToString()); |
|
365 |
} |
|
366 |
|
|
367 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INLINECOMP"); |
|
368 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
369 |
{ |
|
370 |
DataTable dt = reader.GetSchemaTable(); |
|
371 |
foreach (DataRow row in dt.Rows) |
|
372 |
attributes.Add(row["ColumnName"].ToString()); |
|
373 |
} |
|
374 |
|
|
375 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_VESSEL"); |
|
376 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
377 |
{ |
|
378 |
DataTable dt = reader.GetSchemaTable(); |
|
379 |
foreach (DataRow row in dt.Rows) |
|
380 |
attributes.Add(row["ColumnName"].ToString()); |
|
381 |
} |
|
382 |
|
|
383 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EXCHANGER"); |
|
384 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
385 |
{ |
|
386 |
DataTable dt = reader.GetSchemaTable(); |
|
387 |
foreach (DataRow row in dt.Rows) |
|
388 |
attributes.Add(row["ColumnName"].ToString()); |
|
389 |
} |
|
390 |
|
|
391 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_MECHANICAL"); |
|
392 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
393 |
{ |
|
394 |
DataTable dt = reader.GetSchemaTable(); |
|
395 |
foreach (DataRow row in dt.Rows) |
|
396 |
attributes.Add(row["ColumnName"].ToString()); |
|
397 |
} |
|
398 |
|
|
399 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPCOMPONENT"); |
|
400 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
401 |
{ |
|
402 |
DataTable dt = reader.GetSchemaTable(); |
|
403 |
foreach (DataRow row in dt.Rows) |
|
404 |
attributes.Add(row["ColumnName"].ToString()); |
|
405 |
} |
|
406 |
|
|
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |
else |
|
412 |
{ |
|
413 |
|
|
414 |
} |
|
415 |
} |
|
416 |
catch (Exception ex) |
|
417 |
{ |
|
418 |
|
|
419 |
} |
|
420 |
|
|
421 |
|
|
422 |
|
|
423 |
return attributes.Distinct().ToList(); |
|
424 |
} |
|
425 |
} |
|
426 |
} |
DTI_PID/SPPIDConverter_AutoModeling/DB/SPPIDInfo.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace Converter.SPPID.AutoModeling.DB |
|
8 |
{ |
|
9 |
public class SPPIDInfo |
|
10 |
{ |
|
11 |
private static SPPIDInfo sPPIDInfo; |
|
12 |
|
|
13 |
private string _DBType = string.Empty; |
|
14 |
private string _Service = string.Empty; |
|
15 |
private string _Site = string.Empty; |
|
16 |
private string _ServerIP = string.Empty; |
|
17 |
private string _Port = string.Empty; |
|
18 |
private string _DBUser = string.Empty; |
|
19 |
private string _DBPassword = string.Empty; |
|
20 |
|
|
21 |
private List<string> _PlantList = new List<string>(); |
|
22 |
private string _SelectedPlant = string.Empty; |
|
23 |
|
|
24 |
private string _PlantPath = string.Empty; |
|
25 |
private string _Plant = string.Empty; |
|
26 |
private string _PlantDic = string.Empty; |
|
27 |
private string _PlantPID = string.Empty; |
|
28 |
private string _PlantPIDDic = string.Empty; |
|
29 |
|
|
30 |
private bool _Enable = false; |
|
31 |
|
|
32 |
public string DBType { get => _DBType; set => _DBType = value; } |
|
33 |
public string Service { get => _Service; set => _Service = value; } |
|
34 |
public string Site { get => _Site; set => _Site = value; } |
|
35 |
public string ServerIP { get => _ServerIP; set => _ServerIP = value; } |
|
36 |
public string Port { get => _Port; set => _Port = value; } |
|
37 |
public string DBUser { get => _DBUser; set => _DBUser = value; } |
|
38 |
public string DBPassword { get => _DBPassword; set => _DBPassword = value; } |
|
39 |
public List<string> PlantList { get => _PlantList; set => _PlantList = value; } |
|
40 |
public string SelectedPlant { get => _SelectedPlant; set => _SelectedPlant = value; } |
|
41 |
public string PlantPath { get => _PlantPath; set => _PlantPath = value; } |
|
42 |
public string Plant { get => _Plant; set => _Plant = value; } |
|
43 |
public string PlantDic { get => _PlantDic; set => _PlantDic = value; } |
|
44 |
public string PlantPID { get => _PlantPID; set => _PlantPID = value; } |
|
45 |
public string PlantPIDDic { get => _PlantPIDDic; set => _PlantPIDDic = value; } |
|
46 |
public bool Enable { get => _Enable; set => _Enable = value; } |
|
47 |
|
|
48 |
public static SPPIDInfo GetInstance() |
|
49 |
{ |
|
50 |
if (sPPIDInfo == null) |
|
51 |
sPPIDInfo = new SPPIDInfo(); |
|
52 |
|
|
53 |
return sPPIDInfo; |
|
54 |
} |
|
55 |
} |
|
56 |
} |
DTI_PID/SPPIDConverter_AutoModeling/DB/SPPID_DB.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Data; |
|
7 |
using System.Globalization; |
|
8 |
using System.IO; |
|
9 |
using Oracle.ManagedDataAccess.Client; |
|
10 |
|
|
11 |
namespace Converter.SPPID.AutoModeling.DB |
|
12 |
{ |
|
13 |
public class SPPID_DB |
|
14 |
{ |
|
15 |
private const string oConnString = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST ={0}" + @")(PORT = {1}))(CONNECT_DATA = (SERVICE_NAME = {2})))"; |
|
16 |
|
|
17 |
public static bool CheckAndSetSPPIDInfo() |
|
18 |
{ |
|
19 |
bool bResult = false; |
|
20 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
21 |
try |
|
22 |
{ |
|
23 |
if (dbInfo.DBType == "ORACLE") |
|
24 |
{ |
|
25 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
26 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
27 |
|
|
28 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
29 |
{ |
|
30 |
conn.Open(); |
|
31 |
if (conn.State == System.Data.ConnectionState.Open) |
|
32 |
{ |
|
33 |
using (OracleCommand cmd = new OracleCommand()) |
|
34 |
{ |
|
35 |
cmd.Connection = conn; |
|
36 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT NAME, PATH FROM {0}.T_ROOTITEM", dbInfo.Site); |
|
37 |
|
|
38 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
39 |
{ |
|
40 |
while (reader.Read()) |
|
41 |
{ |
|
42 |
dbInfo.Plant = reader["NAME"].ToString(); |
|
43 |
dbInfo.PlantPath = reader["PATH"].ToString(); |
|
44 |
} |
|
45 |
|
|
46 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, @"SELECT SP_SCHEMA_TYPE, USERNAME |
|
47 |
FROM {0}.T_DB_DATA DB_DATA |
|
48 |
INNER JOIN {0}.T_ROOTITEM ROOTITEM ON DB_DATA.SP_ROOTITEMID = ROOTITEM.SP_ID |
|
49 |
WHERE ROOTITEM.NAME = '{1}'", dbInfo.Site, dbInfo.Plant); |
|
50 |
|
|
51 |
|
|
52 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
53 |
{ |
|
54 |
DataTable dt = new DataTable(); |
|
55 |
adapter.SelectCommand = cmd; |
|
56 |
adapter.Fill(dt); |
|
57 |
|
|
58 |
foreach (DataRow row in dt.Rows) |
|
59 |
{ |
|
60 |
string sType = row["SP_SCHEMA_TYPE"].ToString(); |
|
61 |
switch (sType) |
|
62 |
{ |
|
63 |
case "SPPIDDATA_DICTIONARY": |
|
64 |
dbInfo.PlantPIDDic = row["USERNAME"].ToString(); |
|
65 |
break; |
|
66 |
case "DATA_DICTIONARY": |
|
67 |
dbInfo.PlantDic = row["USERNAME"].ToString(); |
|
68 |
break; |
|
69 |
case "SPAPLANT": |
|
70 |
dbInfo.Plant = row["USERNAME"].ToString(); |
|
71 |
break; |
|
72 |
case "SPPID": |
|
73 |
dbInfo.PlantPID = row["USERNAME"].ToString(); |
|
74 |
break; |
|
75 |
default: |
|
76 |
break; |
|
77 |
} |
|
78 |
} |
|
79 |
bResult = true; |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
} |
|
85 |
} |
|
86 |
else |
|
87 |
{ |
|
88 |
|
|
89 |
} |
|
90 |
} |
|
91 |
catch (Exception ex) |
|
92 |
{ |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
return bResult; |
|
97 |
} |
|
98 |
|
|
99 |
public static bool SetPlantDBSetting() |
|
100 |
{ |
|
101 |
bool bResult = false; |
|
102 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
103 |
try |
|
104 |
{ |
|
105 |
if (dbInfo.DBType == "ORACLE") |
|
106 |
{ |
|
107 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
108 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
109 |
|
|
110 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
111 |
{ |
|
112 |
conn.Open(); |
|
113 |
if (conn.State == System.Data.ConnectionState.Open) |
|
114 |
{ |
|
115 |
using (OracleCommand cmd = new OracleCommand()) |
|
116 |
{ |
|
117 |
cmd.Connection = conn; |
|
118 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, @"SELECT SP_SCHEMA_TYPE, USERNAME |
|
119 |
FROM {0}.T_DB_DATA DB_DATA |
|
120 |
INNER JOIN {0}.T_ROOTITEM ROOTITEM ON DB_DATA.SP_ROOTITEMID = ROOTITEM.SP_ID |
|
121 |
WHERE ROOTITEM.NAME = '{1}'", dbInfo.Site, dbInfo.SelectedPlant); |
|
122 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
123 |
{ |
|
124 |
DataTable dt = new DataTable(); |
|
125 |
adapter.SelectCommand = cmd; |
|
126 |
adapter.Fill(dt); |
|
127 |
|
|
128 |
foreach (DataRow row in dt.Rows) |
|
129 |
{ |
|
130 |
string sType = row["SP_SCHEMA_TYPE"].ToString(); |
|
131 |
switch (sType) |
|
132 |
{ |
|
133 |
case "SPPIDDATA_DICTIONARY": |
|
134 |
dbInfo.PlantPIDDic = row["USERNAME"].ToString(); |
|
135 |
break; |
|
136 |
case "DATA_DICTIONARY": |
|
137 |
dbInfo.PlantDic = row["USERNAME"].ToString(); |
|
138 |
break; |
|
139 |
case "SPAPLANT": |
|
140 |
dbInfo.Plant = row["USERNAME"].ToString(); |
|
141 |
break; |
|
142 |
case "SPPID": |
|
143 |
dbInfo.PlantPID = row["USERNAME"].ToString(); |
|
144 |
break; |
|
145 |
default: |
|
146 |
break; |
|
147 |
} |
|
148 |
bResult = true; |
|
149 |
} |
|
150 |
} |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
|
|
158 |
} |
|
159 |
} |
|
160 |
catch (Exception ex) |
|
161 |
{ |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
return bResult; |
|
166 |
} |
|
167 |
|
|
168 |
public static List<string> GetPlantList() |
|
169 |
{ |
|
170 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
171 |
List<string> plantList = new List<string>(); |
|
172 |
try |
|
173 |
{ |
|
174 |
if (dbInfo.DBType == "ORACLE") |
|
175 |
{ |
|
176 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
177 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
178 |
|
|
179 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
180 |
{ |
|
181 |
conn.Open(); |
|
182 |
if (conn.State == System.Data.ConnectionState.Open) |
|
183 |
{ |
|
184 |
using (OracleCommand cmd = new OracleCommand()) |
|
185 |
{ |
|
186 |
cmd.Connection = conn; |
|
187 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT NAME, PATH FROM {0}.T_ROOTITEM", dbInfo.Site); |
|
188 |
|
|
189 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
190 |
{ |
|
191 |
while (reader.Read()) |
|
192 |
{ |
|
193 |
plantList.Add(reader["NAME"].ToString()); |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
} |
|
200 |
else |
|
201 |
{ |
|
202 |
|
|
203 |
} |
|
204 |
} |
|
205 |
catch (Exception ex) |
|
206 |
{ |
|
207 |
|
|
208 |
} |
|
209 |
|
|
210 |
return plantList; |
|
211 |
} |
|
212 |
|
|
213 |
public static DataTable GetUnitTree() |
|
214 |
{ |
|
215 |
DataTable dt = new DataTable(); |
|
216 |
try |
|
217 |
{ |
|
218 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
219 |
|
|
220 |
if (dbInfo.DBType == "ORACLE") |
|
221 |
{ |
|
222 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
223 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
224 |
|
|
225 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
226 |
{ |
|
227 |
conn.Open(); |
|
228 |
if (conn.State == System.Data.ConnectionState.Open) |
|
229 |
{ |
|
230 |
string sQuery = string.Format(CultureInfo.CurrentCulture, |
|
231 |
@"SELECT SP_ID, PARENTID, NAME |
|
232 |
FROM {0}.T_PLANTGROUP |
|
233 |
START WITH PARENTID='-1' |
|
234 |
CONNECT BY PRIOR SP_ID=PARENTID", dbInfo.Plant); |
|
235 |
|
|
236 |
using (OracleCommand cmd = new OracleCommand(sQuery, conn)) |
|
237 |
using (OracleDataAdapter adapter = new OracleDataAdapter()) |
|
238 |
{ |
|
239 |
adapter.SelectCommand = cmd; |
|
240 |
adapter.Fill(dt); |
|
241 |
} |
|
242 |
} |
|
243 |
} |
|
244 |
} |
|
245 |
else |
|
246 |
{ |
|
247 |
|
|
248 |
} |
|
249 |
} |
|
250 |
catch (Exception ex) |
|
251 |
{ |
|
252 |
|
|
253 |
} |
|
254 |
|
|
255 |
return dt; |
|
256 |
} |
|
257 |
|
|
258 |
public static string GetPlantPID_T_OPTIONSETTING_Value(string name) |
|
259 |
{ |
|
260 |
string TemplatePath = string.Empty; |
|
261 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
262 |
try |
|
263 |
{ |
|
264 |
if (dbInfo.DBType == "ORACLE") |
|
265 |
{ |
|
266 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
267 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
268 |
|
|
269 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
270 |
{ |
|
271 |
conn.Open(); |
|
272 |
if (conn.State == System.Data.ConnectionState.Open) |
|
273 |
{ |
|
274 |
using (OracleCommand cmd = new OracleCommand()) |
|
275 |
{ |
|
276 |
cmd.Connection = conn; |
|
277 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT VALUE FROM {0}.T_OPTIONSETTING WHERE NAME = '{1}'", dbInfo.PlantPID, name); |
|
278 |
|
|
279 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
280 |
{ |
|
281 |
while (reader.Read()) |
|
282 |
{ |
|
283 |
TemplatePath = reader["VALUE"].ToString(); |
|
284 |
break; |
|
285 |
} |
|
286 |
} |
|
287 |
} |
|
288 |
} |
|
289 |
} |
|
290 |
} |
|
291 |
else |
|
292 |
{ |
|
293 |
|
|
294 |
} |
|
295 |
|
|
296 |
} |
|
297 |
catch (Exception ex) |
|
298 |
{ |
|
299 |
|
|
300 |
} |
|
301 |
|
|
302 |
return TemplatePath; |
|
303 |
} |
|
304 |
|
|
305 |
public static List<string> GetSPPIDAttribute() |
|
306 |
{ |
|
307 |
List<string> attributes = new List<string>(); |
|
308 |
SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance(); |
|
309 |
try |
|
310 |
{ |
|
311 |
if (dbInfo.DBType == "ORACLE") |
|
312 |
{ |
|
313 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
314 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
315 |
|
|
316 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
317 |
{ |
|
318 |
conn.Open(); |
|
319 |
if (conn.State == System.Data.ConnectionState.Open) |
|
320 |
{ |
|
321 |
using (OracleCommand cmd = new OracleCommand()) |
|
322 |
{ |
|
323 |
cmd.Connection = conn; |
|
324 |
|
|
325 |
// 정리 필요 |
|
326 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPMENT"); |
|
327 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
328 |
{ |
|
329 |
DataTable dt = reader.GetSchemaTable(); |
|
330 |
foreach (DataRow row in dt.Rows) |
|
331 |
attributes.Add(row["ColumnName"].ToString()); |
|
332 |
} |
|
333 |
|
|
334 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_NOZZLE"); |
|
335 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
336 |
{ |
|
337 |
DataTable dt = reader.GetSchemaTable(); |
|
338 |
foreach (DataRow row in dt.Rows) |
|
339 |
attributes.Add(row["ColumnName"].ToString()); |
|
340 |
} |
|
341 |
|
|
342 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPINGCOMP"); |
|
343 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
344 |
{ |
|
345 |
DataTable dt = reader.GetSchemaTable(); |
|
346 |
foreach (DataRow row in dt.Rows) |
|
347 |
attributes.Add(row["ColumnName"].ToString()); |
|
348 |
} |
|
349 |
|
|
350 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_PIPERUN"); |
|
351 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
352 |
{ |
|
353 |
|
|
354 |
DataTable dt = reader.GetSchemaTable(); |
|
355 |
foreach (DataRow row in dt.Rows) |
|
356 |
attributes.Add(row["ColumnName"].ToString()); |
|
357 |
} |
|
358 |
|
|
359 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INSTRUMENT"); |
|
360 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
361 |
{ |
|
362 |
DataTable dt = reader.GetSchemaTable(); |
|
363 |
foreach (DataRow row in dt.Rows) |
|
364 |
attributes.Add(row["ColumnName"].ToString()); |
|
365 |
} |
|
366 |
|
|
367 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_INLINECOMP"); |
|
368 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
369 |
{ |
|
370 |
DataTable dt = reader.GetSchemaTable(); |
|
371 |
foreach (DataRow row in dt.Rows) |
|
372 |
attributes.Add(row["ColumnName"].ToString()); |
|
373 |
} |
|
374 |
|
|
375 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_VESSEL"); |
|
376 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
377 |
{ |
|
378 |
DataTable dt = reader.GetSchemaTable(); |
|
379 |
foreach (DataRow row in dt.Rows) |
|
380 |
attributes.Add(row["ColumnName"].ToString()); |
|
381 |
} |
|
382 |
|
|
383 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EXCHANGER"); |
|
384 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
385 |
{ |
|
386 |
DataTable dt = reader.GetSchemaTable(); |
|
387 |
foreach (DataRow row in dt.Rows) |
|
388 |
attributes.Add(row["ColumnName"].ToString()); |
|
389 |
} |
|
390 |
|
|
391 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_MECHANICAL"); |
|
392 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
393 |
{ |
|
394 |
DataTable dt = reader.GetSchemaTable(); |
|
395 |
foreach (DataRow row in dt.Rows) |
|
396 |
attributes.Add(row["ColumnName"].ToString()); |
|
397 |
} |
|
398 |
|
|
399 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT * FROM {0}.{1}", dbInfo.PlantPID, "T_EQUIPCOMPONENT"); |
|
400 |
using (OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)) |
|
401 |
{ |
|
402 |
DataTable dt = reader.GetSchemaTable(); |
|
403 |
foreach (DataRow row in dt.Rows) |
|
404 |
attributes.Add(row["ColumnName"].ToString()); |
|
405 |
} |
|
406 |
|
|
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |
else |
|
412 |
{ |
|
413 |
|
|
414 |
} |
|
415 |
} |
|
416 |
catch (Exception ex) |
|
417 |
{ |
|
418 |
|
|
419 |
} |
|
420 |
|
|
421 |
|
|
422 |
|
|
423 |
return attributes.Distinct().ToList(); |
|
424 |
} |
|
425 |
} |
|
426 |
} |
DTI_PID/SPPIDConverter_AutoModeling/DB/SPPID_DBInfo.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace Converter.SPPID.AutoModeling.DB |
|
8 |
{ |
|
9 |
public class SPPID_DBInfo |
|
10 |
{ |
|
11 |
private static SPPID_DBInfo sPPIDInfo; |
|
12 |
|
|
13 |
private string _DBType = string.Empty; |
|
14 |
private string _Service = string.Empty; |
|
15 |
private string _Site = string.Empty; |
|
16 |
private string _ServerIP = string.Empty; |
|
17 |
private string _Port = string.Empty; |
|
18 |
private string _DBUser = string.Empty; |
|
19 |
private string _DBPassword = string.Empty; |
|
20 |
|
|
21 |
private List<string> _PlantList = new List<string>(); |
|
22 |
private string _SelectedPlant = string.Empty; |
|
23 |
|
|
24 |
private string _PlantPath = string.Empty; |
|
25 |
private string _Plant = string.Empty; |
|
26 |
private string _PlantDic = string.Empty; |
|
27 |
private string _PlantPID = string.Empty; |
|
28 |
private string _PlantPIDDic = string.Empty; |
|
29 |
|
|
30 |
private bool _Enable = false; |
|
31 |
|
|
32 |
public string DBType { get => _DBType; set => _DBType = value; } |
|
33 |
public string Service { get => _Service; set => _Service = value; } |
|
34 |
public string Site { get => _Site; set => _Site = value; } |
|
35 |
public string ServerIP { get => _ServerIP; set => _ServerIP = value; } |
|
36 |
public string Port { get => _Port; set => _Port = value; } |
|
37 |
public string DBUser { get => _DBUser; set => _DBUser = value; } |
|
38 |
public string DBPassword { get => _DBPassword; set => _DBPassword = value; } |
|
39 |
public List<string> PlantList { get => _PlantList; set => _PlantList = value; } |
|
40 |
public string SelectedPlant { get => _SelectedPlant; set => _SelectedPlant = value; } |
|
41 |
public string PlantPath { get => _PlantPath; set => _PlantPath = value; } |
|
42 |
public string Plant { get => _Plant; set => _Plant = value; } |
|
43 |
public string PlantDic { get => _PlantDic; set => _PlantDic = value; } |
|
44 |
public string PlantPID { get => _PlantPID; set => _PlantPID = value; } |
|
45 |
public string PlantPIDDic { get => _PlantPIDDic; set => _PlantPIDDic = value; } |
|
46 |
public bool Enable { get => _Enable; set => _Enable = value; } |
|
47 |
|
|
48 |
public static SPPID_DBInfo GetInstance() |
|
49 |
{ |
|
50 |
if (sPPIDInfo == null) |
|
51 |
sPPIDInfo = new SPPID_DBInfo(); |
|
52 |
|
|
53 |
return sPPIDInfo; |
|
54 |
} |
|
55 |
} |
|
56 |
} |
DTI_PID/SPPIDConverter_AutoModeling/Form/SPPID_DB_SettingForm.cs | ||
---|---|---|
18 | 18 |
{ |
19 | 19 |
public partial class SPPID_DB_SettingForm : DevExpress.XtraBars.Ribbon.RibbonForm |
20 | 20 |
{ |
21 |
SPPIDInfo info = SPPIDInfo.GetInstance();
|
|
21 |
SPPID_DBInfo info = SPPID_DBInfo.GetInstance();
|
|
22 | 22 |
|
23 | 23 |
public SPPID_DB_SettingForm() |
24 | 24 |
{ |
... | ... | |
109 | 109 |
if (SetPlantList() && info.PlantList.Contains(comboPlant.SelectedItem.ToString())) |
110 | 110 |
{ |
111 | 111 |
info.SelectedPlant = comboPlant.SelectedItem.ToString(); |
112 |
if (DB.DB.SetPlantDBSetting())
|
|
112 |
if (SPPID_DB.SetPlantDBSetting())
|
|
113 | 113 |
{ |
114 | 114 |
info.Enable = true; |
115 | 115 |
if (SPPIDUtil.SaveSPPIDInfo()) |
... | ... | |
149 | 149 |
info.Port = textBoxPort.Text; |
150 | 150 |
info.DBUser = textBoxDBUser.Text; |
151 | 151 |
info.DBPassword = textBoxDBPassword.Text; |
152 |
info.PlantList = DB.DB.GetPlantList();
|
|
152 |
info.PlantList = SPPID_DB.GetPlantList();
|
|
153 | 153 |
if (info.PlantList.Count > 0) |
154 | 154 |
return true; |
155 | 155 |
else |
DTI_PID/SPPIDConverter_AutoModeling/SPPIDConverter_AutoModeling.csproj | ||
---|---|---|
87 | 87 |
<Reference Include="System.Xml" /> |
88 | 88 |
</ItemGroup> |
89 | 89 |
<ItemGroup> |
90 |
<Compile Include="DB\DB.cs" /> |
|
91 |
<Compile Include="DB\SPPIDInfo.cs" /> |
|
90 |
<Compile Include="DB\SPPID_DB.cs" />
|
|
91 |
<Compile Include="DB\SPPID_DBInfo.cs" />
|
|
92 | 92 |
<Compile Include="ConverterForm.cs"> |
93 | 93 |
<SubType>Form</SubType> |
94 | 94 |
</Compile> |
DTI_PID/SPPIDConverter_AutoModeling/Util/SPPIDUtil.cs | ||
---|---|---|
50 | 50 |
|
51 | 51 |
public static bool SaveSPPIDInfo() |
52 | 52 |
{ |
53 |
SPPIDInfo info = SPPIDInfo.GetInstance();
|
|
53 |
SPPID_DBInfo info = SPPID_DBInfo.GetInstance();
|
|
54 | 54 |
try |
55 | 55 |
{ |
56 | 56 |
StreamWriter sw = new StreamWriter(Application.StartupPath + @"\SPPIDInfo.info"); |
... | ... | |
66 | 66 |
|
67 | 67 |
public static bool ReadSPPIDInfo() |
68 | 68 |
{ |
69 |
SPPIDInfo _SPPIDInfo = SPPIDInfo.GetInstance();
|
|
69 |
SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
|
|
70 | 70 |
try |
71 | 71 |
{ |
72 | 72 |
StreamReader sr = new StreamReader(Application.StartupPath + @"\SPPIDInfo.info"); |
73 |
SPPIDInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPIDInfo>(sr.ReadToEnd());
|
|
73 |
SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(sr.ReadToEnd());
|
|
74 | 74 |
sr.Dispose(); |
75 | 75 |
|
76 | 76 |
_SPPIDInfo.DBType = jsonSPPIDInfo.DBType; |
내보내기 Unified diff