Blame view

src/main/resources/templates/task/taskHeader/taskHeader.html 24.9 KB
mahuandong authored
1
2
3
4
5
<!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>
<style>
6
7
8
9
10
    #toolbar1 {
        display: inline-block;
        margin: 10px auto;
        line-height: 34px;
    }
mahuandong authored
11
12
</style>
<body class="gray-bg">
13
<div class="container-div">
14
    <div class="row">
pengyongcheng authored
15
        <div class="col-sm-12 select-table">
16
17
18
19
20
21
            <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">
pengyongcheng authored
22
                    <div class="col-sm-12 select-table">
23
                        <form id="task-form" autocomplete="off">
24
25
26
                            <div class="select-list">
                                <ul>
                                    <li>
pengyongcheng authored
27
                                        <input type="hidden" th:value="${internalTaskType}" name="internalTaskType">
28
                                        <label>库区:</label>
29
30
31
32
33
34
35
36
                                        <select id="zoneCode" name="zoneCode" th:with="list=${@zone.getCode()}">
                                            <option value="">所有</option>
                                            <option th:each="item : ${list}" th:text="${item['name']}"
                                                    th:value="${item['code']}"
                                                    th:attr=" code = ${item['code']}"></option>
                                        </select>
                                    </li>
                                    <li>
37
                                        <label>任务id:</label>
pengyongcheng authored
38
                                        <input name="id" placeholder="请输入任务id" type="text"/>
39
40
                                    </li>
                                    <li>
41
                                        <label>载具编码:</label>
pengyongcheng authored
42
                                        <input name="containerCode" placeholder="请输入载具编码" type="text"/>
43
44
                                    </li>
                                    <li>
45
46
47
48
                                        <label>盛具编码:</label>
                                        <input name="vehicleCode" placeholder="请输入盛具编码" type="text"/>
                                    </li>
                                    <li>
pengyongcheng authored
49
50
                                        <label>原库位编码:</label>
                                        <input name="fromLocation" placeholder="请输入原库位编码" type="text"/>
51
52
                                    </li>
                                    <li>
pengyongcheng authored
53
54
55
56
57
58
59
60
61
62
                                        <label>目标库位编码:</label>
                                        <input name="toLocation" placeholder="请输入目标库位编码" type="text"/>
                                    </li>
                                    <li>
                                        <label>来源料点:</label>
                                        <input name="fromPort" placeholder="请输入来源料点" type="text"/>
                                    </li>
                                    <li>
                                        <label>目标料点:</label>
                                        <input name="port" placeholder="请输入目标料点" type="text"/>
63
                                    </li>
周峰 authored
64
65
                                    <li>
                                        <label>回传次数:</label>
pengyongcheng authored
66
                                        <input name="callBackTimes" placeholder="大于等于" min="0" type="number"/>
周峰 authored
67
                                    </li>
68
                                    <li class="select-time">
69
70
71
72
73
74
75
76
                                        <label>创建时间: </label>
                                        <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                               name="createdBegin"/>
                                        <span>-</span>
                                        <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                               name="createdEnd"/>
                                    </li>
                                    <li>
pengyongcheng authored
77
                                        <input type="hidden" name="internalTaskType" th:value="${internalTaskType}"/>
78
                                    </li>
79
                                    <li style="float: right; margin-right: 45px">
80
81
82
                                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
                                            <i class="fa fa-search"></i>&nbsp;搜索
                                        </a>
83
                                        <a class="btn btn-warning btn-rounded btn-sm"
84
85
86
                                           onclick="$.form.reset('task-form')">
                                            <i class="fa fa-refresh"></i>&nbsp;重置
                                        </a>
87
88
89
90
91
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
92
93
94
95
96
                    <div class="btn-group hidden-xs" id="toolbar" role="group">
                        <a class="btn btn-outline btn-success btn-rounded" onclick="print()"
                           shiro:hasPermission="task:task:execute">
                            <i class="fa fa-print"></i> 打印
                        </a>
