Blame view

src/main/resources/templates/shipment/shipmentContainerHeader/shipmentContainerHeader.html 17.2 KB
tangying authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 select-info">
				<ul id="myTab" class="nav nav-tabs">
					<li class="active"><a href="#tabHeader" data-toggle="tab">主表</a></li>
					<li><a href="#tabDetail" data-toggle="tab">明细</a></li>
				</ul>
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade in active" id="tabHeader">

							<div class="col-sm-12 select-info">
								<form id="shipmentContainerHeader-form">
									<div class="select-list">
										<ul>
											<li>
21
												容器编号:<input type="text" name="containerCode"/>
tangying authored
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
											</li>
											<li>
												库位编号:<input type="text" name="locationCode"/>
											</li>
											<li>
												<!--入库类型:<input type="text" name="sourceCode"/>-->
												任务类型:<select name="taskType" th:with="type=${@dict.getType('shipmentTaskType')}">
												<option value="">所有</option>
												<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}" ></option>
											</select>
											</li>

											<li>
												<!--头 状 态:<input type="text" name="firstStatus"/>-->
												容器任务状态:<select name="status" th:with="firstStatus=${@dict.getType('shipmentContainerHeaderStatus')}">
												<option value="">所有</option>
												<option th:each="e : ${firstStatus}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
											</select>
											</li>

											<li>
												创 建 人:<input type="text" name="createdBy"/>
											</li>
											<li class="time">
												<label>创建时间: </label>
47
												<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/>
tangying authored
48
												<span>-</span>
49
												<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/>
tangying authored
50
51
52
											</li>
											<li>
												<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
53
												<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('shipmentContainerHeader-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
tangying authored
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
												<!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="receipt:receiptHeader:export"><i class="fa fa-download"></i>&nbsp;导出</a>-->
											</li>
										</ul>
									</div>
								</form>
							</div>
							<div class="btn-group hidden-xs" id="toolbar" role="group">
								<a class="btn btn-outline btn-success btn-rounded" onclick="batchCreateTask()" shiro:hasPermission="shipment:container:add">
									<i class="fa fa-edit"></i> 批量生成任务
								</a>
								<a class="btn btn-outline btn-danger btn-rounded" onclick="batchRemoveHead()" shiro:hasPermission="shipment:container:remove">
									<i class="fa fa-remove"></i> 批量撤销组盘
								</a>
							</div>
							<table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>

					</div>
					<div class="tab-pane fade" id="tabDetail">
pengcheng authored
72
73
74
75
76
						<div class="btn-group hidden-xs" id="toolbar1" role="group">
							<a class="btn btn-outline btn-danger btn-rounded" onclick="detailBatRemove()" >
								<i class="fa fa-trash-o"></i> 删除
							</a>
						</div>
tangying authored
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
						<table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
					</div>
				</div>

			</div>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('shipment:container:edit')}]];
        var removeFlag = [[${@permission.hasPermi('shipment:container:remove')}]];
        var prefix = ctx + "shipment/shipmentContainerHeader"
        var detailPrefix = ctx + "shipment/shipmentContainerDetail";
        var locationCode;
        var shipmentTaskType=[[${@dict.getType('shipmentTaskType')}]];
        var shipmentContainerHeaderStatus=[[${@dict.getType('shipmentContainerHeaderStatus')}]];
        var createTaskFlag = [[${@permission.hasPermi('shipment:container:add')}]]
pengcheng authored
94
		var shippingContainerId;
