개정판 0f07fa34
dev issue #000 : add
Change-Id: Ic046c1d421cadfd69354d7f3125c5b5ea68c75fb
DTI_PID/ID2PSN/Document.cs | ||
---|---|---|
28 | 28 |
{ |
29 | 29 |
FilePath = filePath; |
30 | 30 |
ReadFile(); |
31 |
InsertNozzle(); |
|
31 | 32 |
SetRelationItem(); |
32 | 33 |
SetGroup(); |
34 |
RemoveItems(); |
|
33 | 35 |
} |
34 | 36 |
private void ReadFile() |
35 | 37 |
{ |
... | ... | |
328 | 330 |
continue; |
329 | 331 |
endGroupIds.Add(item.Value); |
330 | 332 | |
331 |
Group group = new Group(this); |
|
332 |
group.Items = itemDic.Where(x => x.Value.Equals(item.Value)).Select(x => x.Key).ToList(); |
|
333 |
group.UID = item.Value; |
|
334 |
group.SortItems(); |
|
335 | ||
336 |
Groups.Add(group); |
|
333 |
List<Item> groupItems = itemDic.Where(x => x.Value.Equals(item.Value)).Select(x => x.Key).ToList(); |
|
334 |
if (groupItems.Find(x => x.ItemType == ItemType.Line) == null) |
|
335 |
{ |
|
336 |
foreach (var groupItem in groupItems) |
|
337 |
Items.Remove(groupItem); |
|
338 |
} |
|
339 |
else |
|
340 |
{ |
|
341 |
Group group = new Group(this); |
|
342 |
group.Items = groupItems; |
|
343 |
group.UID = item.Value; |
|
344 |
group.SortItems(); |
|
345 |
Groups.Add(group); |
|
346 |
} |
|
337 | 347 |
} |
338 | 348 | |
339 | 349 |
#region HeaderSetting |
... | ... | |
566 | 576 |
return RunInfos.Find(x => x.Items.Contains(item1) && x.Items.Contains(item2)) != null ? true : false; |
567 | 577 |
} |
568 | 578 |
} |
579 |
private void RemoveItems() |
|
580 |
{ |
|
581 |
List<Group> removeGroups = new List<Group>(); |
|
582 |
foreach (Group group in Groups) |
|
583 |
{ |
|
584 |
Item instLine = group.Items.Find(x => x.ItemType == ItemType.Line && (x.Name != "Secondary" && x.Name != "Primary")); |
|
585 |
if (instLine != null) |
|
586 |
removeGroups.Add(group); |
|
587 |
} |
|
588 | ||
589 |
foreach (Group group in removeGroups) |
|
590 |
{ |
|
591 |
foreach (var item in group.Items) |
|
592 |
Items.Remove(item); |
|
593 |
Groups.Remove(group); |
|
594 |
} |
|
595 |
} |
|
596 |
private void InsertNozzle() |
|
597 |
{ |
|
598 |
List<Item> newNozzles = new List<Item>(); |
|
599 |
foreach (var item in Items) |
|
600 |
{ |
|
601 |
if (item.SubItemType == SubItemType.Nozzle) |
|
602 |
continue; |
|
603 |
|
|
604 |
foreach (Relation relation in item.Relations) |
|
605 |
{ |
|
606 |
Equipment equipment = Equipments.Find(x => x.UID == relation.UID); |
|
607 |
if (equipment != null) |
|
608 |
{ |
|
609 |
Item newNozzle = new Item(); |
|
610 |
newNozzle.UID = Guid.NewGuid().ToString(); |
|
611 |
newNozzle.Name = "PSN_Nozzle"; |
|
612 |
newNozzle.Type = "Nozzles"; |
|
613 |
newNozzle.Owner = item.Owner; |
|
614 |
newNozzle.Parent = "PSN_Nozzle"; |
|
615 |
newNozzle.POINT = relation.Point; |
|
616 |
newNozzle.Relations = new List<Relation>(); |
|
617 | ||
618 |
newNozzle.Relations.Add(new Relation() |
|
619 |
{ |
|
620 |
Point = relation.Point, |
|
621 |
UID = equipment.UID |
|
622 |
}); |
|
623 |
newNozzle.Relations.Add(new Relation() |
|
624 |
{ |
|
625 |
Point = relation.Point, |
|
626 |
UID = item.UID |
|
627 |
}); |
|
628 | ||
629 |
newNozzle.ItemType = ItemType.Symbol; |
|
630 |
newNozzle.SubItemType = SubItemType.Nozzle; |
|
631 | ||
632 |
newNozzles.Add(newNozzle); |
|
633 | ||
634 |
relation.UID = newNozzle.UID; |
|
635 |
} |
|
636 |
} |
|
637 |
} |
|
638 | ||
639 |
Items.AddRange(newNozzles); |
|
640 |
} |
|
569 | 641 |
} |
570 | 642 |
} |
내보내기 Unified diff