프로젝트

일반

사용자정보

개정판 8f24b438

ID8f24b438a89866e7309c3a0cf34c7d056cd21ecc
상위 94a117ca
하위 4c76a67a

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

dev issue #000 : dev

Change-Id: I9028fd2c54a0abd4dc23db92e63e20422b486fbd

차이점 보기:

DTI_PID/ID2PSN/PSN.cs
20 20

  
21 21
    public class PSN
22 22
    {
23
        private double[] DrawingSize = null;
24
        private double DrawingWidth = double.NaN;
25
        private double DrawingHeight = double.NaN;
26
        public int Revision;
23 27
        public DataTable PathItems { get; set; }
24 28
        public DataTable SequenceData { get; set; }
25 29
        public DataTable PipeSystemNetwork { get; set; }
......
37 41
        const string FluidPriorityType = "FLUIDCODE";
38 42
        const string PipingMaterialsPriorityType = "PIPINGMATERIALSCLASS";
39 43

  
40
        public PSN(List<Document> documents)
44
        public PSN(List<Document> documents, int Revision)
41 45
        {
42 46
            Documents = documents;
43 47
            foreach (Document document in Documents)
44 48
                groups.AddRange(document.Groups);
45 49
            opcDT = GetOPCInfo();
46 50
            topologyRuleDT = GetTopologyRule();
51
            this.Revision = Revision;
52
            DrawingSize = DB.GetDrawingSize();
53
            DrawingWidth = DrawingSize[2] - DrawingSize[0];
54
            DrawingHeight = DrawingSize[3] - DrawingSize[1];
47 55
        }
48 56

  
49 57
        public void SetPSNData()
......
65 73
                foreach (Item item in document.Items)
66 74
                {
67 75
                    item.TopologyData = string.Empty;
76
                    item.PSNPipeLineID = string.Empty;
68 77
                    LineNumber lineNumber = document.LineNumbers.Find(x => x.UID == item.Owner);
69 78
                    if (lineNumber != null)
70 79
                    {
......
82 91
                                    item.TopologyData += attribute.Value;
83 92
                            }
84 93
                        }
94

  
95
                        Attribute insulAttr = item.LineNumber.Attributes.Find(x => x.Name == "InsulationPurpose");
96
                        if (!string.IsNullOrEmpty(insulAttr.Value))
97
                            item.PSNPipeLineID = item.TopologyData + "-" + insulAttr.Value;
98
                        else
99
                            item.PSNPipeLineID = item.TopologyData;
85 100
                    }
86 101
                }
87 102
            }
......
131 146
                PSNItem PSNItem = PSNItems.Find(x => x.UID == uid);
132 147
                if (PSNItem == null)
133 148
                {
134
                    PSNItem = new PSNItem(PSNItems.Count) { UID = uid };
149
                    PSNItem = new PSNItem(PSNItems.Count, Revision) { UID = uid };
135 150
                    PSNItems.Add(PSNItem);
136 151
                }
137 152
                PSNItem.Groups.Add(group);
......
452 467
                {
453 468
                    Equipment equipment = equipments.Find(x => x.UID == relation.UID);
454 469
                    equipment.Nozzles.Add(item);
455
                    row["ITEMTAG"] = string.Format("N-{0}", equipment.Nozzles.Count);
470
                    row["ITEMTAG"] = string.Format("N-{0}", string.Format("{0:D3}", equipment.Nozzles.Count + 100));
456 471
                    row["Equipment_OID"] = equipment.UID;
472

  
473

  
457 474
                }
458
                row["XCOORDS"] = item.POINT[0].ToString();
459
                row["YCOORDS"] = item.POINT[1].ToString();
475
                row["XCOORDS"] = (item.POINT[0] / DrawingWidth).ToString();
476
                row["YCOORDS"] = (item.POINT[1] / DrawingHeight).ToString();
460 477
                Attribute fluidAttr = item.LineNumber.Attributes.Find(x => x.Name == "FluidCode");
461 478
                row["FLUID"] = fluidAttr != null ? fluidAttr.Value : string.Empty;
462 479
                Attribute npdAttr = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
......
486 503
                row["ITEMTAG"] = null;
487 504

  
488 505
                List<double> xList = equipment.POINT.Select(x => x[0]).ToList();
489
                row["XCOORDS"] = xList.Sum() / (double)xList.Count;
506
                row["XCOORDS"] = (xList.Sum() / (double)xList.Count) / DrawingWidth;
