개정판 54b6df95
issue #000: Revision, ValveGrouping 수정
Change-Id: I21a5956eff594804824dfab9ca53916487baa463
DTI_PID/ID2PSN/DB.cs | ||
---|---|---|
558 | 558 |
{ |
559 | 559 |
try |
560 | 560 |
{ |
561 |
var query = "SELECT * FROM Drawings";
|
|
561 |
var query = "SELECT DISTINCT NAME FROM [Drawings]";
|
|
562 | 562 |
using (var ds = connection.ExecuteDataSet(connection.GetSqlStringCommand(query))) |
563 | 563 |
{ |
564 | 564 |
dt = ds.Tables[0].Copy(); |
... | ... | |
1306 | 1306 | |
1307 | 1307 |
return dt; |
1308 | 1308 |
} |
1309 | ||
1309 | 1310 |
public static bool ConnCreateRevisionTable(Dictionary<string, string> dicColCheck, List<string> names) |
1310 | 1311 |
{ |
1311 | 1312 |
bool result = false; |
... | ... | |
1404 | 1405 |
AddWithValue(cmd, "@ProjectCode", ProjectCode); |
1405 | 1406 |
AddWithValue(cmd, "@RevNumber", RevNumber); |
1406 | 1407 |
AddWithValue(cmd, "@UserName", UserName); |
1407 |
AddWithValue(cmd, "@TimeData", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); |
|
1408 | ||
1409 |
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); |
|
1410 |
DateTime oDateTime = DateTime.Now; |
|
1411 | ||
1412 |
AddWithValue(cmd, "@TimeData", oDateTime.ToString(ci)); //String.Format("{0:G}", dt) // DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") |
|
1413 | ||
1414 |
//AddWithValue(cmd, "@TimeData", string.Format("{0:G}", DateTime.Now)); //String.Format("{0:G}", dt) // DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") |
|
1408 | 1415 |
AddWithValue(cmd, "@PSNDatabasePath", PSNDatabasePath); |
1409 | 1416 | |
1410 | 1417 |
AddWithValue(cmd, "@PsnByPBSFilter", PsnByPBSFilter); |
... | ... | |
2663 | 2670 |
AddColumn(PSN_PIPESYSTEM, dicColCheck); |
2664 | 2671 |
} |
2665 | 2672 | |
2673 | ||
2674 |
var query2 = $"If(db_id(N'" + PSN_COMMON + "') IS NULL) CREATE DATABASE [" + PSN_COMMON + "]"; |
|
2675 |
if (id2Info.ID2DBType == AnotherID2DB_Type.MSSQL) |
|
2676 |
{ |
|
2677 |
//connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
2678 |
using (var cmd = connection.GetSqlStringCommand(query2)) |
|
2679 |
{ |
|
2680 |
cmd.ExecuteNonQuery(); |
|
2681 |
} |
|
2682 |
} |
|
2683 | ||
2666 | 2684 |
void AddColumn(string TableName, Dictionary<string, string> dicCol) |
2667 | 2685 |
{ |
2668 | 2686 |
var colnames = connection.GetColumnNames(TableName); |
... | ... | |
2708 | 2726 |
return result; |
2709 | 2727 |
} |
2710 | 2728 | |
2729 |
public static bool SaveAnotherRevision(string ProjectCode, int RevNumber, string UserName, string PSNDatabasePath, string PsnByPBSFilter, string PsnByNPDFilter, |
|
2730 |
int PidDrawings, int PipeSystems, int PipeLines, int Topologies, int PipeSystemNetworks, int InValidPSNs, int E2E, int E2B, int B2E, int HDE, int HD2, int HDB, int B2B) |
|
2731 |
{ |
|
2732 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
2733 | ||
2734 |
bool result = true; |
|
2735 | ||
2736 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
2737 |
{ |
|
2738 |
try |
|
2739 |
{ |
|
2740 |
using (var txn = connection.BeginTransaction()) |
|
2741 |
{ |
|
2742 |
try |
|
2743 |
{ |
|
2744 | ||
2745 |
var query = $"INSERT INTO ARS_COMMON.dbo.PSNRevision (OID, Project_OID, ProjectCode, RevNumber, UserName, TimeData, PSNDatabasePath, " + |
|
2746 |
$"PsnByPBSFilter, PsnByNPDFilter, PidDrawings, PipeSystems, PipeLines, Topologies, PipeSystemNetworks, InValidPSNs, E2E, E2B, B2E, HDE, " + |
|
2747 |
$"HD2, HDB, B2B) VALUES (NEWID(), NEWID(), @ProjectCode, @RevNumber, @UserName, @TimeData, @PSNDatabasePath" + |
|
2748 |
$", @PsnByPBSFilter, @PsnByNPDFilter, @PidDrawings, @PipeSystems, @PipeLines, @Topologies, @PipeSystemNetworks, @InValidPSNs, " + |
|
2749 |
$"@E2E, @E2B, @B2E, @HDE, @HD2, @HDB, @B2B)"; |
|
2750 |
var cmd = connection.GetSqlStringCommand(query); |
|
2751 |
AddWithValue(cmd, "@OID", Guid.NewGuid().ToString()); |
|
2752 |
AddWithValue(cmd, "@Project_OID", Guid.NewGuid().ToString()); |
|
2753 |
AddWithValue(cmd, "@ProjectCode", ProjectCode); |
|
2754 |
AddWithValue(cmd, "@RevNumber", RevNumber); |
|
2755 |
AddWithValue(cmd, "@UserName", UserName); |
|
2756 | ||
2757 |
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); |
|
2758 |
DateTime oDateTime = DateTime.Now; |
|
2759 | ||
2760 |
AddWithValue(cmd, "@TimeData", oDateTime.ToString(ci)); //String.Format("{0:G}", dt) // DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") |
|
2761 |
AddWithValue(cmd, "@PSNDatabasePath", PSNDatabasePath); |
|
2762 | ||
2763 |
AddWithValue(cmd, "@PsnByPBSFilter", PsnByPBSFilter); |
|
2764 |
AddWithValue(cmd, "@PsnByNPDFilter", PsnByNPDFilter); |
|
2765 |
AddWithValue(cmd, "@PidDrawings", PidDrawings); |
|
2766 |
AddWithValue(cmd, "@PipeSystems", PipeSystems); |
|
2767 |
AddWithValue(cmd, "@PipeLines", PipeLines); |
|
2768 | ||
2769 |
AddWithValue(cmd, "@Topologies", Topologies); |
|
2770 |
AddWithValue(cmd, "@PipeSystemNetworks", PipeSystemNetworks); |
|
2771 |
AddWithValue(cmd, "@InValidPSNs", InValidPSNs); |
|
2772 |
AddWithValue(cmd, "@E2E", E2E); |
|
2773 |
AddWithValue(cmd, "@E2B", E2B); |
|
2774 |
AddWithValue(cmd, "@B2E", B2E); |
|
2775 |
AddWithValue(cmd, "@HDE", HDE); |
|
2776 |
AddWithValue(cmd, "@HD2", HD2); |
|
2777 |
AddWithValue(cmd, "@HDB", HDB); |
|
2778 |
AddWithValue(cmd, "@B2B", B2B); |
|
2779 |
connection.ExecuteNonQuery(cmd, txn); |
|
2780 | ||
2781 |
txn.Commit(); |
|
2782 |
} |
|
2783 |
catch (Exception ex) |
|
2784 |
{ |
|
2785 |
txn.Rollback(); |
|
2786 |
result = false; |
|
2787 |
} |
|
2788 |
} |
|
2789 |
} |
|
2790 |
catch (Exception ex) |
|
2791 |
{ |
|
2792 |
System.Windows.Forms.MessageBox.Show(ex.Message); |
|
2793 |
result = false; |
|
2794 |
} |
|
2795 |
} |
|
2796 | ||
2797 |
return result; |
|
2798 |
} |
|
2799 | ||
2800 |
public static bool ConnAnotherCreateRevisionTable(Dictionary<string, string> dicColCheck, List<string> names) |
|
2801 |
{ |
|
2802 |
bool result = false; |
|
2803 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
2804 | ||
2805 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
2806 |
{ |
|
2807 |
try |
|
2808 |
{ |
|
2809 |
if (names.Count == 0) |
|
2810 |
{ |
|
2811 | ||
2812 |
var query = $"CREATE TABLE ARS_COMMON.dbo.PSNRevision ([OID] [uniqueidentifier] ,[Project_OID] [uniqueidentifier] ," + |
|
2813 |
$"[ProjectCode] nvarchar(255), [RevNumber] int ,[UserName] nvarchar(255) ,[TimeData] nvarchar(255) ," + |
|
2814 |
$"[PSNDatabasePath] nvarchar(255) , [PsnByPBSFilter] varchar(20) ,[PsnByNPDFilter] varchar(20) ,[PidDrawings] int , " + |
|
2815 |
$"[PipeSystems] int ,[PipeLines] int ,[Topologies] int ,[PipeSystemNetworks] int ,[InValidPSNs] int ,[E2E] int ," + |
|
2816 |
$"[E2B] int ,[B2E] int ,[HDE] int ,[HD2] int ,[HDB] int ,[B2B] int )"; |
|
2817 |
using (var cmd = connection.GetSqlStringCommand(query)) |
|
2818 |
{ |
|
2819 |
cmd.ExecuteNonQuery(); |
|
2820 |
} |
|
2821 |
} |
|
2822 |
else |
|
2823 |
{ |
|
2824 |
AddColumn(PSN_REVISION, dicColCheck, names); |
|
2825 |
} |
|
2826 | ||
2827 |
void AddColumn(string TableName, Dictionary<string, string> dicCol, List<string> colnames) |
|
2828 |
{ |
|
2829 |
bool check = false; |
|
2830 |
if (colnames != null) |
|
2831 |
{ |
|
2832 |
foreach (KeyValuePair<string, string> col in dicCol) |
|
2833 |
{ |
|
2834 |
check = false; |
|
2835 |
foreach (string c in colnames) |
|
2836 |
{ |
|
2837 |
if (col.Key.Contains(c)) |
|
2838 |
{ |
|
2839 |
check = true; |
|
2840 |
break; |
|
2841 |
} |
|
2842 |
} |
|
2843 | ||
2844 |
if (!check) //없으면 추가 |
|
2845 |
{ |
|
2846 |
string i = string.Empty; |
|
2847 |
if (col.Value.ToString().ToUpper().Contains("INT") || col.Value.ToString().ToUpper().Contains("REAL")) |
|
2848 |
i = "DEFAULT 0"; |
|
2849 | ||
2850 |
var queryalter = $"ALTER TABLE ARS_COMMON.dbo.PSNRevision ADD [" + col.Key + "] " + col.Value + " " + i + ";"; |
|
2851 |
using (var cmd = connection.GetSqlStringCommand(queryalter)) |
|
2852 |
{ |
|
2853 |
cmd.ExecuteNonQuery(); |
|
2854 |
} |
|
2855 |
} |
|
2856 |
} |
|
2857 |
} |
|
2858 |
} |
|
2859 | ||
2860 |
result = true; |
|
2861 |
} |
|
2862 |
catch (Exception ex) |
|
2863 |
{ |
|
2864 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
2865 |
} |
|
2866 |
} |
|
2867 | ||
2868 |
return result; |
|
2869 |
} |
|
2870 | ||
2871 |
public static DataTable SelectAnotherRevisionTable() |
|
2872 |
{ |
|
2873 |
DataTable dt = null; |
|
2874 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
2875 | ||
2876 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
2877 |
{ |
|
2878 |
try |
|
2879 |
{ |
|
2880 |
var query = $"SELECT T.name AS table_name, C.name AS column_name FROM ARS_COMMON.sys.tables AS T INNER JOIN ARS_COMMON.sys.columns AS C ON T.object_id = C.object_id WHERE T.name = 'PSN_REVISION'"; |
|
2881 |
using (var ds = connection.ExecuteDataSet(connection.GetSqlStringCommand(query))) |
|
2882 |
{ |
|
2883 |
dt = ds.Tables[0].Copy(); |
|
2884 |
} |
|
2885 |
} |
|
2886 |
catch (Exception ex) |
|
2887 |
{ |
|
2888 |
Log.Write(ex.Message + "\r\n" + ex.StackTrace); |
|
2889 |
} |
|
2890 |
} |
|
2891 | ||
2892 |
return dt; |
|
2893 |
} |
|
2894 | ||
2711 | 2895 |
public static bool SaveAnotherPSNData(PSN item, List<HeaderInfo> headerInfos, List<VentDrainInfo> ventDrainInfos, |
2712 | 2896 |
List<KeywordItem> keywordItems, DataTable dtTopologyRule, DataTable dtFluidCode, DataTable dtPMC, DataTable dtInsulation, DataTable dtvalvegrouping) |
2713 | 2897 |
{ |
... | ... | |
3176 | 3360 | |
3177 | 3361 |
return result; |
3178 | 3362 |
} |
3179 |
} |
|
3180 | 3363 | |
3364 |
public static bool CreatePSN_COMMON() |
|
3365 |
{ |
|
3366 |
AnotherID2Info id2Info = AnotherID2Info.GetInstance(); |
|
3367 | ||
3368 |
bool result = true; |
|
3369 |
using (IAbstractDatabase connection = id2Info.CreateConnection()) |
|
3370 |
{ |
|
3371 |
try |
|
3372 |
{ |
|
3373 |
using (var txn = connection.BeginTransaction()) |
|
3374 |
{ |
|
3375 |
try |
|
3376 |
{ |
|
3377 |
|
|
3378 |
var query = $"If(db_id(N'" + PSN_COMMON + "') IS NULL) CREATE DATABASE [" + PSN_COMMON + "]"; |
|
3379 |
if (id2Info.ID2DBType == AnotherID2DB_Type.MSSQL) |
|
3380 |
{ |
|
3381 |
connection.ExecuteNonQuery(connection.GetSqlStringCommand(query), txn); |
|
3382 |
} |
|
3383 | ||
3384 |
txn.Commit(); |
|
3385 |
} |
|
3386 |
catch (Exception ex) |
|
3387 |
{ |
|
3388 |
txn.Rollback(); |
|
3389 |
result = false; |
|
3390 |
} |
|
3391 |
} |
|
3392 |
} |
|
3393 |
catch (Exception ex) |
|
3394 |
{ |
|
3395 |
System.Windows.Forms.MessageBox.Show(ex.Message); |
|
3396 |
result = false; |
|
3397 |
} |
|
3398 |
} |
|
3399 | ||
3400 |
return result; |
|
3401 |
} |
|
3402 |
} |
|
3181 | 3403 |
} |
3404 | ||
3405 |
DTI_PID/ID2PSN/Form/DBSettingForm.cs | ||
---|---|---|
178 | 178 |
{ |
179 | 179 |
if (rgDbSetting.SelectedIndex == 1) |
180 | 180 |
{ |
181 |
DataTable revisiondt = DB.SelectRevisionTable(); |
|
181 |
//DB.CreatePSN_COMMON(); |
|
182 |
DataTable revisiondt = DB.SelectAnotherRevisionTable(); |
|
182 | 183 |
List<string> names = new List<string>(); |
183 | 184 |
foreach (DataRow dr in revisiondt.Rows) |
184 | 185 |
{ |
... | ... | |
194 | 195 |
dicColCheck.Add("TimeData", "nvarchar(255)"); |
195 | 196 |
dicColCheck.Add("PSNDatabasePath", "nvarchar(255)"); |
196 | 197 |
dicColCheck.Add("PsnByPBSFilter", "varchar(20)"); |
197 |
string PBS = Properties.Settings.Default.PBSSetting; |
|
198 |
|
|
198 | 199 |
dicColCheck.Add("PsnByNPDFilter", "varchar(20)"); |
199 | 200 |
dicColCheck.Add("PidDrawings", "int"); |
200 | 201 |
DataTable lstDrawings = DB.SelectDrawings(); |
201 | 202 |
int DrawingCnt = 0; |
202 | 203 |
foreach (DataRow row in lstDrawings.Rows) |
203 | 204 |
{ |
204 |
string filePath = string.Format(ID2Info.TempDirPath + "{0}.xml", Path.GetFileNameWithoutExtension(row["NAME"].ToString()));
|
|
205 |
string filePath = string.Format(ID2Info.DefaultPath + "/drawings/" + "{0}.png", Path.GetFileNameWithoutExtension(row["NAME"].ToString()));
|
|
205 | 206 |
if (File.Exists(filePath)) |
206 | 207 |
DrawingCnt++; |
207 | 208 |
} |
... | ... | |
224 | 225 |
dicColCheck.Add("HDB", "int"); |
225 | 226 |
dicColCheck.Add("B2B", "int"); |
226 | 227 |
//string ProjectOID = ID2Info.Database; |
227 |
// string ProjectCode = ID2Info.Database; |
|
228 |
string PsnByNPDFilter = string.Empty; |
|
228 |
// string ProjectCode = ID2Info.Database; |
|
229 |
string PsnByNPDFilter = "False"; |
|
230 |
string PsnByPBSFilter = "False"; // Properties.Settings.Default.PBSSetting; |
|
229 | 231 |
int E2E = _currentPSN.PipeSystemNetwork.Select("Type = 'E2E'").Count(); |
230 | 232 |
int E2B = _currentPSN.PipeSystemNetwork.Select("Type = 'E2B'").Count(); |
231 | 233 |
int B2E = _currentPSN.PipeSystemNetwork.Select("Type = 'B2E'").Count(); |
... | ... | |
234 | 236 |
int HDB = _currentPSN.PipeSystemNetwork.Select("Type = 'HDB'").Count(); |
235 | 237 |
int B2B = _currentPSN.PipeSystemNetwork.Select("Type = 'B2B'").Count(); |
236 | 238 |
string UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; |
237 |
DB.ConnCreateRevisionTable(dicColCheck, names); |
|
239 |
DB.ConnAnotherCreateRevisionTable(dicColCheck, names);
|
|
238 | 240 | |
239 |
string PSNDatabasePath = AnotherID2Info.ServerIP; |
|
241 |
string PSNDatabasePath = AnotherID2Info.ServerIP + "__" + AnotherID2Info.Database;
|
|
240 | 242 |
if (!string.IsNullOrEmpty(AnotherID2Info.Port)) |
241 | 243 |
PSNDatabasePath += ", " + AnotherID2Info.Port; |
242 | 244 | |
243 | 245 |
string ProjectCode = AnotherID2Info.Database; |
244 |
DB.SaveRevision(ProjectCode, DB.GetRevision(), UserName, PSNDatabasePath, PBS, PsnByNPDFilter, DrawingCnt, PipeSystems, PipeLines, Topologies, pipeSystemNetworks, |
|
246 | ||
247 |
DB.SaveAnotherRevision(ProjectCode, DB.GetRevision(), UserName, PSNDatabasePath, PsnByPBSFilter, PsnByNPDFilter, DrawingCnt, PipeSystems, PipeLines, Topologies, pipeSystemNetworks, |
|
245 | 248 |
InValidPSNs, E2E, E2B, B2E, HDE, HD2, HDB, B2B); |
246 | 249 |
} |
247 | 250 |
DTI_PID/ID2PSN/Form/DrawingList.cs | ||
---|---|---|
20 | 20 |
public DrawingList(Dictionary<string, List<string>> lstdrawingItem) |
21 | 21 |
{ |
22 | 22 |
InitializeComponent(); |
23 |
this.KeyPreview = true; |
|
24 |
this.KeyDown += DrawingList_KeyDown; |
|
23 | 25 |
_lstdrawingItem = lstdrawingItem; |
24 | 26 | |
25 | 27 |
foreach(string drawingName in _lstdrawingItem.Keys) |
... | ... | |
28 | 30 |
} |
29 | 31 |
} |
30 | 32 | |
33 |
private void DrawingList_KeyDown(object sender, KeyEventArgs e) |
|
34 |
{ |
|
35 |
if (e.KeyCode == Keys.Escape) |
|
36 |
{ |
|
37 |
this.Close(); |
|
38 |
} |
|
39 |
} |
|
40 | ||
31 | 41 |
private void lbDrawingList_MouseDoubleClick(object sender, MouseEventArgs e) |
32 | 42 |
{ |
33 | 43 |
try |
DTI_PID/ID2PSN/Form/MainForm.cs | ||
---|---|---|
333 | 333 |
dicColCheck.Add("TimeData", "nvarchar(255)"); |
334 | 334 |
dicColCheck.Add("PSNDatabasePath", "nvarchar(255)"); |
335 | 335 |
dicColCheck.Add("PsnByPBSFilter", "varchar(20)"); |
336 |
string PBS = Settings.Default.PBSSetting; |
|
336 |
//string PBS = Settings.Default.PBSSetting;
|
|
337 | 337 |
dicColCheck.Add("PsnByNPDFilter", "varchar(20)"); |
338 | 338 |
dicColCheck.Add("PidDrawings", "int"); |
339 | 339 |
DataTable lstDrawings = DB.SelectDrawings(); |
340 | 340 |
int DrawingCnt = 0; |
341 | 341 |
foreach (DataRow row in lstDrawings.Rows) |
342 | 342 |
{ |
343 |
string filePath = string.Format(ID2Info.TempDirPath + "{0}.xml", Path.GetFileNameWithoutExtension(row["NAME"].ToString()));
|
|
343 |
string filePath = string.Format(ID2Info.DefaultPath + "/drawings/" + "{0}.png", Path.GetFileNameWithoutExtension(row["NAME"].ToString()));
|
|
344 | 344 |
if (File.Exists(filePath)) |
345 | 345 |
DrawingCnt++; |
346 | 346 |
} |
347 | ||
348 |
int PipeSystems = 0; //아직테이블추가안됨 AG-UG할때추가 |
|
347 |
//foreach (DataRow row in lstDrawings.Rows) |
|
348 |
//{ |
|
349 |
// string filePath = string.Format(ID2Info.TempDirPath + "{0}.xml", Path.GetFileNameWithoutExtension(row["NAME"].ToString())); |
|
350 |
// if (File.Exists(filePath)) |
|
351 |
// DrawingCnt++; |
|
352 |
//} |
|
353 | ||
354 |
int PipeSystems = currentPSN.PipeSystem.Rows.Count; |
|
349 | 355 |
int PipeLines = currentPSN.PipeLine.Rows.Count; |
350 | 356 |
int Topologies = currentPSN.TopologySet.Rows.Count; |
351 | 357 |
int pipeSystemNetworks = currentPSN.PipeSystemNetwork.Rows.Count; |
... | ... | |
363 | 369 |
dicColCheck.Add("HDB", "int"); |
364 | 370 |
dicColCheck.Add("B2B", "int"); |
365 | 371 | |
366 |
string PsnByNPDFilter = string.Empty; |
|
372 |
string PsnByNPDFilter = "False"; |
|
373 |
string PsnByPBSFilter = "False"; |
|
367 | 374 |
int E2E = currentPSN.PipeSystemNetwork.Select("Type = 'E2E'").Count(); |
368 | 375 |
int E2B = currentPSN.PipeSystemNetwork.Select("Type = 'E2B'").Count(); |
369 | 376 |
int B2E = currentPSN.PipeSystemNetwork.Select("Type = 'B2E'").Count(); |
... | ... | |
374 | 381 |
string UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; |
375 | 382 |
DB.ConnCreateRevisionTable(dicColCheck, names); |
376 | 383 | |
377 |
string PSNDatabasePath = ID2Info.ServerIP; |
|
384 |
string PSNDatabasePath = ID2Info.ServerIP + "__" + ID2Info.Database;
|
|
378 | 385 |
if (!string.IsNullOrEmpty(ID2Info.Port)) |
379 | 386 |
PSNDatabasePath += ", " + ID2Info.Port; |
380 | 387 | |
381 | 388 |
string ProjectCode = ID2Info.Database; |
382 | 389 | |
383 |
DB.SaveRevision(ProjectCode, DB.GetRevision(), UserName, PSNDatabasePath, PBS, PsnByNPDFilter, DrawingCnt, PipeSystems, PipeLines, Topologies, pipeSystemNetworks,
|
|
390 |
DB.SaveRevision(ProjectCode, DB.GetRevision(), UserName, PSNDatabasePath, PsnByPBSFilter, PsnByNPDFilter, DrawingCnt, PipeSystems, PipeLines, Topologies, pipeSystemNetworks,
|
|
384 | 391 |
InValidPSNs, E2E, E2B, B2E, HDE, HD2, HDB, B2B); |
385 | 392 |
} |
386 | 393 |
|
DTI_PID/ID2PSN/Form/ValveGroupingSetting.cs | ||
---|---|---|
76 | 76 | |
77 | 77 | |
78 | 78 |
repositoryGroupType = new RepositoryItemComboBox(); |
79 |
repositoryGroupType.Items.AddRange(new string[] { "Valves (CV, PRV..)", "Traps (ST, DT..)", "Reliefs (PSV..)" }); |
|
79 |
repositoryGroupType.Items.AddRange(new string[] { "Valves (CV, PRV..)", "Traps (ST, DT..)", "Reliefs (PSV..)", "Pumps", "Scope Break" });
|
|
80 | 80 |
repositoryGroupType.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; |
81 | 81 |
//repositoryGroupType.EditValueChanging += RepositoryGroupType_EditValueChanging; |
82 | 82 |
// repositoryGroupType.SelectedIndexChanged += RepositoryGroupType_SelectedIndexChanged; |
... | ... | |
353 | 353 |
{ |
354 | 354 |
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "PSV"; |
355 | 355 |
} |
356 |
else if(selectItem.Contains("Pumps")) |
|
357 |
{ |
|
358 |
dt.Rows[columnView.FocusedRowHandle]["TagIdentifier"] = "Pump"; |
|
359 |
} |
|
356 | 360 |
} |
357 | 361 |
} |
358 | 362 |
|
... | ... | |
380 | 384 |
ReNumbering(currentValveGroupInfo); |
381 | 385 |
if(currentValveGroupInfo.ValveGroupItems.Find(x => x.TagIdentifier == string.Empty || x.AttributeName == string.Empty || x.SppidSymbolName == string.Empty) != null) |
382 | 386 |
{ |
383 |
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
384 |
return; |
|
387 |
IEnumerable<ValveGroupItem> lstvalue = currentValveGroupInfo.ValveGroupItems.Where(x => x.TagIdentifier == string.Empty || x.AttributeName == string.Empty || x.SppidSymbolName == string.Empty); |
|
388 |
//Scope Break |
|
389 |
foreach(ValveGroupItem vg in lstvalue) |
|
390 |
{ |
|
391 |
if(vg.GroupType != "Scope Break") |
|
392 |
{ |
|
393 |
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
394 |
return; |
|
395 |
} |
|
396 |
else |
|
397 |
{ |
|
398 |
if(vg.SppidSymbolName == string.Empty) |
|
399 |
{ |
|
400 |
MessageBox.Show("Please save after entering data.", "ID2 " + ID2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
401 |
return; |
|
402 |
} |
|
403 |
} |
|
404 |
} |
|
405 |
|
|
385 | 406 |
} |
386 | 407 | |
387 | 408 |
if (DB.SaveValveGroupItemsSetting(currentValveGroupInfo.ValveGroupItems)) |
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
282 | 282 |
} |
283 | 283 |
#endregion |
284 | 284 | |
285 |
//DataTable distinctTable = PipeSystemNetwork.DefaultView.ToTable(true, new string[] { "OID" }); |
|
286 |
//foreach (DataRow dataRow in distinctTable.Rows) |
|
287 |
//{ |
|
285 |
|
|
288 | 286 |
int vgTagNum = 1; |
289 | 287 |
DataRow[] tagpathItemRows = PathItems.Select(string.Format("GROUPTAG Like '%\\%'")); |
290 | 288 |
foreach (DataRow drPathitem in tagpathItemRows) |
... | ... | |
292 | 290 |
string[] valvetag = drPathitem["GROUPTAG"].ToString().Split(new string[] { "\\" }, StringSplitOptions.None); |
293 | 291 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", drPathitem["PipeSystemNetwork_OID"].ToString())); |
294 | 292 |
ValveGroupItem valveitem = ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == valvetag[0]).FirstOrDefault(); |
295 |
if (valveitem == null) |
|
293 |
if (valveitem == null || valveitem.GroupType == "Scope Break")
|
|
296 | 294 |
continue; |
297 | 295 |
Dictionary<int, List<DataRow>> keyValuePairs = new Dictionary<int, List<DataRow>>(); |
298 | 296 |
List<Item> valveGroupingItem = new List<Item>(); |
... | ... | |
308 | 306 |
if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString())) |
309 | 307 |
{ |
310 | 308 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString())); |
309 |
if (dr["GROUPTAG"].ToString() == "Scope Break") |
|
310 |
{ |
|
311 |
dr["GROUPTAG"] = string.Empty; |
|
312 |
break; |
|
313 |
} |
|
314 | ||
311 | 315 |
if (rows.First()["SubType"].ToString() != "Bypass" || rows.First()["SubType"].ToString() != "Vent_Drain") |
312 | 316 |
{ |
313 | 317 |
bCheck = true; |
318 |
lstitem.Add(dr); |
|
314 | 319 |
keyValuePairs.Add(bCnt, lstitem.ToList()); |
315 | 320 |
bCnt++; |
316 | 321 |
lstitem.Clear(); |
... | ... | |
322 | 327 |
lstitem.Add(dr); |
323 | 328 |
} |
324 | 329 | |
325 |
if (!bCheck)
|
|
330 |
if (lstitem.Count > 0)
|
|
326 | 331 |
{ |
327 | 332 |
keyValuePairs.Add(bCnt, lstitem); |
328 | 333 |
bCnt++; |
... | ... | |
1302 | 1307 |
if (ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == item.Name).Count() >0) |
1303 | 1308 |
{ |
1304 | 1309 |
ValveGroupItem valveitem = ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == item.Name).First(); |
1305 |
string value = item.Attributes.Find(x => x.Name == valveitem.AttributeName).Value; |
|
1306 |
VgTag = valveitem.SppidSymbolName + "\\" + value; |
|
1310 |
string value = string.Empty; |
|
1311 |
|
|
1312 |
if (valveitem.AttributeName == "NoSelection") |
|
1313 |
value = "NoSelection"; |
|
1314 |
else |
|
1315 |
value = item.Attributes.Find(x => x.Name == valveitem.AttributeName).Value; |
|
1316 | ||
1317 |
if (valveitem.GroupType == "Scope Break") |
|
1318 |
VgTag = "Scope Break"; |
|
1319 |
else |
|
1320 |
VgTag = valveitem.SppidSymbolName + "\\" + value; |
|
1307 | 1321 |
} |
1308 | 1322 | |
1309 | 1323 |
string PathitemUID = string.Empty; |
... | ... | |
1340 | 1354 |
if (bPSNStart) |
1341 | 1355 |
{ |
1342 | 1356 |
CreatePipeSystemNetworkDataRow(); |
1343 |
sPSNData = item.TopologyData; |
|
1344 |
//i |
|
1357 |
sPSNData = item.TopologyData; |
|
1345 | 1358 |
psnOrder++; |
1346 | 1359 |
bPSNStart = false; |
1347 | 1360 |
} |
... | ... | |
1456 | 1469 | |
1457 | 1470 |
if (pipesystemDT.Select(string.Format("OID = '{0}'", PipeSystem_OID)).Count() == 0) |
1458 | 1471 |
{ |
1459 |
//DataRow newPipesystemRow = pipesystemDT.NewRow();
|
|
1460 |
//newPipesystemRow["OID"] = PipeSystem_OID;
|
|
1461 |
//newPipesystemRow["DESCRIPTION"] = string.Empty;
|
|
1462 |
//newPipesystemRow["FLUID"] = FluidCode;
|
|
1463 |
//newPipesystemRow["PMC"] = PMC;
|
|
1464 |
//newPipesystemRow["PipeLineQty"] = string.Empty;
|
|
1465 |
//string GroundLevel = string.Empty;
|
|
1466 |
//if (!string.IsNullOrEmpty(FluidCode) && !string.IsNullOrEmpty(PMC))
|
|
1467 |
//{
|
|
1468 |
// FluidCodeGL = PSNFluidDT.Select(string.Format("Code = '{0}'", FluidCode)).FirstOrDefault().Field<string>("GroundLevel");
|
|
1469 |
// PMCGL = PSNPMCDT.Select(string.Format("Code= '{0}'", PMC)).FirstOrDefault().Field<string>("GroundLevel");
|
|
1470 |
// if (FluidCodeGL == "AG" && PMCGL == "AG")
|
|
1471 |
// GroundLevel = "AG";
|
|
1472 |
// else if (FluidCodeGL == "UG" && PMCGL == "UG")
|
|
1473 |
// GroundLevel = "UG";
|
|
1474 |
// else
|
|
1475 |
// GroundLevel = "AG_UG";
|
|
1476 |
//}
|
|
1477 |
//newPipesystemRow["GroundLevel"] = GroundLevel;
|
|
1478 | ||
1479 |
//pipesystemDT.Rows.Add(newPipesystemRow);
|
|
1472 |
DataRow newPipesystemRow = pipesystemDT.NewRow(); |
|
1473 |
newPipesystemRow["OID"] = PipeSystem_OID; |
|
1474 |
newPipesystemRow["DESCRIPTION"] = string.Empty; |
|
1475 |
newPipesystemRow["FLUID"] = FluidCode; |
|
1476 |
newPipesystemRow["PMC"] = PMC; |
|
1477 |
newPipesystemRow["PipeLineQty"] = string.Empty; |
|
1478 |
string GroundLevel = string.Empty; |
|
1479 |
if (!string.IsNullOrEmpty(FluidCode) && !string.IsNullOrEmpty(PMC)) |
|
1480 |
{ |
|
1481 |
FluidCodeGL = PSNFluidDT.Select(string.Format("Code = '{0}'", FluidCode)).FirstOrDefault().Field<string>("GroundLevel"); |
|
1482 |
PMCGL = PSNPMCDT.Select(string.Format("Code= '{0}'", PMC)).FirstOrDefault().Field<string>("GroundLevel"); |
|
1483 |
if (FluidCodeGL == "AG" && PMCGL == "AG") |
|
1484 |
GroundLevel = "AG"; |
|
1485 |
else if (FluidCodeGL == "UG" && PMCGL == "UG") |
|
1486 |
GroundLevel = "UG"; |
|
1487 |
else |
|
1488 |
GroundLevel = "AG_UG"; |
|
1489 |
} |
|
1490 |
newPipesystemRow["GroundLevel"] = GroundLevel; |
|
1491 | ||
1492 |
pipesystemDT.Rows.Add(newPipesystemRow); |
|
1480 | 1493 |
} |
1481 | 1494 |
} |
1482 | 1495 |
} |
... | ... | |
1510 | 1523 |
{ |
1511 | 1524 |
PSNItem.EndType = PSNType.Equipment; |
1512 | 1525 |
} |
1513 |
|
|
1514 |
if (group.Items.Count == psnOrder + 1 && !string.IsNullOrEmpty(PSNItem.Status))
|
|
1526 | ||
1527 |
if (Groups.Count == psnOrder + 1 && !string.IsNullOrEmpty(PSNItem.Status))
|
|
1515 | 1528 |
{ |
1516 | 1529 |
status += PSNItem.Status; |
1517 | 1530 |
} |
... | ... | |
1853 | 1866 | |
1854 | 1867 |
private void UpdateAccuracy() |
1855 | 1868 |
{ |
1856 |
DataRow[] statusRows = PipeSystemNetwork.Select(" Type = 'Error' OR IsValid = 'Error'"); |
|
1869 |
//DataRow[] statusRows = PipeSystemNetwork.Select(" Type = 'Error' OR IsValid = 'Error'"); |
|
1870 |
DataRow[] statusRows = PipeSystemNetwork.Select(" Type = 'Error' OR IsValid = 'Error'"); |
|
1857 | 1871 |
List<double> lstAcc = null; |
1858 | 1872 |
string Status = string.Empty; |
1859 | 1873 |
내보내기 Unified diff