main.html 7.16 KB
<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>概况</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link  th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link  th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
    <link  th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
    <link  th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
    <script th:src="@{/naranja/naranja.min.js}" ></script>
    <link rel="stylesheet" th:href="@{/naranja/naranja.min.css}">
</head>

<body class="gray-bg">
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/inventory/inventoryTransaction">
        <div class="total_box ys01">
            <h1 id="s1">-</h1>
            <p>今日库存交易量</p>
        </div>
    </a>
</div>
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/receipt/receiptHeader/900/0">
        <div class="total_box ys02">
            <h1 id="s2">-</h1>
            <p>今日入库量</p>
        </div>
    </a>
</div>
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/shipment/shipmentHeader">
        <div class="total_box ys03">
            <h1 id="s3">-</h1>
            <p>今日出库量</p>
        </div>
    </a>
</div>
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/inventory/inventoryHeader">
        <div class="total_box ys04">
            <h1 id="s4">-</h1>
            <p>库存总量</p>
        </div>
    </a>
</div>
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/inventory/inventoryHeader">
        <div class="total_box ys05">
            <h1 id="s5">-</h1>
            <p>库内物料品数</p>
        </div>
    </a>
</div>
<div class="col-sm-2" style="padding:5px;">
    <a class="menuItem" href="/wms/task/taskHeader?taskType=100">
        <div class="total_box ys06">
            <h1 id="s6">-</h1>
            <p>待执行任务数</p>
        </div>
    </a>
</div>
</div>

<div class="row" style="padding:0 30px;">
    <div class="col-sm-6" style="padding:5px 5px 10px 5px;">
        <div class="float-e-margins">
            <div class="ibox-title"><h5>历史每日收发货量</h5></div>
            <div class="ibox-content">
                <div id="chart1" class="flot-chart1">
                    这里放图表
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6" style="padding:5px 5px 10px 5px;">
        <div class="float-e-margins">
            <div class="ibox-title"><h5>库位利用率</h5></div>
            <div class="ibox-content">
                <div id="chart2" class="flot-chart1">
                    这里放图表
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6" style="padding:5px 5px 10px 5px;">
        <div class="float-e-margins">
            <div class="ibox-title"><h5>在线库存状态</h5></div>
            <div class="ibox-content">
                <div id="chart3" class="flot-chart1">
                    这里放图表
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6" style="padding:5px 5px 10px 5px;">
        <div class="ibox float-e-margins">
            <div class="ibox-title"><h5>库存概况</h5></div>
            <div class="ibox-content">
                <div id="chart4" class="flot-chart1">
                    这里放图表
                </div>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/echarts/echarts.js}"></script>
<script>
    $(function () {
        refresh();
        setInterval("refresh()",60000);
    });
    //测试时弄个5s
    // self.setInterval("refresh()",5000);

    var chart1 = echarts.init(document.getElementById('chart1'));
    var chart2 = echarts.init(document.getElementById('chart2'));
    var chart3 = echarts.init(document.getElementById('chart3'));
    var chart4 = echarts.init(document.getElementById('chart4'));

    function refresh() {
        $.get("../index/getShipmentsLast7Days").done(function (data) {
            chart1.setOption(JSON.parse(data));
        })
        $.get("../index/getLocationProp").done(function (data) {
            chart2.setOption(JSON.parse(data));
        })
        $.get("../index/getInventoryStatus").done(function (data) {
            chart3.setOption(JSON.parse(data));
        })
        $.get("../index/getInventoryProp").done(function(data){
            chart4.setOption(JSON.parse(data));
        });

        $.get("../index/getCommonData").done(function (data) {
            if(data.code==200){
                $("#s1").text(data.data.bllCount)
                $("#s2").text(data.data.receiptTotal)
                $("#s3").text(data.data.shipmentTotal)
                $("#s4").text(data.data.inventoryTotal)
                $("#s5").text(data.data.materialCount)
                $("#s6").text(data.data.taskUncompletedTotal)
            }
        })
    }

    function readNotice(id) {
        $.ajax({
            url:'/wms/system/notice/readOne?id=' + id,
            type:"get",
            success:function (response) {
                // location.reload()
            },
            error:function (response) {
                $.modal.alertError("服务出错")
            }
        })
    }

    function showNotice(id, title, text, url) {
        naranja().warn({
            title: title, // <- required
            text: text, // <- required
            icon: true , // <- unrequired, default true,
            timeout: 'keep' , // <- unrequired, default 5000 miliseconds
            buttons: [
                {
                    text: '知道了',
                    click: function (e) {
                        readNotice(id)
                        // click event close notifiaction
                        // unless you use preventClose method
                        e.preventClose()
                        // if you want close notifiaction
                        // manually, use closeNotification
                        e.closeNotification()
                    }
                },
                {
                    text: '查看',
                    click: function () {
                        $.modal.open(title, url, 900, 700);
                        readNotice(id)
                        // $.modal.openTab("物料预警", "/wms/inventory/inventoryDetail/inventoryExpireWarning?materialCode=N022049");
                    }
                }
            ]
        })
    }
</script>
<script th:inline="javascript">
    var datas = [[${@SysNoticeServiceImpl.listNew()}]];
    datas.forEach(function (item) {
        showNotice(item.id, item.title, item.content, item.url)
    });
</script>
<div th:include="include :: footer"></div>
</body>
</html>