프로젝트

일반

사용자정보

개정판 dd27861e

IDdd27861eeda95cb65b371b89a2428a1ac1fc048a
상위 528aa878
하위 284fa2c9

이지연이(가) 약 3년 전에 추가함

issue #000: Revision HistoryForm 추가, Valve Grouping 공란 Row 추가, 공란 선택시 로직 수정, TieinPoint 로직 수정, Psn, Pathitem 컬럼 Ui 수정, Topologies Attribute Display Name으로 변경

Change-Id: I87a6a136079e49f1e195d622816cebd80375334a

차이점 보기:

DTI_PID/ID2PSN/PSN.cs
243 243
            // Update Keyword
244 244
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateKeywordForPSN ( 55 % )");
245 245
            UpdateKeywordForPSN();
246
            // Vent/Drain PSN 데이터 제거
247
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  DeleteVentDrain ( 60 % )");
248
            DeleteVentDrain();
246
          
249 247
            // Topology의 subtype을 update(bypass, Header, 등등) 
250
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateSubType ( 65 % )");
248
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateSubType ( 60 % )");
251 249
            UpdateSubType();
252 250
            // Update Error
253
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateErrorForPSN ( 70 % )");
251
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateErrorForPSN ( 65 % )");
252
            PathItemSorting();
254 253
            UpdateErrorForPSN();
255 254
            // Insert Tee
256
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  InsertTeePSN ( 75 % )");
255
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  InsertTeePSN ( 70 % )");
257 256
            InsertTeePSN();
258
            // 확도 계산
259
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateAccuracy ( 80 % )");
260
            UpdateAccuracy();
257
         
261 258
            // ValveGrouping
262
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateValveGrouping ( 85 % )");
259
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateValveGrouping ( 75 % )");
263 260
            UpdateValveGrouping();
264 261

  
265
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  PathItemSorting ( 90 % )");
262
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  PathItemSorting ( 80 % )");
266 263
            PathItemSorting();
267 264

  
268 265
            // AirFinCooler 
269
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateAirFinCooler ( 95 % )");
266
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateAirFinCooler ( 85 % )");
270 267
            UpdateAirFinCooler();
271 268

  
269
            // Vent/Drain PSN 데이터 제거
270
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  DeleteVentDrain ( 90 % )");
271
            DeleteVentDrain();
272

  
273
            // 확도 계산
274
            splashScreenManager1.SetWaitFormDescription(i++ + " / 19  UpdateAccuracy ( 95 % )");
275
            UpdateAccuracy();
276

  
277
            //UpdatePSNType();
278

  
279
        }
280

  
281
        private void UpdatePSNType()
282
        {
283
            try
284
            {
285
                foreach (PSNItem PSNItem in PSNItems)
286
                {    
287
                    foreach (Group group in PSNItem.Groups)
288
                    {
289
                        foreach (Item item in group.Items)
290
                        {
291
                            DataRow[] pipeSystems = PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID()));
292
                           // PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
293

  
294
                            foreach(DataRow dr in pipeSystems)
295
                            {
296
                                dr["Type"] = PSNItem.GetPSNType();
297
                            }                            
298
                        }
299
                    }                
300
                }
301
            }
302
            catch (Exception ex)
303
            {
304
                MessageBox.Show(ex.Message, "ID2 ", MessageBoxButtons.OK, MessageBoxIcon.Error);
305
            }
272 306
        }
273 307

  
274 308
        private void PathItemSorting()
......
320 354
        {
321 355
            try
322 356
            {
323
                int afcTagNum = 0;
357
                
324 358
                int pumpTagNum = 0;
325 359
                #region EquipmentAirFinCooler Info
326 360
                EquipmentAirFinCoolerInfo EquipmentAirFinCooler = new EquipmentAirFinCoolerInfo();
......
335 369
                }
336 370
                #endregion
337 371

  
338
                DataRow[] airFinCoolerRows = PipeSystemNetwork.Select("AFC = 'P1'");
372
                
339 373
                DataRow[] pumpRows = PipeSystemNetwork.Select("PUMP = 'PUMP'");
340 374
                // 1, 2번
341 375
                foreach (DataRow dataRow in pumpRows) 
......
632 666
                    }                   
