瀏覽代碼

Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-view

whakdo963 2 年之前
父節點
當前提交
932c1351c2

+ 2 - 2
src/main/webapp/app/pomng/POMNG03010.html

@@ -119,7 +119,7 @@
119 119
 										<div class="form-group">
120 120
 											<label class="col-xs-2 itp_lb">발주담당자</label>
121 121
 											<div class="col-xs-4 itp_ip fnPodrMgrNm"></div>
122
-											<label class="col-xs-2 itp_lb">배송구분111</label>
122
+											<label class="col-xs-2 itp_lb">배송구분</label>
123 123
 											<div class="col-xs-4 itp_ip">
124 124
 												<div class="col-xs-5 itp_in">
125 125
 												    <select id="ITP_FORM_POMNG03010_DETAIL_DLV_DVSN" data-select-code="DLV_DVSN" data-check-required="empty" class="form-control itp_input" name="dlvDvsn">
@@ -170,7 +170,7 @@
170 170
 					<div class="itp_form itp_type1 fix">
171 171
 						<div class="col-xs-12">
172 172
 							<form id="ITP_FORM_POMNG03010_NDETAIL" class="form-horizontal">
173
-								<input type="hidden" id="ITP_FORM_POMNG03010_DETAIL_NDETAIL_CD" name="viewCd" value="C">
173
+								<input type="hidden" id="ITP_FORM_POMNG03010_NDETAIL_VIEW_CD" name="viewCd" value="C">
174 174
 					
175 175
 								<section class="itp_form_sec">
176 176
 									<h4 class="itp_form_tit">구매발주상세-신규발주생성</h4>

+ 29 - 24
src/main/webapp/app/pomng/POMNG04010.html

@@ -6,8 +6,7 @@
6 6
 				<div class="pull-right itp_cicon">
7 7
 					<button type="button" id="ITP_BTN_POMNG04010_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;조회&nbsp;&nbsp;</button>
8 8
 					<button type="button" id="ITP_BTN_POMNG04010_MODIFY" class="btn btn-success btn-sm TSA" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;임시저장&nbsp;&nbsp;</button>
9
-					<button type="button" id="ITP_BTN_POMNG04010_NEWREG" class="btn btn-primary btn-sm RQPO" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;발주요청&nbsp;&nbsp;</button>
10
-					<button type="button" id="ITP_BTN_POMNG04010_CANCELLIST" class="btn btn-warning btn-sm CAPO"><i class="glyphicon "></i>&nbsp;&nbsp;발주취소&nbsp;&nbsp;</button>
9
+					<button type="button" id="ITP_BTN_POMNG04010_DELETE" class="btn btn-warning btn-sm CAPO"><i class="glyphicon "></i>&nbsp;&nbsp;발주취소&nbsp;&nbsp;</button>
11 10
 					<button type="button" id="ITP_BTN_POMNG04010_CANCELLIST" class="btn btn-warning btn-sm PRB"><i class="glyphicon "></i>&nbsp;&nbsp;취소/목록&nbsp;&nbsp;</button>
12 11
 				</div>
13 12
 			</div>
@@ -17,42 +16,43 @@
17 16
 						<div class="itp_srh_border fix">
18 17
 							<div class="col-xs-12">
19 18
 								<form id="ITP_FORM_POMNG04010_SEARCH" class="form-horizontal">
19
+                                <input type="hidden" id="ITP_FORM_POMNG04010_SEARCH_BRAND_ID" name="sbrandId" value="">
20 20
 									<div class="form-group">
21 21
 										<div class="col-xs-2 itp_ip itp_noMar">
22
-											<select id="ITP_FORM_POMNG04010_SEARCH_" class="form-control itp_input" name="">
23
-												<option value="A">발주일자*</option>											
24
-											</select>
22
+                                            <label>발주일자 *</label>
25 23
 										</div>										
26 24
 										<div class="col-xs-3 itp_ip itp_noMar">
27 25
 											<div class="input-daterange input-group date">
28
-												<input type="text" id="ITP_FORM_POMNG04010_SEARCH_" class="form-control itp_input" name="" value="">
26
+												<input type="text" id="ITP_FORM_POMNG04010_SEARCH_FROM_DT" class="form-control itp_input" name="fromDt" value="">
29 27
 												<span class="input-group-addon itp_date_to">~</span>
30
-												<input type="text" id="ITP_FORM_POMNG04010_SEARCH_" class="form-control itp_input" name="" value="">
28
+												<input type="text" id="ITP_FORM_POMNG04010_SEARCH_TO_DT" class="form-control itp_input" name="toDt" value="">
31 29
 											</div>
32 30
 										</div>
33 31
 										<div class="col-xs-2 itp_ip itp_noMar">
34
-											<select id="ITP_FORM_POMNG04010_SEARCH_PCH_ODR_ST_CD" class="form-control itp_input" name="spchOdrStCd">
35
-												<option value="A">발주상태</option>											
32
+											<select id="ITP_FORM_POMNG04010_SEARCH_PCH_ODR_ST_CD" data-select-code="PCH_ODR_ST_CD" class="form-control itp_input" name="spchOdrStCd">
33
+												<option value="">발주상태</option>											
36 34
 											</select>
37 35
 										</div>
38 36
 									</div>
39 37
 									<div class="form-group" style="padding-top: 10px; border-top: 1px dotted #ccc;">
40 38
 										<div class="col-xs-2 itp_ip itp_noMar">
41
-											<input type="text" id="ITP_FORM_POMNG04010_SEARCH_SPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" />
39
+											<input type="text" id="ITP_FORM_POMNG04010_DETAIL_SPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" readonly/>
40
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_SPPLY_ID" class="form-control itp_input" name="sspplyId" />
42 41
 										</div>
43 42
 										<div class="col-xs-1 itp_in" style="padding: 0px; width:8%;">
44
-											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
45
-											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
43
+											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_SPPLY_ID" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
44
+											<button type="button" id="ITP_BTN_POMNG04010_DELETE_SPPLY_ID" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
46 45
 						                </div>
47 46
 										<div class="col-xs-2 itp_ip itp_noMar">
48
-											<input type="text" id="ITP_FORM_POMNG04010_SEARCH_DLV_PLACE" class="form-control itp_input" name="sdlvPlace" placeholder="매장/창고" />
47
+											<input type="text" id="ITP_FORM_POMNG04010_DETAIL_WHS_NM" class="form-control itp_input" name="sdlvPlace" placeholder="매장/창고" readonly/>
48
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_WHS_ID" class="form-control itp_input" name="swhsId" />											
49 49
 										</div>
50 50
 										<div class="col-xs-1 itp_in" style="padding: 0px; width:10%;">
51
-											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
52
-											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
51
+											<button type="button" id="ITP_BTN_POMNG04010_SEARCH_WHS_ID" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
52
+											<button type="button" id="ITP_BTN_POMNG04010_DELETE_WHS_ID" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
53 53
 						                </div>
54 54
 										<div class="col-xs-4 itp_ip itp_noMar">
55
-											<input type="text" id="ITP_FORM_POMNG04010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="품목번호 or 품목명" />
55
+											<input type="text" id="ITP_FORM_POMNG04010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="발주번호 / 품목번호 / 품목명" />
56 56
 										</div>
57 57
 									</div>
58 58
 								</form>
@@ -73,17 +73,19 @@
73 73
 						<div class="col-xs-12">
74 74
 							<form id="ITP_FORM_POMNG04010_DETAIL" class="form-horizontal">
75 75
 								<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_VIEW_CD" name="viewCd" value="C">
76
-					
76
+								<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_STORE_ID" name="storeId" value="">
77 77
 								<section class="itp_form_sec">
78 78
 									<h4 class="itp_form_tit">구매발주상세</h4>
79 79
 									<div class="itp_form_in">	
80 80
 										<div class="form-group">
81 81
 											<label class="col-xs-2 itp_lb">브랜드 *</label>
82 82
 											<div class="col-xs-4 itp_ip fnBrandNm"></div>
83
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_BRANDID" name="brandId">
83 84
 											<label class="col-xs-2 itp_lb">발주번호/상태</label>
84 85
 											<div class="col-xs-4 itp_ip">
85 86
 												<div class="col-xs-a itp_in fnPchPodrUnqNo"></div>
86
-												<div class="col-xs-a">/</div>
87
+												<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_PCH_PODR_UNQ_NO" name="pchPodrUnqNo">
88
+												<div class="col-xs-a"> / </div>
87 89
 												<div class="col-xs-4 itp_in fnPchOdrStCd"></div>
88 90
 											</div>
89 91
 										</div>
@@ -93,7 +95,7 @@
93 95
 											<label class="col-xs-2 itp_lb">공급업체명</label>
94 96
 											<div class="col-xs-4 itp_ip fnSpplyNm"></div>
95 97
 											<label class="col-xs-2 itp_lb">발주일자</label>
96
-											<div class="col-xs-4 itp_ip fnPoorDt"></div>
98
+											<div class="col-xs-4 itp_ip fnPodrDt"></div>
97 99
 										</div>
98 100
 									</div>
99 101
 									<div class="itp_form_in">	
@@ -105,7 +107,7 @@
105 107
 												<div class="col-xs-4 itp_in fnDtlLcn"></div>
106 108
 											</div>
107 109
 											<label class="col-xs-2 itp_lb">발주 총 금액</label>
108
-											<div class="col-xs-4 itp_ip fnPodrAmt"></div>
110
+											<div class="col-xs-4 itp_ip fnPodrTotalAmt"></div>
109 111
 										</div>
110 112
 									</div>
111 113
 									<div class="itp_form_in">	
@@ -118,6 +120,7 @@
118 120
 											</div>
119 121
 											<label class="col-xs-2 itp_lb">배송구분</label>
120 122
 											<div class="col-xs-4 itp_ip fnDlvDvsn"></div>
123
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_DLV_DVSN" name="dlvDvsn">
121 124
 										</div>
122 125
 									</div>
123 126
 									<div class="itp_form_in">	
@@ -126,6 +129,8 @@
126 129
 											<div class="col-xs-4 itp_ip fnDlvReqDt"></div>
127 130
 											<label class="col-xs-2 itp_lb">출하창고</label>
128 131
 											<div class="col-xs-4 itp_ip fnShmtWhsNm"></div>
132
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_SHM_LOCATION" name="shmtLocation">
133
+											<input type="hidden" id="ITP_FORM_POMNG04010_DETAIL_SHM_WHS_ID" name="shmtWhsId">
129 134
 										</div>
130 135
 									</div>
131 136
 									<div class="itp_form_in">
@@ -133,10 +138,10 @@
133 138
 											<h4 class="itp_table_tit">발주 품목</h4>
134 139
 										</div>
135 140
 										<div id="ITP_POMNG04010_DETAIL_jqGrid_list" class="itp_tb_list">
136
-										  <div id="ITP_POMNG04010_DETAIL_jqGridView" class="itp_views fix"></div>
137
-										  <table id="ITP_POMNG04010_DETAIL_jqGrid"></table>
138
-										  <div id="ITP_POMNG04010_DETAIL_jqGridPager"></div>
139
-										  <div id="ITP_POMNG04010_DETAIL_jqGridEmpty" class="itp_no_data"></div>
141
+											<div id="ITP_POMNG04010_DETAIL_jqGridView" class="itp_views fix"></div>
142
+											<table id="ITP_POMNG04010_DETAIL_jqGrid"></table>
143
+											<div id="ITP_POMNG04010_DETAIL_jqGridPager"></div>
144
+											<div id="ITP_POMNG04010_DETAIL_jqGridEmpty" class="itp_no_data"></div>
140 145
 										</div>
