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("没有数据"); } 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); }); if (output.list.length > 0) { sectorID[0] = getSectorId(output.list[0].spotId); 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[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; } /*stackeverynum[k]=stackeverynum[k]/z;*/ /// } } get_data("fcFlow/list?flowId="+ flowId,name_Success); 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); name1=factory.list[0].flowPlace; name2=factory.list[0].flowName; document.getElementById("test1").innerHTML = name1+"-"+name2; } 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 load_flows_history_data(nnm) { // 请注意type必须在结尾 get_data("fcBiFlowDaily/list?scheduleId="+scheduleId+ "&flowId=" + flowId+"&type=" + nnm , history_success); } 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(); } else{ } } function get_stop_scheudle() { get_data("fcWorkSchedule/stopSchedule?userId="+userId+"scheduleId=" + scheduleId, stopSuccess); } function stopSuccess(obj, sta) { send_alert("下班操作成功! 点击这里返回控制主页 "); } 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 (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(); }