633 667
                }
634 668
                
669
                int afcTagNum = 0;
670
                DataRow[] airFinCoolerRows = PipeSystemNetwork.Select("AFC = 'P1'");
635 671
                foreach (DataRow dataRow in airFinCoolerRows)
636 672
                {
637 673
                    afcTagNum++;
674
                    DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
675
                    foreach (DataRow dr in pathItemRows)
676
                    {
677
                        dr["EqpGroupTag"] = "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));
678
                    }
679
                }
680
                
681
                foreach (DataRow dataRow in airFinCoolerRows)
682
                {
683
                    
638 684
                    string EGFlowDirection = string.Empty;
639

  
685
                    
640 686
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
641 687
                    if (PSNItem.Groups.First().Items.First().Equipment != null)
642 688
                    {
......
654 700
                    }
655 701

  
656 702
                    DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"].ToString()));
657
                    List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
703
                    string AFCTag = pathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).First().Field<string>("EqpGroupTag");
704
                    List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).ToList();
658 705
                    //ViewPipeSystemNetwork_OID
659 706
                    string MainLineTag = "";
660 707
                    if (dataRow["Type"].ToString() == "E2E")
......
673 720
                            DataRow dr = PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewOID)).First();
674 721
                            if (dr.Field<string>("AFC") != "P1")
675 722
                            {
676
                                bCount++;
677
                                string[] arr = dr.Field<string>("AFC").Split('_');
678
                                if (arr.Length == 1)
679
                                    dr["AFC"] = arr[0] + "_1";
680
                                else
723
                                if (lstViewPipeSystemNetwork_OID.Where(x => x.Equals(viewOID)).Count() == 1)
724
                                {
725
                                    MainLineTag = "M";
726
                                    dataRow["AFC"] = "P3";
727
                                }
728
                                else if(lstViewPipeSystemNetwork_OID.Where(x => x.Equals(viewOID)).Count() > 1)
681 729
                                {
682
                                    dr["AFC"] = arr[0] + "_" + Convert.ToInt32(arr[1]) + 1;
683
                                    afcTagNum++;
730
                                    DataRow[] viewpipeSystem = PipeSystemNetwork.Select(string.Format("OID = '{0}'", viewOID));
731
                                    foreach (DataRow row in viewpipeSystem)
732
                                    {
733
                                        row["AFC"] = "P4";
734
                                    }
735

  
684 736
                                    DataRow[] viewpathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", viewOID));
737

  
738
                                    if(viewpathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).Count() > 0)
739
                                        AFCTag = viewpathItemRows.Where(x => !string.IsNullOrEmpty(x.Field<string>("EqpGroupTag"))).First().Field<string>("EqpGroupTag");                                    
740

  
685 741
                                    foreach (DataRow viewdr in viewpathItemRows)
686 742
                                    {
687
                                        viewdr["EqpGroupTag"] = "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));  //ATG Sequence No Rule 여쭤봐야함.
743
                                       // viewdr["EqpGroupTag"] = AFCTag;
688 744
                                        viewdr["MainLineTag"] = "M";
689 745
                                    }
690 746
                                }
691

  
692 747
                            }
693
                        }
694
                        
695
                        if(bCount == 1)
696
                        {
697
                            MainLineTag = "M";
698
                           // dataRow["AFC"] = "P3";
699
                        }
700
                            
748
                        }                            
701 749
                    }
702 750

  
703 751
                    foreach (DataRow dr in pathItemRows)
704 752
                    {
705
                        dr["EqpGroupTag"] = "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));  //ATG Sequence No Rule 여쭤봐야함.
753
                        dr["EqpGroupTag"] = AFCTag;// "AFC" + string.Format("-{0}", string.Format("{0:D3}", afcTagNum));  //ATG Sequence No Rule 여쭤봐야함.
706 754
                        dr["MainLineTag"] = MainLineTag; 
707 755
                        dr["EGFlowDirection"] = EGFlowDirection; 
708 756
                    }
