|
@@ -17,9 +17,12 @@ const ORDMNG02010_DETAIL_GRID_LIST = '#ITP_ORDMNG02010_DETAIL_jqGrid_list';
|
17
|
17
|
const ORDMNG02010_DETAIL_GRID_PAGER = '#ITP_ORDMNG02010_DETAIL_jqGridPager';
|
18
|
18
|
const ORDMNG02010_DETAIL_GRID_EMPTY = '#ITP_ORDMNG02010_DETAIL_jqGridEmpty';
|
19
|
19
|
|
|
20
|
+let ITP_FORM_OPER03010_DETAIL_IS_WRITING = false;
|
20
|
21
|
let ORDMNG02010_GRID_LAST_ROW_ID;
|
21
|
22
|
|
22
|
|
-//let shmtQtyValue;
|
|
23
|
+// editrules
|
|
24
|
+let shmtQtyValue;
|
|
25
|
+let isExpryDate;
|
23
|
26
|
|
24
|
27
|
/*API URL*/
|
25
|
28
|
let API_POMNG_INOUTMNG_SPPLY_TARGET_GRID_LIST = '/api/pomng/inoutmng/spply-target-grid-list'; // 공급사 납품 대상리스트 그리 리스트
|
|
@@ -104,71 +107,7 @@ const gridColModel = {
|
104
|
107
|
}
|
105
|
108
|
],
|
106
|
109
|
view: [],
|
107
|
|
- detail: [
|
108
|
|
- {
|
109
|
|
- index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
|
110
|
|
- label: ITP_MSG_LOCALE.label.pchPodrDtlNo, //발주항번
|
111
|
|
- width: '20', fixed: false, align: 'center',
|
112
|
|
- sortable: false, hidden: false, edittype: 'text',
|
113
|
|
- editable: false
|
114
|
|
- },
|
115
|
|
- {
|
116
|
|
- index: 'ITEM_ID', name: 'itemId',
|
117
|
|
- label: ITP_MSG_LOCALE.label.itemId, //품목번호
|
118
|
|
- width: '20', fixed: false, align: 'center',
|
119
|
|
- sortable: false, hidden: false, edittype: 'text',
|
120
|
|
- editable: false
|
121
|
|
- },
|
122
|
|
- {
|
123
|
|
- index: 'ITEM_NM', name: 'itemNm',
|
124
|
|
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
|
125
|
|
- width: '20', fixed: false, align: 'center',
|
126
|
|
- sortable: false, hidden: false, edittype: 'text',
|
127
|
|
- editable: false
|
128
|
|
- },
|
129
|
|
- {
|
130
|
|
- index: 'UNIT', name: 'unit',
|
131
|
|
- label: ITP_MSG_LOCALE.label.unit, //기본단위
|
132
|
|
- width: '20', fixed: false, align: 'center',
|
133
|
|
- sortable: false, hidden: false, edittype: 'text',
|
134
|
|
- editable: false
|
135
|
|
- },
|
136
|
|
- {
|
137
|
|
- index: 'PODR_QTY', name: 'podrQty',
|
138
|
|
- label: ITP_MSG_LOCALE.label.podrQty, //발주수량
|
139
|
|
- width: '20', fixed: false, align: 'center',
|
140
|
|
- sortable: false, hidden: false, edittype: 'text',
|
141
|
|
- editable: false
|
142
|
|
- },
|
143
|
|
- {
|
144
|
|
- index: 'SHMT_QTY', name: 'shmtQty',
|
145
|
|
- label: ITP_MSG_LOCALE.label.shmtQty, //출하수량
|
146
|
|
- width: '20', fixed: false, align: 'center',
|
147
|
|
- sortable: false, hidden: false, edittype: 'text',
|
148
|
|
- editable: true, /*editrules: {custom: true, custom_func: shmtQtyValue}*/
|
149
|
|
- },
|
150
|
|
- {
|
151
|
|
- index: 'EXPRY_YN', name: 'expryYn',
|
152
|
|
- label: ITP_MSG_LOCALE.label.expryYn, //유통기한여부
|
153
|
|
- width: '20', fixed: false, align: 'center',
|
154
|
|
- sortable: false, hidden: false, edittype: 'text',
|
155
|
|
- editable: false
|
156
|
|
- },
|
157
|
|
- {
|
158
|
|
- index: 'EXPRY_DATE', name: 'expryDate',
|
159
|
|
- label: ITP_MSG_LOCALE.label.expryDate, //유통기한일자
|
160
|
|
- width: '20', fixed: false, align: 'center',
|
161
|
|
- sortable: false, hidden: false, edittype: 'date',
|
162
|
|
- editable: true
|
163
|
|
- },
|
164
|
|
- {
|
165
|
|
- index: 'REMARK', name: 'remark',
|
166
|
|
- label: ITP_MSG_LOCALE.label.remark, //비고
|
167
|
|
- width: '20', fixed: false, align: 'center',
|
168
|
|
- sortable: false, hidden: false, edittype: 'text',
|
169
|
|
- editable: true
|
170
|
|
- }
|
171
|
|
- ]
|
|
110
|
+ detail: []
|
172
|
111
|
};
|
173
|
112
|
|
174
|
113
|
|
|
@@ -182,6 +121,7 @@ let pageObj = {
|
182
|
121
|
init: function() {
|
183
|
122
|
this.view();
|
184
|
123
|
this.grid();
|
|
124
|
+ this.form();
|
185
|
125
|
this.ready();
|
186
|
126
|
},
|
187
|
127
|
view: function() {
|
|
@@ -201,6 +141,9 @@ let pageObj = {
|
201
|
141
|
$('#ITP_FORM_ORDMNG02010_SEARCH_FROM_DT').datepicker('setDate', '2022.10.01'/*now*/);
|
202
|
142
|
$('#ITP_FORM_ORDMNG02010_SEARCH_TO_DT').datepicker('setDate', '2024.10.01'/*defaultToDate*/);
|
203
|
143
|
},
|
|
144
|
+ form: function() {
|
|
145
|
+ itp_fn_form_event.onKeyup('#ITP_FORM_ORDMNG02010_DETAIL');
|
|
146
|
+ },
|
204
|
147
|
grid: function() {
|
205
|
148
|
itp_fn_jqgrid_resize(ORDMNG02010_GRID_ID, ORDMNG02010_GRID_LIST, 'lg');
|
206
|
149
|
listObj.empty.init();
|
|
@@ -223,7 +166,7 @@ let pageObj = {
|
223
|
166
|
case 'ITP_BTN_ORDMNG02010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
|
224
|
167
|
case 'ITP_BTN_ORDMNG02010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
|
225
|
168
|
case 'ITP_BTN_ORDMNG02010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
|
226
|
|
- case 'ITP_BTN_ORDMNG02010_SAVE' : modifyObj.button.save(); break; // 발주 취소 버튼(예정)
|
|
169
|
+ case 'ITP_BTN_ORDMNG02010_SAVE' : modifyObj.button.save(); break; // 생성버튼
|
227
|
170
|
}
|
228
|
171
|
});
|
229
|
172
|
});
|
|
@@ -267,7 +210,8 @@ let pageObj = {
|
267
|
210
|
}*/ else if(mode === 'MODIFY') { // 수정
|
268
|
211
|
$('#ITP_AJAX_ORDMNG02010_DETAIL_CONTAINER').show();
|
269
|
212
|
fn_show_btn_auth_array(['#ITP_BTN_ORDMNG02010_CANCELLIST', '#ITP_BTN_ORDMNG02010_SAVE', '#ITP_BTN_ORDMNG02010_RESET_PW']);
|
270
|
|
-
|
|
213
|
+ $('#ITP_FORM_ORDMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
214
|
+ $('#ITP_FORM_ORDMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_SEARCH_SPPLY_ID').val(fn_make_user_info.get('spplyId'));
|
271
|
215
|
$('#ITP_FORM_ORDMNG02010_DETAIL_USER_ID').attr('readonly', true);
|
272
|
216
|
$('#ITP_FORM_ORDMNG02010_DETAIL_DUP').attr('disabled', true);
|
273
|
217
|
$('#ITP_FORM_ORDMNG02010_DETAIL_SEARCH_AFFL_SHOP_NM').attr('readonly', true);
|
|
@@ -434,6 +378,43 @@ let modifyObj = {
|
434
|
378
|
button: {
|
435
|
379
|
cancel: function() {
|
436
|
380
|
listObj.grid.search();
|
|
381
|
+ },
|
|
382
|
+ save: function() {
|
|
383
|
+ console.log(111111);
|
|
384
|
+ const formId = '#ITP_FORM_ORDMNG02010_DETAIL';
|
|
385
|
+ itp_fn_form_clear_validate(null, formId);
|
|
386
|
+ console.log(22222);
|
|
387
|
+ itp_fn_grid_save_rows(ORDMNG02010_DETAIL_GRID_ID);
|
|
388
|
+ let gridInsertData = [];
|
|
389
|
+ for(var i=0; i<$(ORDMNG02010_DETAIL_GRID_ID).getGridParam('reccount'); i++) {
|
|
390
|
+ $(ORDMNG02010_DETAIL_GRID_ID).jqGrid('saveCell', i+1, 2)
|
|
391
|
+ }
|
|
392
|
+ const rowData = $(ORDMNG02010_DETAIL_GRID_ID).getRowData();
|
|
393
|
+ console.log(rowData);
|
|
394
|
+ const keyValue = $(formId + '_BRAND_ID').val();
|
|
395
|
+ $.each(rowData, function(key, value) {
|
|
396
|
+ if (value.viewCd != 'R') {
|
|
397
|
+ value.userId = keyValue;
|
|
398
|
+ if (value.viewCd == 'C') {
|
|
399
|
+ gridInsertData.push(value);
|
|
400
|
+ }
|
|
401
|
+ }
|
|
402
|
+ });
|
|
403
|
+ var modalFn = {
|
|
404
|
+ callBack: (args) => {
|
|
405
|
+ console.log(444444444);
|
|
406
|
+ let param = $(formId).serializeObject();
|
|
407
|
+ param.gridInsertData = gridInsertData;
|
|
408
|
+ console.log(5555);
|
|
409
|
+ console.log(param);
|
|
410
|
+ var searhFn = function () {
|
|
411
|
+ ITP_FORM_OPER03010_DETAIL_IS_WRITING = false;
|
|
412
|
+ listObj.grid.search();
|
|
413
|
+ }
|
|
414
|
+ //fn_ajax_call(API_POMNG_INOUTMNG_SAVE_SPPLY_INV, JSON.stringify(param), searhFn, 'POST');
|
|
415
|
+ }
|
|
416
|
+ };
|
|
417
|
+ itp_fn_modal_confirm('저장 하시겠습니까?', modalFn);
|
437
|
418
|
}
|
438
|
419
|
},
|
439
|
420
|
empty: {
|
|
@@ -473,19 +454,39 @@ let modifyObj = {
|
473
|
454
|
$('#ITP_FORM_ORDMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_DLV_MGR_NM').val(result.dlvMgrNm); // 납품담당자
|
474
|
455
|
$('#ITP_FORM_ORDMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_DLV_MGR_TEL_NO').val(result.dlvMgrTelNo); // 납품담당자연락처
|
475
|
456
|
|
476
|
|
- /*shmtQtyValue = function(value, colname) {
|
477
|
|
- for(let i = 0; i < result.invPoInfoList.length; i++){
|
478
|
|
- let podrQty = result.invPoInfoList[i].podrQty;
|
479
|
|
- if(value > podrDty) {
|
480
|
|
- return [false, '발주수량 이하 값 입력'];
|
481
|
|
- } else {
|
482
|
|
- return [true, ''];
|
483
|
|
- }
|
|
457
|
+ shmtQtyValue = function(value, colname) {
|
|
458
|
+ var selectedIds = $(ORDMNG02010_DETAIL_GRID_ID).getGridParam('selarrrow');
|
|
459
|
+
|
|
460
|
+ var selRowData ; //변수선언
|
|
461
|
+ for (var i=selectedIds.length-1; i>=0; i--) { //1개만 선택시
|
|
462
|
+ selRowData = $(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getRowData', selectedIds[i]); //cell 선택
|
|
463
|
+ }
|
|
464
|
+ let podrQty = selRowData.podrQty;
|
|
465
|
+ if(value > podrQty) {
|
|
466
|
+ console.log(podrQty);
|
|
467
|
+ return [false, '발주수량 이하 값 입력'];
|
|
468
|
+ } else {
|
|
469
|
+ console.log(podrQty);
|
|
470
|
+ return [true, ''];
|
484
|
471
|
}
|
485
|
|
- };*/
|
486
|
|
-
|
487
|
|
- modifyObj.grid.init('MODIFY', result.invPoInfoList);
|
488
|
|
-
|
|
472
|
+ };
|
|
473
|
+ isExpryDate = function(value, colname) {
|
|
474
|
+ var selectedIds = $(ORDMNG02010_DETAIL_GRID_ID).getGridParam('selarrrow');
|
|
475
|
+
|
|
476
|
+ var selRowData ; //변수선언
|
|
477
|
+ for (var i=selectedIds.length-1; i>=0; i--) { //1개만 선택시
|
|
478
|
+ selRowData = $(ORDMNG02010_DETAIL_GRID_ID).jqGrid('getRowData', selectedIds[i]); //cell 선택
|
|
479
|
+ }
|
|
480
|
+ let expryYn = selRowData.expryYn;
|
|
481
|
+ if (expryYn !== 'Y' && value.length > 0) {
|
|
482
|
+ console.log(expryYn);
|
|
483
|
+ return [false, '유통기한여부 N'];
|
|
484
|
+ } else {
|
|
485
|
+ console.log(expryYn);0
|
|
486
|
+ return [true, ''];
|
|
487
|
+ }
|
|
488
|
+ }
|
|
489
|
+ modifyObj.grid.init('MODIFY', result.invPoInfoList);
|
489
|
490
|
},
|
490
|
491
|
grid: {
|
491
|
492
|
init: function(mode, gridData) {
|
|
@@ -502,7 +503,73 @@ let modifyObj = {
|
502
|
503
|
var _this = this;
|
503
|
504
|
var option = {
|
504
|
505
|
gridId: _this.gridId,
|
505
|
|
- colModel: gridColModel.detail,
|
|
506
|
+ colModel: [
|
|
507
|
+ {
|
|
508
|
+ index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
|
|
509
|
+ label: ITP_MSG_LOCALE.label.pchPodrDtlNo, //발주항번
|
|
510
|
+ width: '20', fixed: false, align: 'center',
|
|
511
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
512
|
+ editable: false
|
|
513
|
+ },
|
|
514
|
+ {
|
|
515
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
516
|
+ label: ITP_MSG_LOCALE.label.itemId, //품목번호
|
|
517
|
+ width: '20', fixed: false, align: 'center',
|
|
518
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
519
|
+ editable: false
|
|
520
|
+ },
|
|
521
|
+ {
|
|
522
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
523
|
+ label: ITP_MSG_LOCALE.label.itemNm, //품목명
|
|
524
|
+ width: '20', fixed: false, align: 'center',
|
|
525
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
526
|
+ editable: false
|
|
527
|
+ },
|
|
528
|
+ {
|
|
529
|
+ index: 'UNIT', name: 'unit',
|
|
530
|
+ label: ITP_MSG_LOCALE.label.unit, //기본단위
|
|
531
|
+ width: '20', fixed: false, align: 'center',
|
|
532
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
533
|
+ editable: false
|
|
534
|
+ },
|
|
535
|
+ {
|
|
536
|
+ index: 'PODR_QTY', name: 'podrQty',
|
|
537
|
+ label: ITP_MSG_LOCALE.label.podrQty, //발주수량
|
|
538
|
+ width: '20', fixed: false, align: 'center',
|
|
539
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
540
|
+ editable: false
|
|
541
|
+ },
|
|
542
|
+ {
|
|
543
|
+ index: 'SHMT_QTY', name: 'shmtQty',
|
|
544
|
+ label: ITP_MSG_LOCALE.label.shmtQty, //출하수량
|
|
545
|
+ width: '20', fixed: false, align: 'center',
|
|
546
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
547
|
+ editable: true, editrules: {number: true, custom: true, custom_func: shmtQtyValue}
|
|
548
|
+ },
|
|
549
|
+ {
|
|
550
|
+ index: 'EXPRY_YN', name: 'expryYn',
|
|
551
|
+ label: ITP_MSG_LOCALE.label.expryYn, //유통기한여부
|
|
552
|
+ width: '20', fixed: false, align: 'center',
|
|
553
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
554
|
+ editable: false
|
|
555
|
+ },
|
|
556
|
+ {
|
|
557
|
+ index: 'EXPRY_DATE', name: 'expryDate',
|
|
558
|
+ label: ITP_MSG_LOCALE.label.expryDate, //유통기한일자
|
|
559
|
+ width: '20', fixed: false, align: 'center',
|
|
560
|
+ sortable: false, hidden: false, /*edittype: 'text',*/
|
|
561
|
+ editable: true, sorttype: 'date',
|
|
562
|
+ editoptions: {dataInit: function(e) {$(e).datepicker(ITP_DATE_LANGUAGE);}},
|
|
563
|
+ editrules: {custom: true, custom_func: isExpryDate}
|
|
564
|
+ },
|
|
565
|
+ {
|
|
566
|
+ index: 'REMARK', name: 'remark',
|
|
567
|
+ label: ITP_MSG_LOCALE.label.remark, //비고
|
|
568
|
+ width: '20', fixed: false, align: 'center',
|
|
569
|
+ sortable: false, hidden: false, edittype: 'text',
|
|
570
|
+ editable: true
|
|
571
|
+ }
|
|
572
|
+ ],
|
506
|
573
|
data: gridData,
|
507
|
574
|
multiselect: true,
|
508
|
575
|
loadComplete: function(data) {
|