Pārlūkot izejas kodu

施釉节拍看板

张忠帅 2 gadi atpakaļ
vecāks
revīzija
bee17aab4f

+ 173 - 0
wwwroot/main/Procedure/test14/GlazingBeats.ashx

@@ -0,0 +1,173 @@
+<%@ WebHandler Language="C#" Class="SmallKanban" %>
+
+using System;
+using System.Web;
+using System.Web.SessionState;
+using System.Configuration;
+using System.Data;
+using Curtain.DataAccess;
+using Curtain.Log;
+using DK.XuWei.WebMes;
+using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+
+public class SmallKanban : IHttpHandler {
+
+    public void ProcessRequest (HttpContext context) {
+        using (IDataAccess conn = DataAccess.Create())
+        {
+            string morningMintimes= DateTime.Now.ToString("yyyy-MM-dd")+" 07:30:00";
+            string morningMaxtimes= DateTime.Now.ToString("yyyy-MM-dd")+" 12:30:00";
+
+            string afterMintimes= DateTime.Now.ToString("yyyy-MM-dd")+" 13:30:00";
+            string afterMaxtimes= DateTime.Now.ToString("yyyy-MM-dd")+" 16:30:00";
+            //服务器时间
+            if (context.Request["m"].ToString() == "fwq")
+            {
+                string time = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm ");
+                Dictionary<string, string> d = new Dictionary<string, string>();
+                JObject json = new JObject(
+                          new JProperty("success", true),
+                          new JProperty("sj", time)
+                        );
+                context.Response.Write(json.ToString());
+            }
+            //总产量
+            if (context.Request["m"].ToString() == "Output"){
+                string sqlStr = @"SELECT COUNT(DISTINCT BARCODE ) AS 产量
+                                                      FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND TRUNC(CREATETIME)=TRUNC(SYSDATE) AND VALUEFLAG=1  AND USERCODE='JS5'";
+                DataTable dt = conn.ExecuteDatatable(sqlStr);
+                context.Response.Write(new JsonResult(dt).ToJson());
+            }
+            //平均节拍
+            if (context.Request["m"].ToString() == "AvgBeat"){
+                string sqlStr = @"WITH time1 AS(
+                                                    SELECT
+                                                    *
+                                                    FROM(
+                                                    SELECT to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/5)*5,2,0) Times , COUNT(DISTINCT BARCODE ) AS 产量
+                                                               FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND TRUNC(CREATETIME)=TRUNC(SYSDATE) AND VALUEFLAG=1
+																															 AND USERCODE='JS5'
+                                                     group by  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/5)*5,2,0) 
+                                                     ORDER BY  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/5)*5,2,0) DESC
+                                                     )
+                                                     WHERE ROWNUM=1
+                                                     ),
+                                                     time2 AS(
+                                                     SELECT
+                                                    *
+                                                    FROM(
+                                                    SELECT to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/10)*10,2,0) Times , COUNT(DISTINCT BARCODE ) AS 产量
+                                                               FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND TRUNC(CREATETIME)=TRUNC(SYSDATE) AND VALUEFLAG=1 AND USERCODE='JS5'
+                                                     group by  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/10)*10,2,0) 
+                                                     ORDER BY  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/10)*10,2,0) DESC
+                                                     )
+                                                     WHERE ROWNUM=1
+                                                     )
+                                                     ,
+                                                     time3 AS(
+                                                     SELECT
+                                                    *
+                                                    FROM(
+                                                    SELECT to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/30)*30,2,0) Times , COUNT(DISTINCT BARCODE ) AS 产量
+                                                               FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND TRUNC(CREATETIME)=TRUNC(SYSDATE) AND VALUEFLAG=1 AND USERCODE='JS5'
+                                                     group by  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/30)*30,2,0) 
+                                                     ORDER BY  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/30)*30,2,0) DESC
+                                                     )
+                                                     WHERE ROWNUM=1
+                                                     ), 
+                                                     time4 AS(
+                                                     SELECT
+                                                    *
+                                                    FROM(
+                                                    SELECT to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/60)*60,2,0) Times , COUNT(DISTINCT BARCODE ) AS 产量
+                                                               FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND TRUNC(CREATETIME)=TRUNC(SYSDATE) AND VALUEFLAG=1 AND USERCODE='JS5'
+                                                     group by  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/60)*60,2,0) 
+                                                     ORDER BY  to_char(CREATETIME,'hh24')||':'||lpad(floor(to_char(CREATETIME,'mi')/60)*60,2,0) DESC
+                                                     )
+                                                     WHERE ROWNUM=1
+                                                     )
+                                                    SELECT
+                                                    DECODE( NVL( 300, 0 ), 0, 0, TO_CHAR( (300 / DECODE( NVL( time1.产量, 1 ), 0, 1, NVL( time1.产量, 1 ) ) ) , 'fm99990' ) ) one,
+                                                    DECODE( NVL( 600, 0 ), 0, 0, TO_CHAR( ( 600 / DECODE( NVL( time2.产量, 1 ), 0, 1, NVL( time2.产量, 1 ) ) ) , 'fm99990' )  ) two,
+                                                    DECODE( NVL( 1800, 0 ), 0, 0, TO_CHAR( ( 1800 / DECODE( NVL( time3.产量, 1 ), 0, 1, NVL( time3.产量, 1 ) ) ) , 'fm99990' ) ) three,
+                                                    DECODE( NVL( 3600, 0 ), 0, 0, TO_CHAR( ( 3600 / DECODE( NVL( time4.产量, 1 ), 0, 1, NVL( time4.产量, 1 ) ) ) , 'fm99990' ) ) four
+                                                    FROM time1
+                                                    LEFT JOIN time2 ON 1=1 
+                                                    LEFT JOIN time3 ON 1=1 
+                                                    LEFT JOIN time4 ON 1=1 ";
+                DataTable dt = conn.ExecuteDatatable(sqlStr);
+                context.Response.Write(new JsonResult(dt).ToJson());
+            }
+            //上午节拍
+            if (context.Request["m"].ToString() == "morning"){
+               List<CDAParameter> sqlPara = new List<CDAParameter>();
+                sqlPara.Add(new CDAParameter("DATEBEGIN", morningMintimes, DataType.DateTime));
+				sqlPara.Add(new CDAParameter("DATEEND", morningMaxtimes, DataType.DateTime));
+                string sqlStr = @"WITH 总产量 AS(
+                                                    SELECT COUNT(DISTINCT BARCODE ) AS 产量
+                                                           FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND VALUEFLAG=1 AND USERCODE='JS5' AND CREATETIME>=@DATEBEGIN@ AND CREATETIME<=@DATEEND@
+			                                                     ),
+                                                    秒数 AS		
+                                                    (
+                                                    SELECT
+                                                     ceil((MAX(CREATETIME) - MIN(CREATETIME)) * 24 * 60 * 60) times
+                                                    FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND VALUEFLAG=1 AND USERCODE='JS5' AND CREATETIME>=@DATEBEGIN@ AND CREATETIME<=@DATEEND@
+                                                    )
+	                                                     SELECT 
+	                                                      DECODE( NVL( 秒数.times, 0 ), 0, 0, TO_CHAR( (秒数.times / DECODE( NVL( 总产量.产量, 1 ), 0, 1, NVL( 总产量.产量, 1 ) ) ) , 'fm99990' ) ) one
+	                                                     FROM 总产量
+	                                                     LEFT JOIN 秒数 ON 1=1";
+                DataTable dt = conn.ExecuteDatatable(sqlStr,sqlPara.ToArray());
+                context.Response.Write(new JsonResult(dt).ToJson());
+            }
+
+            //下午节拍
+            if (context.Request["m"].ToString() == "after"){
+               List<CDAParameter> sqlPara = new List<CDAParameter>();
+                sqlPara.Add(new CDAParameter("DATEBEGIN", afterMintimes, DataType.DateTime));
+				sqlPara.Add(new CDAParameter("DATEEND", afterMaxtimes, DataType.DateTime));
+                string sqlStr = @"WITH 总产量 AS(
+                                                    SELECT COUNT(DISTINCT BARCODE ) AS 产量
+                                                           FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND VALUEFLAG=1 AND USERCODE='JS5' AND CREATETIME>=@DATEBEGIN@ AND CREATETIME<=@DATEEND@
+			                                                     ),
+                                                    秒数 AS		
+                                                    (
+                                                    SELECT
+                                                     ceil((MAX(CREATETIME) - MIN(CREATETIME)) * 24 * 60 * 60) times
+                                                    FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND VALUEFLAG=1 AND USERCODE='JS5' AND CREATETIME>=@DATEBEGIN@ AND CREATETIME<=@DATEEND@
+                                                    )
+	                                                     SELECT 
+	                                                      DECODE( NVL( 秒数.times, 0 ), 0, 0, TO_CHAR( (秒数.times / DECODE( NVL( 总产量.产量, 1 ), 0, 1, NVL( 总产量.产量, 1 ) ) ) , 'fm99990' ) ) one
+	                                                     FROM 总产量
+	                                                     LEFT JOIN 秒数 ON 1=1";
+                 DataTable dt = conn.ExecuteDatatable(sqlStr,sqlPara.ToArray());
+                 context.Response.Write(new JsonResult(dt).ToJson());
+            }
+
+          //当天节拍
+            if (context.Request["m"].ToString() == "ALL"){
+               List<CDAParameter> sqlPara = new List<CDAParameter>();
+                sqlPara.Add(new CDAParameter("DATEBEGIN", morningMintimes, DataType.DateTime));
+				sqlPara.Add(new CDAParameter("DATEEND", afterMaxtimes, DataType.DateTime));
+                string sqlStr = @"SELECT 
+	                                              DECODE( NVL( 27000, 0 ), 0, 0, TO_CHAR( (27000 / DECODE( NVL( 产量, 1 ), 0, 1, NVL( 产量, 1 ) ) ) , 'fm99990' ) ) one
+	                                             FROM (
+	                                             SELECT COUNT(DISTINCT BARCODE ) AS 产量
+                                                   FROM TP_PM_PRODUCTIONDATA WHERE PROCEDUREID=40 AND VALUEFLAG=1 AND USERCODE='JS5' 
+                                                        AND CREATETIME>=@DATEBEGIN@ AND CREATETIME<=@DATEEND@  )";
+                 DataTable dt = conn.ExecuteDatatable(sqlStr,sqlPara.ToArray());
+                 context.Response.Write(new JsonResult(dt).ToJson());
+            }
+
+
+        }
+    }
+
+    public bool IsReusable {
+        get {
+            return false;
+        }
+    }
+
+}