tangying authored
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "出库组盘",
                sortName: "created",
                sortOrder: "desc",
                search: false,
                clickToSelect:true,
                columns: [
                    {
		            checkbox: true
		        },
				{
					field : 'id',
					title : '组盘头id'
				},
				{
                    field : 'locationCode',
                    title : '库位编号',
                    sortable:true
                },
				{
121
					field : 'containerCode',
tangying authored
122
123
124
125
126
127
128
129
130
131
132
133
134
					title : '容器编号',
					sortable:true
				},
				{
					field : 'warehouseId', 
					title : '仓库id' ,
					visible:false
				},
				{
					field : 'warehouseCode', 
					title : '仓库编号' ,
					visible:false
				},
pengcheng authored
135
136
137
138
139
140
141
142
143
144
145
146
147
148
				// {
				// 	field : 'taskType',
				// 	title : '下发任务类型' ,
                //     formatter: function(value, row, index) {
                //         return $.table.selectDictLabel(shipmentTaskType, value);
                //     },sortable:true
				// },
                // {
                //     field : 'taskTypeReal',
                //     title : '实际任务类型' ,
                //     formatter: function(value, row, index) {
                //         return $.table.selectDictLabel(shipmentTaskType, value);
                //     },sortable:true
                // },
tangying authored
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
				{
					field : 'status', 
					title : '容器任务状态' ,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(shipmentContainerHeaderStatus, value);
                    },sortable:true
				},
				{
					field : 'created', 
					title : '创建日期' ,
					sortable:true
				},
				{
					field : 'createdBy', 
					title : '创建人' ,
					sortable:true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            //	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-info btn-xs " href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>明细</a> ');
                        if (row.status == 0) {
                            actions.push('<a class="btn btn-success btn-xs ' + createTaskFlag + '" href="#" onclick="createTask(\'' + row.id + '\')"><i class="fa fa-cab"></i>生成任务</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="removeHead(\'' + row.id + '\')"><i class="fa fa-remove"></i>取消配盘</a>');
                        }
 						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

        $("#bootstrap-table1").bootstrapTable({
            // url: detailPrefix + "/headerId",
            // createUrl: detailPrefix + "/add",
            // updateUrl: detailPrefix + "/edit/{id}",
            // removeUrl: detailPrefix + "/remove",
            // search: true, //搜索
            sortable: true, //排序
            showRefresh: true, //刷新
            showToggle:true, //视图切换
            clickToSelect: false,
            showColumns:true, //列选择
            // detailView:true,
            showExport: true, //导出
            exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
            modalName: "出库明细",
            iconSize: "outline",
            toolbar: "#toolbar1",
            contentType: "application/x-www-form-urlencoded",
            columns: [{
                checkbox: true
            },
                {
                    field : 'shipmentDetailId',
                    title : '明细id',
                    sortable:true
                },
 /*               {
                    field : 'locationCode',
                    title : '库位编号',
                    sortable:true
                },
                {
                    field : 'containerCode',
                    title : '容器编号',
                    sortable:true
                },*/
 /*               {
                    field : 'headerId',
                    title : '单号Id'
                },*/
                {
                    field : 'shipmentCode',
                    title : '出库单号'
                },

                // {
                //     field : 'shipmentHeaderId',
                //     title : '单头标识'
                // },

                {
                    field : 'materialCode',
236
                    title : '物料编码',
tangying authored
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

                },
                {
                    field : 'materialName',
                    title : '物料名称',

                },
                {
                    field : 'project',
                    title : '项目号',
                },

               /* {
                    field : 'specification',
                    title : '规格',
                    sortable:true
                },
                {
                    field : 'batch',
                    title : '批次',
                    sortable:true
                },
                {
                    field : 'lot',
                    title : '批号',
                    sortable:true
                },*/
                {
                    field : 'qty',
                    title : '组盘数量',

                },
                {
                    field : 'created',
                    title : '创建时间',
                    sortable:true
                },
                {
                    field : 'createdBy',
                    title : '创建用户',

                },
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="removeDetail(\'' + row.id + '\')"><i class="fa fa-remove"></i>取消明细</a>');
                //         return actions.join('');
                //     }
                // }
                ]
        });
pengcheng authored
292
        function createtable(url,shippingContainerId) {
tangying authored
293
294
295
296
297
298
299
300
301
            // $("#tabDetail").children().remove();
            $("#myTab li").removeClass("active");
            $(".tab-pane").removeClass("in active");
            $("#myTab li:eq(1)").addClass("active");
            $("#tabDetail").addClass("in active");
            $.ajax({
                url:url,
                type: 'post',
                data:{
pengcheng authored
302
					shippingContainerId:shippingContainerId
tangying authored
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
                },
                success : function (value) {
                    $("#bootstrap-table1").bootstrapTable('load',value.data);
                    // console.log(value);
                    // $("#bootstrap-table1").bootstrapTable('removeAll');
                    // for (var i = value.data.length-1; i >=0 ; i--) {
                    //     $("#bootstrap-table1").bootstrapTable('insertRow', {
                    //         index: 0, row: {
                    //             id: value.data[i].id,
                    //             headerId: value.data[i].headerId,
                    //             shipmentDetailId: value.data[i].shipmentDetailId,
                    //             shipmentHeaderId: value.data[i].shipmentHeaderId,
						// 		 shipmentCode:value.data[i].shipmentCode,
						// 		 locationCode:value.data[i].locationCode,
                    //             containerCode:value.data[i].containerCode,
                    //             materialCode:value.data[i].materialCode,
                    //             materialName:value.data[i].materialName,
                    //             inventoryId:value.data[i].inventoryId,
                    //             qty:value.data[i].qty,
                    //             created: value.data[i].created,
                    //             createdBy: value.data[i].createdBy
                    //         }
                    //     });
                    // }
                }
            })
        }

        /*入库单列表-详细*/
        function detail(id) {
            var url = detailPrefix + '/list/';
pengcheng authored
334
			shippingContainerId = id;
tangying authored
335
            // createMenuItem(url, "入库组盘明细");
pengcheng authored
336
            createtable(url,shippingContainerId);
tangying authored
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
        }

        /* 单个生成任务 */
        function createTask(id) {
            var url = prefix + "/createTask";
            var data = { "ids" : id };
            $.operate.post(url, data);
        }

        /* 批量生成任务 */
        function batchCreateTask() {
            var rows=$("#bootstrap-table").bootstrapTable('getSelections');
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认要生成选中的" + rows.length + "条组盘任务吗?", function() {
                var url = prefix + "/createTask";
                var ids = "";
                for(var i=0; i<rows.length; i++) {
                    ids = ids + rows[i].id + ","
                }
                var data = { "ids": ids.substring(0, ids.length-1) };
                $.operate.post(url, data);
                // submit(url, "post", "json", data);
            });
        }

        /* 单个取消组盘 */
        function removeHead(id) {
            $.modal.confirm("确定删除该条明细信息吗?", function() {
                var url = prefix+"/remove";
                var data = { "ids": id };
                submit(url, "post", "json", data, false);
            });
        }

        /* 批量取消组盘 */
        function batchRemoveHead() {
            var rows=$("#bootstrap-table").bootstrapTable('getSelections');
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.confirm("确认要撤销选中的" + rows.length + "条组盘吗?", function() {
                var url = prefix + "/remove";
                var ids = "";
                for(var i=0; i<rows.length; i++) {
                    ids = ids + rows[i].id + ","
                }
                var data = { "ids": ids.substring(0, ids.length-1) };
                $.operate.post(url, data);
                // submit(url, "post", "json", data);
            });
        }

        /* 取消单个组盘明细 */
        function removeDetail(id) {
            $.modal.confirm("确定删除该条明细信息吗?", function() {
                var url = detailPrefix+"/remove";
                var data = { "ids": id };
                submit(url, "post", "json", data, true);
            });
        }

        function submit(url, type, dataType, data ,flag) {
            $.modal.loading("正在处理中,请稍后...");
            var config = {
                url: url,
                type: type,
                dataType: dataType,
                data: data,
                success: function(result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.msgSuccess(result.msg);
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                }
            };
            if(flag){
                $.ajax(config).then(function (value) {
                    detail(headerId);
                    $.table.refresh();
                })
			}else {
                $.ajax(config).then(function (value) {
                    $("#bootstrap-table1").bootstrapTable('removeAll');
                    $.table.refresh();
                })
			}

        }
pengcheng authored
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
        function detailBatRemove() {
			var rows=$("#bootstrap-table1").bootstrapTable('getSelections');
			if (rows.length == 0) {
				$.modal.alertWarning("请至少选择一条记录");
				return;
			}
			$.modal.confirm("确认要撤销选中的" + rows.length + "条组盘吗?", function() {
				var url = detailPrefix + "/remove";
				var ids = "";
				for(var i=0; i<rows.length; i++) {
					ids = ids + rows[i].id + ","
				}
				var data = { "ids": ids.substring(0, ids.length-1) };
				$.operate.post(url, data);
				// submit(url, "post", "json", data);
			});
		}
tangying authored
450
451
452
453
454


    </script>
</body>
</html>