Pārlūkot izejas kodu

재고관리 개발중

marseyes 2 gadi atpakaļ
vecāks
revīzija
0c5a5e280f

+ 32 - 27
src/main/webapp/app/stockmng/STOCKMNG01010.html

@@ -2,7 +2,7 @@
2 2
 	<div class="itp_cont">
3 3
 		<article class="itp_detail">
4 4
 			<div class="itp_det_head fix">
5
-				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>재고 관리-팝업있음</strong></h2>
5
+				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>재고 관리</strong></h2>
6 6
 				<div class="pull-right itp_cicon">
7 7
 					<button type="button" id="ITP_BTN_STOCKMNG01010_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon"></i>&nbsp;&nbsp;조회&nbsp;&nbsp;</button>
8 8
 				</div>					
@@ -13,53 +13,58 @@
13 13
 						<div class="itp_srh_border fix">
14 14
 							<div class="col-xs-12">
15 15
 								<form id="ITP_FORM_STOCKMNG01010_SEARCH" class="form-horizontal">
16
+									<input type="hidden" id="ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID" name="sbrandId" value="">
17
+									<input type="hidden" id="ITP_FORM_STOCKMNG01010_SEARCH_STORE_ID" name="sstoreId" value="">
18
+								
16 19
 									<div class="form-group">
17 20
 										<div class="col-xs-10">
18 21
 											<div class="col-xs-2 itp_ip itp_noMar">
19
-												<select id="ITP_FORM_STOCKMNG01010_SERVICE_WHS_MGNT_BASE_INFO" class="form-control itp_input" name="serviceswhsMgntBaseInfo">
22
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_WHS_ID" class="form-control itp_input" name="swhsId">
20 23
 													<option value="">창고</option>											
21 24
 												</select>	
22 25
 											</div>
23 26
 											<div class="col-xs-3 itp_ip itp_noMar">
24
-												<select id="ITP_FORM_STOCKMNG01010_SEARCH_WHS_MGNT_BASE_LOC" class="form-control itp_input" name="sWhsMgntBaseLoc">
27
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_LOCATION" class="form-control itp_input" name="slocation">
25 28
 													<option value="">판매용/B품/폐기품</option>											
26 29
 												</select>										
27 30
 											</div>
28 31
 										</div>
29 32
 									</div>
30 33
 									<div class="form-group" style="padding-top: 10px; border-top: 1px dotted #ccc;">
31
-										<div class="col-xs-1 itp_in" style="width:14%; padding:0px;">
32
-											<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS1" class="form-control itp_input" name="sItemClass1">
33
-												<option value="">품목분류Level1</option>											
34
-											</select>										
35
-										</div>
36
-										<div class="col-xs-1 itp_in" style="width:14%; padding:0px;">
37
-											<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS2" class="form-control itp_input" name="sItemClass2">
38
-												<option value="">품목분류Level2</option>											
39
-											</select>										
40
-										</div>
41
-										<div class="col-xs-1 itp_in" style="width:14%; padding:0px;">
42
-											<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS3" class="form-control itp_input" name="sItemClass3">
43
-												<option value="">품목분류Level3</option>											
44
-											</select>										
45
-										</div>
46
-										<div class="col-xs-1 itp_in" style="width:14%; padding:0px;">
47
-											<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS4" class="form-control itp_input" name="sItemClass4">
48
-												<option value="">품목분류Level4</option>											
49
-											</select>										
50
-										</div>
51
-										<div class="col-xs-4 itp_in">
52
-											<input type="text" id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_NM" class="form-control itp_input" name="sItemNm" placeholder="품목번호 or 품목명" />
34
+										<div class="col-xs-10">
35
+											<div class="col-xs-2 itp_ip itp_noMar">
36
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS1" class="form-control itp_input" name="sitemClass1">
37
+													<option value="">품목분류Level1</option>											
38
+												</select>										
39
+											</div>
40
+											<div class="col-xs-2 itp_ip itp_noMar">
41
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS2" class="form-control itp_input" name="sitemClass2">
42
+													<option value="">품목분류Level2</option>											
43
+												</select>										
44
+											</div>
45
+											<div class="col-xs-2 itp_ip itp_noMar">
46
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS3" class="form-control itp_input" name="sitemClass3">
47
+													<option value="">품목분류Level3</option>											
48
+												</select>										
49
+											</div>
50
+											<div class="col-xs-2 itp_ip itp_noMar">
51
+												<select id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_CLASS4" class="form-control itp_input" name="sitemClass4">
52
+													<option value="">품목분류Level4</option>											
53
+												</select>										
54
+											</div>
55
+											<div class="col-xs-4 itp_in itp_noMar">
56
+												<input type="text" id="ITP_FORM_STOCKMNG01010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="품목번호 or 품목명" />
57
+											</div>
53 58
 										</div>							