141 146
 									</div>
142 147
 								</section>												

+ 12 - 11
src/main/webapp/app/pomng/POMNG07010.html

@@ -13,17 +13,16 @@
13 13
 						<div class="itp_srh_border fix">
14 14
 							<div class="col-xs-12">
15 15
 								<form id="ITP_FORM_POMNG07010_SEARCH" class="form-horizontal">
16
+								<input type="hidden" id="ITP_FORM_POMNG07010_SEARCH_BRAND_ID" name="sbrandId" value="">
16 17
 									<div class="form-group">
17 18
 										<div class="col-xs-2 itp_ip itp_noMar">
18
-											<select id="ITP_FORM_POMNG07010_SERVICE_DLV_CMPLT_DT" class="form-control itp_input" name="servicedlvCmpltDt">
19
-												<option value="A">입고일*</option>		
20
-											</select>
19
+											<label>일고일 *</label>
21 20
 										</div>											
22 21
 										<div class="col-xs-3 itp_ip itp_noMar">
23 22
 											<div class="input-daterange input-group date">
24
-												<input type="text" id="ITP_FORM_POMNG07010_SEARCH_DLV_REQ_DT" class="form-control itp_input" name="dlvReqDt" value="">
23
+												<input type="text" id="ITP_FORM_POMNG07010_SEARCH_FROM_DT" class="form-control itp_input" name="fromDt" value="">
25 24
 												<span class="input-group-addon itp_date_to">~</span>
26
-												<input type="text" id="ITP_FORM_POMNG07010_SEARCH_DLV_CMPLT_DT" class="form-control itp_input" name="dlvCmpltDt" value="">
25
+												<input type="text" id="ITP_FORM_POMNG07010_SEARCH_TO_DT" class="form-control itp_input" name="toDt" value="">
27 26
 											</div>
28 27
 										</div>
29 28
 										<div class="col-xs-2 itp_ip itp_noMar" style="width:9.6%;"></div>
@@ -33,18 +32,20 @@
33 32
 									</div>
34 33
 									<div class="form-group" style="padding-top: 10px; border-top: 1px dotted #ccc;">
35 34
 										<div class="col-xs-2 itp_ip itp_noMar">
36
-											<input type="text" id="ITP_FORM_POMNG07010_SEARCH_SPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" />
35
+											<input type="text" id="ITP_FORM_POMNG07010_DETAIL_SPPLY_NM" class="form-control itp_input" name="sspplyNm" placeholder="공급업체" readonly/>
36
+											<input type="hidden" id="ITP_FORM_POMNG07010_DETAIL_SPPLY_ID" class="form-control itp_input" name="sspplyId" />
37 37
 										</div>
38 38
 										<div class="col-xs-1 itp_in" style="padding: 0px; width:8%;">
39
-											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
40
-											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
39
+											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_SPPLY_ID" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
40
+											<button type="button" id="ITP_BTN_POMNG07010_DELETE_SPPLY_ID" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
41 41
 														</div>
42 42
 										<div class="col-xs-2 itp_ip itp_noMar">
43
-											<input type="text" id="ITP_FORM_POMNG07010_SEARCH_DLV_PLACE" class="form-control itp_input" name="sdlvPlace" placeholder="매장/창고" />
43
+											<input type="text" id="ITP_FORM_POMNG07010_DETAIL_WHS_NM" class="form-control itp_input" name="swhsNm" placeholder="매장/창고" readonly/>
44
+											<input type="hidden" id="ITP_FORM_POMNG07010_DETAIL_WHS_ID" class="form-control itp_input" name="swhsId" />
44 45
 										</div>
45 46
 										<div class="col-xs-1 itp_in" style="padding: 0px; width:10%;">
46
-											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
47
-											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
47
+											<button type="button" id="ITP_BTN_POMNG07010_SEARCH_WHS_ID" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
48
+											<button type="button" id="ITP_BTN_POMNG07010_DELETE_WHS_ID" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
48 49
 														</div>
49 50
 										<div class="col-xs-4 itp_ip itp_noMar">
50 51
 											<input type="text" id="ITP_FORM_POMNG07010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="품목번호 or 품목명" />

+ 10 - 0
src/main/webapp/js/app/config.js

@@ -3057,3 +3057,13 @@ let itp_fn_attach_file = {
3057 3057
 	}
3058 3058
 };
3059 3059
 
3060
+function itp_fn_set_chg_editable(rowId, lastrowid, gridId) {
3061
+	if ($(gridId).jqGrid('getCell', rowId, 'viewCd') === 'R') {
3062
+		 $(gridId).jqGrid('setRowData', rowId, { viewCd: "U" });
3063
+	}
3064
+	
3065
+	$(gridId).jqGrid('saveRow', rowId, true);
3066
+	lastrowid = rowId;
3067
+	
3068
+	return lastrowid;
3069
+};

+ 4 - 4
src/main/webapp/js/app/oper/ITP_OPER03010.js

