Browse Source

모바일 재고관리 > 재고실사 작업 중

juney 2 years ago
parent
commit
7c350e5d8b

+ 51 - 13
src/main/webapp/mobile/app/mstockmng/MSTOCKMNG02010.html

@@ -1,22 +1,23 @@
1 1
 <section id="ITP_MOBILE_MSTOCKMNG02010">
2 2
 	<div id="ITP_AJAX_MSTOCKMNG02010_LIST_CONTAINER">
3
-	 <form id="ITP_FORM_MSTOCKMNG02010_LIST" class="form-horizontal" onsubmit="return false;">
4
-		<input type="hidden" id="ITP_FORM_MSTOCKMNG02010_LIST_VIEW_CD" name="viewCd" value="C">
3
+	 <form id="ITP_FORM_MSTOCKMNG02010_LIST_SEARCH" class="form-horizontal" onsubmit="return false;">
4
+		 <input type="hidden" id="ITP_FORM_MLOANMNG02010_LIST_SEARCH_BRAND_ID" name="sbrandId" value="">
5
+		 <input type="hidden" id="ITP_FORM_MLOANMNG02010_LIST_SEARCH_STORE_ID" name="sstoreId" value="">
5 6
 		  <div class="content">
6 7
 			<div class="line">
7 8
 			  <label>재고실사일자</label>
8 9
 			  <div class="line_right">
9
-				<input id="ITP_FORM_MSTOCKMNG02010_LIST_STCK_DT" class="date" type="date">
10
+				<input id="ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_STCK_DT" name="sDt" class="date" type="date">
10 11
 			  </div>
11 12
 			</div>
12 13
 			<div class="line">
13 14
 			  <label>창고선택</label>
14 15
 			  <div class="search_wrap">
15 16
 				  <div class="float_left">
16
-					<input id="ITP_FORM_MSTOCKMNG02010_LIST_WHS_NM" name="whsNm" type="text" placeholder="A매장명">
17
+					<input id="ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_WHS_NM" name="whsNm" type="text" placeholder="창고명">
17 18
 				  </div>
18 19
 				  <div class="float_left_btn">
19
-					  <button id="ITP_BTN_MSTOCKMNG02010_LIST_SEARCH_WHS_NM" data-call-popup="ITP_POP_MSTOCKMNG02010_WHS_AREA"><img src="../img/search.png" alt=""></button>
20
+					  <button id="ITP_BTN_MSTOCKMNG02010_LIST_SEARCH_WHS_NM"><img src="../img/search.png" alt=""></button>
20 21
 					   <button id="ITP_BTN_MSTOCKMNG02010_LIST_DELETE_WHS_NM"><img src="../img/delete.png" alt=""></button>
21 22
 				  </div>
22 23
 			  </div>
@@ -24,7 +25,7 @@
24 25
 			<div class="line">
25 26
 			  <label>Location</label>
26 27
 			  <div class="line_right">
27
-				<select name="whsDvsn" id="ITP_FORM_MSTOCKMNG02010_LIST_WHS_DVSN">
28
+				<select name="whsDvsn" id="ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_LOCATION">
28 29
 				  <option value=""></option>
29 30
 				</select>
30 31
 			  </div>
@@ -39,10 +40,10 @@
39 40
 			  <button id="ITP_BTN_MSTOCKMNG02010_LIST_BARCODE" class="btn-primary btn-sm ADB">바코드</button>
40 41
 			</div>
41 42
 		  </div>
42
-			<div id="ITP_LIST_MSTOCKMNG02010_ITEM_AREA" class="scroll_area row-2">
43
-			  <ul id="ITP_LIST_MSTOCKMNG02010_LIST_ROWS" class="panel-group"></ul>
44
-			  <div id="ITP_LIST_MSTOCKMNG02010_LIST_ROWCOPY" style="display:none;">
45
-				<li class="history_list5">
43
+			<div id="ITP_LIST_MSTOCKMNG02010_LIST_ITEM_AREA" class="scroll_area row-2">
44
+			  <ul id="ITP_LIST_MSTOCKMNG02010_LIST_ITEM_ROWS" class="panel-group"></ul>
45
+			  <div id="ITP_LIST_MSTOCKMNG02010_LIST_ITEM_ROWCOPY" style="display:none;">
46
+				<li class="history_list5 list-row">
46 47
 				  <div>
47 48
 					<div class="left">
48 49
 					  <div class="nomal">
