|
@@ -0,0 +1,581 @@
|
|
1
|
+require(['config'], function() {
|
|
2
|
+ require([
|
|
3
|
+ ], function($) {
|
|
4
|
+ pageObj.init();
|
|
5
|
+ });
|
|
6
|
+});
|
|
7
|
+
|
|
8
|
+//화면변수
|
|
9
|
+const RTNMNG04010_GRID_ID = '#ITP_RTNMNG04010_jqGrid';
|
|
10
|
+const RTNMNG04010_GRID_LIST = '#ITP_RTNMNG04010_jqGrid_list';
|
|
11
|
+const RTNMNG04010_GRID_PAGER = '#ITP_RTNMNG04010_jqGridPager';
|
|
12
|
+const RTNMNG04010_GRID_EMPTY = '#ITP_RTNMNG04010_jqGridEmpty';
|
|
13
|
+
|
|
14
|
+const RTNMNG04010_DETAIL_GRID_ID = '#ITP_RTNMNG04010_DETAIL_jqGrid';
|
|
15
|
+const RTNMNG04010_DETAIL_GRID_LIST = '#ITP_RTNMNG04010_DETAIL_jqGrid_list';
|
|
16
|
+const RTNMNG04010_DETAIL_GRID_PAGER = '#ITP_RTNMNG04010_DETAIL_jqGridPager';
|
|
17
|
+const RTNMNG04010_DETAIL_GRID_EMPTY = '#ITP_RTNMNG04010_DETAIL_jqGridEmpty';
|
|
18
|
+
|
|
19
|
+let ITP_PODR_DTL_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PODR_DTL_ST_CD', true, '구매발주상세상태코드');
|
|
20
|
+
|
|
21
|
+//API URL
|
|
22
|
+let API_RTNMNG_RTN_DETAIL_GRID_LIST = '/api/rtnmng/rtn/detail-grid-list';
|
|
23
|
+let API_RTNMNG_RTN_INFO_RTNODR = '/api/rtnmng/rtn/info-rtnOdr';
|
|
24
|
+let API_RTNMNG_RTN_CANCEL_RTNPO = '/api/rtnmng/rtn/cancel-rtnPo';
|
|
25
|
+
|
|
26
|
+//화면 grid ColModel
|
|
27
|
+const gridColModel = {
|
|
28
|
+ list:[
|
|
29
|
+ {
|
|
30
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
31
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
32
|
+ width: '10', fixed: false, align: 'center',
|
|
33
|
+ sortable: false, hidden: true
|
|
34
|
+ },
|
|
35
|
+ {
|
|
36
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
37
|
+ label: ITP_MSG_LOCALE.label.brandNm, // 브랜드명
|
|
38
|
+ width: '10', fixed: false, align: 'center',
|
|
39
|
+ sortable: false, hidden: false
|
|
40
|
+ },
|
|
41
|
+ {
|
|
42
|
+ index: 'RTN_PODR_UNQ_NO', name: 'rtnPodrUnqNo',
|
|
43
|
+ label: '반품발주번호',
|
|
44
|
+ width: '10', fixed: false, align: 'center',
|
|
45
|
+ sortable: false, hidden: false
|
|
46
|
+ },
|
|
47
|
+ {
|
|
48
|
+ index: 'RTN_ODR_ST_NM', name: 'rtnOdrStNm',
|
|
49
|
+ label: '발주상태',
|
|
50
|
+ width: '10', fixed: false, align: 'center',
|
|
51
|
+ sortable: false, hidden: false
|
|
52
|
+ },
|
|
53
|
+ {
|
|
54
|
+ index: 'RTN_ODR_REG_DT', name: 'rtnOdrRegDt',
|
|
55
|
+ label: '반품발주일자',
|
|
56
|
+ width: '10', fixed: false, align: 'center',
|
|
57
|
+ sortable: false, hidden: false
|
|
58
|
+ },
|
|
59
|
+ {
|
|
60
|
+ index: 'RTN_WHS_NM', name: 'rtnWhsNm',
|
|
61
|
+ label: '수거처',
|
|
62
|
+ width: '10', fixed: false, align: 'center',
|
|
63
|
+ sortable: false, hidden: false
|
|
64
|
+ },
|
|
65
|
+ {
|
|
66
|
+ index: 'SPPLY_NM', name: 'spplyNm',
|
|
67
|
+ label: ITP_MSG_LOCALE.label.spplyNm, // 공급업체명
|
|
68
|
+ width: '10', fixed: false, align: 'center',
|
|
69
|
+ sortable: false, hidden: false
|
|
70
|
+ },
|
|
71
|
+ {
|
|
72
|
+ index: 'RTN_DODR_TOTAL_AMT', name: 'rtnDodrTotalAmt',
|
|
73
|
+ label: '총 반품발주금액',
|
|
74
|
+ width: '8', fixed: false, align: 'center',
|
|
75
|
+ sortable: false, hidden: false,
|
|
76
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
77
|
+ },
|
|
78
|
+ {
|
|
79
|
+ index: 'rtn_Dodr_Item_Qty', name: 'rtnDodrItemQty',
|
|
80
|
+ label: '반품발주품목수',
|
|
81
|
+ width: '7', fixed: false, align: 'center',
|
|
82
|
+ sortable: false, hidden: false,
|
|
83
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
84
|
+ },
|
|
85
|
+ {
|
|
86
|
+ index: 'COL_REQ_DT', name: 'colReqDt',
|
|
87
|
+ label: '수거요청일',
|
|
88
|
+ width: '10', fixed: false, align: 'center',
|
|
89
|
+ sortable: false, hidden: false
|
|
90
|
+ },
|
|
91
|
+ {
|
|
92
|
+ index: 'col_Dvsn_Nm', name: 'colDvsnNm',
|
|
93
|
+ label: '수거구분',
|
|
94
|
+ width: '10', fixed: false, align: 'center',
|
|
95
|
+ sortable: false, hidden: false
|
|
96
|
+ }
|
|
97
|
+ ],
|
|
98
|
+ view: [],
|
|
99
|
+ detail: [
|
|
100
|
+ {
|
|
101
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
102
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
103
|
+ width: '10', fixed: false, align: 'center',
|
|
104
|
+ sortable: false, hidden: true
|
|
105
|
+ },
|
|
106
|
+ {
|
|
107
|
+ index: 'RTN_PODR_DTL_NO', name: 'rtnPodrDtlNo',
|
|
108
|
+ label: ITP_MSG_LOCALE.label.pchPodrDtlNo, // 발주항번
|
|
109
|
+ width: '5', fixed: false, align: 'center',
|
|
110
|
+ sortable: false, hidden: false
|
|
111
|
+ },
|
|
112
|
+ {
|
|
113
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
114
|
+ label: ITP_MSG_LOCALE.label.itemId, // 품목번호
|
|
115
|
+ width: '5', fixed: false, align: 'center',
|
|
116
|
+ sortable: false, hidden: false
|
|
117
|
+ },
|
|
118
|
+ {
|
|
119
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
120
|
+ label: ITP_MSG_LOCALE.label.itemNm, // 품목명
|
|
121
|
+ width: '5', fixed: false, align: 'left',
|
|
122
|
+ sortable: false, hidden: false
|
|
123
|
+ },
|
|
124
|
+ {
|
|
125
|
+ index: 'RODR_DTL_ST_NM', name: 'rodrDtlStNm',
|
|
126
|
+ label: '발주상세상태',
|
|
127
|
+ width: '5', fixed: false, align: 'center',
|
|
128
|
+ sortable: false, hidden: false
|
|
129
|
+ },
|
|
130
|
+ {
|
|
131
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
132
|
+ label: ITP_MSG_LOCALE.label.unitAmt, // 단가
|
|
133
|
+ width: '5', fixed: false, align: 'center',
|
|
134
|
+ sortable: false, hidden: false,
|
|
135
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
136
|
+ },
|
|
137
|
+ {
|
|
138
|
+ index: 'UNIT', name: 'unit',
|
|
139
|
+ label: ITP_MSG_LOCALE.label.unit, // 기본단위
|
|
140
|
+ width: '5', fixed: false, align: 'center',
|
|
141
|
+ sortable: false, hidden: false
|
|
142
|
+ },
|
|
143
|
+ {
|
|
144
|
+ index: 'RTN_REQ_QTY', name: 'rtnReqQty',
|
|
145
|
+ label: '반품요청수량',
|
|
146
|
+ width: '5', fixed: false, align: 'center',
|
|
147
|
+ sortable: false, hidden: false,
|
|
148
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
149
|
+ },
|
|
150
|
+ {
|
|
151
|
+ index: 'RTN_ODR_QTY', name: 'rtnOdrQty',
|
|
152
|
+ label: '반품발주수량',
|
|
153
|
+ width: '5', fixed: false, align: 'center',
|
|
154
|
+ sortable: false, hidden: false,
|
|
155
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
156
|
+ },
|
|
157
|
+ {
|
|
158
|
+ index: 'RTN_ODR_AMT', name: 'rtnOdrAmt',
|
|
159
|
+ label: ITP_MSG_LOCALE.label.podrAmt, // 발주금액
|
|
160
|
+ width: '5', fixed: false, align: 'center',
|
|
161
|
+ sortable: false, hidden: false,
|
|
162
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
163
|
+ }
|
|
164
|
+ ]
|
|
165
|
+};
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+/*화면공통 Object*/
|
|
169
|
+let pageObj = {
|
|
170
|
+ init: function() {
|
|
171
|
+ this.ui.init();
|
|
172
|
+ this.event.init();
|
|
173
|
+ },
|
|
174
|
+ ui: {
|
|
175
|
+ init: function() {
|
|
176
|
+ this.view();
|
|
177
|
+ this.grid();
|
|
178
|
+ this.ready();
|
|
179
|
+ },
|
|
180
|
+ view: function() {
|
|
181
|
+ // 버튼 권한설정
|
|
182
|
+ fn_proc_btn_auth('RTNMNG04010');
|
|
183
|
+ // 공통코드 표시
|
|
184
|
+ $('select').each(function() {
|
|
185
|
+ if($(this).data('select-code')) {
|
|
186
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
187
|
+ }
|
|
188
|
+ });
|
|
189
|
+ // 조회일자 지정
|
|
190
|
+ var now = new Date();
|
|
191
|
+ var defaultToDate = new Date(now);
|
|
192
|
+ defaultToDate.setDate(now.getDate() + 10);
|
|
193
|
+ $('#ITP_TAB_RTNMNG04010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
194
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_FROM_DT').datepicker('setDate', now);
|
|
195
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_TO_DT').datepicker('setDate', defaultToDate);
|
|
196
|
+ },
|
|
197
|
+ grid: function() {
|
|
198
|
+ itp_fn_jqgrid_resize(RTNMNG04010_GRID_ID, RTNMNG04010_GRID_LIST, 'lg');
|
|
199
|
+ listObj.empty.init();
|
|
200
|
+ itp_fn_fire_window_resize();
|
|
201
|
+ },
|
|
202
|
+ ready: function() {
|
|
203
|
+ listObj.init();
|
|
204
|
+ }
|
|
205
|
+ },
|
|
206
|
+ event: {
|
|
207
|
+ init: function() {
|
|
208
|
+ this.button();
|
|
209
|
+ },
|
|
210
|
+ button: function() {
|
|
211
|
+ // 버튼 클릭 이벤트
|
|
212
|
+ $('button').each(function() {
|
|
213
|
+ var id = $(this).attr('id');
|
|
214
|
+ $(this).on('click', function() {
|
|
215
|
+ switch (id) {
|
|
216
|
+ case 'ITP_BTN_RTNMNG04010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
|
|
217
|
+ case 'ITP_BTN_RTNMNG04010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
|
|
218
|
+ case 'ITP_BTN_RTNMNG04010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
|
|
219
|
+ case 'ITP_BTN_RTNMNG04010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
|
|
220
|
+ case 'ITP_BTN_RTNMNG04010_RTNCANCEL' : modifyObj.button.del(); break; // 발주 취소 버튼(예정)
|
|
221
|
+ }
|
|
222
|
+ });
|
|
223
|
+ });
|
|
224
|
+ }
|
|
225
|
+ },
|
|
226
|
+ switchScreen: function(mode) {
|
|
227
|
+ $('.itp_det_head').find('button[id^="ITP_BTN_RTNMNG04010_"]').each(function(i) {
|
|
228
|
+ $(this).hide();
|
|
229
|
+ });
|
|
230
|
+ $('#ITP_TAB_RTNMNG04010').find('div[id$="_CONTAINER"]').each(function(i) {
|
|
231
|
+ $(this).hide();
|
|
232
|
+ });
|
|
233
|
+ if(mode == 'LIST') { // 목록
|
|
234
|
+ fn_show_btn_auth_array(['#ITP_BTN_RTNMNG04010_SRH', '#ITP_BTN_RTNMNG04010_NEWREG']);
|
|
235
|
+ $('#ITP_AJAX_RTNMNG04010_LIST_CONTAINER').show();
|
|
236
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH #ITP_FORM_RTNMNG04010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
237
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_SPPLY_ID').show();
|
|
238
|
+ $('#ITP_BTN_RTNMNG04010_DELETE_SPPLY_ID').show();
|
|
239
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_WHS_ID').show();
|
|
240
|
+ $('#ITP_BTN_RTNMNG04010_DELETE_WHS_ID').show();
|
|
241
|
+
|
|
242
|
+ } else if(mode == 'MODIFY') { // 수정
|
|
243
|
+ $('#ITP_AJAX_RTNMNG04010_DETAIL_CONTAINER').show();
|
|
244
|
+ fn_show_btn_auth_array(['#ITP_BTN_RTNMNG04010_CANCELLIST', '#ITP_BTN_RTNMNG04010_RTNCANCEL']);
|
|
245
|
+
|
|
246
|
+ $('#ITP_BTN_RTNMNG04010_CANCELLIST').show();
|
|
247
|
+ $('#ITP_BTN_RTNMNG04010_DELETE').show();
|
|
248
|
+
|
|
249
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').attr('readonly', true);
|
|
250
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_NM').attr('readonly', true);
|
|
251
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_BSNS_REG_NO').attr('readonly', true);
|
|
252
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_CORP_REG_NO').attr('readonly', true);
|
|
253
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_SEARCH_AFFL_SHOP').hide();
|
|
254
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL_DELETE_AFFL_SHOP').hide();
|
|
255
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .itp_form_info').show();
|
|
256
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .itp_form_change').hide();
|
|
257
|
+
|
|
258
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
259
|
+ }
|
|
260
|
+ }
|
|
261
|
+};
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+/*목록화면 Object*/
|
|
265
|
+let listObj = {
|
|
266
|
+ init: function() {
|
|
267
|
+ this.grid.init();
|
|
268
|
+ this.action();
|
|
269
|
+ },
|
|
270
|
+ itp_RTNMNG04010_param: {},
|
|
271
|
+ itp_RTNMNG04010_search: false,
|
|
272
|
+ button: {
|
|
273
|
+ search: function() {
|
|
274
|
+ listObj.itp_RTNMNG04010_search = true;
|
|
275
|
+ let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
|
|
276
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
277
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
278
|
+ param.sidx = '0';
|
|
279
|
+ console.log(JSON.stringify(param));
|
|
280
|
+ $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
281
|
+ }
|
|
282
|
+ },
|
|
283
|
+ empty: {
|
|
284
|
+ init: function() {
|
|
285
|
+ var _this = this;
|
|
286
|
+ this.push();
|
|
287
|
+ $(RTNMNG04010_GRID_EMPTY).on('click', function() {
|
|
288
|
+ _this.back();
|
|
289
|
+ listObj.itp_RTNMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
290
|
+ $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_RTNMNG04010_param)}).trigger('reloadGrid');
|
|
291
|
+ });
|
|
292
|
+ },
|
|
293
|
+ push: function() {
|
|
294
|
+ let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
|
|
295
|
+ listObj.itp_RTNMNG04010_param = param;
|
|
296
|
+ param.sidx = '0';
|
|
297
|
+ },
|
|
298
|
+ back: function() {
|
|
299
|
+ $('#ITP_FORM_RTNMNG04010_SERVICE_BRAND_TYPE').val(listObj.itp_RTNMNG04010_param.brandType);
|
|
300
|
+ $('#ITP_FORM_RTNMNG04010_SERVICE_ST_CD').val(listObj.itp_RTNMNG04010_param.stCd);
|
|
301
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_BRAND_NM').val(listObj.itp_RTNMNG04010_param.brandNm);
|
|
302
|
+ }
|
|
303
|
+ },
|
|
304
|
+ grid: {
|
|
305
|
+ init: function() {
|
|
306
|
+ // 데이터 없을때
|
|
307
|
+ listObj.empty.push();
|
|
308
|
+ this.search();
|
|
309
|
+ },
|
|
310
|
+ colModel: gridColModel.list,
|
|
311
|
+ search: function() {
|
|
312
|
+ pageObj.switchScreen('LIST');
|
|
313
|
+ this.unload();
|
|
314
|
+ this.load();
|
|
315
|
+ },
|
|
316
|
+ load: function() {
|
|
317
|
+ let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
|
|
318
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
319
|
+ param.sidx = '0';
|
|
320
|
+ console.log(JSON.stringify(param));
|
|
321
|
+ var option = {
|
|
322
|
+ gridId: RTNMNG04010_GRID_ID,
|
|
323
|
+ colModel: gridColModel.list,
|
|
324
|
+ param: param,
|
|
325
|
+ url: DOMAIN + API_RTNMNG_RTN_DETAIL_GRID_LIST,
|
|
326
|
+ pager: RTNMNG04010_GRID_PAGER,
|
|
327
|
+ onCellSelect: function(rowId, cellIdx, cellValue) {
|
|
328
|
+ var cm = $(this).jqGrid('getGridParam', 'colModel');
|
|
329
|
+ var colNm = cm[cellIdx].name;
|
|
330
|
+ if (colNm === 'rtnPodrUnqNo') {
|
|
331
|
+ const rtnPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'rtnPodrUnqNo');
|
|
332
|
+ const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
|
|
333
|
+ const key = {rtnPodrUnqNo: rtnPodrUnqNoVal, brandId: brandIdVal};
|
|
334
|
+ var param = $.param(key);
|
|
335
|
+ modifyObj.init(param);
|
|
336
|
+ }
|
|
337
|
+ },
|
|
338
|
+ loadComplete: function(data) {
|
|
339
|
+ console.log(data);
|
|
340
|
+ itp_fn_grid_load_complete(data, RTNMNG04010_GRID_ID, true, 'number', 'RTNMNG04010', listObj.itp_RTNMNG04010_search, listObj.empty, true, data.gridRecords, true);
|
|
341
|
+ var ids = $(RTNMNG04010_GRID_ID).getDataIDs();
|
|
342
|
+ $.each(ids, function(idx, rowId) {
|
|
343
|
+ $(RTNMNG04010_GRID_ID).jqGrid('setCell', rowId, 'rtnPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
|
|
344
|
+ });
|
|
345
|
+ },
|
|
346
|
+ onPaging: function(action) {
|
|
347
|
+ itp_fn_grid_paging(RTNMNG04010_GRID_ID, action, param);
|
|
348
|
+ }
|
|
349
|
+ };
|
|
350
|
+ itp_fn_grid_make_remote(option);
|
|
351
|
+ },
|
|
352
|
+ clearData: function() {
|
|
353
|
+ $(RTNMNG04010_GRID_ID).jqGrid('clearGridData', true);
|
|
354
|
+ $(RTNMNG04010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
355
|
+ $(RTNMNG04010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
356
|
+ $(RTNMNG04010_GRID_EMPTY).show();
|
|
357
|
+ },
|
|
358
|
+ unload: function() {
|
|
359
|
+ $.jgrid.gridUnload(RTNMNG04010_GRID_ID);
|
|
360
|
+ }
|
|
361
|
+ },
|
|
362
|
+ action: function() {
|
|
363
|
+ var _this = this;
|
|
364
|
+ // 매장/창고 조회 버튼 클릭
|
|
365
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SWHS_NM').on('click', function() {
|
|
366
|
+ _this.popup('whs');
|
|
367
|
+ });
|
|
368
|
+ // 매장/창고 텍스트 삭제 버튼 클릭
|
|
369
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SWHS_NM').on('click', function() {
|
|
370
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_NM').val('');
|
|
371
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_ID').val('');
|
|
372
|
+ });
|
|
373
|
+
|
|
374
|
+ // 매장/창고 조회 버튼 클릭
|
|
375
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SRTN_WHS_NM').on('click', function() {
|
|
376
|
+ _this.popup('rwhs');
|
|
377
|
+ });
|
|
378
|
+ // 매장/창고 텍스트 삭제 버튼 클릭
|
|
379
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SRTN_WHS_NM').on('click', function() {
|
|
380
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_NM').val('');
|
|
381
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_ID').val('');
|
|
382
|
+ });
|
|
383
|
+
|
|
384
|
+ // 공급업체 조회 버튼 클릭
|
|
385
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SSPPLY_NM').on('click', function() {
|
|
386
|
+ _this.popup('spply');
|
|
387
|
+ });
|
|
388
|
+ // 공급업체 텍스트 삭제 버튼 클릭
|
|
389
|
+ $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SSPPLY_NM').on('click', function() {
|
|
390
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_NM').val('');
|
|
391
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_ID').val('');
|
|
392
|
+ });
|
|
393
|
+
|
|
394
|
+ },
|
|
395
|
+ popup: function(keyword) {
|
|
396
|
+ if(keyword === 'spply'){
|
|
397
|
+ var popFn = this.callback.spply;
|
|
398
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
399
|
+ fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
|
|
400
|
+ } else if(keyword === 'whs'){
|
|
401
|
+ var popFn = this.callback.whs;
|
|
402
|
+ const key1 = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
|
|
403
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
|
|
404
|
+ } else if(keyword === 'rwhs'){
|
|
405
|
+ var popFn = this.callback.rwhs;
|
|
406
|
+ const key1 = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
|
|
407
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
|
|
408
|
+ }
|
|
409
|
+ },
|
|
410
|
+ callback: {
|
|
411
|
+ whs: function(rowDataPop) {
|
|
412
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
|
|
413
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
|
|
414
|
+ },
|
|
415
|
+ rwhs: function(rowDataPop) {
|
|
416
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_NM').val(rowDataPop.whsNm);
|
|
417
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_ID').val(rowDataPop.whsId);
|
|
418
|
+ },
|
|
419
|
+ spply: function(rowDataPop) {
|
|
420
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
|
|
421
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
|
|
422
|
+ }
|
|
423
|
+ }
|
|
424
|
+};
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+/*수정화면 Object*/
|
|
428
|
+let modifyObj = {
|
|
429
|
+ init: function(param) {
|
|
430
|
+ this.load(param);
|
|
431
|
+ },
|
|
432
|
+ itp_RTNMNG04010_param: {},
|
|
433
|
+ itp_RTNMNG04010_search: false,
|
|
434
|
+ button: {
|
|
435
|
+ cancel: function() {
|
|
436
|
+ listObj.grid.search();
|
|
437
|
+ },
|
|
438
|
+ del: function() {
|
|
439
|
+
|
|
440
|
+ var modalFn = {
|
|
441
|
+ callBack: () => {
|
|
442
|
+
|
|
443
|
+ var param = {brandId: $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(), rtnPodrUnqNo: $('#ITP_FORM_RTNMNG04010_DETAIL_RTN_PODR_UNQ_NO').val()};
|
|
444
|
+ var searhFn = function () {
|
|
445
|
+ listObj.grid.search();
|
|
446
|
+ }
|
|
447
|
+ fn_ajax_call(API_RTNMNG_RTN_CANCEL_RTNPO, JSON.stringify(param), searhFn, 'POST');
|
|
448
|
+ }
|
|
449
|
+ };
|
|
450
|
+ itp_fn_modal_confirm('반품발주를 취소 하시겠습니까?', modalFn);
|
|
451
|
+ }
|
|
452
|
+ },
|
|
453
|
+ empty: {
|
|
454
|
+ init: function() {
|
|
455
|
+ var _this = this;
|
|
456
|
+ this.push();
|
|
457
|
+ $(RTNMNG04010_VIEW_GRID_EMPTY).on('click', function() {
|
|
458
|
+ _this.back();
|
|
459
|
+ viewObj.itp_RTNMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
460
|
+ $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_RTNMNG04010_param)}).trigger('reloadGrid');
|
|
461
|
+ });
|
|
462
|
+ },
|
|
463
|
+ push: function() {
|
|
464
|
+ let param = $('#ITP_FORM_RTNMNG04010_DETAIL').serializeObject();
|
|
465
|
+ viewObj.itp_RTNMNG04010_param = param;
|
|
466
|
+ },
|
|
467
|
+ back: function() {
|
|
468
|
+ $('#ITP_FORM_RTNMNG04010_SERVICE_BRAND_TYPE').val(viewObj.itp_RTNMNG04010_param.brandType);
|
|
469
|
+ $('#ITP_FORM_RTNMNG04010_SERVICE_ST_CD').val(viewObj.itp_RTNMNG04010_param.stCd);
|
|
470
|
+ $('#ITP_FORM_RTNMNG04010_SEARCH_BRAND_NM').val(viewObj.itp_RTNMNG04010_param.brandNm);
|
|
471
|
+ }
|
|
472
|
+ },
|
|
473
|
+ load: function(param) {
|
|
474
|
+ fn_ajax_call(API_RTNMNG_RTN_INFO_RTNODR, param, this.callback, 'GET');
|
|
475
|
+ },
|
|
476
|
+ callback: function(result) {
|
|
477
|
+ // console.log('>>>> ' + JSON.stringify(result));
|
|
478
|
+
|
|
479
|
+ // 그리드 전화번호 '-' 함수
|
|
480
|
+ let telNo = '';
|
|
481
|
+ if(result.rtnMgrTelNo != '') {
|
|
482
|
+ function convertTel(value){
|
|
483
|
+ answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
|
|
484
|
+ .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
|
|
485
|
+ .replace("--", "-") : '';
|
|
486
|
+ return answer;
|
|
487
|
+ }
|
|
488
|
+ telNo = convertTel(result.rtnMgrTelNo);
|
|
489
|
+ }
|
|
490
|
+
|
|
491
|
+ pageObj.switchScreen('MODIFY');
|
|
492
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(result.brandId);
|
|
493
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_RTN_PODR_UNQ_NO').val(result.rtnPodrUnqNo);
|
|
494
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_RTN_ODR_ST_CD').val(result.rtnOdrStCd);
|
|
495
|
+
|
|
496
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnBrandNm').text(result.brandNm);
|
|
497
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnPodrUnqNo').text(result.rtnPodrUnqNo + ' / ' + result.rtnOdrStNm);
|
|
498
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnColPlace').text(result.rtnWhsNm + ' - ' + result.rtnLocationNm);
|
|
499
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnWhsNm').text(result.whsNm + ' - ' + result.locationNm);
|
|
500
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnSpplyNm').text(result.spplyNm);
|
|
501
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnOdrRegDt').text(result.rtnOdrRegDt);
|
|
502
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnPodrMgrNm').text(result.rtnMgrNm);
|
|
503
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnPodrMgrTelNo').text(telNo);
|
|
504
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnColDvsnNm').text(result.colDvsnNm);
|
|
505
|
+ $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnDodrTotalAmt').text(itp_fn_number_comma(result.rtnDodrTotalAmt));
|
|
506
|
+
|
|
507
|
+ if('RO20' == result.rtnOdrStCd) { // 반품발주요청
|
|
508
|
+ $('#ITP_BTN_RTNMNG04010_RTNCANCEL').show();
|
|
509
|
+ } else {
|
|
510
|
+ $('#ITP_BTN_RTNMNG04010_RTNCANCEL').hide();
|
|
511
|
+ }
|
|
512
|
+
|
|
513
|
+ modifyObj.grid.init('MODIFY', result.rtnOdrDtlList)
|
|
514
|
+
|
|
515
|
+ },
|
|
516
|
+ grid: {
|
|
517
|
+ init: function(mode, gridData) {
|
|
518
|
+ this.mode = mode;
|
|
519
|
+ this.gridId = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_ID : RTNMNG04010_DETAIL_GRID_ID;
|
|
520
|
+ this.gridList = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_LIST : RTNMNG04010_DETAIL_GRID_LIST;
|
|
521
|
+ this.gridEmpty = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_EMPTY : RTNMNG04010_DETAIL_GRID_EMPTY;
|
|
522
|
+ this.unload();
|
|
523
|
+ this.load(mode, gridData);
|
|
524
|
+ },
|
|
525
|
+ mode: '',
|
|
526
|
+ colModel: gridColModel.view,
|
|
527
|
+ load: function(mode, gridData) {
|
|
528
|
+ var _this = this;
|
|
529
|
+ var option = {
|
|
530
|
+ gridId: _this.gridId,
|
|
531
|
+ colModel: gridColModel.detail,
|
|
532
|
+ data: gridData,
|
|
533
|
+ // multiselect: true,
|
|
534
|
+ onSelectRow: function(index, status) {
|
|
535
|
+ if(index) {
|
|
536
|
+ var row = $(RTNMNG04010_DETAIL_GRID_ID).jqGrid('getRowData', index);
|
|
537
|
+ if(row.podrDtlStCd == 'POD2') {
|
|
538
|
+ $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + index).prop("checked", false);
|
|
539
|
+ }
|
|
540
|
+ }
|
|
541
|
+ },
|
|
542
|
+ onSelectAll: function(rowIds, status) {
|
|
543
|
+ for(let i = 0; i < rowIds.length; i++){
|
|
544
|
+ let podrDtlStCd = $(RTNMNG04010_DETAIL_GRID_ID).getCell(rowIds[i], 'podrDtlStCd');
|
|
545
|
+ if(podrDtlStCd == 'POD2') {
|
|
546
|
+ $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", false);
|
|
547
|
+ } else {
|
|
548
|
+ $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", status);
|
|
549
|
+ }
|
|
550
|
+ }
|
|
551
|
+ },
|
|
552
|
+ loadComplete: function(data) {
|
|
553
|
+ console.log(data);
|
|
554
|
+ let datas = data.rows;
|
|
555
|
+ for(let i = 0; i < datas.length; i++) {
|
|
556
|
+ let podrDtlStCd = datas[i].podrDtlStCd;
|
|
557
|
+ if(podrDtlStCd == 'POD2') {
|
|
558
|
+ $('#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_' + (i + 1)).attr('disabled', true);
|
|
559
|
+ }
|
|
560
|
+ }
|
|
561
|
+ itp_fn_grid_load_complete(data, RTNMNG04010_DETAIL_GRID_ID, true, 'number', 'RTNMNG04010', modifyObj.itp_RTNMNG04010_search, modifyObj.empty, true, data.gridRecords, true);
|
|
562
|
+ }
|
|
563
|
+ };
|
|
564
|
+ itp_fn_grid_make_local(option);
|
|
565
|
+ },
|
|
566
|
+ unload: function() {
|
|
567
|
+ $.jgrid.gridUnload(this.gridId);
|
|
568
|
+ }
|
|
569
|
+ },
|
|
570
|
+ isValid: function(formId) {
|
|
571
|
+ var isValid = false;
|
|
572
|
+ $(formId).find('input, select, checkbox, textarea').each(function(k) {
|
|
573
|
+ if($(this).data('check-required')) {
|
|
574
|
+ var arry = $(this).data('check-required').split(',');
|
|
575
|
+ isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined);
|
|
576
|
+ if(!isValid) return false;
|
|
577
|
+ }
|
|
578
|
+ });
|
|
579
|
+ return isValid;
|
|
580
|
+ },
|
|
581
|
+};
|