프로젝트

일반

사용자정보

개정판 27d06aa8

ID27d06aa81fd18c52d680c3f82eaaaea08c1c123a
상위 327a7a9c
하위 7692cee4

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

issue #000:

Change-Id: I686ce64f271bbca9175dda0a0c064fc1e2094c34

차이점 보기:

DTI_PID/ID2PSN/PSN.cs
559 559

  
560 560
        private void SetTopology()
561 561
        {
562
            #region 기본 topology 정리
563
            foreach (PSNItem PSNItem in PSNItems)
562
            try
564 563
            {
565
                Topology topology = null;
566
                foreach (Group group in PSNItem.Groups)
564
                #region 기본 topology 정리
565
                foreach (PSNItem PSNItem in PSNItems)
567 566
                {
568
                    foreach (Item item in group.Items)
567
                    Topology topology = null;
568
                    foreach (Group group in PSNItem.Groups)
569 569
                    {
570
                        if (string.IsNullOrEmpty(item.TopologyData))
571
                            topology = null;
572
                        else
570
                        foreach (Item item in group.Items)
573 571
                        {
574
                            if (topology == null)
575
                            {
576
                                topology = new Topology()
577
                                {
578
                                    ID = item.TopologyData
579
                                };
580
                                Topologies.Add(topology);
581

  
582
                                if (!PSNItem.Topologies.Contains(topology))
583
                                    PSNItem.Topologies.Add(topology);
584
                            }
572
                            if (string.IsNullOrEmpty(item.TopologyData))
573
                                topology = null;
585 574
                            else
586 575
                            {
587
                                if (topology.ID != item.TopologyData)
576
                                if (topology == null)
588 577
                                {
589 578
                                    topology = new Topology()
590 579
                                    {
......
595 584
                                    if (!PSNItem.Topologies.Contains(topology))
596 585
                                        PSNItem.Topologies.Add(topology);
597 586
                                }
598
                            }
587
                                else
588
                                {
589
                                    if (topology.ID != item.TopologyData)
590
                                    {
591
                                        topology = new Topology()
592
                                        {
593
                                            ID = item.TopologyData
594
                                        };
595
                                        Topologies.Add(topology);
596

  
597
                                        if (!PSNItem.Topologies.Contains(topology))
598
                                            PSNItem.Topologies.Add(topology);
599
                                    }
600
                                }
599 601

  
600
                            item.Topology = topology;
601
                            topology.Items.Add(item);
602
                                item.Topology = topology;
603
                                topology.Items.Add(item);
604
                            }
602 605
                        }
603 606
                    }
604 607
                }
605
            }
606
            #endregion
608
                #endregion
607 609

  
608
            #region Type
609
            List<string> ids = Topologies.Select(x => x.ID).Distinct().ToList();
610
            foreach (string id in ids)
611
            {
612
                List<Topology> topologies = Topologies.FindAll(x => x.ID == id);
610
                #region Type
611
                List<string> ids = Topologies.Select(x => x.ID).Distinct().ToList();
612
                foreach (string id in ids)
613
                {
614
                    try
615
                    {
613 616

  
614
                // Main
615
                List<Topology> mainTopologies = FindMainTopology(topologies);
616
                foreach (Topology topology in mainTopologies)
617
                    topology.Type = "M";
618 617

  
619
                // Branch
620
                List<Topology> branchToplogies = topologies.FindAll(x => string.IsNullOrEmpty(x.Type));
621
                foreach (Topology topology in branchToplogies)
622
                    topology.Type = "B";
618
                        List<Topology> topologies = Topologies.FindAll(x => x.ID == id);
619

  
620
                        // Main
621
                        List<Topology> mainTopologies = FindMainTopology(topologies);
622
                        foreach (Topology topology in mainTopologies)
623
                            topology.Type = "M";
624

  
625
                        // Branch
626
                        List<Topology> branchToplogies = topologies.FindAll(x => string.IsNullOrEmpty(x.Type));
627
                        foreach (Topology topology in branchToplogies)
628
                            topology.Type = "B";
629
                    }
630
                    catch (Exception ex)
631
                    {
632
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
633
                        MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
634
                    }
635
                }
636
                #endregion
637
            }
638
            catch (Exception ex)
639
            {
640
                Log.Write(ex.Message + "\r\n" + ex.StackTrace);
641
                MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
623 642
            }
624
            #endregion
643

  
625 644
        }
