Bläddra i källkod

공급사 수거서 생성 저장부분 작업 남음

dwkim 2 år sedan
förälder
incheckning
2440650c20

+ 31 - 23
src/main/webapp/app/collmng/COLLMNG02010.html

@@ -5,15 +5,10 @@
5 5
 				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>수거서 작성</strong></h2>
6 6
 				<div class="pull-right itp_cicon">
7 7
 					<button type="button" id="ITP_BTN_COLLMNG02010_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;조회&nbsp;&nbsp;</button>
8
-					<button type="button" id="ITP_BTN_COLLMNG02010_NEWREG" class="btn btn-primary btn-sm CUDW" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;수거서 작성&nbsp;&nbsp;</button>
9
-					<button type="button" id="ITP_BTN_COLLMNG02010_CANCELLIST" class="btn btn-warning btn-sm CRT"><i class="glyphicon "></i>&nbsp;&nbsp;생성&nbsp;&nbsp;</button>
8
+					<button type="button" id="ITP_BTN_COLLMNG02010_CUDW" class="btn btn-primary btn-sm CUDW" style="display: inline-block;"><i class="glyphicon "></i>&nbsp;&nbsp;수거서 작성&nbsp;&nbsp;</button>
9
+					<button type="button" id="ITP_BTN_COLLMNG02010_CRT" class="btn btn-warning btn-sm CRT"><i class="glyphicon "></i>&nbsp;&nbsp;생성&nbsp;&nbsp;</button>
10 10
 					<button type="button" id="ITP_BTN_COLLMNG02010_CANCELLIST" class="btn btn-warning btn-sm PRB"><i class="glyphicon "></i>&nbsp;&nbsp;취소/목록&nbsp;&nbsp;</button>
11 11
 				</div>
12
-				<div style="top:0px; text-align:center; font-size:20px;">
13
-					<span style="text-decoration:underline; font-weight:600;">테스트공급업체</span>
14
-					<button type="button" id="ITP_BTN_COLLMNG02010_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
15
-					<button type="button" id="ITP_BTN_COLLMNG02010_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
16
-				</div>
17 12
 			</div>
18 13
 			<div class="itp_det_in">
19 14
 				<div id="ITP_AJAX_COLLMNG02010_LIST_CONTAINER">
@@ -21,6 +16,9 @@
21 16
 						<div class="itp_srh_border fix">
22 17
 							<div class="col-xs-12">
23 18
 								<form id="ITP_FORM_COLLMNG02010_SEARCH" class="form-horizontal">
19
+									<input type="hidden" id="ITP_FORM_COLLMNG02010_SEARCH_SBRAND_ID" class="form-control itp_input" name="sbrandId"  />
20
+									<input type="hidden" id="ITP_FORM_COLLMNG02010_SEARCH_SSPPLY_ID" class="form-control itp_input" name="sspplyId"  />
21
+								
24 22
 									<div class="form-group">
25 23
 										<div class="col-xs-2 itp_ip itp_noMar">
26 24
 											<select id="ITP_FORM_COLLMNG02010_SERVICE_COL_REQ_DT" class="form-control itp_input" name="servicecolReqDt">
@@ -29,20 +27,21 @@
29 27
 										</div>										
30 28
 										<div class="col-xs-3 itp_ip itp_noMar">
31 29
 											<div class="input-daterange input-group date">
32
-												<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_COL_REQ_DT" class="form-control itp_input" name="colReqDt" value="">
30
+												<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_FROM_DT" class="form-control itp_input" name="fromDt" value="">
33 31
 												<span class="input-group-addon itp_date_to">~</span>
34
-												<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_COL_DT" class="form-control itp_input" name="colDt" value="">
32
+												<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_TO_DT" class="form-control itp_input" name="toDt" value="">
35 33
 											</div>
36 34
 										</div>
37 35
 										<div class="col-xs-2 itp_in itp_noMar">
38
-											<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_DLV_PLACE" class="form-control itp_input" name="sColPlace" placeholder="수거장소(창고/매장)" />
36
+											<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_NM" class="form-control itp_input" name="srtnWhsNm" placeholder="수거창고" />
37
+											<input type="hidden" id="ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_ID" class="form-control itp_input" name="srtnWhsId"  />
39 38
 										</div>
40 39
 										<div class="col-xs-1 itp_in" style="padding: 0px; width:8%;">
41
-											<button type="button" id="ITP_BTN_COLLMNG02010_SEARCH_SRH" class="btn btn-success btn-sm SEB" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
42
-											<button type="button" id="ITP_BTN_COLLMNG02010_SEARCH_MODIFY" class="btn btn-primary btn-sm UPB" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
40
+											<button type="button" id="ITP_BTN_COLLMNG02010_SEARCH_RTN_WHS_ID" class="btn btn-success btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-search"></i></button>
41
+											<button type="button" id="ITP_BTN_COLLMNG02010_DELETE_RTN_WHS_ID" class="btn btn-primary btn-sm SHOW" style="display: inline-block;"><i class="glyphicon glyphicon-erase"></i></button>
43 42
 						                </div>
