jason.lu 6 年之前
父节点
当前提交
a841bd8406
共有 8 个文件被更改,包括 1782 次插入1275 次删除
  1. 33 27
      js/common.js
  2. 168 169
      js/dapingmu.js
  3. 1 1
      js/entrance.js
  4. 254 1048
      js/lazhang-data.js
  5. 253 0
      js/lazhang-display.js
  6. 472 0
      js/newData.js
  7. 549 0
      js/pending.js
  8. 52 30
      lazhang.html

+ 33 - 27
js/common.js

@@ -1,20 +1,20 @@
 getUserId();
 
-var RedRank = (function() {
-    this.fetchPos = 0;
-    this.loader = (function () {
-        this.load = function(pos) {
-            get_data(`fcBiWorkerDaily/get?type=${RedRank.fetchPos}`, RedRank.loader.onSuccess);
-        };
-        this.consecutiveLoad = function(){
-            RedRank.fetchPos = (RedRank.fetchPos + 1) % 8;
-            load(RedRank.fetchPos);
-        };
-        this.onSuccess = function(res, code){
-
-        };
-    })();
-})();
+function load_table_red_rank() {
+  //  get_data("fcBiWorkerDaily/get?type=1&limit=3", on_red_rank_success);
+}
+
+function load_table_red_rank1() {
+  //  get_data("fcBiWorkerDaily/get?type=2&limit=3", on_red_rank_success1);
+}
+
+function load_table_black_rank1() {
+  //  get_data("fcBiWorkerDaily/get?type=3&limit=3", on_black_rank_success1);
+}
+
+function load_table_black_rank() {
+ //   get_data("fcBiWorkerDaily/get?type=0&limit=3", on_black_rank_success);
+}
 
 var RANK_TBL_ROW_COUNT = 4;
 var goodColor = [];
@@ -289,17 +289,23 @@ function showHistoryData() {
 }
 
 function showRedRanking() {
-    var htmlbody = "", one_person = "";
-    var i = 0;
-    var triGap = RANK_TBL_ROW_COUNT;
-    htmlbody = "";
-    for (i = 0; i < triGap; i++) {
-
-        htmlbody = getRankingTableBody(htmlbody, i);
-    }
-    if (lastTimeRank1 !== htmlbody) {
-        $("#rank-two").html(htmlbody);
-        lastTimeRank1 = htmlbody;
-    }
     //console.log(htmlbody);
 }
+
+
+function showBlackRanking() {
+    return; // Not Showing Because we now try to scroll pages.
+    //
+    // var htmlbody = "", one_person = "";
+    // var i = 0;
+    // var triGap = RANK_TBL_ROW_COUNT;
+    // htmlbody = "";
+    // for (i = 0; i < triGap; i++) {
+    //     htmlbody = getBlackRanking(htmlbody, i);
+    // }
+    // if (lastTimeRank2 !== htmlbody) {
+    //     $("#rank-three").html(htmlbody);
+    //     lastTimeRank2 = htmlbody;
+    // }
+    //console.log(htmlbody);
+}

+ 168 - 169
js/dapingmu.js

