개정판 bd86dd48
issue #000: Setting Secondary 조건 수정, Header Rule 로직 수정, tieinpoint 로직 수정
Change-Id: I84ad7e4f5784ca7a0886e8900f2526f8d034e81a
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
36 | 36 |
private double DrawingHeight = double.NaN; |
37 | 37 |
public int Revision; |
38 | 38 |
public string EquipTagNoAttributeName = string.Empty; |
39 |
public string TieInPointAttributeName = string.Empty; |
|
39 | 40 |
public DataTable PathItems { get; set; } |
40 | 41 |
public DataTable SequenceData { get; set; } |
41 | 42 |
public DataTable PipeSystemNetwork { get; set; } |
... | ... | |
52 | 53 |
public string Rule5 = "Line Disconnected"; |
53 | 54 |
|
54 | 55 |
int tieInPointIndex = 1; |
55 |
|
|
56 |
int tieInPointSymbolIndex = 1; |
|
56 | 57 |
List<Document> Documents; |
57 | 58 |
List<Group> groups = new List<Group>(); |
58 | 59 |
List<PSNItem> PSNItems = new List<PSNItem>(); |
... | ... | |
1501 | 1502 |
|
1502 | 1503 |
} |
1503 | 1504 |
|
1504 |
|
|
1505 |
// //if (item.Document.MissingLineNumber1) |
|
1506 |
// // item.MissingLineNumber1 = true; |
|
1507 |
// //else if (item.Document.MissingLineNumber2) |
|
1508 |
// // item.MissingLineNumber2 = true; |
|
1509 |
//} |
|
1510 | 1505 |
} |
1506 |
else |
|
1507 |
{ |
|
1508 |
|
|
1509 |
} |
|
1510 |
|
|
1511 | 1511 |
} |
1512 | 1512 |
} |
1513 | 1513 |
|
... | ... | |
1553 | 1553 |
foreach (Group group in groups.FindAll(x => x.Items.Last().SubItemType == SubItemType.OPC)) |
1554 | 1554 |
{ |
1555 | 1555 |
Item opcItem = group.Items.Last(); |
1556 |
DataRow[] fromRows = opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID)); |
|
1557 |
if (fromRows.Length.Equals(1)) |
|
1556 |
if(opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID)) != null) |
|
1558 | 1557 |
{ |
1559 |
DataRow opcRow = fromRows.First(); |
|
1560 |
string toDrawing = opcRow["ToDrawing"].ToString(); |
|
1561 |
string toOPCUID = opcRow["ToOPCUID"].ToString(); |
|
1562 |
|
|
1563 |
Document toDocument = Documents.Find(x => x.DrawingName == toDrawing); |
|
1564 |
if (toDocument != null) |
|
1558 |
DataRow[] fromRows = opcDT.Select(string.Format("FromOPCUID = '{0}'", opcItem.UID)); |
|
1559 |
if (fromRows.Length.Equals(1)) |
|
1565 | 1560 |
{ |
1566 |
Group toGroup = toDocument.Groups.Find(x => x.Items.Find(y => y.UID == toOPCUID) != null); |
|
1567 |
DataRow[] toRows = opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID)); |
|
1568 |
//1대1 매칭이 아닐때 걸림 (2개 이상일 때) 2021.11.07 |
|
1569 |
if (toRows.Length > 1) |
|
1561 |
DataRow opcRow = fromRows.First(); |
|
1562 |
string toDrawing = opcRow["ToDrawing"].ToString(); |
|
1563 |
string toOPCUID = opcRow["ToOPCUID"].ToString(); |
|
1564 |
|
|
1565 |
Document toDocument = Documents.Find(x => x.DrawingName == toDrawing); |
|
1566 |
if (toDocument != null) |
|
1570 | 1567 |
{ |
1571 |
//throw new Exception("OPC error(multi connect)"); |
|
1572 |
MessageBox.Show("OPC error(multi connect)", "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
1573 |
return; |
|
1568 |
Group toGroup = toDocument.Groups.Find(x => x.Items.Find(y => y.UID == toOPCUID) != null); |
|
1569 |
|
|
1570 |
if (toGroup != null && opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID)) != null) |
|
1571 |
{ |
|
1572 |
DataRow[] toRows = opcDT.Select(string.Format("ToOPCUID = '{0}'", toGroup.Items.First().UID)); |
|
1573 |
//1대1 매칭이 아닐때 걸림 (2개 이상일 때) 2021.11.07 |
|
1574 |
if (toRows.Length > 1) |
|
1575 |
{ |
|
1576 |
//throw new Exception("OPC error(multi connect)"); |
|
1577 |
MessageBox.Show("OPC error(multi connect)", "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
1578 |
return; |
|
1579 |
} |
|
1580 |
group.EndGroup = toGroup; |
|
1581 |
toGroup.StartGroup = group; |
|
1582 |
} |
|
1583 |
|
|
1574 | 1584 |
} |
1575 |
group.EndGroup = toGroup; |
|
1576 |
toGroup.StartGroup = group; |
|
1577 | 1585 |
} |
1578 |
} |
|
1586 |
}
|
|
1579 | 1587 |
} |
1580 | 1588 |
} |
1581 | 1589 |
catch (Exception ex) |
... | ... | |
1718 | 1726 |
else if (item.SubItemType == SubItemType.OPC) |
1719 | 1727 |
type = PSNType.OPC; |
1720 | 1728 |
} |
1729 |
else |
|
1730 |
{ |
|
1731 |
|
|
1732 |
} |
|
1721 | 1733 |
|
1722 | 1734 |
return type; |
1723 | 1735 |
} |
... | ... | |
1795 | 1807 |
PSNItem.Topologies.Add(topology); |
1796 | 1808 |
} |
1797 | 1809 |
} |
1810 |
if (topology == null) |
|
1811 |
{ |
|
1798 | 1812 |
|
1813 |
} |
|
1799 | 1814 |
item.Topology = topology; |
1800 | 1815 |
topology.Items.Add(item); |
1801 | 1816 |
} |
1802 | 1817 |
} |
1803 | 1818 |
} |
1819 |
|
|
1804 | 1820 |
} |
1805 | 1821 |
#endregion |
1806 | 1822 |
|
... | ... | |
2038 | 2054 |
|
2039 | 2055 |
private void SaveNozzleAndEquipment() |
2040 | 2056 |
{ |
2057 |
Dictionary<string, int> globalNozzleCount = new Dictionary<string, int>(); |
|
2058 |
|
|
2041 | 2059 |
List<Item> nozzles = new List<Item>(); |
2042 | 2060 |
List<Equipment> equipments = new List<Equipment>(); |
2043 | 2061 |
foreach (Document document in Documents) |
... | ... | |
2046 | 2064 |
equipments.AddRange(document.Equipments); |
2047 | 2065 |
} |
2048 | 2066 |
|
2067 |
DataTable equipDT = new DataTable(); |
|
2068 |
equipDT.Columns.Add("OID", typeof(string)); |
|
2069 |
equipDT.Columns.Add("ITEMTAG", typeof(string)); |
|
2070 |
equipDT.Columns.Add("XCOORDS", typeof(string)); |
|
2071 |
equipDT.Columns.Add("YCOORDS", typeof(string)); |
|
2072 |
|
|
2073 |
foreach (Equipment equipment in equipments) |
|
2074 |
{ |
|
2075 |
DataRow row = equipDT.NewRow(); |
|
2076 |
row["OID"] = equipment.UID; |
|
2077 |
if (!string.IsNullOrEmpty(EquipTagNoAttributeName)) |
|
2078 |
{ |
|
2079 |
Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName); |
|
2080 |
if (attribute != null && attribute.Value != "None") |
|
2081 |
equipment.ItemTag = attribute.Value; |
|
2082 |
else |
|
2083 |
{ |
|
2084 |
equipment.ItemTag = equipment.Name; |
|
2085 |
} |
|
2086 |
} |
|
2087 |
else |
|
2088 |
equipment.ItemTag = equipment.Name; |
|
2089 |
|
|
2090 |
if (!string.IsNullOrEmpty(equipment.ItemTag)) |
|
2091 |
{ |
|
2092 |
if (!globalNozzleCount.ContainsKey(equipment.ItemTag)) |
|
2093 |
{ |
|
2094 |
globalNozzleCount[equipment.ItemTag] = 0; |
|
2095 |
} |
|
2096 |
} |
|
2097 |
|
|
2098 |
row["ITEMTAG"] = equipment.ItemTag; |
|
2099 |
List<double> xList = equipment.POINT.Select(x => x[0]).ToList(); |
|
2100 |
row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth; |
|
2101 |
|
|
2102 |
List<double> yList = equipment.POINT.Select(x => x[1]).ToList(); |
|
2103 |
row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight; |
|
2104 |
|
|
2105 |
equipDT.Rows.Add(row); |
|
2106 |
} |
|
2049 | 2107 |
|
2050 | 2108 |
DataTable nozzleDT = new DataTable(); |
2051 | 2109 |
nozzleDT.Columns.Add("OID", typeof(string)); |
... | ... | |
2069 | 2127 |
{ |
2070 | 2128 |
Equipment equipment = equipments.Find(x => x.UID == relation.UID); |
2071 | 2129 |
equipment.Nozzles.Add(item); |
2072 |
row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", equipment.Nozzles.Count + 100)); |
|
2130 |
//row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", equipment.Nozzles.Count + 100)); |
|
2131 |
|
|
2132 |
int nozzleCount = equipment.Nozzles.Count; |
|
2133 |
if (globalNozzleCount.ContainsKey(equipment.ItemTag)) |
|
2134 |
{ |
|
2135 |
nozzleCount = globalNozzleCount[equipment.ItemTag]; |
|
2136 |
} |
|
2137 |
row["ITEMTAG"] = string.Format("N{0}", string.Format("{0:D3}", nozzleCount + 100)); |
|
2138 |
if (globalNozzleCount.ContainsKey(equipment.ItemTag)) |
|
2139 |
{ |
|
2140 |
globalNozzleCount[equipment.ItemTag] += 1; |
|
2141 |
} |
|
2142 |
|
|
2073 | 2143 |
row["Equipment_OID"] = equipment.UID; |
2074 | 2144 |
item.Equipment = equipment; |
2075 | 2145 |
} |
... | ... | |
2097 | 2167 |
nozzleDT.Rows.Add(row); |
2098 | 2168 |
} |
2099 | 2169 |
|
2100 |
DataTable equipDT = new DataTable(); |
|
2101 |
equipDT.Columns.Add("OID", typeof(string)); |
|
2102 |
equipDT.Columns.Add("ITEMTAG", typeof(string)); |
|
2103 |
equipDT.Columns.Add("XCOORDS", typeof(string)); |
|
2104 |
equipDT.Columns.Add("YCOORDS", typeof(string)); |
|
2105 |
|
|
2106 |
foreach (Equipment equipment in equipments) |
|
2107 |
{ |
|
2108 |
DataRow row = equipDT.NewRow(); |
|
2109 |
row["OID"] = equipment.UID; |
|
2110 |
if (!string.IsNullOrEmpty(EquipTagNoAttributeName)) |
|
2111 |
{ |
|
2112 |
Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName); |
|
2113 |
if (attribute != null) |
|
2114 |
equipment.ItemTag = attribute.Value; |
|
2115 |
} |
|
2116 |
else |
|
2117 |
equipment.ItemTag = equipment.Name; |
|
2118 |
|
|
2119 |
row["ITEMTAG"] = equipment.ItemTag; |
|
2120 |
List<double> xList = equipment.POINT.Select(x => x[0]).ToList(); |
|
2121 |
row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth; |
|
2122 |
|
|
2123 |
List<double> yList = equipment.POINT.Select(x => x[1]).ToList(); |
|
2124 |
row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight; |
|
2125 |
|
|
2126 |
equipDT.Rows.Add(row); |
|
2127 |
} |
|
2170 |
//DataTable equipDT = new DataTable();
|
|
2171 |
//equipDT.Columns.Add("OID", typeof(string));
|
|
2172 |
//equipDT.Columns.Add("ITEMTAG", typeof(string));
|
|
2173 |
//equipDT.Columns.Add("XCOORDS", typeof(string));
|
|
2174 |
//equipDT.Columns.Add("YCOORDS", typeof(string));
|
|
2175 |
|
|
2176 |
//foreach (Equipment equipment in equipments)
|
|
2177 |
//{
|
|
2178 |
// DataRow row = equipDT.NewRow();
|
|
2179 |
// row["OID"] = equipment.UID;
|
|
2180 |
// if (!string.IsNullOrEmpty(EquipTagNoAttributeName))
|
|
2181 |
// {
|
|
2182 |
// Attribute attribute = equipment.Attributes.Find(x => x.Name == EquipTagNoAttributeName);
|
|
2183 |
// if (attribute != null)
|
|
2184 |
// equipment.ItemTag = attribute.Value;
|
|
2185 |
// }
|
|
2186 |
// else
|
|
2187 |
// equipment.ItemTag = equipment.Name;
|
|
2188 |
|
|
2189 |
// row["ITEMTAG"] = equipment.ItemTag;
|
|
2190 |
// List<double> xList = equipment.POINT.Select(x => x[0]).ToList();
|
|
2191 |
// row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth;
|
|
2192 |
|
|
2193 |
// List<double> yList = equipment.POINT.Select(x => x[1]).ToList();
|
|
2194 |
// row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight;
|
|
2195 |
|
|
2196 |
// equipDT.Rows.Add(row);
|
|
2197 |
//}
|
|
2128 | 2198 |
|
2129 | 2199 |
Equipment = equipDT; |
2130 | 2200 |
Nozzle = nozzleDT; |
... | ... | |
2475 | 2545 |
newRow["Equipment_OID"] = item.Equipment != null ? item.Equipment.UID : ""; |
2476 | 2546 |
} |
2477 | 2547 |
|
2548 |
//string topologyFullName = |
|
2549 |
|
|
2478 | 2550 |
newRow["OID"] = itemOID; |
2479 | 2551 |
newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index); |
2480 | 2552 |
newRow["TopologySet_OID"] = item.Topology.FullName; |
2481 | 2553 |
newRow["BranchTopologySet_OID"] = branchTopologyName; |
2482 | 2554 |
newRow["PipeLine_OID"] = item.PSNPipeLineID; |
2483 |
newRow["ITEMNAME"] = GetItemName(item, itemOID); |
|
2484 |
newRow["ITEMTAG"] = GetItemTag(item); |
|
2485 |
newRow["Class"] = GetClass(item, itemOID); |
|
2486 |
string subClass = GetSubClass(item, itemOID); |
|
2487 |
newRow["SubClass"] = subClass; |
|
2488 |
|
|
2489 |
if (item.ItemType == ItemType.Symbol) |
|
2490 |
newRow["TYPE"] = item.ID2DBName; |
|
2491 |
else if (item.ItemType == ItemType.Line) |
|
2492 |
newRow["TYPE"] = item.ID2DBType; |
|
2555 |
|
|
2556 |
if (item.ItemType != ID2PSN.ItemType.Line && item.ID2DBName.ToUpper().Equals("TIEINPOINT")) |
|
2557 |
{ |
|
2558 |
|
|
2559 |
newRow["ITEMNAME"] = "PipingComp"; |
|
2560 |
if (!string.IsNullOrEmpty(TieInPointAttributeName)) |
|
2561 |
newRow["ITEMTAG"] = string.Format("TIEINPOINT_{0:D3}V", tieInPointSymbolIndex); |
|
2562 |
else |
|
2563 |
newRow["ITEMTAG"] = item.Attributes.Find(x => x.Name == TieInPointAttributeName).Value; |
|
2564 |
|
|
2565 |
newRow["Class"] = "In-Line Fitting"; |
|
2566 |
newRow["SubClass"] = ""; |
|
2567 |
newRow["TYPE"] = "End"; |
|
2568 |
tieInPointSymbolIndex++; |
|
2569 |
} |
|
2570 |
else |
|
2571 |
{ |
|
2572 |
newRow["ITEMNAME"] = GetItemName(item, itemOID); |
|
2573 |
newRow["ITEMTAG"] = GetItemTag(item); |
|
2574 |
newRow["Class"] = GetClass(item, itemOID); |
|
2575 |
string subClass = GetSubClass(item, itemOID); |
|
2576 |
newRow["SubClass"] = subClass; |
|
2577 |
|
|
2578 |
if (item.ItemType == ItemType.Symbol) |
|
2579 |
newRow["TYPE"] = item.ID2DBName; |
|
2580 |
else if (item.ItemType == ItemType.Line) |
|
2581 |
newRow["TYPE"] = item.ID2DBType; |
|
2582 |
} |
|
2583 |
|
|
2584 |
|
|
2585 |
|
|
2493 | 2586 |
newRow["PIDNAME"] = group.Document.DrawingName; |
2494 | 2587 |
|
2495 | 2588 |
// NPD |
... | ... | |
2999 | 3092 |
|
3000 | 3093 |
List<Relation> relations = new List<Relation>(); |
3001 | 3094 |
|
3002 |
if (firstItem.Relations.FindAll(x => x.Item == null).Count() != 0) |
|
3003 |
relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID)); |
|
3095 |
if (firstItem.Relations.FindAll(x => x.Item == null).Count() != 0 && firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID) != null )
|
|
3096 |
relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID));
|
|
3004 | 3097 |
|
3005 |
if (lastItem.Relations.FindAll(x => x.Item == null).Count() != 0) |
|
3006 |
relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID)); |
|
3098 |
if (lastItem.Relations.FindAll(x => x.Item == null).Count() != 0 && lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID) != null)
|
|
3099 |
relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology != null && x.Item.Topology.ID != topology.ID));
|
|
3007 | 3100 |
|
3008 | 3101 |
if (relations.Count > 0) |
3009 | 3102 |
rows.First()["SubType"] = "OtherSystem"; |
... | ... | |
3259 | 3352 |
bool bCheck = false; |
3260 | 3353 |
if (!PSNItem.EnableType(PSNItem.StartType)) |
3261 | 3354 |
{ |
3262 |
change = true; |
|
3263 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
3264 |
int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()); |
|
3265 |
|
|
3266 |
Item item = PSNItem.Groups.First().Items.First(); |
|
3267 |
try |
|
3268 |
{ |
|
3269 |
string FROM_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex); |
|
3355 |
//if(!PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])).First().Field<string>("ItemTag").Contains("TIEINPOINT")) |
|
3356 |
//{ |
|
3357 |
change = true; |
|
3358 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
3359 |
int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()); |
|
3270 | 3360 |
|
3271 |
foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID()))) |
|
3361 |
Item item = PSNItem.Groups.First().Items.First(); |
|
3362 |
try |
|
3272 | 3363 |
{ |
3273 |
loopRow["FROM_DATA"] = FROM_DATA; |
|
3274 |
if (item.ItemType == ItemType.Line) |
|
3364 |
string FROM_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex); |
|
3365 |
|
|
3366 |
foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID()))) |
|
3275 | 3367 |
{ |
3276 |
if (loopRow.Field<string>("OrderNumber") == "0") |
|
3368 |
loopRow["FROM_DATA"] = FROM_DATA; |
|
3369 |
if (item.ItemType == ItemType.Line) |
|
3277 | 3370 |
{ |
3278 |
string status = loopRow.Field<string>("Status"); |
|
3279 |
//string isvali |
|
3280 |
if (string.IsNullOrEmpty(status)) |
|
3281 |
status = "Line Disconnected"; |
|
3282 |
else if (!status.Contains("Line Disconnected")) |
|
3283 |
status += ", Line Disconnected"; |
|
3284 |
loopRow["Status"] = status; |
|
3285 |
if (!string.IsNullOrEmpty(status)) |
|
3286 |
loopRow["IsValid"] = "Error"; |
|
3371 |
if (loopRow.Field<string>("OrderNumber") == "0") |
|
3372 |
{ |
|
3373 |
string status = loopRow.Field<string>("Status"); |
|
3374 |
//string isvali |
|
3375 |
if (string.IsNullOrEmpty(status)) |
|
3376 |
status = "Line Disconnected"; |
|
3377 |
else if (!status.Contains("Line Disconnected")) |
|
3378 |
status += ", Line Disconnected"; |
|
3379 |
loopRow["Status"] = status; |
|
3380 |
if (!string.IsNullOrEmpty(status)) |
|
3381 |
loopRow["IsValid"] = "Error"; |
|
3382 |
} |
|
3287 | 3383 |
} |
3288 | 3384 |
} |
3289 |
} |
|
3290 | 3385 |
|
3291 |
tieInPointIndex++; |
|
3386 |
tieInPointIndex++;
|
|
3292 | 3387 |
|
3293 |
if (item.ItemType == ItemType.Line) |
|
3294 |
{ |
|
3295 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex); |
|
3388 |
if (item.ItemType == ItemType.Line) |
|
3389 |
{ |
|
3390 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex); |
|
3391 |
} |
|
3392 |
else |
|
3393 |
{ |
|
3394 |
PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex); |
|
3395 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex); |
|
3396 |
|
|
3397 |
bCheck = true; |
|
3398 |
} |
|
3399 |
|
|
3400 |
PSNItem.StartType = PSNType.Equipment; |
|
3296 | 3401 |
} |
3297 |
else
|
|
3402 |
catch (Exception ex)
|
|
3298 | 3403 |
{ |
3299 |
PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex); |
|
3300 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex); |
|
3301 |
|
|
3302 |
bCheck = true; |
|
3404 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
3405 |
return; |
|
3303 | 3406 |
} |
3304 |
|
|
3305 |
PSNItem.StartType = PSNType.Equipment; |
|
3306 |
} |
|
3307 |
catch (Exception ex) |
|
3308 |
{ |
|
3309 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
3310 |
return; |
|
3311 |
} |
|
3407 |
//} |
|
3312 | 3408 |
} |
3313 | 3409 |
|
3314 | 3410 |
if (!PSNItem.EnableType(PSNItem.EndType)) |
3315 |
{ |
|
3316 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
3317 |
//int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1; |
|
3318 |
DataRow dr = pathItemRows.Last(); |
|
3319 |
if (change) |
|
3320 |
{ |
|
3321 |
if(bCheck) |
|
3322 |
dr = pathItemRows[pathItemRows.Count() - 3]; |
|
3323 |
else |
|
3411 |
{ |
|
3412 |
//if (!PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])).Last().Field<string>("ItemTag").Contains("TIEINPOINT")) |
|
3413 |
//{ |
|
3414 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"])); |
|
3415 |
//int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1; |
|
3416 |
DataRow dr = pathItemRows.Last(); |
|
3417 |
if (change) |
|
3324 | 3418 |
{ |
3325 |
dr = pathItemRows[pathItemRows.Count() - 2]; |
|
3419 |
if (bCheck) |
|
3420 |
dr = pathItemRows[pathItemRows.Count() - 3]; |
|
3421 |
else |
|
3422 |
{ |
|
3423 |
dr = pathItemRows[pathItemRows.Count() - 2]; |
|
3424 |
} |
|
3326 | 3425 |
} |
3327 |
} |
|
3328 |
|
|
3329 |
change = true; |
|
3330 |
int insertIndex = PathItems.Rows.IndexOf(dr) + 1; |
|
3331 | 3426 |
|
3332 |
Item item = PSNItem.Groups.Last().Items.Last(); |
|
3333 |
try |
|
3334 |
{ |
|
3335 |
string TO_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex); |
|
3427 |
change = true; |
|
3428 |
int insertIndex = PathItems.Rows.IndexOf(dr) + 1; |
|
3336 | 3429 |
|
3337 |
|
|
3338 |
foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
|
|
3430 |
Item item = PSNItem.Groups.Last().Items.Last(); |
|
3431 |
try
|
|
3339 | 3432 |
{ |
3340 |
loopRow["TO_DATA"] = TO_DATA; |
|
3341 |
if (item.ItemType == ItemType.Line) |
|
3433 |
string TO_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex); |
|
3434 |
|
|
3435 |
|
|
3436 |
foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID()))) |
|
3342 | 3437 |
{ |
3343 |
if (loopRow.Field<string>("OrderNumber") == Convert.ToString(PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())).Count() - 1)) |
|
3438 |
loopRow["TO_DATA"] = TO_DATA; |
|
3439 |
if (item.ItemType == ItemType.Line) |
|
3344 | 3440 |
{ |
3345 |
string status = loopRow.Field<string>("Status"); |
|
3346 |
if (string.IsNullOrEmpty(status)) |
|
3347 |
status = "Line Disconnected"; |
|
3348 |
else if (!status.Contains("Line Disconnected")) |
|
3349 |
status += ", Line Disconnected"; |
|
3350 |
loopRow["Status"] = status; |
|
3351 |
if (!string.IsNullOrEmpty(status)) |
|
3352 |
loopRow["IsValid"] = "Error"; |
|
3441 |
if (loopRow.Field<string>("OrderNumber") == Convert.ToString(PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())).Count() - 1)) |
|
3442 |
{ |
|
3443 |
string status = loopRow.Field<string>("Status"); |
|
3444 |
if (string.IsNullOrEmpty(status)) |
|
3445 |
status = "Line Disconnected"; |
|
3446 |
else if (!status.Contains("Line Disconnected")) |
|
3447 |
status += ", Line Disconnected"; |
|
3448 |
loopRow["Status"] = status; |
|
3449 |
if (!string.IsNullOrEmpty(status)) |
|
3450 |
loopRow["IsValid"] = "Error"; |
|
3451 |
} |
|
3353 | 3452 |
} |
3453 |
|
|
3354 | 3454 |
} |
3355 | 3455 |
|
3356 |
}
|
|
3456 |
tieInPointIndex++;
|
|
3357 | 3457 |
|
3358 |
tieInPointIndex++; |
|
3458 |
if (item.ItemType == ItemType.Line) |
|
3459 |
{ |
|
3460 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex); |
|
3461 |
} |
|
3462 |
else |
|
3463 |
{ |
|
3464 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex); |
|
3465 |
PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Last()), insertIndex); |
|
3359 | 3466 |
|
3360 |
if (item.ItemType == ItemType.Line)
|
|
3361 |
{ |
|
3362 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex);
|
|
3467 |
}
|
|
3468 |
|
|
3469 |
PSNItem.EndType = PSNType.Equipment;
|
|
3363 | 3470 |
} |
3364 |
else
|
|
3471 |
catch (Exception ex)
|
|
3365 | 3472 |
{ |
3366 |
PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.Last(), TO_DATA), insertIndex); |
|
3367 |
if(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Count() > 0) |
|
3368 |
PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Last()), insertIndex); |
|
3369 |
|
|
3473 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
3474 |
return; |
|
3370 | 3475 |
} |
3371 |
|
|
3372 |
PSNItem.EndType = PSNType.Equipment; |
|
3373 |
} |
|
3374 |
catch (Exception ex) |
|
3375 |
{ |
|
3376 |
MessageBox.Show("Please check the item.\r\nDrawingName : " + item.Document.DrawingName + "\r\nUID : " + item.UID, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
3377 |
return; |
|
3378 |
} |
|
3476 |
//} |
|
3379 | 3477 |
} |
3380 | 3478 |
|
3381 | 3479 |
dataRow["Type"] = PSNItem.GetPSNType(); |
... | ... | |
3449 | 3547 |
newRow["OID"] = Guid.NewGuid().ToString(); |
3450 | 3548 |
newRow["SequenceData_OID"] = itemRow["SequenceData_OID"]; |
3451 | 3549 |
newRow["TopologySet_OID"] = itemRow["TopologySet_OID"]; |
3452 |
newRow["BranchTopologySet_OID"] = itemRow["BranchTopologySet_OID"];
|
|
3550 |
newRow["BranchTopologySet_OID"] = "";
|
|
3453 | 3551 |
newRow["PipeLine_OID"] = itemRow["PipeLine_OID"]; |
3454 |
newRow["ITEMNAME"] = itemRow["ITEMNAME"];
|
|
3455 |
newRow["ITEMTAG"] = itemRow["ITEMTAG"];
|
|
3456 |
newRow["Class"] = itemRow["Class"];
|
|
3457 |
newRow["SubClass"] = itemRow["SubClass"];
|
|
3458 |
newRow["TYPE"] = itemRow["TYPE"];
|
|
3552 |
newRow["ITEMNAME"] = "PipeRun";
|
|
3553 |
newRow["ITEMTAG"] = itemRow["PipeRun_OID"];
|
|
3554 |
newRow["Class"] = "Piping";
|
|
3555 |
newRow["SubClass"] = "";
|
|
3556 |
newRow["TYPE"] = "Secondary";
|
|
3459 | 3557 |
newRow["PIDNAME"] = itemRow["PIDNAME"]; |
3460 | 3558 |
newRow["NPD"] = itemRow["NPD"]; |
3461 | 3559 |
newRow["PipeSystemNetwork_OID"] = itemRow["PipeSystemNetwork_OID"]; |
내보내기 Unified diff