626 645

  
627 646
        private void SetTopologyIndex()
......
1075 1094
                    foreach (KeywordInfo keywordInfo in KeywordInfos)
1076 1095
                        keywordInfo.KeywordItems = keywordInfo.KeywordItems.OrderBy(x => x.Index).ToList();
1077 1096

  
1078
                    //PSN, PathItems, SequenceData 관련
1079
                    foreach (Group group in PSNItem.Groups)
1097
                    try
1080 1098
                    {
1081
                        foreach (Item item in group.Items)
1099
                        //PSN, PathItems, SequenceData 관련
1100
                        foreach (Group group in PSNItem.Groups)
1082 1101
                        {
1083
                            if (item.BranchItems.Count == 0)
1084
                            {
1085
                                CreatePathItemsDataRow(item.UID, item.ID2DBType);
1086
                                CreateSequenceDataDataRow(item.UID);
1087
                                index++;
1088
                            }
1089
                            else
1102
                            foreach (Item item in group.Items)
1090 1103
                            {
1091
                                CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType);
1092
                                CreateSequenceDataDataRow(item.UID + "_L1");
1093
                                index++;
1094
                                for (int i = 0; i < item.BranchItems.Count; i++)
1104
                                if (item.BranchItems.Count == 0)
1095 1105
                                {
1096
                                    CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
1097
                                    CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1));
1106
                                    CreatePathItemsDataRow(item.UID, item.ID2DBType);
1107
                                    CreateSequenceDataDataRow(item.UID);
1098 1108
                                    index++;
1099

  
1100
                                    CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType);
1101
                                    CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2));
1109
                                }
1110
                                else
1111
                                {
1112
                                    CreatePathItemsDataRow(item.UID + "_L1", item.ID2DBType);
1113
                                    CreateSequenceDataDataRow(item.UID + "_L1");
1102 1114
                                    index++;
1103

  
1104
                                    if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item)
1105
                                        startBranchDic.Add(item.BranchItems[i], item);
1106
                                    else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item)
1107
                                        endBranchDic.Add(item.BranchItems[i], item);
1115
                                    for (int i = 0; i < item.BranchItems.Count; i++)
1116
                                    {
1117
                                        CreatePathItemsDataRow(string.Format(item.UID + "_B{0}", i + 1), "Branch", item.BranchItems[i].Topology.FullName, item.BranchItems[i]);
1118
                                        CreateSequenceDataDataRow(string.Format(item.UID + "_B{0}", i + 1));
1119
                                        index++;
1120

  
1121
                                        CreatePathItemsDataRow(string.Format(item.UID + "_L{0}", i + 2), item.ID2DBType);
1122
                                        CreateSequenceDataDataRow(string.Format(item.UID + "_L{0}", i + 2));
1123
                                        index++;
1124

  
1125
                                        if (item.BranchItems[i].Relations[0].Item != null && item.BranchItems[i].Relations[0].Item == item)
1126
                                            startBranchDic.Add(item.BranchItems[i], item);
1127
                                        else if (item.BranchItems[i].Relations[1].Item != null && item.BranchItems[i].Relations[1].Item == item)
1128
                                            endBranchDic.Add(item.BranchItems[i], item);
1129
                                    }
1108 1130
                                }
1109
                            }
1110 1131

  
1111
                            if (bPSNStart)
1112
                            {
1113
                                CreatePipeSystemNetworkDataRow();
1114
                                sPSNData = item.TopologyData;
1115
                                psnOrder++;
1116
                                bPSNStart = false;
1117
                            }
1118
                            else
