diff --git a/WebContent/WEB-INF/view/salesMng/salesRequestFormPopUp.jsp b/WebContent/WEB-INF/view/salesMng/salesRequestFormPopUp.jsp
index 1a85f5c..fb5ae39 100644
--- a/WebContent/WEB-INF/view/salesMng/salesRequestFormPopUp.jsp
+++ b/WebContent/WEB-INF/view/salesMng/salesRequestFormPopUp.jsp
@@ -100,16 +100,17 @@ $(function(){
//상신된 결재라인 가져오기
fn_getApprLine();
- fnc_getAjaxProductMgmtList("PRODUCT_CODE", "", "", "${resultMap.PRODUCT_CODE}");
+ fnc_getAjaxProductMgmtList("PRODUCT_CODE", "", "", "${resultMap.PRODUCT_CODE}");
fnc_getUserList2("SALES_MNG_USER_ID", "${resultMap.SALES_MNG_USER_ID}");
fnc_getCodeListAppend("0000259","REQUEST_STATUS","${resultMap.REQUEST_STATUS}");
- fn_UnitCodeList("${resultMap.PROJECT_NO}", "UNIT_NAME", "${resultMap.UNIT_NAME}","");
+ // 유닛 관련 주석처리
+ // fn_UnitCodeList("${resultMap.PROJECT_NO}", "UNIT_NAME", "${resultMap.UNIT_NAME}","");
fnc_datepick();
$(".select2").select2();
- fn_getSalesRequestTargetPartList("${resultMap.OBJID}","${param.bom_report_objid}");
-
+ fn_getSalesRequestTargetPartList("${resultMap.OBJID}","${param.bom_report_objid}");
+
$("#ORDER_NUMBER").change(function(){
var orderQty = fnc_checkNull($(this).val());
@@ -129,38 +130,63 @@ $(function(){
<% if(isModify){ %>
//수정가능
-$("#REQUEST_CD,#PROJECT_NO,#CUSTOMER_NAME,#PRODUCT_NAME,#MECHANICAL_TYPE,#PROJECT_NAME,#SETUP,#RELEASE_DATE,#REQUEST_REASONS,#REQUEST_USER_ID,#DELIVERY_REQUEST_DATE,#UNIT_NAME").prop("disabled","");
+$("#REQUEST_CD,#PROJECT_NO,#CUSTOMER_NAME,#PRODUCT_NAME,#MECHANICAL_TYPE,#PROJECT_NAME,#SETUP,#RELEASE_DATE,#REQUEST_REASONS,#REQUEST_USER_ID,#DELIVERY_REQUEST_DATE,#PURCHASE_TYPE,#PURCHASE_TYPE2,#ORDER_TYPE,#AREA_CD,#CUSTOMER_OBJID,#PAID_TYPE").prop("disabled","");
- //프로젝트명 변경시 유닛명 셋팅
+ //프로젝트명 변경시 정보 셋팅 (유닛명 제거)
$("#PROJECT_NO").change(function(){
- $("#CUSTOMER_NAME, #PRODUCT_NAME, #MECHANICAL_TYPE, #PROJECT_NAME, #SETUP, #RELEASE_DATE, #UNIT_NAME").val("");
+ $("#CUSTOMER_NAME, #PRODUCT_NAME, #MECHANICAL_TYPE, #PROJECT_NAME, #SETUP, #RELEASE_DATE").val("");
+ $("#partListArea").empty(); // 기존 품번 목록 초기화
+
if($(this).val()!=""){
//프로젝트번호로 지정된 정보를 가져온다
var list = fnc_getJsonAllDataListBySqlId({"sqlId":"salesMng.purchaseOrderAdminSupplyInfo", "PROJECT_NO":$(this).val()});
if(fnc_checkNull( list )!=""){
var row = list[0];
+
+ console.log("프로젝트 정보:", row); // 디버깅용
+
+ // 기존 필드 (읽기전용 텍스트)
$("#CUSTOMER_NAME" ).val( row["CUSTOMER_NAME" ] );
- $("#PRODUCT_NAME" ).val( row["PRODUCT_NAME" ] );
$("#MECHANICAL_TYPE" ).val( row["MECHANICAL_TYPE" ] );
$("#PROJECT_NAME" ).val( row["PROJECT_NAME" ] );
$("#SETUP" ).val( row["SETUP" ] );
$("#RELEASE" ).val( row["RELEASE_DATE" ] );
+
+ // 프로젝트관리 진행관리 데이터 자동 채우기 (드롭다운)
+ // 제품구분 (PRODUCT from PROJECT_MGMT) - 드롭다운
+ if(fnc_checkNull(row["PRODUCT"]) != ""){
+ $("#PRODUCT_NAME").val(row["PRODUCT"]).trigger("change");
+ console.log("제품구분 설정:", row["PRODUCT"]);
+ }
+
+ // 국내/해외 (AREA_CD from PROJECT_MGMT)
+ if(fnc_checkNull(row["AREA_CD"]) != ""){
+ $("#AREA_CD").val(row["AREA_CD"]).trigger("change");
+ console.log("국내/해외 설정:", row["AREA_CD"]);
+ }
+
+ // 고객사 (CUSTOMER_OBJID from PROJECT_MGMT)
+ if(fnc_checkNull(row["CUSTOMER_OBJID"]) != ""){
+ $("#CUSTOMER_OBJID").val(row["CUSTOMER_OBJID"]).trigger("change");
+ console.log("고객사 설정:", row["CUSTOMER_OBJID"]);
+ }
+
+ // 유/무상 (PAID_TYPE from CONTRACT_MGMT)
+ if(fnc_checkNull(row["PAID_TYPE"]) != ""){
+ $("#PAID_TYPE").val(row["PAID_TYPE"]).trigger("change");
+ console.log("유/무상 설정:", row["PAID_TYPE"]);
+ }
}
+
}
- fn_UnitCodeList(this.value, "UNIT_NAME", "","");
-
- });
-
- //프로젝트번호, 유닛명 변경시 - 구매BOM에서 등록한 PART정보를 가져온다
- $("#PROJECT_NO,#UNIT_NAME").change(function(){
- $("#partListArea").empty();
- fn_addBomPart();
});
$("#REQUEST_USER_ID").val('<%=connectUserId%>');
$(".select2").select2();
<% }else{ %>
+ $("#REQUEST_USER_ID").val('<%=connectUserId%>');
+ $(".select2").select2();
$("#btnSupplySave").click(function(){ fn_Supply_save(); }); //공급업체저장
<% } %>
});
@@ -231,38 +257,38 @@ function fn_getSalesRequestTargetPartList(masterObjId,bomObjId){
//appendText += " | ";
//appendText += " ";
//appendText += " | ";
- //appendText += " | ";
- appendText += " ";
- if(requestStatus == 'approvalComplete' || requestStatus == 'reception'){
- appendText += " ";
- }else{
- appendText += " ";
- }
- appendText += " | ";
- //appendText += " | ";
- appendText += " ";
- appendText += " ";
- appendText += " | ";
+ //appendText += " | ";
+ appendText += " ";
+ if(requestStatus == 'approvalComplete' || requestStatus == 'reception'){
+ appendText += " ";
+ }else{
+ appendText += " ";
+ }
+ appendText += " | ";
+ //appendText += " | ";
+ appendText += " ";
+ appendText += " ";
+ appendText += " | ";
//appendText += " ";
//appendText += " ";
//appendText += " | ";
- //appendText += " | ";
- appendText += " ";
- appendText += " ";
- appendText += " | ";
- //appendText += " | ";
- appendText += " ";
- appendText += " ";
- appendText += " | ";
- //appendText += " ";
- //appendText += " ";
- //appendText += " | ";
- //appendText += " ";
- //appendText += " ";
- //appendText += " | ";
- appendText += " ";
+ //appendText += " | ";
+ appendText += " ";
+ appendText += " ";
+ appendText += " | ";
+ //appendText += " | ";
+ //appendText += " ";
+ //appendText += " ";
+ //appendText += " | ";
+ //appendText += " ";
+ //appendText += " ";
+ //appendText += " | ";
+ //appendText += " ";
+ //appendText += " ";
+ //appendText += " | ";
+ appendText += " ";
//fnc_getSupplyCodeListAppend("PARTNER_OBJID_"+rowObjId, PARTNER_OBJID);
@@ -270,15 +296,16 @@ function fn_getSalesRequestTargetPartList(masterObjId,bomObjId){
});
$("#partListArea").append(appendText);
- $.each(resultData, function(i){
- var rowObjId = fnc_checkNull(resultData[i].OBJID);
- var PART_OBJID = fnc_checkNull(resultData[i].PART_OBJID);
- var PARTNER_OBJID = fnc_checkNull(resultData[i].PARTNER_OBJID);
- fnc_getAdminSupCdListAppend("", "PARTNER_OBJID_"+rowObjId, PARTNER_OBJID);
- $("#PARTNER_OBJID_"+rowObjId).val(PARTNER_OBJID);
- fn_addBomPart("PART_OBJID_"+rowObjId, PART_OBJID, "PART_NAME_"+rowObjId,"");
- });
- $(".select2").select2();
+ $.each(resultData, function(i){
+ var rowObjId = fnc_checkNull(resultData[i].OBJID);
+ var PART_OBJID = fnc_checkNull(resultData[i].PART_OBJID);
+ // 공급업체 제거로 주석처리
+ // var PARTNER_OBJID = fnc_checkNull(resultData[i].PARTNER_OBJID);
+ // fnc_getAdminSupCdListAppend("", "PARTNER_OBJID_"+rowObjId, PARTNER_OBJID);
+ // $("#PARTNER_OBJID_"+rowObjId).val(PARTNER_OBJID);
+ fn_addBomPart("PART_OBJID_"+rowObjId, PART_OBJID, "PART_NAME_"+rowObjId,"");
+ });
+ $(".select2").select2();
},
error: function(jqxhr, status, error){
}
@@ -292,10 +319,11 @@ function fn_getSalesRequestTargetPartList(masterObjId,bomObjId){
/* 물품구매요청서 Row 추가 */
function fn_AddRow(){
- if($("#UNIT_NAME").val() == '' || $("#UNIT_NAME").val() == null){
- Swal.fire("유닛명을 먼저 선택해주세요");
- return false;
- }
+ // 유닛명 체크 제거 - 필수 아님
+ // if($("#UNIT_NAME").val() == '' || $("#UNIT_NAME").val() == null){
+ // Swal.fire("유닛명을 먼저 선택해주세요");
+ // return false;
+ // }
var rowObjId = fnc_createObjId();
var appendText = "";
@@ -310,12 +338,12 @@ function fn_AddRow(){
//appendText += " ";
//appendText += " | ";
appendText += " ";
- appendText += " | ";
//appendText += " | ";
- appendText += " ";
- appendText += " ";
+ appendText += " | ";
+ appendText += " ";
appendText += " | ";
//appendText += " ";
//appendText += " ";
@@ -325,10 +353,10 @@ function fn_AddRow(){
appendText += " ";
appendText += " | ";
//appendText += " | ";
- appendText += " ";
- appendText += " ";
- appendText += " ";
- appendText += " | ";
+ //appendText += " ";
+ //appendText += " ";
+ //appendText += " ";
+ //appendText += " | ";
//appendText += " ";
//appendText += " ";
//appendText += " | ";
@@ -337,16 +365,17 @@ function fn_AddRow(){
//appendText += " ";
appendText += " ";
- if(0 < $("#partListArea tr:first").lenght || typeof $("#partListArea tr:first").lenght != "undefined") {
- $("#partListArea tr:first").before(appendText);
- }else{
- $("#partListArea").append(appendText);
- }
- fnc_getAdminSupCdListAppend("", "PARTNER_OBJID_"+rowObjId, "");
- fn_addBomPart("PART_OBJID_"+rowObjId, "", "PART_NAME_"+rowObjId, "PARTNER_OBJID_"+rowObjId);
- fnc_datepick();
- $(".select2").select2();
-}
+ if(0 < $("#partListArea tr:first").lenght || typeof $("#partListArea tr:first").lenght != "undefined") {
+ $("#partListArea tr:first").before(appendText);
+ }else{
+ $("#partListArea").append(appendText);
+ }
+ // 공급업체 제거로 주석처리
+ // fnc_getAdminSupCdListAppend("", "PARTNER_OBJID_"+rowObjId, "");
+ fn_addBomPart("PART_OBJID_"+rowObjId, "", "PART_NAME_"+rowObjId, "");
+ fnc_datepick();
+ $(".select2").select2();
+}
/* Row 삭제 */
function fn_deleteRow(){
@@ -451,14 +480,17 @@ function fn_addBomPart(selectboxId,selectedVal,sql_id,sql_supply){
//console.log('type:'+type + ' contract_mgmt_objid:'+contract_mgmt_objid + ' unit_code:'+unit_code + ' partner_objid:'+partner_objid);
- //프로젝트명, 유닛명이 선택되어있으면
- if(fnc_checkNull(project_objid)!="" && fnc_checkNull(unit_code)!=""){
+ //프로젝트번호만 있으면 품번 조회 가능 (유닛명은 선택사항)
+ if(fnc_checkNull(project_objid)!=""){
$("#"+selectboxId).empty();
$("#"+selectboxId).append("");
//구매BOM 조회해서 부품정보를 가져온다
- var resultList = fnc_getJsonAllDataListBySqlId({"sqlId":"salesMng.SalesBomPartListByProjectUnit"
- , "PROJECT_OBJID":project_objid
- , "UNIT_CODE":unit_code });
+ var paramData = {"sqlId":"salesMng.SalesBomPartListByProjectUnit", "PROJECT_OBJID":project_objid};
+ // 유닛명이 있으면 추가
+ if(fnc_checkNull(unit_code)!=""){
+ paramData.UNIT_CODE = unit_code;
+ }
+ var resultList = fnc_getJsonAllDataListBySqlId(paramData);
if(0 < resultList.length){
for (var i = 0; i < resultList.length; i++) {
var commonCodeId = resultList[i].PART_OBJID;
@@ -514,78 +546,79 @@ function fn_callbackFnc(){
-
- |
-
-
- ${code_map.purchase_type}
-
- |
- |
-
-
- ${code_map.project_no}
-
- |
- |
-
-
- ${code_map.purchase_type}
-
- |
- |
-
-
- ${code_map.order_type}
-
- |
-
-
- |
-
-
- ${code_map.product_name}
-
- |
- |
-
-
- ${code_map.area_cd}
-
- |
- |
-
-
-
- ${code_map.area_cd}
-
- |
- |
-
-
- ${code_map.payment_type}
-
- |
-
-
- |
-
-
- |
-
+
+ |
+
+
+ ${code_map.purchase_type}
+
+ |
+ |
+
+
+ ${code_map.project_no}
+
+ |
+ |
+
+
+ ${code_map.purchase_type}
+
+ |
+ |
+
+
+ ${code_map.order_type}
+
+ |
+
+
+ |
+
+
+ ${code_map.product_name}
+
+ |
+ |
+
+
+ ${code_map.area_cd}
+
+ |
+ |
+
+
+
+ ${code_map.customer_objid}
+
+ |
+ |
+
+
+ ${code_map.paid_type}
+
+ |
+
+
+ |
+
+
+
+ |
+
@@ -606,7 +639,6 @@ function fn_callbackFnc(){
-
@@ -614,7 +646,6 @@ function fn_callbackFnc(){
| 품번 |
품명 |
수량 |
-
@@ -626,7 +657,6 @@ function fn_callbackFnc(){
-
diff --git a/WebContent/WEB-INF/view/salesMng/salesRequestMngRegList.jsp b/WebContent/WEB-INF/view/salesMng/salesRequestMngRegList.jsp
index 169d1bb..9394bd4 100644
--- a/WebContent/WEB-INF/view/salesMng/salesRequestMngRegList.jsp
+++ b/WebContent/WEB-INF/view/salesMng/salesRequestMngRegList.jsp
@@ -207,34 +207,33 @@ var columns = [
{title:'APPROVAL_OBJID' , field:'APPROVAL_OBJID' ,visible:false},
{title:'ROUTE_OBJID' , field:'ROUTE_OBJID' ,visible:false}
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "요청번호", field :"REQUEST_MNG_NO" , width:110,
- formatter: fnc_createGridAnchorTag,
- cellClick : function(e, cell) {
- fn_openSalesRequestPopUp(cell.getData().OBJID);
- }
- }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "요청구분", field :"REQUEST_CD_NAME" , width:80 }
- ,{headerHozAlign : 'center', hozAlign : 'left' , title : "프로젝트번호", field :"PROJECT_NUMBER" , width:100 }
- ,{headerHozAlign : 'center', hozAlign : 'left' , title : "프로젝트명", field :"PROJECT_NAME" , width:150}
- ,{headerHozAlign : 'center', hozAlign : 'left' , title : "유닛명", field :"UNIT_CODE_NAME" , width:180 }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "구매요청품 수", field :"ITEMS_QTY" , width:110 }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "총 수량", field :"TOTAL_QTY" , width:100}
- ,{headerHozAlign : 'center', hozAlign : 'left' , title : "요청사유", field :"REQUEST_REASONS_NAME" , width:100 }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "요청인", field :"REQUEST_USER_NAME" , width:110 }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "입고요청일", field :"DELIVERY_REQUEST_DATE" , width:100 }
-
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "상태", field :"STATUS_TITLE" , width:90,
- formatter: fnc_createGridApprovalAnchorTag,
- cellClick:function(e, cell){
- var targetStatus = fnc_checkNull(cell.getData().STATUS);
- if("approvalComplete" == targetStatus || "approvalRequest" == targetStatus){
- fn_approvalDetail(cell.getData().APPROVAL_OBJID, cell.getData().ROUTE_OBJID);
- }
- }
- }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "접수자", field :"RECEIPT_USER_NAME" , width:110 }
- ,{headerHozAlign : 'center', hozAlign : 'center', title : "접수일", field :"RECEIPT_DATE" , width:90 }
- ,{headerHozAlign : 'center', hozAlign : 'left' , title : "발주서NO", field :"PURCHASE_ORDER_NO_ARR" /* , width:150 */ }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "요청번호", field :"REQUEST_MNG_NO" , widthGrow:1.3,
+ formatter: fnc_createGridAnchorTag,
+ cellClick : function(e, cell) {
+ fn_openSalesRequestPopUp(cell.getData().OBJID);
+ }
+ }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "구매유형", field :"PURCHASE_TYPE_NAME" , widthGrow:1.1 }
+ ,{headerHozAlign : 'center', hozAlign : 'left' , title : "프로젝트번호", field :"PROJECT_NUMBER" , widthGrow:1.4 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "주문유형", field :"ORDER_TYPE_NAME" , widthGrow:1.1 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "제품구분", field :"PRODUCT_NAME_FULL" , widthGrow:1.1}
+ ,{headerHozAlign : 'center', hozAlign : 'left' , title : "고객사", field :"CUSTOMER_NAME" , widthGrow:1.5 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "유/무상", field :"PAID_TYPE_NAME" , widthGrow:0.9 }
+ ,{headerHozAlign : 'center', hozAlign : 'left', title : "품번", field :"PART_NO" , widthGrow:1.4}
+ ,{headerHozAlign : 'center', hozAlign : 'left' , title : "품명", field :"PART_NAME" , widthGrow:1.8 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "구매요청서", field :"REQUEST_MNG_NO" , widthGrow:1.1,
+ formatter: function(cell, formatterParams, onRendered){
+ var objid = fnc_checkNull(cell.getData().OBJID);
+ var iconClass = (objid != '' && objid != null) ? 'file_icon' : 'file_empty_icon';
+ return '';
+ },
+ cellClick : function(e, cell) {
+ fn_openSalesRequestPopUp(cell.getData().OBJID);
+ }
+ }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "요청인", field :"REQUEST_USER_NAME" , widthGrow:1.1 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "입고요청일", field :"DELIVERY_REQUEST_DATE" , widthGrow:1.1 }
+ ,{headerHozAlign : 'center', hozAlign : 'center', title : "작성일", field :"REGDATE_TITLE" , widthGrow:1.1 }
];
//var grid;
diff --git a/database/add_sales_request_master_columns.sql b/database/add_sales_request_master_columns.sql
new file mode 100644
index 0000000..0cf1bf5
--- /dev/null
+++ b/database/add_sales_request_master_columns.sql
@@ -0,0 +1,11 @@
+-- SALES_REQUEST_MASTER 테이블에 구매유형, 주문유형 컬럼 추가
+-- 이 컬럼들이 없으면 저장이 불가능합니다!
+
+ALTER TABLE SALES_REQUEST_MASTER
+ADD COLUMN IF NOT EXISTS PURCHASE_TYPE VARCHAR(50), -- 구매유형
+ADD COLUMN IF NOT EXISTS ORDER_TYPE VARCHAR(50); -- 주문유형
+
+-- 컬럼 설명
+COMMENT ON COLUMN SALES_REQUEST_MASTER.PURCHASE_TYPE IS '구매유형';
+COMMENT ON COLUMN SALES_REQUEST_MASTER.ORDER_TYPE IS '주문유형';
+
diff --git a/src/com/pms/mapper/salesMng.xml b/src/com/pms/mapper/salesMng.xml
index b585572..2547863 100644
--- a/src/com/pms/mapper/salesMng.xml
+++ b/src/com/pms/mapper/salesMng.xml
@@ -585,55 +585,73 @@