54 59
 									</div>
55 60
 								</form>
56 61
 							</div>
57 62
 						</div>
58 63
 					</div>
59
-					<div class="fix" style="padding-right:10px;">
64
+					<div class="fix" style="padding-right:16px;">
60 65
 						<div class="pull-right itp_cicon">
61 66
 							<button type="button" id="ITP_BTN_STOCKMNG01010_ADDROW" class="btn btn-primary btn-sm IPS" style="display: inline-block;"><i class="glyphicon"></i>&nbsp;&nbsp;재고처리&nbsp;&nbsp;</button>
62
-							<button type="button" id="ITP_BTN_STOCKMNG01010_DELROW" class="btn btn-danger btn-sm "><i class="glyphicon"></i>&nbsp;&nbsp;재고이력&nbsp;&nbsp;</button>									
67
+							<button type="button" id="ITP_BTN_STOCKMNG01010_DELROW" class="btn btn-primary btn-sm IPS"><i class="glyphicon"></i>&nbsp;&nbsp;재고이력&nbsp;&nbsp;</button>									
63 68
 						</div>
64 69
 					</div>
65 70
 					<div class="itp_table fix">

+ 272 - 0
src/main/webapp/js/app/stockmng/ITP_STOCKMNG01010.js

@@ -0,0 +1,272 @@
1
+/********************************************************
2
+ --------------------------------------------------------
3
+ - Object 목록								            -
4
+ --------------------------------------------------------
5
+ * const gridColModel = {}	: 화면 Grid Object			*
6
+ * let pageObj = {}			: 화면공통 Object			*
7
+ * let listObj = {}			: 목록화면 Object			*
8
+ * let viewObj = {}			: 상세화면 Object			*
9
+ * let modifyObj = {}		: 수정화면 Object			*
10
+ * let createObj = {}		: 신규화면 Object			*
11
+ * let locInfoObj = {}		: 로케이션정보 Object				*
12
+ *******************************************************/
13
+
14
+/*화면 변수*/
15
+const STOCKMNG01010_GRID_ID = '#ITP_STOCKMNG01010_jqGrid';
16
+const STOCKMNG01010_GRID_LIST = '#ITP_STOCKMNG01010_jqGrid_list';
17
+const STOCKMNG01010_GRID_PAGER = '#ITP_STOCKMNG01010_jqGridPager';
18
+const STOCKMNG01010_GRID_EMPTY = '#ITP_STOCKMNG01010_jqGridEmpty';
19
+
20
+let ITP_FORM_STOCKMNG01010_DETAIL_IS_DUPLICATE = false;
21
+let ITP_FORM_STOCKMNG01010_DETAIL_IS_WRITING = false;
22
+let STOCKMNG01010_DETAIL_GRID_LAST_ROW_ID;
23
+
24
+/*API URL*/
25
+let STOCK_MNG_DETAIL_GRID_LIST = '/api/stock/mng/detail-grid-list';
26
+let WHS_MNG_ADD_WHS = '/api/whs/mng/add-whs';
27
+
28
+/*화면 Grid ColModel*/
29
+const gridColModel = {
30
+	list: [
31
+		{
32
+			index: 'BRAND_ID', name: 'brandId',
33
+			label: "브랜드ID", 
34
+			width: '0', fixed: false, align: 'center',
35
+			sortable: false, hidden: true
36
+		},
37
+		{
38
+			index: 'STORE_ID', name: 'storeId',
39
+			label: "매장ID", 
40
+			width: '0', fixed: false, align: 'center',
41
+			sortable: false, hidden: true
42
+		},
43
+		{
44
+			index: 'BRAND_NM', name: 'brandNm',
45
+			label: ITP_MSG_LOCALE.label.brandNm, //브랜드
46
+			width: '13', fixed: false, align: 'center',
47
+			sortable: false, hidden: false
48
+		},
49
+		{
50
+			index: 'STORE_NM', name: 'storeNm',
51
+			label: "매장명", 
52
+			width: '13', fixed: false, align: 'center',
53
+			sortable: false, hidden: false
54
+		},
55
+		{
56
+			index: 'WHS_ID', name: 'whsId',
57
+			label: "창고번호", 
58
+			width: '8', fixed: false, align: 'center',
59
+			sortable: false, hidden: false
60
+		},
61
+		{
62
+			index: 'WHS_NM', name: 'whsNm',
63
+			label: "창고명", 
64
+			width: '13', fixed: false, align: 'center',
65
+			sortable: false, hidden: false
66
+		},
67
+		{
68
+			index: 'WHS_ST_NM', name: 'whsStNm',
69
+			label: ITP_MSG_LOCALE.label.status, //상태
70
+			width: '6', fixed: false, align: 'center',
71
+			sortable: false, hidden: false
72
+		},
73
+		{
74
+			index: 'MGR_NM', name: 'mgrNm',
75
+			label: "담당자명", 
76
+			width: '8', fixed: false, align: 'center',
77
+			sortable: false, hidden: false
78
+		},
79
+		{
80
+			index: 'MGR_TEL_NO', name: 'mgrTelNo',
81
+			label: "연락처", 
82
+			width: '8', fixed: false, align: 'center',
83
+			sortable: false, hidden: false
84
+		}
85
+	]
86
+};
87
+
88
+require(['config'], function() {
89
+	require([
90
+	], function($) {
91
+		pageObj.init();
92
+	});
93
+});
94
+
95
+/*화면공통 Object*/
96
+let pageObj = {
97
+	init: function () {
98
+		this.ui.init();
99
+		this.event.init();
100
+	},
101
+	ui: {
102
+		init: function () {
103
+			this.view();
104
+			this.grid();
105
+			this.ready();
106
+		},
107
+		view: function() {
108
+			// 버튼 권한설정
109
+			fn_proc_btn_auth('STOCKMNG01010');
110
+			
111
+			// 브랜드ID 지정
112
+			var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
113
+			$('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
114
+			
115
+			// 공통코드 표시
116
+			// fn_make_select(CODE_LIST, 'WHS_DVSN', 'ITP_FORM_STOCKMNG01010_WHS_DVSN');			
117
+			// fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_WHS_ST_CD');
118
+			// fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_DETAIL_WHS_ST_CD', true, '선택');
119
+
120
+			// 조회일자 지정
121
+			$('#ITP_TAB_STOCKMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);			
122
+		},
123
+		grid: function() {
124
+			itp_fn_jqgrid_resize(STOCKMNG01010_GRID_ID, STOCKMNG01010_GRID_LIST, 'lg');
125
+			listObj.empty.init();
126
+			itp_fn_fire_window_resize();
127
+		},
128
+		ready: function() {
129
+			listObj.init();
130
+		}
131
+	},
132
+	event: {
133
+		init: function () {
134
+			this.button();
135
+		},
136
+		button: function () {
137
+			// 버튼 클릭 이벤트
138
+			$('button').each(function() {
139
+				var id = $(this).attr('id');
140
+				$(this).on('click', function() {
141
+					switch (id) {
142
+						case 'ITP_BTN_STOCKMNG01010_SRH'		: listObj.button.search();		break;	// 조회 버튼
143
+						case 'ITP_BTN_STOCKMNG01010_ADDROW'		: locInfoObj.button.addRow();	break;	// 재고처리 버튼
144
+						case 'ITP_BTN_STOCKMNG01010_DELROW'		: locInfoObj.button.delRow();	break;	// 재고이력 버튼
145
+					}
146
+				});
147
+			});
148
+
149
+			$('body').on('click', function(e) {
150
+				
151
+			});
152
+
153
+		}
154
+	},
155
+	switchScreen: function(mode) {
156
+		if(mode == 'LIST') { // 목록			
157
+			fn_show_btn_auth('#ITP_BTN_STOCKMNG01010_SRH');
158
+
159
+			$('#ITP_AJAX_STOCKMNG01010_LIST_CONTAINER').show();
160
+		}
161
+	}
162
+};
163
+
164
+/*목록화면 Object*/
165
+let listObj = {
166
+	init: function () {
167
+		this.grid.init();
168
+	},
169
+	itp_STOCKMNG01010_search: false,
170
+	button: {
171
+		search: function() {
172
+			listObj.itp_STOCKMNG01010_search = true;
173
+			let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
174
+			param.gridSize = $.jgrid.defaults.rowNum;
175
+			param.gridPage = $.jgrid.defaults.page;
176
+			$(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
177
+		},
178
+		create: function() {
179
+			pageObj.switchScreen('ADD');			
180
+			itp_fn_form_clear_validate(null, '#ITP_FORM_STOCKMNG01010_DETAIL');						
181
+			// 로케이션 리스트 조회
182
+			createObj.init();
183
+		}
184
+	},
185
+	empty: {
186
+		init: function() {
187
+			var _this = this;
188
+			this.push();
189
+			$(STOCKMNG01010_GRID_EMPTY).on('click', function() {
190
+				_this.back();
191
+				_this.itp_STOCKMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
192
+				$(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_STOCKMNG01010_param)}).trigger('reloadGrid');
193
+			});
194
+		},
195
+		itp_STOCKMNG01010_param: {},
196
+		push: function() {
197
+			let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
198
+			listObj.itp_STOCKMNG01010_param = param;
199
+		},
200
+		back: function() {
201
+			$('#ITP_FORM_STOCKMNG01010_DEVI_TP_CD').val(this.itp_STOCKMNG01010_param.deviTpCd);
202
+			$('#ITP_FORM_STOCKMNG01010_ORDER_YN').val(this.itp_STOCKMNG01010_param.orderYn);
203
+			$('#ITP_FORM_STOCKMNG01010_ADT_AUTH_CD').val(this.itp_STOCKMNG01010_param.adtAuthCd);
204
+			$('#ITP_FORM_STOCKMNG01010_EMAIL_RCV_YN').val(this.itp_STOCKMNG01010_param.emailRcvYn);
205
+			$('#ITP_FORM_STOCKMNG01010_MEMB_EXIT_DT').val(this.itp_STOCKMNG01010_param.membExitDt);
206
+			$('#ITP_FORM_STOCKMNG01010_FROM_DT').val(this.itp_STOCKMNG01010_param.fromDt);
207
+			$('#ITP_FORM_STOCKMNG01010_TO_DT').val(this.itp_STOCKMNG01010_param.toDt);
208
+			$('#ITP_FORM_STOCKMNG01010_KEYWORD').val(this.itp_STOCKMNG01010_param.keyword);
209
+		}
210
+	},
211
+	grid: {
212
+		init: function () {
213
+			// 데이터 없을때
214
+			listObj.empty.push();
215
+			this.search();
216
+		},
217
+		colModel: gridColModel.list,
218
+		search: function() {
219
+			pageObj.switchScreen('LIST');
220
+			this.unload();
221
+			this.load();
222
+		},
223
+		load: function() {
224
+			var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
225
+			$('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
226
+			
227
+			let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
228
+			param.gridSize = $.jgrid.defaults.rowNum;
229
+
230
+			var option = {
231
+				gridId: STOCKMNG01010_GRID_ID,
232
+				colModel: gridColModel.list,
233
+				param: JSON.stringify(param),
234
+				url: DOMAIN + STOCK_MNG_DETAIL_GRID_LIST,
235
+				pager: STOCKMNG01010_GRID_PAGER,
236
+				onCellSelect: function(rowId, cellIdx, cellValue) {
237
+					var cm = $(this).jqGrid('getGridParam', 'colModel');
238
+					var colNm = cm[cellIdx].name;
239
+					if (colNm == 'whsNm') {
240
+						const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
241
+						const whsIdVal = $(this).jqGrid('getCell', rowId, 'whsId');
242
+						
243
+						const key = {brandId: brandIdVal, whsId: whsIdVal, viewCd: 'R'};
244
+						var param = $.param(key);
245
+						viewObj.init(param);
246
+					}
247
+				},
248
+				loadComplete: function(data) {
249
+					console.log(data);
250
+					itp_fn_grid_load_complete(data, STOCKMNG01010_GRID_ID, true, 'number', 'STOCKMNG01010', listObj.itp_STOCKMNG01010_search, listObj.empty, true, data.gridRecords, true);
251
+					var ids = $(STOCKMNG01010_GRID_ID).getDataIDs();
252
+					$.each(ids, function(idx, rowId) {
253
+						$(STOCKMNG01010_GRID_ID).jqGrid('setCell', rowId, 'whsNm', '', ITP_GRID_COL_STYLE.link);
254
+					});
255
+				},
256
+				onPaging: function(action) {
257
+					itp_fn_grid_paging(STOCKMNG01010_GRID_ID, action, param);
258
+				}
259
+			};
260
+			itp_fn_grid_make_remote(option);
261
+		},
262
+		clearData : function() {
263
+			$(STOCKMNG01010_GRID_ID).jqGrid('clearGridData', true);
264
+			$(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
265
+			$(STOCKMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
266
+			$(STOCKMNG01010_GRID_EMPTY).show();
267
+		},
268
+		unload : function() {
269
+			$.jgrid.gridUnload(STOCKMNG01010_GRID_ID);
270
+		}
271
+	}
272
+};