private RESULT MakingTiff(decimal p_faxId, string p_strTrNo, string p_strPacket, string p_strFaxFormLocal, string p_strFaxFormFullPath, DbModule.SEND_REQUEST_DTL_TMK p_tmkDtlInfo, DbModule.DOC_INFO_ALL_TMK p_docInfo, P_TYPE p_destProcessType) { RESULT result = RESULT.EMPTY; // ADD - KIMCG : 20140903 // 팩스번호 복호화 처리 if (Config.ENCRYPT_FIELD_YN == "Y") { string strDecrytedFaxNo = ""; if (EncryptApi.Decrypt(p_tmkDtlInfo.strFaxNo, out strDecrytedFaxNo)) { p_tmkDtlInfo.strFaxNo = strDecrytedFaxNo; } else { LogWrite(LOG_LEVEL.WRN, "팩스번호 복호화 처리 실패", RESULT.EMPTY); } } // ADD - END if (p_destProcessType == P_TYPE.PSC) { p_docInfo.strDocFile = string.Format("{0}_{1}", p_faxId, p_tmkDtlInfo.faxDtlId); } else { p_docInfo.strDocFile = string.Format("{0}_{1}_tifmake", p_faxId, p_tmkDtlInfo.faxDtlId); } string strFileName = string.Format("{0}.{1}", p_docInfo.strDocFile, p_docInfo.strDocExt); //// 파일경로이름 SET //// string strFinishFile = ""; string strMakingFile = string.Format(@"{0}\{1}", Config.TIFF_MAKING_PATH, strFileName); if (p_destProcessType == P_TYPE.PSC) { strFinishFile = string.Format(@"{0}\{1}", Config.FINISHED_TIF_PATH, p_tmkDtlInfo.strTiffPath); } else { strFinishFile = string.Format(@"{0}\{1}", Config.MADE_TIF_PATH, strFileName); } string strPacketXmlFile = string.Format(@"{0}\{1}_{2}.xml", Config.TIFF_MAKING_PATH, p_faxId, p_tmkDtlInfo.faxDtlId); //// TIFF 생성 //// try { //// 팩스폼 로딩 //// if (!File.Exists(p_strFaxFormLocal)) { LogError(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] 팩스폼파일을 찾을수 없습니다.(파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, p_strFaxFormLocal), RESULT.F_MAKE_NOT_EXIST_FAXFORMFILE); return(RESULT.F_MAKE_NOT_EXIST_FAXFORMFILE); } //// Page fault 처리 - 스트림 생성 //// using (MemoryStream faxFormStream = new MemoryStream()) { using (Stream localFaxFormStream = File.OpenRead(p_strFaxFormLocal)) { localFaxFormStream.CopyTo(faxFormStream); localFaxFormStream.Close(); } using (XtraReport_Btfax report = new XtraReport_Btfax()) { report.LoadLayout(p_strFaxFormLocal); LogMessage(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] 팩스폼파일 로딩성공 (파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, p_strFaxFormLocal), RESULT.SUCCESS); //// 전문 XML 로딩 //// report.LoadPacketXml(p_strPacket, p_strTrNo, false, true); //// 레포트 데이터셋에 팩스번호, 수신인명 바인딩 처리 //// DataSet reportDs = report.DataSource as DataSet; if (reportDs == null) { LogError(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] 팩스폼에 데이터셋이 존재하지 않습니다 (파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, p_strFaxFormLocal), RESULT.F_MAKE); return(RESULT.F_MAKE); } DataTable reportDt = reportDs.Tables["헤더___HEADER_O_COMMON"]; if (reportDt == null) { LogError(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] 팩스폼에 데이터셋이 존재하지 않습니다 (파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, p_strFaxFormLocal), RESULT.F_MAKE); return(RESULT.F_MAKE); } bool bFaxNumBinded = false; bool bFaxRecipientNameBinded = false; foreach (DataColumn col in reportDt.Columns) { foreach (DataRow row in reportDt.Rows) { if (bFaxNumBinded && bFaxRecipientNameBinded) { break; } if (col.ColumnName == "수신자팩스번호") { row[col.ColumnName] = p_tmkDtlInfo.strFaxNo; bFaxNumBinded = true; } if (col.ColumnName == "수신자이름") { row[col.ColumnName] = p_tmkDtlInfo.strRecipientName; bFaxRecipientNameBinded = true; } } } //// 컨트롤 바인딩 처리 //// foreach (Band band in report.Bands) { foreach (XRControl control in band.Controls) { //// 이미지 외, 컨트롤 바인딩 유효성 체크 //// if (control is XRLabel || control is XRCheckBox || control is XRTableCell) { result = ValidateBinding(report, control); if (result != RESULT.SUCCESS) { return(result); } } //// 이미지 바인딩 유효성 체크 및 동적 바인딩 //// else if (control is XRPictureBox) { XRPictureBox xrPictureBox = control as XRPictureBox; result = BindImageBox(report, xrPictureBox); if (result != RESULT.SUCCESS) { throw new Exception(); } } } } //// Export /// //report.ExportToImage(strMakingFile, this.exportOption); if (!report.ExportImageForFax(Config.TIFF_MAKING_PATH, strFileName)) { LogError(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] TIF파일 생성실패 (파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, strMakingFile), RESULT.F_MAKE); return(RESULT.F_MAKE); } LogMessage(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] TIF파일 생성성공 (파일:{2})", p_faxId, p_tmkDtlInfo.faxDtlId, strMakingFile), RESULT.SUCCESS); //// 파일 업로드 //// if (!UploadFinishedTif(strMakingFile, strFinishFile)) { LogError(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] TIF파일 업로드실패 (파일:{2}->{3})", p_faxId, p_tmkDtlInfo.faxDtlId, strMakingFile, strFinishFile), RESULT.F_FILE_FAIL_TO_UPLOAD); return(RESULT.F_FILE_FAIL_TO_UPLOAD); } LogMessage(string.Format("[FAX_ID:{0}][FAX_DTL_ID:{1}] TIF파일 업로드성공 (파일:{2}->{3})", p_faxId, p_tmkDtlInfo.faxDtlId, strMakingFile, strFinishFile), RESULT.SUCCESS); if (reportDt != null) { reportDt.Dispose(); } if (reportDs != null) { reportDs.Dispose(); } // LHOPE File.Delete(strMakingFile); } faxFormStream.Close(); return(RESULT.SUCCESS); } } catch (Exception ex) { LogError(string.Format("팩스 발송 요청에 대하여 팩스폼[{0}]으로 TIFF 파일[{1}]을 생성하는 도중., 다음과 같은 오류가 발생하였습니다. {2}", p_strFaxFormFullPath, strMakingFile, ex.Message), RESULT.F_MAKE); return(RESULT.F_MAKE); } }