개정판 4e2e0aa1
issue #000: psn branch pathitem 수정중
Change-Id: I55a153de719fc921dcd05c05e2775dec20ea7007
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
227 | 227 |
SaveNozzleAndEquipment(); |
228 | 228 |
// PSN의 정보를 저장 |
229 | 229 |
SavePSNData(); |
230 |
|
|
231 | 230 |
// Update Keyword |
232 | 231 |
UpdateKeywordForPSN(); |
233 | 232 |
// Vent/Drain PSN 데이터 제거 |
... | ... | |
235 | 234 |
// Topology의 subtype을 update(bypass, Header, 등등) |
236 | 235 |
UpdateSubType(); |
237 | 236 |
// Update Error |
238 |
UpdateErrorForPSN(); |
|
237 |
UpdateErrorForPSN(); |
|
238 |
// Insert Tee |
|
239 |
InsertTeePSN(); |
|
239 | 240 |
// 확도 계산 |
240 | 241 |
UpdateAccuracy(); |
241 | 242 |
} |
... | ... | |
1341 | 1342 |
} |
1342 | 1343 |
|
1343 | 1344 |
newRow["Type"] = PSNItem.GetPSNType(); |
1345 |
|
|
1344 | 1346 |
|
1345 | 1347 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
1346 | 1348 |
newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision); |
... | ... | |
2001 | 2003 |
} |
2002 | 2004 |
} |
2003 | 2005 |
} |
2006 |
|
|
2007 |
private void InsertTeePSN() |
|
2008 |
{ |
|
2009 |
DataRow[] branchRows = PipeSystemNetwork.Select("Type Like '%B%'"); |
|
2010 |
bool checkF = false; |
|
2011 |
foreach (DataRow dataRow in branchRows) |
|
2012 |
{ |
|
2013 |
checkF = false; |
|
2014 |
try |
|
2015 |
{ |
|
2016 |
PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString()); |
|
2017 |
bool change = false; |
|
2018 |
|
|
2019 |
if (PSNItem.StartType == PSNType.Branch) |
|
2020 |
{ |
|
2021 |
change = true; |
|
2022 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
2023 |
int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()); |
|
2024 |
Item item = PSNItem.Groups.First().Items.First(); |
|
2025 |
try |
|
2026 |
{ |
|
2027 |
if (item.ItemType == ItemType.Line) |
|
2028 |
{ |
|
2029 |
if (pathItemRows.First().Field<string>("SubClass") != "Tee") |
|
2030 |
{ |
|
2031 |
PathItems.Rows.InsertAt(createTeeRow(pathItemRows.First()), insertIndex); |
|
2032 |
checkF = true; |
|
2033 |
} |
|
2034 |
|
|
2035 |
} |
|
2036 |
} |
|
2037 |
catch (Exception ex) |
|
2038 |
{ |
|
2039 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
2040 |
return; |
|
2041 |
} |
|
2042 |
} |
|
2043 |
|
|
2044 |
if (PSNItem.EndType == PSNType.Branch) |
|
2045 |
{ |
|
2046 |
change = true; |
|
2047 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
2048 |
int insertIndex = 0; |
|
2049 |
|
|
2050 |
if (!checkF) |
|
2051 |
insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1; |
|
2052 |
else |
|
2053 |
insertIndex = pathItemRows.Count() - 1; |
|
2054 |
|
|
2055 |
//if(checkF) |
|
2056 |
|
|
2057 |
|
|
2058 |
Item item = PSNItem.Groups.Last().Items.Last(); |
|
2059 |
try |
|
2060 |
{ |
|
2061 |
if (item.ItemType == ItemType.Line) |
|
2062 |
{ |
|
2063 |
if (pathItemRows.Last().Field<string>("SubClass") != "Tee") |
|
2064 |
PathItems.Rows.InsertAt(createTeeRow(pathItemRows.Last()), insertIndex + 1); |
|
2065 |
} |
|
2066 |
} |
|
2067 |
catch (Exception ex) |
|
2068 |
{ |
|
2069 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
2070 |
return; |
|
2071 |
} |
|
2072 |
} |
|
2073 |
|
|
2074 |
if (change) |
|
2075 |
{ |
|
2076 |
int rowIndex = 0; |
|
2077 |
for (int i = 0; i < PathItems.Rows.Count; i++) |
|
2078 |
{ |
|
2079 |
DataRow row = PathItems.Rows[i]; |
|
2080 |
if (row["PipeSystemNetwork_OID"].ToString() != dataRow["OID"].ToString()) |
|
2081 |
continue; |
|
2082 |
string sequenceData = row["SequenceData_OID"].ToString(); |
|
2083 |
string[] split = sequenceData.Split(new char[] { '_' }); |
|
2084 |
|
|
2085 |
StringBuilder sb = new StringBuilder(); |
|
2086 |
for (int j = 0; j < split.Length - 1; j++) |
|
2087 |
sb.Append(split[j] + "_"); |
|
2088 |
sb.Append(rowIndex++); |
|
2089 |
row["SequenceData_OID"] = sb.ToString(); |
|
2090 |
|
|
2091 |
DataRow seqItemRows = SequenceData.Select(string.Format("PathItem_OID = '{0}'", row["OID"])).FirstOrDefault(); |
|
2092 |
int insertSeqIndex = SequenceData.Rows.IndexOf(seqItemRows); |
|
2093 |
|
|
2094 |
string[] splitseq = sb.ToString().Split(new char[] { '_' }); |
|
2095 |
|
|
2096 |
if (seqItemRows == null) |
|
2097 |
{ |
|
2098 |
DataRow newRow = SequenceData.NewRow(); |
|
2099 |
newRow["OID"] = sb.ToString(); |
|
2100 |
newRow["SERIALNUMBER"] = splitseq[splitseq.Length - 1]; |
|
2101 |
newRow["PathItem_OID"] = row["OID"]; |
|
2102 |
newRow["TopologySet_OID_Key"] = row["TopologySet_OID"]; |
|
2103 |
SequenceData.Rows.InsertAt(newRow, Convert.ToInt32(splitseq[splitseq.Length - 1])); |
|
2104 |
} |
|
2105 |
else |
|
2106 |
{ |
|
2107 |
seqItemRows["OID"] = sb.ToString(); |
|
2108 |
seqItemRows["SERIALNUMBER"] = splitseq[splitseq.Length - 1]; |
|
2109 |
seqItemRows["PathItem_OID"] = row["OID"]; |
|
2110 |
seqItemRows["TopologySet_OID_Key"] = row["TopologySet_OID"]; |
|
2111 |
} |
|
2112 |
} |
|
2113 |
} |
|
2114 |
|
|
2115 |
DataRow createTeeRow(DataRow itemRow) |
|
2116 |
{ |
|
2117 |
DataRow newRow = PathItems.NewRow(); |
|
2118 |
newRow["OID"] = Guid.NewGuid().ToString(); |
|
2119 |
newRow["SequenceData_OID"] = itemRow["SequenceData_OID"]; |
|
2120 |
newRow["TopologySet_OID"] = itemRow["TopologySet_OID"]; |
|
2121 |
newRow["BranchTopologySet_OID"] = itemRow["BranchTopologySet_OID"]; |
|
2122 |
newRow["PipeLine_OID"] = itemRow["PipeLine_OID"]; |
|
2123 |
newRow["ITEMNAME"] = "Branch"; //newRow["ITEMNAME"] = "End of line terminator"; |
|
2124 |
newRow["ITEMTAG"] = itemRow["ITEMTAG"]; |
|
2125 |
newRow["DESCRIPTION"] = ""; |
|
2126 |
newRow["Class"] = "Branch"; |
|
2127 |
newRow["SubClass"] = "Tee"; |
|
2128 |
newRow["TYPE"] = itemRow["TYPE"]; |
|
2129 |
newRow["PIDNAME"] = itemRow["PIDNAME"]; |
|
2130 |
newRow["NPD"] = itemRow["NPD"]; |
|
2131 |
newRow["PipeSystemNetwork_OID"] = itemRow["PipeSystemNetwork_OID"]; |
|
2132 |
newRow["ViewPipeSystemNetwork_OID"] = itemRow["ViewPipeSystemNetwork_OID"]; |
|
2133 |
newRow["PipeRun_OID"] = itemRow["PipeRun_OID"]; |
|
2134 |
|
|
2135 |
return newRow; |
|
2136 |
} |
|
2137 |
} |
|
2138 |
catch (Exception ex) |
|
2139 |
{ |
|
2140 |
|
|
2141 |
} |
|
2142 |
} |
|
2143 |
} |
|
2004 | 2144 |
} |
2005 | 2145 |
|
2006 | 2146 |
public class PSNItem |
내보내기 Unified diff