index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="shortcut icon" href="/img/logo.png" />
  7. <link rel="bookmark" href="/img/logo.png" />
  8. <link rel="stylesheet" href="../DashBoard.css?v3" />
  9. <script src="/Plugins/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  10. <script src="/Plugins/xrequest/xrequest.min.js"></script>
  11. <script src="/Plugins/xcountto/xcountTo2.js"></script>
  12. <title>东科软件</title>
  13. </head>
  14. <body>
  15. <div class="m4_box_1920_1080">
  16. <div class="m4_box_title" onclick="showHelp()" style="cursor:pointer">
  17. <div class="m4_box_title_arrow"></div><div class="m4_box_title_arrow2"></div> <div>施釉工艺</div><span class="m4_box_title_loading" id="报表加载"></span>
  18. </div>
  19. <div class="m4_box_body">
  20. <div style="width:1720px;height:410px;display:flex;flex-direction:row;">
  21. <div style="width: 1335px;height:410px;">
  22. <!--1号机器人流量-->
  23. <canvas id="canvasRobot1" style="-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none; height:410px;width:100%"></canvas>
  24. </div>
  25. <div style="width: 385px; height: 390px; padding-left:20px;">
  26. <!--流量-->
  27. <table cellspacing="0" cellpadding="0" border="0" style="width:100%;">
  28. <tr class="tr_title_warning">
  29. <td>平均流量 l/h</td>
  30. <td>累计流量 l </td>
  31. </tr>
  32. <tr class="tr_bg_light_warning" style="height:140px;">
  33. <td id="agv1" data-decimals="2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  34. <td id="sum1" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  35. </tr>
  36. </table>
  37. </div>
  38. </div>
  39. <div style="width:1720px;height:410px;display:flex;flex-direction:row;">
  40. <div style="width: 1335px;height:410px;">
  41. <!--2号机器人流量-->
  42. <canvas id="canvasRobot2" style="-moz-user-select: none;-webkit-user-select: none;-ms-user-select: none; height:410px;width:100%"></canvas>
  43. </div>
  44. <div style="width: 385px; height: 390px; padding-left:20px;">
  45. <!--流量-->
  46. <table cellspacing="0" cellpadding="0" border="0" style="width:100%;">
  47. <tr class="tr_title_warning">
  48. <td>平均流量 l/h</td>
  49. <td>累计流量 l </td>
  50. </tr>
  51. <tr class="tr_bg_light_warning" style="height:140px;">
  52. <td id="agv2" data-decimals="2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  53. <td id="sum2" data-speed="2000" style="font-size: 40px; width: 50%"></td>
  54. </tr>
  55. </table>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <script>
  61. //缺陷统计刷新时间
  62. var refreshTime1 = 60000;
  63. var currentTime1 = 0;
  64. var doGetData;
  65. var doGetTime;
  66. var frameHeight;
  67. var tableHeight;
  68. var offsetHeight = 20;
  69. $(document).ready(function () {
  70. initData();
  71. doGetData = setInterval(function () { timeUpdate(); }, 1000);
  72. });
  73. //帮助说明
  74. function showHelp() {
  75. var message = "统计说明:" + "\n";
  76. message += "施釉机器人1号平均流量:喷釉房号是1#,在3#施釉工序的平均流量" + "\n";
  77. message += "施釉机器人1号累计流量:喷釉房号是1#,在3#施釉工序的累计流量" + "\n";
  78. message += "施釉机器人2号平均流量:喷釉房号是2#,在3#施釉工序的平均流量" + "\n";
  79. message += "施釉机器人2号累计流量:喷釉房号是2#,在3#施釉工序的累计流量" + "\n";
  80. alert(message);
  81. }
  82. function timeUpdate() {
  83. if (currentTime1 <= 0) {
  84. //clearData();
  85. loadData();
  86. currentTime1 = refreshTime1;
  87. }
  88. else {
  89. if (currentTime1 > 0) {
  90. $('#报表加载').html('刷新:' + currentTime1 / 1000 + ' 秒');
  91. currentTime1 = currentTime1 - 1000;
  92. }
  93. }
  94. }
  95. function clearData() {
  96. //清除数据
  97. //工序产量===================================
  98. //window.Robot1.data.labels = ['', '', '', '', '', '', ''];
  99. window.Robot1.data.datasets[1].data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  100. window.Robot1.update();
  101. //===================================================
  102. //window.Robot2.data.labels = ['', '', '', '', '', '', ''];
  103. window.Robot2.data.datasets[1].data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  104. window.Robot2.update();
  105. }
  106. function loadData() {
  107. $.get("rpt.ashx?m=1", function (data) {
  108. var jsondata = JSON.parse(data);
  109. if (jsondata["success"] == true) {
  110. for (var i = 0; i < jsondata["rows"].length; i++) {
  111. window.Robot1.data.labels[i] = jsondata["rows"][i]["时间"];
  112. window.Robot1.data.datasets[0].data[i] = 1.00;
  113. window.Robot1.data.datasets[1].data[i] = jsondata["rows"][i]["流量"];
  114. window.Robot1.data.datasets[2].data[i] = 1.60;
  115. }
  116. var myDate = new Date();
  117. for (var j = myDate.getHours() + 1; j < 24; j++) {
  118. window.Robot1.data.datasets[1].data[j] = null;
  119. }
  120. window.Robot1.update();
  121. }
  122. });
  123. $.get("rpt.ashx?m=2", function (data) {
  124. var jsondata = JSON.parse(data);
  125. if (jsondata["success"] == true) {
  126. for (var i = 0; i < jsondata["rows"].length; i++) {
  127. window.Robot2.data.labels[i] = jsondata["rows"][i]["时间"];
  128. window.Robot2.data.datasets[0].data[i] = 1.00;
  129. window.Robot2.data.datasets[1].data[i] = jsondata["rows"][i]["流量"];
  130. window.Robot2.data.datasets[2].data[i] = 1.60;
  131. }
  132. var myDate = new Date();
  133. for (var j = myDate.getHours() + 1; j < 24; j++) {
  134. window.Robot2.data.datasets[1].data[j] = null;
  135. }
  136. window.Robot2.update();
  137. }
  138. });
  139. $.get("rpt.ashx?m=table1", function (data) {
  140. var jsondata = JSON.parse(data);
  141. if (jsondata["success"] == true) {
  142. $("#agv1").attr('data-to', jsondata["rows"][0]["平均流量"]);
  143. $("#agv1").countTo();
  144. $("#sum1").attr('data-to', jsondata["rows"][0]["累计流量"]);
  145. $("#sum1").countTo();
  146. }
  147. });
  148. $.get("rpt.ashx?m=table2", function (data) {
  149. var jsondata = JSON.parse(data);
  150. if (jsondata["success"] == true) {
  151. $("#agv2").attr('data-to', jsondata["rows"][0]["平均流量"]);
  152. $("#agv2").countTo();
  153. $("#sum2").attr('data-to', jsondata["rows"][0]["累计流量"]);
  154. $("#sum2").countTo();
  155. }
  156. });
  157. ////机器人1=========================================
  158. //window.Robot1.data.datasets[0].data = [
  159. // 50,
  160. // 50,
  161. // 50,
  162. // 50,
  163. // 50,
  164. // 50,
  165. // 50
  166. //];
  167. //window.Robot1.data.datasets[1].data = [
  168. // randomScalingFactor(200) + 110,
  169. // randomScalingFactor(200) + 110,
  170. // randomScalingFactor(200) + 110,
  171. // randomScalingFactor(200) + 110,
  172. // randomScalingFactor(200) + 110,
  173. // randomScalingFactor(200) + 110,
  174. // randomScalingFactor(200) + 110
  175. //];
  176. //window.Robot1.data.datasets[2].data = [
  177. // 350,
  178. // 350,
  179. // 350,
  180. // 350,
  181. // 350,
  182. // 350,
  183. // 350
  184. //];
  185. //window.Robot1.update();
  186. ////===================================================
  187. ////机器人2=========================================
  188. //window.Robot2.data.datasets[0].data = [
  189. // 50,
  190. // 50,
  191. // 50,
  192. // 50,
  193. // 50,
  194. // 50,
  195. // 50
  196. //];
  197. //window.Robot2.data.datasets[1].data = [
  198. // randomScalingFactor(200) + 110,
  199. // randomScalingFactor(200) + 110,
  200. // randomScalingFactor(200) + 110,
  201. // randomScalingFactor(200) + 110,
  202. // randomScalingFactor(200) + 110,
  203. // randomScalingFactor(200) + 110,
  204. // randomScalingFactor(200) + 110
  205. //];
  206. //window.Robot2.data.datasets[2].data = [
  207. // 350,
  208. // 350,
  209. // 350,
  210. // 350,
  211. // 350,
  212. // 350,
  213. // 350
  214. //];
  215. //window.Robot2.update();
  216. ////===================================================
  217. }
  218. function initData() {
  219. window.chartColors = {
  220. red: 'rgb(255, 99, 132)',
  221. orange: 'rgb(255, 159, 64)',
  222. yellow: 'rgb(255, 250, 86)',
  223. green: 'rgb(75, 192, 192)',
  224. blue: 'rgb(54, 162, 250)',
  225. purple: 'rgb(153, 102, 255)',
  226. grey: 'rgb(231,233,237)'
  227. };
  228. var color = Chart.helpers.color;
  229. window.randomScalingFactor = function (num) {
  230. return Math.round(Math.random() * num);
  231. }
  232. Chart.defaults.global.defaultFontColor = 'white';
  233. Chart.defaults.global.defaultFontSize = 24;
  234. Chart.defaults.global.legend.display = false;
  235. //机器人1===========================================
  236. window.configRobot1 = {
  237. data: {
  238. labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
  239. datasets: [{
  240. label: '最低预警线',
  241. backgroundColor: color(window.chartColors.orange).alpha(0.6).rgbString(),
  242. fill: false,
  243. borderColor: window.chartColors.orange,
  244. borderWidth: 2,
  245. pointRadius: 10,
  246. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  247. },
  248. {
  249. label: '施釉机器人(1号)',
  250. backgroundColor: color(window.chartColors.blue).alpha(0.6).rgbString(),
  251. fill: false,
  252. borderColor: window.chartColors.blue,
  253. borderWidth: 2,
  254. pointRadius: 15,
  255. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  256. },
  257. {
  258. label: '最高预警线',
  259. backgroundColor: color(window.chartColors.red).alpha(0.6).rgbString(),
  260. fill: false,
  261. borderColor: window.chartColors.red,
  262. borderWidth: 2,
  263. pointRadius: 10,
  264. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  265. }
  266. ]
  267. },
  268. type: 'line',
  269. options: {
  270. legend: {
  271. display: true
  272. },
  273. title: {
  274. display: true,
  275. text: "施釉机器人(1号)流量统计"
  276. },
  277. tooltips: {
  278. mode: 'point',
  279. intersect: false
  280. },
  281. responsive: true,
  282. scales: {
  283. xAxes: [{
  284. stacked: false
  285. }],
  286. yAxes: [{
  287. display: true,
  288. stacked: false,
  289. ticks: {
  290. min: 1.0,
  291. stepSize: 0.1,
  292. max: 1.8
  293. }
  294. }]
  295. }
  296. }
  297. };
  298. var ctxRobot1 = document.getElementById("canvasRobot1").getContext("2d");
  299. window.Robot1 = new Chart(ctxRobot1, configRobot1);
  300. //===================================================
  301. //机器人2===========================================
  302. window.configRobot2 = {
  303. data: {
  304. labels: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
  305. datasets: [{
  306. label: '最低预警线',
  307. backgroundColor: color(window.chartColors.orange).alpha(0.6).rgbString(),
  308. fill: false,
  309. borderColor: window.chartColors.orange,
  310. borderWidth: 2,
  311. pointRadius: 10,
  312. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  313. },
  314. {
  315. label: '施釉机器人(2号)',
  316. backgroundColor: color(window.chartColors.blue).alpha(0.6).rgbString(),
  317. fill: false,
  318. borderColor: window.chartColors.blue,
  319. borderWidth: 2,
  320. pointRadius: 15,
  321. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  322. },
  323. {
  324. label: '最高预警线',
  325. backgroundColor: color(window.chartColors.red).alpha(0.6).rgbString(),
  326. fill: false,
  327. borderColor: window.chartColors.red,
  328. borderWidth: 2,
  329. pointRadius: 10,
  330. data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  331. }
  332. ]
  333. },
  334. type: 'line',
  335. options: {
  336. legend: {
  337. display: true
  338. },
  339. title: {
  340. display: true,
  341. text: "施釉机器人(2号)流量统计"
  342. },
  343. tooltips: {
  344. mode: 'point',
  345. intersect: false
  346. },
  347. responsive: true,
  348. scales: {
  349. xAxes: [{
  350. stacked: false
  351. }],
  352. yAxes: [{
  353. display: true,
  354. stacked: false,
  355. ticks: {
  356. min: 1.0,
  357. stepSize: 0.1,
  358. max: 1.8
  359. }
  360. }]
  361. }
  362. }
  363. };
  364. var ctxRobot2 = document.getElementById("canvasRobot2").getContext("2d");
  365. window.Robot2 = new Chart(ctxRobot2, configRobot2);
  366. //===================================================
  367. }
  368. </script>
  369. <script src="/Plugins/chartjs-2.8.0/chart-2.8.min.js"></script>
  370. <!--<script src="/Plugins/chartjs-2.8.0/chartjs-plugin-datalabels.js"></script>-->
  371. <script src="/Plugins/chartjs-2.8.0/utils.js"></script>
  372. <script src="/Plugins/circleChart/circleChart.min.js"></script>
  373. </body>
  374. </html>