......
716 764
                    {
717 765
                        List<string> lstViewPipeSystemNetwork_OID = pathItemRows.Select(x => x.Field<string>("ViewPipeSystemNetwork_OID")).Distinct().ToList();
718 766
                        List<string> lstpsn = new List<string>();
767
                        List<string> lstAll = new List<string>();
719 768
                        string EqpGroupTag = string.Empty;
720 769
                        foreach (string viewOID in lstViewPipeSystemNetwork_OID)
721 770
                        {
......
735 784
                                {
736 785
                                    dr["EqpGroupTag"] = EqpGroupTag;
737 786

  
738
                                    if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstpsn.Contains("ViewPipeSystemNetwork_OID"))
787
                                    if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstpsn.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
788
                                    {
739 789
                                        lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
790
                                        lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
791
                                    }
740 792
                                }
741 793
                            }
742 794
                            
743 795
                        }
744 796

  
745
                        while(lstpsn.Count() != 0)
797
                        while (lstpsn.Count() != 0)
746 798
                        {
747
                            foreach(string psn in lstpsn)
799
                            int lstCount = lstpsn.Count;
800
                            for (int i = 0; i < lstpsn.Count(); i++) //string psn in lstpsn
748 801
                            {
749
                                DataRow[] rule4pathItems = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", psn));
802
                                
803
                                DataRow[] rule4pathItems = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", lstpsn[i]));
750 804
                                foreach (DataRow dr in rule4pathItems)
751 805
                                {
752
                                    dr["EqpGroupTag"] = EqpGroupTag;
753

  
754
                                    if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstpsn.Contains("ViewPipeSystemNetwork_OID"))
806
                                    if (!string.IsNullOrEmpty(dr.Field<string>("ViewPipeSystemNetwork_OID")) && !lstAll.Contains(dr.Field<string>("ViewPipeSystemNetwork_OID")))
807
                                    {
755 808
                                        lstpsn.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
809
                                        lstAll.Add(dr.Field<string>("ViewPipeSystemNetwork_OID"));
810
                                    }
811

  
812
                                    if (dr["EqpGroupTag"].Equals(EqpGroupTag))
813
                                        continue;
814

  
815
                                    dr["EqpGroupTag"] = EqpGroupTag;                                  
756 816
                                }
757 817

  
758
                                lstpsn.Remove(psn);
818
                                lstpsn.Remove(lstpsn[i]);
759 819
                            }                        
760 820

  
761 821
                        }
......
886 946
                    int bCnt = 0;
887 947

  
888 948
                    //bool bCheck = false;
949
                    if (drPathitem["PipeSystemNetwork_OID"].ToString().Contains("901"))
950
                    {
951

  
952
                    }
889 953
                    List<DataRow> lstitem = new List<DataRow>();
890 954
                    foreach (DataRow dr in pathItemRows)
891 955
                    {
892 956
                        //if (!string.IsNullOrEmpty(dr["GROUPTAG"].ToString()))
893 957
                        //    break;
894 958

  
895
                       if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString()))
959
                        if (!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString()))
896 960
                        {
897 961
                            DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString()));
898 962
                            if (dr["GROUPTAG"].ToString() == "Scope Break")
899 963
                            {
900 964
                                dr["GROUPTAG"] = string.Empty;
901
                                break;
902
                            }
903

  
904
                            if (rows.First()["SubType"].ToString() != "Bypass" && rows.First()["SubType"].ToString() != "Vent_Drain")
905
                            {
906
                               // bCheck = true;
907
                                lstitem.Add(dr);
908 965
                                keyValuePairs.Add(bCnt, lstitem.ToList());
909 966
                                bCnt++;
910 967
                                lstitem.Clear();
968
                                //break;
911 969
                            }
912 970
                            else
913
                                lstitem.Add(dr);
971
                            {
972
                                if (rows.First()["SubType"].ToString() != "Bypass" && rows.First()["SubType"].ToString() != "Vent_Drain")
973
                                {
974
                                    // bCheck = true;
975
                                    if (lstitem.ToList().Where(x => !string.IsNullOrEmpty(x.Field<string>("GROUPTAG"))).Count() > 0)
976
                                    {
977
                                        lstitem.Add(dr);
978
                                        keyValuePairs.Add(bCnt, lstitem.ToList());
979
                                        lstitem.Clear();
980
                                    }
981
                                    else
982
                                    {
983
                                        keyValuePairs.Add(bCnt, lstitem.ToList());
984
                                        lstitem.Clear();
985
                                        lstitem.Add(dr);
986
                                    }
987
                                    bCnt++;
988

  
989
                                }
990
                                else
991
                                    lstitem.Add(dr);
992
                            }
