프로젝트

일반

사용자정보

개정판 d23fe61b

IDd23fe61bf361dbe58c0ce300ec6ec8f9a2bf4ead
상위 dfac4553
하위 7eebbd7a

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

dev issue #000 : id2 ValidationCheck flow direction 추가 및 Inconsistancy index 추가

Change-Id: Ie15719b8423f98fc28a5000818419b96104e91e6

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
108 108
                    // SpecBreak Modeling
109 109
                    RunSpecBreakModeling();
110 110

  
111
                    // Join
111
                    // Join SameConnector
112 112
                    RunJoinRunForSameConnector();
113 113

  
114
                    // Check FlowDirection
115

  
116

  
114 117
                    //// LineNumber Modeling
115 118
                    //RunLineNumberModeling();
116 119

  
......
386 389
        }
387 390
        private void RunClearInconsistancy()
388 391
        {
389
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.LINES.Count);
392
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, 1);
390 393
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute");
391 394
            SetSystemEditingCommand(false);
392 395

  
......
405 408
                LMRelationships relationships = new LMRelationships();
406 409
                relationships.Collect(dataSource, Filter: filter);
407 410

  
411
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, relationships.Count);
408 412
                foreach (LMRelationship relationship in relationships)
409 413
                {
410 414
                    foreach (LMInconsistency inconsistency in relationship.Inconsistencies)
......
420 424
                                if (attrName.Contains("PipingPoint"))
421 425
                                {
422 426
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
423
                                    int index = 1;
424
                                    while (modelItem1.Attributes["PipingPoint" + index + "." + originalAttr] != null)
427
                                    int index = Convert.ToInt32(relationship.get_Item1Location());
428
                                    LMAAttribute attribute1 = modelItem1.Attributes["PipingPoint" + index + "." + originalAttr];
429
                                    if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
425 430
                                    {
426
                                        LMAAttribute attribute1 = modelItem1.Attributes["PipingPoint" + index + "." + originalAttr];
427
                                        if (attribute1 != null && !DBNull.Value.Equals(attribute1.get_Value()))
428
                                        {
429
                                            loop = true;
430
                                            attribute1.set_Value(DBNull.Value);
431
                                        }
432
                                        index++;
431
                                        loop = true;
432
                                        attribute1.set_Value(DBNull.Value);
433 433
                                    }
434 434
                                }
435 435
                                else
......
449 449
                                if (attrName.Contains("PipingPoint"))
450 450
                                {
451 451
                                    string originalAttr = attrName.Split(new char[] { '.' })[1];
452
                                    int index = 1;
453
                                    while (modelItem2.Attributes["PipingPoint" + index + "." + originalAttr] != null)
452
                                    int index = Convert.ToInt32(relationship.get_Item2Location());
453
                                    LMAAttribute attribute2 = modelItem2.Attributes["PipingPoint" + index + "." + originalAttr];
454
                                    if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
454 455
                                    {
455
                                        LMAAttribute attribute2 = modelItem2.Attributes["PipingPoint" + index + "." + originalAttr];
456
                                        if (attribute2 != null && !DBNull.Value.Equals(attribute2.get_Value()))
457
                                        {
458
                                            attribute2.set_Value(DBNull.Value);
459
                                            loop = true;
460
                                        }
461
                                        index++;
456
                                        attribute2.set_Value(DBNull.Value);
457
                                        loop = true;
462 458
                                    }
463 459
                                }
464 460
                                else
......
480 476
                        }
481 477
                    }
482 478
                    relationship.Commit();
479
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
483 480
                }
484 481
                ReleaseCOMObjects(filter);
485 482
                ReleaseCOMObjects(criterion);
486 483
                ReleaseCOMObjects(relationships);
487 484
            }
488 485

  
489
           
490

  
486
            #region 예전 방식
491 487
            //List<string> endClearModelItemID = new List<string>();
492 488
            //for (int i = 0; i < document.LINES.Count; i++)
493 489
            //{
......
579 575
            //    }
580 576
            //    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
581 577
            //}
578
            #endregion
582 579
            SetSystemEditingCommand(true);
583 580
        }
584 581
        private void RunEndBreakModeling()
......
590 587
                {
591 588
                    EndBreakModeling(item);
592 589
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
593
                    if (string.IsNullOrEmpty(item.SPPID.ModelItemID))
590
                    if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
594 591
                        Log.Write("Fail modeling endbreak UID : " + item.UID);
595 592
                }
596 593
                catch (Exception ex)
......
610 607
                {
611 608
                    SpecBreakModeling(item);
612 609
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
613
                    if (string.IsNullOrEmpty(item.SPPID.ModelItemID))
610
                    if (string.IsNullOrEmpty(item.SPPID.RepresentationId))
614 611
                        Log.Write("Fail modeling specbreak UID : " + item.UID);
615 612
                }
616 613
                catch (Exception ex)
......
623 620
        }
624 621
        private void RunJoinRunForSameConnector()
