dapingmu.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. var passNumber = [];
  2. var failNumber = [];
  3. var failrate = [];
  4. var stackeverynum = [];
  5. var failnum = 0;
  6. var num = 0;
  7. var hispass = [];
  8. var hisfail = [];
  9. var hisstack = [];
  10. var hisrate = [];
  11. var n = 0;
  12. var flowIds = [];
  13. var namedata = [];
  14. var lazhang = {};
  15. function page_document_load() {
  16. get_data("fcWorkScheduleLoad/get", first_success)
  17. }
  18. function first_success(obj, sta) {
  19. let output = first_parse(this, obj);
  20. let i, j, k, z;
  21. failnum = 0;
  22. let x = 0;
  23. let worksum = [];
  24. z = 0;
  25. if(typeof output.length =="number"){
  26. output.list = output;
  27. }
  28. if (output.list == undefined || output.list.length == 0) {
  29. send_alert("没有数据");
  30. }
  31. if (output.list.length > 0) {
  32. flowIds[0] = output.list[0].scheduleId;
  33. for (i = 1; i < output.list.length; i++) {
  34. var thisUid = output.list[i].scheduleId;
  35. x = 0;
  36. for (j = 0; j < flowIds.length; j++) {
  37. if (flowIds[j] === thisUid) {
  38. x = 1;
  39. break;
  40. }
  41. }
  42. if (x === 0) {
  43. flowIds.push(thisUid);
  44. }
  45. }
  46. j = 0;
  47. for (k = 0; k < flowIds.length; k++) {
  48. var uid = flowIds[k];
  49. z = 0;
  50. passNumber[k] = 0;
  51. failNumber[k] = 0;
  52. stackeverynum[k] = 0;
  53. for (i = 0; i < output.list.length; i++) {
  54. if (uid === output.list[i].scheduleId) {
  55. passNumber[k] = output.list[i].passNum + passNumber[j];
  56. failNumber[k] = output.list[i].failNum + failNumber[j];
  57. stackeverynum[k] = output.list[i].due + stackeverynum[j];
  58. z++;
  59. }
  60. }
  61. if (failNumber[k] + passNumber[k] == 0) {
  62. failrate[k] = 0;
  63. } else {
  64. failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100;
  65. }
  66. }
  67. }
  68. for (i = 1; i <= 3; i++) {
  69. load_flows_history_data(i);
  70. }
  71. showChart();
  72. lazhang.timer = setInterval(request_data_realtime, 1000);
  73. }
  74. function request_data_realtime() {
  75. get_data("fcWorkScheduleLoad/get", realtime_success);
  76. //load_flows_history_realtime_data();
  77. load_table_red_rank();
  78. load_table_red_rank1();
  79. load_table_black_rank();
  80. load_table_black_rank1();
  81. }
  82. function load_flows_history_data(nnm) {
  83. get_data("fcBiFactoryDaily/list?type=" + nnm, history_success);
  84. }
  85. function load_flows_history_realtime_data() {
  86. get_data("fcBiFactoryDaily/list?type=1" , history_success);
  87. }
  88. function get_stop_scheudle() {
  89. location.href='denglu.html';
  90. }
  91. function realtime_success(obj, sta) {
  92. var output = first_parse(this, obj);
  93. //在这里排序 spo\
  94. if(showNetwork) console.log(" output : ");
  95. if(showNetwork) console.log(output);
  96. var i, j, k, z;
  97. failnum = 0;
  98. var x = 0;
  99. var worksum = [];
  100. var hhp = 0, hhf = 0, hhs = 0;
  101. if (output.list.length > 0) {
  102. flowIds[0] = output.list[0].scheduleId;
  103. passNumber[0] = 0;
  104. failNumber[0] = 0;
  105. stackeverynum[0] = 0;
  106. z = 0;
  107. for (i = 1; i < output.list.length; i++) {
  108. var thisUid = output.list[i].scheduleId;
  109. x = 0;
  110. for (j = 0; j < flowIds.length; j++) {
  111. if (flowIds[j] === thisUid) {
  112. x = 1;
  113. break;
  114. }
  115. }
  116. if (x === 0) {
  117. flowIds.push(thisUid);
  118. }
  119. }
  120. j = 0;
  121. for (k = 0; k < flowIds.length; k++) {
  122. var uid = flowIds[k];
  123. z = 0;
  124. passNumber[k] = 0;
  125. failNumber[k] = 0;
  126. stackeverynum[k] = 0;
  127. for (i = 0; i < output.list.length; i++) {
  128. if (uid === output.list[i].scheduleId) {
  129. passNumber[k] = output.list[i].passNum + passNumber[k];
  130. failNumber[k] = output.list[i].failNum + failNumber[k];
  131. stackeverynum[k] = output.list[i].due + stackeverynum[k];
  132. z++;
  133. }
  134. }
  135. if (failNumber[k] + passNumber[k] == 0) {
  136. failrate[k] = 0;
  137. } else {
  138. failrate[k] = Math.floor(failNumber[k] / (failNumber[k] + passNumber[k]) * 10000) / 100
  139. }
  140. /*stackeverynum[k]=stackeverynum[k]/z;*/
  141. ///
  142. }
  143. output.list.forEach(function (val, fid, arr) {
  144. hhp += val.passNum;
  145. hhf += val.failNum;
  146. hhs += val.due;
  147. })
  148. }
  149. hispass[0] = hhp;
  150. hisfail[0] = hhf;
  151. if (output.list.length > 0) {
  152. hisstack[0] = hhs / output.list.length;
  153. } else {
  154. hisstack[0] = 0;
  155. }
  156. schedulepass = hhp;
  157. schedulefail = hhf;
  158. if (output.list.length > 0) {
  159. schedulestack = hhs / output.list.length;
  160. } else {
  161. schedulestack = 0;
  162. }
  163. update_all_history();
  164. updateChart();
  165. }