+ 173 - 0
wwwroot/main/Procedure/test14/GlazingBeats.html

@@ -0,0 +1,173 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <link rel="shortcut icon" href="/img/logo.png" />
+    <link rel="bookmark" href="/img/logo.png" />
+    <link rel="stylesheet" href="/plugins/bootstrap-4.3.1/css/bootstrap.min.css">
+    <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
+    <link href="/Plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
+    <link rel="stylesheet" href="../DashBoard.css?v3" />
+    <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
+    <script src="/Plugins/xrequest/xrequest.min.js"></script>
+    <title>东科软件</title>
+</head>
+<body class="bg-white p-0 dk-report">
+    <!--实时缺陷记录-->
+    <div class="container-fluid pt-1 p-0 box_1920_1080">
+        <div class="position-absolute">
+            <span id="成检分级质量" class="dk-report-loading" style="padding-left: 290px;font-size: 13px;color: #38dcff;font-weight: 700;float: left;padding-top: 40px;"></span>
+        </div>
+        <h4 class="text-center pb-2 dk-report-title" style="font-size: 80px; margin-top: -15px; font-weight: bolder; color: #f8f9fa;">施釉节拍</h4>
+        <table id="小件看板第一table" class="table-hover  table-striped" style="font-size: 14px; width: 1875px; height: 60px; margin-left: 21px; margin-top: -30px;">
+            <tr style="height: 70px; width: 1866px;">
+                <td scope="col" class="text-center" id="wd" style="width: 130px; font-size: 40px; color: #f8f9fa; text-align:left ">
+                    <div style="text-align:right;"><span id="sj" style=" font-size: 35px;">0000-00-00 00:00</span></div>
+                </td>
+            </tr>
+        </table>
+        <div style="width: 1875px; height: 95%">
+            <table id="一期打磨" class="table-hover  table-striped" style=" width: 100%; height: 5%; margin-left: 21px; margin-top: -17px;">
+                <thead style="border: 1px solid #38dcff ">
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td scope="col" class="text-center" id="wd" style="width: 350px; font-size: 70px; color: #f8f9fa; text-align: center ">产 量</td>
+                        <td scope="col" class="text-center" id="wd" style="width: 100px; font-size: 70px; color: #f8f9fa; text-align: center ">秒/个</td>
+                        <td scope="col" class="text-center" id="wd" style="width: 100px; font-size: 70px; color: #f8f9fa; text-align: center ">时间段</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td rowspan="3" scope="col" class="text-center" id="zcl" style="width: 350px; font-size: 90px; color: #f8f9fa; text-align: center "></td>
+                        <td scope="col" class="text-center" id="cl1" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl1" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">5分钟</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+
+                        <td scope="col" class="text-center" id="cl2" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl2" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">10分钟</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td scope="col" class="text-center" id="cl3" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl3" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">30分钟</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td scope="col" class="text-center" id="gh4" style="width: 130px; font-size: 55px; color: #f8f9fa; text-align: center ">平均节拍</td>
+                        <td scope="col" class="text-center" id="cl4" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl4" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">60分钟</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td  rowspan="2" scope="col" class="text-center" id="second" style="width: 350px; font-size: 90px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="cl5" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl5" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">上午</td>
+                    </tr>
+                    <tr style="height: 125px; width: 1866px; ">
+                        <td scope="col" class="text-center" id="cl6" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 85px; color: #f8f9fa; text-align: center ">00</td>
+                        <td scope="col" class="text-center" id="hgl6" style="padding: 0px 0px 0px 0px; width: 130px; font-size: 70px; color: #f8f9fa; text-align: right ">下午</td>
+                    </tr>
+                </thead>
+            </table>
+        </div>
+    </div>
+    <!--版权信息-->
+    <script src="/Plugins/bootstrap-4.3.1/js/bootstrap.bundle.min.js"></script>
+    <script src="/Plugins/bootstrap-table/bootstrap-table.min.js"></script>
+    <script src="/Plugins/bootstrap-table/bootstrap-table-locale-all.min.js"></script>
+    <script src="/Plugins/sweetalert/sweetalert.min.js"></script>
+    <script src="/Plugins/chartjs-2.8.0/chart-2.8.min.js"></script>
+    <script src="/Plugins/chartjs-2.8.0/utils.js"></script>
+    <script>
+	
+        $(document).ready(function () {
+            loadServerTime();
+            lodTable();
+			doGetData = setInterval(function () { loadServerTime(); }, 60000);
+        });
+		//取服务器时间
+		function loadServerTime() {
+            $.get('GlazingBeats.ashx?m=fwq', function (data) {
+					var json = JSON.parse(data);
+                if (json["success"] == true) {
+                    $('#sj').html(json["sj"]);
+                }
+              });
+        }
+        function lodTable() {
+            Output();
+            AvgBeat();
+            MorningBeat();
+            AfterBeat();
+            ThatDayBeat();
+        }
+        function Output() { //总产量
+            $.get('GlazingBeats.ashx?m=Output', function (data) {
+                var json = JSON.parse(data);
+                if (json['success'] == true) {
+                    $('#zcl').html(json["rows"][0]["产量"]);
+                    
+                }
+            });
+        }
+        function AvgBeat() { //分钟时间节拍
+            $.get('GlazingBeats.ashx?m=AvgBeat', function (data) {
+                var json = JSON.parse(data);
+                if (json['success'] == true) {
+                    $('#cl1').html(json["rows"][0]["ONE"]);
+                    $('#cl2').html(json["rows"][0]["TWO"]);
+                    $('#cl3').html( json["rows"][0]["THREE"]);
+                    $('#cl4').html(json["rows"][0]["FOUR"]);
+                    
+                }
+            });
+        }
+
+        function MorningBeat() { //上午节拍
+            $.get('GlazingBeats.ashx?m=morning', function (data) {
+                var json = JSON.parse(data);
+                if (json['success'] == true) {
+                    $('#cl5').html(json["rows"][0]["ONE"]);
+                }
+            });
+        }
+
+        function AfterBeat() { //下午节拍
+            $.get('GlazingBeats.ashx?m=after', function (data) {
+                var json = JSON.parse(data);
+                if (json['success'] == true) {
+                    $('#cl6').html(json["rows"][0]["ONE"]);
+                }
+            });
+        }
+
+        function ThatDayBeat() { //当天节拍
+            $.get('GlazingBeats.ashx?m=ALL', function (data) {
+                var json = JSON.parse(data);
+                if (json['success'] == true) {
+                    $('#second').html(json["rows"][0]["ONE"]);
+                }
+            });
+        }
+    
+    </script>
+
+    <style>
+        table {
+            height: 40px;
+            color: #f8f9fa !important;
+            font-size: 20px;
+            font-weight: 700;
+            background: rgba(25, 52, 90,.5);
+            border: 1px solid #38dcff;
+            margin-bottom: 1rem;
+        }
+        td {
+            padding: 2px !important;
+            text-align: center !important;
+            border-bottom: 1px solid #38dcff !important;
+            border-right: 1px dashed #38dcff !important;
+            border: white;
+        }
+        a {
+            background-color: lightblue;
+        }
+    </style>
+</body>
+</html>