Explorar o código

添加了统计

liuzhiwei %!s(int64=7) %!d(string=hai) anos
pai
achega
054b0b676b

+ 96 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/pts/PtsMachineStatistics.java

@@ -0,0 +1,96 @@
+package com.iamberry.rst.core.pts;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 机器统计实体类
+ * Created by Administrator on 2017/8/25.
+ */
+public class PtsMachineStatistics implements Serializable{
+    private static final long serialVersionUID = -6496841333407812728L;
+    private String year;//年
+    private String  month;//月
+    private String day;//日
+    private Integer num;//数量
+    private String date;//日期
+
+    private Integer machineCount;//机器总数
+    private Integer machineAbnormality;//生产异常总数
+
+    private Integer machineType;//1.净水机 2.冲奶机
+
+    private String nodeDes;//工序选项描述
+
+    public String getYear() {
+        return year;
+    }
+
+    public void setYear(String year) {
+        this.year = year;
+    }
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    public String getDay() {
+        return day;
+    }
+
+    public void setDay(String day) {
+        this.day = day;
+    }
+
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public Integer getMachineCount() {
+        return machineCount;
+    }
+
+    public void setMachineCount(Integer machineCount) {
+        this.machineCount = machineCount;
+    }
+
+    public Integer getMachineAbnormality() {
+        return machineAbnormality;
+    }
+
+    public void setMachineAbnormality(Integer machineAbnormality) {
+        this.machineAbnormality = machineAbnormality;
+    }
+
+    public Integer getMachineType() {
+        return machineType;
+    }
+
+    public void setMachineType(Integer machineType) {
+        this.machineType = machineType;
+    }
+
+    public String getNodeDes() {
+        return nodeDes;
+    }
+
+    public void setNodeDes(String nodeDes) {
+        this.nodeDes = nodeDes;
+    }
+}

+ 10 - 4
watero-rst-web/src/main/resources/dev-jdbc.properties

@@ -1,15 +1,21 @@
 jdbc.driver=com.mysql.jdbc.Driver
-##### Õýʽ»·¾³ ####
+##### \uFFFD\uFFFD\u02BD\uFFFD\uFFFD\uFFFD\uFFFD ####
 #jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/rst?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
 #jdbc.username=watero_rst
 #jdbc.password=watero_RST
-##### Õýʽ»·¾³ end #####
+##### \uFFFD\uFFFD\u02BD\uFFFD\uFFFD\uFFFD\uFFFD end #####
 
-### ²âÊÔ»·¾³
+#\u6D4B\u8BD5
+#jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/test_rst?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
+#jdbc.username=rst_test
+#jdbc.password=RST_test
+#
+
+### \uFFFD\uFFFD\uFFFD\u053B\uFFFD\uFFFD\uFFFD
 jdbc.url=jdbc:mysql://192.168.1.254/rst_test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
 jdbc.username=root
 jdbc.password=root
-### ²âÊÔ»·¾³ end ######
+### \uFFFD\uFFFD\uFFFD\u053B\uFFFD\uFFFD\uFFFD end ######
 
 #pool settings
 jdbc.pool.init=1

+ 328 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/producedAbnormalityStatistics.ftl