993

  
914 994
                        }
915 995
                        else
916 996
                            lstitem.Add(dr);
......
926 1006
                        continue;
927 1007

  
928 1008
                    string VGTag = string.Empty;
929
                    if (valveitem.AttributeName == "NoSelection")
1009
                    if (valveitem.AttributeName == "NoSelection" || valveitem.AttributeName == string.Empty)
930 1010
                    {
931 1011
                        VGTag = valveitem.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
932 1012
                        vgTagNum++;
933 1013
                    }
934 1014
                    else
935 1015
                    {
936
                        VGTag = valveitem.TagIdentifier + "-" + valvetag[1];
1016
                        if(string.IsNullOrEmpty(valvetag[1]))
1017
                            VGTag = valveitem.TagIdentifier + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
1018
                        else
1019
                            VGTag = valveitem.TagIdentifier + "-" + valvetag[1] + string.Format("-{0}", string.Format("{0:D5}", vgTagNum));
1020

  
1021
                        vgTagNum++;
937 1022
                    }
938 1023

  
939 1024
                    foreach (KeyValuePair<int, List<DataRow>> keyValuePair in keyValuePairs)
......
943 1028
                            foreach (DataRow dr in keyValuePair.Value)
944 1029
                            {
945 1030
                                dr["GROUPTAG"] = VGTag;
1031

  
1032
                                if(!string.IsNullOrEmpty(dr["BranchTopologySet_OID"].ToString()))
1033
                                {
1034
                                    if(TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString())).First().Field<string>("SubType") == "Bypass")
1035
                                    {
1036
                                        DataRow[] rows = keyValuePair.Value.Where(x => x.Field<string>("ViewPipeSystemNetwork_OID").Equals(dr["ViewPipeSystemNetwork_OID"].ToString())).ToArray();
1037
                                        foreach(DataRow path in rows)
1038
                                        {
1039
                                            DataRow topology = TopologySet.Select(string.Format("OID = '{0}'", path["BranchTopologySet_OID"].ToString())).First();
1040
                                            if (topology.Field<string>("SubType").Equals("Bypass"))
1041
                                            {
1042
                                                DataRow[] drPathItem = PathItems.Select(string.Format("TopologySet_OID = '{0}'", topology.Field<string>("OID")));
1043
                                                foreach(DataRow pathitem in drPathItem)
1044
                                                {
1045
                                                    pathitem["GROUPTAG"] = VGTag;
1046
                                                }
1047
                                            }
1048
                                        }
1049
                                    }
1050
                                    
1051

  
1052
                                    //ViewPipeSystemNetwork_OID
1053
                                    //DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", dr["BranchTopologySet_OID"].ToString()));
1054
                                }
946 1055
                            }
947 1056
                        }
948 1057
                    }
......
1053 1162
                            {
1054 1163
                                Attribute itemAttr = item.Attributes.Find(x => x.Name == uid);
1055 1164

  
1056
                                Attribute attribute = lineNumber.Attributes.Find(x => x.Name == uid);
1165
                                Attribute attribute = lineNumber.Attributes.Find(x => x.DisplayName == uid);
1057 1166
                                if (attribute != null && !string.IsNullOrEmpty(attribute.Value))
1058 1167
                                    pipeLineID.Add(attribute.Value);//item.TopologyData += attribute.Value;
1059 1168
                            }
......
1842 1951
                DataTable dtEquipmentAirFinCooler = DB.SelectAirFinCoolerSetting();
1843 1952
                foreach (DataRow row in dtEquipmentAirFinCooler.Rows)
