프로젝트

일반

사용자정보

개정판 94a117ca

ID94a117ca88304318d9857be0210913df2ca0423a
상위 b3b970ef
하위 8f24b438

gaqhf 이(가) 3년 이상 전에 추가함

dev issue #000 : dev

Change-Id: I7c1c28acb118b042b12209db168b2286c7e7a9fd

차이점 보기:

DTI_PID/ID2PSN/PSN.cs
131 131
                PSNItem PSNItem = PSNItems.Find(x => x.UID == uid);
132 132
                if (PSNItem == null)
133 133
                {
134
                    PSNItem = new PSNItem() { UID = uid };
134
                    PSNItem = new PSNItem(PSNItems.Count) { UID = uid };
135 135
                    PSNItems.Add(PSNItem);
136 136
                }
137 137
                PSNItem.Groups.Add(group);
......
535 535

  
536 536
            foreach (PSNItem PSNItem in PSNItems)
537 537
            {
538
                int psnOrder = 0;
538 539
                int index = 0;
540
                bool bPSNStart = true;
541
                string sPSNData = string.Empty;
539 542
                foreach (Group group in PSNItem.Groups)
540 543
                {
541 544
                    foreach (Item item in group.Items)
......
563 566
                            }
564 567
                        }
565 568

  
569
                        if (bPSNStart)
570
                        {
571
                            CreatePipeSystemNetworkDataRow();
572
                            sPSNData = item.TopologyData;
573
                            psnOrder++;
574
                            bPSNStart = false;
575
                        }
576
                        else
577
                        {
578
                            if (item.TopologyData != sPSNData)
579
                            {
580
                                CreatePipeSystemNetworkDataRow();
581
                                sPSNData = item.TopologyData;
582
                                psnOrder++;
583
                            }
584
                        }
566 585
                        void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "")
567 586
                        {
568 587
                            DataRow newRow = pathItemsDT.NewRow();
......
589 608
                            else
590 609
                                newRow["NPD"] = null;
591 610

  
592
                            newRow["PipeSystemNetwork_OID"] = string.Empty;//PSNItem.UID;
611
                            newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
593 612
                            newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
594 613
                            newRow["DrawingName"] = group.Document.DrawingName;
595 614

  
......
598 617
                        void CreateSequenceDataDataRow(string itemOID)
599 618
                        {
600 619
                            DataRow newRow = sequenceDataDT.NewRow();
601
                            newRow["OID"] = string.Format(item.Topology.FullName + "-{0}", index);
620
                            newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index);
602 621
                            newRow["SERIALNUMBER"] = string.Format("{0}", index);
603 622
                            newRow["PathItem_OID"] = itemOID;
604 623
                            newRow["TopologySet_OID_Key"] = item.Topology.FullName;
605 624

  
606 625
                            sequenceDataDT.Rows.Add(newRow);
607 626
                        }
627
                        void CreatePipeSystemNetworkDataRow()
628
                        {
629
                            DataRow newRow = pipeSystemNetworkDT.NewRow();
630
                            newRow["OID"] = PSNItem.PSN_OID();
631
                            newRow["Type"] = PSNItem.GetPSNType();
632
                            newRow["OrderNumber"] = psnOrder;
633
                            newRow["Pipeline_OID"] = item.TopologyData;
634
                            newRow["FROM_DATA"] = PSNItem.GetFromData();
635
                            newRow["TO_DATA"] = PSNItem.GetToData();
636
                            newRow["TopologySet_OID_Key"] = item.Topology.FullName;
637
                            newRow["PSNRevisionNumber"] = null;
638
                            newRow["PathOID"] = null;
639
                            newRow["PBS"] = null;
640

  
608 641

  
642
                            List<string> drawingNames = new List<string>();
643
                            foreach (Group _group in PSNItem.Groups)
644
                            {
645
                                if (!drawingNames.Contains(_group.Document.DrawingName))
646
                                {
647

  
648
                                    if (drawingNames.Count == 0)
649
                                        newRow["PIDDrawings"] = _group.Document.DrawingName;
650
                                    else
651
                                        newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + _group.Document.DrawingName;
652
                                    drawingNames.Add(_group.Document.DrawingName);
653
                                }
654
                            }
655
                            pipeSystemNetworkDT.Rows.Add(newRow);
656
                        }
609 657

  
610 658
                        string GetItemTag()
611 659
                        {
......
617 665
                        }
618 666
                    }
619 667
                }
620

  
621
                CreatePipeSystemNetworkDataRow();
622

  
623
                void CreatePipeSystemNetworkDataRow()