@@ -1,193 +1,192 @@
-var BigScreen = (function () {
-    this.passNumber = [];
-    this.failNumber = [];
-    this.failrate = [];
-    this.stackeverynum = [];
-    this.failnum = 0;
-    this.num = 0;
-    this.hispass = [];
-    this.hisfail = [];
-    this.hisstack = [];
-    this.hisrate = [];
-    this.n = 0;
-    this.flowIds = [];
-    this.namedata = [];
-    this.lazhang = (function () {
-    })();
-    this.realTimeRequestTimer = 0;
-
-    this.page_document_load = function() {
-        get_data("fcWorkScheduleLoad/get", onFirstTimeSuccess)
+var passNumber = [];
+var failNumber = [];
+var failrate = [];
+var stackeverynum = [];
+var failnum = 0;
+var num = 0;
+var hispass = [];
+var hisfail = [];
+var hisstack = [];
+var hisrate = [];
+var n = 0;
+var flowIds = [];
+var namedata = [];
+var lazhang = {};
+
+
+function page_document_load() {
+    get_data("fcWorkScheduleLoad/get", first_success)
+}
+
+function first_success(obj, sta) {
+    let output = first_parse(this, obj);
+    let i, j, k, z;
+    failnum = 0;
+    let x = 0;
+    let worksum = [];
+    z = 0;
+
+    if(typeof output.length =="number"){
+        output.list = output;
     }
 
-    this.first_success = function(obj, sta) {
-        let output = first_parse(this, obj);
-        let i, j, k, z;
-        failnum = 0;
-        let x = 0;
-        let worksum = [];
-        z = 0;
-
-        if (typeof output.length == "number") {
-            output.list = output;
-        }
+    if (output.list == undefined || output.list.length == 0) {
+        send_alert("没有数据");
+    }
 
-        if (output.list == undefined || output.list.length == 0) {
-            send_alert("没有数据");
-        }
+    if (output.list.length > 0) {
+        flowIds[0] = output.list[0].scheduleId;
 
-        if (output.list.length > 0) {
-            flowIds[0] = output.list[0].scheduleId;
-
-            for (i = 1; i < output.list.length; i++) {
-                var thisUid = output.list[i].scheduleId;
-                x = 0;
-                for (j = 0; j < flowIds.length; j++) {
-                    if (flowIds[j] === thisUid) {
-                        x = 1;
-                        break;
-                    }
-                }
-                if (x === 0) {
-                    flowIds.push(thisUid);
+        for (i = 1; i < output.list.length; i++) {
+            var thisUid = output.list[i].scheduleId;
+            x = 0;
+            for (j = 0; j < flowIds.length; j++) {
+                if (flowIds[j] === thisUid) {
+                    x = 1;
+                    break;
                 }
             }
+            if (x === 0) {
+                flowIds.push(thisUid);
+            }
+        }
 
-            j = 0;
-            for (k = 0; k < flowIds.length; k++) {
-                var uid = flowIds[k];
-                z = 0;
-                passNumber[k] = 0;
-                failNumber[k] = 0;
-                stackeverynum[k] = 0;
-                for (i = 0; i < output.list.length; i++) {
-                    if (uid === output.list[i].scheduleId) {
-                        passNumber[k] = output.list[i].passNum + passNumber[j];
-                        failNumber[k] = output.list[i].failNum + failNumber[j];
-                        stackeverynum[k] = output.list[i].due + stackeverynum[j];
-                        z++;
-                    }
-                }
-                if (failNumber[k] + passNumber[k] == 0) {
-                    failrate[k] = 0;
-                } else {
-                    failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100;
+        j = 0;
+        for (k = 0; k < flowIds.length; k++) {
+            var uid = flowIds[k];
+            z = 0;
+            passNumber[k] = 0;
+            failNumber[k] = 0;
+            stackeverynum[k] = 0;
+            for (i = 0; i < output.list.length; i++) {
+                if (uid === output.list[i].scheduleId) {
+                    passNumber[k] = output.list[i].passNum + passNumber[j];
+                    failNumber[k] = output.list[i].failNum + failNumber[j];
+                    stackeverynum[k] = output.list[i].due + stackeverynum[j];
+                    z++;
                 }
             }
+            if (failNumber[k] + passNumber[k] == 0) {
+                failrate[k] = 0;
+            } else {
+                failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100;
+            }
         }
-        for (i = 1; i <= 3; i++) {
-            loadHistroyOnce(i);
-        }
-        showChart();
-        realTimeRequestTimer = setInterval(mainLoopFunc, 1000);
-
-    }
-
-    this.mainLoopFunc = function() {
-        get_data("fcWorkScheduleLoad/get", realtime_success);
-        //loadHistoryRealTime();
-        load_table_red_rank();
-        load_table_red_rank1();
-        load_table_black_rank();
-        load_table_black_rank1();
-    }
-
-    this.loadHistroyOnce = function(nnm) {
-        get_data("fcBiFactoryDaily/list?type=" + nnm, history_success);
-    }
-
-    this.loadHistoryRealTime = function() {
-        get_data("fcBiFactoryDaily/list?type=1", history_success);
     }
-
-
-    this.doStopSchedule = function() {
-        location.href = 'denglu.html';
+    for (i = 1; i <= 3; i++) {
+        load_flows_history_data(i);
     }
+    showChart();
+    lazhang.timer = setInterval(request_data_realtime, 1000);
+
+}
+
+function request_data_realtime() {
+    get_data("fcWorkScheduleLoad/get", realtime_success);
+    //load_flows_history_realtime_data();
+    load_table_red_rank();
+    load_table_red_rank1();
+    load_table_black_rank();
+    load_table_black_rank1();
+}
+
+function load_flows_history_data(nnm) {
+    get_data("fcBiFactoryDaily/list?type=" + nnm, history_success);
+}
+
+function load_flows_history_realtime_data() {
+    get_data("fcBiFactoryDaily/list?type=1" , history_success);
+}
+
+
+function get_stop_scheudle() {
+    location.href='denglu.html';
+}
+
+function realtime_success(obj, sta) {
+    var output = first_parse(this, obj);
+    //在这里排序 spo\
+    console.log(" output : ");
+    console.log(output);
+
+    var i, j, k, z;
+    failnum = 0;
+    var x = 0;
+    var worksum = [];
+    var hhp = 0, hhf = 0, hhs = 0;
+
+
+    if (output.list.length > 0) {
+        flowIds[0] = output.list[0].scheduleId;
+        passNumber[0] = 0;
+        failNumber[0] = 0;
+        stackeverynum[0] = 0;
+        z = 0;
+        for (i = 1; i < output.list.length; i++) {
+            var thisUid = output.list[i].scheduleId;
+            x = 0;
+            for (j = 0; j < flowIds.length; j++) {
+                if (flowIds[j] === thisUid) {
+                    x = 1;
+                    break;
+                }
+            }
+            if (x === 0) {
+                flowIds.push(thisUid);
+            }
 
-    this.realtime_success = function(obj, sta) {
-        var output = first_parse(this, obj);
-        //在这里排序 spo\
-        console.log(" output : ");
-        console.log(output);
-
-        var i, j, k, z;
-        failnum = 0;
-        var x = 0;
-        var worksum = [];
-        var hhp = 0, hhf = 0, hhs = 0;
-
-
-        if (output.list.length > 0) {
-            flowIds[0] = output.list[0].scheduleId;
-            passNumber[0] = 0;
-            failNumber[0] = 0;
-            stackeverynum[0] = 0;
+        }
+        j = 0;
+        for (k = 0; k < flowIds.length; k++) {
+            var uid = flowIds[k];
             z = 0;
-            for (i = 1; i < output.list.length; i++) {
-                var thisUid = output.list[i].scheduleId;
-                x = 0;
-                for (j = 0; j < flowIds.length; j++) {
-                    if (flowIds[j] === thisUid) {
-                        x = 1;
-                        break;
-                    }
+            passNumber[k] = 0;
+            failNumber[k] = 0;
+            stackeverynum[k] = 0;
+            for (i = 0; i < output.list.length; i++) {
+                if (uid === output.list[i].scheduleId) {
+                    passNumber[k] = output.list[i].passNum + passNumber[k];
+                    failNumber[k] = output.list[i].failNum + failNumber[k];
+                    stackeverynum[k] = output.list[i].due + stackeverynum[k];
+                    z++;
                 }
-                if (x === 0) {
-                    flowIds.push(thisUid);
-                }
-
             }
-            j = 0;
-            for (k = 0; k < flowIds.length; k++) {
-                var uid = flowIds[k];
-                z = 0;
-                passNumber[k] = 0;
-                failNumber[k] = 0;
-                stackeverynum[k] = 0;
-                for (i = 0; i < output.list.length; i++) {
-                    if (uid === output.list[i].scheduleId) {
-                        passNumber[k] = output.list[i].passNum + passNumber[k];
-                        failNumber[k] = output.list[i].failNum + failNumber[k];
-                        stackeverynum[k] = output.list[i].due + stackeverynum[k];
-                        z++;
-                    }
-                }
-                if (failNumber[k] + passNumber[k] == 0) {
-                    failrate[k] = 0;
-                } else {
-                    failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100
-                }
-                /*stackeverynum[k]=stackeverynum[k]/z;*/
-                ///
-
+            if (failNumber[k] + passNumber[k] == 0) {
+                failrate[k] = 0;
+            } else {
+                failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100
             }
-            output.list.forEach(function (val, fid, arr) {
-                hhp += val.passNum;
-                hhf += val.failNum;
-                hhs += val.due;
-            })
-        }
+            /*stackeverynum[k]=stackeverynum[k]/z;*/
+            ///
 
-        hispass[0] = hhp;
-        hisfail[0] = hhf;
-        if (output.list.length > 0) {
-            hisstack[0] = hhs / output.list.length;
-        } else {
-            hisstack[0] = 0;
         }
+        output.list.forEach(function (val, fid, arr) {
+            hhp += val.passNum;
+            hhf += val.failNum;
+            hhs += val.due;
+        })
+    }
 
-        schedulepass = hhp;
-        schedulefail = hhf;
-        if (output.list.length > 0) {
-            schedulestack = hhs / output.list.length;
-        } else {
-            schedulestack = 0;
-        }
-        update_all_history();
-        updateChart();
+    hispass[0] = hhp;
+    hisfail[0] = hhf;
+    if (output.list.length > 0) {
+        hisstack[0] = hhs / output.list.length;
+    } else {
+        hisstack[0] = 0;
+    }
 
+    schedulepass = hhp;
+    schedulefail = hhf;
+    if (output.list.length > 0) {
+        schedulestack = hhs / output.list.length;
+    } else {
+        schedulestack = 0;
     }
-})();
+    update_all_history();
+    updateChart();
+
+}
+
+
 
 

+ 1 - 1
js/entrance.js

@@ -18,7 +18,7 @@ function page_document_load() {
 }
 
 function firsttime_load_spots_data() {
-    group_get_data("denglu","fcFlow/list", onFirstTimeSuccess)
+    group_get_data("denglu","fcFlow/list", first_success)
 }
 
 function first_success(obj, sta) {

+ 254 - 1048
js/lazhang-data.js

@@ -1,1120 +1,326 @@
-getUserId();
-
-var RedRank = (function() {
-    this.fetchPos = 0;
-    this.loader = (function () {
-        this.load = function(pos) {
-            get_data(`fcBiWorkerDaily/get?type=${RedRank.fetchPos}`, RedRank.loader.onSuccess);
-        };
-        this.consecutiveLoad = function(){
-            RedRank.fetchPos = (RedRank.fetchPos + 1) % 8;
-            load(RedRank.fetchPos);
-        };
-        this.onSuccess = function(res, code){
-
-        };
-    })();
-})();
-
-var RANK_TBL_ROW_COUNT = 4;
-var goodColor = [];
-var badColor = [];
-var goodColor1 = [];
-var badColor1 = [];
-var userIDs = [];
-var schedulepass = 0, schedulefail = 0, schedulestack = 0;
-var todayotherpass = 0, todayotherfail = 0, todayotherstack = 0;
-var lastTimeHistory = "";
-var histoires = [];
-
-var hispass = [];
-var hisfail = [];
-var hisstack = [];
-var hisrate = [];
-var goodpass = [];
-var goodid = [];
-var goodfailrate = [];
-var goodpass1 = [];
-var goodid1 = [];
-var goodfailrate1 = [];
-var badpass = [];
-var badid = [];
-var badfailrate = [];
-var badpass1 = [];
-var badid1 = [];
-var badfailrate1 = [];
-
-function history_success(obj, sta) {
-    var histoire = first_parse(this, obj);
-    var i, j, t;
-    console.log(" histoire : ");
-    console.log(histoire);
-    if (this.url.indexOf("type=1") >= 0) {
-        t = 1;
-    } else if (this.url.indexOf("type=2") >= 0) {
-        t = 2;
-    } else if (this.url.indexOf("type=3") >= 0) {
-        t = 3;
-    } else {
-        t = 0;
-        return;
-    }
-    histoires[t] = histoire;
-    if (t === 2 || t === 3) {
-        hispass[t] = 0;
-        hisfail[t] = 0;
-        hisstack[t] = 0;
-        hisrate[t] = 0;
-        for (i = 0; i < histoire.length - 1; i++) { //除了今日
-            hispass[t] = histoire[i].passNum + hispass[t];
-            hisfail[t] = histoire[i].failNum + hisfail[t];
-            hisstack[t] = histoire[i].avgDue + hisstack[t];
-        }
-        orighispass[t] = hispass[t];
-        orighisfail[t] = hisfail[t];
-        orighisstack[t] = hisstack[t];
-        hispass[t] += hispass[0];
-        hisfail[t] += hisfail[0];
-        hisstack[t] += hisstack[0];
-        hisrate[t] = get_factor(hispass[t], hisfail[t]);
-    } else if (t === 1) {
-        hispass[1] = histoire[0].passNum;
-        hisfail[1] = histoire[0].failNum;
-        hisstack[1] = histoire[0].avgDue;
-        hisrate[t] = get_factor(hispass[1], hisfail[1]);
+var passNumber = [];
+var failNumber = [];
+var failrate = [];
+var stackeverynum = [];
+var failnum = 0;
+var num = 0;
+var n = 0;
+var sectorID = [];
+var namedata = [];
+var lazhang = {};
+var scheduleId = utils_get_param("scheduleId");
+var flowId = utils_get_param("flowId");
+var name1,name2;
+
+function first_success(obj, sta) {
+    let output = first_parse(this, obj);
+    let i, j, k, z;
+    failnum = 0;
+    let x = 0;
+    let worksum = [];
+    z = 0;
+
+    if (output.list == undefined || output.list.length == 0) {
+        send_alert("没有数据");
     }
 
-    todayotherpass = histoire[histoire.length - 1].passNum;
-    todayotherfail = histoire[histoire.length - 1].failNum;
-    todayotherstack = histoire[histoire.length - 1].avgDue;
+    output.list.forEach(function(val,it,arr){
+        var isExist = false;
+        userIDs.forEach(function(vals){
+            if(vals == val.userId){
+                isExist = true;
+            }
+        });
+        if(!isExist) userIDs.push(val.userId);
+    });
 
-    update_all_history();
-}
+    if (output.list.length > 0) {
+        sectorID[0] = getSectorId(output.list[0].spotId);
 
-function update_all_history() {
-    hispass[0] = todayotherpass + schedulepass;
-    hisfail[0] = todayotherfail + schedulefail;
-    hisstack[0] = todayotherstack + schedulestack;
-    hisrate[0] = get_factor(hispass[0], hisfail[0]);
+        for (i = 1; i < output.list.length; i++) {
+            var thisUid = getSectorId(output.list[i].spotId);
+            x = 0;
+            for (j = 0; j < sectorID.length; j++) {
+                if (sectorID[j] === thisUid) {
+                    x = 1;
+                    break;
+                }
+            }
+            if (x === 0) {
+                sectorID.push(thisUid);
+            }
 
-    if (typeof hisrate[0] == "undefined" || isNaN(hisrate[0])) {
-        send_alert("请重试!");
-    }
+        }
 
-    for (i = 2; i <= 3; i++) {
-        hispass[i] = orighispass[i] + hispass[0];
-        hisfail[i] = orighisfail[i] + hisfail[0];
-        hisstack[i] = orighisstack[i] + hisstack[0];
-        hisrate[i] = get_factor(hispass[i], hisfail[i]);
-    }
-}
+        j = 0;
+        for (k = 0; k < sectorID.length; k++) {
+            var uid = sectorID[k];
+            z = 0;
+            passNumber[k] = 0;
+            failNumber[k] = 0;
+            stackeverynum[k] = 0;
+            for (i = 0; i < output.list.length; i++) {
+                if (uid === getSectorId(output.list[i].spotId)) {
+                    passNumber[k] = output.list[i].passNum + passNumber[j];
+                    failNumber[k] = output.list[i].failNum + failNumber[j];
+                    stackeverynum[k] = output.list[i].due + stackeverynum[j];
+                    z++;
+                }
+            }
+            if (failNumber[k] + passNumber[k] == 0) {
+                failrate[k] = 0;
+            }
+            else {
+                failrate[k] = failNumber[k] / (failNumber[k] + passNumber[k]) * 100;
 
-var todayotherpass, todayotherfail, todayotherstack;
-var orighisfail = [], orighispass = [], orighisstack = [];
+            }
+            /*stackeverynum[k]=stackeverynum[k]/z;*/
 
-function isUserOfThisFlow(uid) {
-    var isExist = false;
-    userIDs.forEach(function (vals) {
-        if (vals == uid) {
-            isExist = true;
-        }
-    });
-    return isExist;
-}
+            ///
 
-function on_red_rank_success(obj, sta) {
-    var redchart = first_parse(this, obj);
-    var i, j;
-    i = j = 0;
-    console.log(" redchart : ");
-    console.log(redchart);
-    for (i = 0; i < redchart.list.length; i++) {
-        goodid[i] = getUserName(redchart.list[i].workerId);
-        goodpass[i] = redchart.list[i].passNum;
-        if (redchart.list[i].passNum + redchart.list[i].failNum > 0) {
-            goodfailrate[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
-        } else {
-            goodfailrate[i] = 0;
-        }
-        if (isUserOfThisFlow(redchart.list[i].workerId)) {
-            goodColor[i] = 'red';
-        } else {
-            goodColor[i] = '';
         }
     }
+    get_data("fcFlow/list?flowId="+ flowId,name_Success);
 
-}
 
-function on_red_rank_success1(obj, sta) {
-    var redchart = first_parse(this, obj);
-    var i, j;
-    i = j = 0;
-    console.log(" redchart : ");
-    console.log(redchart);
-    for (i = 0; i < redchart.list.length; i++) {
-        goodid1[i] = getUserName(redchart.list[i].workerId);
-        goodpass1[i] = redchart.list[i].passNum;
-        if (redchart.list[i].passNum + redchart.list[i].failNum > 0) {
-            goodfailrate1[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
-        } else {
-            goodfailrate1[i] = 0;
-        }
-        if (isUserOfThisFlow(redchart.list[i].workerId)) {
-            goodColor1[i] = 'red';
-        } else {
-            goodColor1[i] = '';
-        }
+    for (i = 1; i <= 3; i++) {
+        load_flows_history_data(i);
     }
+    showChart();
+    lazhang.timer = setInterval(request_data_realtime, 1000);
 
 }
+function name_Success(obj, sta) {
+    var factory = first_parse(this, obj);
+    var i, j, t;
+    console.log(" factory : ");
+    console.log(factory);
 
-function on_black_rank_success(obj, sta) {
-    var blackchart = first_parse(this, obj);
-    var i, j;
-    i = j = 0;
-    console.log(" black chart : ");
-    console.log(blackchart);
-    for (i = 0; i < blackchart.list.length; i++) {
-        badid[i] = getUserName(blackchart.list[i].workerId);
-        badpass[i] = blackchart.list[i].passNum;
-        //badfailrate[i] = blackchart.list[i].failRate / 100;
-        if (blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
-            badfailrate[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
-        } else {
-            badfailrate[i] = 0;
-        }
-        if (isUserOfThisFlow(blackchart.list[i].workerId)) {
-            badColor[i] = 'green';
-        } else {
-            badColor[i] = '';
-        }
-    }
-
+    name1=factory.list[0].flowPlace;
+    name2=factory.list[0].flowName;
+    document.getElementById("flow_title").innerHTML = name1+"-"+name2 + " 度彼科技";
+    document.title =  name1 + " " + name2 + " | 流水线管理 | 度彼科技";
 
 }
 
-function on_black_rank_success1(obj, sta) {
-    var blackchart = first_parse(this, obj);
-    var i, j;
-    i = j = 0;
-    console.log(" black chart : ");
-    console.log(blackchart);
-    for (i = 0; i < blackchart.list.length; i++) {
-        badid1[i] = getUserName(blackchart.list[i].workerId);
-        badpass1[i] = blackchart.list[i].passNum;
-        //badfailrate[i] = blackchart.list[i].failRate / 100;
-        if (blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
-            badfailrate1[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
-        } else {
-            badfailrate1[i] = 0;
-        }
-        if (isUserOfThisFlow(blackchart.list[i].workerId)) {
-            badColor1[i] = 'green';
-        } else {
-            badColor1[i] = '';
-        }
-    }
-
+function request_data_realtime() {
+    get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, realtime_success);
+    //load_flows_history_realtime_data();
+    load_table_red_rank();
+    load_table_red_rank1();
+    load_table_black_rank();
+    load_table_black_rank1();
 
 }
 
-function getHistoryTableBody(htmlbody, i) {
-    if (typeof hispass[i] === "undefined") {
-        htmlbody += "<tr>";
-        htmlbody += `<tr>
-                    <td> - </td>
-                    <td> - </td>
-                    <td> - </td>
-                    <td> - </td>
-                    <td> - </td>
-                </tr>`;
-        htmlbody += "</tr>";
-        return htmlbody;
-    }
-    htmlbody += "<tr>";
-    htmlbody += `<tr>
-                    <td>${timeday[i]}</td>
-                    <td>${hispass[i]}</td>
-                    <td>${hisfail[i]}</td>
-                    <td>${hisstack[i]}</td>
-                    <td>${hisrate[i] + '%'}</td>
-                </tr>`;
-    htmlbody += "</tr>";
-    return htmlbody;
+function load_flows_history_data(nnm) {
+    // 请注意type必须在结尾
+    get_data("fcBiFlowDaily/list?scheduleId="+scheduleId+ "&flowId=" + flowId+"&type=" + nnm , history_success);
 }
 
-function getRankingTableBody(htmlbody, i) {
-    if (typeof goodRank === "undefined" || typeof goodRank[i] === "undefined") {
-        htmlbody += "<tr>";
-        htmlbody += `<tr>
-                    <td> - </td>
-                    <td> 0 </td>
-                    <td> 0 </td>
-                    <td> 0 </td>
-                </tr>`;
-        htmlbody += "</tr>";
-        return htmlbody;
-    }
-    htmlbody += "<tr>";
-    htmlbody += `<tr ">
-                    <td style="background-color: ${goodRank[i].color}">${goodRank[i].id}</td>
-                    <td style="background-color: ${goodRank[i].color}">${goodRank[i].pass}</td>
-                    <td style="background-color: ${goodRank[i].color}">${goodRank[i].fail}</td>
-                    <td style="background-color: ${goodRank[i].color}">${goodRank[i].failRate + '%'}</td>
-                </tr>`;
-    htmlbody += "</tr>";
-    return htmlbody;
+function load_flows_history_realtime_data() {
+    // 请注意type必须在结尾
+    get_data("fcBiFlowDaily/list?flowId=" + flowId +"&type=1", history_success);
 }
+function get_stop_scheudle1() {
+    var out = confirm("真的要下班吗?");
+    if(out == true){
+        get_stop_scheudle();
 
-var lastTimeRank0 = "";
-var lastTimeRank1 = "";
-var lastTimeRank2 = "";
-var lastTimeRank3 = "";
-var lastTimeRank4 = "";
-
-function showHistoryData() {
-    var htmlbody = "", one_person = "";
-    var i = 0;
-    var triGap = 4;
-    htmlbody = "";
-    for (i = 0; i < triGap; i++) {
-
-        htmlbody = getHistoryTableBody(htmlbody, i);
     }
-    if (lastTimeRank0 !== htmlbody) {
-        $("#rank-one").html(htmlbody);
-        lastTimeRank0 = htmlbody;
-    }
-    //console.log(htmlbody);
-}
+    else{
 
-function showRedRanking() {
-    var htmlbody = "", one_person = "";
-    var i = 0;
-    var triGap = RANK_TBL_ROW_COUNT;
-    htmlbody = "";
-    for (i = 0; i < triGap; i++) {
-
-        htmlbody = getRankingTableBody(htmlbody, i);
-    }
-    if (lastTimeRank1 !== htmlbody) {
-        $("#rank-two").html(htmlbody);
-        lastTimeRank1 = htmlbody;
     }
-    //console.log(htmlbody);
 }
 
+function show_clear_panel(){
+    $("#clearModal").modal('show');
+}
 
-/***
- * DataObject DO
- * @param cname
- * @param serverJsonObj
- * @constructor
- */
-var DataObject = function(cname, serverJsonObj){
-    this.ctlName = cname;
-    this.jsonObj = serverJsonObj;
-    this.getVal = function (key) {
-        return jsonObj[key];
-    };
-    this.serVal = function (key, val) {
-        jsonObj[key] = val;
-    };
-};
-
-/***
- * DataObjectList
- * @param name
- * @constructor
- */
-var DataObjectList = function(name){
-    this.ctlName = name;
-    this.list = null;
-    this.isSorted = false;
-    this.preSort = [];
-    /***
-     * sorting
-     * @param comparator (a,b)  =====>  a - b
-     */
-    this.sortBy = function(comparator){
-        preSort = new Array();
-        for (let i = 0; i < list.length; i++) preSort.push(list[i]);
-        quickSort(preSort, 0, preSort.length - 1, function(l, r){});
-    };
-
-    function clearData() {
-      isSorted = false;
-      preSort = null;
-      list = null;
+var executed = false;
+var finished = true;
+var directCount = -1;
+
+function clear_one_data(){
+    executed = false;
+    directCount = -1;
+    finished = true;
+    var hand = $("#handInput").val();
+    var hd = 0;
+    if(hand.length > 0){
+       hd = parseInt(hand);
     }
+    get_data("endpoint/clearBoard?flowId="+flowId+"&handheldId=" + hd, clearSuccess);
+}
 
-    this.len = function() {
-        if(list == null) return 0;
-        return list.length;
-    };
-
-    this.assignJsonData = function (data) {
-        clearData();
-        list = new Array();
-        for (let i = 0; i < list.length; i++) list.push(new DataObject(ctlName, data[i]));
-    };
-    this.getRaw = function (index) {
-        return list[index];
-    };
-    this.getSorted = function (index) {
-        if(!isSorted) return null;
-        return preSort[index];
-    };
-    this.quickSort = function (a,left,right,comp){
-        if(left>right){ //一定要有这个判断,因为有递归left和i-1,若没有这个判断条件,该函数会进入无限死错位递归
-            return;
-        }
-
-        var i=left,
-            j=right,
-            pivot=a[left]; //基准总是取序列开头的元素
-
-        while(i!=j){
-            while((comp(a[j],pivot) > 0)&&i<j){j--}
-            while((comp(a[j],pivot) <= 0)&&i<j){i++}
-            if(i<j){  //如果i==j跳出外层while
-                var t=a[i];
-                a[i]=a[j];
-                a[j]=t;
-            }
-        }
-
-        a[left]=a[i];//交换基准数和k位置上的数
-        a[i]=pivot;
-
-        quicksort(a,left,i-1,comp);
-        quicksort(a,i+1,right,comp);
-    };
-};
+function clearSuccess(obj, sta){
+    console.warn("-------  手持设备清空  ----------");
+    console.warn(this);
+    send_alert("发送清空请求成功, 正在等待采集端进行处理...");
+    finished = false;
+    setTimeout(on_timeout_clear, 8000);
+    setTimeout(recurseget,300);
+    //var output = first_success(this, obj);
+}
 
-/***
- * DOService
- * @param controlName
- * @constructor
- */
-var DataObjectService = function(controlName, syncType, extparm){
-    this.ctlName    = controlName;
-    // 2=default 4=on-demand, 8=auto, 16:fast, 32=passive
-    this.syncType   = syncType;
-    this.extParm    = extparm;
-    this.isDefault  =  ((syncType & 2)  !== 0);
-    this.isOnDemand = ((syncType & 4)  !== 0);
-    this.isAuto =     ((syncType & 8)  !== 0);
-    this.isFast =     ((syncType & 16) !== 0);
-    this.isPassive =  ((syncType & 32) !== 0);
-    this.failedCount = 0;
-    this.list = new DataObjectList(controlName);
-    this.autoUpdateTimer = 0;
-    this.autoInterval = 1000;
+function recurseget(){
+    if(finished) return;
+    get_data("endpoint/heartbeat?flowId=" + flowId, onheart);
+    setTimeout(recurseget,100);
+}
 
-    function setUpInterval() {
-        //URL + exparm
-        if(this.autoUpdateTimer != 0) clearInterval(this.autoUpdateTimer);
-        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval);
+function onheart(obj,sta){
+    var ouy = {};
+    if(typeof(obj) === "string"){
+        ouy = JSON.parse(obj);
+    }else{
+        ouy = obj;
     }
 
-    this.init = function(){
-        if(isAuto){
-            // timer
-            if(!isFast){
-                this.autoInterval = 5000;
-            }
-            setUpInterval();
-            selfUpdate();
-        }
-    };
-    this.stopTimers = function () {
-        clearInterval(this.autoUpdateTimer);
-        this.autoUpdateTimer = 0;
-    };
-    this.selfUpdateTick = function(){
-        get_data(controlName+"/list"+extParm, this.onDataReceived);
-    };
-    this.onDemandUpdate = function(){
-        get_data(controlName+"/list"+extParm, this.onDataReceived);
-    };
-    this.onDataReceived = function(data, sta){
-        let output = first_parse(this, obj);
-        if (output.list == undefined || output.list.length == 0) {
-            this.failedCount++;
-            if(this.failedCount > 100){
-                this.failedCount = 0;
-                this.stopTimers();
-                console.log("【错误次数过多");
-                setTimeout(this.setUpInterval, 10000);
-            }
-            if(this.failedCount == 2) {
-                send_alert("没有数据,请尝试重新加载!【DataService】: ctlName[" + controlName + "],  extParm[" + extparm + "]");
-            }
-        }else{
-            this.list.assignJsonData(output.list);
-        }
-    };
-
-    this.passiveUpdate = function(data){
-        this.failedCount = 0;
-        this.list.assignJsonData(data);
-    };
-    this.init();
-};
-
-var SinglePage = function () {
-    this.modules = [];
-};
 
-var Module = function(chartContainerSelector, dataCtlName){
-    this.selector = chartContainerSelector;
-    this.dataCtl = dataCtlName;
-    this.activeData = null;
-    this.lastActive = 0;
-    /***
-     * bindData to UI
-     * @param data DataObjectList
-     */
-    this.setData = function (data) {
-        if(data.ctlName == this.dataCtl){
+    if(typeof(ouy) === "object"){
+        if(ouy.ret === "10000"){
             //ok
-            console.log(`-------- Module ${this.selector} got data ----------- `);
-            this.activeData = data;
-            //cache
-            this.drawData();
-        }else{
-            console.log(`-------- Module ${this.selector} cannot use data of ${data.ctlName} ----------- `);
-        }
-    };
-    this.drawData = function () {
-      // do nothing
-    }
-};
-
-var RealTimeGraph = new Module("", "fcBiSectorLoad");
-RealTimeGraph.drawData = function (data) {
-    var tempo = this.activeData;
-
-};
-
-var FlowRealTime = (function () {
-
-    this.pgName = "flowDashBoard";
-    this.page = new SinglePage(this.pgName);
-    this.scheduleId = utils_get_param("scheduleId");
-    this.flowId = utils_get_param("flowId");
-    if(scheduleId  == null || flowId == null)
-    {
-        send_alert(`清重新进入本页面!<a href='denglu.html'> 返回主页 </a>`);
-        return;
-    }
-    this.flowPlace = " % flowPlace %";
-    this.flowName = " % flowPlace %";
-    this.HistoryBaseURL = "fcBiFlowDaily/list?scheduleId=" + scheduleId + "&flowId=" + flowId;
-
-    this.scheduleLoadDataService = new DataObjectService("fcScheduleLoadService", 2 & 4);
-    this.biFlowDailyService = null;
-    this.oaStaffService = null;
-    this.sectorService = null;
-    this.flowService = null;
-
-    this.initializeUsers = function(list){
-        list.forEach(function (val, it, arr) {
-            var isExist = false;
-            userIDs.forEach(function (vals) {
-                if (vals == val.userId) {
-                    isExist = true;
-                }
-            });
-            if (!isExist) userIDs.push(val.userId);
-        });
-    };
-
-    this.initPage = function(){
-        showHistoryData();
-        showRedRanking();
-        showBlackRanking();
-    };
-
-    /***
-     * On
-     * @param obj
-     * @param sta
-     */
-    this.onFirstTimeSuccess = function (obj, sta) {
-        let output = first_parse(this, obj);
-        let i, j, k, z = 0, x = 0, worksum = [];
-        if (output.list == undefined || output.list.length == 0) {
-            send_alert("没有数据 | 请重新加载页面 ! ");
-        }else{
-            DataLogic.onScheduleData(output.list);
-        }
-        initializeUsers(output.list);
-        Action.loadMultiHistory();
-        showChart();
-    };
-
-
-    /**
-     * DataLogic
-     */
-    this.DataLogic = (function () {
-
-        this.combineAsSector = function(sectorList, scheduleDoList) {
-            var output = new DataObjectList("sectorLoad");
-            output.assignJsonData("");
-            return output;
-        };
-
-        this.onScheduleData = function (scheduleDoList) {
-            sectorID[0] = getSectorId(scheduleDoList[0].spotId);
-            for (let i = 1; i < scheduleDoList.length; i++) {
-                let loadDO = new ScheduleDO(scheduleDoList[i]);
-                x = 0;
-                for (j = 0; j < sectorID.length; j++) {
-                    if (sectorID[j] === thisUid) {
-                        x = 1;
-                        break;
-                    }
-                }
-                if (x === 0) {
-                    sectorID.push(thisUid);
-                }
-            }
-            DataLogic.CountBySector();
-        }
-        this.CountBySector = function (sectors, spotData) {
-            sectorId, passNumber, failNumber
-            let j = 0, k = 0, z = 0;
-            for (k = 0; k < sectors.length; k++) {
-                var uid = sectors[k].getUid();
-                z = 0;
-                passNumber[k] = 0;
-                failNumber[k] = 0;
-                stackeverynum[k] = 0;
-                for (i = 0; i < output.list.length; i++) {
-                    if (uid === getSectorId(output.list[i].spotId)) {
-                        passNumber[k] = output.list[i].passNum + passNumber[j];
-                        failNumber[k] = output.list[i].failNum + failNumber[j];
-                        stackeverynum[k] = output.list[i].due + stackeverynum[j];
-                        z++;
+            if(ouy.model == null || ouy.model === undefined){
+                executed = true;
+                finished = true;
+            }else if(typeof(obj.model) === "object"){
+                // 没有拿到,继续
+                if(obj.model.list != null && obj.model.list.length > 0){
+                    var direct = obj.model.list[0];
+                    if(direct.eventType+"" !== "500"){
+                        // OK
+                        executed = true;
+                        finished = true;
+                    }else if(direct.arg2+"" !== ""+$("#handInput").val()){
+                        // OK
+                        executed = true;
+                        finished = true;
+                    }else{
+                        directCount = direct.counter;
                     }
                 }
-                if (failNumber[k] + passNumber[k] == 0) {
-                    failrate[k] = 0;
-                }  else {
-                    failrate[k] = failNumber[k] / (failNumber[k] + passNumber[k]) * 100;
-                }
-                // z is the number of data in one sector
             }
         }
-    })();
-
-    this.NameLoader = (function(){
-        this.onNameRetrieved = function (obj, sta) {
-            var factory = first_parse(this, obj);
-            var i, j, t;
-            console.log(" factory : ");
-            console.log(factory);
-            flowPlace = factory.list[0].flowPlace;
-            flowName = factory.list[0].flowName;
-            $("#flow_title").html(flowPlace + "-" + flowName + " 度彼科技");
-            document.title = flowPlace + " " + flowName + " | 流水线管理 | 度彼科技";
-        };
-        this.load = function(){
-            get_data("fcFlow/list?flowId=" + flowId, onNameRetrieved);
-        };
-    })();
-
-
-    this.mainLoopFunc = function () {
-        get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, realtime_success);
-        HistoryData.update();
-    };
+    }
+}
 
-    this.Action = (function () {
-        this.clearDataOfDeviceId = function (handId) {
-            executed = false;
+function on_timeout_clear(){
+    finished = true;
+    if(executed){
+        // 执行成功
+    }else{
+        if(directCount >= 0){
+            get_data("endpoint/ack?counter="+directCount,function(){console.log("撤销操作成功");console.log(this);});
             directCount = -1;
-            finished = true;
-            var hand = handId;
-            var hd = 0;
-            if (hand.length > 0) {
-                hd = parseInt(hand);
-            }
-            get_data("endpoint/clearBoard?flowId=" + flowId + "&handheldId=" + hd, clearSuccess);
-        };
-        this.doStopSchedule = function () {
-            get_data("fcWorkSchedule/stopSchedule?userId=" + userId + "&scheduleId=" + scheduleId, UI.showStopSuccess);
-        };
-        this.confirmStopSchedule = function () {
-            var out = confirm("真的要下班吗?");
-            if (out == true) {
-                doStopSchedule();
-            } else {
-            }
-        };
-
-    })();
-
-    this.UI = (function () {
-        this.showClearPanel = function () {
-            $("#clearModal").modal('show');
-        };
-        this.showStopSuccess = function (obj, sta) {
-            send_alert("下班操作成功! <a href='denglu.html'> 点击这里返回控制主页 </a>");
-        };
-    })();
-
-    this.HistoryData = (function (){
-
-        this.update = function () {
-            // 请注意type必须在结尾
-            get_data("fcBiFlowDaily/list?flowId=" + flowId + "&type=1", history_success);
-        };
-
-        this.loadHistroyOnce = function (nnm) {
-            // 请注意type必须在结尾
-            get_data(HistoryBaseURL + "&type=" + nnm, history_success);
-        };
-
-        this.loadMultiHistory = function(){
-            for (i = 1; i <= 3; i++) loadHistroyOnce(i);
-        };
-
-        this.add_success = function(obj, sta) {
-            var history1 = first_parse(this, obj);
-            var i, j;
-            console.log(" history1 : ");
-            console.log(history1);
-            hispass[t] = 0;
-            hisfail[t] = 0;
-            hisstack[t] = 0;
-            hisrate[t] = 0;
-            var lengthnum = history1.length - 1;
-            for (i = lengthnum; i < history1.length; i++) {
-                hispass[t] = history1[i].passNum + hispass[t];
-                hisfail[t] = history1[i].failNum + hisfail[t];
-                hisstack[t] = history1[i].avgDue + hisstack[t];
-            }
-            if (hispass[t] + hisfail[t] == 0) {
-                hisrate[t] = 0;
-            }
-            t++;
-        }
-    })();
-
-    function realtime_success(obj, sta) {
-        var output = first_parse(this, obj);
-        //在这里排序 spo\
-        console.log(" output : ");
-        console.log(output);
-
-        var i, j, k, z;
-        failnum = 0;
-        var x = 0;
-        var worksum = [];
-        var hhp = 0, hhf = 0, hhs = 0;
-
-
-        if (output.list.length > 0) {
-            sectorID[0] = getSectorId(output.list[0].spotId);
-            passNumber[0] = 0;
-            failNumber[0] = 0;
-            stackeverynum[0] = 0;
-            z = 0;
-            for (i = 1; i < output.list.length; i++) {
-                var thisUid = getSectorId(output.list[i].spotId);
-                x = 0;
-                for (j = 0; j < sectorID.length; j++) {
-                    if (sectorID[j] === thisUid) {
-                        x = 1;
-                        break;
-                    }
-                }
-                if (x === 0) {
-                    sectorID.push(thisUid);
-                }
-
-            }
-            j = 0;
-            for (k = 0; k < sectorID.length; k++) {
-                var uid = sectorID[k];
-                z = 0;
-                passNumber[k] = 0;
-                failNumber[k] = 0;
-                stackeverynum[k] = 0;
-                for (i = 0; i < output.list.length; i++) {
-                    if (uid === getSectorId(output.list[i].spotId)) {
-                        passNumber[k] = output.list[i].passNum + passNumber[k];
-                        failNumber[k] = output.list[i].failNum + failNumber[k];
-                        stackeverynum[k] = output.list[i].due + stackeverynum[k];
-                        z++;
-                    }
-                }
-                failrate[k] = get_factor(passNumber[k], failNumber[k]);
-            }
-            output.list.forEach(function (val, fid, arr) {
-                hhp += val.passNum;
-                hhf += val.failNum;
-                hhs += val.due;
-            })
-        }
-
-        schedulepass = hhp;
-        schedulefail = hhf;
-        if (output.list.length > 0) {
-            schedulestack = hhs / output.list.length;
-        } else {
-            schedulestack = 0;
+            send_alert("请求已经超时!请注意,采集端可能没有执行成功。即将撤销您的请求。");
+        }else{
+            send_alert("请求已经超时!请注意,采集端可能没有执行成功。");
         }
-        update_all_history();
-        updateChart();
-
-    };
-
-})();
-
-var ClearDataControl = (function () {
-    this.finished = true;
-    this.executed = false;
-    this.directCount = -1;
-
-    this.Action = (function () {
-
-    })();
-
-    this.clearSuccess = function (obj, sta) {
-        console.warn("-------  手持设备清空  ----------");
-        console.warn(this);
-        send_alert("发送清空请求成功, 正在等待采集端进行处理...");
-        ClearDataControl.finished = false;
-        setTimeout(resultVerifyTimeout, 8000);
-        setTimeout(getVerify, 300);
     }
+}
 
-    this.getVerify = function () {
-        if (ClearDataControl.finished) return;
-        get_data("endpoint/heartbeat?flowId=" + flowId, onVerifyResult);
-        setTimeout(getVerify, 100);
-    };
-
-    this.onVerifyResult = function (obj, sta) {
-        var parsed = {};
-        if (typeof(obj) === "string") {
-            parsed = JSON.parse(obj);
-        } else {
-            parsed = obj;
-        }
-
-        if (typeof(parsed) === "object") {
-            if (parsed.ret === "10000") {
-                //ok
-                if (parsed.model == null || parsed.model === undefined) {
-                    executed = true;
-                    finished = true;
-                } else if (typeof(obj.model) === "object") {
-                    // 没有拿到,继续
-                    if (obj.model.list != null && obj.model.list.length > 0) {
-                        var direct = obj.model.list[0];
-                        if (direct.eventType + "" !== "500") {
-                            // OK
-                            executed = true;
-                            finished = true;
-                        } else if (direct.arg2 + "" !== "" + $("#handInput").val()) {
-                            // OK
-                            executed = true;
-                            finished = true;
-                        } else {
-                            directCount = direct.counter;
-                        }
-                    }
-                }
-            }
-        }
-    }
 
-    this.resultVerifyTimeout = function () {
-        finished = true;
-        if (executed) {
-            // 执行成功
-        } else {
-            if (directCount >= 0) {
-                get_data("endpoint/ack?counter=" + directCount, function () {
-                    console.log("撤销操作成功");
-                    console.log(this);
-                });
-                directCount = -1;
-                send_alert("请求已经超时!请注意,采集端可能没有执行成功。即将撤销您的请求。");
-            } else {
-                send_alert("请求已经超时!请注意,采集端可能没有执行成功。");
-            }
-        }
-    }
-})();
+function get_stop_scheudle() {
+    get_data("fcWorkSchedule/stopSchedule?userId="+userId+"&scheduleId=" + scheduleId, stopSuccess);
 
-$(document).ready(function(){
-});
+}
 
+function stopSuccess(obj, sta) {
+    send_alert("下班操作成功! <a href='denglu.html'> 点击这里返回控制主页 </a>");
+}
 
-var RealTimeCharts = (function() {
 
-    var timeday = ["今日", "昨日", "本周", "本月"];
+function add_success(obj, sta) {
+    var history1 = first_parse(this, obj);
+    var i, j;
+    console.log(" history1 : ");
+    console.log(history1);
+    hispass[t] = 0;
+    hisfail[t] = 0;
+    hisstack[t] = 0;
+    hisrate[t] = 0;
+    var lengthnum = history1.length - 1;
+    for (i = lengthnum; i < history1.length; i++) {
+        hispass[t] = history1[i].passNum + hispass[t];
+        hisfail[t] = history1[i].failNum + hisfail[t];
+        hisstack[t] = history1[i].avgDue + hisstack[t];
 
-    if (flowId == null || scheduleId == null) {
-        send_alert("出错啦!请检查参数完整性");
     }
 
-    function page_document_load() {
-        get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, onFirstTimeSuccess);
-
+    if (hispass[t] + hisfail[t] == 0) {
+        hisrate[t] = 0;
     }
+    t++;
 
-    var compAxis = {
-        categories: namedata,
-        crosshair: true,
-        title: {
-            text: '工位',
-            style: {
-                fontSize: '1.5em'
-            }
-        },
-        labels: {
-            style: {
-                fontSize: '1.5em'
-            }
-        }
-    };
+}
 
-    var getSeperateArrays = function (sectorLoadData){
-        this.data = [];
-        this.len = sectorLoadData.len();
-        this.stackmax = 0;
-        this.failmax = 0;
-        this.passmax = 0;
-        this.failratemax = 0;
-        this.ratedata = [];
-        this.passdata = [];
-        this.faildata = [];
-        for (i = 0; i < len; i++) {
-            var one = sectorLoadData.getRaw(i);
-            if (stackmax < one[i].getVal("stack")) {
-                stackmax = one[i].getVal("stack")
-            }
-            if (failmax < one[i].getVal("failNum")) {
-                failmax = one[i].getVal("failNum");
-            }
-            if (failratemax < one[i].getVal("failRate")) {
-                failratemax = one[i].getVal("failRate");
+function realtime_success(obj, sta) {
+    var output = first_parse(this, obj);
+    //在这里排序 spo\
+    console.log(" output : ");
+    console.log(output);
+
+    var i, j, k, z;
+    failnum = 0;
+    var x = 0;
+    var worksum = [];
+    var hhp = 0, hhf = 0, hhs = 0;
+
+
+    if (output.list.length > 0) {
+        sectorID[0] = getSectorId(output.list[0].spotId);
+        passNumber[0] = 0;
+        failNumber[0] = 0;
+        stackeverynum[0] = 0;
+        z = 0;
+        for (i = 1; i < output.list.length; i++) {
+            var thisUid = getSectorId(output.list[i].spotId);
+            x = 0;
+            for (j = 0; j < sectorID.length; j++) {
+                if (sectorID[j] === thisUid) {
+                    x = 1;
+                    break;
+                }
             }
-            if (passmax < one[i].getVal("passNum")) {
-                passmax = one[i].getVal("passNum");
+            if (x === 0) {
+                sectorID.push(thisUid);
             }
 
-            data.push(one[i].getVal("stack"));
-            this.ratedata.push(Math.floor(one[i].getVal("failRate")));
-            this.passdata.push(one[i].getVal("passNum"));
-            this.faildata.push(one[i].getVal("failNum"));
         }
-    };
-
-    this.dataArrays = null;
-
-    function showChart(sectorLoadData) {
-        dataArrays = new getSeperateArrays(sectorLoadData);
-
-        failratemax = Math.max(failratemax, 5);
-        stackmax = Math.max(stackmax, 5);
-        failmax = Math.max(failmax, 5);
-        passmax = Math.max(passmax, failmax, stackmax);
-
-        stackAndFailChart = Highcharts.chart('graph-1', {
-            chart: {
-                zoomType: 'xy',
-                //height: (4 / 16 * 100) + '%' // 16:9 ratio
-            },
-            title: {text: '各工位今日产能'},
-            credits: {enabled: false},
-            exporting: {enabled: false},
-            xAxis: [compAxis],
-            yAxis: [{
-                labels: {
-                    format: '{value}',
-                    style: {
-                        color: "#ffffff",
-                        fontSize: '1.5em'
-                    }
-                },
-                min: 0,
-                max: passmax * 1.5,
-                title: {
-                    text: '数量',
-                    style: {
-                        color: '#ffffff',
-                        fontSize: '1em'
-                    },
-                    rotation: 270,
-                }
-            },],
-            tooltip: {shared: true},
-            legend: {
-                layout: 'vertical',
-                align: 'right',
-                x: 0,
-                verticalAlign: 'top',
-                y: 0,
-                floating: true,
-                backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
-            },
-            series: [{
-                name: '良品数',
-                type: 'column',
-                data: passdata,
-
-            }, {
-                name: '不良品数',
-                type: 'column',
-                data: faildata,
-
-            },
-                {
-                    name: '堆积数',
-                    type: 'column',
-                    data: data,
-                }]
-        });
-
-        FailChart = Highcharts.chart('graph-2', {
-            chart: {
-                //height: (4 / 16 * 100) + '%' // 16:9 ratio
-            },
-            title: {
-                text: '各工位今日不良率'
-            },
-            credits: {
-                enabled: false // 禁用版权信息
-            },
-            exporting: {
-                enabled: false
-            },
-            xAxis: [compAxis],
-            yAxis: [{ // Secondary yAxis
-                title: {
-                    text: '不良率',
-                    style: {
-                        color: '#ffffff',
-                        fontSize: '1em'
-                    }
-                },
-                min: 0,
-                max: 1.5 * failratemax,
-                labels: {
-                    formatter: function () {
-                        return Math.floor(this.value) + "%";
-                    },
-                    style: {
-                        color: '#ffffff',
-                        fontSize: '20px'
-                    },
-                    rotation: 270,
-                },
-
-            }],
-            tooltip: {
-                shared: true
-            },
-            legend: {
-                layout: 'vertical',
-                align: 'right',
-                x: 0,
-                verticalAlign: 'top',
-                y: 0,
-                floating: true,
-                backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
-            },
-            series: [{
-                name: '不良率',
-                type: 'spline',
-                data: ratedata,
-                color: 'red',
-                tooltip: {
-                    valueSuffix: '%'
+        j = 0;
+        for (k = 0; k < sectorID.length; k++) {
+            var uid = sectorID[k];
+            z = 0;
+            passNumber[k] = 0;
+            failNumber[k] = 0;
+            stackeverynum[k] = 0;
+            for (i = 0; i < output.list.length; i++) {
+                if (uid === getSectorId(output.list[i].spotId)) {
+                    passNumber[k] = output.list[i].passNum + passNumber[k];
+                    failNumber[k] = output.list[i].failNum + failNumber[k];
+                    stackeverynum[k] = output.list[i].due + stackeverynum[k];
+                    z++;
                 }
-            }]
-        });
-
-    }
-
-    function updateChart() {
-        var data = [];
-        var ratedata = [];
-        var stackmax = 0;
-        var failmax = 0;
-        var passdata = [];
-        var faildata = [];
-        var passmax = 0;
-        var failratemax = 0;
-
-        for (i = 0; i < passNumber.length; i++) {
-            if (stackmax < stackeverynum[i]) {
-                stackmax = stackeverynum[i];
-            }
-            if (failmax < failNumber[i]) {
-                failmax = failNumber[i];
-            }
-            if (failratemax < failrate[i]) {
-                failratemax = failrate[i];
             }
-            if (passmax < passNumber[i]) {
-                passmax = passNumber[i];
-            }
-            data.push(stackeverynum[i]);
-            ratedata.push(Math.floor(failrate[i]));
-            passdata.push(passNumber[i]);
-            faildata.push(failNumber[i])
-        }
-        failratemax = Math.max(failratemax, 5);
-        stackmax = Math.max(stackmax, 5);
-        failmax = Math.max(failmax, 5);
-        passmax = Math.max(passmax, failmax, stackmax);
-
-
-        // https://api.hcharts.cn/highcharts#Series.addPoint;
-
-        stackAndFailChart.series[0].setData(passdata);
-        stackAndFailChart.series[1].setData(faildata);
-        stackAndFailChart.series[2].setData(data);
-        FailChart.series[0].setData(ratedata);
-
-        if (failratemax > FailChart.yAxis[0].getExtremes().max * 1.3 || failratemax < FailChart.yAxis[0].getExtremes().max * 0.5) {
-            FailChart.yAxis[0].setExtremes(0, failratemax * 1.5);
-        }
-        if (passmax > stackAndFailChart.yAxis[0].getExtremes().max * 1.3 || passmax < stackAndFailChart.yAxis[0].getExtremes().max * 0.5) {
-            stackAndFailChart.yAxis[0].setExtremes(0, passmax * 1.5);
-        }
-
-        showHistoryData();
-        showRedRanking();
-        showBlackRanking();
-
-
-        var secNames = [];
-
-        sectorID.forEach(function (val) {
-            secNames.push(getSectorName(val));
-        });
-
-        if (JSON.stringify(secNames) !== lastTimeSecNames) {
-            lastTimeSecNames = JSON.stringify(secNames);
-            FailChart.xAxis[0].setCategories(secNames);
-            stackAndFailChart.xAxis[0].setCategories(secNames);
+            failrate[k] = get_factor(passNumber[k], failNumber[k]);
         }
+        output.list.forEach(function (val, fid, arr) {
+            hhp += val.passNum;
+            hhf += val.failNum;
+            hhs += val.due;
+        })
     }
 
-    var lastTimeSecNames = "";
+    schedulepass = hhp;
+    schedulefail = hhf;
+    if (output.list.length > 0) {
+        schedulestack = hhs / output.list.length;
+    } else {
+        schedulestack = 0;
+    }
+    update_all_history();
+    updateChart();
 
-    var stackAndFailChart = null;
-    var FailChart = null;
+}
 
-})();

+ 253 - 0
js/lazhang-display.js

@@ -0,0 +1,253 @@
+var timeday = ["今日", "昨日", "本周", "本月"];
+
+if (flowId == null || scheduleId == null) {
+    send_alert("出错啦!请检查参数完整性");
+}
+
+function page_document_load() {
+    get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, first_success);
+
+}
+
+var compAxis = {
+    categories: namedata,
+    crosshair: true,
+    title: {
+        text: '工位',
+        style: {
+            fontSize: '1.5em'
+        }
+    },
+    labels: {
+        style: {
+            fontSize: '1.5em'
+        }
+    }
+};
+
+function showChart() {
+
+    var data = [];
+    var ratedata = [];
+    var stackmax = 0;
+    var failmax = 0;
+    var passdata = [];
+    var faildata = [];
+    var passmax = 0;
+    var failratemax=0;
+
+    for (i = 0; i < passNumber.length; i++) {
+        if (stackmax < stackeverynum[i]) {
+            stackmax = stackeverynum[i];
+        }
+        if (failmax < failNumber[i]) {
+            failmax = failNumber[i];
+        }
+        if (failratemax< failrate[i]) {
+            failratemax = failrate[i];
+        }
+        if (passmax < passNumber[i]) {
+            passmax = passNumber[i];
+        }
+
+        data.push(stackeverynum[i]);
+        ratedata.push(Math.floor(failrate[i]));
+        passdata.push(passNumber[i]);
+        faildata.push(failNumber[i])
+    }
+
+    showHistoryData();
+    showRedRanking();
+    showBlackRanking();
+
+
+    failratemax = Math.max(failratemax, 5);
+    stackmax = Math.max(stackmax, 5);
+    failmax = Math.max(failmax, 5);
+    passmax =  Math.max(passmax,failmax,stackmax);
+
+    stackAndFailChart = Highcharts.chart('graph-1', {
+        chart: {
+            zoomType: 'xy',
+            //height: (4 / 16 * 100) + '%' // 16:9 ratio
+        },
+        title: {text: '各工位今日产能'},
+        credits: {enabled: false},
+        exporting: {enabled: false},
+        xAxis: [compAxis],
+        yAxis: [{
+            labels: {
+                format: '{value}',
+                style: {
+                    color: "#ffffff",
+                    fontSize: '1.5em'
+                }
+            },
+            min: 0,
+            max: passmax * 1.5,
+            title: {
+                text: '数量',
+                style: {
+                    color: '#ffffff',
+                    fontSize: '1em'
+                },
+                rotation: 270,
+            }
+        },],
+        tooltip: {shared: true},
+        legend: {
+            layout: 'vertical',
+            align: 'right',
+            x: 0,
+            verticalAlign: 'top',
+            y: 0,
+            floating: true,
+            backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
+        },
+        series: [{
+            name: '良品数',
+            type: 'column',
+            data: passdata,
+
+        }, {
+            name: '不良品数',
+            type: 'column',
+            data: faildata,
+
+        },
+            {
+                name: '堆积数',
+                type: 'column',
+                data: data,
+            }]
+    });
+
+    FailChart = Highcharts.chart('graph-2', {
+        chart: {
+            //height: (4 / 16 * 100) + '%' // 16:9 ratio
+        },
+        title: {
+            text: '各工位今日不良率'
+        },
+        credits: {
+            enabled: false // 禁用版权信息
+        },
+        exporting: {
+            enabled: false
+        },
+        xAxis: [compAxis],
+        yAxis: [{ // Secondary yAxis
+            title: {
+                text: '不良率',
+                style: {
+                    color: '#ffffff',
+                    fontSize: '1em'
+                }
+            },
+            min: 0,
+            max: 1.5 * failratemax,
+            labels: {
+                formatter: function () {
+                    return Math.floor(this.value) + "%";
+                },
+                style: {
+                    color: '#ffffff',
+                    fontSize: '20px'
+                },
+                rotation: 270,
+            },
+
+        }],
+        tooltip: {
+            shared: true
+        },
+        legend: {
+            layout: 'vertical',
+            align: 'right',
+            x: 0,
+            verticalAlign: 'top',
+            y: 0,
+            floating: true,
+            backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
+        },
+        series: [{
+            name: '不良率',
+            type: 'spline',
+            data: ratedata,
+            color: 'red',
+            tooltip: {
+                valueSuffix: '%'
+            }
+        }]
+    });
+
+}
+
+function updateChart() {
+    var data = [];
+    var ratedata = [];
+    var stackmax = 0;
+    var failmax = 0;
+    var passdata = [];
+    var faildata = [];
+    var passmax = 0;
+    var failratemax=0;
+
+    for (i = 0; i < passNumber.length; i++) {
+        if (stackmax < stackeverynum[i]) {
+            stackmax = stackeverynum[i];
+        }
+        if (failmax < failNumber[i]) {
+            failmax = failNumber[i];
+        }
+        if (failratemax < failrate[i]) {
+            failratemax= failrate[i];
+        }
+        if (passmax < passNumber[i]) {
+            passmax = passNumber[i];
+        }
+        data.push(stackeverynum[i]);
+        ratedata.push(Math.floor(failrate[i]));
+        passdata.push(passNumber[i]);
+        faildata.push(failNumber[i])
+    }
+    failratemax = Math.max(failratemax, 5);
+    stackmax = Math.max(stackmax, 5);
+    failmax = Math.max(failmax, 5);
+    passmax =  Math.max(passmax,failmax,stackmax);
+
+
+    // https://api.hcharts.cn/highcharts#Series.addPoint;
+
+    stackAndFailChart.series[0].setData(passdata);
+    stackAndFailChart.series[1].setData(faildata);
+    stackAndFailChart.series[2].setData(data);
+    FailChart.series[0].setData(ratedata);
+
+    if (failratemax > FailChart.yAxis[0].getExtremes().max * 1.3 || failratemax < FailChart.yAxis[0].getExtremes().max * 0.5) {
+        FailChart.yAxis[0].setExtremes(0, failratemax * 1.5);
+    }
+    if (passmax > stackAndFailChart.yAxis[0].getExtremes().max * 1.3 || passmax < stackAndFailChart.yAxis[0].getExtremes().max * 0.5) {
+        stackAndFailChart.yAxis[0].setExtremes(0, passmax * 1.5);
+    }
+
+    showHistoryData();
+    showRedRanking();
+    showBlackRanking();
+
+
+    var secNames = [];
+
+    sectorID.forEach(function(val){  secNames.push(getSectorName(val)); });
+
+    if(JSON.stringify(secNames) !== lastTimeSecNames){
+        lastTimeSecNames = JSON.stringify(secNames);
+        FailChart.xAxis[0].setCategories(secNames);
+        stackAndFailChart.xAxis[0].setCategories(secNames);
+    }
+}
+
+var lastTimeSecNames = "";
+
+var stackAndFailChart = null;
+var FailChart = null;

+ 472 - 0
js/newData.js

@@ -0,0 +1,472 @@
+getUserId();
+
+const DEFAULT = 2;
+const ONDEMAND = 4;
+const AUTO = 8;
+const FAST = 16;
+const PASSIVE = 32;
+
+var RANK_TBL_ROW_COUNT = 4;
+
+var lastTimeRank0 = "";
+var lastTimeRank1 = "";
+var lastTimeRank2 = "";
+var lastTimeRank3 = "";
+var lastTimeRank4 = "";
+
+
+/***
+ * DataObject DO
+ * @param cname
+ * @param serverJsonObj
+ * @constructor
+ */
+var DataObject = function(cname, serverJsonObj){
+    this.ctlName = cname;
+    this.jsonObj = serverJsonObj;
+    this.getVal = function (key) {
+        return jsonObj[key];
+    };
+    this.serVal = function (key, val) {
+        jsonObj[key] = val;
+    };
+
+};
+
+/***
+ * DataObjectList
+ * @param name
+ * @constructor
+ */
+var DataObjectList = function(name){
+    this.ctlName = name;
+    this.list = null;
+    this.isSorted = false;
+    this.preSort = [];
+    /***
+     * sorting
+     * @param comparator (a,b)  =====>  a - b
+     */
+    this.sortBy = function(comparator){
+        preSort = new Array();
+        for (let i = 0; i < list.length; i++) preSort.push(list[i]);
+        quickSort(preSort, 0, preSort.length - 1, function(l, r){});
+    };
+
+    function clearData() {
+        isSorted = false;
+        preSort = null;
+        list = null;
+    }
+
+    this.len = function() {
+        if(list == null) return 0;
+        return list.length;
+    };
+
+    this.mergeJsonData = function (data, extdata) {
+        list = new Array();
+        for (let i = 0; i < data.length; i++) this.addObject(data[i]);
+    };
+
+    this.addObject = function (jsonObj) {
+        list.push(new DataObject(ctlName, jsonObj));
+    };
+
+    this.assignJsonData = function (data) {
+        clearData();
+        mergeJsonData(data);
+    };
+    this.getRaw = function (index) {
+        return list[index];
+    };
+    this.getSorted = function (index) {
+        if(!isSorted) return null;
+        return preSort[index];
+    };
+    this.quickSort = function (a,left,right,comp){
+        if(left>right){ //一定要有这个判断,因为有递归left和i-1,若没有这个判断条件,该函数会进入无限死错位递归
+            return;
+        }
+
+        var i=left,
+            j=right,
+            pivot=a[left]; //基准总是取序列开头的元素
+
+        while(i!=j){
+            while((comp(a[j],pivot) > 0)&&i<j){j--}
+            while((comp(a[j],pivot) <= 0)&&i<j){i++}
+            if(i<j){  //如果i==j跳出外层while
+                var t=a[i];
+                a[i]=a[j];
+                a[j]=t;
+            }
+        }
+
+        a[left]=a[i];//交换基准数和k位置上的数
+        a[i]=pivot;
+
+        quicksort(a,left,i-1,comp);
+        quicksort(a,i+1,right,comp);
+    };
+};
+
+/***
+ * DOService
+ * @param controlName
+ * @constructor
+ */
+var DataObjectService = function(controlName, syncType, extparm){
+    this.ctlName    = controlName;
+    // 2=default 4=on-demand, 8=auto, 16:fast, 32=passive
+    this.syncType   = syncType;
+    this.extParm    = extparm;
+    this.isDefault  =  ((syncType & DEFAULT)  !== 0);
+    this.isOnDemand = ((syncType & ONDEMAND)  !== 0);
+    this.isAuto =     ((syncType & AUTO)  !== 0);
+    this.isFast =     ((syncType & FAST) !== 0);
+    this.isPassive =  ((syncType & PASSIVE) !== 0);
+    this.failedCount = 0;
+    this.list = new DataObjectList(controlName);
+    this.autoUpdateTimer = 0;
+    this.autoInterval = 1000;
+
+    function setUpInterval() {
+        //URL + exparm
+        if(this.autoUpdateTimer != 0) clearInterval(this.autoUpdateTimer);
+        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval);
+        setTimeout(this.selfUpdateTick, 100);
+    }
+
+    this.init = function(){
+        this.appUrl = "/server/"+ controlName + "/list" + extparm;
+        if(!this.isFast || this.isOnDemand){
+            this.autoInterval = 30000;
+        }
+
+        if(this.isFast) {
+            this.appUrl = "/server/"+ controlName + "/get" + extparm;
+        }
+
+        if(this.isAuto){
+            // timer
+            setUpInterval();
+        }
+    };
+
+    this.stopTimers = function () {
+        clearInterval(this.autoUpdateTimer);
+        this.autoUpdateTimer = 0;
+    };
+
+    this.selfUpdateTick = function(){
+        get_data(this.appUrl, this.onDataReceived);
+    };
+
+    this.onDemandUpdate = function(){
+        get_data(this.appUrl, this.onDataReceived);
+    };
+
+    this.onDataReceived = function(data, sta){
+        let output = first_parse(this, obj);
+        if (output.list == undefined || output.list.length == 0) {
+            this.failedCount++;
+            if(this.failedCount > 100){
+                this.failedCount = 0;
+                this.stopTimers();
+                console.log("【错误次数过多");
+                setTimeout(this.setUpInterval, 10000);
+            }
+            if(this.failedCount == 2) {
+                send_alert("没有数据,请尝试重新加载!【DataService】: ctlName[" + controlName + "],  extParm[" + extparm + "]");
+            }
+        }else{
+            this.list.assignJsonData(output.list);
+        }
+    };
+
+    this.passiveUpdate = function(data){
+        this.failedCount = 0;
+        this.list.assignJsonData(data);
+    };
+
+    this.init();
+};
+
+var SinglePage = function () {
+    this.modules = [];
+};
+
+var Module = function(chartContainerSelector, dataCtlName){
+    this.selector = chartContainerSelector;
+    this.dataCtl = dataCtlName;
+    this.activeData = null;
+    this.lastActive = 0;
+    this.tickInterval = 1000;
+    /***
+     * bindData to UI
+     * @param data DataObjectList
+     */
+    this.setData = function (data) {
+        if(data.ctlName == this.dataCtl){
+            console.log(`-------- Module ${this.selector} got data ----------- `);
+            this.activeData = data;
+            this.drawData(this.activeData);
+        }else{
+            console.log(`-------- Module ${this.selector} cannot use data of ${data.ctlName} ----------- `);
+        }
+    };
+    this.init = function () {
+        // do init
+        this.setupInterval();
+    };
+    this.tick = function () {
+        // do tick
+    };
+    this.setupInterval = function () {
+        // do tick
+        if(this.tickInterval != 0) clearInterval(this.tickInterval);
+        this.tickInterval = setInterval(this.tick, this.tickInterval);
+    };
+    this.drawData = function () {
+        // do drawData
+    };
+};
+
+var RedRankTable = new Module("#table-rank", "fcBiWorkerDaily");
+
+RedRankTable.slideLen = 16;
+RedRankTable.slides   = 0;
+RedRankTable.parts    = 4;
+RedRankTable.partLen  = 4;
+RedRankTable.curSlide = 0;
+
+RedRankTable.drawData = function (data) {
+    // showSlide
+    this.showSlide(this.curSlide, data);
+};
+
+RedRankTable.showSlide = function (slide, data) {
+    this.parts = 3;
+    for(var part = 0; part < this.parts; part++){
+        this.showPart(slide, part, data);
+    }
+};
+
+RedRankTable.showPart = function(slide, part, data){
+    var htmlbody = "", row;
+    var lpos = this.slide * this.slideLen + part * this.partLen;
+    var rpos = this.slide * this.slideLen + (part+1) * this.partLen;
+    for (var i = lpos; i < rpos; i++) {
+        row = this.getDataRow(htmlbody, data.getRaw(i));
+        htmlbody += row;
+    }
+    //if (localCache() !== htmlbody) {
+    $(this.selector + "-" + part).html(htmlbody);
+    //    lastTimeRank1 = htmlbody;
+    //}
+    //console.log(htmlbody);
+};
+
+RedRankTable.tickInterval = 10000;
+RedRankTable.tick = function(){
+    var totalDataLen = this.activeData != null ? this.activeData.len() : 0;
+    if(this.slides != Math.ceil(totalDataLen / this.slideLen)){
+        this.slides = Math.ceil(totalDataLen / this.slideLen);
+        this.curSlide = 0;
+    } else {
+        this.curSlide = (this.curSlide + 1) % this.slides;
+    }
+};
+
+RedRankTable.getDataRow = function(htmlbody, dataObj) {
+    if (dataObj == null || typeof dataObj === "undefined") {
+        htmlbody += "<tr>";
+        htmlbody += `<tr>
+                    <td> - </td>
+                    <td> 0 </td>
+                    <td> 0 </td>
+                    <td> 0 </td>
+                </tr>`;
+        htmlbody += "</tr>";
+        return htmlbody;
+    }
+    htmlbody += "<tr>";
+    htmlbody += `<tr>
+                    <td style="background-color: ${dataObj.getVal("color")}">${getUserName(dataObj.getVal("id"))}</td>
+                    <td style="background-color: ${dataObj.getVal("color")}">${dataObj.getVal("failNum")}</td>
+                    <td style="background-color: ${dataObj.getVal("color")}">${dataObj.getVal("passNum")}</td>
+                    <td style="background-color: ${dataObj.getVal("color")}">${dataObj.getVal("failRate") + '%'}</td>
+                </tr>`;
+    htmlbody += "</tr>";
+    return htmlbody;
+}
+RedRankTable.init();
+
+var FlowRealTime = new (function () {
+
+    this.pgName = "flowDashBoard";
+    this.page = new SinglePage(this.pgName);
+    this.scheduleId = utils_get_param("scheduleId");
+    this.flowId = utils_get_param("flowId");
+    if(scheduleId  == null || flowId == null)
+    {
+        send_alert(`清重新进入本页面!<a href='denglu.html'> 返回主页 </a>`);
+        return;
+    }
+    this.flowPlace = " % flowPlace %";
+    this.flowName = " % flowPlace %";
+
+    this.scheduleLoadDataService = new DataObjectService("fcWorkScheduleLoad", ONDEMAND /*AUTO & FAST*/, "?scheduleId=" + scheduleId);
+    this.oaStaffService = new DataObjectService("fcWorkScheduleLoad", ONDEMAND, "");
+    this.sectorService = new DataObjectService("fcWorkScheduleLoad", ONDEMAND, "");
+    this.flowService = new DataObjectService("fcFlow", ONDEMAND, "");
+    this.rankData = new DataObjectService("fcBiWorkerDaily", ONDEMAND & AUTO & FAST, "?type=1");
+
+    this.MeduimData = new (function () {
+        this.initializeUsers = function(list){
+            list.forEach(function (val, it, arr) {
+                var isExist = false;
+                userIDs.forEach(function (vals) {
+                    if (vals == val.userId) {
+                        isExist = true;
+                    }
+                });
+                if (!isExist) userIDs.push(val.userId);
+            });
+        };
+    })();
+
+    this.initPage = function() {
+        setInterval(this.tick, 1000);
+    };
+
+    this.tick = function(){
+        RedRankTable.setData(this.rankData.list);
+    };
+
+    this.Action = new (function () {
+        this.doStopSchedule = function () {
+            get_data("fcWorkSchedule/stopSchedule?userId=" + userId + "&scheduleId=" + scheduleId, UI.showStopSuccess);
+        };
+        this.confirmStopSchedule = function () {
+            var out = confirm("真的要下班吗?");
+            if (out == true) {
+                doStopSchedule();
+            } else {
+            }
+        };
+    })();
+
+    this.UI = new (function () {
+        this.showClearPanel = function () {
+            $("#clearModal").modal('show');
+        };
+        this.showStopSuccess = function (obj, sta) {
+            send_alert("下班操作成功! <a href='denglu.html'> 点击这里返回控制主页 </a>");
+        };
+        this.bind = function () {
+            $(".confirm-clear-data").click(function(){
+                FlowRealTime.ClearDataControl.clearDataOfDeviceId($('#handInput').val());
+            });
+            $(".open-clear-panel").click(function () {
+                FlowRealTime.UI.showClearPanel();
+            })
+            $(".close-schedule").click(function () {
+                FlowRealTime.Action.confirmStopSchedule();
+            })
+        }
+    })();
+
+    var ClearDataControl = new (function () {
+        this.finished = true;
+        this.executed = false;
+        this.directCount = -1;
+
+        this.clearDataOfDeviceId = function (handId) {
+            this.executed = false;
+            this.directCount = -1;
+            this.finished = true;
+            var hand = handId;
+            var hd = 0;
+            if (hand.length > 0) {
+                hd = parseInt(hand);
+            }
+            get_data("endpoint/clearBoard?flowId=" + flowId + "&handheldId=" + hd, this.clearSuccess);
+        };
+
+        this.clearSuccess = function (obj, sta) {
+            console.warn("-------  手持设备清空  ----------");
+            console.warn(obj);
+            send_alert("发送清空请求成功, 正在等待采集端进行处理...");
+            this.finished = false;
+            setTimeout(this.resultVerifyTimeout, 8000);
+            setTimeout(this.getVerify, 300);
+        }
+
+        this.getVerify = function () {
+            if (this.finished) return;
+            get_data("endpoint/heartbeat?flowId=" + flowId, this.onVerifyResult);
+            setTimeout(this.getVerify, 100);
+        };
+
+        this.onVerifyResult = function (obj, sta) {
+            var parsed = {};
+            if (typeof(obj) === "string") {
+                parsed = JSON.parse(obj);
+            } else {
+                parsed = obj;
+            }
+
+            if (typeof(parsed) === "object") {
+                if (parsed.ret === "10000") {
+                    //ok
+                    if (parsed.model == null || parsed.model === undefined) {
+                        executed = true;
+                        finished = true;
+                    } else if (typeof(obj.model) === "object") {
+                        // 没有拿到,继续
+                        if (obj.model.list != null && obj.model.list.length > 0) {
+                            var direct = obj.model.list[0];
+                            if (direct.eventType + "" !== "500") {
+                                // OK
+                                executed = true;
+                                finished = true;
+                            } else if (direct.arg2 + "" !== "" + $("#handInput").val()) {
+                                // OK
+                                executed = true;
+                                finished = true;
+                            } else {
+                                directCount = direct.counter;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        this.resultVerifyTimeout = function () {
+            finished = true;
+            if (executed) {
+                // 执行成功
+            } else {
+                if (directCount >= 0) {
+                    get_data("endpoint/ack?counter=" + directCount, function () {
+                        console.log("撤销操作成功");
+                        console.log(this);
+                    });
+                    directCount = -1;
+                    send_alert("请求已经超时!请注意,采集端可能没有执行成功。即将撤销您的请求。");
+                } else {
+                    send_alert("请求已经超时!请注意,采集端可能没有执行成功。");
+                }
+            }
+        }
+    })();
+
+})();
+
+
+$(document).ready(function(){
+    FlowRealTime.UI.bind();
+});

+ 549 - 0
js/pending.js

@@ -0,0 +1,549 @@
+this.HistoryData = (function (){
+    this.update = function () {
+        // 请注意type必须在结尾
+        get_data("fcBiFlowDaily/list?flowId=" + flowId + "&type=1", history_success);
+    };
+
+    this.loadHistroyOnce = function (nnm) {
+        // 请注意type必须在结尾
+        get_data(HistoryBaseURL + "&type=" + nnm, history_success);
+    };
+
+    this.loadMultiHistory = function(){
+        for (i = 1; i <= 3; i++) loadHistroyOnce(i);
+    };
+
+    this.add_success = function(obj, sta) {
+        var history1 = first_parse(this, obj);
+        var i, j;
+        console.log(" history1 : ");
+        console.log(history1);
+        hispass[t] = 0;
+        hisfail[t] = 0;
+        hisstack[t] = 0;
+        hisrate[t] = 0;
+        var lengthnum = history1.length - 1;
+        for (i = lengthnum; i < history1.length; i++) {
+            hispass[t] = history1[i].passNum + hispass[t];
+            hisfail[t] = history1[i].failNum + hisfail[t];
+            hisstack[t] = history1[i].avgDue + hisstack[t];
+        }
+        if (hispass[t] + hisfail[t] == 0) {
+            hisrate[t] = 0;
+        }
+        t++;
+    }
+})();
+
+function realtime_success(obj, sta) {
+    var output = first_parse(this, obj);
+    //在这里排序 spo\
+    console.log(" output : ");
+    console.log(output);
+
+    var i, j, k, z;
+    failnum = 0;
+    var x = 0;
+    var worksum = [];
+    var hhp = 0, hhf = 0, hhs = 0;
+
+
+    if (output.list.length > 0) {
+        sectorID[0] = getSectorId(output.list[0].spotId);
+        passNumber[0] = 0;
+        failNumber[0] = 0;
+        stackeverynum[0] = 0;
+        z = 0;
+        for (i = 1; i < output.list.length; i++) {
+            var thisUid = getSectorId(output.list[i].spotId);
+            x = 0;
+            for (j = 0; j < sectorID.length; j++) {
+                if (sectorID[j] === thisUid) {
+                    x = 1;
+                    break;
+                }
+            }
+            if (x === 0) {
+                sectorID.push(thisUid);
+            }
+
+        }
+        j = 0;
+        for (k = 0; k < sectorID.length; k++) {
+            var uid = sectorID[k];
+            z = 0;
+            passNumber[k] = 0;
+            failNumber[k] = 0;
+            stackeverynum[k] = 0;
+            for (i = 0; i < output.list.length; i++) {
+                if (uid === getSectorId(output.list[i].spotId)) {
+                    passNumber[k] = output.list[i].passNum + passNumber[k];
+                    failNumber[k] = output.list[i].failNum + failNumber[k];
+                    stackeverynum[k] = output.list[i].due + stackeverynum[k];
+                    z++;
+                }
+            }
+            failrate[k] = get_factor(passNumber[k], failNumber[k]);
+        }
+        output.list.forEach(function (val, fid, arr) {
+            hhp += val.passNum;
+            hhf += val.failNum;
+            hhs += val.due;
+        })
+    }
+
+    schedulepass = hhp;
+    schedulefail = hhf;
+    if (output.list.length > 0) {
+        schedulestack = hhs / output.list.length;
+    } else {
+        schedulestack = 0;
+    }
+    update_all_history();
+    updateChart();
+
+};
+
+
+var RealTimeCharts = (function() {
+
+    var timeday = ["今日", "昨日", "本周", "本月"];
+
+    if (flowId == null || scheduleId == null) {
+        send_alert("出错啦!请检查参数完整性");
+    }
+
+    function page_document_load() {
+        get_data("fcWorkScheduleLoad/list?scheduleId=" + scheduleId, onFirstTimeSuccess);
+    }
+
+    var compAxis = {
+        categories: namedata,
+        crosshair: true,
+        title: {
+            text: '工位',
+            style: {
+                fontSize: '1.5em'
+            }
+        },
+        labels: {
+            style: {
+                fontSize: '1.5em'
+            }
+        }
+    };
+
+    var getSeperateArrays = function (sectorLoadData){
+        this.data = [];
+        this.len = sectorLoadData.len();
+        this.stackmax = 0;
+        this.failmax = 0;
+        this.passmax = 0;
+        this.failratemax = 0;
+        this.ratedata = [];
+        this.passdata = [];
+        this.faildata = [];
+        for (i = 0; i < len; i++) {
+            var one = sectorLoadData.getRaw(i);
+            if (stackmax < one[i].getVal("stack")) {
+                stackmax = one[i].getVal("stack")
+            }
+            if (failmax < one[i].getVal("failNum")) {
+                failmax = one[i].getVal("failNum");
+            }
+            if (failratemax < one[i].getVal("failRate")) {
+                failratemax = one[i].getVal("failRate");
+            }
+            if (passmax < one[i].getVal("passNum")) {
+                passmax = one[i].getVal("passNum");
+            }
+
+            data.push(one[i].getVal("stack"));
+            this.ratedata.push(Math.floor(one[i].getVal("failRate")));
+            this.passdata.push(one[i].getVal("passNum"));
+            this.faildata.push(one[i].getVal("failNum"));
+        }
+
+        failratemax = Math.max(failratemax, 5);
+        stackmax = Math.max(stackmax, 5);
+        failmax = Math.max(failmax, 5);
+        passmax = Math.max(passmax, failmax, stackmax);
+    };
+
+    this.dataArrays = null;
+
+    function showChart(sectorLoadData) {
+        dataArrays = new getSeperateArrays(sectorLoadData);
+
+        stackAndFailChart = Highcharts.chart('graph-1', {
+            chart: {
+                zoomType: 'xy',
+                //height: (4 / 16 * 100) + '%' // 16:9 ratio
+            },
+            title: {text: '各工位今日产能'},
+            credits: {enabled: false},
+            exporting: {enabled: false},
+            xAxis: [compAxis],
+            yAxis: [{
+                labels: {
+                    format: '{value}',
+                    style: {
+                        color: "#ffffff",
+                        fontSize: '1.5em'
+                    }
+                },
+                min: 0,
+                max: passmax * 1.5,
+                title: {
+                    text: '数量',
+                    style: {
+                        color: '#ffffff',
+                        fontSize: '1em'
+                    },
+                    rotation: 270,
+                }
+            },],
+            tooltip: {shared: true},
+            legend: {
+                layout: 'vertical',
+                align: 'right',
+                x: 0,
+                verticalAlign: 'top',
+                y: 0,
+                floating: true,
+                backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
+            },
+            series: [{
+                name: '良品数',
+                type: 'column',
+                data: passdata,
+
+            }, {
+                name: '不良品数',
+                type: 'column',
+                data: faildata,
+
+            },
+                {
+                    name: '堆积数',
+                    type: 'column',
+                    data: data,
+                }]
+        });
+
+        FailChart = Highcharts.chart('graph-2', {
+            chart: {
+                //height: (4 / 16 * 100) + '%' // 16:9 ratio
+            },
+            title: {
+                text: '各工位今日不良率'
+            },
+            credits: {
+                enabled: false // 禁用版权信息
+            },
+            exporting: {
+                enabled: false
+            },
+            xAxis: [compAxis],
+            yAxis: [{ // Secondary yAxis
+                title: {
+                    text: '不良率',
+                    style: {
+                        color: '#ffffff',
+                        fontSize: '1em'
+                    }
+                },
+                min: 0,
+                max: 1.5 * failratemax,
+                labels: {
+                    formatter: function () {
+                        return Math.floor(this.value) + "%";
+                    },
+                    style: {
+                        color: '#ffffff',
+                        fontSize: '20px'
+                    },
+                    rotation: 270,
+                },
+
+            }],
+            tooltip: {
+                shared: true
+            },
+            legend: {
+                layout: 'vertical',
+                align: 'right',
+                x: 0,
+                verticalAlign: 'top',
+                y: 0,
+                floating: true,
+                backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
+            },
+            series: [{
+                name: '不良率',
+                type: 'spline',
+                data: ratedata,
+                color: 'red',
+                tooltip: {
+                    valueSuffix: '%'
+                }
+            }]
+        });
+
+    }
+
+    function updateChart(sectorLoad) {
+        var data = [];
+        var ratedata = [];
+        var stackmax = 0;
+        var failmax = 0;
+        var passdata = [];
+        var faildata = [];
+        var passmax = 0;
+        var failratemax = 0;
+        for (i = 0; i < passNumber.length; i++) {
+            if (stackmax < stackeverynum[i]) {
+                stackmax = stackeverynum[i];
+            }
+            if (failmax < failNumber[i]) {
+                failmax = failNumber[i];
+            }
+            if (failratemax < failrate[i]) {
+                failratemax = failrate[i];
+            }
+            if (passmax < passNumber[i]) {
+                passmax = passNumber[i];
+            }
+            data.push(stackeverynum[i]);
+            ratedata.push(Math.floor(failrate[i]));
+            passdata.push(passNumber[i]);
+            faildata.push(failNumber[i]);
+        }
+        failratemax = Math.max(failratemax, 5);
+        stackmax = Math.max(stackmax, 5);
+        failmax = Math.max(failmax, 5);
+        passmax = Math.max(passmax, failmax, stackmax);
+
+
+        // https://api.hcharts.cn/highcharts#Series.addPoint;
+
+        stackAndFailChart.series[0].setData(passdata);
+        stackAndFailChart.series[1].setData(faildata);
+        stackAndFailChart.series[2].setData(data);
+        FailChart.series[0].setData(ratedata);
+
+        if (failratemax > FailChart.yAxis[0].getExtremes().max * 1.3 || failratemax < FailChart.yAxis[0].getExtremes().max * 0.5) {
+            FailChart.yAxis[0].setExtremes(0, failratemax * 1.5);
+        }
+        if (passmax > stackAndFailChart.yAxis[0].getExtremes().max * 1.3 || passmax < stackAndFailChart.yAxis[0].getExtremes().max * 0.5) {
+            stackAndFailChart.yAxis[0].setExtremes(0, passmax * 1.5);
+        }
+
+        showHistoryData();
+        showRedRanking();
+        showBlackRanking();
+
+
+        var secNames = [];
+
+        sectorID.forEach(function (val) {
+            secNames.push(getSectorName(val));
+        });
+
+        if (JSON.stringify(secNames) !== lastTimeSecNames) {
+            lastTimeSecNames = JSON.stringify(secNames);
+            FailChart.xAxis[0].setCategories(secNames);
+            stackAndFailChart.xAxis[0].setCategories(secNames);
+        }
+    }
+
+    var lastTimeSecNames = "";
+
+    var stackAndFailChart = null;
+    var FailChart = null;
+
+})();
+
+
+function getHistoryTableBody(htmlbody, i) {
+    if (typeof hispass[i] === "undefined") {
+        htmlbody += "<tr>";
+        htmlbody += `<tr>
+                    <td> - </td>
+                    <td> - </td>
+                    <td> - </td>
+                    <td> - </td>
+                    <td> - </td>
+                </tr>`;
+        htmlbody += "</tr>";
+        return htmlbody;
+    }
+    htmlbody += "<tr>";
+    htmlbody += `<tr>
+                    <td>${timeday[i]}</td>
+                    <td>${hispass[i]}</td>
+                    <td>${hisfail[i]}</td>
+                    <td>${hisstack[i]}</td>
+                    <td>${hisrate[i] + '%'}</td>
+                </tr>`;
+    htmlbody += "</tr>";
+    return htmlbody;
+}
+
+
+var goodColor = [];
+var badColor = [];
+var goodColor1 = [];
+var badColor1 = [];
+var userIDs = [];
+var schedulepass = 0, schedulefail = 0, schedulestack = 0;
+var todayotherpass = 0, todayotherfail = 0, todayotherstack = 0;
+var lastTimeHistory = "";
+var histoires = [];
+
+var hispass = [];
+var hisfail = [];
+var hisstack = [];
+var hisrate = [];
+var goodpass = [];
+var goodid = [];
+var goodfailrate = [];
+var goodpass1 = [];
+var goodid1 = [];
+var goodfailrate1 = [];
+var badpass = [];
+var badid = [];
+var badfailrate = [];
+var badpass1 = [];
+var badid1 = [];
+var badfailrate1 = [];
+var todayotherpass, todayotherfail, todayotherstack;
+var orighisfail = [], orighispass = [], orighisstack = [];
+
+/*
+function isUserOfThisFlow(uid) {
+    var isExist = false;
+    userIDs.forEach(function (vals) {
+        if (vals == uid) {
+            isExist = true;
+        }
+    });
+    return isExist;
+}
+
+var RedRank = (function() {
+    this.fetchPos = 0;
+    this.multipleData = [];
+    this.loader = (function () {
+        this.load = function(pos) {
+            this.multipleData = new Array();
+            for(let i = 0; i < 8; i++){
+                this.multipleData[i] = new DataObjectService("fcBiWorkderDaily", AUTO & FAST, "?type="+i);
+            }
+            get_data(`fcBiWorkerDaily/get?type=${RedRank.fetchPos}`, RedRank.loader.onSuccess);
+        };
+        this.consecutiveLoad = function(){
+            RedRank.fetchPos = (RedRank.fetchPos + 1) % 8;
+            load(RedRank.fetchPos);
+        };
+        this.onSuccess = function(res, code){
+
+        };
+    })();
+})();
+
+function on_red_rank_success(obj, sta) {
+    var redchart = first_parse(this, obj);
+    var i, j;
+    i = j = 0;
+    console.log(" redchart : ");
+    console.log(redchart);
+    for (i = 0; i < redchart.list.length; i++) {
+        goodid[i] = getUserName(redchart.list[i].workerId);
+        goodpass[i] = redchart.list[i].passNum;
+        if (redchart.list[i].passNum + redchart.list[i].failNum > 0) {
+            goodfailrate[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
+        } else {
+            goodfailrate[i] = 0;
+        }
+        if (isUserOfThisFlow(redchart.list[i].workerId)) {
+            goodColor[i] = 'red';
+        } else {
+            goodColor[i] = '';
+        }
+    }
+
+}
+
+function on_red_rank_success1(obj, sta) {
+    var redchart = first_parse(this, obj);
+    var i, j;
+    i = j = 0;
+    console.log(" redchart : ");
+    console.log(redchart);
+    for (i = 0; i < redchart.list.length; i++) {
+        goodid1[i] = getUserName(redchart.list[i].workerId);
+        goodpass1[i] = redchart.list[i].passNum;
+        if (redchart.list[i].passNum + redchart.list[i].failNum > 0) {
+            goodfailrate1[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100;
+        } else {
+            goodfailrate1[i] = 0;
+        }
+        if (isUserOfThisFlow(redchart.list[i].workerId)) {
+            goodColor1[i] = 'red';
+        } else {
+            goodColor1[i] = '';
+        }
+    }
+
+}
+
+function on_black_rank_success(obj, sta) {
+    var blackchart = first_parse(this, obj);
+    var i, j;
+    i = j = 0;
+    console.log(" black chart : ");
+    console.log(blackchart);
+    for (i = 0; i < blackchart.list.length; i++) {
+        badid[i] = getUserName(blackchart.list[i].workerId);
+        badpass[i] = blackchart.list[i].passNum;
+        //badfailrate[i] = blackchart.list[i].failRate / 100;
+        if (blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
+            badfailrate[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
+        } else {
+            badfailrate[i] = 0;
+        }
+        if (isUserOfThisFlow(blackchart.list[i].workerId)) {
+            badColor[i] = 'green';
+        } else {
+            badColor[i] = '';
+        }
+    }
+
+
+}
+
+function on_black_rank_success1(obj, sta) {
+    var blackchart = first_parse(this, obj);
+    var i, j;
+    i = j = 0;
+    console.log(" black chart : ");
+    console.log(blackchart);
+    for (i = 0; i < blackchart.list.length; i++) {
+        badid1[i] = getUserName(blackchart.list[i].workerId);
+        badpass1[i] = blackchart.list[i].passNum;
+        //badfailrate[i] = blackchart.list[i].failRate / 100;
+        if (blackchart.list[i].passNum + blackchart.list[i].failNum > 0) {
+            badfailrate1[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100;
+        } else {
+            badfailrate1[i] = 0;
+        }
+        if (isUserOfThisFlow(blackchart.list[i].workerId)) {
+            badColor1[i] = 'green';
+        } else {
+            badColor1[i] = '';
+        }
+    }
+
+
+}*/

+ 52 - 30
lazhang.html

@@ -31,10 +31,8 @@
     <link href="css/themes/all-themes.css" rel="stylesheet"/>
 
     <script src="css/third/jq.3.2.1.min.js"></script>
-    <script src="css/third/popper.1.12.9.js"
-            ></script>
-    <script src="css/third/boot.min.js"
-            ></script>
+    <script src="css/third/popper.1.12.9.js"></script>
+    <script src="css/third/boot.min.js"></script>
 
 
     <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -55,6 +53,7 @@
     <script src="css/third/exporting.js"></script>
     <script src="css/third/cn.js"></script>
     <script src="css/third/dark.js"></script>
+    <script src="js/timeService.js"></script>
 </head>
 
 <body class="theme-black" style="background-color: #2d2d2d !important;overflow: hidden" onload="startTime()">
@@ -91,12 +90,12 @@
                 <a class="nav-link bg-red text-white" href="javascript:void" id="flow_title">深圳市度彼电子有限公司</a>
             </li>
         </ul>
-        <form class="form-inline my-2 my-lg-0 text-white" >
+        <div class="form-inline my-2 my-lg-0 text-white" >
             <button class="btn btn-outline-dark my-2 my-sm-0 text-white" id="nowDateTimeSpan"></button>
-            <button class="btn btn-danger my-2 my-sm-0" onclick="confirmStopSchedule()">下班</button>
-            <button class="btn btn-warning my-2 my-sm-0" onclick="FlowRealTime.UI.showClearPanel()">清除数据</button>
+            <button class="btn btn-danger my-2 my-sm-0 close-schedule">下班</button>
+            <button class="btn btn-warning my-2 my-sm-0 open-clear-panel">清除数据</button>
             <button class="btn btn-success my-2 my-sm-0" onclick="history.go(0)">重新加载</button>
-        </form>
+        </div>
     </div>
     <!--<div class="container-fluid">
         <div class="navbar-header">
@@ -128,15 +127,16 @@
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
-                    <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="FlowRealTime.Action.clearDataOfDeviceId($("#handInput").val())">确认清除</button>
+                    <button type="button confirm-clear-data" class="btn btn-primary" data-dismiss="modal">确认清除</button>
                 </div>
             </div>
         </div>
     </div>
+
     <div class="text-white row middle-font">
-        <div class="col-md-5">
-            <div class="text-center big-letter">本拉产能统计</div>
-            <table class="table table-bordered text-center" style="color: #ffffff">
+        <div class="col-md-3"  style="height: 30vh">
+            <div class="text-center big-letter">全厂产能统计</div>
+            <table class="table table-bordered text-center">
                 <thead>
                 <tr>
                     <th scope="col">时间</th>
@@ -147,62 +147,83 @@
                 </tr>
                 </thead>
                 <tbody id="rank-one">
-
                 </tbody>
             </table>
         </div>
-        <div class="col-md-7 text-white">
+        <div class="col-md-9 text-white" style="height: 30vh">
             <div class="text-center text-lg big-letter">本厂今日生产能手榜</div>
             <div class="row">
-                <div class="col-md-6">
+                <div class="col-md-3">
                     <table class="table table-bordered text-center table-striped">
                         <thead>
                         <tr>
-                            <th scope="col" colspan="4">红榜</th>
+                            <th>人员</th>
+                            <th>良品</th>
+                            <th>坏品</th>
+                            <th>不良率</th>
                         </tr>
+                        </thead>
+                        <tbody id="table-rank-0">
+                        </tbody>
+                    </table>
+                </div>
+
+                <div class="col-md-3">
+                    <table class="table table-bordered text-center table-striped">
+                        <thead>
                         <tr>
                             <th>人员</th>
-                            <th>良品数</th>
-                            <th>人员</th>
+                            <th>良品</th>
+                            <th>坏品</th>
                             <th>不良率</th>
 
                         </tr>
                         </thead>
-                        <tbody id="rank-two">
+                        <tbody id="table-rank-1">
                         </tbody>
-
                     </table>
                 </div>
-
-                <div class="col-md-6">
+                <div class="col-md-3">
                     <table class="table table-bordered text-center table-striped">
                         <thead>
                         <tr>
-                            <th scope="col" colspan="4">黑榜</th>
+                            <th>人员</th>
+                            <th>良品</th>
+                            <th>坏品</th>
+                            <th>不良率</th>
+
                         </tr>
+                        </thead>
+                        <tbody id="table-rank-2">
+                        </tbody>
+                    </table>
+                </div>
+
+                <div class="col-md-3">
+                    <table class="table table-bordered text-center table-striped">
+                        <thead>
                         <tr>
                             <th>人员</th>
-                            <th>良品数</th>
-                            <th>人员</th>
+                            <th>良品</th>
+                            <th>坏品</th>
                             <th>不良率</th>
 
                         </tr>
                         </thead>
-                        <tbody id="rank-three">
+                        <tbody id="table-rank-3">
                         </tbody>
                     </table>
                 </div>
-
             </div>
         </div>
     </div>
 
-    <div class="row" style-height="50">
+    <div class="container" style="height:50vh; max-width: 90% !important;" sxtyle-height="50">
         <div class="row col-md-12 ">
-            <div id="graph-1" class="chartsize col-md-12" style-height="30"></div>
+            <div id="graph-1" class="chartsize col-md-12" style="height:30vh" sxtyle-height="30"></div>
         </div>
         <div class="row col-md-12 ">
-            <div id="graph-2" class="chartsize col-md-12" style-height="30"></div>
+            <div id="graph-2" class="chartsize col-md-12" style="height:30vh" sxtyle-height="30"></div>
         </div>
     </div>
 
@@ -220,6 +241,7 @@
 <!--- Unique -->
 <script src="js/lazhang-data.js"></script>
 <script src="js/lazhang-display.js"></script>
+<script src="js/newData.js"></script>
 </body>
 
 </html>