1119
                            {
1120
                                if (item.TopologyData != sPSNData)
1132
                                if (bPSNStart)
1121 1133
                                {
1122 1134
                                    CreatePipeSystemNetworkDataRow();
1123 1135
                                    sPSNData = item.TopologyData;
1124 1136
                                    psnOrder++;
1137
                                    bPSNStart = false;
1125 1138
                                }
1126
                            }
1127
                            void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null)
1128
                            {
1129
                                DataRow newRow = pathItemsDT.NewRow();
1130
                                newRow["OID"] = itemOID;
1139
                                else
1140
                                {
1141
                                    if (item.TopologyData != sPSNData)
1142
                                    {
1143
                                        CreatePipeSystemNetworkDataRow();
1144
                                        sPSNData = item.TopologyData;
1145
                                        psnOrder++;
1146
                                    }
1147
                                }
1148
                                void CreatePathItemsDataRow(string itemOID, string itemType, string branchTopologyName = "", Item branchItem = null)
1149
                                {
1150
                                    DataRow newRow = pathItemsDT.NewRow();
1151
                                    newRow["OID"] = itemOID;
1131 1152

  
1132
                                newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1153
                                    newRow["SequenceData_OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1154

  
1155
                                    newRow["TopologySet_OID"] = item.Topology.FullName;
1156

  
1157
                                    newRow["BranchTopologySet_OID"] = branchTopologyName;
1158
                                    newRow["PipeLine_OID"] = item.PSNPipeLineID;
1159
                                    newRow["ITEMNAME"] = GetItemName(item, itemOID);
1160
                                    newRow["ITEMTAG"] = GetItemTag(item);
1161
                                    newRow["Class"] = GetClass(item, itemOID);
1162
                                    newRow["SubClass"] = GetSubClass(item, itemOID);
1163

  
1164
                                    if (item.ItemType == ItemType.Symbol)
1165
                                        newRow["TYPE"] = item.ID2DBName;
1166
                                    else if (item.ItemType == ItemType.Line)
1167
                                        newRow["TYPE"] = item.ID2DBType;
1168
                                    newRow["PIDNAME"] = group.Document.DrawingName;
1169

  
1170
                                    // NPD
1171
                                    if (item.LineNumber != null)
1172
                                    {
1173
                                        Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
1174
                                        if (attribute != null)
1175
                                            newRow["NPD"] = attribute.Value;
1176
                                    }
1177
                                    else
1178
                                        newRow["NPD"] = null;
1133 1179

  
1134
                                newRow["TopologySet_OID"] = item.Topology.FullName;
1135 1180

  
1136
                                newRow["BranchTopologySet_OID"] = branchTopologyName;
1137
                                newRow["PipeLine_OID"] = item.PSNPipeLineID;
1138
                                newRow["ITEMNAME"] = GetItemName(item, itemOID);
1139
                                newRow["ITEMTAG"] = GetItemTag(item);
1140
                                newRow["Class"] = GetClass(item, itemOID);
1141
                                newRow["SubClass"] = GetSubClass(item, itemOID);
1181
                                    newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1182
                                    if (branchItem == null)
1183
                                        newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1184
                                    else
1185
                                        newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID();
1142 1186

  
1143
                                if (item.ItemType == ItemType.Symbol)
1144
                                    newRow["TYPE"] = item.ID2DBName;
1145
                                else if (item.ItemType == ItemType.Line)
1146
                                    newRow["TYPE"] = item.ID2DBType;
1147
                                newRow["PIDNAME"] = group.Document.DrawingName;
1187
                                    newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
1148 1188

  
1149
                                // NPD
1150
                                if (item.LineNumber != null)
1189
                                    pathItemsDT.Rows.Add(newRow);
1190
                                }
1191
                                void CreateSequenceDataDataRow(string itemOID)
1151 1192
                                {
1152
                                    Attribute attribute = item.LineNumber.Attributes.Find(x => x.Name == "NominalDiameter");
1153
                                    if (attribute != null)
1154
                                        newRow["NPD"] = attribute.Value;
1193
                                    DataRow newRow = sequenceDataDT.NewRow();
1194
                                    newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1195
                                    newRow["SERIALNUMBER"] = string.Format("{0}", index);
1196
                                    newRow["PathItem_OID"] = itemOID;
1197
                                    newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1198

  
1199
                                    sequenceDataDT.Rows.Add(newRow);
1155 1200
                                }
1156
                                else
1157
                                    newRow["NPD"] = null;
1201
                                void CreatePipeSystemNetworkDataRow()
1202
                                {
1203
                                    // VentDrain의 경우 제외 요청
1204
                                    if (bVentDrain)
1205
                                        return;
1158 1206

  
1207
                                    DataRow newRow = pipeSystemNetworkDT.NewRow();
1208
                                    newRow["OID"] = PSNItem.PSN_OID();
1209
                                    newRow["Type"] = PSNItem.GetPSNType();
1210
                                    newRow["OrderNumber"] = psnOrder;
1211
                                    newRow["Pipeline_OID"] = item.PSNPipeLineID;
1159 1212

  
1160
                                newRow["PipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1161
                                if (branchItem == null)
1162
                                    newRow["ViewPipeSystemNetwork_OID"] = PSNItem.PSN_OID();
1163
                                else
1164
                                    newRow["ViewPipeSystemNetwork_OID"] = branchItem.PSNItem.PSN_OID();
1213
                                    string From_d = string.Empty;
1214
                                    string To_d = string.Empty;
1165 1215

  
1166
                                newRow["PipeRun_OID"] = item.LineNumber != null ? item.LineNumber.Name : string.Empty;
1216
                                    From_d = PSNItem.GetFromData();
1217
                                    To_d = PSNItem.GetToData();
1218
                                    newRow["FROM_DATA"] = From_d;
1219
                                    newRow["TO_DATA"] = To_d;
1167 1220

  
1168
                                pathItemsDT.Rows.Add(newRow);
1169
                            }
1170
                            void CreateSequenceDataDataRow(string itemOID)
1171
                            {
1172
                                DataRow newRow = sequenceDataDT.NewRow();
1173
                                newRow["OID"] = string.Format(item.Topology.FullName + "_{0}", index);
1174
                                newRow["SERIALNUMBER"] = string.Format("{0}", index);
1175
                                newRow["PathItem_OID"] = itemOID;
1176
                                newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1221
                                    From_d = PSNItem.GetFromKeywordData();
1222
                                    To_d = PSNItem.GetToKeywordData();
1177 1223

  
1178
                                sequenceDataDT.Rows.Add(newRow);
1179
                            }
1180
                            void CreatePipeSystemNetworkDataRow()
1181
                            {
1182
                                // VentDrain의 경우 제외 요청
1183
                                if (bVentDrain)
1184
                                    return;
1185

  
1186
                                DataRow newRow = pipeSystemNetworkDT.NewRow();
1187
                                newRow["OID"] = PSNItem.PSN_OID();
1188
                                newRow["Type"] = PSNItem.GetPSNType();
1189
                                newRow["OrderNumber"] = psnOrder;
1190
                                newRow["Pipeline_OID"] = item.PSNPipeLineID;
1191
                                
1192
                                string From_d = string.Empty;
1193
                                string To_d = string.Empty;
1194

  
1195
                                From_d = PSNItem.GetFromData();
1196
                                To_d = PSNItem.GetToData();
1197
                                newRow["FROM_DATA"] = From_d;
1198
                                newRow["TO_DATA"] = To_d;
1199
                                
1200
                                From_d = PSNItem.GetFromKeywordData();
1201
                                To_d = PSNItem.GetToKeywordData();
1202
                                
1203
                                if(!string.IsNullOrEmpty(From_d))
1204
                                    newRow["FROM_DATA"] = From_d;
1224
                                    if (!string.IsNullOrEmpty(From_d))
1225
                                        newRow["FROM_DATA"] = From_d;
1205 1226

  
1206
                                if (!string.IsNullOrEmpty(To_d))
1207
                                    newRow["TO_DATA"] = To_d;
1227
                                    if (!string.IsNullOrEmpty(To_d))
1228
                                        newRow["TO_DATA"] = To_d;
1208 1229

  
1209
                                newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1210
                                newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision);
1211
                                newRow["PBS"] = PSNItem.GetPBSData();
1212
                                newRow["Validity"] = PSNItem.Validity;
1213
                                newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty;
1214
                                newRow["IncludingVirtualData"] = "No";
1215
                                                        
1216
                                 newRow["PSNAccuracy"] = "100";
1217

  
1218
                                List<string> drawingNames = new List<string>();
1219
                                foreach (Group _group in PSNItem.Groups)
1220
                                {
1221
                                    if (!drawingNames.Contains(_group.Document.DrawingName))
1230
                                    newRow["TopologySet_OID_Key"] = item.Topology.FullName;
1231
                                    newRow["PSNRevisionNumber"] = string.Format("V{0:D4}", Revision);
1232
                                    newRow["PBS"] = PSNItem.GetPBSData();
1233
                                    newRow["Validity"] = PSNItem.Validity;
1234
                                    newRow["Status"] = !string.IsNullOrEmpty(PSNItem.Status) ? PSNItem.Status.Remove(0, 2) : string.Empty;
1235
                                    newRow["IncludingVirtualData"] = "No";
1236

  
1237
                                    newRow["PSNAccuracy"] = "100";
1238

  
1239
                                    List<string> drawingNames = new List<string>();
1240
                                    foreach (Group _group in PSNItem.Groups)
1222 1241
                                    {
1223
                                        if (drawingNames.Count == 0)
1224
                                            newRow["PIDDrawings"] = _group.Document.DrawingName;
1225
                                        else
1226
                                            newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + _group.Document.DrawingName;
1227
                                        drawingNames.Add(_group.Document.DrawingName);
1242
                                        if (!drawingNames.Contains(_group.Document.DrawingName))
1243
                                        {
1244
                                            if (drawingNames.Count == 0)
1245
                                                newRow["PIDDrawings"] = _group.Document.DrawingName;
1246
                                            else
1247
                                                newRow["PIDDrawings"] = newRow["PIDDrawings"] + ", " + _group.Document.DrawingName;
1248
                                            drawingNames.Add(_group.Document.DrawingName);
1249
                                        }
1228 1250
                                    }
1229
                                }
1230 1251

  
1231
                                pipeSystemNetworkDT.Rows.Add(newRow);
1252
                                    pipeSystemNetworkDT.Rows.Add(newRow);
1253
                                }
1232 1254
                            }
1233 1255
                        }
