agvTask.html 15.7 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">
            <!--<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="task-form">
                            <div class="select-list">
                                <ul>
                                    <li>
                                        任务id:<input type="text" name="id"/>
                                    </li>
                                    <li>
                                        单据编码:<input type="text" name="billCode"/>
                                    </li>
                                    <li>
                                        容器编号:<input type="text" name="containerCode"/>
                                    </li>
                                    <!--<li>-->
                                    <!--&lt;!&ndash;入库类型:<input type="text" name="sourceCode"/>&ndash;&gt;-->
                                    <!--任务类型:<select name="type" th:with="type=${@dict.getType('taskType')}">-->
                                    <!--<option value="">所有</option>-->
                                    <!--<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>-->
                                    <!--</li>-->

                                    <!--<li class="time" style="height: 30px">-->
                                    <!--<label>创建时间: </label>-->
                                    <!--<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/>-->
                                    <!--<span>-</span>-->
                                    <!--<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/>-->
                                    <!--</li>-->

                                    <!--<li>-->
                                    <!--&lt;!&ndash;头 状 态:<input type="text" name="firstStatus"/>&ndash;&gt;-->
                                    <!--头 状 态:<select name="firstStatus" th:with="firstStatus=${@dict.getType('taskStatus')}">-->
                                    <!--<option value="">所有</option>-->
                                    <!--<option th:each="e : ${firstStatus}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>-->
                                    <!--</li>-->
                                    <!--<li>-->
                                    <!--&lt;!&ndash;尾 状 态:<input type="text" name="lastStatus"/>&ndash;&gt;-->
                                    <!--尾 状 态:<select name="lastStatus" th:with="lastStatus=${@dict.getType('taskStatus')}">-->
                                    <!--<option value="">所有</option>-->
                                    <!--<option th:each="e : ${lastStatus}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>-->
                                    <!--</li>-->
                                    <!--<li>
                                        出入库站台:<select name="station" th:with="stations = ${@dict.getType('station')}">
                                        <option value="">所有</option>
                                        <option th:each="e : ${stations}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>
                                    </li>-->
                                    <!--<li>-->
                                    <!--巷道:<input type="text" name="roadway"/>-->
                                    <!--</li>-->
                                    <!--<li>-->
                                    <!--来源库位:<input type="text" name="sourceLocation"/>-->
                                    <!--</li>-->
                                    <!--<li>-->
                                    <!--目的库位:<input type="text" name="destinationLocation"/>-->
                                    <!--</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="$.operate.add()" >
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-outline btn-danger btn-rounded" onclick="batchCancel()" shiro:hasPermission="task:agvTask:remove">
                            <i class="fa fa-remove"></i>批量取消
                        </a>
                        <a class="btn btn-outline btn-success btn-rounded" onclick="batchExecute()" shiro:hasPermission="task:agvTask:execute">
                            <i class="fa fa-send"></i>批量执行
                        </a>
                        <a class="btn btn-outline btn-primary btn-rounded" onclick="batchComplete()" shiro:hasPermission="task:agvTask:complete">
                            <i class="fa fa-check"></i>批量完成
                        </a>

                    </div>
                    <!--                    <input type="hidden" id="taskId" name="taskId" th:value="${taskId}"/>-->
                    <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
                </div>
<!--                <div class="tab-pane fade" id="tabDetail">-->
<!--                <div class="btn-group hidden-xs" id="toolbar1" role="group">-->
<!--                <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" >-->
<!--                <i class="fa fa-plus"></i> 新增-->
<!--                </a>-->
<!--                </div>-->
<!--                <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 prefix = ctx + "task/agvTask";
    var cancelFlag = [[${@permission.hasPermi('task:agvTask:cancel')}]];
    var executeFlag = [[${@permission.hasPermi('task:agvTask:execute')}]];
    var completeFlag = [[${@permission.hasPermi('task:agvTask:complete')}]];
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "任务管理",
            sortName: "id",
            sortOrder: "desc",
            search: false,
            clickToSelect:true,
            columns: [
                {
                    checkbox: true,
                    formatter:function (value,row,index){
                        if(row.status === 100){
                            return {
                                checked : false,
                                disabled: true
                            }
                        }else{
                            return {
                                checked : false,
                                disabled: false
                            }
                        }
                    }
                },
                {
                    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 < 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-danger btn-xs'+cancelFlag+'" href="#" onclick="cancel(\'' + 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 < 100 && row.status >=10 ){
                            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 : 'warehouseId',
                //     title : '仓库ID' ,
                //     visible:true
                // },
                {
                    field : 'warehouseCode',
                    title : '仓库编码' ,
                    visible:false
                },
                {
                    field : 'companyCode',
                    title : '货主编码' ,
                    visible:true
                },
                // {
                //     field : 'companyId',
                //     title : '货主ID' ,
                //     visible:false
                // },
                {
                    field : 'interactionId',
                    title : '交互标识' ,
                    visible:true
                },
                {
                    field : 'taskHeaderId',
                    title : '任务头标识' ,
                    visible:true
                },
                // {
                //     field : 'taskDetailId',
                //     title : '任务子标识' ,
                //     visible:true
                // },
                {
                    field : 'taskType',
                    title : '任务类型' ,
                    visible:true
                },
                {
                    field : 'shelfNo',
                    title : '货架编码' ,
                    visible:true
                },
                {
                    field : 'station',
                    title : '站台编码' ,
                    visible:true
                },
                {
                    field : 'fromLocationNo',
                    title : '源位置' ,
                    visible:true
                },
                {
                    field : 'toLocationNo',
                    title : '目的位置' ,
                    visible:true
                },
                {
                    field : 'orientation',
                    title : '方向' ,
                    visible:true
                },
                {
                    field : 'platform',
                    title : '平台' ,
                    visible:true
                },
                {
                    field : 'carNo',
                    title : '小车编号' ,
                    visible:true
                },
                // {
                //     field : 'state',
                //     title : '状态' ,
                //     visible:true
                // },
                // {
                //     field : 'date',
                //     title : '日期' ,
                //     visible:true
                // },

            ]
        };
        $.table.init(options);
    });
    /*执行任务*/
    function execute(id) {
        $.modal.confirm("确定执行任务?", function() {
            var url = ctx + 'task/agvTask/execute';
            var data = { "id" : id };
            $.operate.post(url, data);
        });
    }

    /**
     * 批量执行任务
     */
    function batchExecute() {
        var rows=$("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要下发AGV选中的" + rows.length + "条数据吗?", function() {
            var url = ctx + 'task/agvTask/executes';
            var ids = "";
            for(var i=rows.length-1; i >= 0; i--) {
                ids = ids + rows[i].id + ","
            }
            var data = { "ids": ids.substring(0, ids.length-1) };
            $.operate.submit(url, "post", "json", data);
        })
    }

    /*批量取消任务*/
    function batchCancel() {
        var rows=$("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
            var url = ctx + 'task/agvTask/cancels';
            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);
        })
    }

    /**
     * 取消任务
     * @param id
     */
    function cancel(id) {
        $.modal.confirm("确定执行任务?", function() {
            var url = ctx + 'task/agvTask/cancel';
            var data = { "id" : id };
            $.operate.post(url, data);
        });
    }

    /**
     * 任务完成
     * @param id
     */
    function complete(id) {
        $.modal.confirm("确定执行任务?", function() {
            var url = ctx + 'task/agvTask/complete';
            var data = { "id" : id };
            $.operate.post(url, data);
        });
    }

    /**
     * 批量任务完成
     * @param ids
     */
    function batchComplete(ids) {
        var rows=$("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
            var url = ctx + 'task/agvTask/completes';
            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>