V2026012702 #125
@@ -317,7 +317,7 @@ function fn_purchaseClose(){
|
||||
</h2>
|
||||
<div class="btnArea">
|
||||
<input type="button" class="plm_btns" value="조회" id="btnSearch">
|
||||
<input type="button" class="plm_btns" value="입고등록" id="btnAccept">
|
||||
<!-- <input type="button" class="plm_btns" value="입고등록" id="btnAccept"> -->
|
||||
<input type="button" class="plm_btns" value="매입마감" id="btnClose">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -88,8 +88,28 @@ var columns = [
|
||||
{headerHozAlign:'center', hozAlign:'center', widthGrow:1.2, title:'프로젝트번호', field:'PROJECT_NUMBER'},
|
||||
{headerHozAlign:'center', hozAlign:'center', widthGrow:0.7, title:'주문유형', field:'ORDER_TYPE_NAME'},
|
||||
{headerHozAlign:'center', hozAlign:'center', widthGrow:0.7, title:'제품구분', field:'PRODUCT_NAME_TITLE'},
|
||||
{headerHozAlign:'center', hozAlign:'left', widthGrow:1.2, title:'품번', field:'PART_NO'},
|
||||
{headerHozAlign:'center', hozAlign:'left', widthGrow:1.5, title:'품명', field:'PART_NAME'},
|
||||
{headerHozAlign:'center', hozAlign:'left', widthGrow:1.2, title:'품번', field:'PART_NO',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var partNo = fnc_checkNull(cell.getValue());
|
||||
var detailCount = parseInt(fnc_checkNull(cell.getData().DETAIL_COUNT)) || 0;
|
||||
if(partNo === '') return '';
|
||||
if(detailCount > 1) {
|
||||
return partNo + ' <span style="color:#888;">외 ' + (detailCount - 1) + '건</span>';
|
||||
}
|
||||
return partNo;
|
||||
}
|
||||
},
|
||||
{headerHozAlign:'center', hozAlign:'left', widthGrow:1.5, title:'품명', field:'PART_NAME',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var partName = fnc_checkNull(cell.getValue());
|
||||
var detailCount = parseInt(fnc_checkNull(cell.getData().DETAIL_COUNT)) || 0;
|
||||
if(partName === '') return '';
|
||||
if(detailCount > 1) {
|
||||
return partName + ' <span style="color:#888;">외 ' + (detailCount - 1) + '건</span>';
|
||||
}
|
||||
return partName;
|
||||
}
|
||||
},
|
||||
{headerHozAlign:'center', hozAlign:'left', widthGrow:1.2, title:'업체명', field:'VENDOR_NAME',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
|
||||
@@ -4503,9 +4503,16 @@ ORDER BY V.PATH2
|
||||
PM.PROJECT_NO AS PROJECT_NUMBER,
|
||||
-- 업체 정보
|
||||
CM.CLIENT_NM AS VENDOR_NAME,
|
||||
-- 품번/품명 (프로젝트 정보)
|
||||
PM.PART_NO,
|
||||
PM.PART_NAME,
|
||||
-- 품번/품명 (견적요청서 상세 - 첫 번째 품목)
|
||||
(SELECT QRD.PART_NO FROM QUOTATION_REQUEST_DETAIL QRD
|
||||
WHERE QRD.QUOTATION_REQUEST_MASTER_OBJID = QRM.OBJID
|
||||
ORDER BY QRD.OBJID LIMIT 1) AS PART_NO,
|
||||
(SELECT QRD.PART_NAME FROM QUOTATION_REQUEST_DETAIL QRD
|
||||
WHERE QRD.QUOTATION_REQUEST_MASTER_OBJID = QRM.OBJID
|
||||
ORDER BY QRD.OBJID LIMIT 1) AS PART_NAME,
|
||||
-- 견적요청서 상세 품목 개수
|
||||
(SELECT COUNT(*) FROM QUOTATION_REQUEST_DETAIL QRD
|
||||
WHERE QRD.QUOTATION_REQUEST_MASTER_OBJID = QRM.OBJID) AS DETAIL_COUNT,
|
||||
-- 수신견적서 첨부파일 개수
|
||||
(SELECT COUNT(*) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID = QRM.OBJID::VARCHAR AND DOC_TYPE = 'QUOTATION_RECEIVED' AND STATUS = 'Active') AS ATTACH_FILE_CNT
|
||||
FROM QUOTATION_REQUEST_MASTER QRM
|
||||
|
||||
@@ -3007,11 +3007,30 @@ public class PurchaseOrderService {
|
||||
masterInfo.put("EXCELFILE_NAME", excelName);
|
||||
masterInfo.put("APPR_COMPLETE_DATE", frm2.format(cal.getTime()));
|
||||
|
||||
// 발주서 테이블 내용 생성
|
||||
String contents_table = this.makePoContentsTable(masterInfo, detailList, apprList, multiMasterList);
|
||||
// pdfSessionId 확인 (PDF 첨부 여부 결정)
|
||||
String pdfSessionId = CommonUtils.checkNull(paramMap.get("pdfSessionId"));
|
||||
boolean isPdfAttach = false;
|
||||
|
||||
// 메일 본문 생성 (사용자 입력 내용 + 발주서 테이블)
|
||||
String mailContents = this.makeMailContentsWithUserInput(contents, contents_table);
|
||||
// PDF 파일 존재 여부 확인
|
||||
if(!"".equals(pdfSessionId)) {
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File pdfFile = new File(tempDir + File.separator + pdfSessionId + ".pdf");
|
||||
isPdfAttach = pdfFile.exists();
|
||||
}
|
||||
|
||||
// 발주서 테이블 내용 생성 (PDF 첨부 시에는 사용하지 않음)
|
||||
String contents_table = "";
|
||||
if(!isPdfAttach) {
|
||||
contents_table = this.makePoContentsTable(masterInfo, detailList, apprList, multiMasterList);
|
||||
}
|
||||
|
||||
// 메일 본문 생성 (PDF 첨부 시에는 사용자 입력 내용만, 아니면 테이블 포함)
|
||||
String mailContents = "";
|
||||
if(isPdfAttach) {
|
||||
mailContents = this.makeMailContentsWithoutTable(contents);
|
||||
} else {
|
||||
mailContents = this.makeMailContentsWithUserInput(contents, contents_table);
|
||||
}
|
||||
|
||||
// 수신인 이메일 목록 생성
|
||||
ArrayList<String> toUserIdList = new ArrayList<String>();
|
||||
@@ -3044,10 +3063,26 @@ public class PurchaseOrderService {
|
||||
// 첨부파일 목록 생성
|
||||
ArrayList<HashMap> attachFileList = new ArrayList<HashMap>();
|
||||
|
||||
// 1. 발주서 엑셀 파일 첨부
|
||||
HashMap excelFile = this.makeMailAttachFileOrderSheet(masterInfo, contents_table);
|
||||
if(excelFile != null) {
|
||||
attachFileList.add(excelFile);
|
||||
// 1. 발주서 첨부 (PDF 또는 엑셀)
|
||||
if(isPdfAttach) {
|
||||
// PDF 파일 첨부
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File pdfFile = new File(tempDir + File.separator + pdfSessionId + ".pdf");
|
||||
String pdfFileName = "발주서_" + poNo + "_" + todayKor + ".pdf";
|
||||
|
||||
HashMap pdfFileMap = new HashMap();
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_REAL_NAME, pdfFileName);
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_SAVED_NAME, pdfFile.getName());
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_PATH, tempDir);
|
||||
attachFileList.add(pdfFileMap);
|
||||
|
||||
System.out.println("발주서 PDF 첨부 완료: " + pdfFile.getAbsolutePath());
|
||||
} else {
|
||||
// 엑셀 파일 첨부 (PDF 없을 때)
|
||||
HashMap excelFile = this.makeMailAttachFileOrderSheet(masterInfo, contents_table);
|
||||
if(excelFile != null) {
|
||||
attachFileList.add(excelFile);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 도면 파일 압축 첨부 (includeDrawingFiles가 Y인 경우에만)
|
||||
@@ -3108,6 +3143,36 @@ public class PurchaseOrderService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 입력 내용만으로 메일 본문 생성 (PDF 첨부 시 테이블 없이)
|
||||
* @param userContents 사용자가 입력한 메일 내용
|
||||
* @return 완성된 메일 본문
|
||||
*/
|
||||
private String makeMailContentsWithoutTable(String userContents) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("<!DOCTYPE html><html lang='ko' dir='ltr'>");
|
||||
sb.append("<head>");
|
||||
sb.append(" <meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>");
|
||||
sb.append(" <style>");
|
||||
sb.append(" @import url(http://fonts.googleapis.com/earlyaccess/notosanskr.css);");
|
||||
sb.append(" @import url(https://fonts.googleapis.com/css?family=Roboto:100,300,500,500,700,900);");
|
||||
sb.append(" body {font-family: 'Noto Sans KR', sans-serif; background: #fff; width: 100%; position:relative;}");
|
||||
sb.append(" </style>");
|
||||
sb.append("</head>");
|
||||
sb.append("<body style='margin:0; padding:20px;'>");
|
||||
|
||||
// 사용자 입력 내용 (줄바꿈을 <br>로 변환)
|
||||
sb.append("<div style='white-space: pre-line;'>");
|
||||
sb.append(userContents.replace("\n", "<br>"));
|
||||
sb.append("</div>");
|
||||
|
||||
sb.append("<div style='margin-top: 20px; color: #666;'>※ 발주서는 첨부파일(PDF)을 확인해주세요.</div>");
|
||||
sb.append("</body>");
|
||||
sb.append("</html>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 입력 내용과 발주서 테이블을 합친 메일 본문 생성
|
||||
* @param userContents 사용자가 입력한 메일 내용
|
||||
|
||||
Reference in New Issue
Block a user