624
                {
625
                    DataRow newRow = pipeSystemNetworkDT.NewRow();
626
                    newRow["OID"] = PSNItem.UID;
627
                    newRow["Type"] = null;
628
                    newRow["OrderNumber"] = null;
629
                    newRow["Pipeline_OID"] = PSNItem.Groups.First().Items.First().TopologyData;
630
                    newRow["FROM_DATA"] = PSNItem.StartType.ToString();
631
                    newRow["TO_DATA"] = PSNItem.EndType.ToString();
632
                    newRow["TopologySet_OID_Key"] = PSNItem.Groups.First().Items.First().Topology.FullName;
633
                    newRow["PSNRevisionNumber"] = null;
634
                    newRow["PathOID"] = null;
635
                    newRow["PBS"] = null;
636

  
637

  
638
                    List<string> drawingNames = new List<string>();
639
                    foreach (Group group in PSNItem.Groups)
640
                    {
641
                        if (!drawingNames.Contains(group.Document.DrawingName))
642
                        {
643

  
644
                            if (drawingNames.Count == 0)
645
                                newRow["PIDDrawings"] = group.Document.DrawingName;
646
                            else
647
                                newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + group.Document.DrawingName;
648
                            drawingNames.Add(group.Document.DrawingName);
649
                        }
650
                    }
651

  
652

  
653
                    pipeSystemNetworkDT.Rows.Add(newRow);
654
                }
655 668
            }
656 669

  
657 670
            PathItems = pathItemsDT;
......
662 675

  
663 676
    public class PSNItem
664 677
    {
665
        public PSNItem()
678
        public PSNItem(int count)
666 679
        {
667 680
            Groups = new List<Group>();
668 681
            Topologies = new List<Topology>();
682

  
683
            Index = count + 1;
684
            Revision = 1;
669 685
        }
670 686
        public string UID { get; set; }
671 687
        public List<Group> Groups { get; set; }
672 688
        public List<Topology> Topologies { get; set; }
673 689
        public PSNType StartType { get; set; }
674 690
        public PSNType EndType { get; set; }
691
        public int Index { get; set; }
692
        public int Revision { get; set; }
693
        public string PSN_OID()
694
        {
695
            return string.Format("R{0}-PSN-{1}", string.Format("{0:D4}", Revision), string.Format("{0:D4}", Index));
696
        }
697
        public string GetPSNType()
698
        {
699
            string result = string.Empty;
700

  
701
            if (EnableType(StartType) && EnableType(EndType))
702
            {
703
                if (StartType == PSNType.Equipment && EndType == PSNType.Equipment)
704
                    result = "E2E";
705
                else if (StartType == PSNType.Branch && EndType == PSNType.Branch)
706
                    result = "B2B";
707
                else if (StartType == PSNType.Header && EndType == PSNType.Header)
708
                    result = "HD2";
709

  
710
                else if (StartType == PSNType.Equipment && EndType == PSNType.Branch)
711
                    result = "E2B";
712
                else if (StartType == PSNType.Branch && EndType == PSNType.Equipment)
713
                    result = "B2E";
714

  
715
                else if (StartType == PSNType.Header && EndType == PSNType.Branch)
716
                    result = "HDB";
717
                else if (StartType == PSNType.Branch && EndType == PSNType.Header)
718
                    result = "HDB";
719

  
720
                else if (StartType == PSNType.Header && EndType == PSNType.Equipment)
721
                    result = "HDE";
722
                else if (StartType == PSNType.Equipment && EndType == PSNType.Header)
723
                    result = "HDE";
724
                else
725
                    result = "Error";
726
            }
727
            else
728
                result = "Error";
729

  
730
            return result;
731

  
732
            
733
        }
734
        private bool EnableType(PSNType type)
735
        {
736
            bool result = false;
737

  
738
            if (type == PSNType.Branch ||
739
                type == PSNType.Equipment ||
740
                type == PSNType.Header)
741
            {
742
                result = true;
743
            }
744

  
745
            return result;
746
        }
747

  
748
        public string GetFromData()
749
        {
750
            string result = string.Empty;
751
            if (StartType == PSNType.Header)
752
                result = "ENDOFHEADER";
753
            else if (StartType == PSNType.Branch)
754
                result = Groups.First().Items.First().LineNumber.Name;
755
            else if (StartType == PSNType.Equipment)
756
                result = "Equipment Tag";
757
            else
758
                result = "Unknown";
759

  
760
            return result;
761
        }
762

  
763
        public string GetToData()
764
        {
765
            string result = string.Empty;
766
            if (EndType == PSNType.Header)
767
                result = "ENDOFHEADER";
768
            else if (EndType == PSNType.Branch)
769
                result = Groups.Last().Items.Last().LineNumber.Name;
770
            else if (EndType == PSNType.Equipment)
771
                result = "Equipment Tag";
772
            else 
773
                result = "Unknown";
774
            return result;
775
        }
675 776
    }
676 777
}

내보내기 Unified diff