44 43
 										<div class="col-xs-4 itp_ip itp_noMar">
45
-											<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_ITEM_NM" class="form-control itp_input" name="sItemNm" placeholder="발주번호/품목번호 /품목명" />
44
+											<input type="text" id="ITP_FORM_COLLMNG02010_SEARCH_ITEM_NM" class="form-control itp_input" name="sitemNm" placeholder="발주번호/품목번호 /품목명" />
46 45
 										</div>
47 46
 									</div>
48 47
 								</form>
@@ -63,12 +62,15 @@
63 62
 						<div class="col-xs-12">
64 63
 							<form id="ITP_FORM_COLLMNG02010_DETAIL" class="form-horizontal">
65 64
 								<input type="hidden" id="ITP_FORM_COLLMNG02010_DETAIL_VIEW_CD" name="viewCd" value="C">
66
-					
65
+								<input type="hidden" id="ITP_FORM_COLLMNG02010_DETAIL_BRAND_ID" class="form-control itp_input" name="brandId"  />
66
+								<input type="hidden" id="ITP_FORM_COLLMNG02010_DETAIL_RTN_WHS_ID" class="form-control itp_input" name="rtnWhsId"  />
67
+								<input type="hidden" id="ITP_FORM_COLLMNG02010_DETAIL_RTN_lOCATION" class="form-control itp_input" name="rtnLocation"  />
68
+								<input type="hidden" id="ITP_FORM_COLLMNG02010_DETAIL_SPPLY_ID" class="form-control itp_input" name="spplyId"  />
67 69
 								<section class="itp_form_sec">
68 70
 									<h4 class="itp_form_tit">반품 발주 상세</h4>
69 71
 									<div class="itp_form_in">	
70 72
 										<div class="form-group">
71
-											<label class="col-xs-2 itp_lb">브랜드 *</label>
73
+											<label class="col-xs-2 itp_lb">브랜드</label>
72 74
 											<div class="col-xs-4 itp_ip fnBrandNm"></div>
73 75
 											<label class="col-xs-2 itp_lb">반품발주번호</label>
74 76
 											<div class="col-xs-4 itp_ip fnRtnPodrUnqNo"></div>
@@ -76,8 +78,14 @@
76 78
 									</div>
77 79
 									<div class="itp_form_in">	
78 80
 										<div class="form-group">
79
-											<label class="col-xs-2 itp_lb">수거서생성일자</label>
80
-											<div class="col-xs-4 itp_ip "></div>
81
+											<label class="col-xs-2 itp_lb">수거일자 *</label>
82
+											<div class="input-daterange input-group date">
83
+												<div class="col-xs-4 itp_ip">
84
+													<div class="col-xs-7 itp_in">
85
+														<input type="text" id="ITP_FORM_ORDMNG02010_DETAIL_COL_SCH_DT" data-check-required="empty" class="form-control itp_input" name="colSchDt" value="">
86
+													</div>
87
+												</div>
88
+											</div>
81 89
 											<label class="col-xs-2 itp_lb">수거 총 금액</label>
82 90
 											<div class="col-xs-4 itp_ip fnColAmt"></div>
83 91
 										</div>
@@ -85,23 +93,23 @@
85 93
 									<div class="itp_form_in">	
86 94
 										<div class="form-group">
87 95
 											<label class="col-xs-2 itp_lb">수거장소</label>
88
-											<div class="col-xs-4 itp_ip fnColPlace"></div>
89
-											<label class="col-xs-2 itp_lb">수거장소연락처</label>
90
-											<div class="col-xs-4 itp_ip "></div>
96
+											<div class="col-xs-4 itp_ip fnRtnWhsNm"></div>
97
+											<label class="col-xs-2 itp_lb">수거장소연락처 *</label>
98
+											<div class="col-xs-4 itp_ip fnPickTelNo"></div>
91 99
 										</div>
92 100
 									</div>
93 101
 									<div class="itp_form_in">	
94 102
 										<div class="form-group">
95
-											<label class="col-xs-2 itp_lb">수거담당자</label>
103
+											<label class="col-xs-2 itp_lb">수거담당자 *</label>
96 104
 											<div class="col-xs-4 itp_ip">
97 105
 												<div class="col-xs-7 itp_in">
98
-													<input type="text" id="ITP_FORM_COLLMNG02010_DETAIL_COL_MGR_NM" class="form-control itp_input" name="colMgrNm" />
106
+													<input type="text" id="ITP_FORM_COLLMNG02010_DETAIL_PICK_MGR_NM" data-check-required="empty" class="form-control itp_input" name="pickMgrNm" />
99 107
 												</div>
100 108
 											</div>
101 109
 											<label class="col-xs-2 itp_lb">수거담당자연락처</label>
102 110
 											<div class="col-xs-4 itp_ip">
103 111
 												<div class="col-xs-7 itp_in">
104
-													<input type="text" id="ITP_FORM_COLLMNG02010_DETAIL_COL_MGR_TEL_NO" class="form-control itp_input" name="colMgrTelNo" />
112
+													<input type="text" id="ITP_FORM_COLLMNG02010_DETAIL_PICK_MGR_TEL_NO"  data-check-required="empty" class="form-control itp_input" name="pickMgrTelNo" />
105 113
 												</div>
