개정판 cf1cc862
licensing 수정
Change-Id: I3bffa280e0205be1031c133bf4716929fcbd7c54
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs | ||
---|---|---|
255 | 255 |
} |
256 | 256 |
|
257 | 257 |
#region 생성자 & 소멸자 |
258 |
public EndFinalResult MakeFinalPDF(object _FinalPDF)
|
|
258 |
public void MakeFinalPDF(object _FinalPDF)
|
|
259 | 259 |
{ |
260 |
EndFinalResult result = new EndFinalResult(); |
|
261 |
|
|
262 | 260 |
DOCUMENT_ITEM documentItem; |
263 | 261 |
FINAL_PDF FinalPDF = (FINAL_PDF)_FinalPDF; |
264 | 262 |
FinalItem = FinalPDF; |
... | ... | |
278 | 276 |
{ |
279 | 277 |
if (_properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).Count() == 0) |
280 | 278 |
{ |
281 |
result.Error = " TileSourcePath Not Found."; |
|
279 |
SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : TileSourcePath Not Found."); |
|
280 |
return; |
|
282 | 281 |
} |
283 | 282 |
else |
284 |
{
|
|
283 |
{ |
|
285 | 284 |
PdfFilePathRoot = _properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).First().VALUE; |
286 | 285 |
} |
287 | 286 |
|
288 | 287 |
if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).Count() == 0) |
289 | 288 |
{ |
290 |
result.Error = " FinalPDFStorgeLocal Not Found."; |
|
289 |
SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeLocal Not Found."); |
|
290 |
return; |
|
291 | 291 |
} |
292 | 292 |
else |
293 | 293 |
{ |
... | ... | |
297 | 297 |
|
298 | 298 |
if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).Count() == 0) |
299 | 299 |
{ |
300 |
result.Error = " FinalPDFStorgeRemote Not Found."; |
|
300 |
SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeRemote Not Found."); |
|
301 |
return; |
|
301 | 302 |
} |
302 | 303 |
else |
303 | 304 |
{ |
... | ... | |
306 | 307 |
} |
307 | 308 |
else |
308 | 309 |
{ |
309 |
result.Error = " Final PDF Properties Not Found."; |
|
310 |
SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : Final PDF Properties Not Found."); |
|
311 |
return; |
|
310 | 312 |
} |
311 | 313 |
|
312 | 314 |
var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID); |
... | ... | |
322 | 324 |
} |
323 | 325 |
catch (Exception ex) |
324 | 326 |
{ |
325 |
result.Error = " 프로퍼티 에러." + ex.ToString(); |
|
326 |
} |
|
327 |
|
|
328 |
if(result.Error != null) |
|
329 |
{ |
|
330 |
return result; |
|
327 |
SetNotice(FinalPDF.ID, "프로퍼티 에러: " + ex.ToString()); |
|
328 |
return; |
|
331 | 329 |
} |
332 |
|
|
333 | 330 |
#endregion |
334 | 331 |
|
335 | 332 |
#region 문서 복사 |
... | ... | |
349 | 346 |
+ (FinalPDF.DOCUMENT_ID.All(char.IsDigit) ? (System.Convert.ToInt64(FinalPDF.DOCUMENT_ID) / 100).ToString() : FinalPDF.DOCUMENT_ID.Substring(0, 5)) |
350 | 347 |
+ @"\" + FinalPDF.DOCUMENT_ID + @"\"; |
351 | 348 |
|
352 |
var infoItems = _entity.MARKUP_INFO.Where(x=>x.DOCINFO_ID == DocInfoItem.ID && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0);
|
|
349 |
var infoItems = _entity.MARKUP_INFO.Where(x => x.DOCINFO_ID == DocInfoItem.ID && x.CONSOLIDATE == 1 && x.AVOID_CONSOLIDATE == 0 && x.PART_CONSOLIDATE == 0);
|
|
353 | 350 |
|
354 | 351 |
if (infoItems.Count() == 0) |
355 | 352 |
{ |
... | ... | |
360 | 357 |
MarkupInfoItem = infoItems.First(); |
361 | 358 |
|
362 | 359 |
var markupInfoVerItems = _entity.MARKUP_INFO_VERSION.Where(x => x.MARKUPINFO_ID == MarkupInfoItem.ID).ToList(); |
363 |
|
|
360 |
|
|
364 | 361 |
if (markupInfoVerItems.Count() > 0) |
365 | 362 |
{ |
366 | 363 |
var markupInfoVerItem = markupInfoVerItems.OrderByDescending(x => x.CREATE_DATE).First(); |
367 | 364 |
|
368 |
MarkupDataSet = _entity.MARKUP_DATA.Where(x=>x.MARKUPINFO_VERSION_ID == markupInfoVerItem.ID).OrderBy(d => d.PAGENUMBER).ToList();
|
|
365 |
MarkupDataSet = _entity.MARKUP_DATA.Where(x => x.MARKUPINFO_VERSION_ID == markupInfoVerItem.ID).OrderBy(d => d.PAGENUMBER).ToList();
|
|
369 | 366 |
} |
370 | 367 |
else |
371 | 368 |
{ |
... | ... | |
387 | 384 |
/// 문서 관리 시스템의 원본 PDF 파일과 비교 --> 삭제될 예정 |
388 | 385 |
//if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower())) |
389 | 386 |
//{ |
390 |
OriginFileName = _files.First().Name;
|
|
391 |
PdfFilePath = _files.First().CopyTo(TestFile, true);
|
|
392 |
StatusChange($"Copy File file Count = 1 : {PdfFilePath}", 0);
|
|
387 |
OriginFileName = _files.First().Name; |
|
388 |
PdfFilePath = _files.First().CopyTo(TestFile, true); |
|
389 |
StatusChange($"Copy File file Count = 1 : {PdfFilePath}", 0); |
|
393 | 390 |
//} |
394 | 391 |
//else |
395 | 392 |
//{ |
... | ... | |
427 | 424 |
throw new Exception("PDF원본이 존재하지 않습니다"); |
428 | 425 |
} |
429 | 426 |
#endregion |
430 |
|
|
427 |
|
|
431 | 428 |
} |
432 | 429 |
else |
433 | 430 |
{ |
... | ... | |
437 | 434 |
} |
438 | 435 |
catch (Exception ex) |
439 | 436 |
{ |
440 |
result.Error = "PDF를 Stamp 중 에러 : " + ex.Message; |
|
441 |
//if (ex.Message == "사용 가능한" || ex.Message == "작업을 완료했습니다") |
|
442 |
//{ |
|
443 |
// //SetNotice(FinalPDF.ID, "Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다"); |
|
444 |
// //System.Diagnostics.Process process = new System.Diagnostics.Process(); |
|
445 |
// //process.StartInfo.FileName = "cmd"; |
|
446 |
// //process.StartInfo.Arguments = "/c net stop \"FinalService\" & net start \"FinalService\""; |
|
447 |
// //process.Start(); |
|
448 |
//} |
|
449 |
//else |
|
450 |
//{ |
|
451 |
|
|
452 |
//} |
|
453 |
} |
|
454 |
|
|
455 |
|
|
456 |
if (result.Error != null) |
|
457 |
{ |
|
458 |
return result; |
|
437 |
if (ex.Message == "사용 가능한" || ex.Message == "작업을 완료했습니다") |
|
438 |
{ |
|
439 |
SetNotice(FinalPDF.ID, "Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다"); |
|
440 |
//System.Diagnostics.Process process = new System.Diagnostics.Process(); |
|
441 |
//process.StartInfo.FileName = "cmd"; |
|
442 |
//process.StartInfo.Arguments = "/c net stop \"FinalService\" & net start \"FinalService\""; |
|
443 |
//process.Start(); |
|
444 |
} |
|
445 |
else |
|
446 |
{ |
|
447 |
SetNotice(FinalPDF.ID, "PDF를 Stamp 중 에러 : " + ex.Message); |
|
448 |
} |
|
459 | 449 |
} |
460 |
|
|
461 | 450 |
#endregion |
462 | 451 |
|
463 | 452 |
try |
... | ... | |
472 | 461 |
//TestFile = SetFlattingPDF(TestFile); |
473 | 462 |
//StatusChange($"SetFlattingPDF : {TestFile}", 0); |
474 | 463 |
|
475 |
if(SetStampInPDF(FinalItem, TestFile, MarkupInfoItem)) |
|
476 |
{ |
|
477 |
StatusChange($"finish : {TestFile}", 0); |
|
478 |
} |
|
479 |
else |
|
480 |
{ |
|
481 |
StatusChange($"stamp Error", 0); |
|
482 |
} |
|
464 |
SetStampInPDF(FinalItem, TestFile, MarkupInfoItem); |
|
483 | 465 |
|
466 |
StatusChange($"SetStampInPDF : {TestFile}", 0); |
|
484 | 467 |
} |
485 | 468 |
} |
486 |
|
|
487 |
result.FinalPDFRemotePath = _FinalPDFStorgeRemote + @"\" + FinalPDFPath.Name; |
|
488 |
result.OriginPDFName = OriginFileName; |
|
489 |
result.FinalPDFPath = FinalPDFPath.FullName; |
|
490 |
result.Error = ""; |
|
491 |
result.Message = ""; |
|
469 |
if (EndFinal != null) |
|
470 |
{ |
|
471 |
EndFinal(this, new EndFinalEventArgs |
|
472 |
{ |
|
473 |
FinalPDFRemotePath = _FinalPDFStorgeRemote + @"\" + FinalPDFPath.Name, |
|
474 |
OriginPDFName = OriginFileName, |
|
475 |
FinalPDFPath = FinalPDFPath.FullName, |
|
476 |
Error = "", |
|
477 |
Message = "", |
|
478 |
FinalPDF = FinalPDF, |
|
479 |
}); |
|
480 |
} |
|
492 | 481 |
} |
493 | 482 |
catch (Exception ex) |
494 | 483 |
{ |
495 | 484 |
SetNotice(FinalPDF.ID, "MarkFinalPDF Error : " + ex.Message); |
496 | 485 |
} |
497 |
|
|
498 |
return result; |
|
499 | 486 |
} |
500 | 487 |
#endregion |
501 | 488 |
|
내보내기 Unified diff