개정판 2b8bbe9a
dev issue #000 : add validation
Change-Id: Ibc71ee8d1b8fc1dc6a8b676e0db71403d82532ad
DTI_PID/SPPIDConverter/BaseModel/Document.cs | ||
---|---|---|
753 | 753 |
} |
754 | 754 |
} |
755 | 755 |
} |
756 |
|
|
757 |
foreach (var item in SYMBOLS.FindAll(x => x.CONNECTORS.Count == 2)) |
|
758 |
{ |
|
759 |
Line line1 = item.CONNECTORS[0].ConnectedObject as Line; |
|
760 |
Line line2 = item.CONNECTORS[1].ConnectedObject as Line; |
|
761 |
if (line1.TYPE == line2.TYPE) |
|
762 |
{ |
|
763 |
int index1 = line1.CONNECTORS.IndexOf(line1.CONNECTORS.Find(x => x.ConnectedObject == item)); |
|
764 |
int index2 = line2.CONNECTORS.IndexOf(line2.CONNECTORS.Find(x => x.ConnectedObject == item)); |
|
765 |
if (index1 == index2) |
|
766 |
{ |
|
767 |
validationStringBuilder.AppendLine("Check line flow direction!"); |
|
768 |
validationStringBuilder.AppendLine("UID : " + line1.UID); |
|
769 |
validationStringBuilder.AppendLine("UID : " + line2.UID); |
|
770 |
validationStringBuilder.AppendLine(); |
|
771 |
validationResult = true; |
|
772 |
} |
|
773 |
} |
|
774 |
} |
|
756 | 775 |
#endregion |
757 | 776 |
|
758 | 777 |
#region Association Check |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
246 | 246 |
|
247 | 247 |
} |
248 | 248 |
} |
249 |
private void JoinRun(string mainModelId, string modelId)
|
|
249 |
private void JoinRun(string modelId, string mainModelId, ref string survivorId)
|
|
250 | 250 |
{ |
251 |
LMModelItem modelItem = dataSource.GetModelItem(mainModelId); |
|
252 |
if (modelItem != null) |
|
251 |
try |
|
253 | 252 |
{ |
254 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
255 |
{ |
|
256 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
257 |
{ |
|
258 |
LMConnector connector = dataSource.GetConnector(rep.Id); |
|
259 |
if (connector.ConnectItem1SymbolObject != null && connector.ConnectItem1SymbolObject.get_RepresentationType() != "Branch") |
|
260 |
{ |
|
261 |
LMSymbol symbol = connector.ConnectItem1SymbolObject; |
|
253 |
LMModelItem modelItem1 = dataSource.GetModelItem(modelId); |
|
254 |
_LMAItem item1 = modelItem1.AsLMAItem(); |
|
255 |
LMModelItem modelItem2 = dataSource.GetModelItem(mainModelId); |
|
256 |
_LMAItem item2 = modelItem2.AsLMAItem(); |
|
262 | 257 |
|
263 |
} |
|
264 |
if (connector.ConnectItem2SymbolObject != null && connector.ConnectItem2SymbolObject.get_RepresentationType() != "Branch") |
|
265 |
{ |
|
266 |
LMSymbol symbol = connector.ConnectItem2SymbolObject; |
|
267 |
string typeName = symbol.ModelItemObject.get_ItemTypeName().ToString(); |
|
268 |
if (typeName == "Instrument") |
|
269 |
{ |
|
270 |
LMInstrument instrument = dataSource.GetInstrument(symbol.ModelItemID); |
|
271 |
} |
|
272 |
else if (typeName == "PipingComp") |
|
273 |
{ |
|
274 |
LMPipingComp pipingComp = dataSource.GetPipingComp(symbol.ModelItemID); |
|
275 |
} |
|
276 |
} |
|
277 |
} |
|
258 |
// item2가 item1으로 조인 |
|
259 |
_placement.PIDJoinRuns(ref item1, ref item2); |
|
260 |
item1.Commit(); |
|
261 |
item2.Commit(); |
|
262 |
|
|
263 |
string beforeID = string.Empty; |
|
264 |
string afterID = string.Empty; |
|
265 |
|
|
266 |
if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() != "Active") |
|
267 |
{ |
|
268 |
beforeID = modelItem2.Id; |
|
269 |
afterID = modelItem1.Id; |
|
270 |
survivorId = afterID; |
|
271 |
} |
|
272 |
else if (modelItem1.get_ItemStatus() != "Active" && modelItem2.get_ItemStatus() == "Active") |
|
273 |
{ |
|
274 |
beforeID = modelItem1.Id; |
|
275 |
afterID = modelItem2.Id; |
|
276 |
survivorId = afterID; |
|
278 | 277 |
} |
278 |
else if (modelItem1.get_ItemStatus() == "Active" && modelItem2.get_ItemStatus() == "Active") |
|
279 |
survivorId = null; |
|
280 |
else |
|
281 |
throw new Exception("잘못된 경우"); |
|
282 |
|
|
283 |
//if (!string.IsNullOrEmpty(beforeID) && !string.IsNullOrEmpty(afterID)) |
|
284 |
//{ |
|
285 |
// List<Line> lines = SPPIDUtil.FindLinesByModelId(document, beforeID); |
|
286 |
// foreach (var line in lines) |
|
287 |
// line.SPPID.ModelItemId = afterID; |
|
288 |
//} |
|
289 |
|
|
290 |
ReleaseCOMObjects(modelItem1); |
|
291 |
ReleaseCOMObjects(item1); |
|
292 |
ReleaseCOMObjects(modelItem2); |
|
293 |
ReleaseCOMObjects(item2); |
|
294 |
} |
|
295 |
catch (Exception ex) |
|
296 |
{ |
|
297 |
Log.Write("Join Error"); |
|
298 |
Log.Write(ex.Message); |
|
279 | 299 |
} |
280 | 300 |
} |
281 | 301 |
|
282 |
private void GetModelItemForJoin(string modelItemId, List<string> otherModelIds) |
|
302 |
private void GetModelItemForJoin(string modelItemId, List<string> otherModelIds, ref string survivorId)
|
|
283 | 303 |
{ |
284 | 304 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
285 | 305 |
List<string> endModelItemIDs = new List<string>(); |
... | ... | |
302 | 322 |
} |
303 | 323 |
} |
304 | 324 |
} |
325 |
} |
|
326 |
|
|
327 |
if (true) |
|
328 |
{ |
|
305 | 329 |
|
306 | 330 |
} |
307 | 331 |
} |
내보내기 Unified diff