1844 1953
                {
1845
                    //pump type도 마찬가지?
1846 1954
                    EquipmentAirFinCooler.EquipmentAirFinCoolerItem.Add(new EquipmentAirFinCoolerItem()
1847 1955
                    {
1848 1956
                        Type = row["Type"].ToString(),
......
1946 2054
                                        ValveGroupItem valveitem = ValveGrouping.ValveGroupItems.Where(x => x.SppidSymbolName == item.Name).First();
1947 2055
                                        string value = string.Empty;
1948 2056

  
1949
                                        if (valveitem.GroupType == "Scope Break" || valveitem.AttributeName == "NoSelection")
2057
                                        if (valveitem.GroupType == "Scope Break" || valveitem.AttributeName == "NoSelection" || valveitem.AttributeName == string.Empty)
1950 2058
                                            value = "NoSelection";
1951 2059
                                        else
1952
                                            value = item.Attributes.Find(x => x.Name == valveitem.AttributeName).Value;
2060
                                        {
2061
                                            if(item.Attributes.Find(x => x.Name == valveitem.AttributeName) == null)
2062
                                                value = "NoSelection";
2063
                                            else
2064
                                                value = item.Attributes.Find(x => x.Name == valveitem.AttributeName).Value;
2065
                                        }
1953 2066

  
1954 2067
                                        if (valveitem.GroupType == "Scope Break")
1955 2068
                                            VgTag = "Scope Break";
......
2174 2287

  
2175 2288
                                        newRow["FROM_DATA"] = FROM_DATA;
2176 2289
                                        newRow["TO_DATA"] = TO_DATA;
2290
                                        //if(TO_DATA.Contains("Free Vent W-Screen") || TO_DATA.Contains("Empty LineNumber") || FROM_DATA.Contains("Empty LineNumber"))
2291
                                        //{
2292

  
2293
                                        //}
2177 2294
                                        newRow["Type"] = PSNItem.GetPSNType();
2178 2295

  
2179 2296
                                        if (psnOrder > 0)
......
2794 2911
                try
2795 2912
                {
2796 2913
                    PSNItem PSNItem = PSNItems.Find(x => x.PSN_OID() == dataRow["OID"].ToString());
2914
                   
2797 2915
                    bool change = false;
2798 2916
                    bool bCheck = false;
2799
                    int bCount = 0;
2800 2917
                    if (!PSNItem.EnableType(PSNItem.StartType))
2801 2918
                    {
2802 2919
                        change = true;
2803
                        bCheck = change;
2804 2920
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
2805 2921
                        int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First());
2806 2922

  
......
2809 2925
                        {
2810 2926
                            string FROM_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
2811 2927

  
2812
                            tieInPointIndex++;
2813

  
2814

  
2815
                            if (item.ItemType == ItemType.Line)
2928
                            foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
2816 2929
                            {
2817
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
2818
                                bCount = 2;
2819

  
2820
                                foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
2930
                                loopRow["FROM_DATA"] = FROM_DATA;
2931
                                if (item.ItemType == ItemType.Line)
2821 2932
                                {
2822
                                    loopRow["FROM_DATA"] = FROM_DATA;
2823 2933
                                    if (loopRow.Field<string>("OrderNumber") == "0")
2824 2934
                                    {
2825 2935
                                        string status = loopRow.Field<string>("Status");
......
2834 2944
                                    }
2835 2945
                                }
2836 2946
                            }
2947

  
2948
                            tieInPointIndex++;
2949

  
2950
                            if (item.ItemType == ItemType.Line)
2951
                            {
2952
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);                                
2953
                            }
2837 2954
                            else
2838 2955
                            {
2839
                                if(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).Count() > 0)
2840
                                    PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex);
2956
                                PathItems.Rows.InsertAt(createLineRow(PathItems.Select(string.Format("PipeLine_OID = '{0}' AND ItemName = 'PipeRun' AND PipeSystemNetwork_OID = '{1}'", item.PSNPipeLineID, dataRow["OID"])).First()), insertIndex);
2957
                                PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
2841 2958

  
2842
                                    PathItems.Rows.InsertAt(createTerminatorRow(pathItemRows.First(), FROM_DATA), insertIndex);
2843
                                   
2844
                                
2845
                                bCount = 3;
2959
                                bCheck = true;
2846 2960
                            }
2847 2961

  
2848 2962
                            PSNItem.StartType = PSNType.Equipment;
......
2855 2969
                    }
2856 2970

  
2857 2971
                    if (!PSNItem.EnableType(PSNItem.EndType))
2858
                    {
2859
                        change = true;
2972
                    {                        
2860 2973
                        DataRow[] pathItemRows = PathItems.Select(string.Format("PipeSystemNetwork_OID = '{0}'", dataRow["OID"]));
2861 2974
                        //int insertIndex = PathItems.Rows.IndexOf(pathItemRows.First()) + pathItemRows.Count() - 1;
2862 2975
                        DataRow dr = pathItemRows.Last();
2863 2976
                        if (change)
2864
                            dr = pathItemRows[pathItemRows.Count() - bCount];
2977
                        {
2978
                            if(bCheck)
2979
                                dr = pathItemRows[pathItemRows.Count() - 3];
2980
                            else
2981
                            {
2982
                                dr = pathItemRows[pathItemRows.Count() - 2];
2983
                            }
2984
                        }
2865 2985

  
2986
                        change = true;
2866 2987
                        int insertIndex = PathItems.Rows.IndexOf(dr) + 1;
2867 2988

  
2868 2989
                        Item item = PSNItem.Groups.Last().Items.Last();
......
2870 2991
                        {
2871 2992
                            string TO_DATA = string.Format("TIEINPOINT_{0:D5}V", tieInPointIndex);
2872 2993

  
2873
                            if (item.ItemType == ItemType.Line)
2994
                           
2995
                            foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
2874 2996
                            {
2875
                                foreach (DataRow loopRow in PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())))
2997
                                loopRow["TO_DATA"] = TO_DATA;
2998
                                if (item.ItemType == ItemType.Line)
2876 2999
                                {
2877
                                    loopRow["TO_DATA"] = TO_DATA;
2878 3000
                                    if (loopRow.Field<string>("OrderNumber") == Convert.ToString(PipeSystemNetwork.Select(string.Format("OID = '{0}'", PSNItem.PSN_OID())).Count() - 1))
2879 3001
                                    {
2880 3002
                                        string status = loopRow.Field<string>("Status");
......
2887 3009
                                            loopRow["IsValid"] = "Error";
2888 3010
                                    }
2889 3011
                                }
2890
                            }
3012
                            }                            
2891 3013

  
2892 3014
                            tieInPointIndex++;
2893 3015

  
......
3251 3373
                else if (StartType == PSNType.Branch)
3252 3374
                {
3253 3375
                    //if (!item.MissingLineNumber && item.Relations.First().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
3254
                    if (!item.MissingLineNumber2 && item.Relations.First().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
3376
                    if (item.Relations.First().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
3255 3377
                        result = item.Relations.First().Item.LineNumber.Name;
3256 3378
                    else
3257 3379
                    {
3258 3380
                        IsValid = "Error";
3259
                        Status += ", Missing LineNumber_2";
3260 3381
                        result = "Empty LineNumber";
3261 3382
                    }
3262 3383

  
3384
                    if (item.MissingLineNumber2)
3385
                        Status += ", Missing LineNumber_2";
3386

  
3387

  
3263 3388
                    //if (item.MissingLineNumber1)
3264 3389
                    //{
3265 3390
                    //    Status += ", Missing LineNumber_1";
......
3376 3501
            else if (EndType == PSNType.Branch)
3377 3502
            {
3378 3503
                //if (!item.MissingLineNumber && item.Relations.Last().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
3379
                if (!item.MissingLineNumber2 && item.Relations.Last().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
3504
                if (item.Relations.Last().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
3380 3505
                    result = item.Relations.Last().Item.LineNumber.Name;
3381 3506
                else
3382 3507
                {
3383
                    IsValid = "Error";
3384
                    Status += ", Missing LineNumber_2";
3508
                    IsValid = "Error";                    
3385 3509
                    result = "Empty LineNumber";
3386 3510
                }
3387 3511

  
3512
                if(item.MissingLineNumber2)
3513
                    Status += ", Missing LineNumber_2";
3388 3514
                //if (item.MissingLineNumber1)
3389 3515
                //{
3390 3516
                //    Status += ", Missing LineNumber_1";

내보내기 Unified diff

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