97
98
99
100
101
102
                        <a class="btn btn-outline btn-primary btn-rounded" onclick="batchExecute()">
                            <i class="fa fa-send"></i> 批量执行
                        </a>
                        <a class="btn btn-outline btn-danger btn-rounded" onclick="batchRemoveHead()">
                            <i class="fa fa-remove"></i>批量取消
                        </a>
103
104
105
106
107
108
                        <!-- <a class="btn btn-outline btn-success btn-rounded" onclick="prioritymax()">
                             <i class="fa fa-edit"></i> 批量设置优先级最大值
                         </a>
                         <a class="btn btn-outline btn-primary btn-rounded" onclick="prioritymin()">
                             <i class="fa fa-edit"></i> 批量设置优先级最小值
                         </a>-->
109
110
                    </div>
                    <input type="hidden" id="taskId" name="taskId" th:value="${taskId}"/>
pengyongcheng authored
111
                    <input type="hidden" id="internalTaskType" name="internalTaskType" th:value="${internalTaskType}"/>
pengyongcheng authored
112
113
114
115
116
                    <div class="col-sm-12 select-table">
                        <table id="bootstrap-table" data-mobile-responsive="true"
                               class="table table-bordered table-hover text-nowrap">
                        </table>
                    </div>
117
118
119
120
121
                </div>
                <div class="tab-pane fade" id="tabDetail">
                    <div class="btn-group hidden-xs" id="toolbar1" role="group">
                    </div>
                    <table id="bootstrap-table1" data-mobile-responsive="true"
122
123
                           class="table table-bordered table-hover text-nowrap">
                    </table>
124
125
126
127
                </div>
            </div>
        </div>
    </div>
128
129
130
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
131
132
133
    var editFlag = [[${@permission.hasPermi('task:taskHeader:edit')}]];
    var removeFlag = [[${@permission.hasPermi('task:taskHeader:remove')}]];
    var executeFlag = [[${@permission.hasPermi('task:taskHeader:execute')}]];
134
    var supplier = [[${@SupplierService.getCode()}]];
135
136
137
138
139
    var prefix = ctx + "task/taskHeader";
    var stations = [[${@dict.getType('station')}]];
    var taskTypes = [[${@dict.getType('taskType')}]];
    var taskStatus = [[${@dict.getType('taskStatus')}]];
    var taskDetailStatus = [[${@dict.getType('taskDetailStatus')}]];
140
    var inventoryStatus = [[${@dict.getType('inventorySts')}]];
141
    var zone = [[${@zone.getCode()}]];
