Browse Source

반품현황 개발중

marseyes 2 years ago
parent
commit
e7d5870428

+ 13 - 11
src/main/webapp/app/rtnmng/RTNMNG06010.html

@@ -13,35 +13,37 @@
13 13
 						<div class="itp_srh_border fix">
14 14
 							<div class="col-xs-12">
15 15
 								<form id="ITP_FORM_RTNMNG06010_SEARCH" class="form-horizontal">
16
+									<input type="hidden" id="ITP_FORM_RTNMNG06010_SEARCH_SBRAND_ID" name="sbrandId" value="">
17
+									<input type="hidden" id="ITP_FORM_RTNMNG06010_SEARCH_SSTORE_ID" name="sstoreId" value="">
18
+									<input type="hidden" id="ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_ID" name="sspplyId" value="">	<!-- 공급업체 -->
19
+								
16 20
 									<div class="form-group">
17 21
 										<div class="col-xs-1 itp_ip itp_noMar" style="width:10.7%;">
18
-											<select id="ITP_FORM_RTNMNG06010_SERVICE_COL_DT" class="form-control itp_input" name="servicecolDt">
19
-												<option value="A">수거일*</option>											
22
+											<select id="ITP_FORM_RTNMNG06010_SERVICE_COL_DT" class="form-control itp_input">
23
+												<option value="A">수거일</option>											
20 24
 											</select>
21 25
 										</div>
22 26
 										<div class="col-xs-3 itp_ip itp_noMar">
23 27
 											<div class="input-daterange input-group date">
24
-												<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_COL_REQ_DT" class="form-control itp_input" name="colReqDt" value="">
28
+												<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_FROM_DT" class="form-control itp_input" name="fromDt" value="">
25 29
 												<span class="input-group-addon itp_date_to">~</span>
26
-												<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_COL_DT" class="form-control itp_input" name="colDt" value="">
30
+												<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_TO_DT" class="form-control itp_input" name="toDt" value="">
27 31
 											</div>
28 32
 										</div>
29 33
 										<div class="col-xs-2 itp_ip itp_noMar">
30
-											<select id="ITP_FORM_RTNMNG06010_SEARCH_BRAND_NM" class="form-control itp_input" name="sBrandNm">
31
-												<option value="A">브랜드*</option>											
32
-											</select>
34
+											
33 35
 										</div>
34 36
 										<div class="col-xs-5 itp_ip itp_noMar">
35
-											<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_RTN_REQ_DTL_NO" class="form-control itp_input" name="sRtnReqDtlNo" placeholder="반품요청번호" />
37
+											
36 38
 										</div>
37 39
 									</div>
38 40
 									<div class="form-group" style="padding-top: 10px; border-top: 1px dotted #ccc;">
39 41
 										<div class="col-xs-2 itp_ip itp_noMar">
40
-											<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_SPPLY_NM" class="form-control itp_input" name="sSpplyNm" placeholder="공급업체" />
42
+											<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_NM" class="form-control itp_input" placeholder="공급업체" />
41 43
 										</div>
42 44
 										<div class="col-xs-1 itp_in" style="width:8%; padding:0px;">
43
-											<button type="button" id="ITP_BTN_RTNMNG06010_SEARCH_SRH" 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_RTNMNG06010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
45
+											<button type="button" id="ITP_BTN_RTNMNG06010_SEARCH_POP_SSPPLY_NM" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
46
+											<button type="button" id="ITP_BTN_RTNMNG06010_SEARCH_DEL_SSPPLY_NM" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
45 47
 						                </div>
46 48
 										<div class="col-xs-2 itp_ip itp_noMar">
47 49
 											<input type="text" id="ITP_FORM_RTNMNG06010_SEARCH_STORE_NM" class="form-control itp_input" name="sStoreNm" placeholder="매장/창고" />

+ 367 - 0
src/main/webapp/js/app/rtnmng/ITP_RTNMNG06010.js

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