1234 1256
                    }
1235

  
1257
                    catch(Exception ex)
1258
                    {
1259
                        Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1260
                        MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1261
                    }
1236 1262

  
1237 1263
                    //TopologySet 관련
1238 1264
                    foreach (Topology topology in PSNItem.Topologies)
......
1335 1361

  
1336 1362
        private void UpdateSubType()
1337 1363
        {
1338
            foreach (PSNItem PSNItem in PSNItems)
1364
            try
1339 1365
            {
1340
                if (PSNItem.IsBypass)
1366

  
1367

  
1368
                foreach (PSNItem PSNItem in PSNItems)
1341 1369
                {
1342
                    foreach (Topology topology in PSNItem.Topologies)
1370
                    if (PSNItem.IsBypass)
1343 1371
                    {
1372
                        foreach (Topology topology in PSNItem.Topologies)
1373
                        {
1374
                            DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1375
                            if (rows.Length.Equals(1))
1376
                                rows.First()["SubType"] = "Bypass";
1377
                        }
1378
                    }
1379

  
1380
                    if (PSNItem.StartType == PSNType.Header)
1381
                    {
1382
                        Topology topology = PSNItem.Topologies.First();
1383
                        DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1384
                        if (rows.Length.Equals(1))
1385
                            rows.First()["SubType"] = "Header";
1386
                    }
1387
                    else if (PSNItem.EndType == PSNType.Header)
1388
                    {
1389
                        Topology topology = PSNItem.Topologies.Last();
1344 1390
                        DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1345 1391
                        if (rows.Length.Equals(1))
1346
                            rows.First()["SubType"] = "Bypass";
1392
                            rows.First()["SubType"] = "Header";
1347 1393
                    }
1348 1394
                }
1349 1395

  
1350
                if (PSNItem.StartType == PSNType.Header)
1351
                {
1352
                    Topology topology = PSNItem.Topologies.First();
1353
                    DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1354
                    if (rows.Length.Equals(1))
1355
                        rows.First()["SubType"] = "Header";
1356
                }
1357
                else if (PSNItem.EndType == PSNType.Header)
1358
                {
1359
                    Topology topology = PSNItem.Topologies.Last();
1360
                    DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1361
                    if (rows.Length.Equals(1))
1362
                        rows.First()["SubType"] = "Header";
1363
                }
1364
            }
1365 1396

  
1366
            foreach (Topology topology in Topologies)
1367
            {
1368
                DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1369
                if (rows.Length.Equals(1) && rows.First()["SubType"] == null || string.IsNullOrEmpty(rows.First()["SubType"].ToString()))
1397
                foreach (Topology topology in Topologies)
1370 1398
                {
1371
                    Item firstItem = topology.Items.First();
1372
                    Item lastItem = topology.Items.Last();
1399
                    try
1400
                    {
1401
                        DataRow[] rows = TopologySet.Select(string.Format("OID = '{0}'", topology.FullName));
1402
                        if (rows.Length.Equals(1) && rows.First()["SubType"] == null || string.IsNullOrEmpty(rows.First()["SubType"].ToString()))
1403
                        {
1404
                            if (topology.Items == null)
1405
                                continue;
1406

  
1407
                            Item firstItem = topology.Items.First();
1408
                            Item lastItem = topology.Items.Last();
1409

  
1410
                            List<Relation> relations = new List<Relation>();
1411
                            
1412
                            if (firstItem.Relations.FindAll(x => x.Item == null).Count() != 0)
1413
                                relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
1373 1414

  
1374
                    List<Relation> relations = new List<Relation>();
1375
                    relations.AddRange(firstItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
1376
                    relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
1415
                            if (lastItem.Relations.FindAll(x => x.Item == null).Count() != 0)
1416
                                relations.AddRange(lastItem.Relations.FindAll(x => x.Item != null && x.Item.Topology.ID != topology.ID));
1377 1417

  
1378
                    if (relations.Count > 0)
1379
                        rows.First()["SubType"] = "OtherSystem";
1418
                            if (relations.Count > 0)
1419
                                rows.First()["SubType"] = "OtherSystem";
1420
                        }
1421
                    }
1422
                    catch (Exception ex)
1423
                    {
1424
                       
1425
                        MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1426
                    }
1380 1427
                }
1381
            }
1382 1428

  
1383
            foreach (DataRow row in TopologySet.Rows)
1384
                if (row["SubType"] == null || string.IsNullOrEmpty(row["SubType"].ToString()))
1385
                    row["SubType"] = "Normal";
1429
                    foreach (DataRow row in TopologySet.Rows)
1430
                    if (row["SubType"] == null || string.IsNullOrEmpty(row["SubType"].ToString()))
1431
                        row["SubType"] = "Normal";
1432
            }
1433
            catch (Exception ex)
1434
            {
1435
                Log.Write(ex.Message + "\r\n" + ex.StackTrace);
1436
                MessageBox.Show(ex.Message, "ID2 " + id2Info.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Information);
1437
            }
1386 1438
        }