mahuandong authored
142
143
    $(function () {
144
        let options = {
145
146
147
148
149
150
151
152
153
154
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "任务管理",
            sortName: "lastUpdated",
            sortOrder: "desc",
            search: false,
            clickToSelect: true,
            queryParams: queryParams,
155
156
157
158
            columns: [
                {
                    checkbox: true
                },
159
160
161
162
163
164
165
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        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 < 100) {
pengyongcheng authored
166
167
168
169
170
                            if (row.internalTaskType === 1100) {
                                actions.push('<a class="btn btn-success btn-xs" href="#" onclick="assemble(\'' + row.id + '\')"><i class="fa fa-send" style="padding-right: 1px;"></i>装配</a> ');
                            } else {
                                actions.push('<a class="btn btn-success btn-xs ' + executeFlag + '" href="#" onclick="execute(\'' + row.id + '\')"><i class="fa fa-send" style="padding-right: 1px;"></i>执行</a> ');
                            }
171
                        }
pengyongcheng authored
172
173
174
175
                        /*if (row.status >= 10 && row.status < 100) {
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>取消</a> ');
                            actions.push('<a class="btn btn-primary btn-xs ' + completeFlag + '" href="#" onclick="complete(\'' + row.id + '\')"><i class="fa fa-check"></i>完成</a>');
                        }*/
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                        return actions.join('');
                    }
                },
                {
                    field: 'id',
                    title: '任务id',
                },
                {
                    field: 'zoneCode',
                    title: '库区',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        $.each(zone, function (index, dict) {
pengyongcheng authored
190
                            if (dict.code === value) {
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
                                actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
                                return false;
                            }
                        });
                        return actions.join('');
                    }
                },
                {
                    field: 'taskType',
                    title: '任务类型',
                    align: 'center',
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(taskTypes, value);
                    }
                },
                {
pengyongcheng authored
208
209
210
211
212
213
214
215
                    field: 'status',
                    title: '任务状态',
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(taskStatus, value);
                    }
                },
                {
pengyongcheng authored
216
217
218
219
220
                    field: 'fromLocation',
                    title: '原库位编码',
                    visible: true
                },
                {
221
222
223
224
225
226
227
                    field: 'toLocation',
                    title: '目的库位编码',
                    visible: true
                },
                {
                    field: 'containerCode',
                    title: '载具编码',
228
229
230
231
                },
                {
                    field: 'vehicleCode',
                    title: '盛具编码',
232
233
234
                },
                {
                    field: 'fromPort',
pengyongcheng authored
235
                    title: '来源料点',
236
237
238
239
240
                    align: 'center',
                    visible: true,
                },
                {
                    field: 'port',
pengyongcheng authored
241
                    title: '目标料点',
242
243
244
245
                    align: 'center',
                    visible: true,
                },
                {
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
                    field: 'sequenceGroup',
                    title: '顺序组',
                    visible: true
                },
                {
                    field: 'sequenceCount',
                    title: '排序数',
                    visible: true
                },
                {
                    field: 'sequence',
                    title: '顺序号',
                    visible: true
                },
                {
周峰 authored
261
262
263
                    field: 'callBackTimes',
                    title: '回传',
                    formatter: function (value, row, index) {
pengyongcheng authored
264
                        if (row.isBack === 1) {
pengyongcheng authored
265
                            return "<span title='' class='badge badge-primary'>成功 " + value + "</span>";
pengyongcheng authored
266
267
                        } else if (row.isBack === 0) {
                            return "<span title=" + row.information + " class='badge badge-default'>未回传</span>";
pengyongcheng authored
268
269
                        } else if (value > 1) {
                            return "<span title=" + row.information + " class='badge badge-danger'>失败 " + value + "</span>";
周峰 authored
270
                        } else {
pengyongcheng authored
271
                            return "<span title=" + row.information + " class='badge badge-success'>无需回传</span>";
周峰 authored
272
273
274
                        }
                    }
                },
275
276
277
278
279
280
281
282
                {
                    field: 'orderCode',
                    title: '工单号',
                },
                {
                    field: 'shipmentReferCode',
                    title: '领料单号',
                },
周峰 authored
283
                {
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
                    field: 'exceptionCode',
                    title: '异常原因',
                },
                {
                    field: 'isEmptyOut',
                    title: '空出',
                },
                {
                    field: 'isDoubleIn',
                    title: '重入',
                },
                {
                    field: 'originLocation',
                    title: '原始库位',
                },
                {
                    field: 'created',
                    title: '生成时间',
                },
                {
                    field: 'createdBy',
                    title: '任务下达人'
                },
                {
                    field: 'lastUpdated',
                    title: '修改时间',
                },
                {
                    field: 'lastUpdatedBy',
周峰 authored
313
                    title: '更新用户',
314
315
316
317
318
                },
            ]
        };
        $.table.init(options);
    });
