|
@@ -0,0 +1,835 @@
|
|
1
|
+require(['config'], function() {
|
|
2
|
+ require([
|
|
3
|
+ 'kakao.map.util'
|
|
4
|
+ ], function($) {
|
|
5
|
+ pageObj.init();
|
|
6
|
+ });
|
|
7
|
+});
|
|
8
|
+
|
|
9
|
+/********************************************************
|
|
10
|
+ --------------------------------------------------------
|
|
11
|
+ - Object 목록 -
|
|
12
|
+ --------------------------------------------------------
|
|
13
|
+ * const gridColModel = {} : 화면 Grid Object *
|
|
14
|
+ * let pageObj = {} : 화면공통 Object *
|
|
15
|
+ * let listObj = {} : 목록화면 Object *
|
|
16
|
+ * let viewObj = {} : 상세화면 Object *
|
|
17
|
+ * let modifyObj = {} : 수정화면 Object *
|
|
18
|
+ * let createObj = {} : 신규화면 Object *
|
|
19
|
+ *******************************************************/
|
|
20
|
+
|
|
21
|
+/*화면 변수*/
|
|
22
|
+const POMNG03010_GRID_ID = '#ITP_POMNG03010_jqGrid';
|
|
23
|
+const POMNG03010_GRID_LIST = '#ITP_POMNG03010_jqGrid_list';
|
|
24
|
+const POMNG03010_GRID_PAGER = '#ITP_POMNG03010_jqGridPager';
|
|
25
|
+const POMNG03010_GRID_EMPTY = '#ITP_POMNG03010_jqGridEmpty';
|
|
26
|
+
|
|
27
|
+const POMNG03010_DETAIL_GRID_ID = '#ITP_POMNG03010_DETAIL_jqGrid';
|
|
28
|
+const POMNG03010_DETAIL_GRID_LIST = '#ITP_POMNG03010_DETAIL_jqGrid_list';
|
|
29
|
+const POMNG03010_DETAIL_GRID_PAGER = '#ITP_POMNG03010_DETAIL_jqGridPager';
|
|
30
|
+const POMNG03010_DETAIL_GRID_EMPTY = '#ITP_POMNG03010_DETAIL_jqGridEmpty';
|
|
31
|
+
|
|
32
|
+const POMNG03010_NDETAIL_GRID_ID = '#ITP_POMNG03010_NDETAIL_jqGrid';
|
|
33
|
+const POMNG03010_NDETAIL_GRID_LIST = '#ITP_POMNG03010_NDETAIL_jqGrid_list';
|
|
34
|
+const POMNG03010_NDETAIL_GRID_PAGER = '#ITP_POMNG03010_NDETAIL_jqGridPager';
|
|
35
|
+const POMNG03010_NDETAIL_GRID_EMPTY = '#ITP_POMNG03010_NDETAIL_jqGridEmpty';
|
|
36
|
+
|
|
37
|
+let ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
|
|
38
|
+
|
|
39
|
+/*API URL*/
|
|
40
|
+let API_DETAIL_GRID_LIST = '/api/pomng/po-target-grid-list'; // 목록
|
|
41
|
+let API_DETAIL_REJECT_LIST = '/api/pomng/reject-pchreq-target'; // 구매요청 선택한건 반려 처리 대상 리스트
|
|
42
|
+let API_DETAIL_POPASS_CHK = '/api/pomng/po/chk-pchOrd'; // 목록에서 선택한 구매요청건에 대해 발주가능여부 체크 함
|
|
43
|
+let API_DETAIL_PO_INIT_INFO = '/api/pomng/po/init-pchOrd'; // 구매요청발주생성 오픈시 호출하여 데이타 세팅함
|
|
44
|
+let API_DETAIL_NEW_INIT_INFO = '/api/pomng/po/init-poOrd'; // 신규발주생성 오픈시 호출하여 데이타 세팅함
|
|
45
|
+let API_DETAIL_SAVE = '/api/pomng/po/save-pchPo'; // 저장
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+/*화면 Grid ColModel*/
|
|
49
|
+const gridColModel = {
|
|
50
|
+ list: [
|
|
51
|
+ {
|
|
52
|
+ index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
|
|
53
|
+ label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청고유번호
|
|
54
|
+ width: '10', fixed: false, align: 'center',
|
|
55
|
+ sortable: false, hidden: true
|
|
56
|
+ },
|
|
57
|
+ {
|
|
58
|
+ index: 'PCH_REQ_DTL_NO', name: 'pchReqDtlNo',
|
|
59
|
+ label: ITP_MSG_LOCALE.label.pchReqDtlNo, //구매요청상세번호
|
|
60
|
+ width: '13', fixed: false, align: 'center',
|
|
61
|
+ sortable: false, hidden: true
|
|
62
|
+ },
|
|
63
|
+ {
|
|
64
|
+ index: 'BRAND_ID', name: 'brandId',
|
|
65
|
+ label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
|
|
66
|
+ width: '10', fixed: false, align: 'center',
|
|
67
|
+ sortable: false, hidden: true
|
|
68
|
+ },
|
|
69
|
+ {
|
|
70
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
71
|
+ label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
|
|
72
|
+ width: '10', fixed: false, align: 'center',
|
|
73
|
+ sortable: false, hidden: false
|
|
74
|
+ },
|
|
75
|
+ {
|
|
76
|
+ index: 'STORE_ID', name: 'storeId',
|
|
77
|
+ label: ITP_MSG_LOCALE.label.storeId, //매장아이디
|
|
78
|
+ width: '13', fixed: false, align: 'center',
|
|
79
|
+ sortable: false, hidden: true
|
|
80
|
+ },
|
|
81
|
+ {
|
|
82
|
+ index: 'STORE_NM', name: 'storeNm',
|
|
83
|
+ label: ITP_MSG_LOCALE.label.storeNm, //매장명
|
|
84
|
+ width: '15', fixed: false, align: 'center',
|
|
85
|
+ sortable: false, hidden: true
|
|
86
|
+ },
|
|
87
|
+ {
|
|
88
|
+ index: 'SPPLY_ID', name: 'spplyId',
|
|
89
|
+ label: ITP_MSG_LOCALE.label.spplyId, //공급사아이디
|
|
90
|
+ width: '15', fixed: false, align: 'center',
|
|
91
|
+ sortable: false, hidden: true
|
|
92
|
+ },
|
|
93
|
+ {
|
|
94
|
+ index: 'SPPLY_NM', name: 'spplyNm',
|
|
95
|
+ label: ITP_MSG_LOCALE.label.spplyNm, //공급사명
|
|
96
|
+ width: '6', fixed: false, align: 'left',
|
|
97
|
+ sortable: false, hidden: false
|
|
98
|
+ },
|
|
99
|
+ {
|
|
100
|
+ index: 'WHS_ID', name: 'whsId',
|
|
101
|
+ label: ITP_MSG_LOCALE.label.whsId, //창고아이디
|
|
102
|
+ width: '10', fixed: false, align: 'center',
|
|
103
|
+ sortable: false, hidden: true
|
|
104
|
+ },
|
|
105
|
+ {
|
|
106
|
+ index: 'WHS_NM', name: 'whsNm',
|
|
107
|
+ label: ITP_MSG_LOCALE.label.whsNm, //창고명
|
|
108
|
+ width: '10', fixed: false, align: 'left',
|
|
109
|
+ sortable: false, hidden: false
|
|
110
|
+ },
|
|
111
|
+ {
|
|
112
|
+ index: 'LOCATION', name: 'location',
|
|
113
|
+ label: ITP_MSG_LOCALE.label.location, //창고상세코드
|
|
114
|
+ width: '10', fixed: false, align: 'center',
|
|
115
|
+ sortable: false, hidden: true
|
|
116
|
+ },
|
|
117
|
+ {
|
|
118
|
+ index: 'LOCATION_NM', name: 'locationNm',
|
|
119
|
+ label: ITP_MSG_LOCALE.label.locationNm, //창고상세명
|
|
120
|
+ width: '10', fixed: false, align: 'center',
|
|
121
|
+ sortable: false, hidden: true
|
|
122
|
+ },
|
|
123
|
+ {
|
|
124
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
125
|
+ label: ITP_MSG_LOCALE.label.itemId, //품목아이디
|
|
126
|
+ width: '10', fixed: false, align: 'center',
|
|
127
|
+ sortable: false, hidden: false
|
|
128
|
+ },
|
|
129
|
+ {
|
|
130
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
131
|
+ label: ITP_MSG_LOCALE.label.itemNm, //품목명
|
|
132
|
+ width: '10', fixed: false, align: 'left',
|
|
133
|
+ sortable: false, hidden: false
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
137
|
+ label: ITP_MSG_LOCALE.label.unitAmt, //구매요청단가
|
|
138
|
+ width: '10', fixed: false, align: 'right',
|
|
139
|
+ sortable: false, hidden: true
|
|
140
|
+ },
|
|
141
|
+ {
|
|
142
|
+ index: 'PO_UNIT_AMT', name: 'poUnitAmt',
|
|
143
|
+ label: ITP_MSG_LOCALE.label.poUnitAmt, //발주단가
|
|
144
|
+ width: '10', fixed: false, align: 'right',
|
|
145
|
+ sortable: false, hidden: true
|
|
146
|
+ },
|
|
147
|
+ {
|
|
148
|
+ index: 'PCH_REQ_QTY', name: 'pchReqQty',
|
|
149
|
+ label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
|
|
150
|
+ width: '10', fixed: false, align: 'right',
|
|
151
|
+ sortable: false, hidden: false
|
|
152
|
+ },
|
|
153
|
+ {
|
|
154
|
+ index: 'DLV_REQ_DT', name: 'dlvReqDt',
|
|
155
|
+ label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
|
|
156
|
+ width: '10', fixed: false, align: 'center',
|
|
157
|
+ sortable: false, hidden: false
|
|
158
|
+ },
|
|
159
|
+ {
|
|
160
|
+ index: 'PCH_REQ_AMT', name: 'pchReqAmt',
|
|
161
|
+ label: ITP_MSG_LOCALE.label.pchReqAmt, //납품요청금액
|
|
162
|
+ width: '10', fixed: false, align: 'right',
|
|
163
|
+ sortable: false, hidden: false
|
|
164
|
+ },
|
|
165
|
+ {
|
|
166
|
+ index: 'PCH_ORD_AMT', name: 'pchOrdAmt',
|
|
167
|
+ label: ITP_MSG_LOCALE.label.pchOrdSpplyAmt, //본사납품금액
|
|
168
|
+ width: '10', fixed: false, align: 'right',
|
|
169
|
+ sortable: false, hidden: false
|
|
170
|
+ },
|
|
171
|
+ {
|
|
172
|
+ index: 'LEAD_TIME', name: 'leadTime',
|
|
173
|
+ label: ITP_MSG_LOCALE.label.leadTime, //리드타임
|
|
174
|
+ width: '10', fixed: false, align: 'right',
|
|
175
|
+ sortable: false, hidden: false
|
|
176
|
+ }
|
|
177
|
+ ],
|
|
178
|
+ detail: [
|
|
179
|
+ {
|
|
180
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
181
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
182
|
+ width: '10', fixed: false, align: 'center',
|
|
183
|
+ sortable: false, hidden: true
|
|
184
|
+ },
|
|
185
|
+ {
|
|
186
|
+ index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
|
|
187
|
+ label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청번호
|
|
188
|
+ width: '20', fixed: false, align: 'center',
|
|
189
|
+ sortable: false, hidden: true, edittype: 'text',
|
|
190
|
+ editable: false
|
|
191
|
+ },
|
|
192
|
+ {
|
|
193
|
+ index: 'PCH_REQ_DTL_NO', name: 'pchReqDtlNo',
|
|
194
|
+ label: ITP_MSG_LOCALE.label.pchReqDtlNo, //구매요청항번
|
|
195
|
+ width: '30', fixed: false, align: 'center',
|
|
196
|
+ sortable: true, editable: false, edittype: 'text',
|
|
197
|
+ hidden: true
|
|
198
|
+ },
|
|
199
|
+ {
|
|
200
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
201
|
+ label: ITP_MSG_LOCALE.label.itemId, // 품목아이디
|
|
202
|
+ width: '10', fixed: false, align: 'center',
|
|
203
|
+ sortable: false, editable: false, edittype: 'text',
|
|
204
|
+ hidden: false
|
|
205
|
+ },
|
|
206
|
+ {
|
|
207
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
208
|
+ label: ITP_MSG_LOCALE.label.itemNm, //품목명
|
|
209
|
+ width: '10', fixed: false, align: 'left',
|
|
210
|
+ sortable: false, editable: false, edittype: 'text',
|
|
211
|
+ hidden: false
|
|
212
|
+ },
|
|
213
|
+ {
|
|
214
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
215
|
+ label: ITP_MSG_LOCALE.label.unitAmt, //단가
|
|
216
|
+ width: '10', fixed: false, align: 'right',
|
|
217
|
+ sortable: false, editable: false, edittype: 'text',
|
|
218
|
+ hidden: false
|
|
219
|
+ },
|
|
220
|
+ {
|
|
221
|
+ index: 'UNIT', name: 'unit',
|
|
222
|
+ label: ITP_MSG_LOCALE.label.unit, //단위
|
|
223
|
+ width: '10', fixed: false, align: 'center',
|
|
224
|
+ sortable: false, editable: false, edittype: 'text',
|
|
225
|
+ hidden: false
|
|
226
|
+ },
|
|
227
|
+ {
|
|
228
|
+ index: 'PCH_REQ_QTY', name: 'pchReqQty',
|
|
229
|
+ label: ITP_MSG_LOCALE.label.pchReqQty, //구매요청수량
|
|
230
|
+ width: '10', fixed: false, align: 'right',
|
|
231
|
+ sortable: false, editable: false, edittype: 'text',
|
|
232
|
+ hidden: false
|
|
233
|
+ },
|
|
234
|
+ {
|
|
235
|
+ index: 'PODR_QTY', name: 'podrQty',
|
|
236
|
+ label: ITP_MSG_LOCALE.label.podrQty, //발주수량
|
|
237
|
+ width: '10', fixed: false, align: 'right',
|
|
238
|
+ sortable: false, editable: true, edittype: 'text',
|
|
239
|
+ editrules: {required: true}, hidden: false
|
|
240
|
+ },
|
|
241
|
+ {
|
|
242
|
+ index: 'PODR_AMT', name: 'podrAmt',
|
|
243
|
+ label: ITP_MSG_LOCALE.label.podrAmt, //발주금액
|
|
244
|
+ width: '10', fixed: false, align: 'right',
|
|
245
|
+ sortable: false, editable: false, edittype: 'text',
|
|
246
|
+ hidden: false
|
|
247
|
+ },
|
|
248
|
+ {
|
|
249
|
+ index: 'DLV_REQ_DT', name: 'dlvReqDt',
|
|
250
|
+ label: ITP_MSG_LOCALE.label.dlvReqDt, //납기요청일
|
|
251
|
+ width: '10', fixed: false, align: 'center',
|
|
252
|
+ sortable: false, editable: false, edittype: 'text',
|
|
253
|
+ hidden: false
|
|
254
|
+ },
|
|
255
|
+ {
|
|
256
|
+ index: 'WHS_PASS_QTY', name: 'whsPassQty',
|
|
257
|
+ label: ITP_MSG_LOCALE.label.whsPassQty, //출고가능수량
|
|
258
|
+ width: '10', fixed: false, align: 'right',
|
|
259
|
+ sortable: false, editable: false, edittype: 'text',
|
|
260
|
+ hidden: false
|
|
261
|
+ },
|
|
262
|
+ {
|
|
263
|
+ index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
|
|
264
|
+ label: ITP_MSG_LOCALE.label.brandUnitUnqNo, //브랜드단가고유번호
|
|
265
|
+ width: '10', fixed: false, align: 'center',
|
|
266
|
+ sortable: false, editable: false, edittype: 'text',
|
|
267
|
+ hidden: true
|
|
268
|
+ },
|
|
269
|
+ {
|
|
270
|
+ index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
|
|
271
|
+ label: ITP_MSG_LOCALE.label.storeUnitUnqNo, //매장단가고유번호
|
|
272
|
+ width: '10', fixed: false, align: 'center',
|
|
273
|
+ sortable: false, editable: false, edittype: 'text',
|
|
274
|
+ hidden: true
|
|
275
|
+ }
|
|
276
|
+ ]
|
|
277
|
+};
|
|
278
|
+
|
|
279
|
+/*화면공통 Object*/
|
|
280
|
+let pageObj = {
|
|
281
|
+ init: function () {
|
|
282
|
+ this.ui.init();
|
|
283
|
+ this.event.init();
|
|
284
|
+ this.action();
|
|
285
|
+ },
|
|
286
|
+ ui: {
|
|
287
|
+ init: function () {
|
|
288
|
+ this.view();
|
|
289
|
+ this.grid();
|
|
290
|
+ this.ready();
|
|
291
|
+ },
|
|
292
|
+ view: function() {
|
|
293
|
+ // 버튼 권한설정
|
|
294
|
+ fn_proc_btn_auth('POMNG03010');
|
|
295
|
+
|
|
296
|
+ // 공통코드 표시
|
|
297
|
+ $('select').each(function() {
|
|
298
|
+ if($(this).data('select-code')) {
|
|
299
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
300
|
+ }
|
|
301
|
+ });
|
|
302
|
+
|
|
303
|
+ // 조회일자 지정
|
|
304
|
+ var now = new Date();
|
|
305
|
+ $('#ITP_TAB_POMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
306
|
+ $('#ITP_FORM_POMNG03010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
|
|
307
|
+ $('#ITP_FORM_POMNG03010_SEARCH_TO_DT').datepicker('setDate', new Date());
|
|
308
|
+
|
|
309
|
+ },
|
|
310
|
+ grid: function() {
|
|
311
|
+ itp_fn_jqgrid_resize(POMNG03010_GRID_ID, POMNG03010_GRID_LIST, 'lg');
|
|
312
|
+ listObj.empty.init();
|
|
313
|
+ itp_fn_fire_window_resize();
|
|
314
|
+ },
|
|
315
|
+ ready: function() {
|
|
316
|
+ listObj.init();
|
|
317
|
+ }
|
|
318
|
+ },
|
|
319
|
+ action: function () {
|
|
320
|
+ var _this = this;
|
|
321
|
+ // 검색 납품장소
|
|
322
|
+ $('#ITP_FORM_POMNG03010_SSEARCH_SWHS_NM').on('click', function() {
|
|
323
|
+ console.log("=================================");
|
|
324
|
+ _this.popup('SW');
|
|
325
|
+ });
|
|
326
|
+ // 검색 납품장소 텍스트 삭제 버튼 클릭
|
|
327
|
+ $('#ITP_FORM_POMNG03010_SDELETE_SWHS_NM').on('click', function() {
|
|
328
|
+ console.log("=================================");
|
|
329
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SWHS_NM').val('');
|
|
330
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SWHS_ID').val('');
|
|
331
|
+
|
|
332
|
+ });
|
|
333
|
+
|
|
334
|
+ // 검색 공급사
|
|
335
|
+ $('#ITP_FORM_POMNG03010_SSEARCH_SSPPLY_NM').on('click', function() {
|
|
336
|
+ console.log("=================================");
|
|
337
|
+ _this.popup('SS');
|
|
338
|
+ });
|
|
339
|
+ // 검색 텍스트 삭제 버튼 클릭
|
|
340
|
+ $('#ITP_FORM_POMNG03010_SDELETE_SSPPLY_NM').on('click', function() {
|
|
341
|
+ console.log("=================================");
|
|
342
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_NM').val('');
|
|
343
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_ID').val('');
|
|
344
|
+
|
|
345
|
+ });
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+ // 상세 출하창고
|
|
349
|
+ $('#ITP_BTN_POMNG03010_SEARCH_SHMT_WHS_NM').on('click', function() {
|
|
350
|
+ console.log("=================================");
|
|
351
|
+ _this.popup('SHW');
|
|
352
|
+ });
|
|
353
|
+ // 검색 납품장소 텍스트 삭제 버튼 클릭
|
|
354
|
+ $('#ITP_BTN_POMNG03010_DELETE_SHMT_WHS_NM').on('click', function() {
|
|
355
|
+ console.log("=================================");
|
|
356
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val('');
|
|
357
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val('');
|
|
358
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM').val('');
|
|
359
|
+
|
|
360
|
+ });
|
|
361
|
+
|
|
362
|
+ },
|
|
363
|
+ popup: function (arg) {
|
|
364
|
+ var popFn ;
|
|
365
|
+ // 팝업
|
|
366
|
+ if (arg == "SW") {
|
|
367
|
+ popFn = this.callback.searWhs;
|
|
368
|
+ } else if (arg == "SS") {
|
|
369
|
+ popFn = this.callback.searSpply;
|
|
370
|
+ } else if (arg == "SHW") {
|
|
371
|
+ popFn = this.callback.searShmtWhs;
|
|
372
|
+ }
|
|
373
|
+
|
|
374
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
375
|
+ if (arg == "SW") {
|
|
376
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
|
|
377
|
+ } else if (arg == "SS") {
|
|
378
|
+ fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
|
|
379
|
+ } else if (arg == "SHW") {
|
|
380
|
+ const key1 = {brandId:fn_make_user_info.get('brandId')};
|
|
381
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
|
|
382
|
+ }
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+ },
|
|
386
|
+ callback: {
|
|
387
|
+ searWhs: function(rowDataPop) {
|
|
388
|
+ console.log(rowDataPop);
|
|
389
|
+ if(rowDataPop) {
|
|
390
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
|
|
391
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
|
|
392
|
+ }
|
|
393
|
+
|
|
394
|
+ },
|
|
395
|
+ searSpply: function(rowDataPop) {
|
|
396
|
+ console.log(rowDataPop);
|
|
397
|
+ if(rowDataPop) {
|
|
398
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
|
|
399
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
|
|
400
|
+ }
|
|
401
|
+
|
|
402
|
+ },
|
|
403
|
+ searShmtWhs: function(rowDataPop) {
|
|
404
|
+ console.log(rowDataPop);
|
|
405
|
+ if(rowDataPop) {
|
|
406
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_NM').val(rowDataPop.whsNm + " - " + rowDataPop.locationNm);
|
|
407
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(rowDataPop.whsId);
|
|
408
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(rowDataPop.location);
|
|
409
|
+ }
|
|
410
|
+
|
|
411
|
+ }
|
|
412
|
+ },
|
|
413
|
+ event: {
|
|
414
|
+ init: function () {
|
|
415
|
+ this.button();
|
|
416
|
+ },
|
|
417
|
+ button: function () {
|
|
418
|
+ // 버튼 클릭 이벤트
|
|
419
|
+ $('button').each(function() {
|
|
420
|
+ var id = $(this).attr('id');
|
|
421
|
+ $(this).on('click', function() {
|
|
422
|
+ switch (id) {
|
|
423
|
+ case 'ITP_BTN_POMNG03010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
|
|
424
|
+ case 'ITP_BTN_POMNG03010_POCREATE' : listObj.button.chkpo(); break; // prpo 버튼
|
|
425
|
+ case 'ITP_BTN_POMNG03010_NEWPOCREATE' : listObj.button.newpocreate(); break; // 신규po 버튼
|
|
426
|
+ case 'ITP_BTN_POMNG03010_REJECT' : listObj.button.reject(); break; // 반려
|
|
427
|
+ case 'ITP_BTN_POMNG03010_PO' : modifyObj.button.save(); break; // 발주
|
|
428
|
+ case 'ITP_BTN_POMNG03010_CANCELLIST' : createObj.button.cancel(); break; // 취소/목록 버튼
|
|
429
|
+ case 'ITP_BTN_POMNG03010_DETAIL_ADDROW' : pageObj.grid.button.addRow(); break; // 품목추가
|
|
430
|
+ case 'ITP_BTN_POMNG03010_DETAIL_DELROW' : pageObj.grid.button.delRow(); break; // 품목삭제
|
|
431
|
+ }
|
|
432
|
+ });
|
|
433
|
+ });
|
|
434
|
+
|
|
435
|
+ }
|
|
436
|
+ },
|
|
437
|
+ switchScreen: function(mode) {
|
|
438
|
+ $('.itp_det_head').find('button[id^="ITP_BTN_POMNG03010_"]').each(function(i) {
|
|
439
|
+ $(this).hide();
|
|
440
|
+ });
|
|
441
|
+ $('#ITP_TAB_POMNG03010').find('div[id$="_CONTAINER"]').each(function(i) {
|
|
442
|
+ $(this).hide();
|
|
443
|
+ });
|
|
444
|
+ if(mode == 'LIST') { // 목록
|
|
445
|
+ $('#ITP_AJAX_POMNG03010_LIST_CONTAINER').show();
|
|
446
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_SRH', '#ITP_BTN_POMNG03010_POCREATE','#ITP_BTN_POMNG03010_NEWPOCREATE', '#ITP_BTN_POMNG03010_REJECT']);
|
|
447
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
448
|
+ $('#ITP_FORM_POMNG03010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
|
|
449
|
+ } else if(mode == 'NPC') { // 신규발주등록
|
|
450
|
+ $('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
|
|
451
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST', '#ITP_BTN_POMNG03010_DETAIL_ADDROW', '#ITP_BTN_POMNG03010_DETAIL_DELROW']);
|
|
452
|
+ $('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
453
|
+ $('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
454
|
+
|
|
455
|
+ $('#ITP_FORM_POMNG03010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
|
|
456
|
+ $(this).attr('id') === 'ITP_FORM_POMNG03010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
|
|
457
|
+ if(elem.type === 'select') {
|
|
458
|
+ $(this).val('').prop('selected', true);
|
|
459
|
+ }
|
|
460
|
+ });
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+ // 가맹점 정보 설정
|
|
464
|
+ /*
|
|
465
|
+ $('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
|
|
466
|
+ $('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
467
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
|
|
468
|
+
|
|
469
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnStoreNm').text('(자동부여)');
|
|
470
|
+ $('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').removeAttr('readonly');
|
|
471
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').hide();
|
|
472
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
|
|
473
|
+ if($(this).data('check-required')) $(this).data('check-required', '');
|
|
474
|
+ $(this).attr('disabled', true);
|
|
475
|
+ });
|
|
476
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').show();
|
|
477
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
|
|
478
|
+ if($(this).data('check-required')) $(this).data('check-required', 'empty');
|
|
479
|
+ $(this).attr('disabled', false);
|
|
480
|
+ });
|
|
481
|
+ */
|
|
482
|
+ var now = new Date();
|
|
483
|
+ $('#ITP_TAB_POMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
484
|
+ $('#ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+5)));
|
|
485
|
+ } else if(mode == 'POC') { // 구매요청 발주
|
|
486
|
+ $('#ITP_AJAX_POMNG03010_DETAIL_CONTAINER').show();
|
|
487
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_PO', '#ITP_BTN_POMNG03010_CANCELLIST']);
|
|
488
|
+ $('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
489
|
+ $('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
490
|
+ /*
|
|
491
|
+ $('#ITP_FORM_POMNG03010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
|
|
492
|
+ $('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
493
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(fn_make_user_info.get('brandNm'));
|
|
494
|
+
|
|
495
|
+ $('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').attr('readonly', true);
|
|
496
|
+ // $('#ITP_BTN_POMNG03010_RESET_PW').show();
|
|
497
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').show();
|
|
498
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_info').find('input, select').each(function(i, elem) {
|
|
499
|
+ if($(this).data('check-required')) $(this).data('check-required', 'empty');
|
|
500
|
+ $(this).attr('disabled', false);
|
|
501
|
+ });
|
|
502
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').hide();
|
|
503
|
+ $('#ITP_FORM_POMNG03010_DETAIL .itp_form_change').find('input, select').each(function(i, elem) {
|
|
504
|
+ if($(this).data('check-required')) $(this).data('check-required', '');
|
|
505
|
+ $(this).attr('disabled', true);
|
|
506
|
+ });
|
|
507
|
+ */
|
|
508
|
+
|
|
509
|
+ }
|
|
510
|
+ /*
|
|
511
|
+ else if(mode == 'VIEW') { // 보기
|
|
512
|
+ $('#ITP_AJAX_POMNG03010_VIEW_CONTAINER').show();
|
|
513
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG03010_MODIFY', '#ITP_BTN_POMNG03010_CANCELLIST']);
|
|
514
|
+ }
|
|
515
|
+ */
|
|
516
|
+ }
|
|
517
|
+};
|
|
518
|
+
|
|
519
|
+/*목록화면 Object*/
|
|
520
|
+let listObj = {
|
|
521
|
+ init: function () {
|
|
522
|
+ this.grid.init();
|
|
523
|
+ },
|
|
524
|
+ itp_POMNG03010_search: false,
|
|
525
|
+ button: {
|
|
526
|
+ search: function() {
|
|
527
|
+ listObj.itp_POMNG03010_search = true;
|
|
528
|
+ let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
|
|
529
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
530
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
531
|
+ $(POMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
532
|
+ },
|
|
533
|
+ pocreate: function(param) {
|
|
534
|
+ pageObj.switchScreen('POC');
|
|
535
|
+ itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
|
|
536
|
+ modifyObj.init(param);
|
|
537
|
+ },
|
|
538
|
+ newpocreate: function() {
|
|
539
|
+ pageObj.switchScreen('NPC');
|
|
540
|
+ itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
|
|
541
|
+ createObj.init();
|
|
542
|
+ },
|
|
543
|
+ reject: function() {
|
|
544
|
+ //팝업 오픈
|
|
545
|
+ //pageObj.switchScreen('NPC');
|
|
546
|
+ //itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
|
|
547
|
+ //createObj.init();
|
|
548
|
+ },
|
|
549
|
+ chkpo: function() {
|
|
550
|
+ let gridUpdateData = [];
|
|
551
|
+ console.log("==================");
|
|
552
|
+ const rowKey = $(POMNG03010_GRID_ID).getGridParam('selrow');
|
|
553
|
+ console.log(rowKey);
|
|
554
|
+ if (!rowKey) {
|
|
555
|
+ console.log("################");
|
|
556
|
+ return;
|
|
557
|
+ }
|
|
558
|
+
|
|
559
|
+ var selectedIds = $(POMNG03010_GRID_ID).getGridParam('selarrrow');
|
|
560
|
+
|
|
561
|
+ for (var i=selectedIds.length-1; i>=0; i--) {
|
|
562
|
+ gridUpdateData.push($(POMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]));
|
|
563
|
+ }
|
|
564
|
+
|
|
565
|
+ let param = {};
|
|
566
|
+ param.brandId=fn_make_user_info.get('brandId');
|
|
567
|
+ param.gridUpdateData = gridUpdateData;
|
|
568
|
+ console.log(JSON.stringify(param));
|
|
569
|
+ var chkFn = function(result) {
|
|
570
|
+ console.log(result);
|
|
571
|
+ if (result.code == "Y") {
|
|
572
|
+ //발수 생성화면으로 전화
|
|
573
|
+ listObj.button.pocreate(param);
|
|
574
|
+ }
|
|
575
|
+ };
|
|
576
|
+ fn_ajax_call(API_DETAIL_POPASS_CHK, JSON.stringify(param), chkFn, 'POST');
|
|
577
|
+ },
|
|
578
|
+ },
|
|
579
|
+ empty: {
|
|
580
|
+ init: function() {
|
|
581
|
+ var _this = this;
|
|
582
|
+ this.push();
|
|
583
|
+ $(POMNG03010_GRID_EMPTY).on('click', function() {
|
|
584
|
+ _this.back();
|
|
585
|
+ _this.itp_POMNG03010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
586
|
+ $(POMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_POMNG03010_param)}).trigger('reloadGrid');
|
|
587
|
+ });
|
|
588
|
+ },
|
|
589
|
+ itp_POMNG03010_param: {},
|
|
590
|
+ push: function() {
|
|
591
|
+ let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
|
|
592
|
+ listObj.itp_POMNG03010_param = param;
|
|
593
|
+ },
|
|
594
|
+ back: function() {
|
|
595
|
+ $('#ITP_FORM_POMNG03010_SEARCH_FROM_DT').val(this.itp_POMNG03010_param.fromDt);
|
|
596
|
+ $('#ITP_FORM_POMNG03010_SEARCH_TO_DT').val(this.itp_POMNG03010_param.toDt);
|
|
597
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SPPLY_ID').val(this.itp_POMNG03010_param.sspplyId);
|
|
598
|
+ $('#ITP_FORM_POMNG03010_SEARCH_SPPLY_NM').val(this.itp_POMNG03010_param.sspplyNm);
|
|
599
|
+ $('#ITP_FORM_POMNG03010_SEARCH_WHS_NM').val(this.itp_POMNG03010_param.swhsNm);
|
|
600
|
+ $('#ITP_FORM_POMNG03010_SEARCH_WHS_ID').val(this.itp_POMNG03010_param.swhsId);
|
|
601
|
+ $('#ITP_FORM_POMNG03010_SEARCH_ITEM_NM').val(this.itp_POMNG03010_param.sitemNm);
|
|
602
|
+ }
|
|
603
|
+ },
|
|
604
|
+ grid: {
|
|
605
|
+ init: function () {
|
|
606
|
+ // 데이터 없을때
|
|
607
|
+ listObj.empty.push();
|
|
608
|
+ this.search();
|
|
609
|
+ },
|
|
610
|
+ colModel: gridColModel.list,
|
|
611
|
+ search: function() {
|
|
612
|
+ pageObj.switchScreen('LIST');
|
|
613
|
+ this.unload();
|
|
614
|
+ this.load();
|
|
615
|
+ },
|
|
616
|
+ load: function() {
|
|
617
|
+ let param = $('#ITP_FORM_POMNG03010_SEARCH').serializeObject();
|
|
618
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
619
|
+
|
|
620
|
+ var option = {
|
|
621
|
+ multiselect: true,
|
|
622
|
+ autowidth: true,
|
|
623
|
+ gridId: POMNG03010_GRID_ID,
|
|
624
|
+ colModel: gridColModel.list,
|
|
625
|
+ param: param,
|
|
626
|
+ url: DOMAIN + API_DETAIL_GRID_LIST,
|
|
627
|
+ pager: POMNG03010_GRID_PAGER,
|
|
628
|
+ loadComplete: function(data) {
|
|
629
|
+ console.log(data);
|
|
630
|
+ itp_fn_grid_load_complete(data, POMNG03010_GRID_ID, true, 'number', 'POMNG03010', listObj.itp_POMNG03010_search, listObj.empty, true, data.gridRecords, true);
|
|
631
|
+ var ids = $(POMNG03010_GRID_ID).getDataIDs();
|
|
632
|
+ $.each(ids, function(idx, rowId) {
|
|
633
|
+ $(POMNG03010_GRID_ID).jqGrid('setCell', rowId, 'storeId', '', ITP_GRID_COL_STYLE.link);
|
|
634
|
+ });
|
|
635
|
+ },
|
|
636
|
+ onPaging: function(action) {
|
|
637
|
+ itp_fn_grid_paging(POMNG03010_GRID_ID, action, param);
|
|
638
|
+ }
|
|
639
|
+ };
|
|
640
|
+ itp_fn_grid_make_remote(option);
|
|
641
|
+ },
|
|
642
|
+ button: {
|
|
643
|
+ },
|
|
644
|
+ unload : function() {
|
|
645
|
+ $.jgrid.gridUnload(POMNG03010_GRID_ID);
|
|
646
|
+ },
|
|
647
|
+ clearData : function() {
|
|
648
|
+ $(POMNG03010_GRID_ID).jqGrid('clearGridData', true);
|
|
649
|
+ $(POMNG03010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
650
|
+ $(POMNG03010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
651
|
+ $(POMNG03010_GRID_EMPTY).show();
|
|
652
|
+ }
|
|
653
|
+ }
|
|
654
|
+};
|
|
655
|
+
|
|
656
|
+/*수정화면 Object*/
|
|
657
|
+let modifyObj = {
|
|
658
|
+ init: function (param) {
|
|
659
|
+ this.load(param);
|
|
660
|
+ },
|
|
661
|
+ button: {
|
|
662
|
+ modify: function (param) {
|
|
663
|
+ itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
|
|
664
|
+ const selectVal = $('#ITP_FORM_POMNG03010_VIEW_STORE_ID').val();
|
|
665
|
+ const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
|
|
666
|
+ var param = $.param(key);
|
|
667
|
+ console.log(param);
|
|
668
|
+ modifyObj.load(param);
|
|
669
|
+ },
|
|
670
|
+ save: function() {
|
|
671
|
+ const formId = '#ITP_FORM_POMNG03010_DETAIL';
|
|
672
|
+ itp_fn_form_clear_validate(null, formId);
|
|
673
|
+
|
|
674
|
+ // console.log($(formId).serializeObject());
|
|
675
|
+ if (itp_fn_form_event.isValid(formId)) {
|
|
676
|
+ var modalFn = {
|
|
677
|
+ callBack: () => {
|
|
678
|
+ itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
|
|
679
|
+
|
|
680
|
+ let gridInsertData = [];
|
|
681
|
+ const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
|
|
682
|
+
|
|
683
|
+ $.each(rowData, function(key, value) {
|
|
684
|
+ gridInsertData.push(value);
|
|
685
|
+ });
|
|
686
|
+
|
|
687
|
+ let param = $(formId).serializeObject();
|
|
688
|
+ param.gridInsertData = gridInsertData;
|
|
689
|
+
|
|
690
|
+ var searhFn = function () {
|
|
691
|
+ ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
|
|
692
|
+ modifyObj.grid.clearData();
|
|
693
|
+ createObj.button.cancel();
|
|
694
|
+ }
|
|
695
|
+ fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
|
|
696
|
+ }
|
|
697
|
+ };
|
|
698
|
+ itp_fn_modal_confirm('발주 진행 하시겠습니까?', modalFn);
|
|
699
|
+ }
|
|
700
|
+ }
|
|
701
|
+ },
|
|
702
|
+
|
|
703
|
+ load: function(param) {
|
|
704
|
+ fn_ajax_call(API_DETAIL_PO_INIT_INFO, JSON.stringify(param), this.callback, 'POST');
|
|
705
|
+ },
|
|
706
|
+ callback: function (result) {
|
|
707
|
+ console.log(result);
|
|
708
|
+ pageObj.switchScreen('POC');
|
|
709
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_VIEW_CD').val('C');
|
|
710
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(result.brandId);
|
|
711
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnBrandNm').text(result.brandNm);
|
|
712
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(result.storeId);
|
|
713
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SPPLY_ID').val(result.spplyId);
|
|
714
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnPchReqNm').text(result.spplyNm);
|
|
715
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnPodrDt').text(result.podrDt);
|
|
716
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnWhsNm').text(result.dlvPlace);
|
|
717
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_WHS_ID').val(result.whsId);
|
|
718
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_LOCATION').val(result.location);
|
|
719
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_PODR_MGR_ID').val(result.podrMgrId);
|
|
720
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnPodrMgrNm').text(result.podrMgrNm);
|
|
721
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_PODR_MGR_TEL_NO').val(result.podrMgrTelNo);
|
|
722
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_DVSN').val(result.dlvDvsn);
|
|
723
|
+ //$('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_').val(result.dlvDvsnNm);
|
|
724
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(result.podrTotalAmt);
|
|
725
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_DLV_REQ_DT').val(result.dlvReqDt);
|
|
726
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_WHS_ID').val(result.shmtWhsId);
|
|
727
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DELETE_SHMT_WHS_NM').val(result.shmtWhsNm + " - " + result.shmtLocationNm );
|
|
728
|
+ $('#ITP_FORM_POMNG03010_DETAIL #ITP_FORM_POMNG03010_DETAIL_SHMT_LOCATION').val(result.shmtLocation);
|
|
729
|
+
|
|
730
|
+ // 품목 리스트 조회
|
|
731
|
+ modifyObj.grid.init('DETAIL', result.itemList);
|
|
732
|
+ // modifyObj.grid.load(result.spplyMgrList);
|
|
733
|
+ },
|
|
734
|
+ grid: {
|
|
735
|
+ init: function(mode, gridRows) {
|
|
736
|
+ this.gridId = POMNG03010_DETAIL_GRID_ID;
|
|
737
|
+ this.gridList = POMNG03010_DETAIL_GRID_LIST;
|
|
738
|
+ this.gridEmpty = POMNG03010_DETAIL_GRID_EMPTY;
|
|
739
|
+ this.gridRows = gridRows;
|
|
740
|
+ this.load(mode, gridRows);
|
|
741
|
+ },
|
|
742
|
+ gridId: '',
|
|
743
|
+ mode: 'DETAIL',
|
|
744
|
+ button: {},
|
|
745
|
+ gridList: '',
|
|
746
|
+ gridEmpty: '',
|
|
747
|
+ gridRows: '',
|
|
748
|
+ load: function(mode, gridRows) {
|
|
749
|
+ var _this = this;
|
|
750
|
+ var option = {
|
|
751
|
+ gridId: _this.gridId,
|
|
752
|
+ colModel: gridColModel.detail,
|
|
753
|
+ data: gridRows,
|
|
754
|
+ cellEdit: true,
|
|
755
|
+ multiselect: false,
|
|
756
|
+ // cellEdit: (mode !== 'VIEW'),
|
|
757
|
+ loadComplete: function(data) {
|
|
758
|
+ console.log(data);
|
|
759
|
+ $(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
|
|
760
|
+ (Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
|
|
761
|
+ },
|
|
762
|
+ onCellSelect: function(rowid, cellIdx, cellValue) {
|
|
763
|
+ console.log('mode ===> ' + mode);
|
|
764
|
+ POMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['actionId']);
|
|
765
|
+ },
|
|
766
|
+ afterSaveCell: function(rowid,name,val,iRow,iCol) {
|
|
767
|
+ // 구매요청금액 계산 (기존금액과 )
|
|
768
|
+ var unitAmt = jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('getCell',rowid,iCol-3);
|
|
769
|
+ jQuery(POMNG03010_DETAIL_GRID_ID).jqGrid('setRowData',rowid,{podrAmt: parseInt(val)*parseInt(unitAmt)});
|
|
770
|
+
|
|
771
|
+ // 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
|
|
772
|
+ _this.recal();
|
|
773
|
+ }
|
|
774
|
+ };
|
|
775
|
+ itp_fn_grid_make_local(option);
|
|
776
|
+ },
|
|
777
|
+ recal: function() {
|
|
778
|
+ //PCH_REQ_AMT
|
|
779
|
+ console.log("==========================================");
|
|
780
|
+ const rowData = $(POMNG03010_DETAIL_GRID_ID).getRowData();
|
|
781
|
+ var podrAmt = 0 ;
|
|
782
|
+ console.log("####################################");
|
|
783
|
+ $.each(rowData, function(key, value) {
|
|
784
|
+ console.log(rowData);
|
|
785
|
+ if (value.podrAmt != null && value.podrAmt != "" && value.viewCd != "D") {
|
|
786
|
+ podrAmt = podrAmt + parseInt(value.podrAmt) ;
|
|
787
|
+ }
|
|
788
|
+
|
|
789
|
+ });
|
|
790
|
+ $('#ITP_FORM_POMNG03010_DETAIL .fnPodrAmt').text(podrAmt);
|
|
791
|
+ },
|
|
792
|
+ clearData : function() {
|
|
793
|
+ $(POMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
|
|
794
|
+ $(POMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
795
|
+ $(POMNG03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
796
|
+ $(POMNG03010_DETAIL_GRID_EMPTY).show();
|
|
797
|
+ }
|
|
798
|
+ },
|
|
799
|
+};
|
|
800
|
+
|
|
801
|
+/*신규화면 Object*/
|
|
802
|
+let createObj = {
|
|
803
|
+ init: function () {
|
|
804
|
+ $('#ITP_FORM_POMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
805
|
+ $('#ITP_FORM_POMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
806
|
+
|
|
807
|
+ },
|
|
808
|
+ button: {
|
|
809
|
+ cancel: function() {
|
|
810
|
+ document.getElementById('ITP_FORM_POMNG03010_DETAIL').reset();
|
|
811
|
+ listObj.grid.search();
|
|
812
|
+ },
|
|
813
|
+ save: function() {
|
|
814
|
+ const formId = '#ITP_FORM_POMNG03010_DETAIL';
|
|
815
|
+ itp_fn_form_clear_validate(null, formId);
|
|
816
|
+
|
|
817
|
+ // console.log($(formId).serializeObject());
|
|
818
|
+ if (itp_fn_form_event.isValid(formId)) {
|
|
819
|
+ var modalFn = {
|
|
820
|
+ callBack: (args) => {
|
|
821
|
+ itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
|
|
822
|
+ let param = $(formId).serializeObject();
|
|
823
|
+ console.log(JSON.stringify(param));
|
|
824
|
+ var searhFn = function () {
|
|
825
|
+ ITP_FORM_POMNG03010_DETAIL_IS_WRITING = false;
|
|
826
|
+ listObj.grid.search();
|
|
827
|
+ }
|
|
828
|
+ fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
|
|
829
|
+ }
|
|
830
|
+ };
|
|
831
|
+ itp_fn_modal_confirm('저장 하시겠습니까?', modalFn);
|
|
832
|
+ }
|
|
833
|
+ }
|
|
834
|
+ }
|
|
835
|
+};
|