|
|
|
|
@@ -1842,6 +1842,8 @@ public class ApprovalService {
|
|
|
|
|
try {
|
|
|
|
|
if("CONTRACT_ESTIMATE".equals(targetType)) {
|
|
|
|
|
fileListEncoded = uploadEstimateFilesToOneChamber(apiClient, empSeq, targetObjId);
|
|
|
|
|
} else if("CONTRACT_ORDER".equals(targetType)) {
|
|
|
|
|
fileListEncoded = uploadOrderFilesToOneChamber(apiClient, empSeq, targetObjId);
|
|
|
|
|
} else {
|
|
|
|
|
fileListEncoded = uploadFilesToOneChamber(apiClient, empSeq, targetObjId, targetType);
|
|
|
|
|
}
|
|
|
|
|
@@ -2051,6 +2053,363 @@ public class ApprovalService {
|
|
|
|
|
* 견적서 첨부파일을 원챔버에 업로드하고 fileList (URL 인코딩) 반환
|
|
|
|
|
* @return URL 인코딩된 fileList JSON 문자열 (파일 없으면 null)
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* 주문서 데이터를 원챔버에 HTML로 업로드
|
|
|
|
|
*/
|
|
|
|
|
private String uploadOrderFilesToOneChamber(
|
|
|
|
|
com.pms.api.AmaranthApprovalApiClient apiClient,
|
|
|
|
|
String empSeq, String targetObjId) throws Exception {
|
|
|
|
|
|
|
|
|
|
if(targetObjId == null || targetObjId.isEmpty()) return null;
|
|
|
|
|
|
|
|
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(true);
|
|
|
|
|
try {
|
|
|
|
|
Map<String, String> authResult = apiClient.getAuthToken(AMARANTH_BASE_URL, empSeq);
|
|
|
|
|
if(!"true".equals(authResult.get("success"))){
|
|
|
|
|
throw new Exception("파일 업로드용 인증 토큰 발급 실패: " + authResult.get("resultMsg"));
|
|
|
|
|
}
|
|
|
|
|
String authToken = authResult.get("authToken");
|
|
|
|
|
String userHashKey = authResult.get("hashKey");
|
|
|
|
|
|
|
|
|
|
StringBuilder listItems = new StringBuilder();
|
|
|
|
|
int uploadCount = 0;
|
|
|
|
|
|
|
|
|
|
// 주문서 본문을 HTML 파일로 생성하여 업로드
|
|
|
|
|
try {
|
|
|
|
|
Map<String, Object> orderParam = new HashMap<String, Object>();
|
|
|
|
|
orderParam.put("targetObjId", targetObjId);
|
|
|
|
|
Map<String, Object> orderInfo = sqlSession.selectOne("approval.getOrderInfoForApproval", orderParam);
|
|
|
|
|
|
|
|
|
|
if(orderInfo != null){
|
|
|
|
|
orderInfo = CommonUtils.toUpperCaseMapKey(orderInfo);
|
|
|
|
|
String contractNo = CommonUtils.checkNull(orderInfo.get("CONTRACT_NO"));
|
|
|
|
|
|
|
|
|
|
List<Map> itemList = sqlSession.selectList("approval.getOrderItemsForApproval", orderParam);
|
|
|
|
|
|
|
|
|
|
String fullHtml = buildOrderFormFileHtml(orderInfo, itemList);
|
|
|
|
|
|
|
|
|
|
String tempFileName = "주문서_" + contractNo + ".html";
|
|
|
|
|
java.io.File tempFile = java.io.File.createTempFile("order_", ".html");
|
|
|
|
|
java.io.OutputStreamWriter writer = new java.io.OutputStreamWriter(
|
|
|
|
|
new java.io.FileOutputStream(tempFile), "UTF-8");
|
|
|
|
|
writer.write(fullHtml);
|
|
|
|
|
writer.close();
|
|
|
|
|
|
|
|
|
|
System.out.println("[첨부파일] 주문서 HTML 생성: " + tempFileName + " (" + tempFile.length() + " bytes)");
|
|
|
|
|
|
|
|
|
|
String uploadResponse = apiClient.uploadFileToOneChamber(
|
|
|
|
|
AMARANTH_BASE_URL, authToken, userHashKey, empSeq, tempFile, tempFileName
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
String listItem = apiClient.extractListItemFromUploadResponse(uploadResponse);
|
|
|
|
|
if(listItem != null){
|
|
|
|
|
listItems.append(listItem);
|
|
|
|
|
uploadCount++;
|
|
|
|
|
System.out.println("[첨부파일] 주문서 HTML 업로드 성공");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempFile.delete();
|
|
|
|
|
}
|
|
|
|
|
} catch(Exception htmlEx){
|
|
|
|
|
System.err.println("[첨부파일] 주문서 HTML 생성/업로드 오류: " + htmlEx.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ATTACH_FILE_INFO에서 기존 첨부파일도 업로드 (주문서 첨부)
|
|
|
|
|
Map<String, Object> fileParam = new HashMap<String, Object>();
|
|
|
|
|
fileParam.put("targetObjId", targetObjId);
|
|
|
|
|
List<Map<String, Object>> fileList = sqlSession.selectList("common.getFileList", fileParam);
|
|
|
|
|
|
|
|
|
|
if(fileList != null && !fileList.isEmpty()){
|
|
|
|
|
System.out.println("[첨부파일] 주문서(" + targetObjId + ") 기존 첨부파일 " + fileList.size() + "건 발견");
|
|
|
|
|
|
|
|
|
|
for(Map<String, Object> fileInfo : fileList){
|
|
|
|
|
String savedFileName = CommonUtils.checkNull(fileInfo.get("saved_file_name"));
|
|
|
|
|
String realFileName = CommonUtils.checkNull(fileInfo.get("real_file_name"));
|
|
|
|
|
String filePath = CommonUtils.checkNull(fileInfo.get("file_path"));
|
|
|
|
|
|
|
|
|
|
if(savedFileName.isEmpty()) continue;
|
|
|
|
|
|
|
|
|
|
String fullPath = filePath + "/" + savedFileName;
|
|
|
|
|
java.io.File physicalFile = new java.io.File(fullPath);
|
|
|
|
|
if(!physicalFile.exists()){
|
|
|
|
|
System.err.println("[첨부파일] 파일 미존재: " + fullPath);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String originalName = realFileName.isEmpty() ? savedFileName : realFileName;
|
|
|
|
|
|
|
|
|
|
String uploadResponse = apiClient.uploadFileToOneChamber(
|
|
|
|
|
AMARANTH_BASE_URL, authToken, userHashKey, empSeq, physicalFile, originalName
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
String listItem = apiClient.extractListItemFromUploadResponse(uploadResponse);
|
|
|
|
|
if(listItem != null){
|
|
|
|
|
if(uploadCount > 0) listItems.append(",");
|
|
|
|
|
listItems.append(listItem);
|
|
|
|
|
uploadCount++;
|
|
|
|
|
System.out.println("[첨부파일] 업로드 성공: " + originalName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(uploadCount == 0) return null;
|
|
|
|
|
|
|
|
|
|
String fileListJson = "[" + listItems.toString() + "]";
|
|
|
|
|
String fileListEncoded = java.net.URLEncoder.encode(fileListJson, "UTF-8");
|
|
|
|
|
|
|
|
|
|
System.out.println("[첨부파일] 주문서 총 " + uploadCount + "건 업로드 완료");
|
|
|
|
|
|
|
|
|
|
return fileListEncoded;
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
if(sqlSession != null) sqlSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 주문서 Amaranth 결재 본문용 HTML 생성
|
|
|
|
|
*/
|
|
|
|
|
private String buildOrderContentsHtml(Map orderInfo, List<Map> itemList){
|
|
|
|
|
StringBuilder html = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
String contractNo = CommonUtils.checkNull(orderInfo.get("CONTRACT_NO"));
|
|
|
|
|
String orderDate = CommonUtils.checkNull(orderInfo.get("ORDER_DATE"));
|
|
|
|
|
String clientNm = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_NM")));
|
|
|
|
|
String clientBusRegNo = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_REG_NO")));
|
|
|
|
|
String clientCeoNm = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_CEO_NM")));
|
|
|
|
|
String clientAddr = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_ADDR")));
|
|
|
|
|
String clientBusType = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_TYPE")));
|
|
|
|
|
String clientBusItem = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_ITEM")));
|
|
|
|
|
String clientTelNo = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_TEL_NO")));
|
|
|
|
|
String clientFaxNo = escapeHtml(CommonUtils.checkNull(orderInfo.get("CLIENT_FAX_NO")));
|
|
|
|
|
String writerName = escapeHtml(CommonUtils.checkNull(orderInfo.get("WRITER_NAME")));
|
|
|
|
|
String supplyPrice = CommonUtils.checkNull(orderInfo.get("ORDER_SUPPLY_PRICE"));
|
|
|
|
|
String vat = CommonUtils.checkNull(orderInfo.get("ORDER_VAT"));
|
|
|
|
|
String totalAmount = CommonUtils.checkNull(orderInfo.get("ORDER_TOTAL_AMOUNT"));
|
|
|
|
|
String vatNote = escapeHtml(CommonUtils.checkNull(orderInfo.get("VAT_NOTE")));
|
|
|
|
|
|
|
|
|
|
final String TH = "style='border:1px solid #999; padding:4px 8px; background-color:#f5f5f5; text-align:center; font-weight:bold; font-size:12px;'";
|
|
|
|
|
final String TD = "style='border:1px solid #999; padding:4px 8px; font-size:12px;'";
|
|
|
|
|
final String TD_C = "style='border:1px solid #999; padding:4px 8px; font-size:12px; text-align:center;'";
|
|
|
|
|
final String TD_R = "style='border:1px solid #999; padding:4px 8px; font-size:12px; text-align:right;'";
|
|
|
|
|
|
|
|
|
|
html.append("<div style='font-family:맑은 고딕; max-width:800px; margin:0 auto;'>");
|
|
|
|
|
html.append("<h2 style='text-align:center; letter-spacing:15px;'>주 문 서</h2>");
|
|
|
|
|
|
|
|
|
|
// 헤더
|
|
|
|
|
String poNo = escapeHtml(CommonUtils.checkNull(orderInfo.get("PO_NO")));
|
|
|
|
|
html.append("<p style='font-size:12px;'>주문일자 : ").append(escapeHtml(orderDate)).append("</p>");
|
|
|
|
|
html.append("<p style='font-size:12px;'>증빙번호 : ").append(poNo).append("</p>");
|
|
|
|
|
|
|
|
|
|
// 공급받는자/공급자 테이블
|
|
|
|
|
html.append("<table style='width:100%; border-collapse:collapse; margin-bottom:5px;'>");
|
|
|
|
|
html.append("<tr><td rowspan='4' " + TH + " style='width:25px; writing-mode:vertical-rl;'>공급받는자</td>");
|
|
|
|
|
html.append("<td " + TH + ">등록번호</td><td " + TD + " colspan='2'>").append(clientBusRegNo).append("</td>");
|
|
|
|
|
html.append("<td rowspan='4' " + TH + " style='width:25px; writing-mode:vertical-rl;'>공급자</td>");
|
|
|
|
|
html.append("<td " + TH + ">등록번호</td><td " + TD + " colspan='2'>314-81-75146</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><td " + TH + ">상호</td><td " + TD + ">").append(clientNm).append("</td>");
|
|
|
|
|
html.append("<td " + TH + " style='width:35px;'>성명</td><td " + TD + ">").append(clientCeoNm).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">상호</td><td " + TD + ">주식회사알피에스본사</td>");
|
|
|
|
|
html.append("<td " + TH + " style='width:35px;'>성명</td><td " + TD + ">이동헌</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><td " + TH + ">주소</td><td " + TD + " colspan='2'>").append(clientAddr).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">주소</td><td " + TD + " colspan='2'>대전광역시 유성구 국제과학10로 8(둔곡동)</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><td " + TH + ">업태</td><td " + TD + ">").append(clientBusType).append("</td>");
|
|
|
|
|
html.append("<td " + TH + " style='width:35px;'>종목</td><td " + TD + ">").append(clientBusItem).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">업태</td><td " + TD + ">제조업</td>");
|
|
|
|
|
html.append("<td " + TH + " style='width:35px;'>종목</td><td " + TD + ">금속절삭가공기계,반도체제조용기계</td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
// 납품처/담당자
|
|
|
|
|
html.append("<table style='width:100%; border-collapse:collapse; margin-bottom:5px;'>");
|
|
|
|
|
html.append("<tr><td " + TH + ">납품처</td><td " + TD + ">").append(clientNm).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">전화번호</td><td " + TD + ">").append(clientTelNo).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">팩스번호</td><td " + TD + ">").append(clientFaxNo).append("</td></tr>");
|
|
|
|
|
html.append("<tr><td " + TH + ">주소</td><td " + TD + ">").append(clientAddr).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">담당자</td><td " + TD + ">").append(writerName).append("</td>");
|
|
|
|
|
html.append("<td " + TH + ">C.P.번호</td><td " + TD + "></td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
// 품목 테이블
|
|
|
|
|
html.append("<table style='width:100%; border-collapse:collapse;'>");
|
|
|
|
|
html.append("<tr>");
|
|
|
|
|
html.append("<th " + TH + " style='width:30px;'>No.</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:90px;'>품번</th>");
|
|
|
|
|
html.append("<th " + TH + ">품명</th>");
|
|
|
|
|
html.append("<th " + TH + ">규격</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:40px;'>단위</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:75px;'>납기일</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:50px;'>수량</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:70px;'>단가</th>");
|
|
|
|
|
html.append("<th " + TH + " style='width:80px;'>금액</th>");
|
|
|
|
|
html.append("</tr>");
|
|
|
|
|
|
|
|
|
|
int totalQty = 0;
|
|
|
|
|
if(itemList != null){
|
|
|
|
|
for(int i = 0; i < itemList.size(); i++){
|
|
|
|
|
Map item = CommonUtils.toUpperCaseMapKey(itemList.get(i));
|
|
|
|
|
int qty = 0;
|
|
|
|
|
try { qty = Integer.parseInt(CommonUtils.checkNull(item.get("ORDER_QUANTITY"), "0")); } catch(Exception e){}
|
|
|
|
|
totalQty += qty;
|
|
|
|
|
String unitPrice = CommonUtils.checkNull(item.get("ORDER_UNIT_PRICE"));
|
|
|
|
|
String itemSupply = CommonUtils.checkNull(item.get("ORDER_SUPPLY_PRICE"));
|
|
|
|
|
|
|
|
|
|
html.append("<tr>");
|
|
|
|
|
html.append("<td " + TD_C + ">").append(i + 1).append("</td>");
|
|
|
|
|
html.append("<td " + TD_C + ">").append(escapeHtml(CommonUtils.checkNull(item.get("PART_NO")))).append("</td>");
|
|
|
|
|
html.append("<td " + TD + ">").append(escapeHtml(CommonUtils.checkNull(item.get("PART_NAME")))).append("</td>");
|
|
|
|
|
html.append("<td " + TD + ">").append(escapeHtml(CommonUtils.checkNull(item.get("SPEC")))).append("</td>");
|
|
|
|
|
html.append("<td " + TD_C + ">").append(escapeHtml(CommonUtils.checkNull(item.get("UNIT_NAME")))).append("</td>");
|
|
|
|
|
html.append("<td " + TD_C + ">").append(escapeHtml(CommonUtils.checkNull(item.get("DUE_DATE")))).append("</td>");
|
|
|
|
|
html.append("<td " + TD_R + ">").append(formatNumber(qty)).append("</td>");
|
|
|
|
|
html.append("<td " + TD_R + ">").append(formatNumber(unitPrice)).append("</td>");
|
|
|
|
|
html.append("<td " + TD_R + ">").append(formatNumber(itemSupply)).append("</td>");
|
|
|
|
|
html.append("</tr>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 합계
|
|
|
|
|
html.append("<tr style='background-color:#ffffcc;'>");
|
|
|
|
|
html.append("<td " + TD_C + " colspan='6' style='font-weight:bold;'>합 계</td>");
|
|
|
|
|
html.append("<td " + TD_R + " style='font-weight:bold;'>").append(formatNumber(totalQty)).append("</td>");
|
|
|
|
|
html.append("<td " + TD_R + "></td>");
|
|
|
|
|
html.append("<td " + TD_R + " style='font-weight:bold;'>").append(formatNumber(supplyPrice)).append("</td>");
|
|
|
|
|
html.append("</tr></table>");
|
|
|
|
|
|
|
|
|
|
// 비고(합계 요약)
|
|
|
|
|
html.append("<table style='width:100%; border-collapse:collapse;'>");
|
|
|
|
|
html.append("<tr><td rowspan='3' " + TH + " style='width:30px; writing-mode:vertical-rl;'>비고</td>");
|
|
|
|
|
html.append("<td " + TH + ">공급가액 합계</td><td " + TD_R + " style='width:150px;'>").append(formatNumber(supplyPrice)).append("</td>");
|
|
|
|
|
html.append("<td rowspan='3' " + TD_C + ">").append(vatNote).append("</td></tr>");
|
|
|
|
|
html.append("<tr><td " + TH + ">부가가치세</td><td " + TD_R + ">").append(formatNumber(vat)).append("</td></tr>");
|
|
|
|
|
html.append("<tr><td " + TH + ">총 계</td><td " + TD_R + " style='font-weight:bold;'>").append(formatNumber(totalAmount)).append("</td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
html.append("</div>");
|
|
|
|
|
|
|
|
|
|
return html.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 주문서 결재 첨부파일용 전체 HTML 생성
|
|
|
|
|
*/
|
|
|
|
|
private String buildOrderFormFileHtml(Map orderInfo, List<Map> itemList){
|
|
|
|
|
StringBuilder html = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
String contractNo = CommonUtils.checkNull(orderInfo.get("CONTRACT_NO"));
|
|
|
|
|
String orderDate = CommonUtils.checkNull(orderInfo.get("ORDER_DATE"));
|
|
|
|
|
String clientNm = CommonUtils.checkNull(orderInfo.get("CLIENT_NM"));
|
|
|
|
|
String clientBusRegNo = CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_REG_NO"));
|
|
|
|
|
String clientCeoNm = CommonUtils.checkNull(orderInfo.get("CLIENT_CEO_NM"));
|
|
|
|
|
String clientAddr = CommonUtils.checkNull(orderInfo.get("CLIENT_ADDR"));
|
|
|
|
|
String clientBusType = CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_TYPE"));
|
|
|
|
|
String clientBusItem = CommonUtils.checkNull(orderInfo.get("CLIENT_BUS_ITEM"));
|
|
|
|
|
String clientTelNo = CommonUtils.checkNull(orderInfo.get("CLIENT_TEL_NO"));
|
|
|
|
|
String clientFaxNo = CommonUtils.checkNull(orderInfo.get("CLIENT_FAX_NO"));
|
|
|
|
|
String writerName = CommonUtils.checkNull(orderInfo.get("WRITER_NAME"));
|
|
|
|
|
String supplyPrice = CommonUtils.checkNull(orderInfo.get("ORDER_SUPPLY_PRICE"));
|
|
|
|
|
String vat = CommonUtils.checkNull(orderInfo.get("ORDER_VAT"));
|
|
|
|
|
String totalAmount = CommonUtils.checkNull(orderInfo.get("ORDER_TOTAL_AMOUNT"));
|
|
|
|
|
String vatNote = CommonUtils.checkNull(orderInfo.get("VAT_NOTE"));
|
|
|
|
|
String regDatetime = CommonUtils.checkNull(orderInfo.get("REG_DATETIME"));
|
|
|
|
|
|
|
|
|
|
html.append("<!DOCTYPE html><html><head><meta charset='UTF-8'>");
|
|
|
|
|
html.append("<title>주문서 - ").append(contractNo).append("</title>");
|
|
|
|
|
html.append("<style>");
|
|
|
|
|
html.append("body { font-family: '맑은 고딕', sans-serif; font-size: 12px; margin: 20px 40px; }");
|
|
|
|
|
html.append(".title { text-align: center; font-size: 26px; font-weight: bold; letter-spacing: 18px; margin-bottom: 10px; }");
|
|
|
|
|
html.append(".header { font-size: 12px; margin-bottom: 8px; }");
|
|
|
|
|
html.append("table { width: 100%; border-collapse: collapse; margin-bottom: 5px; }");
|
|
|
|
|
html.append("th, td { border: 1px solid #000; padding: 3px 6px; font-size: 11px; }");
|
|
|
|
|
html.append("th { background-color: #f0f0f0; text-align: center; font-weight: bold; }");
|
|
|
|
|
html.append(".center { text-align: center; }");
|
|
|
|
|
html.append(".right { text-align: right; }");
|
|
|
|
|
html.append(".total-row td { background-color: #ffffcc; font-weight: bold; }");
|
|
|
|
|
html.append(".vl { writing-mode: vertical-rl; letter-spacing: 3px; width: 25px; text-align: center; font-weight: bold; background-color: #f0f0f0; }");
|
|
|
|
|
html.append("</style></head><body>");
|
|
|
|
|
|
|
|
|
|
html.append("<div class='title'>주 문 서</div>");
|
|
|
|
|
String poNo = CommonUtils.checkNull(orderInfo.get("PO_NO"));
|
|
|
|
|
html.append("<div class='header'>주문일자 : ").append(orderDate).append("</div>");
|
|
|
|
|
html.append("<div class='header'>증빙번호 : ").append(poNo).append("</div>");
|
|
|
|
|
|
|
|
|
|
// 공급받는자/공급자
|
|
|
|
|
html.append("<table>");
|
|
|
|
|
html.append("<tr><td class='vl' rowspan='4'>공<br/>급<br/>받<br/>는<br/>자</td>");
|
|
|
|
|
html.append("<th style='width:55px;'>등록번호</th><td colspan='2'>").append(clientBusRegNo).append("</td>");
|
|
|
|
|
html.append("<td class='vl' rowspan='4'>공<br/>급<br/>자</td>");
|
|
|
|
|
html.append("<th style='width:55px;'>등록번호</th><td colspan='2'>314-81-75146</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><th>상 호</th><td>").append(clientNm).append("</td><th style='width:40px;'>성명</th><td>").append(clientCeoNm).append("</td>");
|
|
|
|
|
html.append("<th>상 호</th><td>주식회사알피에스본사</td><th style='width:40px;'>성명</th><td>이동헌</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><th>주 소</th><td colspan='2'>").append(clientAddr).append("</td>");
|
|
|
|
|
html.append("<th>주 소</th><td colspan='2'>대전광역시 유성구 국제과학10로 8(둔곡동)</td></tr>");
|
|
|
|
|
|
|
|
|
|
html.append("<tr><th>업 태</th><td>").append(clientBusType).append("</td><th style='width:40px;'>종목</th><td>").append(clientBusItem).append("</td>");
|
|
|
|
|
html.append("<th>업 태</th><td>제조업</td><th style='width:40px;'>종목</th><td>금속절삭가공기계,반도체제조용기계</td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
// 납품처/담당자
|
|
|
|
|
html.append("<table>");
|
|
|
|
|
html.append("<tr><th style='width:70px;'>납 품 처</th><td>").append(clientNm).append("</td>");
|
|
|
|
|
html.append("<th style='width:70px;'>전화번호</th><td>").append(clientTelNo).append("</td>");
|
|
|
|
|
html.append("<th style='width:70px;'>팩스번호</th><td>").append(clientFaxNo).append("</td></tr>");
|
|
|
|
|
html.append("<tr><th>주 소</th><td>").append(clientAddr).append("</td>");
|
|
|
|
|
html.append("<th>담 당 자</th><td>").append(writerName).append("</td>");
|
|
|
|
|
html.append("<th>C.P.번호</th><td></td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
// 품목
|
|
|
|
|
html.append("<table>");
|
|
|
|
|
html.append("<tr><th style='width:30px;'>No.</th><th style='width:90px;'>품번</th><th>품명</th><th>규격</th>");
|
|
|
|
|
html.append("<th style='width:40px;'>단위</th><th style='width:75px;'>납기일</th>");
|
|
|
|
|
html.append("<th style='width:50px;'>수량</th><th style='width:70px;'>단가</th><th style='width:80px;'>금액</th></tr>");
|
|
|
|
|
|
|
|
|
|
int totalQty = 0;
|
|
|
|
|
if(itemList != null){
|
|
|
|
|
for(int i = 0; i < itemList.size(); i++){
|
|
|
|
|
Map item = CommonUtils.toUpperCaseMapKey(itemList.get(i));
|
|
|
|
|
int qty = 0;
|
|
|
|
|
try { qty = Integer.parseInt(CommonUtils.checkNull(item.get("ORDER_QUANTITY"), "0")); } catch(Exception e){}
|
|
|
|
|
totalQty += qty;
|
|
|
|
|
|
|
|
|
|
html.append("<tr>");
|
|
|
|
|
html.append("<td class='center'>").append(i + 1).append("</td>");
|
|
|
|
|
html.append("<td class='center'>").append(CommonUtils.checkNull(item.get("PART_NO"))).append("</td>");
|
|
|
|
|
html.append("<td>").append(CommonUtils.checkNull(item.get("PART_NAME"))).append("</td>");
|
|
|
|
|
html.append("<td>").append(CommonUtils.checkNull(item.get("SPEC"))).append("</td>");
|
|
|
|
|
html.append("<td class='center'>").append(CommonUtils.checkNull(item.get("UNIT_NAME"))).append("</td>");
|
|
|
|
|
html.append("<td class='center'>").append(CommonUtils.checkNull(item.get("DUE_DATE"))).append("</td>");
|
|
|
|
|
html.append("<td class='right'>").append(formatNumber(qty)).append("</td>");
|
|
|
|
|
html.append("<td class='right'>").append(formatNumber(CommonUtils.checkNull(item.get("ORDER_UNIT_PRICE")))).append("</td>");
|
|
|
|
|
html.append("<td class='right'>").append(formatNumber(CommonUtils.checkNull(item.get("ORDER_SUPPLY_PRICE")))).append("</td>");
|
|
|
|
|
html.append("</tr>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.append("<tr class='total-row'><td colspan='6' class='center'>합 계</td>");
|
|
|
|
|
html.append("<td class='right'>").append(formatNumber(totalQty)).append("</td><td></td>");
|
|
|
|
|
html.append("<td class='right'>").append(formatNumber(supplyPrice)).append("</td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
// 비고
|
|
|
|
|
html.append("<table>");
|
|
|
|
|
html.append("<tr><td class='vl' rowspan='3'>비<br/>고</td>");
|
|
|
|
|
html.append("<th style='width:100px;'>공급가액 합계</th><td class='right' style='width:140px;'>").append(formatNumber(supplyPrice)).append("</td>");
|
|
|
|
|
html.append("<td rowspan='3' class='center'>").append(vatNote).append("</td>");
|
|
|
|
|
html.append("<td rowspan='3' style='text-align:right; vertical-align:bottom; font-size:10px;'>").append(regDatetime).append("</td></tr>");
|
|
|
|
|
html.append("<tr><th>부 가 가 치 세</th><td class='right'>").append(formatNumber(vat)).append("</td></tr>");
|
|
|
|
|
html.append("<tr><th>총 계</th><td class='right' style='font-weight:bold;'>").append(formatNumber(totalAmount)).append("</td></tr>");
|
|
|
|
|
html.append("</table>");
|
|
|
|
|
|
|
|
|
|
html.append("</body></html>");
|
|
|
|
|
|
|
|
|
|
return html.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String uploadEstimateFilesToOneChamber(
|
|
|
|
|
com.pms.api.AmaranthApprovalApiClient apiClient,
|
|
|
|
|
String empSeq, String targetObjId) throws Exception {
|
|
|
|
|
@@ -2503,6 +2862,8 @@ public class ApprovalService {
|
|
|
|
|
System.out.println("구매요청 상태 변경 - targetObjId: " + targetObjId + " → " + proposalStatus);
|
|
|
|
|
} else if("CONTRACT_ESTIMATE".equals(targetType)){
|
|
|
|
|
System.out.println("견적서 결재 상태 변경 - targetObjId: " + targetObjId + " → " + internalStatus);
|
|
|
|
|
} else if("CONTRACT_ORDER".equals(targetType)){
|
|
|
|
|
System.out.println("주문서 결재 상태 변경 - targetObjId: " + targetObjId + " → " + internalStatus);
|
|
|
|
|
} else if("ECR".equals(targetType)){
|
|
|
|
|
System.out.println("ECR 콜백 처리 - targetObjId: " + targetObjId + " (AMARANTH_APPROVAL 상태만 관리)");
|
|
|
|
|
}
|
|
|
|
|
@@ -2627,6 +2988,21 @@ public class ApprovalService {
|
|
|
|
|
title = "견적서 결재 - " + estimateNo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if("CONTRACT_ORDER".equals(targetType) && !targetObjId.isEmpty()){
|
|
|
|
|
Map<String, Object> orderParam = new HashMap();
|
|
|
|
|
orderParam.put("targetObjId", targetObjId);
|
|
|
|
|
Map<String, Object> orderInfo = sqlSession.selectOne("approval.getOrderInfoForApproval", orderParam);
|
|
|
|
|
|
|
|
|
|
if(orderInfo != null){
|
|
|
|
|
orderInfo = CommonUtils.toUpperCaseMapKey(orderInfo);
|
|
|
|
|
List<Map> itemList = sqlSession.selectList("approval.getOrderItemsForApproval", orderParam);
|
|
|
|
|
contentsHtml = buildOrderContentsHtml(orderInfo, itemList);
|
|
|
|
|
|
|
|
|
|
String contractNo = CommonUtils.checkNull(orderInfo.get("CONTRACT_NO"));
|
|
|
|
|
if(!contractNo.isEmpty()){
|
|
|
|
|
title = "주문서 결재 - " + contractNo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if("ECR".equals(targetType) && !targetObjId.isEmpty()){
|
|
|
|
|
Map<String, Object> ecrParam = new HashMap();
|
|
|
|
|
try {
|
|
|
|
|
|