1387 1439

  
1388 1440
        private bool IsBypass(PSNItem PSNItem)
......
1685 1737
        public string GetFromData()
1686 1738
        {
1687 1739
            string result = string.Empty;
1688
            if (StartType == PSNType.Header)
1689
                result = "ENDOFHEADER";
1690
            else if (StartType == PSNType.Branch)
1740
            try
1691 1741
            {
1692
                Item item = Groups.First().Items.First();
1693
                if (!string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
1694
                    result = item.Relations.First().Item.LineNumber.Name;
1742
                if (StartType == PSNType.Header)
1743
                    result = "ENDOFHEADER";
1744
                else if (StartType == PSNType.Branch)
1745
                {
1746
                    Item item = Groups.First().Items.First();
1747
                    if (item.Relations.First().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.First().Item.LineNumber.Name))
1748
                        result = item.Relations.First().Item.LineNumber.Name;
1749
                    else
1750
                    {
1751
                        Status += ", Missing LineNumber";
1752
                        result = "Empty LineNumber";
1753
                    }
1754
                }
1755
                else if (StartType == PSNType.Equipment)
1756
                    result = Groups.First().Items.First().Equipment.ItemTag;
1695 1757
                else
1696 1758
                {
1697
                    Status += ", Missing LineNumber";
1698
                    result = "Empty LineNumber";
1759
                    Validity = "Error";
1760
                    Item item = Groups.First().Items.First();
1761
                    if (item.ItemType == ItemType.Symbol)
1762
                    {
1763
                        if (item.ID2DBType.Contains("OPC's"))
1764
                            Status += ", OPC Disconneted";
1765
                        else
1766
                            Status += ", Missing ItemTag or Description";
1767

  
1768
                        result = item.ID2DBName;
1769
                    }
1770
                    else if (item.ItemType == ItemType.Line)
1771
                    {
1772
                        Status += ", Line Disconnected";
1773
                        result = item.LineNumber != null && !string.IsNullOrEmpty(item.LineNumber.Name) ? item.LineNumber.Name : "Empty LineNumber";
1774
                    }
1775
                    else
1776
                        result = "Unknown";
1699 1777
                }
1700 1778
            }
1701
            else if (StartType == PSNType.Equipment)
1702
                result = Groups.First().Items.First().Equipment.ItemTag;
1703
            else
1779
            catch(Exception ex)
1704 1780
            {
1705
                Validity = "Error";
1706
                Item item = Groups.First().Items.First();
1707
                if (item.ItemType == ItemType.Symbol)
1708
                {
1709
                    if (item.ID2DBType.Contains("OPC's"))
1710
                        Status += ", OPC Disconneted";
1711
                    else
1712
                        Status += ", Missing ItemTag or Description";
1713 1781

  
1714
                    result = item.ID2DBName;
1715
                }
1716
                else if (item.ItemType == ItemType.Line)
1717
                {
1718
                    Status += ", Line Disconnected";
1719
                    result = !string.IsNullOrEmpty(item.LineNumber.Name) ? item.LineNumber.Name : "Empty LineNumber";
1720
                }
1721
                else
1722
                    result = "Unknown";
1723 1782
            }
1724 1783

  
1725 1784
            return result;
......
1757 1816
            else if (EndType == PSNType.Branch)
1758 1817
            {
1759 1818
                Item item = Groups.Last().Items.Last();
1760
                if (!string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
1819
                if (item.Relations.Last().Item.LineNumber != null && !string.IsNullOrEmpty(item.Relations.Last().Item.LineNumber.Name))
1761 1820
                    result = item.Relations.Last().Item.LineNumber.Name;
1762 1821
                else
1763 1822
                {
......
1783 1842
                else if (item.ItemType == ItemType.Line)
1784 1843
                {
1785 1844
                    Status += ", Line Disconnected";
1786
                    result = !string.IsNullOrEmpty(item.LineNumber.Name) ? item.LineNumber.Name : "Empty LineNumber";
1845
                    result = item.LineNumber != null && !string.IsNullOrEmpty(item.LineNumber.Name) ? item.LineNumber.Name : "Empty LineNumber";
1787 1846
                }
1788 1847
                else
1789 1848
                    result = "Unknown";

내보내기 Unified diff

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