106 114
 											</div>
107 115
 										</div>

+ 594 - 0
src/main/webapp/js/app/collmng/ITP_COLLMNG02010.js

@@ -0,0 +1,594 @@
1
+require(['config'], function() {
2
+	require([], function($) {
3
+		pageObj.init();
4
+	});
5
+});
6
+
7
+/********************************************************
8
+ --------------------------------------------------------
9
+ - Object 목록								            -
10
+ --------------------------------------------------------
11
+ * const gridColModel = {}	: 화면 Grid Object			*
12
+ * let pageObj = {}			: 화면공통 Object			*
13
+ * let listObj = {}			: 목록화면 Object			*
14
+ * let modifyObj = {}		: 수정화면 Object			*
15
+ 
16
+ *******************************************************/
17
+
18
+/*화면 변수*/
19
+const COLLMNG02010_GRID_ID = '#ITP_COLLMNG02010_jqGrid';
20
+const COLLMNG02010_GRID_LIST = '#ITP_COLLMNG02010_jqGrid_list';
21
+const COLLMNG02010_GRID_PAGER = '#ITP_COLLMNG02010_jqGridPager';
22
+const COLLMNG02010_GRID_EMPTY = '#ITP_COLLMNG02010_jqGridEmpty';
23
+
24
+const COLLMNG02010_DETAIL_GRID_ID = '#ITP_COLLMNG02010_DETAIL_jqGrid';
25
+const COLLMNG02010_DETAIL_GRID_LIST = '#ITP_COLLMNG02010_DETAIL_jqGrid_list';
26
+const COLLMNG02010_DETAIL_GRID_PAGER = '#ITP_COLLMNG02010_DETAIL_jqGridPager';
27
+const COLLMNG02010_DETAIL_GRID_EMPTY = '#ITP_COLLMNG02010_DETAIL_jqGridEmpty';
28
+
29
+
30
+//let ITP_FORM_COLLMNG02010_DETAIL_IS_WRITING = false;
31
+let COLLMNG02010_GRID_LAST_ROW_ID;
32
+
33
+
34
+/*API URL*/
35
+let API_DETAIL_GRID_LIST = '/api/rtnmng/inoutmng/spply-target-rtn-grid-list';	// 목록
36
+let API_DETAIL_INIT_INFO = '/api/rtnmng/inoutmng/init-spply-col';	// 정보
37
+let API_DETAIL_SAVE 	 = '/api/rtnmng/inoutmng/save-spply-col';			// 수거서생성
38
+
39
+/*화면 Grid ColModel*/
40
+const gridColModel = {
41
+	list: [
42
+		{
43
+			index: 'BRAND_ID', name: 'brandId',
44
+			label: ITP_MSG_LOCALE.label.brandId, //브랜드아이디
45
+			width: '13', fixed: false, align: 'center',
46
+			sortable: false, hidden: true
47
+		},
48
+		{
49
+			index: 'BRAND_NM', name: 'brandNm',
50
+			label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
51
+			width: '10', fixed: false, align: 'center',
52
+			sortable: false, hidden: false
53
+		},
54
+		{
55
+			index: 'RTN_PODR_UNQ_NO', name: 'rtnPodrUnqNo',
56
+			label: ITP_MSG_LOCALE.label.rtnPodrUnqNo, //반품발주번호
57
+			width: '10', fixed: false, align: 'center',
58
+			sortable: false, hidden: false
59
+		},
60
+		{
61
+			index: 'RTN_PODR_DTL_NO', name: 'rtnPodrDtlNo',
62
+			label: ITP_MSG_LOCALE.label.rtnPodrDtlNo, //반품발주항번
63
+			width: '10', fixed: false, align: 'center',
64
+			sortable: false, hidden: false
65
+		},
66
+		{
67
+			index: 'ITEM_ID', name: 'itemId',
68
+			label: ITP_MSG_LOCALE.label.itemId, //품목아이디
69
+			width: '10', fixed: false, align: 'center',
70
+			sortable: false, hidden: false
71
+		},
72
+		{
73
+			index: 'ITEM_NM', name: 'itemNm',
74
+			label: ITP_MSG_LOCALE.label.itemNm, //품목명
75
+			width: '10', fixed: false, align: 'left',
76
+			sortable: false, hidden: false
77
+		},
78
+		{
79
+			index: 'RTN_WHS_ID', name: 'rtnWhsId',
80
+			label: ITP_MSG_LOCALE.label.rtnWhsId, //수거창고아이디
81
+			width: '13', fixed: false, align: 'center',
82
+			sortable: false, hidden: true
83
+		},
84
+		{
85
+			index: 'RTN_WHS_NM', name: 'rtnWhsNm',
86
+			label: ITP_MSG_LOCALE.label.rtnWhsNm, //수거창고명
87
+			width: '15', fixed: false, align: 'left',
88
+			sortable: false, hidden: false
89
+		},
90
+		{
91
+			index: 'RTN_LOCATION', name: 'rtnLocation',
92
+			label: ITP_MSG_LOCALE.label.rtnLocation, //납품수거LOCATION
93
+			width: '15', fixed: false, align: 'center',
94
+			sortable: false, hidden: true
95
+		},
96
+		{
97
+			index: 'UNIT_AMT', name: 'unitAmt',
98
+			label: ITP_MSG_LOCALE.label.unitAmt, //단가
99
+			width: '6', fixed: false, align: 'right',
100
+			sortable: false, hidden: false,
101
+			formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
102
+		},
103
+		{
104
+			index: 'RTN_ODR_QTY', name: 'rtnOdrQty',
105
+			label: ITP_MSG_LOCALE.label.rtnOdrQty, //rtnOdrAmt
106
+			width: '10', fixed: false, align: 'right',
107
+			sortable: false, hidden: false,
108
+			formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
109
+		},
110
+		
111
+		{
112
+			index: 'COL_REQ_DT', name: 'colReqDt',
113
+			label: ITP_MSG_LOCALE.label.colReqDt, //수거요청일
114
+			width: '20', fixed: false, align: 'center',
115
+			sortable: false, hidden: true,
116
+			editable: false, sorttype: "date"
117
+		}
118
+	],
119
+	detail: [
120
+		{
121
+			index: 'RTN_PODR_UNQ_NO', name: 'rtnPodrUnqNo',
122
+			label: ITP_MSG_LOCALE.label.rtnPodrUnqNo, //반품발주번호
123
+			width: '10', fixed: false, align: 'center',
124
+			sortable: false, hidden: false
125
+		},
126
+		{
127
+			index: 'RTN_PODR_DTL_NO', name: 'rtnPodrDtlNo',
128
+			label: ITP_MSG_LOCALE.label.rtnPodrDtlNo, //반품발주항번
129
+			width: '10', fixed: false, align: 'center',
130
+			sortable: false, hidden: false
131
+		},
132
+		{
133
+			index: 'ITEM_ID', name: 'itemId',
134
+			label: ITP_MSG_LOCALE.label.itemId, //품목아이디
135
+			width: '10', fixed: false, align: 'center',
136
+			sortable: false, hidden: false
137
+		},
138
+		{
139
+			index: 'ITEM_NM', name: 'itemNm',
140
+			label: ITP_MSG_LOCALE.label.itemNm, //품목명
141
+			width: '10', fixed: false, align: 'left',
142
+			sortable: false, hidden: false
143
+		},
144
+		{
145
+			index: 'UNIT', name: 'unit',
146
+			label: ITP_MSG_LOCALE.label.unit, //단위
147
+			width: '6', fixed: false, align: 'center',
148
+			sortable: false, hidden: false
149
+		},
150
+		{
151
+			index: 'UNIT_AMT', name: 'unitAmt',
152
+			label: ITP_MSG_LOCALE.label.unitAmt, //단가
153
+			width: '6', fixed: false, align: 'right',
154
+			sortable: false, hidden: false,
155
+			formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
156
+		},
157
+		{
158
+			index: 'RTN_ODR_QTY', name: 'rtnOdrQty',
159
+			label: ITP_MSG_LOCALE.label.rtnOdrQty, //반품발주수량
160
+			width: '10', fixed: false, align: 'right',
161
+			sortable: false, hidden: false,
162
+			formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
163
+		},
164
+		{
165
+			index: 'COL_QTY', name: 'colQty',
166
+			label: ITP_MSG_LOCALE.label.colQty, //수거수량
167
+			width: '10', fixed: false, align: 'right',
168
+			sortable: true, editable: true, edittype: 'text',
169
+			editrules: { required: true, number: true },
170
+			formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
171
+		},
172
+		{
173
+			index: 'RTN_RSN_DVSN_NM', name: 'rtnRsnDvsnNm',
174
+			label: ITP_MSG_LOCALE.label.rtnRsnDvsnNm, //반품사유
175
+			width: '10', fixed: false, align: 'center',
176
+			sortable: false, hidden: false
177
+		},
178
+		{
179
+			index: 'RTN_RSN_DVSN', name: 'rtnRsnDvsn',
180
+			label: ITP_MSG_LOCALE.label.rtnRsnDvsn, //반품사유
181
+			width: '10', fixed: false, align: 'center',
182
+			sortable: false, hidden: true
183
+		},
184
+		{
185
+			index: 'RTN_RSN', name: 'rtnRsn',
186
+			label: ITP_MSG_LOCALE.label.rtnRsn, //비고
187
+			width: '10', fixed: false, align: 'center',
188
+			sortable: false, hidden: false
189
+		},
190
+		{
191
+			index: 'COL_AMT', name: 'colAmt',
192
+			label: ITP_MSG_LOCALE.label.colAmt, //
193
+			width: '10', fixed: false, align: 'right',
194
+			sortable: false, hidden: false
195
+		}
196
+	]
197
+};
198
+
199
+/*화면공통 Object*/
200
+let pageObj = {
201
+	init: function () {
202
+		this.ui.init();
203
+		this.event.init();
204
+		this.action();
205
+	},
206
+	ui: {
207
+		init: function () {
208
+			this.view();
209
+			this.grid();
210
+			this.ready();
211
+		},
212
+		view: function() {
213
+			// 버튼 권한설정
214
+			fn_proc_btn_auth('COLLMNG02010');
215
+
216
+			// 공통코드 표시
217
+			$('select').each(function() {
218
+				if($(this).data('select-code')) {
219
+					fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
220
+				}
221
+			});
222
+
223
+			// 조회일자 지정
224
+			var now = new Date();
225
+			$('#ITP_TAB_COLLMNG02010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
226
+			$('#ITP_FORM_COLLMNG02010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setDate(now.getDate())));
227
+			$('#ITP_FORM_COLLMNG02010_SEARCH_TO_DT').datepicker('setDate', new Date(now.setDate(now.getDate() + 30)));
228
+			
229
+			$('#ITP_FORM_COLLMNG02010_SEARCH #ITP_FORM_COLLMNG02010_SEARCH_SSPPLY_ID').val(fn_make_user_info.get('spplyId'));
230
+		},
231
+		grid: function() {
232
+			itp_fn_jqgrid_resize(COLLMNG02010_GRID_ID, COLLMNG02010_GRID_LIST, 'lg');
233
+			listObj.empty.init();
234
+			itp_fn_fire_window_resize();
235
+		},
236
+		ready: function() {
237
+			listObj.init();
238
+		}
239
+	},
240
+	action: function () {
241
+		var _this = this;
242
+		// 수거창고 조회 버튼 클릭
243
+		$('#ITP_BTN_COLLMNG02010_SEARCH_RTN_WHS_ID').on('click', function() {
244
+			_this.popup();
245
+		});
246
+		// 출하창고 텍스트 삭제 버튼 클릭
247
+		$('#ITP_BTN_COLLMNG02010_DELETE_RTN_WHS_ID').on('click', function() {
248
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_NM').val('');
249
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_ID').val('');
250
+
251
+		});
252
+		
253
+	},
254
+	popup: function (arg) {
255
+		var popFn = this.callback.rtnwhs;
256
+		
257
+		var whsDvsn = "";
258
+
259
+		const key = { brandId: fn_make_user_info.get('brandId'), storeId: fn_make_user_info.get('storeId'), whsDvsn: whsDvsn };
260
+
261
+		fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
262
+		
263
+		
264
+	},
265
+	callback: {
266
+		rtnwhs: function(rowDataPop) {
267
+			if (rowDataPop) {
268
+				$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_NM').val(rowDataPop.whsNm);
269
+				$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_ID').val(rowDataPop.whsId);
270
+			}
271
+
272
+		}
273
+	},
274
+	event: {
275
+		init: function () {
276
+			this.button();
277
+		},
278
+		button: function () {
279
+			// 버튼 클릭 이벤트
280
+			$('button').each(function() {
281
+				var id = $(this).attr('id');
282
+				$(this).on('click', function() {
283
+					switch (id) {
284
+						case 'ITP_BTN_COLLMNG02010_SRH'				: listObj.button.search();			break;
285
+						case 'ITP_BTN_COLLMNG02010_CUDW'			: listObj.button.colcreat();		break;	// 수거서생성
286
+						case 'ITP_BTN_COLLMNG02010_CRT'				: modifyObj.button.save() ;			break;	// 생성
287
+						case 'ITP_BTN_COLLMNG02010_CANCELLIST'		: modifyObj.button.cancel();		break;
288
+						
289
+					}
290
+				});
291
+			});
292
+			
293
+			$('body').on('click', function(e) {
294
+				
295
+				var gridId = (COLLMNG02010_DETAIL_GRID_ID).replace('#', '');
296
+				var rids = $(COLLMNG02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
297
+				var last_row_id = rids[rids.length - 1];
298
+				
299
+				itp_fn_grid_reset_selection(e, last_row_id, gridId, 'COLLMNG02010_DETAIL');	
300
+				
301
+				modifyObj.button.recal();	
302
+			});
303
+
304
+		}
305
+	},
306
+	switchScreen: function(mode) {
307
+		$('.itp_det_head').find('button[id^="ITP_BTN_COLLMNG02010_"]').each(function(i) {
308
+			$(this).hide();
309
+		});
310
+		$('#ITP_TAB_COLLMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
311
+			$(this).hide();
312
+		});
313
+		if(mode == 'LIST') { // 목록
314
+			$('#ITP_AJAX_COLLMNG02010_LIST_CONTAINER').show();
315
+			fn_show_btn_auth_array(['#ITP_BTN_COLLMNG02010_SRH', '#ITP_BTN_COLLMNG02010_CUDW']);
316
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SBRAND_ID').val(fn_make_user_info.get('brandId'));
317
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SSPPLY_ID').val(fn_make_user_info.get('spplyId'));
318
+		} else if(mode == 'DETAIL') { // 수거서 작성
319
+			$('#ITP_AJAX_COLLMNG02010_DETAIL_CONTAINER').show();
320
+			fn_show_btn_auth_array(['#ITP_BTN_COLLMNG02010_CRT', '#ITP_BTN_COLLMNG02010_CANCELLIST']);
321
+			$('#ITP_FORM_COLLMNG02010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
322
+			
323
+			//pageObj.grid.init(param);
324
+		} 
325
+	},
326
+	grid: {
327
+		init: function(gridData) {
328
+			
329
+			this.gridId = COLLMNG02010_DETAIL_GRID_ID;
330
+			this.gridList = COLLMNG02010_DETAIL_GRID_LIST;
331
+			this.gridEmpty = COLLMNG02010_DETAIL_GRID_EMPTY;
332
+			//var now = new Date();
333
+			//$('#ITP_TAB_COLLMNG02010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
334
+			//$('#ITP_FORM_COLLMNG02010_DETAIL_DLV_SCH_DT').datepicker('setDate', new Date(param.dlvSchDt));
335
+			//$('#ITP_FORM_COLLMNG02010_DETAIL .fnBrandNm').text(param.brandNm);
336
+			
337
+			//this.gridRows = param.recordData;
338
+			this.unload();
339
+			this.load(gridData);
340
+			
341
+		},
342
+		gridId: '',
343
+		button: {},
344
+		gridList: '',
345
+		gridEmpty: '',
346
+		gridRows: '',
347
+		load: function(gridRows) {
348
+			console.log(gridRows);
349
+			var _this = this;
350
+			var option = {
351
+				gridId: _this.gridId,
352
+				colModel: gridColModel.detail,
353
+				data: gridRows,
354
+				loadComplete: function(data) {
355
+					console.log(data);
356
+					itp_fn_grid_load_complete(data, COLLMNG02010_DETAIL_GRID_ID, true, 'number', 'COLLMNG02010', modifyObj.itp_COLLMNG02010_search, modifyObj.empty, true, data.gridRecords, true);
357
+					
358
+				},
359
+				onCellSelect: function(rowid, cellIdx, cellValue) {
360
+					COLLMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, COLLMNG02010_GRID_LAST_ROW_ID, _this.gridId, ['rtnReqDtlNo']);
361
+				}
362
+			};
363
+			itp_fn_grid_make_local(option);
364
+		},
365
+		clearData : function(mode) {
366
+			$(COLLMNG02010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
367
+			$(COLLMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
368
+			$(COLLMNG02010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
369
+			$(COLLMNG02010_DETAIL_GRID_EMPTY).show();
370
+		},
371
+		unload : function() {
372
+			$.jgrid.gridUnload(this.gridId);
373
+		}
374
+	}
375
+};
376
+
377
+/*목록화면 Object*/
378
+let listObj = {
379
+	init: function () {
380
+		this.grid.init();
381
+	},
382
+	itp_COLLMNG02010_search: false,
383
+	button: {
384
+		search: function() {
385
+			listObj.itp_COLLMNG02010_search = true;
386
+			let param = $('#ITP_FORM_COLLMNG02010_SEARCH').serializeObject();
387
+			param.gridSize = $.jgrid.defaults.rowNum;
388
+			param.gridPage = $.jgrid.defaults.page;
389
+			$(COLLMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
390
+		},
391
+		colcreat: function() {
392
+			var selectedIds = $(COLLMNG02010_GRID_ID).getGridParam('selarrrow');
393
+    		if(selectedIds.length > 1) { // 1이상 선택시
394
+    			alert("반품발주 한 건만 선택해주세요 (대표 반품발주)") ;//출력
395
+    			return; //리턴
396
+    		}
397
+    		var selRowData ; //변수선언		
398
+    		for (var i=selectedIds.length-1; i>=0;i--) {
399
+    			selRowData = $(COLLMNG02010_GRID_ID).jqGrid('getRowData', selectedIds[i]);		//cell 선택
400
+    		}
401
+    		let param = {brandId: selRowData.brandId, rtnPodrUnqNo: selRowData.rtnPodrUnqNo, spplyId: fn_make_user_info.get('spplyId')};
402
+    		pageObj.switchScreen('DETAIL');
403
+			itp_fn_form_clear_validate(null, '#ITP_FORM_COLLMNG02010_DETAIL');
404
+			modifyObj.init(param);
405
+		}
406
+	},
407
+	empty: {
408
+		init: function() {
409
+			var _this = this;
410
+			this.push();
411
+			$(COLLMNG02010_GRID_EMPTY).on('click', function() {
412
+				_this.back();
413
+				_this.itp_COLLMNG02010_param.gridSize = $.jgrid.defaults.rowNum;
414
+				$(COLLMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_COLLMNG02010_param)}).trigger('reloadGrid');
415
+			});
416
+		},
417
+		itp_COLLMNG02010_param: {},
418
+		push: function() {
419
+			let param = $('#ITP_FORM_COLLMNG02010_SEARCH').serializeObject();
420
+			listObj.itp_COLLMNG02010_param = param;
421
+		},
422
+		back: function() {
423
+			$('#ITP_FORM_COLLMNG02010_SEARCH_FROM_DT').val(this.itp_COLLMNG02010_param.fromDt);
424
+			$('#ITP_FORM_COLLMNG02010_SEARCH_TO_DT').val(this.itp_COLLMNG02010_param.toDt);
425
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_NM').val(this.itp_COLLMNG02010_param.ssrtnWhsNm);
426
+			$('#ITP_FORM_COLLMNG02010_SEARCH_SRTN_WHS_ID').val(this.itp_COLLMNG02010_param.ssrtnWhsId);
427
+			$('#ITP_FORM_COLLMNG02010_SEARCH_ITEM_NM').val(this.itp_COLLMNG02010_param.sItemNm);
428
+		}
429
+	},
430
+	grid: {
431
+		init: function () {
432
+			// 데이터 없을때
433
+			listObj.empty.push();
434
+			itp_fn_jqgrid_resize(COLLMNG02010_GRID_ID, COLLMNG02010_GRID_LIST, 'lg');
435
+			itp_fn_fire_window_resize();
436
+			this.search();
437
+			
438
+		},
439
+		colModel: gridColModel.list,
440
+		search: function() {
441
+			pageObj.switchScreen('LIST');
442
+			this.unload();
443
+			this.load();
444
+		},
445
+		load: function() {
446
+			let param = $('#ITP_FORM_COLLMNG02010_SEARCH').serializeObject();
447
+			param.gridSize = $.jgrid.defaults.rowNum;
448
+			console.log(param);
449
+			var option = {
450
+				multiselect: true,
451
+				autowidth: true,
452
+				gridId: COLLMNG02010_GRID_ID,
453
+				colModel: gridColModel.list,
454
+				param: param,
455
+				url: DOMAIN + API_DETAIL_GRID_LIST,
456
+				pager: COLLMNG02010_GRID_PAGER,
457
+				loadComplete: function(data) {
458
+					itp_fn_grid_load_complete(data, COLLMNG02010_GRID_ID, true, 'number', 'COLLMNG02010', listObj.itp_COLLMNG02010_search, listObj.empty, true, data.gridRecords, true);
459
+				},
460
+				onPaging: function(action) {
461
+					itp_fn_grid_paging(COLLMNG02010_GRID_ID, action, param);
462
+				}
463
+			};
464
+			itp_fn_grid_make_remote(option);
465
+		},
466
+		button: {
467
+		},
468
+		unload : function() {
469
+			$.jgrid.gridUnload(COLLMNG02010_GRID_ID);
470
+		},
471
+		clearData : function() {
472
+			$(COLLMNG02010_GRID_ID).jqGrid('clearGridData', true);
473
+			$(COLLMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
474
+			$(COLLMNG02010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
475
+			$(COLLMNG02010_GRID_EMPTY).show();
476
+		}
477
+	}
478
+};
479
+
480
+/*수정화면 Object*/
481
+let modifyObj = {
482
+	init: function (param) {
483
+		console.log("param  modiryObj init");
484
+		console.log(param);
485
+		this.load(param);
486
+	},
487
+	button: {
488
+		modify: function (param) {
489
+			itp_fn_form_clear_validate(null, '#ITP_FORM_COLLMNG02010_DETAIL');
490
+			//const selectVal = $('#ITP_FORM_COLLMNG02010_VIEW_STORE_ID').val();
491
+			//const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
492
+			//var param = $.param(key);
493
+			//modifyObj.load(param);
494
+		},
495
+		cancel: function() {
496
+			$('body').trigger('click');
497
+			document.getElementById('ITP_FORM_COLLMNG02010_DETAIL').reset();
498
+			listObj.grid.search();
499
+		},
500
+		recal: function() {
501
+			var ids = $(COLLMNG02010_DETAIL_GRID_ID).getDataIDs();
502
+			$.each(ids, function(idx, rowId) {
503
+				var unitAmt = jQuery(COLLMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
504
+				var colQty = jQuery(COLLMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'colQty');
505
+				
506
+				if(unitAmt != null && unitAmt != '' && colQty != null && colQty != '') {		
507
+					jQuery(COLLMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{colAmt: parseInt(unitAmt)*parseInt(colQty)});
508
+				}
509
+			});
510
+			
511
+			const rowData = $(COLLMNG02010_DETAIL_GRID_ID).getRowData();
512
+			var colAmt = 0 ;
513
+			$.each(rowData, function(key, value) {
514
+				if (value.colAmt != null && value.colAmt != "" ) {
515
+					colAmt = colAmt + parseInt(value.colAmt) ;
516
+				}				
517
+			});
518
+			$('#ITP_FORM_COLLMNG02010_DETAIL .fnColAmt').text(itp_fn_number_comma(colAmt));
519
+		},
520
+		save: function() {
521
+			$('body').trigger('click');
522
+			const formId = ('#ITP_FORM_COLLMNG02010_DETAIL');
523
+			itp_fn_form_clear_validate(null, formId);
524
+			
525
+			if (itp_fn_form_event.isValid(formId)) {
526
+				var modalFn = {
527
+					callBack: () => {
528
+						itp_fn_form_event.removeChar('#ITP_FORM_COLLMNG02010_DETAIL');
529
+						var chkQtyYn = "N";
530
+						let gridInsertData = [];
531
+						const rowData = $(COLLMNG02010_DETAIL_GRID_ID).getRowData();
532
+						
533
+						$.each(rowData, function(key, value) {
534
+							
535
+							if (value.coltQty == '' || value.coltQty < 1 ) {
536
+								alert("수거수량을 입력해주세요!");
537
+								chkQtyYn = "Y";
538
+								return false;
539
+							}
540
+							
541
+							
542
+							if (value.rtnOdrQty > value.coltQty ) {
543
+								 alert("수거수량이 반품발주수량보다 클수 없습니다!");
544
+								chkQtyYn = "Y";
545
+								return false;
546
+							}
547
+							
548
+							gridInsertData.push(value);
549
+						});
550
+						
551
+						if (chkQtyYn == "Y") return;
552
+						
553
+						let param = $(formId).serializeObject();
554
+						param.viewCd = "C";
555
+						param.gridInsertData = gridInsertData;
556
+						console.log(JSON.stringify(param));
557
+						var searhFn = function () {
558
+							//ITP_FORM_COLLMNG02010_DETAIL_IS_WRITING = false;
559
+							pageObj.grid.clearData();
560
+							modifyObj.button.cancel();
561
+						}
562
+						fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
563
+					}
564
+				};
565
+				itp_fn_modal_confirm('수거서 생성 하시겠습니까?', modalFn);
566
+			}
567
+		}
568
+	},
569
+	
570
+	load: function(param) {
571
+		console.log("param  modiryObj load");
572
+		console.log(param);
573
+		fn_ajax_call(API_DETAIL_INIT_INFO, param, this.callback, 'GET');
574
+	},
575
+	callback: function(result) {
576
+		console.log(result);
577
+		pageObj.switchScreen('DETAIL');
578
+		$('#ITP_FORM_COLLMNG02010_DETAIL #ITP_FORM_COLLMNG02010_DETAIL_SPPLY_ID').val(fn_make_user_info.get('spplyId'));
579
+		$('#ITP_FORM_COLLMNG02010_DETAIL .fnBrandNm').text(result.brandNm);										// 브랜드
580
+		$('#ITP_FORM_COLLMNG02010_DETAIL #ITP_FORM_COLLMNG02010_DETAIL_BRAND_ID').val(result.brandId);			// 
581
+		$('#ITP_FORM_COLLMNG02010_DETAIL #ITP_FORM_ORDMNG02010_DETAIL_COL_SCH_DT').val(result.colReqDt);			// 
582
+		$('#ITP_FORM_COLLMNG02010_DETAIL #ITP_FORM_COLLMNG02010_DETAIL_RTN_WHS_ID').val(result.rtnWhsId);			//
583
+		$('#ITP_FORM_COLLMNG02010_DETAIL #ITP_FORM_COLLMNG02010_DETAIL_RTN_lOCATION').val(result.rtnLocation);			//
584
+		$('#ITP_FORM_COLLMNG02010_DETAIL .fnColAmt').text(result.rtnDodrTotalAmt);			//
585
+		$('#ITP_FORM_COLLMNG02010_DETAIL .fnRtnWhsNm').text(result.rtnWhsNm);			//
586
+		$('#ITP_FORM_COLLMNG02010_DETAIL .fnPickTelNo').text(result.pickTelNo);			//
587
+		$('#ITP_FORM_COLLMNG02010_DETAIL .fnRtnPodrUnqNo').text(result.rtnPodrUnqNo);			//
588
+
589
+				
590
+		pageObj.grid.init( result.pickRtnDtlInfo);		
591
+	},
592
+};
593
+
594
+

+ 1 - 1
src/main/webapp/js/app/inoutmng/ITP_INOUTMNG01010.js

@@ -656,7 +656,7 @@ let modifyObj = {
656 656
 				
657 657
 				var modalFn = {
658 658
 					callBack: () => {
659
-						itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
659
+						itp_fn_form_event.removeChar('#ITP_FORM_INOUTMNG01010_DETAIL');
660 660
 						var chkQtyYn = "N";
661 661
 						let gridInsertData = [];
662 662
 						const rowData = $(INOUTMNG01010_DETAIL_GRID_ID).getRowData();

+ 1 - 1
src/main/webapp/js/app/ordmng/ITP_ORDMNG02010.js

@@ -259,7 +259,7 @@ let listObj = {
259 259
     		let param = {brandId: selRowData.brandId, pchPodrUnqNo: selRowData.pchPodrUnqNo};
260 260
     		param.spplyId = fn_make_user_info.get('spplyId');
261 261
     		pageObj.switchScreen('MODIFY');
262
-			itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG03010_DETAIL');
262
+			itp_fn_form_clear_validate(null, '#ITP_FORM_ORDMNG02010_DETAIL');
263 263
 			modifyObj.init(param);
264 264
 		}
265 265
 	},