@@ -612,13 +612,13 @@ let createObj = {
612 612
 					const rowData = $(OPER03010_DETAIL_GRID_ID).getRowData();
613 613
 					const keyValue = $(formId + '_AFFL_SHOP_ID').val();
614 614
 					$.each(rowData, function(key, value) {
615
-						if (value.viewCd != 'R') {
615
+						if (value.viewCd !== 'R') {
616 616
 							value.afflShopId = keyValue;
617
-							if (value.viewCd == 'C') {
617
+							if (value.viewCd === 'C') {
618 618
 								gridInsertData.push(value);
619
-							} else if (value.viewCd == 'U') {
619
+							} else if (value.viewCd === 'U') {
620 620
 								gridUpdateData.push(value);
621
-							} else if (value.viewCd == 'D') {
621
+							} else if (value.viewCd === 'D') {
622 622
 								gridDeleteData.push(value);
623 623
 							}
624 624
 						}

+ 4 - 4
src/main/webapp/js/app/pomng/ITP_POMNG01010.js

@@ -366,12 +366,12 @@ let createObj = {
366 366
 						const rowData = $(POMNG01010_DETAIL_GRID_ID).getRowData();
367 367
 						
368 368
 						$.each(rowData, function(key, value) {
369
-							if (value.viewCd != 'R') {
370
-								if (value.viewCd == 'C') {
369
+							if (value.viewCd !== 'R') {
370
+								if (value.viewCd === 'C') {
371 371
 									gridInsertData.push(value);
372
-								} else if (value.viewCd == 'U') {
372
+								} else if (value.viewCd === 'U') {
373 373
 									gridUpdateData.push(value);
374
-								} else if (value.viewCd == 'D') {
374
+								} else if (value.viewCd === 'D') {
375 375
 									gridDeleteData.push(value);
376 376
 								}
377 377
 							}

+ 35 - 39
src/main/webapp/js/app/pomng/ITP_POMNG02010.js

@@ -196,7 +196,7 @@ const gridColModel = {
196 196
 			label: ITP_MSG_LOCALE.label.pchReqQty, //단가
197 197
 			width: '10', fixed: false, align: 'right',
198 198
 			sortable: true, editable: true, edittype: 'text',
199
-			editrules: { number:true}
199
+			editrules: {required: true, number:true}
200 200
 		},
201 201
 		{
202 202
 			index: 'PCH_REQ_AMT', name: 'pchReqAmt',
@@ -405,6 +405,7 @@ let pageObj = {
405 405
 	},
406 406
 	grid: {
407 407
 		init: function(mode, gridRows) {
408
+			
408 409
 			this.gridId = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_ID : POMNG02010_DETAIL_GRID_ID;
409 410
 			this.gridList = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST;
410 411
 			this.gridEmpty = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY;
@@ -412,6 +413,7 @@ let pageObj = {
412 413
 			this.unload();
413 414
 			this.load(mode, gridRows);
414 415
 		},
416
+		
415 417
 		gridId: '',
416 418
 		gridList: '',
417 419
 		gridEmpty: '',
@@ -452,25 +454,26 @@ let pageObj = {
452 454
 				gridId: _this.gridId,
453 455
 				colModel: gridColModel.detail,
454 456
 				data: gridRows,
455
-				cellEdit: true,
456 457
 				multiselect: true,
457
-				// cellEdit: (mode !== 'VIEW'),
458
+				cellEdit: (mode !== 'VIEW'),
458 459
 				loadComplete: function(data) {
459
-					console.log(data);
460
+					//console.log(data);
460 461
 					//$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
461 462
 					//(Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
462 463
 					$(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
463
-					data.records === 0 ? _this.clearData() : $(this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).hide();
464
+					data.records === 0 ? _this.clearData() : $(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).hide();
464 465
 				},
465 466
 				onCellSelect: function(rowid, cellIdx, cellValue) {
466
-					console.log('mode ===> ' + mode);
467 467
 					if(mode !== 'VIEW') {
468
-						POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqQty']);
469
-						//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG02010_GRID_LAST_ROW_ID,  _this.gridId); 
468
+						//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, POMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
470 469
 					}
471
-				},
470
+				}
471
+				,
472 472
 				afterSaveCell: function(rowid,name,val,iRow,iCol) {
473
-					// 구매요청금액 계산 (기존금액과 )
473
+					
474
+					POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_chg_editable(rowid, POMNG02010_GRID_LAST_ROW_ID, POMNG02010_DETAIL_GRID_ID);
475
+					//POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, iCol, POMNG02010_GRID_LAST_ROW_ID,  _this.gridId); 
476
+					
474 477
 					var unitAmt = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-1);
475 478
 					jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{pchReqAmt: parseInt(val)*parseInt(unitAmt)});
476 479
 					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
@@ -488,14 +491,10 @@ let pageObj = {
488 491
 				console.log(rowData);
489 492
 				if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
490 493
 					pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
491
-					console.log("-----------------------------");
492
-					console.log(pchReqAmt);
493
-					console.log("-----------------------------");
494 494
 				}
495 495
 				
496 496
 			});
497
-			console.log("########################################");
498
-			console.log(pchReqAmt);
497
+			
499 498
 			$('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(pchReqAmt);
500 499
 		},
501 500
 		clearData : function() {
@@ -506,28 +505,6 @@ let pageObj = {
506 505
 		},
507 506
 		unload : function() {
508 507
 			$.jgrid.gridUnload(this.gridId);
509
-		},
510
-		changeRows: function(gridRows) {
511
-			var modifyRows = [];
512
-			var chkColumns = ['pchReqQty'];
513
-			$.each(this.gridRows, function(index, item) {
514
-				console.log(item);
515
-				var row = gridRows[index];
516
-				if(row.viewCd == 'C') {
517
-					modifyRows.push(item);
518
-				} else {
519
-					if(row.brandUnitUnqNo == item.brandUnitUnqNo) {
520
-						$.each(chkColumns, function(index, column) {
521
-							if(row[column].toString() != item[column].toString()) {
522
-								row.viewCd = 'U';
523
-								modifyRows.push(row);
524
-								return false;
525
-							}
526
-						});
527
-					}
528
-				}
529
-			});
530
-			return modifyRows;
531 508
 		}
532 509
 		
533 510
 	}
@@ -602,6 +579,8 @@ let listObj = {
602 579
 			var option = {
603 580
 				gridId: POMNG02010_GRID_ID,
604 581
 				colModel: gridColModel.list,
582
+				//autowidth: true,
583
+				//shrinkToFit:false, 
605 584
 				param: param,
606 585
 				url: DOMAIN + API_DETAIL_GRID_LIST,
607 586
 				pager: POMNG02010_GRID_PAGER,
@@ -624,6 +603,20 @@ let listObj = {
624 603
 					});
625 604
 				},
626 605
 				onPaging: function(action) {
606
+					/*
607
+					var pagingFn = {
608
+						callBack: function(args) {
609
+							$(args).trigger('reloadGrid');
610
+						}
611
+					};
612
+					if (itp_fn_check_grid_is_writing(POMNG02010_DETAIL_GRID_ID)) {
613
+						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, POMNG02010_DETAIL_GRID_ID);
614
+						return 'stop';
615
+					} else {
616
+						itp_fn_grid_paging(POMNG02010_DETAIL_GRID_ID, action, param);
617
+					}
618
+					*/
619
+					
627 620
 					itp_fn_grid_paging(POMNG02010_GRID_ID, action, param);
628 621
 				}
629 622
 			};
@@ -691,7 +684,7 @@ let viewObj = {
691 684
 /*수정화면 Object*/
692 685
 let modifyObj = {
693 686
 	init: function (param) {
694
-		//pageObj.grid.init('DETAIL', []);
687
+		pageObj.grid.init('DETAIL', []);
695 688
 		//this.load(param);
696 689
 	},
697 690
 	button: {
@@ -721,6 +714,9 @@ let modifyObj = {
721 714
 		save: function(arg) {
722 715
 			const formId = '#ITP_FORM_POMNG02010_DETAIL';
723 716
 			itp_fn_form_clear_validate(null, formId);
717
+			
718
+			itp_fn_grid_save_rows(POMNG02010_DETAIL_GRID_ID);
719
+			
724 720
 			$('#ITP_FORM_POMNG02010_DETAIL_PCH_REQ_ST_CD').val(arg);
725 721
 			
726 722
 			//정산 타입이 무정산이면 스킵
@@ -750,7 +746,7 @@ let modifyObj = {
750 746
 							const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
751 747
 							
752 748
 							$.each(rowData, function(key, value) {
753
-								if (value.viewCd !== 'R') {
749
+								if (value.viewCd != 'R') {
754 750
 									if (value.viewCd == 'C') {
755 751
 										gridInsertData.push(value);
756 752
 									} else if (value.viewCd == 'U') {

+ 140 - 126
src/main/webapp/js/app/pomng/ITP_POMNG03010.js

@@ -35,6 +35,7 @@ const POMNG03010_NDETAIL_GRID_PAGER = '#ITP_POMNG03010_NDETAIL_jqGridPager';
35 35
 const POMNG03010_NDETAIL_GRID_EMPTY = '#ITP_POMNG03010_NDETAIL_jqGridEmpty';
36 36
 
37 37
 let ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
38
+let POMNG03010_GRID_LAST_ROW_ID;
38 39
 
39 40
 /*API URL*/
40 41
 let API_DETAIL_GRID_LIST 		= '/api/pomng/po-target-grid-list';	// 목록
@@ -43,6 +44,7 @@ let API_DETAIL_POPASS_CHK   	= '/api/pomng/po/chk-pchOrd'; // 목록에서 선
43 44
 let API_DETAIL_PO_INIT_INFO    	= '/api/pomng/po/init-pchOrd'; // 구매요청발주생성 오픈시 호출하여 데이타 세팅함
44 45
 let API_DETAIL_NEW_INIT_INFO    = '/api/pomng/po/init-poOrd'; // 신규발주생성 오픈시 호출하여 데이타 세팅함
45 46
 let API_DETAIL_SAVE 		    = '/api/pomng/po/save-pchPo';			// 저장
47
+let API_DETAIL_PASSQTY 		    = '/api/stock/mng/whs-passqty-list';			// 창고선택후 해당 창고의 출고가능수량을 가져옴
46 48
 
47 49
 
48 50
 /*화면 Grid ColModel*/
@@ -180,7 +182,7 @@ const gridColModel = {
180 182
 			index: 'VIEW_CD', name: 'viewCd',
181 183
 			label: ITP_MSG_LOCALE.label.viewCd,
182 184
 			width: '10', fixed: false, align: 'center',
183
-			sortable: false, hidden: true
185
+			sortable: false, hidden: false
184 186
 		},
185 187
 		{
186 188
 			index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
@@ -406,8 +408,28 @@ let pageObj = {
406 408
 				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM').val(rowDataPop.whsNm + " - " + rowDataPop.locationNm);
407 409
 				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(rowDataPop.whsId);
408 410
 				$('#ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(rowDataPop.location);
411
+				
412
+				// 본사배송일경우 해당 창고의 재고를 가져와 출고가능수량에 기입한다.
413
+				// 만약 본사 배송일 경우 진행 처리함
414
+				var param = {brandId: fn_make_user_info.get('brandId'), whsId:rowDataPop.whsId , location:rowDataPop.location };
415
+				let gridItemData = [];
416
+				const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
417
+				$.each(rowData, function(key, value) {
418
+					gridItemData.push(value);
419
+				});
420
+
421
+				param.gridSize = 1000;
422
+				param.gridPage = 1;
423
+
424
+				param.gridItemData = gridItemData;
425
+					
426
+				modifyObj.whsPassQty(param);
409 427
 			}
410 428
 			
429
+			
430
+			
431
+			
432
+			
411 433
 		}
412 434
 	},
413 435
 	event: {
@@ -425,7 +447,7 @@ let pageObj = {
425 447
 						case 'ITP_BTN_POMNG03010_NEWPOCREATE'			: listObj.button.newpocreate();	break;	// 신규po 버튼
426 448
 						case 'ITP_BTN_POMNG03010_REJECT'				: listObj.button.reject(); 		break;	// 반려
427 449
 						case 'ITP_BTN_POMNG03010_PO'					: modifyObj.button.save(); 			break;	// 발주
428
-						case 'ITP_BTN_POMNG03010_CANCELLIST'			: createObj.button.cancel(); 		break;	// 취소/목록 버튼
450
+						case 'ITP_BTN_POMNG03010_CANCELLIST'			: modifyObj.button.cancel(); 		break;	// 취소/목록 버튼
429 451
 						case 'ITP_BTN_POMNG03010_DETAIL_ADDROW'			: pageObj.grid.button.addRow(); 	break;	// 품목추가
430 452
 						case 'ITP_BTN_POMNG03010_DETAIL_DELROW'			: pageObj.grid.button.delRow(); 	break;	// 품목삭제
431 453
 					}
@@ -447,72 +469,107 @@ let pageObj = {
447 469
 			$('#ITP_FORM_POMNG03010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
448 470
 			$('#ITP_FORM_POMNG03010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
449 471
 		} else if(mode == 'NPC') { // 신규발주등록
472
+		/*
450 473
 			$('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
451
-			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST', '#ITP_BTN_POMNG03010_DETAIL_ADDROW', '#ITP_BTN_POMNG03010_DETAIL_DELROW']);
452
-			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
453
-			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
474
+			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST', '#ITP_BTN_POMNG03010_NDETAIL_ADDROW', '#ITP_BTN_POMNG03010_NDETAIL_DELROW']);
475
+			$('#ITP_FORM_POMNG03010_NDETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
476
+			$('#ITP_FORM_POMNG03010_NDETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
454 477
 			
455
-			$('#ITP_FORM_POMNG03010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
456
-				$(this).attr('id') === 'ITP_FORM_POMNG03010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
478
+			$('#ITP_FORM_POMNG03010_NDETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
479
+				$(this).attr('id') === 'ITP_FORM_POMNG03010_NDETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
457 480
 				if(elem.type === 'select') {
458 481
 					$(this).val('').prop('selected', true);
459 482
 				}
460 483
 			});
461 484
 			
462
-			
463
-			// 가맹점 정보 설정
464
-			/*
465
-			$('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
466
-			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
467
-			$('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
468
-
469
-			$('#ITP_FORM_POMNG03010_DETAIL .fnStoreNm').text('(자동부여)');
470
-			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').removeAttr('readonly');
471
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').hide();
472
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
473
-				if($(this).data('check-required')) $(this).data('check-required', '');
474
-				$(this).attr('disabled', true);
475
-			});
476
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').show();
477
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
478
-				if($(this).data('check-required')) $(this).data('check-required', 'empty');
479
-				$(this).attr('disabled', false);
480
-			});
481
-			*/
482 485
 			var now = new Date();
483 486
 			$('#ITP_TAB_POMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
484
-			$('#ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+5)));
487
+			$('#ITP_FORM_POMNG03010_NDETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+5)));
488
+			*/
485 489
 		} else if(mode == 'POC') { // 구매요청 발주
486 490
 			$('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
487 491
 			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST']);
488 492
 			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
489 493
 			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
490
-			/*
491
-			$('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
492
-			$('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
493
-			$('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
494
-
495
-			$('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').attr('readonly', true);
496
-			// $('#ITP_BTN_POMNG03010_RESET_PW').show();
497
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').show();
498
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
499
-				if($(this).data('check-required')) $(this).data('check-required', 'empty');
500
-				$(this).attr('disabled', false);
501
-			});
502
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').hide();
503
-			$('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
504
-				if($(this).data('check-required')) $(this).data('check-required', '');
505
-				$(this).attr('disabled', true);
494
+			
495
+		}
496
+	},
497
+	grid: {
498
+		init: function(mode, gridRows) {
499
+			this.gridId = (mode === 'NPC') ? POMNG03010_VIEW_NDETAIL_ID : POMNG03010_DETAIL_GRID_ID;
500
+			this.gridList = (mode === 'NPC') ? POMNG03010_NDETAIL_GRID_LIST : POMNG03010_DETAIL_GRID_LIST;
501
+			this.gridEmpty = (mode === 'NPC') ? POMNG03010_NDETAIL_GRID_EMPTY : POMNG03010_DETAIL_GRID_EMPTY;
502
+			this.gridRows = gridRows;
503
+			this.unload();
504
+			this.load(mode, gridRows);
505
+			
506
+		},
507
+		gridId: '',
508
+		mode: 'DETAIL',
509
+		button: {},
510
+		gridList: '',
511
+		gridEmpty: '',
512
+		gridRows: '',
513
+		load: function(mode, gridRows) {
514
+			var _this = this;
515
+			var option = {
516
+				gridId: _this.gridId,
517
+				colModel: gridColModel.detail,
518
+				data: gridRows,
519
+				cellEdit: true,
520
+				multiselect: (mode !== 'NPC'),
521
+				loadComplete: function(data) {
522
+					console.log(data);
523
+					
524
+					$(_this.mode === 'NPC' ? POMNG03010_NDETAIL_GRID_LIST : POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
525
+					data.records === 0 ? _this.clearData(_this.mode) : $(_this.mode === 'VIEW' ? POMNG03010_NDETAIL_GRID_EMPTY : POMNG03010_DETAIL_GRID_EMPTY).hide();
526
+					
527
+				},
528
+				onCellSelect: function(rowid, cellIdx, cellValue) {
529
+					console.log('mode ===> ' + mode);
530
+					//POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
531
+				},
532
+				afterSaveCell: function(rowid,name,val,iRow,iCol) {
533
+					// 구매요청금액 계산 (기존금액과 )
534
+					var	unitAmt  = jQuery(_this.gridId).jqGrid('getCell',rowid,iCol-3);
535
+					jQuery(_this.gridId).jqGrid('setRowData',rowid,{podrAmt: parseInt(val)*parseInt(unitAmt)});	
536
+					
537
+					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
538
+					pageObj.grid.recal(_this.mode,_this.gridId);
539
+				}
540
+			};
541
+			itp_fn_grid_make_local(option);
542
+		},
543
+		recal: function(mode, gridId) {
544
+			//PCH_REQ_AMT
545
+			console.log(gridId);
546
+			const rowData = $(gridId).getRowData();
547
+			var podrAmt = 0 ;
548
+			console.log("####################################");
549
+			$.each(rowData, function(key, value) {
550
+				console.log(rowData);
551
+				if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
552
+					podrAmt = podrAmt + parseInt(value.podrAmt) ;
553
+				}
554
+				
506 555
 			});
507
-			*/
508
-
509
-		} 
510
-		/*
511
-		else if(mode == 'VIEW') { // 보기
512
-			$('#ITP_AJAX_POMNG03010_VIEW_CONTAINER').show();
513
-			fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_MODIFY', '#ITP_BTN_POMNG03010_CANCELLIST']);
556
+			
557
+			if (mode == 'NPC')  {
558
+				$('#ITP_FORM_POMNG03010_NDETAIL .fnPodrAmt').text(podrAmt);	
559
+			} else {
560
+				$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
561
+			}
562
+			
563
+		},
564
+		clearData : function(mode) {
565
+			$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_ID : POMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
566
+			$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_LIST : POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
567
+			$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_EMPTY : POMNG03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
568
+			$(mode === 'NPC' ? POMNG03010_NDETAIL_GRID_EMPTY : POMNG03010_DETAIL_GRID_EMPTY).show();
569
+		},
570
+		unload : function() {
571
+			$.jgrid.gridUnload(this.gridId);
514 572
 		}
515
-		*/
516 573
 	}
517 574
 };
518 575
 
@@ -548,12 +605,9 @@ let listObj = {
548 605
 		},
549 606
 		chkpo: function() {	
550 607
 			let gridUpdateData = [];
551
-			console.log("==================");
552 608
 			const rowKey = $(POMNG03010_GRID_ID).getGridParam('selrow');
553
-			console.log(rowKey);
554
-		    if (!rowKey) {
555
-				console.log("################");
556
-		    	return;
609
+			if (!rowKey) {
610
+				return;
557 611
 		    }
558 612
 	
559 613
 		    var selectedIds = $(POMNG03010_GRID_ID).getGridParam('selarrrow');
@@ -605,7 +659,10 @@ let listObj = {
605 659
 		init: function () {
606 660
 			// 데이터 없을때
607 661
 			listObj.empty.push();
662
+			itp_fn_jqgrid_resize(POMNG03010_GRID_ID, POMNG03010_GRID_LIST, 'lg');
663
+			itp_fn_fire_window_resize();
608 664
 			this.search();
665
+			
609 666
 		},
610 667
 		colModel: gridColModel.list,
611 668
 		search: function() {
@@ -664,9 +721,13 @@ let modifyObj = {
664 721
 			const selectVal = $('#ITP_FORM_POMNG03010_VIEW_STORE_ID').val();
665 722
 			const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
666 723
 			var param = $.param(key);
667
-			console.log(param);
668 724
 			modifyObj.load(param);
669 725
 		},
726
+		cancel: function() {
727
+			document.getElementById('ITP_FORM_POMNG03010_DETAIL').reset();
728
+			document.getElementById('ITP_FORM_POMNG03010_NDETAIL').reset();
729
+			listObj.grid.search();
730
+		},
670 731
 		save: function() {
671 732
 			const formId = '#ITP_FORM_POMNG03010_DETAIL';
672 733
 			itp_fn_form_clear_validate(null, formId);
@@ -689,8 +750,8 @@ let modifyObj = {
689 750
 						
690 751
 						var searhFn = function () {
691 752
 							ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
692
-							modifyObj.grid.clearData();
693
-							createObj.button.cancel();
753
+							pageObj.grid.clearData();
754
+							modifyObj.button.cancel();
694 755
 						}
695 756
 						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
696 757
 					}
@@ -704,7 +765,7 @@ let modifyObj = {
704 765
 		fn_ajax_call(API_DETAIL_PO_INIT_INFO, JSON.stringify(param), this.callback, 'POST');
705 766
 	},
706 767
 	callback: function (result) {
707
-		console.log(result);
768
+		
708 769
 		pageObj.switchScreen('POC');
709 770
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_VIEW_CD').val('C');
710 771
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(result.brandId);
@@ -728,74 +789,27 @@ let modifyObj = {
728 789
 		$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(result.shmtLocation);
729 790
 		
730 791
 		// 품목  리스트 조회
731
-		modifyObj.grid.init('DETAIL', result.itemList);
792
+		pageObj.grid.init('DETAIL', result.itemList);
732 793
 		// modifyObj.grid.load(result.spplyMgrList);
733 794
 	},
734
-	grid: {
735
-		init: function(mode, gridRows) {
736
-			this.gridId = POMNG03010_DETAIL_GRID_ID;
737
-			this.gridList = POMNG03010_DETAIL_GRID_LIST;
738
-			this.gridEmpty = POMNG03010_DETAIL_GRID_EMPTY;
739
-			this.gridRows = gridRows;
740
-			this.load(mode, gridRows);
741
-		},
742
-		gridId: '',
743
-		mode: 'DETAIL',
744
-		button: {},
745
-		gridList: '',
746
-		gridEmpty: '',
747
-		gridRows: '',
748
-		load: function(mode, gridRows) {
749
-			var _this = this;
750
-			var option = {
751
-				gridId: _this.gridId,
752
-				colModel: gridColModel.detail,
753
-				data: gridRows,
754
-				cellEdit: true,
755
-				multiselect: false,
756
-				// cellEdit: (mode !== 'VIEW'),
757
-				loadComplete: function(data) {
758
-					console.log(data);
759
-					$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
760
-					(Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
761
-				},
762
-				onCellSelect: function(rowid, cellIdx, cellValue) {
763
-					console.log('mode ===> ' + mode);
764
-					POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
765
-				},
766
-				afterSaveCell: function(rowid,name,val,iRow,iCol) {
767
-					// 구매요청금액 계산 (기존금액과 )
768
-					var	unitAmt = jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-3);
769
-					jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{podrAmt: parseInt(val)*parseInt(unitAmt)});	
770
-					
771
-					// 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
772
-					_this.recal();
773
-				}
774
-			};
775
-			itp_fn_grid_make_local(option);
776
-		},
777
-		recal: function() {
778
-			//PCH_REQ_AMT
779
-			console.log("==========================================");
780
-			const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
781
-			var podrAmt = 0 ;
782
-			console.log("####################################");
783
-			$.each(rowData, function(key, value) {
784
-				console.log(rowData);
785
-				if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
786
-					podrAmt = podrAmt + parseInt(value.podrAmt) ;
787
-				}
788
-				
789
-			});
790
-			$('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
791
-		},
792
-		clearData : function() {
793
-			$(POMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
794
-			$(POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
795
-			$(POMNG03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
796
-			$(POMNG03010_DETAIL_GRID_EMPTY).show();
797
-		}
795
+	whsPassQty: function(param) {
796
+		console.log(JSON.stringify(param));
797
+		fn_ajax_call(API_DETAIL_PASSQTY, JSON.stringify(param), this.passQtyCallback, 'POST');
798 798
 	},
799
+	passQtyCallback: function (result) {
800
+		
801
+		console.log(result);
802
+		console.log(result.size());
803
+		
804
+		/*
805
+		if ($(gridId).jqGrid('getCell', rowId, 'viewCd') === 'R') {
806
+		 $(gridId).jqGrid('setRowData', rowId, { viewCd: "U" });
807
+		}
808
+		*/
809
+		// 품목  리스트 조회
810
+		//pageObj.grid.init('DETAIL', result.itemList);
811
+		// modifyObj.grid.load(result.spplyMgrList);
812
+	}
799 813
 };
800 814
 
801 815
 /*신규화면 Object*/

+ 588 - 0
src/main/webapp/js/app/pomng/ITP_POMNG04010.js

@@ -0,0 +1,588 @@
1
+require(['config'], function() {
2
+    require([
3
+    ], function($) {
4
+        pageObj.init();
5
+    });
6
+});
7
+
8
+
9
+//화면변수
10
+const POMNG04010_GRID_ID = '#ITP_POMNG04010_jqGrid';
11
+const POMNG04010_GRID_LIST = '#ITP_POMNG04010_jqGrid_list';
12
+const POMNG04010_GRID_PAGER = '#ITP_POMNG04010_jqGridPager';
13
+const POMNG04010_GRID_EMPTY = '#ITP_POMNG04010_jqGridEmpty';
14
+
15
+const POMNG04010_DETAIL_GRID_ID = '#ITP_POMNG04010_DETAIL_jqGrid';
16
+const POMNG04010_DETAIL_GRID_LIST = '#ITP_POMNG04010_DETAIL_jqGrid_list';
17
+const POMNG04010_DETAIL_GRID_PAGER = '#ITP_POMNG04010_DETAIL_jqGridPager';
18
+const POMNG04010_DETAIL_GRID_EMPTY = '#ITP_POMNG04010_DETAIL_jqGridEmpty';
19
+
20
+let ITP_PODR_DTL_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PODR_DTL_ST_CD', true, '구매발주상세상태코드');
21
+
22
+
23
+//API URL
24
+let API_POMNG_PO_DETAIL_GRID_LIST =  '/api/pomng/po/detail-grid-list';
25
+let API_POMNG_PO_INFO_PCHODR =  '/api/pomng/po/info-pchOdr';
26
+let API_POMNG_PO_CANCEL_PCHPO =  '/api/pomng/po/cancel-pchPo';
27
+
28
+
29
+//화면 grid ColModel
30
+const gridColModel = {
31
+	list:[
32
+		{
33
+			index: 'VIEW_CD', name: 'viewCd',
34
+			label: ITP_MSG_LOCALE.label.viewCd,
35
+			width: '10', fixed: false, align: 'center',
36
+			sortable: false, hidden: true
37
+		},
38
+		{
39
+			index: 'BRAND_NM', name: 'brandNm',
40
+			label: ITP_MSG_LOCALE.label.brandNm,			// 브랜드명
41
+			width: '10', fixed: false, align: 'center',
42
+			sortable: false, hidden: false
43
+		},
44
+		{
45
+			index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
46
+			label: ITP_MSG_LOCALE.label.pchPodrUnqNo, 		// 발주번호
47
+			width: '10', fixed: false, align: 'center',
48
+			sortable: false, hidden: false
49
+		},
50
+		{
51
+			index: 'PCH_ODR_ST_NM', name: 'pchOdrStNm',
52
+			label: ITP_MSG_LOCALE.label.pchOdrStNm, 		// 발주상태명
53
+			width: '10', fixed: false, align: 'center',
54
+			sortable: false, hidden: false
55
+		},
56
+		{
57
+			index: 'PODR_DT', name: 'podrDt',
58
+			label: ITP_MSG_LOCALE.label.podrDt, 			// 발주일자
59
+			width: '10', fixed: false, align: 'center',
60
+			sortable: false, hidden: false
61
+		},
62
+		{
63
+			index: 'LOCATION_NM', name: 'locationNm',
64
+			label: ITP_MSG_LOCALE.label.locationNm, 		// 입고처
65
+			width: '10', fixed: false, align: 'center',
66
+			sortable: false, hidden: false
67
+		},
68
+		{
69
+			index: 'SPPLY_NM', name: 'spplyNm',
70
+			label: ITP_MSG_LOCALE.label.spplyNm, 			// 공급업체명
71
+			width: '10', fixed: false, align: 'center',
72
+			sortable: false, hidden: false
73
+		},
74
+		{
75
+			index: 'PODR_TOTAL_AMT', name: 'podrTotalAmt',
76
+			label: ITP_MSG_LOCALE.label.podrTotalAmt, 		// 총 발주금액
77
+			width: '8', fixed: false, align: 'center',
78
+			sortable: false, hidden: false,
79
+			formatter: 'integer', formatoptions: {thousandsSeparator: ','}
80
+		},
81
+		{
82
+			index: 'PODR_ITEM_QTY', name: 'podrItemQty',
83
+			label: ITP_MSG_LOCALE.label.podrItemQty, 		// 발주품목수
84
+			width: '7', fixed: false, align: 'center',
85
+			sortable: false, hidden: false
86
+		},
87
+		{
88
+			index: 'PODR_MGR_NM', name: 'podrMgrNm',
89
+			label: ITP_MSG_LOCALE.label.podrMgrNm, 			// 발주담당자
90
+			width: '10', fixed: false, align: 'center',
91
+			sortable: false, hidden: false
92
+		}
93
+	],
94
+	view: [],
95
+	detail: [
96
+		{
97
+			index: 'VIEW_CD', name: 'viewCd',
98
+			label: ITP_MSG_LOCALE.label.viewCd,
99
+			width: '10', fixed: false, align: 'center',
100
+			sortable: false, hidden: true
101
+		},
102
+		{
103
+			index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
104
+			label: ITP_MSG_LOCALE.label.pchPodrDtlNo, 		// 발주항번
105
+			width: '5', fixed: false, align: 'center',
106
+			sortable: false, hidden: false
107
+		},
108
+		{
109
+			index: 'ITEM_ID', name: 'itemId',
110
+			label: ITP_MSG_LOCALE.label.itemId, 			// 품목번호
111
+			width: '5', fixed: false, align: 'center',
112
+			sortable: false, hidden: false
113
+		},
114
+		{
115
+			index: 'ITEM_NM', name: 'itemNm',
116
+			label: ITP_MSG_LOCALE.label.itemNm, 			// 품목명
117
+			width: '5', fixed: false, align: 'center',
118
+			sortable: false, hidden: false
119
+		},
120
+		{
121
+			index: 'UNIT_AMT', name: 'unitAmt',
122
+			label: ITP_MSG_LOCALE.label.unitAmt, 			// 단가
123
+			width: '5', fixed: false, align: 'center',
124
+			sortable: false, hidden: false,
125
+			formatter: 'integer', formatoptions: {thousandsSeparator: ','}
126
+		},
127
+		{
128
+			index: 'UNIT', name: 'unit',
129
+			label: ITP_MSG_LOCALE.label.unit, 				// 기본단위
130
+			width: '5', fixed: false, align: 'center',
131
+			sortable: false, hidden: false
132
+		},
133
+		{
134
+			index: 'PODR_QTY', name: 'podrQty',
135
+			label: ITP_MSG_LOCALE.label.podrQty, 			// 발주수량
136
+			width: '5', fixed: false, align: 'center',
137
+			sortable: false, hidden: false
138
+		},
139
+		{
140
+			index: 'PODR_AMT', name: 'podrAmt',
141
+			label: ITP_MSG_LOCALE.label.podrAmt, 			// 발주금액
142
+			width: '5', fixed: false, align: 'center',
143
+			sortable: false, hidden: false,
144
+			formatter: 'integer', formatoptions: {thousandsSeparator: ','}
145
+		},
146
+		{
147
+			index: 'WHS_PASS_QTY', name: 'whsPassQty',
148
+			label: ITP_MSG_LOCALE.label.whsPassQty, 		// 출고가능수량
149
+			width: '5', fixed: false, align: 'center',
150
+			sortable: false, hidden: false
151
+		},
152
+		{
153
+			index: 'PODR_DTL_ST_CD', name: 'podrDtlStCd',
154
+			label: ITP_MSG_LOCALE.label.podrDtlStCd, 		// 구매발주상세상태코드
155
+			width: '5', fixed: false, align: 'center',
156
+			sortable: false, hidden: false, formatter: 'select', edittype: 'select',
157
+			editoptions: {value: ITP_PODR_DTL_ST_CD},
158
+		}
159
+	]
160
+};
161
+
162
+
163
+/*화면공통 Object*/
164
+let pageObj = {
165
+	init: function() {
166
+		this.ui.init();
167
+		this.event.init();
168
+	},
169
+	ui: {
170
+		init: function() {
171
+			this.view();
172
+			this.grid();
173
+			this.ready();
174
+		},
175
+		view: function() {
176
+			// 버튼 권한설정
177
+			fn_proc_btn_auth('POMNG04010');
178
+			// 공통코드 표시
179
+			$('select').each(function() {
180
+				if($(this).data('select-code')) {
181
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
182
+				}
183
+			});
184
+			// 조회일자 지정	
185
+			var now = new Date();
186
+			var defaultToDate = new Date(now);
187
+			defaultToDate.setDate(now.getDate() + 5);
188
+			$('#ITP_TAB_POMNG04010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
189
+			$('#ITP_FORM_POMNG04010_SEARCH_FROM_DT').datepicker('setDate', '2020.10.01');
190
+			$('#ITP_FORM_POMNG04010_SEARCH_TO_DT').datepicker('setDate', '2024.10.01');
191
+		},
192
+		grid: function() {
193
+			itp_fn_jqgrid_resize(POMNG04010_GRID_ID, POMNG04010_GRID_LIST, 'lg');
194
+			listObj.empty.init();
195
+			itp_fn_fire_window_resize();
196
+		},
197
+		ready: function() {
198
+			listObj.init();
199
+		}
200
+	},
201
+	event: {
202
+		init: function() {
203
+			this.button();
204
+		},
205
+		button: function() {
206
+			// 버튼 클릭 이벤트
207
+			$('button').each(function() {
208
+				var id = $(this).attr('id');
209
+				$(this).on('click', function() {
210
+					switch (id) {
211
+						case 'ITP_BTN_POMNG04010_SRH'				: listObj.button.search();		break;	// 조회 버튼 클릭
212
+						case 'ITP_BTN_POMNG04010_NEWREG'			: listObj.button.create(); 		break;	// 신규등록 버튼
213
+						case 'ITP_BTN_POMNG04010_MODIFY'			: modifyObj.button.modify();	break;	// 수정 버튼
214
+						case 'ITP_BTN_POMNG04010_CANCELLIST'		: modifyObj.button.cancel(); 	break;	// 취소/목록 버튼
215
+						case 'ITP_BTN_POMNG04010_DELETE'			: modifyObj.button.del();		break;	// 발주 취소 버튼(예정)
216
+					}
217
+				});
218
+			});
219
+		}
220
+	},
221
+	switchScreen: function(mode) {
222
+        $('.itp_det_head').find('button[id^="ITP_BTN_POMNG04010_"]').each(function(i) {
223
+            $(this).hide();
224
+        });
225
+        $('#ITP_TAB_POMNG04010').find('div[id$="_CONTAINER"]').each(function(i) {
226
+            $(this).hide();
227
+        });
228
+        if(mode == 'LIST') { // 목록
229
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_SRH', '#ITP_BTN_POMNG04010_NEWREG']);
230
+            $('#ITP_AJAX_POMNG04010_LIST_CONTAINER').show();
231
+            $('#ITP_FORM_POMNG04010_SEARCH #ITP_FORM_POMNG04010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
232
+            $('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').show();
233
+            $('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').show();
234
+            $('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').show();
235
+            $('#ITP_BTN_POMNG04010_DELETE_WHS_ID').show();
236
+            
237
+        } else if(mode == 'ADD') { // 등록
238
+            $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
239
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
240
+
241
+            $('#ITP_FORM_POMNG04010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
242
+                $(this).attr('id') === 'ITP_FORM_POMNG04010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
243
+                if(elem.type === 'select') {
244
+                    $(this).val('').prop('selected', true);
245
+                }
246
+            });
247
+            $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_FILE_NO').val('');
248
+            $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').removeAttr('readonly');
249
+            $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').removeAttr('readonly');
250
+            $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').removeAttr('readonly');
251
+            $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').removeAttr('readonly');
252
+            // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').removeAttr('disabled');
253
+            // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').removeAttr('disabled');
254
+            $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').show();
255
+            $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').show();
256
+			$('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').hide();
257
+			$('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').show();
258
+
259
+            $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
260
+            $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
261
+
262
+            $('.fnBrandId').text('(자동부여)');
263
+        } else if(mode == 'MODIFY') { // 수정
264
+            $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
265
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
266
+
267
+            $('#ITP_BTN_POMNG04010_CANCELLIST').show();
268
+            $('#ITP_BTN_POMNG04010_DELETE').show();
269
+            
270
+            $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').attr('readonly', true);
271
+            $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').attr('readonly', true);
272
+            $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').attr('readonly', true);
273
+            $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').attr('readonly', true);
274
+            // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').attr('disabled', true);
275
+            // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').attr('disabled', true);
276
+            $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').hide();
277
+            $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').hide();
278
+			$('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').show();
279
+			$('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').hide();
280
+
281
+            $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
282
+        } else if(mode == 'VIEW') { // 보기
283
+            $('#ITP_AJAX_POMNG04010_VIEW_CONTAINER').show();
284
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_MODIFY', '#ITP_BTN_POMNG04010_CANCELLIST']);
285
+        }
286
+    }
287
+};
288
+
289
+
290
+/*목록화면 Object*/
291
+let listObj = {
292
+	init: function() {
293
+		this.grid.init();
294
+		this.action();
295
+	},
296
+	itp_POMNG04010_param: {},
297
+	itp_POMNG04010_search: false,
298
+	button: {
299
+		search: function() {
300
+			listObj.itp_POMNG04010_search = true;
301
+			let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
302
+			param.gridSize = $.jgrid.defaults.rowNum;
303
+            param.gridPage = $.jgrid.defaults.page;
304
+            param.sidx = '0';
305
+            console.log(JSON.stringify(param));
306
+            $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
307
+        }
308
+	},
309
+	empty: {
310
+		init: function() {
311
+			var _this = this;
312
+            this.push();
313
+            $(POMNG04010_GRID_EMPTY).on('click', function() {
314
+                _this.back();
315
+                listObj.itp_POMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
316
+                $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_POMNG04010_param)}).trigger('reloadGrid');
317
+            });
318
+		},
319
+		push: function() {
320
+            let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
321
+            listObj.itp_POMNG04010_param = param;
322
+            param.sidx = '0';
323
+        },
324
+        back: function() {
325
+            $('#ITP_FORM_POMNG04010_SERVICE_BRAND_TYPE').val(listObj.itp_POMNG04010_param.brandType);
326
+            $('#ITP_FORM_POMNG04010_SERVICE_ST_CD').val(listObj.itp_POMNG04010_param.stCd);
327
+            $('#ITP_FORM_POMNG04010_SEARCH_BRAND_NM').val(listObj.itp_POMNG04010_param.brandNm);
328
+        }
329
+	},
330
+	grid: {
331
+		init: function() {
332
+			// 데이터 없을때
333
+            listObj.empty.push();
334
+            this.search();
335
+		},
336
+		colModel: gridColModel.list,
337
+		search: function() {
338
+			pageObj.switchScreen('LIST');
339
+			this.unload();
340
+			this.load();
341
+		},
342
+		load: function() {
343
+            let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
344
+            param.gridSize = $.jgrid.defaults.rowNum;
345
+            param.sidx = '0';
346
+            console.log(JSON.stringify(param));
347
+            var option = {
348
+            	gridId: POMNG04010_GRID_ID,
349
+            	colModel: gridColModel.list,
350
+            	param: param,
351
+            	url: DOMAIN + API_POMNG_PO_DETAIL_GRID_LIST,
352
+            	pager: POMNG04010_GRID_PAGER,
353
+            	onCellSelect: function(rowId, cellIdx, cellValue) {
354
+                    var cm = $(this).jqGrid('getGridParam', 'colModel');
355
+                    var colNm = cm[cellIdx].name;
356
+                    if (colNm === 'pchPodrUnqNo') {
357
+                        const pchPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'pchPodrUnqNo');
358
+                        const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
359
+                        const key = {pchPodrUnqNo: pchPodrUnqNoVal, brandId: brandIdVal};
360
+                        var param = $.param(key);
361
+                        modifyObj.init(param);
362
+                    }
363
+				},
364
+				loadComplete: function(data) {
365
+					console.log(data);
366
+                    itp_fn_grid_load_complete(data, POMNG04010_GRID_ID, true, 'number', 'POMNG04010', listObj.itp_POMNG04010_search, listObj.empty, true, data.gridRecords, true);
367
+                    var ids = $(POMNG04010_GRID_ID).getDataIDs();
368
+                    $.each(ids, function(idx, rowId) {
369
+                        $(POMNG04010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
370
+                    });
371
+				},
372
+				onPaging: function(action) {
373
+                    itp_fn_grid_paging(POMNG04010_GRID_ID, action, param);
374
+                }
375
+            };
376
+            itp_fn_grid_make_remote(option);
377
+		},
378
+		clearData: function() {
379
+			$(POMNG04010_GRID_ID).jqGrid('clearGridData', true);
380
+            $(POMNG04010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
381
+            $(POMNG04010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
382
+            $(POMNG04010_GRID_EMPTY).show();
383
+		},
384
+		unload: function() {
385
+			$.jgrid.gridUnload(POMNG04010_GRID_ID);
386
+		}
387
+	},
388
+	action: function() {
389
+		var _this = this;
390
+		// 공급업체 조회 버튼 클릭
391
+		$('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').on('click', function() {
392
+			_this.popup('spply');
393
+		});
394
+		// 공급업체 텍스트 삭제 버튼 클릭
395
+		$('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').on('click', function() {
396
+			$('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val('');
397
+			$('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val('');
398
+		});
399
+		// 매장/창고 조회 버튼 클릭
400
+		$('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').on('click', function() {
401
+			_this.popup('whs');
402
+		});
403
+		// 매장/창고 텍스트 삭제 버튼 클릭
404
+		$('#ITP_BTN_POMNG04010_DELETE_WHS_ID').on('click', function() {
405
+			$('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val('');
406
+			$('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val('');
407
+		});
408
+	},
409
+	popup: function(keyword) {
410
+		var popFn = this.callback.create;
411
+		// const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
412
+		if(keyword === 'spply'){
413
+			fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, /*key*/null, 'S');
414
+		} else if(keyword === 'whs'){
415
+			fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, /*key*/null, 'S');
416
+		}
417
+	},
418
+	callback: {
419
+		create: function(rowDataPop) {
420
+			console.log(rowDataPop);
421
+			if(rowDataPop.hasOwnProperty('whsId') == false) {
422
+				$('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
423
+				$('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val(rowDataPop.spplyId);
424
+			} else {
425
+				$('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
426
+				$('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val(rowDataPop.whsId);
427
+			}
428
+		}
429
+	}
430
+};
431
+
432
+
433
+/*수정화면 Object*/
434
+let modifyObj = {
435
+	init: function(param) {
436
+		this.load(param);
437
+	},
438
+	itp_POMNG04010_param: {},
439
+	itp_POMNG04010_search: false,
440
+	button: {
441
+		cancel: function() {
442
+			listObj.grid.search();
443
+		},
444
+		del: function() {
445
+			console.log('here');
446
+			const formId = '#ITP_FORM_POMNG04010_DETAIL';
447
+			itp_fn_form_clear_validate(null, formId);
448
+			itp_fn_grid_save_rows(POMNG04010_DETAIL_GRID_ID);
449
+			let gridUpdateData = [];
450
+			for(var i=0; i<$(POMNG04010_DETAIL_GRID_ID).getGridParam('reccount'); i++) {
451
+				$(POMNG04010_DETAIL_GRID_ID).jqGrid('saveCell', i+1, 2)
452
+			}
453
+			const selection = $(POMNG04010_DETAIL_GRID_ID).getGridParam('selarrrow');
454
+			console.log(selection);
455
+			const rowData = $(POMNG04010_DETAIL_GRID_ID).getRowData();
456
+			let newData = [];
457
+			for(let i = 0; i < selection.length; i++){
458
+				let before = $(POMNG04010_DETAIL_GRID_ID).getRowData(selection[i]);
459
+				//before.podrDtlStCd = 'POD2';
460
+				//console.log(before)
461
+				newData.push(before);
462
+			}
463
+			console.log(newData);
464
+			let param = $(formId).serializeObject();
465
+			param.gridUpdateData = newData;
466
+			console.log(JSON.stringify(param));
467
+			var searhFn = function() {
468
+				ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
469
+				listObj.grid.search();
470
+			};
471
+			fn_ajax_call(API_POMNG_PO_CANCEL_PCHPO, JSON.stringify(param), searhFn, 'POST');
472
+		}
473
+	},
474
+	empty: {
475
+		init: function() {
476
+            var _this = this;
477
+            this.push();
478
+            $(POMNG04010_VIEW_GRID_EMPTY).on('click', function() {
479
+                _this.back();
480
+                viewObj.itp_POMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
481
+                $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_POMNG04010_param)}).trigger('reloadGrid');
482
+            });
483
+        },
484
+        push: function() {
485
+            let param = $('#ITP_FORM_POMNG04010_DETAIL').serializeObject();
486
+            viewObj.itp_POMNG04010_param = param;
487
+        },
488
+        back: function() {
489
+            $('#ITP_FORM_POMNG04010_SERVICE_BRAND_TYPE').val(viewObj.itp_POMNG04010_param.brandType);
490
+            $('#ITP_FORM_POMNG04010_SERVICE_ST_CD').val(viewObj.itp_POMNG04010_param.stCd);
491
+            $('#ITP_FORM_POMNG04010_SEARCH_BRAND_NM').val(viewObj.itp_POMNG04010_param.brandNm);
492
+        }
493
+	},
494
+	load: function(param) {
495
+		fn_ajax_call(API_POMNG_PO_INFO_PCHODR, param, this.callback, 'GET');
496
+	},
497
+	callback: function(result) {
498
+		console.log(result);
499
+		
500
+		// 그리드 전화번호 '-' 함수
501
+		function convertTel(value){
502
+			answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
503
+					.replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
504
+					.replace("--", "-") : '';
505
+			return answer;
506
+		}		
507
+		let telNo = convertTel(result.podrMgrTelNo);
508
+		
509
+		pageObj.switchScreen('MODIFY');
510
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(result.afflShopId);
511
+		$('#ITP_FORM_POMNG04010_DETAIL .fnBrandNm').text(result.brandNm);				
512
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPchPodrUnqNo').text(result.pchPodrUnqNo);
513
+		$('#ITP_FORM_POMNG04010_DETAIL .fnSpplyNm').text(result.spplyId);
514
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPodrDt').text(result.podrDt);
515
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPchOdrStCd').text(result.pchOdrStNm);
516
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPodrTotalAmt').text(result.podrTotalAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
517
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNm').text(result.podrMgrNm);
518
+		$('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNo').text(telNo);
519
+		$('#ITP_FORM_POMNG04010_DETAIL .fnDlvDvsn').text(result.dlvDvsnNm);
520
+		$('#ITP_FORM_POMNG04010_DETAIL .fnDlvReqDt').text(result.dlvReqDt);
521
+		$('#ITP_FORM_POMNG04010_DETAIL .fnShmtWhsNm').text(result.shmtWhsDvsnNm);
522
+		
523
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRANDID').val(result.brandId);
524
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_DLV_DVSN').val(result.dlvDvsnNm);
525
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_PCH_PODR_UNQ_NO').val(result.pchPodrUnqNo);
526
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_STORE_ID').val(result.storeId);
527
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_LOCATION').val(result.shmtLocation);
528
+		$('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_WHS_ID').val(result.shmtWhsId);
529
+		
530
+		modifyObj.grid.init('MODIFY', result.pchOdrDtlList)
531
+	},
532
+	grid: {
533
+		init: function(mode, gridData) {
534
+			this.mode = mode;
535
+			this.gridId = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_ID : POMNG04010_DETAIL_GRID_ID;
536
+			this.gridList = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_LIST : POMNG04010_DETAIL_GRID_LIST;
537
+			this.gridEmpty = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_EMPTY : POMNG04010_DETAIL_GRID_EMPTY;
538
+			this.unload();
539
+			this.load(mode, gridData);
540
+		},
541
+		mode: '',
542
+		colModel: gridColModel.view,
543
+		load: function(mode, gridData) {
544
+			var _this = this;
545
+			var option = {
546
+				gridId: _this.gridId,
547
+				colModel: gridColModel.detail,
548
+				data: gridData,
549
+				multiselect: true,
550
+				loadComplete: function(data) {
551
+					console.log(data);
552
+					itp_fn_grid_load_complete(data, POMNG04010_DETAIL_GRID_ID, true, 'number', 'POMNG04010', modifyObj.itp_POMNG04010_search, modifyObj.empty, true, data.gridRecords, true);
553
+					var idArry = $(POMNG04010_DETAIL_GRID_ID).jqGrid('getDataIDs');
554
+					for(var i = 0; i < idArry.length; i++){
555
+						var ret =  $(POMNG04010_DETAIL_GRID_ID).getRowData(idArry[i]);
556
+						console.log(1111111);
557
+						console.log(ret);
558
+						if(ret.podrDtlStCd == 'POD4'){
559
+							$("#jqg_list_"+idArry[i]).attr("disabled", true);
560
+						}
561
+					}
562
+				},
563
+				onSelectAll: function(aRowids, status) {
564
+					if(status){
565
+						var cbs = $("tr.jqgrow > td > input.cbox:disabled", $(POMNG04010_DETAIL_GRID_ID)[0]);
566
+						cbs.removeAttr("checked");
567
+						$(POMNG04010_DETAIL_GRID_ID)[0].p.selarrrow = $("#grid_id").find("tr.jqgrow:has(td > input.cbox:checked)").map(function() { return this.id; }).get();
568
+					}
569
+				}
570
+			};
571
+			itp_fn_grid_make_local(option);
572
+		},
573
+		unload: function() {
574
+			$.jgrid.gridUnload(this.gridId);
575
+		}
576
+	},
577
+	isValid: function(formId) {
578
+		var isValid = false;
579
+		$(formId).find('input, select, checkbox, textarea').each(function(k) {
580
+			if($(this).data('check-required')) {
581
+				var arry = $(this).data('check-required').split(',');
582
+				isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined);
583
+				if(!isValid) return false;
584
+			}
585
+		});
586
+		return isValid;
587
+	},
588
+};

+ 411 - 0
src/main/webapp/js/app/pomng/ITP_POMNG07010.js

@@ -0,0 +1,411 @@
1
+require(['config'], function() {
2
+    require([
3
+    ], function($) {
4
+        pageObj.init();
5
+    });
6
+});
7
+
8
+
9
+//화면변수
10
+const POMNG07010_GRID_ID = '#ITP_POMNG07010_jqGrid';
11
+const POMNG07010_GRID_LIST = '#ITP_POMNG07010_jqGrid_list';
12
+const POMNG07010_GRID_PAGER = '#ITP_POMNG07010_jqGridPager';
13
+const POMNG07010_GRID_EMPTY = '#ITP_POMNG07010_jqGridEmpty';
14
+
15
+
16
+//API URL
17
+let API_POMNG_INOUTMNG_WAREHOUSE_GRID_LIST = '/api/pomng/inoutmng/warehouse-grid-list';
18
+
19
+
20
+//화면 grid ColModel
21
+const gridColModel = {
22
+	list:[
23
+		{
24
+			index: 'VIEW_CD', name: 'viewCd',
25
+			label: ITP_MSG_LOCALE.label.viewCd,
26
+			width: '10', fixed: false, align: 'center',
27
+			sortable: false, hidden: true
28
+		},
29
+		{
30
+			index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
31
+			label: ITP_MSG_LOCALE.label.pchPodrUnqNo, 		// 발주번호
32
+			width: '10', fixed: false, align: 'center',
33
+			sortable: false, hidden: false
34
+		},
35
+		{
36
+			index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
37
+			label: ITP_MSG_LOCALE.label.pchPodrDtlNo, 		// 발주항번
38
+			width: '5', fixed: false, align: 'center',
39
+			sortable: false, hidden: false
40
+		},
41
+		{
42
+			index: 'DLV_STTMT_UNQ_NO', name: 'dlvSttmtUnqNo',
43
+			label: ITP_MSG_LOCALE.label.dlvSttmtUnqNo, 		// 납품번호
44
+			width: '10', fixed: false, align: 'center',
45
+			sortable: false, hidden: false
46
+		},
47
+		{
48
+			index: 'DLV_STTMT_DTL_NO', name: 'dlvSttmtDtlNo',
49
+			label: ITP_MSG_LOCALE.label.dlvSttmtDtlNo, 		// 납품항번
50
+			width: '5', fixed: false, align: 'center',
51
+			sortable: false, hidden: false
52
+		},
53
+		{
54
+			index: 'PODR_QTY', name: 'podrQty',
55
+			label: ITP_MSG_LOCALE.label.podrQty, 			// 발주수량
56
+			width: '5', fixed: false, align: 'center',
57
+			sortable: false, hidden: false
58
+		},
59
+		{
60
+			index: 'DLV_QTY', name: 'dlvQty',
61
+			label: ITP_MSG_LOCALE.label.dlvQty, 			// 납품수량
62
+			width: '5', fixed: false, align: 'center',
63
+			sortable: false, hidden: false
64
+		},
65
+		{
66
+			index: 'WHS_QTY', name: 'whsQty',
67
+			label: ITP_MSG_LOCALE.label.whsQty, 			// 입고수량
68
+			width: '5', fixed: false, align: 'center',
69
+			sortable: false, hidden: false
70
+		},
71
+		{
72
+			index: 'DIV_REQ_DT', name: 'dlvReqDt',
73
+			label: ITP_MSG_LOCALE.label.dlvReqDt, 			// 납품요청일
74
+			width: '8', fixed: false, align: 'center',
75
+			sortable: false, hidden: false
76
+		},
77
+		
78
+		{
79
+			index: 'DLV_SCH_DT', name: 'dlvSchDt',
80
+			label: ITP_MSG_LOCALE.label.dlvSchDt, 			// 납품예정일
81
+			width: '8', fixed: false, align: 'center',
82
+			sortable: false, hidden: false
83
+		},
84
+		{
85
+			index: 'DLV_CMPLT_DT', name: 'dlvCmpltDt',
86
+			label: ITP_MSG_LOCALE.label.dlvCmpltDt, 		// 납품일자
87
+			width: '8', fixed: false, align: 'center',
88
+			sortable: false, hidden: false
89
+		},
90
+		{
91
+			index: 'WHS_CNFM_NM', name: 'whsCnfmNm',
92
+			label: ITP_MSG_LOCALE.label.whsCnfmNm, 			// 입고확인자
93
+			width: '8', fixed: false, align: 'center',
94
+			sortable: false, hidden: false
95
+		},
96
+		{
97
+			index: 'DLV_MGR_NM', name: 'dlvMgrNm',
98
+			label: ITP_MSG_LOCALE.label.dlvMgrNm, 			// 납품자명
99
+			width: '8', fixed: false, align: 'center',
100
+			sortable: false, hidden: false
101
+		},
102
+		{
103
+			index: 'DLV_MGR_TEL_NO', name: 'dlvMgrTelNo',
104
+			label: ITP_MSG_LOCALE.label.dlvMgrTelNo, 		// 납품자전화번호
105
+			width: '8', fixed: false, align: 'center',
106
+			sortable: false, hidden: false
107
+		},
108
+		{
109
+			index: 'ITEM_ID', name: 'itemId',
110
+			label: ITP_MSG_LOCALE.label.itemId, 			// 품목번호
111
+			width: '8', fixed: false, align: 'center',
112
+			sortable: false, hidden: false
113
+		},
114
+		{
115
+			index: 'ITEM_NM', name: 'itemNm',
116
+			label: ITP_MSG_LOCALE.label.itemNm, 			// 품목명
117
+			width: '8', fixed: false, align: 'center',
118
+			sortable: false, hidden: false
119
+		},
120
+		{
121
+			index: 'UNIT', name: 'unit',
122
+			label: ITP_MSG_LOCALE.label.unit, 				// 기본단위
123
+			width: '5', fixed: false, align: 'center',
124
+			sortable: false, hidden: false
125
+		},
126
+		{
127
+			index: 'WHS_AMT', name: 'whsAmt',
128
+			label: ITP_MSG_LOCALE.label.whsAmt, 			// 입고금액
129
+			width: '8', fixed: false, align: 'center',
130
+			sortable: false, hidden: false,
131
+			formatter: 'integer', formatoptions: {thousandsSeparator: ','}
132
+		}
133
+	],
134
+	view: [],
135
+	detail: []
136
+};
137
+
138
+
139
+/*화면공통 Object*/
140
+let pageObj = {
141
+	init: function() {
142
+		this.ui.init();
143
+		this.event.init();
144
+	},
145
+	ui: {
146
+		init: function() {
147
+			this.view();
148
+			this.grid();
149
+			this.ready();
150
+		},
151
+		view: function() {
152
+			// 버튼 권한설정
153
+			fn_proc_btn_auth('POMNG07010');
154
+			// 공통코드 표시
155
+			$('select').each(function() {
156
+				if($(this).data('select-code')) {
157
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
158
+				}
159
+			});
160
+			// 조회일자 지정	
161
+			var now = new Date();
162
+			var defaultToDate = new Date(now);
163
+			defaultToDate.setDate(now.getDate() + 5);
164
+			$('#ITP_TAB_POMNG07010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
165
+			$('#ITP_FORM_POMNG07010_SEARCH_FROM_DT').datepicker('setDate', now);
166
+			$('#ITP_FORM_POMNG07010_SEARCH_TO_DT').datepicker('setDate', defaultToDate);
167
+		},
168
+		grid: function() {
169
+			itp_fn_jqgrid_resize(POMNG07010_GRID_ID, POMNG07010_GRID_LIST, 'lg');
170
+			listObj.empty.init();
171
+			itp_fn_fire_window_resize();
172
+		},
173
+		ready: function() {
174
+			listObj.init();
175
+		}
176
+	},
177
+	event: {
178
+		init: function() {
179
+			this.button();
180
+		},
181
+		button: function() {
182
+			// 버튼 클릭 이벤트
183
+			$('button').each(function() {
184
+				var id = $(this).attr('id');
185
+				$(this).on('click', function() {
186
+					switch (id) {
187
+						case 'ITP_BTN_POMNG07010_SRH'				: listObj.button.search();		break;	// 조회 버튼 클릭
188
+						case 'ITP_BTN_POMNG07010_NEWREG'			: listObj.button.create(); 		break;	// 신규등록 버튼
189
+						case 'ITP_BTN_POMNG07010_MODIFY'			: modifyObj.button.modify();	break;	// 수정 버튼
190
+						case 'ITP_BTN_POMNG07010_CANCELLIST'		: viewObj.button.cancel(); 		break;	// 취소/목록 버튼
191
+						case 'ITP_BTN_POMNG07010_DELETE'			: 								break;	// 삭제 버튼
192
+					}
193
+				});
194
+			});
195
+		}
196
+	},
197
+	switchScreen: function(mode) {
198
+        $('.itp_det_head').find('button[id^="ITP_BTN_POMNG07010_"]').each(function(i) {
199
+            $(this).hide();
200
+        });
201
+        $('#ITP_TAB_POMNG07010').find('div[id$="_CONTAINER"]').each(function(i) {
202
+            $(this).hide();
203
+        });
204
+        if(mode == 'LIST') { // 목록
205
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG07010_SRH', '#ITP_BTN_POMNG07010_NEWREG']);
206
+            $('#ITP_AJAX_POMNG07010_LIST_CONTAINER').show();
207
+            $('#ITP_FORM_POMNG07010_SEARCH #ITP_FORM_POMNG07010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
208
+            $('#ITP_BTN_POMNG07010_SEARCH_SPPLY_ID').show();
209
+            $('#ITP_BTN_POMNG07010_DELETE_SPPLY_ID').show();
210
+            $('#ITP_BTN_POMNG07010_SEARCH_WHS_ID').show();
211
+            $('#ITP_BTN_POMNG07010_DELETE_WHS_ID').show();
212
+        }/* else if(mode == 'ADD') { // 등록
213
+            $('#ITP_AJAX_POMNG07010_DETAIL_CONTAINER').show();
214
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG07010_CANCELLIST', '#ITP_BTN_POMNG07010_SAVE']);
215
+
216
+            $('#ITP_FORM_POMNG07010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
217
+                $(this).attr('id') === 'ITP_FORM_POMNG07010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
218
+                if(elem.type === 'select') {
219
+                    $(this).val('').prop('selected', true);
220
+                }
221
+            });
222
+            $('#ITP_FORM_POMNG07010_DETAIL #ITP_FORM_POMNG07010_DETAIL_FILE_NO').val('');
223
+            $('#ITP_FORM_POMNG07010_DETAIL_BRAND_ID').removeAttr('readonly');
224
+            $('#ITP_FORM_POMNG07010_DETAIL_BRAND_NM').removeAttr('readonly');
225
+            $('#ITP_FORM_POMNG07010_DETAIL_BSNS_REG_NO').removeAttr('readonly');
226
+            $('#ITP_FORM_POMNG07010_DETAIL_CORP_REG_NO').removeAttr('readonly');
227
+            // $('#ITP_FORM_POMNG07010_DETAIL_SEARCH_AFFL_SHOP').removeAttr('disabled');
228
+            // $('#ITP_FORM_POMNG07010_DETAIL_DELETE_AFFL_SHOP').removeAttr('disabled');
229
+            $('#ITP_FORM_POMNG07010_DETAIL_SEARCH_AFFL_SHOP').show();
230
+            $('#ITP_FORM_POMNG07010_DETAIL_DELETE_AFFL_SHOP').show();
231
+			$('#ITP_FORM_POMNG07010_DETAIL .itp_form_info').hide();
232
+			$('#ITP_FORM_POMNG07010_DETAIL .itp_form_change').show();
233
+
234
+            $('#ITP_FORM_POMNG07010_DETAIL #ITP_FORM_POMNG07010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
235
+            $('#ITP_FORM_POMNG07010_DETAIL #ITP_FORM_POMNG07010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
236
+
237
+            $('.fnBrandId').text('(자동부여)');
238
+        } else if(mode == 'MODIFY') { // 수정
239
+            $('#ITP_AJAX_POMNG07010_DETAIL_CONTAINER').show();
240
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG07010_CANCELLIST', '#ITP_BTN_POMNG07010_SAVE']);
241
+
242
+            $('#ITP_FORM_POMNG07010_DETAIL_BRAND_ID').attr('readonly', true);
243
+            $('#ITP_FORM_POMNG07010_DETAIL_BRAND_NM').attr('readonly', true);
244
+            $('#ITP_FORM_POMNG07010_DETAIL_BSNS_REG_NO').attr('readonly', true);
245
+            $('#ITP_FORM_POMNG07010_DETAIL_CORP_REG_NO').attr('readonly', true);
246
+            // $('#ITP_FORM_POMNG07010_DETAIL_SEARCH_AFFL_SHOP').attr('disabled', true);
247
+            // $('#ITP_FORM_POMNG07010_DETAIL_DELETE_AFFL_SHOP').attr('disabled', true);
248
+            $('#ITP_FORM_POMNG07010_DETAIL_SEARCH_AFFL_SHOP').hide();
249
+            $('#ITP_FORM_POMNG07010_DETAIL_DELETE_AFFL_SHOP').hide();
250
+			$('#ITP_FORM_POMNG07010_DETAIL .itp_form_info').show();
251
+			$('#ITP_FORM_POMNG07010_DETAIL .itp_form_change').hide();
252
+
253
+            $('#ITP_FORM_POMNG07010_DETAIL #ITP_FORM_POMNG07010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
254
+        } else if(mode == 'VIEW') { // 보기
255
+            $('#ITP_AJAX_POMNG07010_VIEW_CONTAINER').show();
256
+            fn_show_btn_auth_array(['#ITP_BTN_POMNG07010_MODIFY', '#ITP_BTN_POMNG07010_CANCELLIST']);
257
+        }*/
258
+    }
259
+}
260
+
261
+
262
+/*목록화면 Object*/
263
+let listObj = {
264
+	init: function() {
265
+		this.grid.init();
266
+		this.action();
267
+	},
268
+	itp_POMNG07010_param: {},
269
+	itp_POMNG07010_search: false,
270
+	button: {
271
+		search: function() {
272
+			listObj.itp_POMNG07010_search = true;
273
+			let param = $('#ITP_FORM_POMNG07010_SEARCH').serializeObject();
274
+			param.gridSize = $.jgrid.defaults.rowNum;
275
+            param.gridPage = $.jgrid.defaults.page;
276
+            console.log(JSON.stringify(param));
277
+            $(POMNG07010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
278
+        }
279
+	},
280
+	empty: {
281
+		init: function() {
282
+			var _this = this;
283
+            this.push();
284
+            $(POMNG07010_GRID_EMPTY).on('click', function() {
285
+                _this.back();
286
+                listObj.itp_POMNG07010_param.gridSize = $.jgrid.defaults.rowNum;
287
+                $(POMNG07010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_POMNG07010_param)}).trigger('reloadGrid');
288
+            });
289
+		},
290
+		push: function() {
291
+            let param = $('#ITP_FORM_POMNG07010_SEARCH').serializeObject();
292
+            listObj.itp_POMNG07010_param = param;
293
+        },
294
+        back: function() {
295
+            $('#ITP_FORM_POMNG07010_SERVICE_BRAND_TYPE').val(listObj.itp_POMNG07010_param.brandType);
296
+            $('#ITP_FORM_POMNG07010_SERVICE_ST_CD').val(listObj.itp_POMNG07010_param.stCd);
297
+            $('#ITP_FORM_POMNG07010_SEARCH_BRAND_NM').val(listObj.itp_POMNG07010_param.brandNm);
298
+        	console.log('here');
299
+        	console.log(listObj.itp_POMNG07010_param);            
300
+        }
301
+	},
302
+	grid: {
303
+		init: function() {
304
+			// 데이터 없을때
305
+            listObj.empty.push();
306
+            this.search();
307
+		},
308
+		colModel: gridColModel.list,
309
+		search: function() {
310
+			pageObj.switchScreen('LIST');
311
+			this.unload();
312
+			this.load();
313
+		},
314
+		load: function() {
315
+            let param = $('#ITP_FORM_POMNG07010_SEARCH').serializeObject();
316
+            param.gridSize = $.jgrid.defaults.rowNum;
317
+            console.log(JSON.stringify(param));
318
+            var option = {
319
+            	gridId: POMNG07010_GRID_ID,
320
+            	colModel: gridColModel.list,
321
+            	param: param,
322
+            	url: DOMAIN + API_POMNG_INOUTMNG_WAREHOUSE_GRID_LIST,
323
+            	pager: POMNG07010_GRID_PAGER,
324
+            	rownumbers: false,
325
+            	/*onCellSelect: function(rowId, cellIdx, cellValue) {
326
+                    var cm = $(this).jqGrid('getGridParam', 'colModel');
327
+                    var colNm = cm[cellIdx].name;
328
+                    if (colNm === 'pchPodrUnqNo') {
329
+                        const pchPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'pchPodrUnqNo');
330
+                        const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
331
+                        const spplyIdVal = LOGIN_USER_INFO.spplyId;
332
+                        const key = {pchPodrUnqNo: pchPodrUnqNoVal, brandId: brandIdVal, spplyId: spplyIdVal};
333
+                        var param = $.param(key);
334
+                        viewObj.init(param);
335
+                    }
336
+				},*/
337
+				loadComplete: function(data) {
338
+					console.log(data);
339
+                    itp_fn_grid_load_complete(data, POMNG07010_GRID_ID, true, 'number', 'POMNG07010', listObj.itp_POMNG07010_search, listObj.empty, true, data.gridRecords, true);
340
+                    var ids = $(POMNG07010_GRID_ID).getDataIDs();
341
+                    $.each(ids, function(idx, rowId) {
342
+                        $(POMNG07010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
343
+                    });
344
+				},
345
+				onPaging: function(action) {
346
+                    itp_fn_grid_paging(POMNG07010_GRID_ID, action, param);
347
+                }
348
+            };
349
+            itp_fn_grid_make_remote(option);
350
+		},
351
+		clearData: function() {
352
+			$(POMNG07010_GRID_ID).jqGrid('clearGridData', true);
353
+            $(POMNG07010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
354
+            $(POMNG07010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
355
+            $(POMNG07010_GRID_EMPTY).show();
356
+		},
357
+		unload: function() {
358
+			$.jgrid.gridUnload(POMNG07010_GRID_ID);
359
+		}
360
+	},
361
+	action: function() {
362
+		var _this = this;
363
+		// 공급업체 조회 버튼 클릭
364
+		$('#ITP_BTN_POMNG07010_SEARCH_SPPLY_ID').on('click', function() {
365
+			_this.popup('spply');
366
+		});
367
+		// 공급업체 텍스트 삭제 버튼 클릭
368
+		$('#ITP_BTN_POMNG07010_DELETE_SPPLY_ID').on('click', function() {
369
+			$('#ITP_FORM_POMNG07010_DETAIL_SPPLY_NM').val('');
370
+			$('#ITP_FORM_POMNG07010_DETAIL_SPPLY_ID').val('');
371
+		});
372
+		// 매장/창고 조회 버튼 클릭
373
+		$('#ITP_BTN_POMNG07010_SEARCH_WHS_ID').on('click', function() {
374
+			_this.popup('whs');
375
+		});
376
+		// 매장/창고 텍스트 삭제 버튼 클릭
377
+		$('#ITP_BTN_POMNG07010_DELETE_WHS_ID').on('click', function() {
378
+			$('#ITP_FORM_POMNG07010_DETAIL_WHS_NM').val('');
379
+			$('#ITP_FORM_POMNG07010_DETAIL_WHS_ID').val('');
380
+		});
381
+	},
382
+	popup: function(keyword) {
383
+		var popFn = this.callback.create;
384
+		// const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
385
+		if(keyword === 'spply'){
386
+			fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, /*key*/null, 'S');
387
+		} else if(keyword === 'whs'){
388
+			fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, /*key*/null, 'S');
389
+		}
390
+	},
391
+	callback: {
392
+		create: function(rowDataPop) {
393
+			console.log(rowDataPop);
394
+			console.log(Array.isArray(rowDataPop));
395
+			if(rowDataPop.hasOwnProperty('whsId') == false) {
396
+				console.log(rowDataPop.spplyId);
397
+				$('#ITP_FORM_POMNG07010_DETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
398
+				$('#ITP_FORM_POMNG07010_DETAIL_SPPLY_ID').val(rowDataPop.spplyId);
399
+				//console.log(rowDataPop[0].storeId);
400
+				//$('#ITP_FORM_POMNG07010_DETAIL_STORE_NM').val(rowDataPop[0].storeNm);
401
+				//$('#ITP_FORM_POMNG07010_DETAIL_STORE_ID').val(rowDataPop[0].storeId);
402
+			} else {
403
+				console.log(rowDataPop);
404
+				console.log(rowDataPop.whsId);
405
+				$('#ITP_FORM_POMNG07010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
406
+				$('#ITP_FORM_POMNG07010_DETAIL_WHS_ID').val(rowDataPop.whsId);
407
+			}
408
+		}
409
+	}
410
+}
411
+console.log(CONN_KEY);

+ 1 - 1
src/main/webapp/js/app/stinfo/ITP_STINFO06010.js

@@ -547,7 +547,7 @@ let createObj = {
547 547
 				$.each(changeRows, function (index, item) {
548 548
 					if(item.viewCd === 'C') {
549 549
 						gridInsertData.push(item);
550
-					} else if(item.viewCd == 'U') {
550
+					} else if(item.viewCd === 'U') {
551 551
 						gridUpdateData.push(item);
552 552
 					}
553 553
 					// if(pageObj.screenMode === 'ADD') {