dapingmu.js 5.7 KB

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