@@ -0,0 +1,328 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+
+    <style>
+        .charts-box{width:700px;height:400px;display: inline-block;position: relative;margin-right: 40px;margin-bottom: 40px;}
+        .my-nav{width: 100%;height: 48px;background: #fff;display: table;text-align: center;}
+        .my-nav>a{display: table-cell;vertical-align: middle; border: 1px solid #32a3d8;font-size: 18px;border-left: 0;color: #32a3d8;}
+        .my-nav>a:first-child{border-left: 1px solid #32a3d8;}
+        .my-nav>a.active{background-color: #32a3d8;color:#fff;}
+    </style>
+    <title>生产统计</title>
+<#include "/base/list_base.ftl">
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 统计管理 <span class="c-gray en">&gt;</span> 生产统计 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px;background-color: #32a3d8;border: 1px solid #32a3d8;" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
+<div class="pd-20">
+    <div style="width: 250px;margin-bottom: 20px;">
+        <nav class="my-nav" id="tab-nav-menu">
+            <a <#if machineType == '1'>class="active" </#if> onclick="machineTypeNormal(1);">净水机</a><a <#if machineType == '2'>class="active" </#if> onclick="machineTypeNormal(2);">冲奶机</a>
+        </nav>
+    </div>
+    <div>
+        <div class="charts-box">
+            <div id="container" style="width:700px;height:400px;display: inline-block;"></div>
+        </div>
+        <div class="charts-box">
+            <div id="container1" style="width:700px;height:400px;display: inline-block;"></div>
+        </div>
+    </div>
+    <div>
+        <div class="charts-box" style="height: 478px;background-color: #f5f5f5;">
+            <div style="margin: 15px;">
+                <nav class="my-nav" id="tab-nav-map">
+                <#list processList as list>
+                    <a  name="${list.processId }" <#if list_index == 0>class="active"</#if> >${list.processName }</a>
+                </#list>
+                </nav>
+            </div>
+            <div id="container3" style="width:700px;height:400px;display: inline-block;"></div>
+        </div>
+        <div class="charts-box" style="height: 478px;">
+            <div id="container2" style="width:700px;height:478px;display: inline-block;"></div>
+        </div>
+
+    </div>
+</div>
+<script type="text/javascript" src="${path}/common/lib/hcharts/Highcharts/5.0.6/js/highcharts.js"></script>
+<!--<script type="text/javascript" src="lib/Highcharts/4.1.7/js/modules/exporting.js"></script>-->
+<script type="text/javascript">
+    $(function () {
+
+    });
+
+    var chart =new Highcharts.Chart('container', {
+        chart: {
+            type: 'column',
+            backgroundColor:'#f5f5f5'
+        },
+        title: {
+            text: '每月生产数量'
+        },
+        subtitle: {
+            text: ''
+        },
+        xAxis: {
+            categories: [
+                '一月',
+                '二月',
+                '三月',
+                '四月',
+                '五月',
+                '六月',
+                '七月',
+                '八月',
+                '九月',
+                '十月',
+                '十一月',
+                '十二月'
+            ]
+        },
+        legend: {
+            enabled: false
+        },
+        yAxis: {
+            min: 0,
+            title: {
+                text: '数量'
+            }
+        },
+        tooltip: {
+            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
+            pointFormat: '<tr><td style="color:{series.color};padding:0"> </td>' +
+            '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
+            footerFormat: '</table>',
+            shared: true,
+            useHTML: true
+        },
+        plotOptions: {
+            column: {
+                pointPadding: 0.2,
+                borderWidth: 0
+            }
+        },
+        series: [{
+            name: ' ',
+            data: ${years!''}
+
+        }]
+    });
+
+    var chart1 =new Highcharts.Chart('container1', {
+        chart: {
+            type: 'column',
+            backgroundColor:'#f5f5f5'
+        },
+        title: {
+            text: '七天每日生产数量'
+        },
+        subtitle: {
+            text: ''
+        },
+        xAxis: {
+            categories: ${monthDay!''}
+        },
+        legend: {
+            enabled: false
+        },
+        yAxis: {
+            min: 0,
+            title: {
+                text: '数量'
+            }
+        },
+        tooltip: {
+            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
+            pointFormat: '<tr></td>' +
+            '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
+            footerFormat: '</table>',
+            shared: true,
+            useHTML: true
+        },
+        plotOptions: {
+            column: {
+                pointPadding: 0.2,
+                borderWidth: 0
+            }
+        },
+        series: [{
+            name: ' ',
+            data: ${days!''}
+
+        }]
+    });
+
+    var chart2 =new Highcharts.Chart('container2', {
+        chart: {
+            plotBackgroundColor: null,
+            plotBorderWidth: null,
+            plotShadow: false,
+            backgroundColor:'#f5f5f5'
+        },
+        title: {
+            text: '流程异常'
+        },
+        subtitle: {
+            text: '共生产台${machineNum!''}机器,${machineAbnormality!''}台流程异常<span style="color:#fba62e;">异常率${abnormalityPercentage!''}%</span>'
+        },
+        tooltip: {
+            pointFormat: '<b>{point.percentage:.1f}%</b>'
+        },
+        plotOptions: {
+            pie: {
+                allowPointSelect: true,
+                cursor: 'pointer',
+                dataLabels: {
+                    enabled: true,
+                    color: '#000000',
+                    connectorColor: '#000000',
+                    format: '{point.percentage:.1f} %'
+                }
+            }
+        },
+        series: [{
+            type: 'pie',
+            name: 'Browser share',
+            colors: ['#2adaa7', '#fba62e', '#90ed7d', '#f7a35c', '#8085e9', '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'],
+            data: [
+                ['正常',   ${normalPercentage!''}],
+                {
+                    name: '异常',
+                    y: ${abnormalityPercentage!''},
+                    sliced: true,
+                    selected: true
+                },
+            ]
+        }]
+    });
+    var chart3 =new Highcharts.Chart('container3', {
+
+        chart: {
+            type: 'column',
+            backgroundColor:'#f5f5f5'
+        },
+        title: {
+            text: ''
+        },
+        subtitle: {
+            text: ''
+        },
+        xAxis: {
+            categories: ${desString!''}
+        },
+        legend: {
+            enabled: false
+        },
+        yAxis: {
+            min: 0,
+            title: {
+                text: '类型'
+            }
+        },
+        tooltip: {
+            headerFormat: '<span style="font-size:10px">{point.key} :</span><table>',
+            pointFormat: '<tr>' +
+            '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
+            footerFormat: '</table>',
+            shared: false,
+            useHTML: false
+        },
+        plotOptions: {
+            column: {
+                pointPadding: 0.2,
+                borderWidth: 0
+            }
+        },
+        series: [{
+            name: ' ',
+            data: ${nodeString!''}
+
+        }]
+    });
+
+
+    //按钮切换
+    $(document).on('click', '#tab-nav-menu>a', function() {
+        $(this).addClass("active").siblings().removeClass("active");
+        //这里写更新1,2,3,4图数据的代码,逻辑自己判断
+    });
+
+
+    $(document).on('click', '#tab-nav-map>a', function() {
+        $(this).addClass("active").siblings().removeClass("active");
+        var processId = $(this).attr("name");
+        $.ajax({
+            "type" : "post",
+            "url" : "${path}/admin/machine/_node_normal",
+            "dataType" : "json",
+            "data" :{processId : processId},
+            "success" : function(data) {
+                if(data.returnCode == 200){
+                    var desString = eval(data.desString);
+                    var nodeString = eval(data.nodeString);
+                    chart3.update({
+                        chart: {
+                            type: 'column',
+                            backgroundColor:'#f5f5f5'
+                        },
+                        title: {
+                            text: ''
+                        },
+                        subtitle: {
+                            text: ''
+                        },
+                        xAxis: {
+                            categories: desString
+                        },
+                        legend: {
+                            enabled: false
+                        },
+                        yAxis: {
+                            min: 0,
+                            title: {
+                                text: '类型'
+                            }
+                        },
+                        tooltip: {
+                            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
+                            pointFormat: '<tr><td style="color:{series.color};padding:0"> </td>' +
+                            '<td style="padding:0"><b>{point.y} 台</b></td></tr>',
+                            footerFormat: '</table>',
+                            shared: false,
+                            useHTML: false
+                        },
+                        plotOptions: {
+                            column: {
+                                pointPadding: 0.2,
+                                borderWidth: 0
+                            }
+                        },
+                        series: [{
+                            name: ' ',
+                            data: nodeString
+
+                        }]
+                    });
+                }else{
+                    layer.msg('查询失败', {icon: 2, time: 2000});
+                }
+            },
+            "error":function(data){
+                layer.msg('操作失败', {icon: 2, time: 2000});
+            }
+        });
+
+    });
+
+    function machineTypeNormal(machineType) {
+        window.location.href=root_path + '/admin/machine/_produced_abnormality_statistics?machineType='+machineType;
+    }
+</script>
+</body>
+</html>

+ 193 - 0
watero-rst-web/src/main/webapp/common/lib/jquery.PrintArea/jquery.PrintArea.js

@@ -0,0 +1,193 @@
+/**
+ *  Version 2.4.0 Copyright (C) 2013
+ *  Tested in IE 11, FF 28.0 and Chrome 33.0.1750.154
+ *  No official support for other browsers, but will TRY to accommodate challenges in other browsers.
+ *  Example:
+ *      Print Button: <div id="print_button">Print</div>
+ *      Print Area  : <div class="PrintArea" id="MyId" class="MyClass"> ... html ... </div>
+ *      Javascript  : <script>
+ *                       $("div#print_button").click(function(){
+ *                           $("div.PrintArea").printArea( [OPTIONS] );
+ *                       });
+ *                     </script>
+ *  options are passed as json (example: {mode: "popup", popClose: false})
+ *
+ *  {OPTIONS}   | [type]     | (default), values      | Explanation
+ *  ---------   | ---------  | ---------------------- | -----------
+ *  @mode       | [string]   | (iframe),popup         | printable window is either iframe or browser popup
+ *  @popHt      | [number]   | (500)                  | popup window height
+ *  @popWd      | [number]   | (400)                  | popup window width
+ *  @popX       | [number]   | (500)                  | popup window screen X position
+ *  @popY       | [number]   | (500)                  | popup window screen Y position
+ *  @popTitle   | [string]   | ('')                   | popup window title element
+ *  @popClose   | [boolean]  | (false),true           | popup window close after printing
+ *  @extraCss   | [string]   | ('')                   | comma separated list of extra css to include
+ *  @retainAttr | [string[]] | ["id","class","style"] | string array of attributes to retain for the containment area. (ie: id, style, class)
+ *  @standard   | [string]   | strict, loose, (html5) | Only for popup. For html 4.01, strict or loose document standard, or html 5 standard
+ *  @extraHead  | [string]   | ('')                   | comma separated list of extra elements to be appended to the head tag
+ */
+(function($) {
+    var counter = 0;
+    var modes = { iframe : "iframe", popup : "popup" };
+    var standards = { strict : "strict", loose : "loose", html5 : "html5" };
+    var defaults = { mode       : modes.iframe,
+                     standard   : standards.html5,
+                     popHt      : 500,
+                     popWd      : 400,
+                     popX       : 200,
+                     popY       : 200,
+                     popTitle   : '',
+                     popClose   : false,
+                     extraCss   : '',
+                     extraHead  : '',
+                     retainAttr : ["id","class","style"] };
+
+    var settings = {};//global settings
+
+    $.fn.printArea = function( options )
+    {
+        $.extend( settings, defaults, options );
+
+        counter++;
+        var idPrefix = "printArea_";
+        $( "[id^=" + idPrefix + "]" ).remove();
+
+        settings.id = idPrefix + counter;
+
+        var $printSource = $(this);
+
+        var PrintAreaWindow = PrintArea.getPrintWindow();
+
+        PrintArea.write( PrintAreaWindow.doc, $printSource );
+
+        setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 );
+    };
+
+    var PrintArea = {
+        print : function( PAWindow ) {
+            var paWindow = PAWindow.win;
+
+            $(PAWindow.doc).ready(function(){
+                paWindow.focus();
+                paWindow.print();
+
+                if ( settings.mode == modes.popup && settings.popClose )
+                    setTimeout(function() { paWindow.close(); }, 2000);
+            });
+        },
+        write : function ( PADocument, $ele ) {
+            PADocument.open();
+            PADocument.write( PrintArea.docType() + "<html>" + PrintArea.getHead() + PrintArea.getBody( $ele ) + "</html>" );
+            PADocument.close();
+        },
+        docType : function() {
+            if ( settings.mode == modes.iframe ) return "";
+
+            if ( settings.standard == standards.html5 ) return "<!DOCTYPE html>";
+
+            var transitional = settings.standard == standards.loose ? " Transitional" : "";
+            var dtd = settings.standard == standards.loose ? "loose" : "strict";
+
+            return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01' + transitional + '//EN" "http://www.w3.org/TR/html4/' + dtd +  '.dtd">';
+        },
+        getHead : function() {
+            var extraHead = "";
+            var links = "";
+
+            if ( settings.extraHead ) settings.extraHead.replace( /([^,]+)/g, function(m){ extraHead += m });
+
+            $(document).find("link")
+                .filter(function(){ // Requirement: <link> element MUST have rel="stylesheet" to be considered in print document
+                        var relAttr = $(this).attr("rel");
+                        return ($.type(relAttr) === 'undefined') == false && relAttr.toLowerCase() == 'stylesheet';
+                    })
+                .filter(function(){ // Include if media is undefined, empty, print or all
+                        var mediaAttr = $(this).attr("media");
+                        return $.type(mediaAttr) === 'undefined' || mediaAttr == "" || mediaAttr.toLowerCase() == 'print' || mediaAttr.toLowerCase() == 'all'
+                    })
+                .each(function(){
+                        links += '<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >';
+                    });
+            if ( settings.extraCss ) settings.extraCss.replace( /([^,\s]+)/g, function(m){ links += '<link type="text/css" rel="stylesheet" href="' + m + '">' });
+
+            return "<head><title>" + settings.popTitle + "</title>" + extraHead + links + "</head>";
+        },
+        getBody : function ( elements ) {
+            var htm = "";
+            var attrs = settings.retainAttr;
+            elements.each(function() {
+                var ele = PrintArea.getFormData( $(this) );
+
+                var attributes = ""
+                for ( var x = 0; x < attrs.length; x++ )
+                {
+                    var eleAttr = $(ele).attr( attrs[x] );
+                    if ( eleAttr ) attributes += (attributes.length > 0 ? " ":"") + attrs[x] + "='" + eleAttr + "'";
+                }
+
+                htm += '<div ' + attributes + '>' + $(ele).html() + '</div>';
+            });
+
+            return "<body>" + htm + "</body>";
+        },
+        getFormData : function ( ele ) {
+            var copy = ele.clone();
+            var copiedInputs = $("input,select,textarea", copy);
+            $("input,select,textarea", ele).each(function( i ){
+                var typeInput = $(this).attr("type");
+                if ($.type(typeInput) === 'undefined') typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : "";
+                var copiedInput = copiedInputs.eq( i );
+
+                if ( typeInput == "radio" || typeInput == "checkbox" ) copiedInput.attr( "checked", $(this).is(":checked") );
+                else if ( typeInput == "text" ) copiedInput.attr( "value", $(this).val() );
+                else if ( typeInput == "select" )
+                    $(this).find( "option" ).each( function( i ) {
+                        if ( $(this).is(":selected") ) $("option", copiedInput).eq( i ).attr( "selected", true );
+                    });
+                else if ( typeInput == "textarea" ) copiedInput.text( $(this).val() );
+            });
+            return copy;
+        },
+        getPrintWindow : function () {
+            switch ( settings.mode )
+            {
+                case modes.iframe :
+                    var f = new PrintArea.Iframe();
+                    return { win : f.contentWindow || f, doc : f.doc };
+                case modes.popup :
+                    var p = new PrintArea.Popup();
+                    return { win : p, doc : p.doc };
+            }
+        },
+        Iframe : function () {
+            var frameId = settings.id;
+            var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;';
+            var iframe;
+
+            try
+            {
+                iframe = document.createElement('iframe');
+                document.body.appendChild(iframe);
+                $(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() });
+                iframe.doc = null;
+                iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
+            }
+            catch( e ) { throw e + ". iframes may not be supported in this browser."; }
+
+            if ( iframe.doc == null ) throw "Cannot find document.";
+
+            return iframe;
+        },
+        Popup : function () {
+            var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
+            windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
+            windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes";
+
+            var newWin = window.open( "", "_blank",  windowAttr );
+
+            newWin.doc = newWin.document;
+
+            return newWin;
+        }
+    };
+})(jQuery);