mahuandong authored
319
320
    $("#bootstrap-table1").bootstrapTable({
321
322
        //排序
        showRefresh: false, //刷新
pengyongcheng authored
323
        showToggle: false, //视图切换
324
        clickToSelect: false,
pengyongcheng authored
325
        showColumns: false, //列选择
326
        // detailView:true,
pengyongcheng authored
327
        showExport: false, //导出
328
329
330
331
332
333
334
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "任务明细",
        iconSize: "outline",
        toolbar: "#toolbar1",
        contentType: "application/x-www-form-urlencoded",
        sortName: "id",
        sortOrder: "desc",
335
336
337
338
        columns: [
            {
                checkbox: true
            },
339
340
341
342
343
344
            {
                field: 'billCode',
                title: '单据编码',
            },
            {
                field: 'billDetailId',
345
                title: '单据明细id',
346
347
348
349
350
351
352
353
354
355
356
                visible: true,
            },
            {
                field: 'materialCode',
                title: '物料编码',
            },
            {
                field: 'materialName',
                title: '物料名称',
            },
            {
357
358
359
360
361
362
363
364
365
366
367
368
                field: 'materialSpec',
                title: '物料规格',
            },
            {
                field: 'materialUnit',
                title: '物料单位',
            },
            {
                field: 'weight',
                title: '药量(克)',
            },
            {
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
                field: 'high',
                title: '高度'
            },
            {
                field: 'solidifyTime',
                title: '固化时间(时)'
            },
            {
                field: 'tracingNo',
                title: '追溯码',
            },
            {
                field: 'supplierCode',
                title: '供应商',
                visible: true,
                formatter: function (value, row, index) {
                    let actions = [];
                    $.each(supplier, function (index, item) {
                        if (item.code === value) {
                            actions.push("<span class='badge badge-info'>" + item.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                },
            },
            {
                field: 'supplierTracingNo',
                title: '供应商追溯码',
            },
            {
400
401
402
403
404
                field: 'inventorySts',
                title: '库存状态',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(inventoryStatus, value);
                }
405
406
407
408
409
410
            },
            {
                field: 'containerCode',
                title: '载具编码',
            },
            {
411
412
413
414
                field: 'vehicleCode',
                title: '盛具编码',
            },
            {
415
416
417
418
419
420
421
422
423
424
425
426
                field: 'fromLocation',
                title: '源库位',
            },
            {
                field: 'toLocation',
                title: '目的库位',
            },
            {
                field: 'qty',
                title: '数量'
            },
            {
427
428
429
430
431
432
433
434
                field: 'locationNoX',
                title: 'x',
            },
            {
                field: 'locationNoY',
                title: 'y',
            },
            {
435
                field: 'created',
pengyongcheng authored
436
                title: '创建时间'
437
438
439
            },
            {
                field: 'lastUpdated',
pengyongcheng authored
440
                title: '最后修改时间'
441
442
443
444
445
446
447
            },
            {
                field: 'lastUpdatedBy',
                title: '更新用户'
            },
        ]
    });
pengyongcheng authored
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
    function createtable(url, taskId) {
        $("#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: {
                taskId: taskId
            },
            success: function (value) {
                $("#bootstrap-table1").bootstrapTable('load', value.data);
            }
        })
    }
游杰 authored
465
466
467
468
469
470
471
472
    /*入库单列表-详细*/
    function detail(taskId) {
        var url = ctx + 'task/taskDetail/list';
        // createMenuItem(url, "入库单明细");
        // createtab(curl);
        createtable(url, taskId);
    }
pengyongcheng authored
473
474
475
476
477
478
479
480
481
    /*任务列表-下发执行*/
    function execute(taskId) {
        $.modal.confirm("确定执行任务?", function () {
            var url = ctx + 'task/taskHeader/execute';
            var data = {"taskId": taskId};
            $.operate.post(url, data);
        });
    }
mahuandong authored
482
pengyongcheng authored
483
484
485
486
487
    // 装配
    function assemble(taskId) {
        $.modal.openFull("人工装配", prefix + "/assemble/" + taskId, 800, 500)
    }
488
489
490
491
    /*任务列表-批量下发执行*/
    function batchExecute() {
        //var rows = $.common.isEmpty($.table._option.taskId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.taskId);
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
492
        if (rows.length === 0) {
493
494
495
496
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要执行选中的" + rows.length + "条数据吗?", function () {
497
498
499
            let url = ctx + 'task/taskHeader/execute';
            let ids = "";
            for (let i = rows.length - 1; i >= 0; i--) {
500
501
                ids = ids + rows[i].id + ","
            }
502
            let data = {"taskId": ids.substring(0, ids.length - 1)};
503
504
505
            $.operate.submit(url, "post", "json", data);
        })
    }