490 507

  
491 508
                List<double> yList = equipment.POINT.Select(x => x[1]).ToList();
492
                row["YCOORDS"] = yList.Sum() / (double)yList.Count;
509
                row["YCOORDS"] = (yList.Sum() / (double)yList.Count) / DrawingHeight;
493 510

  
494 511
                equipDT.Rows.Add(row);
495 512
            }
......
512 529
            pathItemsDT.Columns.Add("NPD", typeof(string));
513 530
            pathItemsDT.Columns.Add("PipeSystemNetwork_OID", typeof(string));
514 531
            pathItemsDT.Columns.Add("PipeRun_OID", typeof(string));
515
            pathItemsDT.Columns.Add("DrawingName", typeof(string));
532
            pathItemsDT.Columns.Add(" ", typeof(string));
516 533

  
517 534
            DataTable sequenceDataDT = new DataTable();
518 535
            sequenceDataDT.Columns.Add("OID", typeof(string));
......
587 604
                            DataRow newRow = pathItemsDT.NewRow();
588 605
                            newRow["OID"] = itemOID;
589 606

  
590
                            newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "-{0}", index);
607
                            newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
591 608

  
592 609
                            newRow["TopologySet_OID"] = item.Topology.FullName;
593 610

  
594 611
                            newRow["BranchTopologySet_OID"] = branchTopologyName;
595
                            newRow["PipeLine_OID"] = null;
612
                            newRow["PipeLine_OID"] = item.PSNPipeLineID;
596 613
                            newRow["ITEMNAME"] = null;
597 614
                            newRow["ITEMTAG"] = GetItemTag();
598 615
                            newRow["TYPE"] = item.Name;
......
610 627

  
611 628
                            newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
612 629
                            newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
613
                            newRow["DrawingName"] = group.Document.DrawingName;
614 630

  
615 631
                            pathItemsDT.Rows.Add(newRow);
616 632
                        }
......
630 646
                            newRow["OID"] = PSNItem.PSN_OID();
631 647
                            newRow["Type"] = PSNItem.GetPSNType();
632 648
                            newRow["OrderNumber"] = psnOrder;
633
                            newRow["Pipeline_OID"] = item.TopologyData;
649
                            newRow["Pipeline_OID"] = item.PSNPipeLineID;
634 650
                            newRow["FROM_DATA"] = PSNItem.GetFromData();
635 651
                            newRow["TO_DATA"] = PSNItem.GetToData();
636 652
                            newRow["TopologySet_OID_Key"] = item.Topology.FullName;
637
                            newRow["PSNRevisionNumber"] = null;
653
                            newRow["PSNRevisionNumber"] = string.Format("{0:D3}", Revision);
638 654
                            newRow["PathOID"] = null;
639 655
                            newRow["PBS"] = null;
640 656

  
......
659 675
                        {
660 676
                            string result = string.Empty;
661 677
                            if (item.ItemType == ItemType.Line)
662
                                result = item.LineNumber != null ? item.LineNumber.Name : string.Empty; ;
678
                                result = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
679
                            else if (item.ItemType == ItemType.Symbol && item.SubItemType == SubItemType.Nozzle)
680
                                result = Nozzle.Select(string.Format("OID = '{0}'", item.UID)).First()["ITEMTAG"].ToString();
681

  
663 682

  
664 683
                            return result;
665 684
                        }
......
675 694

  
676 695
    public class PSNItem
677 696
    {
678
        public PSNItem(int count)
697
        public PSNItem(int count, int Revision)
679 698
        {
680 699
            Groups = new List<Group>();
681 700
            Topologies = new List<Topology>();
682 701

  
683 702
            Index = count + 1;
684
            Revision = 1;
703
            this.Revision = Revision;
685 704
        }
705
        private int Revision;
686 706
        public string UID { get; set; }
687 707
        public List<Group> Groups { get; set; }
688 708
        public List<Topology> Topologies { get; set; }
689 709
        public PSNType StartType { get; set; }
690 710
        public PSNType EndType { get; set; }
691 711
        public int Index { get; set; }
692
        public int Revision { get; set; }
693 712
        public string PSN_OID()
694 713
        {
695
            return string.Format("R{0}-PSN-{1}", string.Format("{0:D4}", Revision), string.Format("{0:D4}", Index));
714
            return string.Format("R{0}-PSN-{1}", string.Format("{0:D3}", Revision), string.Format("{0:D5}", Index));
696 715
        }
697 716
        public string GetPSNType()
698 717
        {

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)