123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- 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;
- }
- if (output.list == undefined || output.list.length == 0) {
- send_alert("没有数据");
- }
- 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);
- }
- }
- 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++) {
- 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\
- if(showNetwork) console.log(" output : ");
- if(showNetwork) 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);
- }
- }
- 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;*/
- ///
- }
- output.list.forEach(function (val, fid, arr) {
- hhp += val.passNum;
- hhf += val.failNum;
- hhs += val.due;
- })
- }
- 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();
- }
|