506
507
508
509
510
511
512
513
514
    /*任务列表-完成任务*/
    function complete(taskId) {
        $.modal.confirm("确定完成任务?", function () {
            var url = ctx + 'task/taskHeader/completeTaskByWMS';
            var data = {"taskId": taskId};
            $.operate.post(url, data);
        });
    }
515
516
517
518
519
    /*任务列表-批量完成任务*/
    function batchComplete() {
        //var rows = $.common.isEmpty($.table._option.taskId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.taskId);
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
520
        if (rows.length === 0) {
521
522
523
524
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要执行选中的" + rows.length + "条数据吗?", function () {
525
526
527
            let url = ctx + 'task/task/completeTaskByWMS';
            let ids = "";
            for (let i = 0; i < rows.length; i++) {
528
529
530
531
532
533
                ids = ids + rows[i].id + ","
            }
            var data = {"taskId": ids.substring(0, ids.length - 1)};
            $.operate.submit(url, "post", "json", data);
        })
    }
534
535
536
537
    /*批量最大值*/
    function prioritymax() {
        let rows = $.table.selectColumns("id");
538
        if (rows.length === 0) {
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
            $.modal.alertWarning("请至少选择一条记录");
        } else {
            $.ajax({
                cache: true,
                type: "POST",
                url: prefix + "/prioritymax/",
                async: false,
                data: {
                    "ids": rows.join(","),
                },
                error: function (request) {
                    $.operate.ajaxSuccess(request);
                },
                success: function (data) {
                    $.operate.ajaxSuccess(data);
                }
            });
        }
    }

    /*批量最小值*/
    function prioritymin() {
        let rows = $.table.selectColumns("id");
562
        if (rows.length === 0) {
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
            $.modal.alertWarning("请至少选择一条记录");
        } else {
            $.ajax({
                cache: true,
                type: "POST",
                url: prefix + "/prioritymin/",
                async: false,
                data: {
                    "ids": rows.join(","),
                },
                error: function (request) {
                    $.operate.ajaxSuccess(request);
                },
                success: function (data) {
                    $.operate.ajaxSuccess(data);
                }
            });
        }
    }
582
583
584
585
586
    /*任务列表-批量删除任务*/
    function batchRemoveHead() {
        //var rows = $.common.isEmpty($.table._option.taskId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.taskId);
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
587
        if (rows.length === 0) {
588
589
590
591
592
593
594
595
596
597
598
599
600
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function () {
            var url = ctx + 'task/taskHeader/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.submit(url, "post", "json", data);
        })
    }
601
602
603
    function queryParams(params) {
        return {
pengyongcheng authored
604
            internalTaskType: +[[${internalTaskType}]],
605
606
607
608
609
610
611
            // 传递参数查询参数
            pageSize: params.limit,
            pageNum: params.offset / params.limit + 1,
            searchValue: params.search,
            orderByColumn: params.sort,
            isAsc: params.order
        };
pengyongcheng authored
612
    }
613
614
615
616
617
618
619
620
621
622
623
624
625
626
    function print() {
        let rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if ($.common.isEmpty(rows)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        let ids = rows[0].id;
        for (let i = 1; i < rows.length; i++) {
            ids = ids + "," + rows[i].id;
        }
        let url = ctx + 'task/taskDetail/report/' + ids;
        $.modal.open("任务打印", url);
    }
627
</script>
mahuandong authored
628
</body>
lector authored
629
</html>