개정판 68e9394a
dev issue #000 : mapping validation 추가
Change-Id: I52f3a3284a77703bede74fd5b0a19fcbd79bd694
DTI_PID/SPPIDConverter/BaseModel/Document.cs | ||
---|---|---|
27 | 27 |
private List<Equipment> _Equipments = new List<Equipment>(); |
28 | 28 |
private bool _Enable; |
29 | 29 |
private bool _Validation; |
30 |
private string _ValidationMessage; |
|
30 |
private bool _MappingValidation; |
|
31 |
private string _ValidationMessage = string.Empty; |
|
31 | 32 |
bool validationResult = false; |
32 | 33 |
|
33 |
public bool Enable { get { return _Enable; } } |
|
34 |
public bool Validation { get { return _Validation; } } |
|
35 |
public string ValidationMessage { get { return _ValidationMessage; } } |
|
34 |
public string ValidationMessage { get => _ValidationMessage; set => _ValidationMessage = value; } |
|
36 | 35 |
|
37 | 36 |
public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; } |
38 | 37 |
public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; } |
... | ... | |
64 | 63 |
public double SIZE_HEIGHT { get => _SIZE_HEIGHT; } |
65 | 64 |
public List<TrimLine> TRIMLINES { get => _TRIMLINES; set => _TRIMLINES = value; } |
66 | 65 |
public string PATH { get; set; } |
66 |
public bool Enable { get => _Enable; set => _Enable = value; } |
|
67 |
public bool Validation { get => _Validation; set => _Validation = value; } |
|
68 |
public bool MappingValidation { get => _MappingValidation; set => _MappingValidation = value; } |
|
67 | 69 |
|
68 | 70 |
StringBuilder validationStringBuilder = new StringBuilder(); |
69 | 71 |
|
... | ... | |
91 | 93 |
SetTrimLine(xml.Element("TRIMLINENOS")); |
92 | 94 |
|
93 | 95 |
SetAllConnectors(); |
94 |
_Enable = true;
|
|
96 |
Enable = true; |
|
95 | 97 |
ValidationCheck(); |
96 | 98 |
} |
97 | 99 |
} |
98 | 100 |
catch (Exception ex) |
99 | 101 |
{ |
100 |
_Enable = false;
|
|
102 |
Enable = false; |
|
101 | 103 |
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
102 | 104 |
} |
103 | 105 |
} |
... | ... | |
281 | 283 |
lineNumber.CONNLINE = item.Element("CONNLINE").Value; |
282 | 284 |
else |
283 | 285 |
{ |
284 |
validationStringBuilder.AppendLine("Not exist CONNLINE!" + "\r\nLineNumber UID : " + lineNumber.CONNLINE);
|
|
286 |
validationStringBuilder.AppendLine("Not exist CONNLINE!" + "\r\nLineNumber UID : " + lineNumber.UID);
|
|
285 | 287 |
validationStringBuilder.AppendLine(); |
286 | 288 |
validationResult = true; |
287 | 289 |
} |
... | ... | |
895 | 897 |
|
896 | 898 |
if (validationResult) |
897 | 899 |
{ |
898 |
_Validation = false;
|
|
899 |
_Enable = false;
|
|
900 |
_ValidationMessage = validationStringBuilder.ToString(); |
|
900 |
Validation = false; |
|
901 |
Enable = false; |
|
902 |
_ValidationMessage += validationStringBuilder.ToString();
|
|
901 | 903 |
} |
902 | 904 |
else |
903 | 905 |
{ |
904 |
_Validation = true; |
|
905 |
_Enable = true; |
|
906 |
_ValidationMessage = ""; |
|
906 |
Validation = true; |
|
907 |
Enable = true; |
|
907 | 908 |
} |
908 | 909 |
} |
909 | 910 |
} |
DTI_PID/SPPIDConverter/ConverterForm.cs | ||
---|---|---|
473 | 473 |
{ |
474 | 474 |
SPPID_Document document = new SPPID_Document(fileName); |
475 | 475 |
|
476 |
document.SymbolTable = _ID2SymbolTable; |
|
477 |
document.SymbolMappings = symbolMappings; |
|
478 |
document.ChildSymbolMappings = childSymbolMappings; |
|
479 |
document.LineMappings = lineMappings; |
|
480 |
document.LineNumberMappings = lineNumberMappings; |
|
481 |
document.AttributeMappings = attributeMappings; |
|
482 |
document.ETCSetting = ETCSetting.GetInstance(); |
|
483 |
document.SetSPPIDInfo(); |
|
484 |
|
|
485 |
|
|
486 |
if (!document.SetSPPIDMapping()) |
|
487 |
{ |
|
488 |
document.Enable = false; |
|
489 |
document.MappingValidation = false; |
|
490 |
} |
|
491 |
|
|
476 | 492 |
DataRow[] rows = _ConverterDT.Select(string.Format("colDrawingFilePath = '{0}'", fileName)); |
477 | 493 |
if (rows.Length == 0) |
478 | 494 |
{ |
... | ... | |
511 | 527 |
if (!_DicDocuments.ContainsKey(fileName)) |
512 | 528 |
_DicDocuments.Add(fileName, null); |
513 | 529 |
|
514 |
if (!document.Validation) |
|
530 |
if (!document.Validation || !document.MappingValidation)
|
|
515 | 531 |
validationFailDocs.Add(document); |
516 | 532 |
|
517 | 533 |
_DicDocuments[fileName] = document; |
... | ... | |
653 | 669 |
{ |
654 | 670 |
string fileName = row["colDrawingFilePath"].ToString(); |
655 | 671 |
SPPID_Document document = new SPPID_Document(fileName); |
672 |
document.SymbolTable = _ID2SymbolTable; |
|
673 |
document.SymbolMappings = symbolMappings; |
|
674 |
document.ChildSymbolMappings = childSymbolMappings; |
|
675 |
document.LineMappings = lineMappings; |
|
676 |
document.LineNumberMappings = lineNumberMappings; |
|
677 |
document.AttributeMappings = attributeMappings; |
|
678 |
document.ETCSetting = ETCSetting.GetInstance(); |
|
679 |
document.SetSPPIDInfo(); |
|
680 |
|
|
681 |
|
|
682 |
if (!document.SetSPPIDMapping()) |
|
683 |
{ |
|
684 |
document.Enable = false; |
|
685 |
document.MappingValidation = false; |
|
686 |
} |
|
687 |
|
|
656 | 688 |
row["colDrawingNumber"] = document.DWGNAME; |
657 | 689 |
row["colDrawingName"] = document.DWGNAME; |
658 | 690 |
if (document.Enable) |
... | ... | |
663 | 695 |
if (!_DicDocuments.ContainsKey(fileName)) |
664 | 696 |
_DicDocuments.Add(fileName, null); |
665 | 697 |
|
666 |
if (!document.Validation) |
|
698 |
if (!document.Validation || !document.MappingValidation)
|
|
667 | 699 |
validationFailDocs.Add(document); |
668 | 700 |
|
669 | 701 |
_DicDocuments[fileName] = document; |
DTI_PID/SPPIDConverter/Form/MessageForm.cs | ||
---|---|---|
18 | 18 |
InitializeComponent(); |
19 | 19 |
foreach (var item in documents) |
20 | 20 |
{ |
21 |
if (!item.Validation) |
|
21 |
if (!item.Validation || !item.MappingValidation)
|
|
22 | 22 |
{ |
23 | 23 |
var page = tabPane.AddPage(item.DWGNAME, Guid.NewGuid().ToString()); |
24 | 24 |
|
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs | ||
---|---|---|
407 | 407 |
|
408 | 408 |
public bool SetSPPIDMapping() |
409 | 409 |
{ |
410 |
bool result = true; |
|
411 |
StringBuilder sb = new StringBuilder(); |
|
410 | 412 |
foreach (var item in SYMBOLS) |
411 | 413 |
{ |
412 | 414 |
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
413 | 415 |
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
414 | 416 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
415 |
return false; |
|
417 |
{ |
|
418 |
result = false; |
|
419 |
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME); |
|
420 |
} |
|
421 |
|
|
416 | 422 |
|
417 | 423 |
foreach (var childSymbol in item.ChildSymbols) |
418 | 424 |
{ |
419 | 425 |
ChildSymbolMapping childMapping = ChildSymbolMappings.Find(x => x.UID == childSymbol.NAME); |
420 | 426 |
childSymbol.SPPID.MAPPINGNAME = childMapping != null ? childMapping.SPPIDSYMBOLNAME : null; |
421 | 427 |
if (string.IsNullOrEmpty(childSymbol.SPPID.MAPPINGNAME) || !SetChildSymbolMapping(childSymbol)) |
422 |
return false; |
|
428 |
{ |
|
429 |
result = false; |
|
430 |
sb.AppendLine("Need Mapping Symbol Name : " + childSymbol.NAME); |
|
431 |
} |
|
423 | 432 |
} |
424 | 433 |
} |
425 | 434 |
|
... | ... | |
428 | 437 |
LineMapping mapping = LineMappings.Find(x => x.UID == item.TYPEUID); |
429 | 438 |
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
430 | 439 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
431 |
return false; |
|
440 |
{ |
|
441 |
result = false; |
|
442 |
sb.AppendLine("Need Mapping Line Type : " + item.TYPE); |
|
443 |
} |
|
432 | 444 |
} |
433 | 445 |
|
434 | 446 |
foreach (var item in Equipments) |
... | ... | |
436 | 448 |
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
437 | 449 |
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
438 | 450 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
439 |
return false; |
|
451 |
{ |
|
452 |
result = false; |
|
453 |
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME); |
|
454 |
} |
|
440 | 455 |
} |
441 | 456 |
|
442 | 457 |
foreach (var item in EndBreaks) |
... | ... | |
444 | 459 |
SymbolMapping mapping = SymbolMappings.Find(x => x.UID == item.DBUID); |
445 | 460 |
item.SPPID.MAPPINGNAME = mapping != null ? mapping.SPPIDSYMBOLNAME : null; |
446 | 461 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
447 |
return false; |
|
462 |
{ |
|
463 |
result = false; |
|
464 |
sb.AppendLine("Need Mapping Symbol Name : " + item.NAME); |
|
465 |
} |
|
448 | 466 |
} |
449 | 467 |
|
450 | 468 |
foreach (var item in LINENUMBERS) |
... | ... | |
452 | 470 |
if (LineNumberMappings.Count > 0) |
453 | 471 |
item.SPPID.MAPPINGNAME = LineNumberMappings[0].SPPIDSYMBOLNAME; |
454 | 472 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
455 |
return false; |
|
473 |
{ |
|
474 |
result = false; |
|
475 |
sb.AppendLine("Need Mapping LineNumber Mapping"); |
|
476 |
} |
|
456 | 477 |
} |
457 | 478 |
|
458 | 479 |
ETCSetting etc = ETCSetting.GetInstance(); |
... | ... | |
460 | 481 |
{ |
461 | 482 |
item.SPPID.MAPPINGNAME = etc.NoteSymbolPath; |
462 | 483 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
463 |
return false; |
|
484 |
{ |
|
485 |
result = false; |
|
486 |
sb.AppendLine("Need Mapping Note Mapping"); |
|
487 |
} |
|
464 | 488 |
} |
465 | 489 |
|
466 | 490 |
foreach (var item in TEXTINFOS) |
467 | 491 |
{ |
468 | 492 |
item.SPPID.MAPPINGNAME = etc.TextSymbolPath; |
469 | 493 |
if (string.IsNullOrEmpty(item.SPPID.MAPPINGNAME)) |
470 |
return false; |
|
494 |
{ |
|
495 |
result = false; |
|
496 |
sb.AppendLine("Need Mapping Text Mapping"); |
|
497 |
} |
|
471 | 498 |
} |
472 | 499 |
|
473 |
return true; |
|
500 |
if (!result) |
|
501 |
ValidationMessage += sb.ToString(); |
|
502 |
|
|
503 |
return result; |
|
474 | 504 |
} |
475 | 505 |
|
476 | 506 |
private bool SetChildSymbolMapping(ChildSymbol item) |
내보내기 Unified diff