개정판 7881ec8f
dev issue #000 : add
Change-Id: I36938467c8d357f79b0414501a13dcedddcddc29
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
5 | 5 |
using System.Linq; |
6 | 6 |
using System.Text; |
7 | 7 |
using System.Threading.Tasks; |
8 |
using ID2PSN.Properties; |
|
9 |
using System.Text.RegularExpressions; |
|
8 | 10 |
|
9 | 11 |
namespace ID2PSN |
10 | 12 |
{ |
... | ... | |
71 | 73 |
|
72 | 74 |
return result; |
73 | 75 |
} |
76 |
private string GetItemName(Item item, string itemOID) |
|
77 |
{ |
|
78 |
string result = string.Empty; |
|
79 |
if (item.ItemType == ItemType.Line && (item.Name == "Secondary" || item.Name == "Primary")) |
|
80 |
{ |
|
81 |
if (itemOID.Contains("_")) |
|
82 |
{ |
|
83 |
string split = itemOID.Split(new char[] { '_' })[1]; |
|
84 |
if (split.StartsWith("B")) |
|
85 |
result = "Branch"; |
|
86 |
else |
|
87 |
result = "PipeRun"; |
|
88 |
} |
|
89 |
else |
|
90 |
result = "PipeRun"; |
|
91 |
} |
|
92 |
else if (item.ItemType == ItemType.Symbol) |
|
93 |
{ |
|
94 |
if (item.ID2DBCategory == "Instrumentation") |
|
95 |
result = "Instrument"; |
|
96 |
else if (item.ID2DBType == "Nozzles") |
|
97 |
result = "Nozzle"; |
|
98 |
else if (item.ID2DBType == "Fittings" || |
|
99 |
item.ID2DBType == "Piping OPC's" || |
|
100 |
item.ID2DBType == "Specialty Components" || |
|
101 |
item.ID2DBType == "Valves" || |
|
102 |
item.ID2DBType == "Reducers") |
|
103 |
result = "PipingComp"; |
|
104 |
} |
|
105 |
return result; |
|
106 |
} |
|
107 |
|
|
108 |
private string GetClass(Item item, string itemOID) |
|
109 |
{ |
|
110 |
string result = string.Empty; |
|
111 |
if (item.ItemType == ItemType.Line && (item.Name == "Secondary" || item.Name == "Primary")) |
|
112 |
{ |
|
113 |
if (itemOID.Contains("_")) |
|
114 |
{ |
|
115 |
string split = itemOID.Split(new char[] { '_' })[1]; |
|
116 |
if (split.StartsWith("B")) |
|
117 |
result = "Branch"; |
|
118 |
else |
|
119 |
result = "Piping"; |
|
120 |
} |
|
121 |
else |
|
122 |
result = "Piping"; |
|
123 |
} |
|
124 |
else if (item.ItemType == ItemType.Symbol) |
|
125 |
{ |
|
126 |
if (item.ID2DBCategory == "Instrumentation") |
|
127 |
result = item.ID2DBType; |
|
128 |
else if (item.ID2DBType == "Nozzles") |
|
129 |
result = string.Empty; |
|
130 |
else if (item.ID2DBType == "Fittings" || |
|
131 |
item.ID2DBType == "Piping OPC's" || |
|
132 |
item.ID2DBType == "Specialty Components" || |
|
133 |
item.ID2DBType == "Valves" || |
|
134 |
item.ID2DBType == "Reducers") |
|
135 |
result = item.ID2DBType; |
|
136 |
} |
|
137 |
return result; |
|
138 |
} |
|
139 |
|
|
140 |
private string GetSubClass(Item item, string itemOID) |
|
141 |
{ |
|
142 |
string result = string.Empty; |
|
143 |
if (item.ItemType == ItemType.Line && (item.Name == "Secondary" || item.Name == "Primary")) |
|
144 |
{ |
|
145 |
if (itemOID.Contains("_")) |
|
146 |
{ |
|
147 |
string split = itemOID.Split(new char[] { '_' })[1]; |
|
148 |
if (split.StartsWith("B")) |
|
149 |
result = "Tee"; |
|
150 |
else |
|
151 |
result = ""; |
|
152 |
} |
|
153 |
else |
|
154 |
result = ""; |
|
155 |
} |
|
156 |
else if (item.ItemType == ItemType.Symbol) |
|
157 |
{ |
|
158 |
if (item.ID2DBCategory == "Instrumentation") |
|
159 |
result = string.Empty; |
|
160 |
else if (item.ID2DBType == "Nozzles") |
|
161 |
result = string.Empty; |
|
162 |
else if (item.ID2DBType == "Fittings" || |
|
163 |
item.ID2DBType == "Piping OPC's" || |
|
164 |
item.ID2DBType == "Specialty Components" || |
|
165 |
item.ID2DBType == "Valves" || |
|
166 |
item.ID2DBType == "Reducers") |
|
167 |
result = "In-line component"; |
|
168 |
} |
|
169 |
return result; |
|
170 |
} |
|
74 | 171 |
|
75 | 172 |
public void SetPSNData() |
76 | 173 |
{ |
174 |
// Item들의 속성으로 Topology Data를 생성한다. |
|
175 |
// Topology Data는 Topology Rule Setting을 기준으로 생성한다. |
|
77 | 176 |
SetTopologyData(); |
177 |
// ID2의 OPC연결 Data 기반으로 Group(도면단위 PSN)을 연결한다. |
|
78 | 178 |
ConnectByOPC(); |
179 |
// 실제 PSN 생성 로직 |
|
180 |
// 연결된 Group을 하나의 PSN으로 만든다. |
|
79 | 181 |
SetPSNItem(); |
182 |
// 생성된 PSN의 Type을 설정한다. |
|
80 | 183 |
SetPSNType(); |
184 |
// ID2에는 Branch 정보가 없어서 Branch 정보를 생성한다. |
|
81 | 185 |
SetBranchInfo(); |
186 |
// 생성된 Topology Data들을 정리하며 Main, Branch를 판단한다. |
|
82 | 187 |
SetTopology(); |
83 |
|
|
188 |
// PSN이 Bypass인지 검사 |
|
189 |
SetPSNBypass(); |
|
190 |
// Topology들에게 Index를 부여한다 |
|
191 |
SetTopologyIndex(); |
|
192 |
|
|
193 |
// Nozzle, Equipment의 정보를 저장 |
|
84 | 194 |
SaveNozzleAndEquipment(); |
195 |
// PSN의 정보를 저장 |
|
85 | 196 |
SavePSNData(); |
86 |
|
|
87 |
UpdateBypass(); |
|
197 |
// Topology의 subtype을 update(bypass, Header, 등등) |
|
198 |
UpdateSubType(); |
|
199 |
// Update Error |
|
200 |
UpdateErrorForPSN(); |
|
88 | 201 |
} |
202 |
|
|
89 | 203 |
private void SetTopologyData() |
90 | 204 |
{ |
91 | 205 |
foreach (Document document in Documents) |
... | ... | |
231 | 345 |
PSNItem.Groups.AddRange(_groups); |
232 | 346 |
} |
233 | 347 |
|
234 |
|
|
235 | 348 |
void ChangeGroupID(string from, string to) |
236 | 349 |
{ |
237 | 350 |
if (from.Equals(to)) |
... | ... | |
383 | 496 |
// Main |
384 | 497 |
List<Topology> mainTopologies = FindMainTopology(topologies); |
385 | 498 |
foreach (Topology topology in mainTopologies) |
386 |
{ |
|
387 | 499 |
topology.Type = "M"; |
388 |
topology.Index = mainTopologies.IndexOf(topology).ToString(); |
|
389 |
} |
|
390 | 500 |
|
391 | 501 |
// Branch |
392 | 502 |
List<Topology> branchToplogies = topologies.FindAll(x => string.IsNullOrEmpty(x.Type)); |
393 | 503 |
foreach (Topology topology in branchToplogies) |
394 |
{ |
|
395 | 504 |
topology.Type = "B"; |
396 |
topology.Index = (branchToplogies.IndexOf(topology) + 1).ToString(); |
|
397 |
} |
|
398 | 505 |
} |
399 | 506 |
#endregion |
400 | 507 |
} |
508 |
private void SetTopologyIndex() |
|
509 |
{ |
|
510 |
List<string> ids = Topologies.Select(x => x.ID).Distinct().ToList(); |
|
511 |
foreach (string id in ids) |
|
512 |
{ |
|
513 |
List<Topology> topologies = Topologies.FindAll(x => x.ID == id); |
|
514 |
|
|
515 |
// Main |
|
516 |
List<Topology> mainTopologies = topologies.FindAll(x => x.Type == "M"); |
|
517 |
foreach (Topology topology in mainTopologies) |
|
518 |
topology.Index = mainTopologies.IndexOf(topology).ToString(); |
|
519 |
|
|
520 |
// Branch |
|
521 |
List<Topology> branchToplogies = topologies.FindAll(x => x.Type == "B"); |
|
522 |
foreach (Topology topology in branchToplogies) |
|
523 |
topology.Index = (branchToplogies.IndexOf(topology) + 1).ToString(); |
|
524 |
} |
|
525 |
} |
|
526 |
private void SetPSNBypass() |
|
527 |
{ |
|
528 |
foreach (PSNItem PSNItem in PSNItems) |
|
529 |
PSNItem.IsBypass = IsBypass(PSNItem); |
|
530 |
} |
|
401 | 531 |
private List<Topology> FindMainTopology(List<Topology> data) |
402 | 532 |
{ |
403 | 533 |
DataTable nominalDiameterDT = DB.SelectNominalDiameter(); |
... | ... | |
666 | 796 |
pathItemsDT.Columns.Add("PipeLine_OID", typeof(string)); |
667 | 797 |
pathItemsDT.Columns.Add("ITEMNAME", typeof(string)); |
668 | 798 |
pathItemsDT.Columns.Add("ITEMTAG", typeof(string)); |
799 |
pathItemsDT.Columns.Add("Class", typeof(string)); |
|
800 |
pathItemsDT.Columns.Add("SubClass", typeof(string)); |
|
669 | 801 |
pathItemsDT.Columns.Add("TYPE", typeof(string)); |
670 | 802 |
pathItemsDT.Columns.Add("PIDNAME", typeof(string)); |
671 | 803 |
pathItemsDT.Columns.Add("NPD", typeof(string)); |
672 | 804 |
pathItemsDT.Columns.Add("PipeSystemNetwork_OID", typeof(string)); |
805 |
pathItemsDT.Columns.Add("ViewPipeSystemNetwork_OID", typeof(string)); |
|
673 | 806 |
pathItemsDT.Columns.Add("PipeRun_OID", typeof(string)); |
674 | 807 |
|
675 | 808 |
DataTable sequenceDataDT = new DataTable(); |
... | ... | |
747 | 880 |
Item item = group.Items[i]; |
748 | 881 |
foreach (VentDrainInfo ventDrainInfo in VentDrainInfos) |
749 | 882 |
{ |
750 |
if (endInfos.Contains(ventDrainInfo)) |
|
883 |
if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count)
|
|
751 | 884 |
continue; |
752 | 885 |
if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name)) |
753 | 886 |
{ |
... | ... | |
768 | 901 |
Item item = group.Items[group.Items.Count - i - 1]; |
769 | 902 |
foreach (VentDrainInfo ventDrainInfo in VentDrainInfos) |
770 | 903 |
{ |
771 |
if (endInfos.Contains(ventDrainInfo)) |
|
904 |
if (endInfos.Contains(ventDrainInfo) || ventDrainInfo.VentDrainItems.Count != group.Items.Count)
|
|
772 | 905 |
continue; |
773 | 906 |
if (!ventDrainInfo.VentDrainItems[i].Name.Equals(item.Name)) |
774 | 907 |
{ |
... | ... | |
790 | 923 |
{ |
791 | 924 |
if (item.BranchItems.Count == 0) |
792 | 925 |
{ |
793 |
CreatePathItemsDataRow(item.UID, item.Type); |
|
926 |
CreatePathItemsDataRow(item.UID, item.ID2DBType);
|
|
794 | 927 |
CreateSequenceDataDataRow(item.UID); |
795 | 928 |
index++; |
796 | 929 |
} |
797 | 930 |
else |
798 | 931 |
{ |
799 |
CreatePathItemsDataRow(item.UID + "_L1", item.Type); |
|
932 |
CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType);
|
|
800 | 933 |
CreateSequenceDataDataRow(item.UID + "_L1"); |
801 | 934 |
index++; |
802 | 935 |
for (int i = 0; i < item.BranchItems.Count; i++) |
803 | 936 |
{ |
804 |
CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName); |
|
937 |
CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
|
|
805 | 938 |
CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1)); |
806 | 939 |
index++; |
807 | 940 |
|
808 |
CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.Type); |
|
941 |
CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType);
|
|
809 | 942 |
CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2)); |
810 | 943 |
index++; |
811 | 944 |
|
... | ... | |
832 | 965 |
psnOrder++; |
833 | 966 |
} |
834 | 967 |
} |
835 |
void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "") |
|
968 |
void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null)
|
|
836 | 969 |
{ |
837 | 970 |
DataRow newRow = pathItemsDT.NewRow(); |
838 | 971 |
newRow["OID"] = itemOID; |
... | ... | |
843 | 976 |
|
844 | 977 |
newRow["BranchTopologySet_OID"] = branchTopologyName; |
845 | 978 |
newRow["PipeLine_OID"] = item.PSNPipeLineID; |
846 |
newRow["ITEMNAME"] = null;
|
|
979 |
newRow["ITEMNAME"] = GetItemName(item, itemOID);
|
|
847 | 980 |
newRow["ITEMTAG"] = GetItemTag(item); |
981 |
newRow["Class"] = GetClass(item, itemOID); |
|
982 |
newRow["SubClass"] = GetSubClass(item, itemOID); |
|
983 |
|
|
848 | 984 |
if (item.ItemType == ItemType.Symbol) |
849 |
newRow["TYPE"] = item.Parent;
|
|
985 |
newRow["TYPE"] = item.ID2DBName;
|
|
850 | 986 |
else if (item.ItemType == ItemType.Line) |
851 |
newRow["TYPE"] = item.Type; |
|
987 |
newRow["TYPE"] = item.ID2DBType;
|
|
852 | 988 |
newRow["PIDNAME"] = group.Document.DrawingName; |
853 | 989 |
|
854 | 990 |
// NPD |
... | ... | |
862 | 998 |
newRow["NPD"] = null; |
863 | 999 |
|
864 | 1000 |
newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
1001 |
if (branchItem == null) |
|
1002 |
newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID(); |
|
1003 |
else |
|
1004 |
newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID(); |
|
1005 |
|
|
865 | 1006 |
newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty; |
866 | 1007 |
|
867 | 1008 |
pathItemsDT.Rows.Add(newRow); |
... | ... | |
891 | 1032 |
newRow["TO_DATA"] = PSNItem.GetToData(); |
892 | 1033 |
newRow["TopologySet_OID_Key"] = item.Topology.FullName; |
893 | 1034 |
newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision); |
894 |
newRow["PBS"] = null;
|
|
1035 |
newRow["PBS"] = PSNItem.GetPBSData();
|
|
895 | 1036 |
newRow["Validity"] = PSNItem.Validity; |
896 | 1037 |
newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty; |
897 | 1038 |
|
1039 |
|
|
898 | 1040 |
List<string> drawingNames = new List<string>(); |
899 | 1041 |
foreach (Group _group in PSNItem.Groups) |
900 | 1042 |
{ |
901 |
if (newRow["PBS"] == null) |
|
902 |
{ |
|
903 |
List<Item> _items = _group.Items.FindAll(x => x.Attributes.Find(y => y.Name.ToUpper() == "UNITNUMBER" && !string.IsNullOrEmpty(y.Value)) != null); |
|
904 |
foreach (Item _item in _items) |
|
905 |
{ |
|
906 |
string _value = _item.Attributes.Find(x => x.Name.ToUpper() == "UNITNUMBER").Value; |
|
907 |
newRow["PBS"] = _value; |
|
908 |
break; |
|
909 |
} |
|
910 |
} |
|
911 |
|
|
912 | 1043 |
if (!drawingNames.Contains(_group.Document.DrawingName)) |
913 | 1044 |
{ |
914 | 1045 |
if (drawingNames.Count == 0) |
... | ... | |
929 | 1060 |
newRow["OID"] = topology.FullName; |
930 | 1061 |
newRow["Type"] = topology.FullName.Split(new char[] { '-' }).Last().StartsWith("M") ? "Main" : "Branch"; |
931 | 1062 |
if (bVentDrain) |
932 |
newRow["SubType"] = "Vent/Drain";
|
|
1063 |
newRow["SubType"] = "Vent_Drain";
|
|
933 | 1064 |
else |
934 | 1065 |
newRow["SubType"] = null; |
935 | 1066 |
newRow["HeadItemTag"] = GetItemTag(topology.Items.Last()); |
... | ... | |
1004 | 1135 |
PipeSystemNetwork = pipeSystemNetworkDT; |
1005 | 1136 |
TopologySet = topologySetDT; |
1006 | 1137 |
} |
1007 |
private void UpdateBypass()
|
|
1138 |
private void UpdateSubType()
|
|
1008 | 1139 |
{ |
1009 | 1140 |
foreach (PSNItem PSNItem in PSNItems) |
1010 | 1141 |
{ |
1011 |
if (PSNItem.GetPSNType() == "B2B")
|
|
1142 |
if (PSNItem.IsBypass)
|
|
1012 | 1143 |
{ |
1013 |
bool bChange = false; |
|
1014 |
Group firstGroup = PSNItem.Groups.First(); |
|
1015 |
Group lastGroup = PSNItem.Groups.Last(); |
|
1016 |
Item firstItem = firstGroup.Items.First(); |
|
1017 |
Item lastItem = lastGroup.Items.Last(); |
|
1018 |
|
|
1019 |
Item connectedFirstItem = GetConnectedItemByPSN(firstItem); |
|
1020 |
Item connectedLastItem = GetConnectedItemByPSN(lastItem); |
|
1021 |
|
|
1022 |
if (connectedFirstItem.LineNumber != null && connectedLastItem.LineNumber != null && |
|
1023 |
!string.IsNullOrEmpty(connectedFirstItem.LineNumber.Name) && !string.IsNullOrEmpty(connectedLastItem.LineNumber.Name) && |
|
1024 |
connectedFirstItem.LineNumber.Name == connectedLastItem.LineNumber.Name) |
|
1025 |
bChange = true; |
|
1026 |
else if (connectedFirstItem.PSNItem == connectedLastItem.PSNItem) |
|
1027 |
bChange = true; |
|
1028 |
|
|
1029 |
if (bChange) |
|
1144 |
foreach (Topology topology in PSNItem.Topologies) |
|
1030 | 1145 |
{ |
1031 |
foreach (Topology topology in PSNItem.Topologies) |
|
1032 |
{ |
|
1033 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName)); |
|
1034 |
if (rows.Length.Equals(1)) |
|
1035 |
rows.First()["SubType"] = "Bypass"; |
|
1036 |
} |
|
1146 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName)); |
|
1147 |
if (rows.Length.Equals(1)) |
|
1148 |
rows.First()["SubType"] = "Bypass"; |
|
1037 | 1149 |
} |
1038 | 1150 |
} |
1151 |
|
|
1152 |
if (PSNItem.StartType == PSNType.Header) |
|
1153 |
{ |
|
1154 |
Topology topology = PSNItem.Topologies.First(); |
|
1155 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName)); |
|
1156 |
if (rows.Length.Equals(1)) |
|
1157 |
rows.First()["SubType"] = "Header"; |
|
1158 |
} |
|
1159 |
else if (PSNItem.EndType == PSNType.Header) |
|
1160 |
{ |
|
1161 |
Topology topology = PSNItem.Topologies.Last(); |
|
1162 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName)); |
|
1163 |
if (rows.Length.Equals(1)) |
|
1164 |
rows.First()["SubType"] = "Header"; |
|
1165 |
} |
|
1039 | 1166 |
} |
1040 | 1167 |
|
1168 |
foreach (Topology topology in Topologies) |
|
1169 |
{ |
|
1170 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName)); |
|
1171 |
if (rows.Length.Equals(1) && rows.First()["SubType"] == null || string.IsNullOrEmpty(rows.First()["SubType"].ToString())) |
|
1172 |
{ |
|
1173 |
Item firstItem = topology.Items.First(); |
|
1174 |
Item lastItem = topology.Items.Last(); |
|
1175 |
|
|
1176 |
List<Relation> relations = new List<Relation>(); |
|
1177 |
relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID)); |
|
1178 |
relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID)); |
|
1179 |
|
|
1180 |
if (relations.Count > 0) |
|
1181 |
rows.First()["SubType"] = "OtherSystem"; |
|
1182 |
} |
|
1183 |
} |
|
1184 |
|
|
1185 |
foreach (DataRow row in TopologySet.Rows) |
|
1186 |
if (row["SubType"] == null || string.IsNullOrEmpty(row["SubType"].ToString())) |
|
1187 |
row["SubType"] = "Normal"; |
|
1188 |
} |
|
1189 |
private bool IsBypass(PSNItem PSNItem) |
|
1190 |
{ |
|
1191 |
bool bResult = false; |
|
1192 |
|
|
1193 |
if (PSNItem.GetPSNType() == "B2B") |
|
1194 |
{ |
|
1195 |
Group firstGroup = PSNItem.Groups.First(); |
|
1196 |
Group lastGroup = PSNItem.Groups.Last(); |
|
1197 |
Item firstItem = firstGroup.Items.First(); |
|
1198 |
Item lastItem = lastGroup.Items.Last(); |
|
1199 |
|
|
1200 |
Item connectedFirstItem = GetConnectedItemByPSN(firstItem); |
|
1201 |
Item connectedLastItem = GetConnectedItemByPSN(lastItem); |
|
1041 | 1202 |
|
1203 |
if (connectedFirstItem.LineNumber != null && connectedLastItem.LineNumber != null && |
|
1204 |
!string.IsNullOrEmpty(connectedFirstItem.LineNumber.Name) && !string.IsNullOrEmpty(connectedLastItem.LineNumber.Name) && |
|
1205 |
connectedFirstItem.LineNumber.Name == connectedLastItem.LineNumber.Name) |
|
1206 |
bResult = true; |
|
1207 |
else if (connectedFirstItem.PSNItem == connectedLastItem.PSNItem) |
|
1208 |
bResult = true; |
|
1209 |
} |
|
1042 | 1210 |
|
1043 | 1211 |
Item GetConnectedItemByPSN(Item item) |
1044 | 1212 |
{ |
... | ... | |
1050 | 1218 |
|
1051 | 1219 |
return result; |
1052 | 1220 |
} |
1221 |
|
|
1222 |
return bResult; |
|
1223 |
} |
|
1224 |
private void UpdateErrorForPSN() |
|
1225 |
{ |
|
1226 |
DataRow[] errorRows = PipeSystemNetwork.Select(" Type = 'Error'"); |
|
1227 |
foreach (DataRow dataRow in errorRows) |
|
1228 |
{ |
|
1229 |
PSNItem PSNItem = PSNItems.Find(x=>x.PSN_OID() == dataRow["OID"].ToString()); |
|
1230 |
|
|
1231 |
if (PSNItem.StartType == PSNType.OPC) |
|
1232 |
PSNItem.StartType = PSNType.Equipment; |
|
1233 |
|
|
1234 |
if (PSNItem.EndType == PSNType.OPC) |
|
1235 |
PSNItem.EndType = PSNType.Equipment; |
|
1236 |
|
|
1237 |
dataRow["Type"] = PSNItem.GetPSNType(); |
|
1238 |
} |
|
1239 |
|
|
1240 |
|
|
1053 | 1241 |
} |
1054 | 1242 |
} |
1055 | 1243 |
|
... | ... | |
1126 | 1314 |
|
1127 | 1315 |
return result; |
1128 | 1316 |
} |
1317 |
public bool IsBypass { get; set; } |
|
1129 | 1318 |
|
1130 | 1319 |
public string GetFromData() |
1131 | 1320 |
{ |
... | ... | |
1151 | 1340 |
Item item = Groups.First().Items.First(); |
1152 | 1341 |
if (item.ItemType == ItemType.Symbol) |
1153 | 1342 |
{ |
1154 |
if (item.Type.Contains("OPC's")) |
|
1343 |
if (item.ID2DBType.Contains("OPC's"))
|
|
1155 | 1344 |
Status += ", OPC Disconneted"; |
1156 | 1345 |
else |
1157 | 1346 |
Status += ", Missing ItemTag or Description"; |
1158 | 1347 |
|
1159 |
result = item.Parent;
|
|
1348 |
result = item.ID2DBName;
|
|
1160 | 1349 |
} |
1161 | 1350 |
else if (item.ItemType == ItemType.Line) |
1162 | 1351 |
{ |
... | ... | |
1194 | 1383 |
Item item = Groups.Last().Items.Last(); |
1195 | 1384 |
if (item.ItemType == ItemType.Symbol) |
1196 | 1385 |
{ |
1197 |
if (item.Type.Contains("OPC's")) |
|
1386 |
if (item.ID2DBType.Contains("OPC's"))
|
|
1198 | 1387 |
Status += ", OPC Disconneted"; |
1199 | 1388 |
else |
1200 | 1389 |
Status += ", Missing ItemTag or Description"; |
1201 | 1390 |
|
1202 |
result = item.Parent;
|
|
1391 |
result = item.ID2DBName;
|
|
1203 | 1392 |
} |
1204 | 1393 |
else if (item.ItemType == ItemType.Line) |
1205 | 1394 |
{ |
... | ... | |
1211 | 1400 |
} |
1212 | 1401 |
return result; |
1213 | 1402 |
} |
1403 |
|
|
1404 |
public string GetPBSData() |
|
1405 |
{ |
|
1406 |
string result = string.Empty; |
|
1407 |
List<string> PBSList = new List<string>(); |
|
1408 |
if (Settings.Default.PBSSetting.Equals("Line Number")) |
|
1409 |
{ |
|
1410 |
string attrValue = Settings.Default.PBSSettingValue; |
|
1411 |
|
|
1412 |
foreach (Group group in Groups) |
|
1413 |
{ |
|
1414 |
List<LineNumber> lineNumbers = group.Items.Select(x =>x.LineNumber).Distinct().ToList(); |
|
1415 |
foreach (LineNumber lineNumber in lineNumbers) |
|
1416 |
{ |
|
1417 |
Attribute attribute = lineNumber.Attributes.Find(x => x.Name == attrValue && !string.IsNullOrEmpty(x.Value)); |
|
1418 |
if (attribute != null) |
|
1419 |
{ |
|
1420 |
string value = attribute.Value; |
|
1421 |
if (!PBSList.Contains(value)) |
|
1422 |
PBSList.Add(value); |
|
1423 |
} |
|
1424 |
} |
|
1425 |
} |
|
1426 |
} |
|
1427 |
else if (Settings.Default.PBSSetting.Equals("Item Attribute")) |
|
1428 |
{ |
|
1429 |
string attrValue = Settings.Default.PBSSettingValue; |
|
1430 |
|
|
1431 |
foreach (Group group in Groups) |
|
1432 |
{ |
|
1433 |
List<Item> items = group.Items.FindAll(x => x.Attributes.Find(y => y.Name == attrValue && !string.IsNullOrEmpty(y.Value)) != null); |
|
1434 |
foreach (Item item in items) |
|
1435 |
{ |
|
1436 |
string value = item.Attributes.Find(x => x.Name == attrValue).Value; |
|
1437 |
if (!PBSList.Contains(value)) |
|
1438 |
PBSList.Add(value); |
|
1439 |
} |
|
1440 |
} |
|
1441 |
} |
|
1442 |
else if (Settings.Default.PBSSetting.Equals("Drawing No")) |
|
1443 |
{ |
|
1444 |
string attrValue = Settings.Default.PBSSettingValue; |
|
1445 |
|
|
1446 |
foreach (Group group in Groups) |
|
1447 |
{ |
|
1448 |
List<Document> documents = group.Items.Select(x => x.Document).Distinct().ToList(); |
|
1449 |
foreach (Document document in documents) |
|
1450 |
{ |
|
1451 |
string name = document.DrawingName; |
|
1452 |
|
|
1453 |
int startIndex = Settings.Default.PBSSettingStartValue; |
|
1454 |
int endIndex = Settings.Default.PBSSettingEndValue; |
|
1455 |
|
|
1456 |
string subStr = name.Substring(startIndex - 1, endIndex - startIndex + 1); |
|
1457 |
if (!PBSList.Contains(subStr)) |
|
1458 |
PBSList.Add(subStr); |
|
1459 |
} |
|
1460 |
} |
|
1461 |
} |
|
1462 |
else if (Settings.Default.PBSSetting.Equals("Unit Area")) |
|
1463 |
{ |
|
1464 |
foreach (Group group in Groups) |
|
1465 |
{ |
|
1466 |
List<Document> documents = group.Items.Select(x => x.Document).Distinct().ToList(); |
|
1467 |
foreach (Document document in documents) |
|
1468 |
{ |
|
1469 |
List<TextInfo> textInfos = document.TextInfos.FindAll(x => x.Area == "Unit"); |
|
1470 |
foreach (TextInfo textInfo in textInfos) |
|
1471 |
{ |
|
1472 |
if (!PBSList.Contains(textInfo.Value)) |
|
1473 |
PBSList.Add(textInfo.Value); |
|
1474 |
} |
|
1475 |
} |
|
1476 |
} |
|
1477 |
} |
|
1478 |
|
|
1479 |
foreach (var item in PBSList) |
|
1480 |
{ |
|
1481 |
if (string.IsNullOrEmpty(result)) |
|
1482 |
result = item; |
|
1483 |
else |
|
1484 |
result += ", " + item; |
|
1485 |
} |
|
1486 |
return result; |
|
1487 |
} |
|
1214 | 1488 |
} |
1215 | 1489 |
} |
내보내기 Unified diff