diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp index 9e0b650..793814a 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateAndOrderRegistFormPopup.jsp @@ -366,12 +366,19 @@ var orderQuantity = $row.find(".item-order-quantity").val().replace(/,/g, "").trim(); var orderUnitPrice = $row.find(".item-order-unit-price").val().replace(/,/g, "").trim(); + var product = $row.find(".item-product").val(); + if(!product || product == "") { + alert((i+1) + "번째 품목의 제품구분을 선택해주세요."); + $row.find(".item-product").focus(); + return false; + } + if(!partObjId || partObjId == "") { alert((i+1) + "번째 품목의 품번을 선택해주세요."); $row.find(".item-part-no-select").focus(); return false; } - + if(orderQuantity == "" || orderQuantity == "0") { alert((i+1) + "번째 품목의 수주수량을 입력해주세요."); $row.find(".item-order-quantity").focus(); @@ -405,6 +412,7 @@ var item = { objId: $row.find(".item-objid").val() || '', + product: $row.find(".item-product").val(), partObjId: $row.find(".item-part-objid").val(), partNo: $row.find(".item-part-no").val() ? $row.find(".item-part-no").val().trim() : "", partName: $row.find(".item-part-name").val() ? $row.find(".item-part-name").val().trim() : "", @@ -448,7 +456,14 @@ var html = ''; html += '' + (itemCounter-1) + ''; - + + // 제품구분 드롭다운 + html += ''; + html += ''; + html += ''; + // 품번 셀렉트박스 html += ''; html += ''; + html += ''; + html += ''; + html += ''; + // 품번 셀렉트박스 html += ''; html += ''; + html += ''; + html += ''; + html += ''; + html += ''; html += ''; html += ''; @@ -744,7 +841,11 @@ // 품번/품명 옵션 채우기 fn_fillPartOptions(itemId, savedPartObjId, savedPartNo, savedPartName); - + + // 제품구분 드롭다운 초기화 + fnc_getCodeListAppend("0000001", "PRODUCT_" + itemId, savedProduct); + $("#PRODUCT_" + itemId).select2({ width: '100%' }); + // datepicker 적용 $("#" + itemId + " .date_icon").datepicker({ changeMonth: true, @@ -1534,13 +1635,11 @@ - + - + - - - + @@ -1552,13 +1651,14 @@ ${code_map.category_cd} - + <%-- 제품구분: 품목정보 그리드로 이동 --%> + <%-- + --%>
- - - - - - - + + + + + + + - - + + - + + @@ -1667,14 +1769,14 @@ - - + diff --git a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp index 6f0c41b..2aaac3c 100644 --- a/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp +++ b/WebContent/WEB-INF/view/contractMgmt/estimateRegistFormPopup.jsp @@ -477,7 +477,7 @@ message = "등록"; } if (confirm(message + "하시겠습니까?")) { - $("#category_cd,#area_cd,#target_project_no,#customer_objid,#product,#contract_result,#overhaul_order").prop("disabled",""); + $("#category_cd,#area_cd,#target_project_no,#customer_objid,#contract_result,#overhaul_order").prop("disabled",""); // 저장 직전 S/N 확인 console.log("=== 저장 시작 ==="); @@ -533,9 +533,16 @@ for(var i = 0; i < itemRows.length; i++) { var $row = $(itemRows[i]); + var product = $row.find(".item-product").val(); var partObjId = $row.find(".item-part-objid").val(); // hidden 필드에서 가져오기 var quantity = $row.find(".item-quantity").val().replace(/,/g, "").trim(); - + + if(!product || product == "") { + alert((i+1) + "번째 품목의 제품구분을 선택해주세요."); + $row.find(".item-product").focus(); + return false; + } + if(!partObjId || partObjId == "") { alert((i+1) + "번째 품목의 품번을 선택해주세요."); $row.find(".item-part-no-select").focus(); @@ -575,6 +582,7 @@ var item = { objId: $row.find(".item-objid").val(), // 기존 품목 OBJID (수정 시 유지) + product: $row.find(".item-product").val(), partObjId: $row.find(".item-part-objid").val(), partNo: $row.find(".item-part-no").val() ? $row.find(".item-part-no").val().trim() : "", partName: $row.find(".item-part-name").val() ? $row.find(".item-part-name").val().trim() : "", @@ -638,6 +646,7 @@ var savedPartObjId = "<%= item.get("PART_OBJID") != null ? item.get("PART_OBJID") : (item.get("part_objid") != null ? item.get("part_objid") : "") %>"; var savedPartNo = "<%= item.get("PART_NO") != null ? item.get("PART_NO") : (item.get("part_no") != null ? item.get("part_no") : "") %>"; var savedPartName = "<%= item.get("PART_NAME") != null ? item.get("PART_NAME") : (item.get("part_name") != null ? item.get("part_name") : "") %>"; + var savedProduct = "<%= CommonUtils.checkNull(item.get("PRODUCT") != null ? item.get("PRODUCT") : (item.get("product") != null ? item.get("product") : "")) %>"; // JSON 데이터를 안전하게 전달 var snJsonData = <%= snListJson %>; @@ -645,7 +654,14 @@ var html = ''; html += ''; - + + // 제품구분 드롭다운 + html += ''; + // 품번 셀렉트박스 html += ''; html += ''; - + + // 제품구분 드롭다운 + html += ''; + // 품번 셀렉트박스 html += '
No제품구분 * 품번 * 품명 * S/N
+ 품목 추가 버튼을 클릭하여 품목을 등록하세요.
TotalTotal 0 0.00
' + (itemCounter-1) + ''; + html += ''; + html += ''; html += '
' + (itemCounter-1) + ''; + html += ''; + html += ''; html += '- + - + - - - + - + + <%-- 제품구분을 품목정보로 이동 + --%>
@@ -2126,6 +2208,7 @@ ${code_map.category_cd} - - - + + + + - - - + + + + @@ -2239,7 +2325,7 @@ - diff --git a/src/com/pms/salesmgmt/mapper/contractMgmt.xml b/src/com/pms/salesmgmt/mapper/contractMgmt.xml index 7cebd44..1ff5dc1 100644 --- a/src/com/pms/salesmgmt/mapper/contractMgmt.xml +++ b/src/com/pms/salesmgmt/mapper/contractMgmt.xml @@ -1370,7 +1370,7 @@ OBJID ,CATEGORY_CD ,CUSTOMER_OBJID - ,PRODUCT + /* ,PRODUCT -- 제품구분을 품목(CONTRACT_ITEM)으로 이동 */ ,CUSTOMER_PROJECT_NAME ,STATUS_CD ,DUE_DATE @@ -1431,7 +1431,7 @@ #{objId} ,#{category_cd} ,#{customer_objid} - ,#{product} + ,#{customer_project_name} ,#{status_cd} ,#{due_date} @@ -1492,7 +1492,7 @@ SET CATEGORY_CD = #{category_cd} ,CUSTOMER_OBJID = #{customer_objid} - ,PRODUCT = #{product} + ,CUSTOMER_PROJECT_NAME = #{customer_project_name} ,STATUS_CD = #{status_cd} ,DUE_DATE = #{due_date} @@ -1660,7 +1660,7 @@ SET CATEGORY_CD = #{category_cd} ,CUSTOMER_OBJID = #{customer_objid} - ,PRODUCT = #{product} + ,CUSTOMER_PROJECT_NAME = #{customer_project_name} ,STATUS_CD = #{status_cd} ,DUE_DATE = #{due_date} @@ -5152,7 +5152,7 @@ WHERE OBJID, CATEGORY_CD, CUSTOMER_OBJID, - PRODUCT, + /* PRODUCT, -- 제품구분을 품목(CONTRACT_ITEM)으로 이동 */ AREA_CD, CUSTOMER_EQUIP_NAME, CUSTOMER_PROJECT_NAME, @@ -5176,7 +5176,7 @@ WHERE #{objId}, #{category_cd}, #{customer_objid}, - #{product}, + #{area_cd}, #{customer_equip_name}, #{customer_project_name}, @@ -5200,7 +5200,7 @@ WHERE SET CATEGORY_CD = #{category_cd}, CUSTOMER_OBJID = #{customer_objid}, - PRODUCT = #{product}, + AREA_CD = #{area_cd}, CUSTOMER_EQUIP_NAME = #{customer_equip_name}, CUSTOMER_PROJECT_NAME = #{customer_project_name}, @@ -5247,7 +5247,8 @@ WHERE CI.ORDER_SUPPLY_PRICE, CI.ORDER_VAT, CI.ORDER_TOTAL_AMOUNT, - CI.CANCEL_QTY + CI.CANCEL_QTY, + CI.PRODUCT FROM CONTRACT_ITEM CI LEFT JOIN PART_MNG PM ON CI.PART_OBJID = PM.OBJID @@ -5273,7 +5274,8 @@ WHERE CI.ORDER_SUPPLY_PRICE, CI.ORDER_VAT, CI.ORDER_TOTAL_AMOUNT, - CI.CANCEL_QTY + CI.CANCEL_QTY, + CI.PRODUCT ORDER BY CI.SEQ @@ -5370,7 +5372,8 @@ WHERE RETURN_REASON, REGDATE, WRITER, - STATUS + STATUS, + PRODUCT ) VALUES ( #{objId}, #{contractObjId}, @@ -5384,7 +5387,8 @@ WHERE #{returnReason}, NOW(), #{writer}, - 'ACTIVE' + 'ACTIVE', + #{product} ) @@ -5408,7 +5412,8 @@ WHERE ORDER_UNIT_PRICE, ORDER_SUPPLY_PRICE, ORDER_VAT, - ORDER_TOTAL_AMOUNT + ORDER_TOTAL_AMOUNT, + PRODUCT ) VALUES ( #{objId}, #{contractObjId}, @@ -5427,7 +5432,8 @@ WHERE #{orderUnitPrice}, #{orderSupplyPrice}, #{orderVat}, - #{orderTotalAmount} + #{orderTotalAmount}, + #{product} ) @@ -5472,9 +5478,10 @@ WHERE CI.ORDER_SUPPLY_PRICE, CI.ORDER_VAT, CI.ORDER_TOTAL_AMOUNT, + CI.PRODUCT, STRING_AGG(CIS.SERIAL_NO, ', ' ORDER BY CIS.SEQ) AS SERIAL_NOS, COUNT(CIS.OBJID) AS SERIAL_COUNT - FROM + FROM CONTRACT_ITEM CI LEFT JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID @@ -5503,8 +5510,9 @@ WHERE CI.ORDER_UNIT_PRICE, CI.ORDER_SUPPLY_PRICE, CI.ORDER_VAT, - CI.ORDER_TOTAL_AMOUNT - ORDER BY + CI.ORDER_TOTAL_AMOUNT, + CI.PRODUCT + ORDER BY CI.SEQ @@ -5726,7 +5734,8 @@ WHERE RETURN_REASON, REGDATE, WRITER, - STATUS + STATUS, + PRODUCT ) VALUES ( #{objId}, #{contractObjId}, @@ -5740,7 +5749,8 @@ WHERE #{returnReason}, NOW(), #{writer}, - 'ACTIVE' + 'ACTIVE', + #{product} ) ON CONFLICT (OBJID) DO UPDATE SET @@ -5754,7 +5764,8 @@ WHERE RETURN_REASON = #{returnReason}, CHGDATE = NOW(), CHG_USER_ID = #{writer}, - STATUS = 'ACTIVE' + STATUS = 'ACTIVE', + PRODUCT = #{product} @@ -5777,7 +5788,8 @@ WHERE ORDER_UNIT_PRICE, ORDER_SUPPLY_PRICE, ORDER_VAT, - ORDER_TOTAL_AMOUNT + ORDER_TOTAL_AMOUNT, + PRODUCT ) VALUES ( #{objId}, #{contractObjId}, @@ -5796,7 +5808,8 @@ WHERE #{orderUnitPrice}, #{orderSupplyPrice}, #{orderVat}, - #{orderTotalAmount} + #{orderTotalAmount}, + #{product} ) ON CONFLICT (OBJID) DO UPDATE SET @@ -5815,7 +5828,8 @@ WHERE ORDER_UNIT_PRICE = #{orderUnitPrice}, ORDER_SUPPLY_PRICE = #{orderSupplyPrice}, ORDER_VAT = #{orderVat}, - ORDER_TOTAL_AMOUNT = #{orderTotalAmount} + ORDER_TOTAL_AMOUNT = #{orderTotalAmount}, + PRODUCT = #{product} diff --git a/src/com/pms/salesmgmt/service/ContractMgmtService.java b/src/com/pms/salesmgmt/service/ContractMgmtService.java index b993aa8..5945002 100644 --- a/src/com/pms/salesmgmt/service/ContractMgmtService.java +++ b/src/com/pms/salesmgmt/service/ContractMgmtService.java @@ -2729,7 +2729,8 @@ private String encodeImageToBase64(String imagePath) { itemMap.put("dueDate", item.get("dueDate") != null ? item.get("dueDate").toString() : ""); itemMap.put("customerRequest", item.get("customerRequest") != null ? item.get("customerRequest").toString() : ""); itemMap.put("returnReason", item.get("returnReason") != null ? item.get("returnReason").toString() : ""); - + itemMap.put("product", item.get("product") != null ? item.get("product").toString() : ""); + // 수주 정보 String orderQuantity = item.get("orderQuantity") != null ? item.get("orderQuantity").toString().replace(",", "") : "0"; String orderUnitPrice = item.get("orderUnitPrice") != null ? item.get("orderUnitPrice").toString().replace(",", "") : "0"; @@ -3178,6 +3179,7 @@ private String encodeImageToBase64(String imagePath) { itemParam.put("dueDate", item.get("dueDate")); itemParam.put("customerRequest", item.get("customerRequest")); itemParam.put("returnReason", item.get("returnReason")); + itemParam.put("product", item.get("product")); itemParam.put("writer", userId); System.out.println("품목 UPSERT 시도 - OBJID: " + itemObjId);
No제품구분 * 품번 * 품명 * S/N
+ 품목 추가 버튼을 클릭하여 품목을 등록하세요.