@@ -76,9 +77,9 @@
76 77
 						</div>
77 78
 						<label class="col_6">실사수량&nbsp;:</label>
78 79
 						<div class="btn_bar">
79
-						  <button id="ITP_BTN_MSTOCKMNG02010_LIST_QTY"><</button>
80
+						  <button id="ITP_BTN_MSTOCKMNG02010_LIST_QTY+MINUS"><</button>
80 81
 						  <div class="fn col_0">2</div>
81
-						  <button id="ITP_BTN_MSTOCKMNG02010_LIST_QTY">></button>
82
+						  <button id="ITP_BTN_MSTOCKMNG02010_LIST_QTY_PLUS">></button>
82 83
 						</div>
83 84
 					  </div>
84 85
 					</div>
@@ -93,7 +94,7 @@
93 94
 	  </form>
94 95
 	</div>
95 96
 	<div id="ITP_MOBILE_JS"></div>
96
-	<div id="ITP_POP_MSTOCKMNG02010_BARCODE_AREA" class="popup2" style="display: block;">
97
+	<div id="ITP_POP_MSTOCKMNG02010_BARCODE_AREA" class="popup2" style="display: none;">
97 98
 		<div class="barcode">
98 99
 			<h1>바코드를 스캔 하시면 재고  실사 목록에 스캔한<br>바코드의품목이 추가 되고 실사 수량을 입력<br>하시기 바랍니다.</h1>
99 100
 		</div>
@@ -104,4 +105,41 @@
104 105
 			<button id="ITP_BTN_MSTOCKMNG02010_POP_CANCEL" class="btn-gray">취소</button>
105 106
 		</div>
106 107
 	</div>
108
+	<div id="ITP_POP_MSTOCKMNG02010_WHS_AREA" class="popup2 mobile-pop-close" style="display: none;">
109
+		<div class="pop">
110
+			<div class="header">
111
+				<div class="header_left">
112
+					<label>> 납품장소</label>
113
+				</div>
114
+				<div class="header_right">
115
+					<button type="button" id="ITP_BTN_MSTOCKMNG02010_POP_WHS_CLOSE" class="btn-pop-close"><img src="../img/close.png"></button>
116
+				</div>
117
+			</div>
118
+			<div class="search_bar">
119
+				<form id="ITP_FORM_MSTOCKMNG02010_POP_WHS" class="form-horizontal" onsubmit="return false;">
120
+					<input type="hidden" id="ITP_FORM_MSTOCKMNG02010_WHS_ITEM_BRAND_ID" name="sbrandId" value="">
121
+					<input type="hidden" id="ITP_FORM_MSTOCKMNG02010_WHS_ITEM_STORE_ID" name="sstoreId" value="">
122
+					<input id="ITP_FORM_MSTOCKMNG02010_POP_WHS_KEYWORD" type="text" name="swhsNm" placeholder="납품장소명">
123
+					<button id="ITP_BTN_MSTOCKMNG02010_POP_WHS_SEARCH"><img src="../img/search.png"></button>
124
+				</form>
125
+			</div>
126
+			<div class="search_bar">
127
+				<button id="ITP_BTN_MSTOCKMNG02010_POP_WHS_NM" class="btn_blue">납품장소▼</button>
128
+			</div>
129
+			<div id="ITP_LIST_MSTOCKMNG02010_POP_WHS_AREA" class="popup_scroll">
130
+				<ul id="ITP_LIST_MSTOCKMNG02010_POP_WHS_ROWS" class="panel-group itp_nav"></ul>
131
+				<div id="ITP_LIST_MSTOCKMNG02010_POP_WHS_ROWCOPY" style="display:none;">
132
+					<li class="list-row">
133
+						<div class="scroll_left">
134
+							<div class="fnWhsNm">브랜드 창고 명A</div>
135
+							<div class="fnLocationNm">(상세위치내용)</div>
136
+						</div>
137
+						<div class="scroll_right">
138
+							<button id="ITP_BTN_MSTOCKMNG02010_POP_WHS_CHOICE" class="fnWhsId" data-whs-id="">선택</button>
139
+						</div>
140
+					</li>
141
+				</div>
142
+			</div>
143
+		</div>
144
+	</div>
107 145
   </section>

+ 262 - 0
src/main/webapp/mobile/js/app/mstockmng/ITP_MSTOCKMNG02010.js

