瀏覽代碼

바코드 스캔기능 추가

isna 2 年之前
父節點
當前提交
d3912f3e87
共有 1 個文件被更改,包括 55 次插入0 次删除
  1. 55 0
      src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG02010.js

+ 55 - 0
src/main/webapp/mobile/js/app/mpomng/ITP_MPOMNG02010.js

@@ -11,6 +11,7 @@ const API_MOBILE_INFO 				= '/api/pomng/info-pchReq';			// 상세
11 11
 const API_MOBILE_SAVE 				= '/api/pomng/save-pchReq';			// 저장
12 12
 const API_POP_SEARCH_LIST			= '/api/whs/mng/pop-whs-search';
13 13
 const API_POP_ITEM_LIST 			= '/api/item/pop-grid-list';
14
+const API_MOBILE_BARCODE			= '/api/item/info-barcode-item';	// 바코드
14 15
 
15 16
 const API_POP_WISH_LIST 		= '/api/item/wish-list';
16 17
 const API_POP_SEARCH_WISH_LIST 	= '/api/item/pop-grid-wishlist';
@@ -116,6 +117,9 @@ let mobPageObj = {
116 117
 				}
117 118
 				return false;
118 119
 			});
120
+			$('#ITP_BTN_MPOMNG02010_DETAIL_SCAN').on('click', function() {
121
+				mobContObj.barcode.callApp();
122
+			});
119 123
 		}
120 124
 	},
121 125
 	switchScreen: function(mode) {
@@ -143,7 +147,28 @@ let mobPageObj = {
143 147
 	}
144 148
 };
145 149
 
150
+function appCallFnBarcode(barcode) {
151
+	var infoFn = function(result) {
152
+		// console.log(JSON.stringify(result));
153
+		if(result) {
154
+			result.pchReqQty=1;
155
+			mobContObj.modify.list.attachRow([result]);
156
+		}
157
+	};
158
+	const param = {
159
+		'sBrandId': fn_make_user_info.get('brandId'),
160
+		'sStoreId': fn_make_user_info.get('storeId'),
161
+		'sBarcode': barcode
162
+	};
163
+	fn_ajax_call(API_MOBILE_BARCODE, param, infoFn, 'GET');
164
+}
146 165
 let mobContObj = {
166
+	barcode: {
167
+		callApp: function() {
168
+			location.replace('app:scan');
169
+			// appCallFnBarcode('2210080000001005BRD221000001');
170
+		}
171
+	},
147 172
 	list: {
148 173
 		listPage: 1,
149 174
 		rows: [],
@@ -165,6 +190,36 @@ let mobContObj = {
165 190
 				CommonObj.moreView('#ITP_LIST_MPOMNG02010_ITEM_AREA', false);
166 191
 			this.listPage += 1;
167 192
 		},
193
+		attachRow: function (items) {
194
+			var _this = this;
195
+			var fnIsExist = function(rows, item) {
196
+				var isExist = false;
197
+				$.each(rows, function(i, row) {
198
+					if(row.brandUnitUnqNo === item.brandUnitUnqNo) {
199
+						isExist = true;
200
+						return false;
201
+					}
202
+				});
203
+				return isExist;
204
+			};
205
+			$.each(items, function(i, item) {
206
+				if(!fnIsExist(_this.rows, item)) {
207
+					_this.rows.push(item);
208
+					$('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group').append($('#ITP_LIST_MPOMNG01010_DETAIL_ROWCOPY').html());
209
+					var $li = $('#ITP_LIST_MPOMNG01010_ITEM_AREA .panel-group > .list-row:last');
210
+					$li.find('.fnBrandUnitUnqNo').val(item.brandUnitUnqNo);
211
+					$li.find('.fnItemNm').text(item.itemNm);
212
+					$li.find('#ITP_MPOMNG01010_DETAIL_NUM').val(item.pchReqQty ? item.pchReqQty : '1');
213
+					$li.find('.fnUnitAmt').text(CommonObj.currency.add(item.unitAmt));
214
+					$li.find('.fnOrdAmt').text(CommonObj.currency.add(Number(item.unitAmt) * Number(item.pchReqQty ? item.pchReqQty : '1')));
215
+					$('.list-row #ITP_BTN_MPOMNG01010_DETAIL_PLUS')[$li.index()].addEventListener('click', function() { _this.actPlus(this); });
216
+					$('.list-row #ITP_BTN_MPOMNG01010_DETAIL_MINUS')[$li.index()].addEventListener('click', function() { _this.actMinus(this); });
217
+					$('.item-row #ITP_MPOMNG01010_DETAIL_NUM')[$li.index()].addEventListener('input', function() { _this.actInput(this); });
218
+					_this.pchReqAmtTot();
219
+				}
220
+			});
221
+			this.empty();
222
+		},
168 223
 		load: function() {
169 224
 			var callbackFn = function(result) {
170 225
 				/*console.log(result);*/