개정판 bd86dd48
issue #000: Setting Secondary 조건 수정, Header Rule 로직 수정, tieinpoint 로직 수정
Change-Id: I84ad7e4f5784ca7a0886e8900f2526f8d034e81a
DTI_PID/ID2PSN/Document.cs | ||
---|---|---|
127 | 127 |
private LineNumber GetLineNumber(XElement element) |
128 | 128 |
{ |
129 | 129 |
LineNumber lineNumber = new LineNumber(); |
130 |
lineNumber.UID = element.Element("UID").Value; |
|
130 |
lineNumber.UID = element.Element("UID").Value;
|
|
131 | 131 |
lineNumber.Name = element.Element("TEXT").Value; |
132 | 132 |
lineNumber.Attributes = GetAttributes(element); |
133 | 133 |
return lineNumber; |
... | ... | |
183 | 183 |
List<Attribute> result = new List<Attribute>(); |
184 | 184 |
foreach (XElement item in element.Elements("ATTRIBUTE")) |
185 | 185 |
{ |
186 |
|
|
186 | 187 |
result.Add(new Attribute() |
187 | 188 |
{ |
188 | 189 |
UID = item.Attribute("UID").Value, |
... | ... | |
406 | 407 |
HeaderInfos.Add(headerInfo); |
407 | 408 |
} |
408 | 409 |
|
410 |
|
|
409 | 411 |
headerInfo.HeaderItems.Add(new HeaderItem() |
410 | 412 |
{ |
411 | 413 |
Index = index, |
412 | 414 |
Name = name |
413 | 415 |
}); |
414 | 416 |
} |
417 |
|
|
418 |
|
|
415 | 419 |
foreach (HeaderInfo headerInfo in HeaderInfos) |
416 |
headerInfo.HeaderItems = headerInfo.HeaderItems.OrderBy(x => x.Index).ToList(); |
|
420 |
headerInfo.HeaderItems = headerInfo.HeaderItems.OrderByDescending(x => x.Index).ToList();
|
|
417 | 421 |
|
418 | 422 |
foreach (Group group in Groups) |
419 | 423 |
{ |
420 |
List<HeaderInfo> endInfos = new List<HeaderInfo>(); |
|
421 |
bool bFind = false; |
|
422 |
for (int i = 0; i < group.Items.Count; i++) |
|
424 |
foreach (HeaderInfo header in HeaderInfos) |
|
423 | 425 |
{ |
424 |
Item item = group.Items[i]; |
|
425 |
foreach (HeaderInfo header in HeaderInfos) |
|
426 |
if (group.Items.Count < header.HeaderItems.Count) |
|
426 | 427 |
{ |
427 |
if (endInfos.Contains(header)) |
|
428 |
continue; |
|
429 |
|
|
430 |
if (!header.HeaderItems[i].Name.Equals(item.Name)) |
|
431 |
{ |
|
432 |
endInfos.Add(header); |
|
433 |
continue; |
|
434 |
} |
|
428 |
continue; |
|
429 |
} |
|
435 | 430 |
|
436 |
if (header.HeaderItems.Count.Equals(i + 1)) |
|
431 |
bool found = true; |
|
432 |
for (int i = 0; i < header.HeaderItems.Count; i++) |
|
433 |
{ |
|
434 |
if (!header.HeaderItems[header.HeaderItems.Count - 1 - i].Name.Equals(group.Items[i].Name)) |
|
437 | 435 |
{ |
438 |
for (int j = 0; j < i + 1; j++) |
|
439 |
group.Items[j].SubItemType = SubItemType.Header; |
|
440 |
bFind = true; |
|
436 |
found = false; |
|
441 | 437 |
break; |
442 | 438 |
} |
443 | 439 |
} |
444 |
|
|
445 |
if (bFind || endInfos.Count.Equals(HeaderInfos.Count)) |
|
446 |
break; |
|
447 |
} |
|
448 |
|
|
449 |
endInfos = new List<HeaderInfo>(); |
|
450 |
bFind = false; |
|
451 |
for (int i = 0; i < group.Items.Count; i++) |
|
452 |
{ |
|
453 |
Item item = group.Items[group.Items.Count - i - 1]; |
|
454 |
foreach (HeaderInfo header in HeaderInfos) |
|
440 |
if (found) |
|
455 | 441 |
{ |
456 |
if (endInfos.Contains(header)) |
|
457 |
continue; |
|
442 |
found = false; |
|
443 |
List<Item> branches = new List<Item>(); |
|
444 |
//for (int i = 0; i < header.HeaderItems.Count; i++) |
|
445 |
//{ |
|
446 |
// if (group.Items[i].ItemType == ItemType.Line) |
|
447 |
// { |
|
448 |
foreach(var _line in group.Items.Where(x=>x.ItemType == ItemType.Line)) |
|
449 |
{ |
|
450 |
branches = Groups.Where(w => w != group).SelectMany(s => s.Items).Where(w => w.ItemType == ItemType.Line).Where(w => w.Relations[0].Item == _line || w.Relations[1].Item == _line).ToList(); |
|
451 |
if (branches.Count > 0) |
|
452 |
{ |
|
453 |
found = true; |
|
454 |
break; |
|
455 |
} |
|
456 |
|
|
457 |
if (found) |
|
458 |
break; |
|
459 |
} |
|
460 |
// } |
|
461 |
//} |
|
458 | 462 |
|
459 |
if (!header.HeaderItems[i].Name.Equals(item.Name))
|
|
463 |
if (found)
|
|
460 | 464 |
{ |
461 |
endInfos.Add(header); |
|
462 |
continue; |
|
465 |
for (int i = 0; i < header.HeaderItems.Count; i++) |
|
466 |
{ |
|
467 |
group.Items[i].SubItemType = SubItemType.Header; |
|
468 |
} |
|
463 | 469 |
} |
470 |
} |
|
464 | 471 |
|
465 |
if (header.HeaderItems.Count.Equals(i + 1)) |
|
472 |
found = true; |
|
473 |
for (int i = 0; i < header.HeaderItems.Count; i++) |
|
474 |
{ |
|
475 |
if (!header.HeaderItems[i].Name.Equals(group.Items[group.Items.Count - header.HeaderItems.Count + i].Name)) |
|
466 | 476 |
{ |
467 |
for (int j = 0; j < i + 1; j++) |
|
468 |
group.Items[group.Items.Count - j - 1].SubItemType = SubItemType.Header; |
|
469 |
bFind = true; |
|
477 |
found = false; |
|
470 | 478 |
break; |
471 | 479 |
} |
472 | 480 |
} |
481 |
if (found) |
|
482 |
{ |
|
483 |
found = false; |
|
484 |
List<Item> branches = new List<Item>(); |
|
485 |
//for (int i = 0; i < header.HeaderItems.Count; i++) |
|
486 |
//{ |
|
487 |
// if (group.Items[group.Items.Count - 1 - i].ItemType == ItemType.Line) |
|
488 |
// { |
|
489 |
|
|
490 |
foreach (var _line in group.Items.Where(x => x.ItemType == ItemType.Line)) |
|
491 |
{ |
|
492 |
branches = Groups.Where(w => w != group).SelectMany(s => s.Items).Where(w => w.ItemType == ItemType.Line).Where(w => w.Relations[0].Item == _line || w.Relations[1].Item == _line).ToList(); |
|
493 |
if (branches.Count > 0) |
|
494 |
{ |
|
495 |
found = true; |
|
496 |
break; |
|
497 |
} |
|
498 |
|
|
499 |
if (found) |
|
500 |
break; |
|
501 |
} |
|
502 |
// } |
|
503 |
//} |
|
473 | 504 |
|
474 |
if (bFind || endInfos.Count.Equals(HeaderInfos.Count)) |
|
475 |
break; |
|
505 |
if (found) |
|
506 |
{ |
|
507 |
for (int i = 0; i < header.HeaderItems.Count; i++) |
|
508 |
{ |
|
509 |
group.Items[group.Items.Count - 1 - i].SubItemType = SubItemType.Header; |
|
510 |
} |
|
511 |
} |
|
512 |
} |
|
476 | 513 |
} |
477 | 514 |
} |
515 |
|
|
478 | 516 |
#endregion |
479 | 517 |
|
518 |
//#region HeaderSetting |
|
519 |
//List<HeaderInfo> HeaderInfos = new List<HeaderInfo>(); |
|
520 |
//DataTable dt = DB.SelectHeaderSetting(); |
|
521 |
//foreach (DataRow row in dt.Rows) |
|
522 |
//{ |
|
523 |
// string groupID = row["GROUP_ID"].ToString(); |
|
524 |
// string desc = row["DESCRIPTION"].ToString(); |
|
525 |
// int index = Convert.ToInt32(row["INDEX"]); |
|
526 |
// string name = row["NAME"].ToString(); |
|
527 |
|
|
528 |
// HeaderInfo headerInfo = HeaderInfos.Find(x => x.UID.Equals(groupID)); |
|
529 |
// if (headerInfo == null) |
|
530 |
// { |
|
531 |
// headerInfo = new HeaderInfo(groupID); |
|
532 |
// headerInfo.Description = desc; |
|
533 |
// HeaderInfos.Add(headerInfo); |
|
534 |
// } |
|
535 |
|
|
536 |
// headerInfo.HeaderItems.Add(new HeaderItem() |
|
537 |
// { |
|
538 |
// Index = index, |
|
539 |
// Name = name |
|
540 |
// }); |
|
541 |
//} |
|
542 |
//foreach (HeaderInfo headerInfo in HeaderInfos) |
|
543 |
// headerInfo.HeaderItems = headerInfo.HeaderItems.OrderBy(x => x.Index).ToList(); |
|
544 |
|
|
545 |
//foreach (Group group in Groups) |
|
546 |
//{ |
|
547 |
// List<HeaderInfo> endInfos = new List<HeaderInfo>(); |
|
548 |
// bool bFind = false; |
|
549 |
// for (int i = 0; i < group.Items.Count; i++) |
|
550 |
// { |
|
551 |
// Item item = group.Items[i]; |
|
552 |
// foreach (HeaderInfo header in HeaderInfos) |
|
553 |
// { |
|
554 |
// if (endInfos.Contains(header)) |
|
555 |
// continue; |
|
556 |
|
|
557 |
// if (!header.HeaderItems[i].Name.Equals(item.Name)) |
|
558 |
// { |
|
559 |
// endInfos.Add(header); |
|
560 |
// continue; |
|
561 |
// } |
|
562 |
|
|
563 |
// if (header.HeaderItems.Count.Equals(i + 1)) |
|
564 |
// { |
|
565 |
// for (int j = 0; j < i + 1; j++) |
|
566 |
// group.Items[j].SubItemType = SubItemType.Header; |
|
567 |
// bFind = true; |
|
568 |
// break; |
|
569 |
// } |
|
570 |
// } |
|
571 |
|
|
572 |
// if (bFind || endInfos.Count.Equals(HeaderInfos.Count)) |
|
573 |
// break; |
|
574 |
// } |
|
575 |
|
|
576 |
// endInfos = new List<HeaderInfo>(); |
|
577 |
// bFind = false; |
|
578 |
// for (int i = 0; i < group.Items.Count; i++) |
|
579 |
// { |
|
580 |
// Item item = group.Items[group.Items.Count - i - 1]; |
|
581 |
// foreach (HeaderInfo header in HeaderInfos) |
|
582 |
// { |
|
583 |
// if (endInfos.Contains(header)) |
|
584 |
// continue; |
|
585 |
|
|
586 |
// if (!header.HeaderItems[i].Name.Equals(item.Name)) |
|
587 |
// { |
|
588 |
// endInfos.Add(header); |
|
589 |
// continue; |
|
590 |
// } |
|
591 |
|
|
592 |
// if (header.HeaderItems.Count.Equals(i + 1)) |
|
593 |
// { |
|
594 |
// for (int j = 0; j < i + 1; j++) |
|
595 |
// group.Items[group.Items.Count - j - 1].SubItemType = SubItemType.Header; |
|
596 |
// bFind = true; |
|
597 |
// break; |
|
598 |
// } |
|
599 |
// } |
|
600 |
|
|
601 |
// if (bFind || endInfos.Count.Equals(HeaderInfos.Count)) |
|
602 |
// break; |
|
603 |
// } |
|
604 |
//} |
|
605 |
//#endregion |
|
606 |
|
|
480 | 607 |
//#region KeywordSetting |
481 | 608 |
////List<KeywordInfo> KeywordInfos = new List<KeywordInfo>(); |
482 | 609 |
//DataTable dtKeyword = DB.SelectKeywordsSetting(); |
내보내기 Unified diff