@@ -0,0 +1,262 @@
1
+require(['config'], function() {
2
+	require([
3
+	], function($) {
4
+		mobPageObj.init();
5
+	});
6
+});
7
+
8
+/*API URL*/
9
+const API_MOBILE_GRID_LIST 			= '/api/stock/cdd/detail-grid-list';	// 목록
10
+const API_MOBILE_SAVE 				= '/api/stock/cdd/save-stock-cdd';		// 저장
11
+const API_MOBILE_LOCATION			= '/api/whs/mng/location-grid-list';	// 이력
12
+const API_POP_SEARCH_LIST			= '/api/whs/mng/detail-grid-list';
13
+
14
+const PAGE_MODE_LIST				= "LIST";
15
+const PAGE_MODE_VIEW				= "VIEW";
16
+
17
+let mobPageObj = {
18
+	viewMode: PAGE_MODE_LIST,
19
+	init: function () {
20
+		this.ui.init();
21
+		this.event.init();
22
+		this.ready();
23
+	},
24
+	ui: {
25
+		init: function () {
26
+			this.view();
27
+			this.info();
28
+		},
29
+		view: function() {
30
+			// 공통코드 표시
31
+			$('select').each(function() {
32
+				if($(this).data('select-code')) {
33
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
34
+				}
35
+			});
36
+
37
+			// 조회일자 지정
38
+			$('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_STCK_DT').val(itp_fn_date_add('M', 0));
39
+		},
40
+		info: function() {
41
+			$('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
42
+			$('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
43
+		}
44
+	},
45
+	event: {
46
+		init: function() {
47
+			this.button();
48
+		},
49
+		button: function() {
50
+			$('button[id^="ITP_BTN_MSTOCKMNG02010_LIST"]').on('click', function() {
51
+				var id = $(this).attr('id');
52
+				switch (id) {
53
+					case 'ITP_BTN_MSTOCKMNG02010_LIST_SEARCH_WHS_NM'	: mobPopObj.popWhsNm.init(); 		break;
54
+					case 'ITP_BTN_MSTOCKMNG02010_LIST_DELETE_WHS_NM'	: mobPopObj.popWhsNm.delete(); 		break;
55
+					case 'ITP_BTN_MSTOCKMNG02010_LIST_SEARCH'			: mobContentObj.list.search();		break;
56
+					case 'ITP_BTN_MSTOCKMNG02010_LIST_BARCODE'			: mobContentObj.list.barcode();		break;
57
+				}
58
+				return false;
59
+			});
60
+
61
+			$('button[id^="ITP_BTN_MSTOCKMNG02010_VIEW"]').on('click', function() {
62
+				var id = $(this).attr('id');
63
+				switch (id) {
64
+					case 'ITP_BTN_MSTOCKMNG02010_VIEW_SEARCH'		: mobContentObj.view.history.search();	break;
65
+					case 'ITP_BTN_MSTOCKMNG02010_VIEW_CANCEL_LIST'	: mobContentObj.view.cancel();			break;
66
+				}
67
+				return false;
68
+			});
69
+
70
+			$(document).on('click', '#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_ROWS li', function() {
71
+				var item = mobContentObj.list.rows[$(this).index()];
72
+				mobContentObj.view.init(item);
73
+			});
74
+
75
+			$(document).on('click', '#ITP_LIST_MSTOCKMNG02010_POP_STORE_ROWS li button', function() {
76
+				mobPopObj.popWhsNm.choice($(this));
77
+			});
78
+		}
79
+	},
80
+	switchScreen: function(mode) {
81
+		$('#ITP_MOBILE_MSTOCKMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
82
+			$(this).hide();
83
+		});
84
+		if(mode === PAGE_MODE_LIST) {
85
+			$('#ITP_AJAX_MSTOCKMNG02010_LIST_CONTAINER').show();
86
+			this.moreView(true);
87
+		} else if(mode === PAGE_MODE_VIEW) {
88
+			$('#ITP_AJAX_MSTOCKMNG02010_VIEW_CONTAINER').show();
89
+			this.moreView(false);
90
+		}
91
+		this.viewMode = mode;
92
+	},
93
+	moreView: function(isScroll) {
94
+		var _this = this;
95
+		if(isScroll) {
96
+			$('#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_AREA').on('scroll', function () {
97
+				if($(this).scrollTop() + $(this).innerHeight() + 1 >= $(this)[0].scrollHeight) {
98
+					if(mobContentObj.list.totPage > mobContentObj.list.listPage) {
99
+						if(!mobContentObj.list.isSearch) {
100
+							mobContentObj.list.load();
101
+						}
102
+					}
103
+				}
104
+			});
105
+		} else {
106
+			$('#ITP_LIST_MSTOCKMNG02010_LIST_AREA').off('scroll');
107
+		}
108
+	},
109
+	ready: function() {
110
+		mobContentObj.list.init();
111
+	}
112
+};
113
+
114
+let mobContentObj = {
115
+	list: {
116
+		listSize: 10,
117
+		listPage: 0,
118
+		totPage: 0,
119
+		isSearch: false,
120
+		rows: [],
121
+		init: function() {
122
+			mobPageObj.switchScreen(PAGE_MODE_LIST);
123
+			this.search();
124
+		},
125
+		search: function() {
126
+			this.listPage = 0;
127
+			this.totPage = 0;
128
+			this.rows.length = 0;
129
+			$('#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_ROWS').empty();
130
+			this.load();
131
+		},
132
+		load: function() {
133
+			var _this = this;
134
+			this.isSearch = true;
135
+			var callbackFn = function(result) {
136
+				console.log(result);
137
+				_this.isSearch = false;
138
+				_this.totPage = result.gridTotal;
139
+				$.each(result.gridRows, function (i, item) {
140
+					$('#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_AREA .panel-group').append($('#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_ROWCOPY').html());
141
+					var $li = $('#ITP_LIST_MSTOCKMNG02010_LIST_ITEM_AREA .panel-group > .list-row:last');
142
+					$li.find('.fnStoreNm').text(item.storeNm);
143
+					$li.find('.fnLoanDvsnNm').text(item.loanDvsnNm);
144
+					var limitAmt;
145
+					if(item.loanDvsn == 'LD01') { // 선불(충전)
146
+						limitAmt = item.chrgeLimitAmt;
147
+					} else if(item.loanDvsn == 'LD02') { // 후불(신용)
148
+						limitAmt = item.credtLimitAmt;
149
+					}
150
+					$li.find('.fnLimitAmt').text(CommonObj.currency.add(limitAmt));
151
+					$li.find('.fnPosbLimitAmt').text(CommonObj.currency.add(limitAmt - item.useAmtTotal));
152
+					$li.find('.fnTmpRcvAcctTotal').text(CommonObj.currency.add(item.tmpRcvAcctTotal));
153
+					$li.find('.fnUseAmtTotal').text(CommonObj.currency.add(item.useAmtTotal));
154
+					$li.find('.fnUseYnNm').text(item.useYnNm);
155
+					_this.rows.push(item);
156
+				});
157
+			};
158
+			var errFn = function() { _this.isSearch = false;};
159
+			const param = $('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH').serializeObject();
160
+			param.gridPage = ++this.listPage;
161
+			param.gridSize = this.listSize
162
+			// console.log(JSON.stringify(param));
163
+			fn_ajax_call(API_MOBILE_GRID_LIST, JSON.stringify(param), callbackFn, 'POST', errFn);
164
+		},
165
+		barcode: function() {
166
+			location.replace('app:barcode');
167
+			// location.href = 'app:barcode';
168
+		}
169
+	}
170
+};
171
+
172
+let mobPopObj = {
173
+	popWhsNm: {
174
+		popId: 'ITP_POP_MSTOCKMNG02010_WHS_AREA',
175
+		rows: [],
176
+		init: function () {
177
+			this.rows.length = 0;
178
+			mobPopObj.show(this.popId);
179
+			this.search();
180
+			this.action();
181
+		},
182
+		search: function () {
183
+			var _this = this;
184
+			$('#ITP_LIST_MSTOCKMNG02010_POP_WHS_AREA .panel-group').empty();
185
+			var callbackFn = function(result) {
186
+				console.log(result);
187
+				_this.view(result.gridRows);
188
+			};
189
+			const param = $('#ITP_FORM_MSTOCKMNG02010_POP_WHS').serializeObject();
190
+			console.log(JSON.stringify(param));
191
+			fn_ajax_call(API_POP_SEARCH_LIST, JSON.stringify(param), callbackFn, 'POST');
192
+		},
193
+		view: function(gridRows) {
194
+			this.rows = gridRows;
195
+			$.each(gridRows, function (i, item) {
196
+				$('#ITP_LIST_MSTOCKMNG02010_POP_WHS_AREA .panel-group').append($('#ITP_LIST_MSTOCKMNG02010_POP_WHS_ROWCOPY').html());
197
+				var $li = $('#ITP_LIST_MSTOCKMNG02010_POP_WHS_AREA .panel-group > .list-row:last');
198
+				$li.find('.fnWhsNm').text(item.whsNm);
199
+				$li.find('.fnLocationNm').text(item.locationNm);
200
+				$li.find('.fnWhsId').data('whs-id', item.whsId);
201
+			});
202
+		},
203
+		choice: function(elem) {
204
+			var _this = this;
205
+			var whsId = $(elem).data('whs-id');
206
+			$.each(this.rows, function (i, item) {
207
+				if(whsId === item.whsId) {
208
+					$('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH #ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_WHS_ID').val(item.whsId);
209
+					$('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH #ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_WHS_NM').val(item.whsNm);
210
+					_this.close();
211
+					_this.location(item.whsId);
212
+					return false;
213
+				}
214
+			});
215
+		},
216
+		location: function(whsId) {
217
+			var callbackFn = function(result) {
218
+				fn_make_select_location(result.gridRows, 'ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_LOCATION');
219
+			};
220
+			var param = {
221
+				'brandId': fn_make_user_info.get('brandId'),
222
+				'storeId': fn_make_user_info.get('storeId'),
223
+				'whsId': whsId
224
+			};
225
+			fn_ajax_call(API_MOBILE_LOCATION, JSON.stringify(param), callbackFn, 'POST');
226
+		},
227
+		action: function() {
228
+			var _this = this;
229
+			$('button[id^="ITP_BTN_MSTOCKMNG02010_POP_WHS"]').off('click').on('click', function() {
230
+				var id = $(this).attr('id');
231
+				switch (id) {
232
+					case 'ITP_BTN_MSTOCKMNG02010_POP_WHS_SEARCH'	: _this.search();			break;
233
+					case 'ITP_BTN_MSTOCKMNG02010_POP_WHS_CHOICE'	: _this.choice($(this)); 	break;
234
+					case 'ITP_BTN_MSTOCKMNG02010_POP_WHS_CLOSE'		: _this.close(); 			break;
235
+				}
236
+				return false;
237
+			});
238
+		},
239
+		delete: function() {
240
+			$('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH #ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_WHS_ID').val('');
241
+			$('#ITP_FORM_MSTOCKMNG02010_LIST_SEARCH #ITP_FORM_MSTOCKMNG02010_LIST_SEARCH_WHS_NM').val('');
242
+		},
243
+		close: function() {
244
+			this.rows.length = 0;
245
+			$('#ITP_POP_MSTOCKMNG02010_LIST_WHS_AREA .panel-group').empty();
246
+			$('#ITP_FORM_MSTOCKMNG02010_POP_WHS #ITP_FORM_MSTOCKMNG02010_POP_WHS_KEYWORD').val('');
247
+			mobPopObj.hide(this.popId);
248
+		}
249
+	},
250
+	show: function(popId) {
251
+		$('button[id$="_CLOSE"]').off('click').on('click', function() {
252
+			console.log($(this).attr('id'));
253
+			if($(this).hasClass('btn-pop-close')) {
254
+				mobPopObj.hide(popId);
255
+			}
256
+		});
257
+		$('#' + popId).show();
258
+	},
259
+	hide: function(popId) {
260
+		$('#' + popId).closest('.mobile-pop-close').hide();
261
+	}
262
+};

+ 14 - 0
src/main/webapp/mobile/js/config.js

@@ -312,6 +312,20 @@ function fn_make_select_store(options, select_id, all_show_yn, all_name, all_val
312 312
 	});
313 313
 }
314 314
 
315
+function fn_make_select_location(options, select_id, all_show_yn, all_name) { //위치 셀렉트 박스 만들기
316
+	$select_id = $('#' + select_id);
317
+	$select_id.empty();
318
+	if(all_show_yn == true) {
319
+		$('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
320
+	}
321
+	$.each(options, function(key, value) {
322
+		$('<option/>', {
323
+			'value': value.location,	// 로케이션
324
+			'text': value.locationNm	// 로케이션명
325
+		}).appendTo($select_id);
326
+	});
327
+};
328
+
315 329
 function fnHashed(code) { //유니코드로 들어오는 해쉬키를 스트링으로 변환
316 330
 	return decodeURIComponent(JSON.parse('"' + code.replace(/\"/g, '\\"') + '"'));
317 331
 }