개정판 6805be6e
issue #000:
Change-Id: I5ca463f0becb07fc27898f0de30f321ad5b80741
DTI_PID/ID2PSN/PSN.cs | ||
---|---|---|
263 | 263 |
|
264 | 264 |
// ValveGrouping |
265 | 265 |
splashScreenManager1.SetWaitFormDescription(i++ + " / 19 UpdateValveGrouping ( 80 % )"); |
266 |
PathItemSorting(); //test
|
|
266 |
PathItemSorting(); |
|
267 | 267 |
UpdateValveGrouping(); |
268 | 268 |
|
269 | 269 |
splashScreenManager1.SetWaitFormDescription(i++ + " / 19 PathItemSorting ( 85 % )"); |
... | ... | |
1121 | 1121 |
|
1122 | 1122 |
int vgTagNum = 1; |
1123 | 1123 |
DataRow[] tagpathItemRows = PathItems.Select(string.Format("GROUPTAG Like '%\\%'")); |
1124 |
List<string> pathOid = new List<string>(); |
|
1124 | 1125 |
foreach (DataRow drPathitem in tagpathItemRows) |
1125 | 1126 |
{ |
1127 |
if (pathOid.Contains(drPathitem.Field<string>("OID"))) |
|
1128 |
continue; |
|
1129 |
|
|
1126 | 1130 |
string[] valvetag = drPathitem["GROUPTAG"].ToString().Split(new string[] { "\\" }, StringSplitOptions.None); |
1127 | 1131 |
DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", drPathitem["PipeSystemNetwork_OID"].ToString())); |
1128 | 1132 |
ValveGroupItem valveitem = ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == valvetag[0]).FirstOrDefault(); |
... | ... | |
1144 | 1148 |
lstitem.Clear(); |
1145 | 1149 |
continue; |
1146 | 1150 |
} |
1151 |
else if(!string.IsNullOrEmpty(dr["GROUPTAG"].ToString()) && !dr.Field<string>("OID").Equals(drPathitem.Field<string>("OID"))) |
|
1152 |
{ |
|
1153 |
|
|
1154 |
List<DataRow> lstitem2 = new List<DataRow>(); |
|
1155 |
int indexOf = 0; |
|
1156 |
|
|
1157 |
for (int i = 0; i < lstitem.Count; i++) |
|
1158 |
{ |
|
1159 |
DataRow dataRow = lstitem[lstitem.Count() - i - 1]; |
|
1160 |
if (!string.IsNullOrEmpty(dataRow["BranchTopologySet_OID"].ToString())) |
|
1161 |
{ |
|
1162 |
indexOf = lstitem.Count() - i - 1; |
|
1163 |
break; |
|
1164 |
} |
|
1165 |
} |
|
1166 |
|
|
1167 |
for (int i = 0; i < lstitem.Count; i++) |
|
1168 |
{ |
|
1169 |
if (indexOf == i) |
|
1170 |
{ |
|
1171 |
keyValuePairs.Add(bCnt, lstitem2.ToList()); |
|
1172 |
lstitem2.Clear(); |
|
1173 |
bCnt++; |
|
1174 |
} |
|
1175 |
lstitem2.Add(lstitem[i]); |
|
1176 |
} |
|
1177 |
|
|
1178 |
lstitem = lstitem2.ToList(); |
|
1179 |
} |
|
1147 | 1180 |
|
1148 | 1181 |
if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString())) |
1149 | 1182 |
{ |
1150 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString())); |
|
1151 |
|
|
1183 |
DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString())); |
|
1152 | 1184 |
|
1153 |
if (rows.First()["SubType"].ToString() != "Bypass" && rows.First()["SubType"].ToString() != "Vent_Drain") |
|
1185 |
if (rows.First()["SubType"].ToString() != "Bypass" && rows.First()["SubType"].ToString() != "Vent_Drain") |
|
1186 |
{ |
|
1187 |
if (lstitem.ToList().Where(x => !string.IsNullOrEmpty(x.Field<string>("GROUPTAG"))).Count() > 0) |
|
1154 | 1188 |
{ |
1155 |
if (lstitem.ToList().Where(x => !string.IsNullOrEmpty(x.Field<string>("GROUPTAG"))).Count() > 0) |
|
1156 |
{ |
|
1157 |
lstitem.Add(dr); |
|
1158 |
keyValuePairs.Add(bCnt, lstitem.ToList()); |
|
1159 |
lstitem.Clear(); |
|
1160 |
} |
|
1161 |
else |
|
1162 |
{ |
|
1163 |
keyValuePairs.Add(bCnt, lstitem.ToList()); |
|
1164 |
lstitem.Clear(); |
|
1165 |
lstitem.Add(dr); |
|
1166 |
} |
|
1167 |
bCnt++; |
|
1168 |
|
|
1189 |
lstitem.Add(dr); |
|
1190 |
keyValuePairs.Add(bCnt, lstitem.ToList()); |
|
1191 |
lstitem.Clear(); |
|
1169 | 1192 |
} |
1170 | 1193 |
else |
1194 |
{ |
|
1195 |
keyValuePairs.Add(bCnt, lstitem.ToList()); |
|
1196 |
lstitem.Clear(); |
|
1171 | 1197 |
lstitem.Add(dr); |
1198 |
} |
|
1199 |
bCnt++; |
|
1200 |
|
|
1201 |
} |
|
1202 |
else |
|
1203 |
lstitem.Add(dr); |
|
1172 | 1204 |
|
1173 | 1205 |
} |
1174 | 1206 |
else |
... | ... | |
1190 | 1222 |
vgTagNum++; |
1191 | 1223 |
} |
1192 | 1224 |
else |
1193 |
{ |
|
1194 |
//if(string.IsNullOrEmpty(valvetag[1])) |
|
1195 |
// VGTag = valveitem.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum)); |
|
1196 |
//else |
|
1225 |
{ |
|
1197 | 1226 |
VGTag = valveitem.TagIdentifier + "-" + valvetag[1]; |
1198 | 1227 |
} |
1199 | 1228 |
|
1200 | 1229 |
foreach (KeyValuePair<int, List<DataRow>> keyValuePair in keyValuePairs) |
1201 |
{ |
|
1230 |
{
|
|
1202 | 1231 |
if (keyValuePair.Value.Where(x => x.Field<string>("OID") == drPathitem.Field<string>("OID")).Count() > 0) |
1203 | 1232 |
{ |
1233 |
if (!pathOid.Contains(drPathitem.Field<string>("OID"))) |
|
1234 |
pathOid.Add(drPathitem.Field<string>("OID")); |
|
1235 |
|
|
1204 | 1236 |
foreach (DataRow dr in keyValuePair.Value) |
1205 | 1237 |
{ |
1206 | 1238 |
dr["GROUPTAG"] = VGTag; |
... | ... | |
1216 | 1248 |
if (topology.Field<string>("SubType").Equals("Bypass")) |
1217 | 1249 |
{ |
1218 | 1250 |
DataRow[] drPathItem = PathItems.Select(string.Format("TopologySet_OID = '{0}'", topology.Field<string>("OID"))); |
1219 |
foreach(DataRow pathitem in drPathItem) |
|
1251 |
//if (dr["GROUPTAG"].ToString() == "Scope Break") |
|
1252 |
if(drPathItem.Where(x => x.Field<string>("GROUPTAG") == "Scope Break").Count() == 0) |
|
1220 | 1253 |
{ |
1221 |
pathitem["GROUPTAG"] = VGTag; |
|
1254 |
foreach (DataRow pathitem in drPathItem) |
|
1255 |
{ |
|
1256 |
pathitem["GROUPTAG"] = VGTag; |
|
1257 |
} |
|
1222 | 1258 |
} |
1223 | 1259 |
} |
1224 | 1260 |
} |
... | ... | |
1226 | 1262 |
} |
1227 | 1263 |
} |
1228 | 1264 |
} |
1265 |
else |
|
1266 |
{ |
|
1267 |
foreach (DataRow drs in tagpathItemRows) |
|
1268 |
{ |
|
1269 |
if (drs.Field<string>("OID").Equals(drPathitem.Field<string>("OID"))) |
|
1270 |
continue; |
|
1271 |
|
|
1272 |
if(keyValuePair.Value.Where(x => x.Field<string>("OID") == drs.Field<string>("OID")).Count() > 0) |
|
1273 |
{ |
|
1274 |
if (!pathOid.Contains(drs.Field<string>("OID"))) |
|
1275 |
{ |
|
1276 |
pathOid.Add(drs.Field<string>("OID")); |
|
1277 |
|
|
1278 |
valvetag = drs["GROUPTAG"].ToString().Split(new string[] { "\\" }, StringSplitOptions.None); |
|
1279 |
ValveGroupItem valveitems = ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == valvetag[0]).FirstOrDefault(); |
|
1280 |
if (valveitems == null || valveitems.GroupType == "Scope Break") |
|
1281 |
continue; |
|
1282 |
|
|
1283 |
VGTag = string.Empty; |
|
1284 |
if (valveitems.AttributeName == "NoSelection" || valveitems.AttributeName == string.Empty) |
|
1285 |
{ |
|
1286 |
VGTag = valveitems.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum)); |
|
1287 |
vgTagNum++; |
|
1288 |
} |
|
1289 |
else |
|
1290 |
{ |
|
1291 |
VGTag = valveitems.TagIdentifier + "-" + valvetag[1]; |
|
1292 |
} |
|
1293 |
|
|
1294 |
foreach (DataRow dr in keyValuePair.Value) |
|
1295 |
{ |
|
1296 |
dr["GROUPTAG"] = VGTag; |
|
1297 |
|
|
1298 |
if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString())) |
|
1299 |
{ |
|
1300 |
if (TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString())).First().Field<string>("SubType") == "Bypass") |
|
1301 |
{ |
|
1302 |
DataRow[] rows = keyValuePair.Value.Where(x => x.Field<string>("ViewPipeSystemNetwork_OID").Equals(dr["ViewPipeSystemNetwork_OID"].ToString())).ToArray(); |
|
1303 |
foreach (DataRow path in rows) |
|
1304 |
{ |
|
1305 |
DataRow topology = TopologySet.Select(string.Format("OID = '{0}'", path["BranchTopologySet_OID"].ToString())).First(); |
|
1306 |
if (topology.Field<string>("SubType").Equals("Bypass")) |
|
1307 |
{ |
|
1308 |
DataRow[] drPathItem = PathItems.Select(string.Format("TopologySet_OID = '{0}'", topology.Field<string>("OID"))); |
|
1309 |
if (drPathItem.Where(x => x.Field<string>("GROUPTAG") == "Scope Break").Count() == 0) |
|
1310 |
{ |
|
1311 |
foreach (DataRow pathitem in drPathItem) |
|
1312 |
{ |
|
1313 |
pathitem["GROUPTAG"] = VGTag; |
|
1314 |
} |
|
1315 |
} |
|
1316 |
} |
|
1317 |
} |
|
1318 |
} |
|
1319 |
} |
|
1320 |
} |
|
1321 |
|
|
1322 |
if (valveitems.GroupType.Contains("PSV")) |
|
1323 |
{ |
|
1324 |
DataRow[] psnRows = PipeSystemNetwork.Select(string.Format("OID = '{0}'", drPathitem["PipeSystemNetwork_OID"].ToString())); |
|
1325 |
foreach (DataRow row in psnRows) |
|
1326 |
row["Pocket"] = "Yes"; |
|
1327 |
} |
|
1328 |
} |
|
1329 |
} |
|
1330 |
} |
|
1331 |
} |
|
1229 | 1332 |
} |
1333 |
|
|
1230 | 1334 |
if(valveitem.GroupType.Contains("PSV")) |
1231 | 1335 |
{ |
1232 | 1336 |
DataRow[] psnRows = PipeSystemNetwork.Select(string.Format("OID = '{0}'", drPathitem["PipeSystemNetwork_OID"].ToString())); |
... | ... | |
2537 | 2641 |
} |
2538 | 2642 |
|
2539 | 2643 |
status = PSNItem.Status; |
2540 |
//if (dr != null)
|
|
2541 |
//{
|
|
2542 |
// newRow["FROM_DATA"] = dr.Field<string>("FROM_DATA");
|
|
2543 |
// newRow["TO_DATA"] = dr.Field<string>("TO_DATA");
|
|
2544 |
// newRow["Type"] = dr.Field<string>("Type");
|
|
2545 |
//}
|
|
2644 |
if (dr != null) |
|
2645 |
{ |
|
2646 |
newRow["FROM_DATA"] = dr.Field<string>("FROM_DATA"); |
|
2647 |
newRow["TO_DATA"] = dr.Field<string>("TO_DATA"); |
|
2648 |
newRow["Type"] = dr.Field<string>("Type"); |
|
2649 |
} |
|
2546 | 2650 |
} |
2547 | 2651 |
|
2548 | 2652 |
|
내보내기 Unified diff