개정판 b42dd24d
finalPDF 수정
Change-Id: Ic1c091379dcc59c6c7a0f42f275a4d57a9239229
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
338 | 338 |
|
339 | 339 |
if (_DOCINFO.Count() > 0) |
340 | 340 |
{ |
341 |
DocInfoItem = _DOCINFO.FirstOrDefault(); |
|
342 |
DocPageItem = DocInfoItem.DOCPAGE.ToList(); |
|
341 |
DocInfoItem = _DOCINFO.First(); |
|
342 |
|
|
343 |
DocPageItem = _entity.DOCPAGE.Where(x => x.DOCINFO_ID == DocInfoItem.ID).ToList(); |
|
343 | 344 |
|
344 | 345 |
PdfFilePathRoot = PdfFilePathRoot + @"\" + FinalPDF.PROJECT_NO + "_Tile" + @"\" |
345 | 346 |
+ (FinalPDF.DOCUMENT_ID.All(char.IsDigit) ? (System.Convert.ToInt64(FinalPDF.DOCUMENT_ID) / 100).ToString() : FinalPDF.DOCUMENT_ID.Substring(0, 5)) |
346 | 347 |
+ @"\" + FinalPDF.DOCUMENT_ID + @"\"; |
347 | 348 |
|
348 |
MarkupInfoItem = DocInfoItem.MARKUP_INFO.Where(data => data.CONSOLIDATE == 1 && data.AVOID_CONSOLIDATE == 0 && data.PART_CONSOLIDATE == 0).FirstOrDefault();
|
|
349 |
var infoItems = _entity.MARKUP_INFO.Where(x=>x.DOCINFO_ID == DocInfoItem.ID && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0);
|
|
349 | 350 |
|
350 |
if (MarkupInfoItem == null)
|
|
351 |
if (infoItems.Count() == 0)
|
|
351 | 352 |
{ |
352 | 353 |
throw new Exception("콘솔리데잇이 작업 요청 후에 수정 / 삭제 되었습니다"); |
353 | 354 |
} |
354 | 355 |
else |
355 | 356 |
{ |
356 |
if (MarkupInfoItem.MARKUP_INFO_VERSION.Count > 0) |
|
357 |
MarkupInfoItem = infoItems.First(); |
|
358 |
|
|
359 |
var markupInfoVerItems = _entity.MARKUP_INFO_VERSION.Where(x => x.MARKUPINFO_ID == MarkupInfoItem.ID).ToList(); |
|
360 |
|
|
361 |
if (markupInfoVerItems.Count() > 0) |
|
357 | 362 |
{ |
358 |
MarkupDataSet = MarkupInfoItem.MARKUP_INFO_VERSION.OrderBy(d => d.CREATE_DATE).LastOrDefault().MARKUP_DATA.ToList().OrderBy(d => d.PAGENUMBER).ToList(); |
|
363 |
var markupInfoVerItem = markupInfoVerItems.OrderByDescending(x => x.CREATE_DATE).First(); |
|
364 |
|
|
365 |
MarkupDataSet = _entity.MARKUP_DATA.Where(x=>x.MARKUPINFO_VERSION_ID == markupInfoVerItem.ID).OrderBy(d => d.PAGENUMBER).ToList(); |
|
359 | 366 |
} |
360 | 367 |
else |
361 | 368 |
{ |
... | ... | |
559 | 566 |
{ |
560 | 567 |
if(StatusChanged != null) |
561 | 568 |
{ |
562 |
var sb = new StringBuilder(); |
|
563 |
sb.AppendLine(message); |
|
569 |
//var sb = new StringBuilder();
|
|
570 |
//sb.AppendLine(message);
|
|
564 | 571 |
|
565 |
StatusChanged(null, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = sb.ToString() });
|
|
572 |
StatusChanged(this, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = message });
|
|
566 | 573 |
} |
567 | 574 |
} |
568 | 575 |
|
... | ... | |
601 | 608 |
|
602 | 609 |
foreach (var data in MarkupDataSet) |
603 | 610 |
{ |
604 |
StatusChange("MarkupDataSet", 0); |
|
611 |
//StatusChange("MarkupDataSet", 0);
|
|
605 | 612 |
|
606 | 613 |
string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID; |
607 | 614 |
|
... | ... | |
653 | 660 |
pdfStamper.SetFullCompression(); |
654 | 661 |
_SetColor = new SolidColorBrush(Colors.Red); |
655 | 662 |
|
663 |
StringBuilder strLog = new StringBuilder(); |
|
664 |
int lastPageNo = 0; |
|
665 |
|
|
666 |
strLog.Append($"Write {DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")} markup Count : {MarkupDataSet.Count()} / "); |
|
667 |
|
|
656 | 668 |
foreach (var markupItem in MarkupDataSet) |
657 | 669 |
{ |
658 | 670 |
/// 2020.11.13 김태성 |
... | ... | |
663 | 675 |
{ |
664 | 676 |
var currentPage = pageitems.First(); |
665 | 677 |
pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER); |
678 |
lastPageNo = markupItem.PAGENUMBER; |
|
666 | 679 |
//try |
667 | 680 |
//{ |
668 |
|
|
681 |
|
|
669 | 682 |
//} |
670 | 683 |
//catch (Exception ex) |
671 | 684 |
//{ |
... | ... | |
704 | 717 |
string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
705 | 718 |
|
706 | 719 |
PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER); |
720 |
strLog.Append($"{markupItem.PAGENUMBER}/"); |
|
707 | 721 |
|
708 | 722 |
foreach (var data in markedData) |
709 | 723 |
{ |
... | ... | |
1224 | 1238 |
{ |
1225 | 1239 |
StatusChange($"markupItem : {markupItem.ID}" + ex.ToString(), 0); |
1226 | 1240 |
} |
1241 |
finally |
|
1242 |
{ |
|
1243 |
if(ControlT?.Name != null) |
|
1244 |
{ |
|
1245 |
strLog.Append($"{ControlT.Name},"); |
|
1246 |
} |
|
1247 |
} |
|
1227 | 1248 |
} |
1249 |
|
|
1228 | 1250 |
} |
1229 | 1251 |
} |
1252 |
|
|
1253 |
if (StatusChanged != null) |
|
1254 |
{ |
|
1255 |
StatusChanged(this, new StatusChangedEventArgs { CurrentPage = lastPageNo, Message = strLog.ToString() }); |
|
1256 |
} |
|
1230 | 1257 |
//PdfFileSpecification pfs = PdfFileSpecification.FileEmbedded(pdfStamper.Writer, @"C:\Users\kts\Documents\업무\CARS\엑셀양식\F-000-5378-702_R2_계장 Cable Schedule Sample.xlsx", "F-000-5378-702_R2_계장 Cable Schedule Sample.xlsx", null); |
1231 | 1258 |
//pdfStamper.AddFileAttachment("F-000-5378-702_R2_계장 Cable Schedule Sample.xlsx", pfs); |
1232 | 1259 |
|
내보내기 Unified diff