agvHeader.html 12.6 KB
<!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">
            <div class="tab-content" id="myTabContent">
                <div class="tab-pane fade in active">
                    <div class="col-sm-12 select-info">
                        <form id="task-form">
                            <div class="select-list">
                                <ul>
                                    <input type="hidden" th:value="${InternalTaskType}" name="InternalTaskType">
                                    <li>
                                        <input type="hidden" name="internalTaskType"  th:value="${InternalTaskType}"/>
                                    </li>
                                    <li>
                                        任务id:<input type="text" name="id"/>
                                    </li>
                                    <li>
                                        容器编号:<input type="text" name="containerCode"/>
                                    </li>
                                    <li>
                                        源点位:<input type="text" name="fromPort"/>
                                    </li>
                                    <li>
                                        目标点位:<input type="text" name="toPort"/>
                                    </li>
                                    <li>
                                        小车编号:<input type="text" name="carNo"/>
                                    </li>
                                    <form>
                                        <li>
                                            任务状态:<select name="taskComplete">
                                            <option value="" selected="selected">所有</option>
                                            <option value="1" >生成</option>
                                            <option value="10" >下发</option>
                                            <option value="20" >执行</option>
                                            <option value="100">完成</option>
                                        </select>
                                        <li/>
                                    </form>
                                    <li class="time" style="height: 30px">
                                        <label>创建时间: </label>
                                        <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdTime"/>
                                        <span>-</span>
                                        <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="updated"/>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('task-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                        <!--<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="print()" shiro:hasPermission="task:task:execute">
                            <i class="fa fa-print"></i> 打印
                        </a>
                        <a th:if="${InternalTaskType} eq 500" class="btn btn-outline btn-primary btn-rounded" onclick="$.operate.add()" shiro:hasPermission="task:task:add">
                            <i class="fa fa-send"></i> 新增
                        </a>
                        <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>
                    </div>
                    <input type="hidden" id="taskId" name="taskId" th:value="${taskId}"/>
                    <input type="hidden" id="internalTaskType" name="internalTaskType" th:value="${InternalTaskType}"/>
                    <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('task:taskHeader:edit')}]];
    var removeFlag = [[${@permission.hasPermi('task:taskHeader:remove')}]];
    var executeFlag = [[${@permission.hasPermi('task:taskHeader:execute')}]];
    var completeFlag = [[${@permission.hasPermi('task:taskHeader:complete')}]];
    var agvFlag = [[${@permission.hasPermi('task:task:agvFlag')}]];
    var stations = [[${@dict.getType('station')}]];
    var taskTypes=[[${@dict.getType('agvTaskType')}]];
    var taskStatus=[[${@dict.getType('agvTaskStatus')}]];
    var zone =[[${@zone.getCode()}]];
    var prefix = ctx + "agv"
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/createAGVTask",
            updateUrl: prefix + "/editagv/{id}",
            removeUrl: prefix + "/cancelAGVTask",
            modalName: "任务管理",
            sortName: "lastUpdated",
            sortOrder: "desc",
            search: false,
            clickToSelect:true,
            queryParams: queryParams,
            columns: [{
                checkbox: true
            },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.status < 10)  {
                            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> ');
                            actions.push('<a class="btn btn-info 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="$.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>');
                        }
                        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>');
                        }
                        return actions.join('');
                    }
                },
                {
                    field : 'id',
                    title : '任务id' ,
                    sortable: true
                },
                {
                    field : 'companyCode',
                    title : '货主编码',
                    visible:false
                },
                {
                    field : 'taskType',
                    title : '任务类型' ,
                    align: 'center',
                    visible:true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(taskTypes, value);
                    }
                },
                {
                    field : 'fromPort',
                    title : '开始点位',
                    visible:true
                },
                {
                    field : 'toPort',
                    title : '目标点位',
                    visible:true
                },
                {
                    field : 'containerCode',
                    title : '容器号' ,
                    sortable: true
                },
                {
                    field : 'priority',
                    title : '优先级',
                    sortable: true
                },
                {
                    field : 'status',
                    title : '任务状态' ,
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(taskStatus, value);
                    }
                },
                {
                    field : 'carNo',
                    title : '小车编号' ,
                    align: 'center',
                    visible:true,
                },
                {
                    field : 'preTaskNo',
                    title : '前置任务号',
                    sortable: true
                },
                {
                    field : 'shelfNo',
                    title : '货架编号',
                    sortable: true
                },
                {
                    field : 'station',
                    title : '站台编号',
                    sortable: true
                },
                {
                    field : 'createdTime',
                    title : '生成时间',
                    sortable: true
                },
                {
                    field : 'createdBy',
                    title : '任务下达人'
                },
                {
                    field : 'updated',
                    title : '修改时间' ,
                    sortable: true,
                },
                {
                    field : 'updatedBy',
                    title : '更新用户'
                },
                {
                    field : 'userDef1',
                    title : '自定义字段1' ,
                    visible:false
                },
                {
                    field : 'userDef2',
                    title : '自定义字段2' ,
                    visible:false
                },
                {
                    field : 'userDef3',
                    title : '自定义字段3' ,
                    visible:false
                }
            ]
        };
        $.table.init(options);
    });

    function execute(taskId) {
        $.modal.confirm("确定执行任务?", function() {
            var url = ctx + 'agv/execute';
            var data = { "taskId" : taskId };
            $.operate.post(url, data);
        });
    }
    function complete(taskId) {
        $.modal.confirm("确定完成任务?", function() {
            var url = ctx + 'agv/completeTaskByWMS';
            var data = { "taskId" : taskId };
            $.operate.post(url, data);
        });
    }
    function queryParams(params) {
        return {
            ids:       $("#ids").val()
        };
    }

    /*任务列表-批量删除任务*/
    function batchRemoveHead() {
        //var rows = $.common.isEmpty($.table._option.taskId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.taskId);
        var rows=$("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
            var url = prefix + "/cancelAGVTask";
            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);
        })
    }
</script>

</body>
</html>