625 622
        {
623
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
626 624
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "PipeRun Join");
627 625
            foreach (var line in document.LINES)
628 626
            {
......
632 630
                    {
633 631
                        if (connector.ConnectedObject != null &&
634 632
                            connector.ConnectedObject.GetType() == typeof(Line) &&
635
                            !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line) &&
636
                            !SPPIDUtil.IsSegmentLine(document, connector.ConnectedObject as Line)) 
633
                            !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line)) 
637 634
                        {
638 635
                            Line connLine = connector.ConnectedObject as Line;
639 636
                            if (line.SPPID.ModelItemId != connLine.SPPID.ModelItemId)
......
641 638
                        }
642 639
                    }
643 640
                }
641
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
642
            }
643
        }
644
        private void RunFlowDirection()
645
        {
646
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
647
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Check Flow Direction");
648
            foreach (var line in document.LINES)
649
            {
650

  
651

  
652
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
644 653
            }
645 654
        }
646 655

  
......
2091 2100
                if (_LmLabelPersist != null)
2092 2101
                {
2093 2102
                    endBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id;
2094
                    endBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
2103
                    if (_LmLabelPersist.ModelItemObject != null)
2104
                        endBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
2095 2105
                    endBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID();
2096 2106
                    ReleaseCOMObjects(_LmLabelPersist);
2097 2107
                }
......
2209 2219
                            if (_LmLabelPersist != null)
2210 2220
                            {
2211 2221
                                specBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id;
2212
                                specBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
2222
                                if (_LmLabelPersist.ModelItemObject != null)
2223
                                    specBreak.SPPID.ModelItemID = _LmLabelPersist.ModelItemID;
2213 2224
                                specBreak.SPPID.GraphicOID = _LmLabelPersist.get_GraphicOID();
2214 2225
                                ReleaseCOMObjects(_LmLabelPersist);
2215 2226
                            }
DTI_PID/SPPIDConverter/BaseModel/Document.cs
707 707
            }
708 708

  
709 709
            #endregion
710

  
711
            #region Check Flow Direction
712
            foreach (var line in LINES)
713
            {
714
                foreach (var connector in line.CONNECTORS)
715
                {
716
                    if (connector.ConnectedObject != null &&
717
                        connector.ConnectedObject.GetType() == typeof(Line) &&
718
                        !SPPIDUtil.IsBranchLine(line, connector.ConnectedObject as Line))
719
                    {
720
                        Line connLine = connector.ConnectedObject as Line;
721
                        int lineIndex1 = line.CONNECTORS.IndexOf(connector);
722
                        int lineIndex2 = connLine.CONNECTORS.IndexOf(connLine.CONNECTORS.Find(x => x.ConnectedObject == line));
723
                        if (lineIndex1 == lineIndex2 && !SPPIDUtil.IsSegmentLine(this, line, connLine))
724
                        {
725
                            validationStringBuilder.AppendLine("Check line flow direction!");
726
                            validationStringBuilder.AppendLine("UID : " + line.UID);
727
                            validationStringBuilder.AppendLine("UID : " + connLine.UID);
728
                            throw new Exception(validationStringBuilder.ToString());
729
                        }
730
                    }
731
                }
732
            }
733
            #endregion
710 734
        }
711 735
    }
712 736
}
DTI_PID/SPPIDConverter/ConverterDocking.cs
199 199
                filter.ItemType = "Drawing";
200 200
                criterion.SourceAttributeName = "Name";
201 201
                criterion.Operator = "=";
202
                criterion.set_ValueAttribute("20-PID-2011_Page1-97");
202
                criterion.set_ValueAttribute("11111");
203 203
                filter.get_Criteria().Add(criterion);
204 204

  
205 205
                LMDrawings drawings = new LMDrawings();
......
305 305
                                ReleaseCOMObjects(modelItem2);
306 306
                            inconsistency.Commit();
307 307
                        }
308
                        else if (inconsistency.get_InconsistencyTypeIndex() == 3)
309
                        {
310

  
311
                        }
308 312
                    }
309 313
                    relationship.Commit();
310 314
                }
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs
549 549

  
550 550
            return result;
551 551
        }
552

  
553
        public static bool IsSegmentLine(Document document, Line line1, Line line2)
554
        {
555
            bool result = false;
556
            SpecBreak startSpecBreak = document.SpecBreaks.Find(x =>
557
            (x.DownStreamUID == line1.UID || x.UpStreamUID == line1.UID) &&
558
            (x.DownStreamUID == line2.UID || x.UpStreamUID == line2.UID));
559

  
560
            EndBreak startEndBreak = document.EndBreaks.Find(x =>
561
            (x.OWNER == line1.UID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == line1.UID) &&
562
            (x.OWNER == line2.UID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == line2.UID));
563

  
564
            if (startSpecBreak != null || startEndBreak != null)
565
                result = true;
566

  
567
            return result;
568
        }
552 569
    }
553 570
}

내보내기 Unified diff

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