lazhang.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  6. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  7. <title>流水线管理页</title>
  8. <!-- Favicon-->
  9. <link rel="icon" href="favicon.ico" type="image/x-icon">
  10. <!-- Google Fonts -->
  11. <link href="css/cyllic.css" rel="stylesheet" type="text/css">
  12. <link href="css/mateial.css" rel="stylesheet" type="text/css">
  13. <!-- Bootstrap Core Css -->
  14. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css"
  15. integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  16. <!-- Waves Effect Css -->
  17. <link href="plugins/node-waves/waves.css" rel="stylesheet"/>
  18. <!-- Animation Css -->
  19. <link href="plugins/animate-css/animate.css" rel="stylesheet"/>
  20. <!-- Morris Chart Css-->
  21. <link href="plugins/morrisjs/morris.css" rel="stylesheet"/>
  22. <!-- Custom Css -->
  23. <link href="css/style.css" rel="stylesheet">
  24. <!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes -->
  25. <link href="css/themes/all-themes.css" rel="stylesheet"/>
  26. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  27. <script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js"
  28. integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
  29. crossorigin="anonymous"></script>
  30. <script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js"
  31. integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
  32. crossorigin="anonymous"></script>
  33. <link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">
  34. <meta name="viewport" content="width=device-width, initial-scale=1">
  35. <style>
  36. /* css 代码 */
  37. </style>
  38. <script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
  39. <script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
  40. <script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
  41. <script src="https://img.hcharts.cn/highcharts/themes/dark-unica.js"></script>
  42. <script language="JavaScript">
  43. function startTime()
  44. {
  45. var today=new Date();//定义日期对象
  46. var yyyy = today.getFullYear();//通过日期对象的getFullYear()方法返回年
  47. var MM = today.getMonth()+1;//通过日期对象的getMonth()方法返回年
  48. var dd = today.getDate();//通过日期对象的getDate()方法返回年
  49. var hh=today.getHours();//通过日期对象的getHours方法返回小时
  50. var mm=today.getMinutes();//通过日期对象的getMinutes方法返回分钟
  51. var ss=today.getSeconds();//通过日期对象的getSeconds方法返回秒
  52. // 如果分钟或小时的值小于10,则在其值前加0,比如如果时间是下午3点20分9秒的话,则显示15:20:09
  53. MM=checkTime(MM);
  54. dd=checkTime(dd);
  55. mm=checkTime(mm);
  56. ss=checkTime(ss);
  57. var day; //用于保存星期(getDay()方法得到星期编号)
  58. if(today.getDay()==0) day = "星期日 "
  59. if(today.getDay()==1) day = "星期一 "
  60. if(today.getDay()==2) day = "星期二 "
  61. if(today.getDay()==3) day = "星期三 "
  62. if(today.getDay()==4) day = "星期四 "
  63. if(today.getDay()==5) day = "星期五 "
  64. if(today.getDay()==6) day = "星期六 "
  65. document.getElementById('nowDateTimeSpan').innerHTML=yyyy+"-"+MM +"-"+ dd +" " + hh+":"+mm+":"+ss+" " + day;
  66. setTimeout('startTime()',1000);//每一秒中重新加载startTime()方法
  67. }
  68. function checkTime(i)
  69. {
  70. if (i<10){
  71. i="0" + i;
  72. }
  73. return i;
  74. }
  75. </script>
  76. </head>
  77. <body class="theme-black" style="background-color: #17253f !important;" onload="startTime()">
  78. <nav class="navbar" style="background-color: red">
  79. <div class="container-fluid">
  80. <div class="navbar-header">
  81. <a class="navbar-brand" href="index.html">工厂产能监控系统</a>
  82. </div>
  83. <div style="color: #ffffff"><img src="images/logo.jpg" style="width: 10%"> 深圳市度彼电子有限公司——</div>
  84. <font color="#ffffff"><span id="nowDateTimeSpan"></span></font>
  85. </div>
  86. </nav>
  87. <section style="margin-top: 100px;color: #ffffff" style-height="20">
  88. <div style="width: 38%;float: left">
  89. <div class="text-center">本拉产能统计</div>
  90. <table class="table table-bordered text-center" style="color: #ffffff">
  91. <thead>
  92. <tr>
  93. <th scope="col">时间</th>
  94. <th scope="col">良品数</th>
  95. <th scope="col">不良品数</th>
  96. <th scope="col">堆积数</th>
  97. <th scope="col">不良率</th>
  98. </tr>
  99. </thead>
  100. <tbody id="rank-one">
  101. </tbody>
  102. </table>
  103. </div>
  104. <div style="width: 60%;float: right">
  105. <div class="text-center">本厂今日生产能手榜</div>
  106. <table class="table table-bordered text-center" style="color: #ffffff;width: 50%;float: left" >
  107. <thead>
  108. <tr >
  109. <th scope="col" colspan="4">红榜</th>
  110. </tr>
  111. <tr >
  112. <th >人员</th>
  113. <th >良品数</th>
  114. <th >人员</th>
  115. <th >不良率</th>
  116. </tr>
  117. </thead>
  118. <tbody id="rank-two">
  119. <tr>
  120. <th scope="row">1</th>
  121. <td>Mark</td>
  122. <td>Otto</td>
  123. <td>@mdo</td>
  124. </tr>
  125. <tr>
  126. <th scope="row">2</th>
  127. <td>Jacob</td>
  128. <td>Thornton</td>
  129. <td>@fat</td>
  130. </tr>
  131. <tr>
  132. <th scope="row">2</th>
  133. <td>Jacob</td>
  134. <td>Thornton</td>
  135. <td>@fat</td>
  136. </tr>
  137. <tr>
  138. <th scope="row">3</th>
  139. <td>Larry</td>
  140. <td>the Bird</td>
  141. <td>@twitter</td>
  142. </tr>
  143. </tbody>
  144. </table>
  145. <table class="table table-bordered text-center" style="color: #ffffff;width: 50%;float: right" >
  146. <thead>
  147. <tr >
  148. <th scope="col" colspan="4">黑榜</th>
  149. </tr>
  150. <tr >
  151. <th >人员</th>
  152. <th >良品数</th>
  153. <th >人员</th>
  154. <th >不良率</th>
  155. </tr>
  156. </thead>
  157. <tbody id="rank-three">
  158. <tr>
  159. <th scope="row">1</th>
  160. <td>Mark</td>
  161. <td>Otto</td>
  162. <td>@mdo</td>
  163. </tr>
  164. <tr>
  165. <th scope="row">2</th>
  166. <td>Jacob</td>
  167. <td>Thornton</td>
  168. <td>@fat</td>
  169. </tr>
  170. <tr>
  171. <th scope="row">2</th>
  172. <td>Jacob</td>
  173. <td>Thornton</td>
  174. <td>@fat</td>
  175. </tr>
  176. <tr>
  177. <th scope="row">3</th>
  178. <td>Larry</td>
  179. <td>the Bird</td>
  180. <td>@twitter</td>
  181. </tr>
  182. </tbody>
  183. </table>
  184. </div>
  185. </section>
  186. <div class="row" style-height="50-8">
  187. <div id="graph-1"></div>
  188. <div class="row " style="height: 10em"></div>
  189. <div class="row" style-height="">
  190. <div id="graph-2"></div>
  191. </div>
  192. </div>
  193. <!-- Jquery Core Js -->
  194. <script src="plugins/jquery/jquery.min.js"></script>
  195. <!-- Bootstrap Core Js -->
  196. <script src="plugins/bootstrap/js/bootstrap.js"></script>
  197. <!-- Select Plugin Js -->
  198. <script src="plugins/bootstrap-select/js/bootstrap-select.js"></script>
  199. <!-- Slimscroll Plugin Js -->
  200. <script src="plugins/jquery-slimscroll/jquery.slimscroll.js"></script>
  201. <!-- Waves Effect Plugin Js -->
  202. <script src="plugins/node-waves/waves.js"></script>
  203. <!-- Jquery CountTo Plugin Js -->
  204. <script src="plugins/jquery-countto/jquery.countTo.js"></script>
  205. <!-- Morris Plugin Js -->
  206. <script src="plugins/raphael/raphael.min.js"></script>
  207. <script src="plugins/morrisjs/morris.js"></script>
  208. <!-- ChartJs -->
  209. <script src="plugins/chartjs/Chart.bundle.js"></script>
  210. <!-- Flot Charts Plugin Js -->
  211. <script src="plugins/flot-charts/jquery.flot.js"></script>
  212. <script src="plugins/flot-charts/jquery.flot.resize.js"></script>
  213. <script src="plugins/flot-charts/jquery.flot.pie.js"></script>
  214. <script src="plugins/flot-charts/jquery.flot.categories.js"></script>
  215. <script src="plugins/flot-charts/jquery.flot.time.js"></script>
  216. <!-- Sparkline Chart Plugin Js -->
  217. <script src="plugins/jquery-sparkline/jquery.sparkline.js"></script>
  218. <!-- Custom Js -->
  219. <script src="js/admin.js"></script>
  220. <!--<script src="js/pages/index.js"></script>-->
  221. <!-- Demo Js -->
  222. <script src="js/demo.js"></script>
  223. <script src="js/basic.js"></script>
  224. <script src="js/getparam.js"></script>
  225. <script>
  226. var timeday=["今日" ,"昨日" ,"本周" ,"本月"];
  227. function getSpotHtml(htmlbody, i) {
  228. htmlbody += "<tr>";
  229. htmlbody += `<tr>
  230. <td>${timeday[i]}</td>
  231. <td>${hispass[i]}</td>
  232. <td>${hisfail[i]}</td>
  233. <td>${hisstack[i]}</td>
  234. <td>${hisrate[i]+'%'}</td>
  235. </tr>`;
  236. htmlbody += "</tr>";
  237. return htmlbody;
  238. }
  239. function getSpotHtml1(htmlbody, i) {
  240. htmlbody += "<tr>";
  241. htmlbody += `<tr>
  242. <td>${goodid[i]}</td>
  243. <td>${goodpass[i]}</td>
  244. <td>${goodid[i]}</td>
  245. <td>${goodfailrate[i]+'%'}</td>
  246. </tr>`;
  247. htmlbody += "</tr>";
  248. return htmlbody;
  249. }
  250. function getSpotHtml2(htmlbody, i) {
  251. htmlbody += "<tr>";
  252. htmlbody += `<tr>
  253. <td>${badid[i]}</td>
  254. <td>${badpass[i]}</td>
  255. <td>${badid[i]}</td>
  256. <td>${badfailrate[i]+'%'}</td>
  257. </tr>`;
  258. htmlbody += "</tr>";
  259. return htmlbody;
  260. }
  261. function showEachSpot() {
  262. var htmlbody = "", one_person = "";
  263. var i = 0;
  264. var triGap = 4;
  265. htmlbody = "";
  266. for (i = 0; i < triGap; i++) {
  267. htmlbody = getSpotHtml(htmlbody, i);
  268. }
  269. $("#rank-one").html(htmlbody);
  270. //console.log(htmlbody);
  271. }
  272. function showEachSpot1() {
  273. var htmlbody = "", one_person = "";
  274. var i = 0;
  275. var triGap = 3;
  276. htmlbody = "";
  277. for (i = 0; i < triGap; i++) {
  278. htmlbody = getSpotHtml1(htmlbody, i);
  279. }
  280. $("#rank-two").html(htmlbody);
  281. //console.log(htmlbody);
  282. }
  283. function showEachSpot2() {
  284. var htmlbody = "", one_person = "";
  285. var i = 0;
  286. var triGap = 3;
  287. htmlbody = "";
  288. for (i = 0; i < triGap; i++) {
  289. htmlbody = getSpotHtml2(htmlbody, i);
  290. }
  291. $("#rank-three").html(htmlbody);
  292. //console.log(htmlbody);
  293. }
  294. function showChart() {
  295. var data = [];
  296. var ratedata = [];
  297. var stackmax = 0;
  298. var failmax = 0;
  299. var passdata=[];
  300. var faildata=[];
  301. var passmax=0;
  302. for (i = 0; i < passNumber.length; i++) {
  303. if (stackmax < stackeverynum[i]) {
  304. stackmax = stackeverynum[i];
  305. }
  306. if (failmax < failrate[i]) {
  307. failmax = failrate[i];
  308. }
  309. if(passmax<passNumber[i]){
  310. passmax=passNumber[i];
  311. }
  312. data.push(stackeverynum[i]);
  313. ratedata.push(Math.floor(failrate[i]));
  314. passdata.push(passNumber[i]);
  315. faildata.push(failNumber[i])
  316. }
  317. showEachSpot();
  318. showEachSpot1();
  319. showEachSpot2();
  320. stackmax = Math.max(stackmax, 5);
  321. failmax = Math.max(failmax, 5);
  322. stackAndFailChart = Highcharts.chart('graph-1', {
  323. chart: {
  324. zoomType: 'xy',
  325. height: (4 / 16 * 100) + '%' // 16:9 ratio
  326. },
  327. title: {
  328. text: '各工位今日产能'
  329. },
  330. credits: {
  331. enabled: false // 禁用版权信息
  332. },
  333. exporting: {
  334. enabled: false
  335. },
  336. xAxis: [{
  337. categories: namedata,
  338. crosshair: true,
  339. title: {
  340. text: '员工',
  341. style: {
  342. fontSize: '1.5em'
  343. }
  344. },
  345. labels: {
  346. style: {
  347. fontSize: '1.5em'
  348. }
  349. }
  350. }],
  351. yAxis: [{ // Primary yAxis
  352. labels: {
  353. format: '{value}',
  354. style: {
  355. color: Highcharts.getOptions().colors[0],
  356. fontSize: '1.5em'
  357. }
  358. },
  359. min: 0,
  360. max: passmax*1.5,
  361. title: {
  362. style: {
  363. color: Highcharts.getOptions().colors[0],
  364. fontSize: '1em'
  365. }
  366. }
  367. },
  368. ],
  369. tooltip: {
  370. shared: true
  371. },
  372. legend: {
  373. layout: 'vertical',
  374. align: 'right',
  375. x: -100,
  376. verticalAlign: 'top',
  377. y: 0,
  378. floating: true,
  379. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  380. },
  381. series: [{
  382. name: '良品数',
  383. type: 'column',
  384. data: passdata,
  385. }, {
  386. name: '不良品数',
  387. type: 'column',
  388. data: faildata,
  389. },
  390. {
  391. name: '堆积数',
  392. type: 'column',
  393. data: data,
  394. },]
  395. });
  396. FailChart = Highcharts.chart('graph-2', {
  397. chart: {
  398. height: (4 / 16 * 100) + '%' // 16:9 ratio
  399. },
  400. title: {
  401. text: '各工位今日不良率'
  402. },
  403. credits: {
  404. enabled: false // 禁用版权信息
  405. },
  406. exporting: {
  407. enabled: false
  408. },
  409. xAxis: [{
  410. categories: namedata,
  411. crosshair: true,
  412. title: {
  413. text: '员工',
  414. style: {
  415. fontSize: '1.5em'
  416. }
  417. },
  418. labels: {
  419. style: {
  420. fontSize: '1.5em'
  421. }
  422. }
  423. }],
  424. yAxis: [ { // Secondary yAxis
  425. title: {
  426. text: '不良率',
  427. style: {
  428. color: 'red',
  429. fontSize: '1em'
  430. }
  431. },
  432. min: 0,
  433. max: 1.5 * failmax,
  434. labels: {
  435. formatter: function () {
  436. return Math.floor(this.value) + "%";
  437. },
  438. style: {
  439. color: 'red',
  440. fontSize: '20px'
  441. }
  442. },
  443. }],
  444. tooltip: {
  445. shared: true
  446. },
  447. legend: {
  448. layout: 'vertical',
  449. align: 'right',
  450. x: -120,
  451. verticalAlign: 'top',
  452. y: 0,
  453. floating: true,
  454. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
  455. },
  456. series: [{
  457. name: '不良率',
  458. type: 'spline',
  459. data: ratedata,
  460. color: 'red',
  461. tooltip: {
  462. valueSuffix: '%'
  463. }
  464. }]
  465. });
  466. }
  467. function updateChart() {
  468. var data = [];
  469. var ratedata = [];
  470. var stackmax = 0;
  471. var failmax = 0;
  472. var passdata=[];
  473. var faildata=[];
  474. var passmax=0;
  475. for (i = 0; i < passNumber.length; i++) {
  476. if (stackmax < stackeverynum[i]) {
  477. stackmax = stackeverynum[i];
  478. }
  479. if (failmax < failrate[i]) {
  480. failmax = failrate[i];
  481. }
  482. if(passmax<passNumber[i]){
  483. passmax=passNumber[i];
  484. }
  485. data.push(stackeverynum[i]);
  486. ratedata.push(Math.floor(failrate[i]));
  487. passdata.push(passNumber[i]);
  488. faildata.push(failNumber[i])
  489. }
  490. stackmax = Math.max(stackmax, 5);
  491. failmax = Math.max(failmax, 5);
  492. // https://api.hcharts.cn/highcharts#Series.addPoint;
  493. stackAndFailChart.series[0].setData(passdata);
  494. stackAndFailChart.series[1].setData(faildata);
  495. stackAndFailChart.series[2].setData(data);
  496. FailChart.series[0].setData(ratedata);
  497. if(failmax > FailChart.yAxis[0].getExtremes().max * 1.3 || failmax < FailChart.yAxis[0].getExtremes().max * 0.5) {
  498. FailChart.yAxis[0].setExtremes(0, failmax*1.5);
  499. }
  500. if(passmax>stackAndFailChart.yAxis[0].getExtremes().max*1.3 || passmax<stackAndFailChart.yAxis[0].getExtremes().max*0.5) {
  501. stackAndFailChart.yAxis[0].setExtremes(0, passmax*1.5);
  502. }
  503. showEachSpot();
  504. showEachSpot1();
  505. showEachSpot2();
  506. }
  507. var stackAndFailChart = null;
  508. var FailChart = null;
  509. $(document).ready(on_document_load);
  510. window.onresize = resizeAll;
  511. function resizeAll() {
  512. $('[style-height="10"]').height(window.innerHeight / 10);
  513. $('[style-height="20"]').each(function(one,items){$(items).height(window.innerHeight / 5)});
  514. $('[style-height="30"]').each(function(one,items){$(items).height(window.innerHeight * 0.4)});
  515. $('[style-height="40"]').height(window.innerHeight *0.4);
  516. $('[style-height="30-8"]').height(window.innerHeight * 0.4 - 220);
  517. $('[style-height="30-1"]').each(function(one,items){$(items).height(window.innerHeight * 0.3)});
  518. $('[style-height="30-2"]').each(function(one,items){$(items).height(window.innerHeight * 0.2)});
  519. $('[style-height="50-8"]').each(function(one,items){$(items).height(window.innerHeight * 0.5)});
  520. var graph = $("#graph-1");
  521. graph.width(window.innerWidth - 35);
  522. graph.height(window.innerHeight *0.2);
  523. if (graph.highcharts !== undefined) {
  524. graph.highcharts().reflow();
  525. }
  526. var graph = $("#graph-2");
  527. graph.width(window.innerWidth - 35);
  528. graph.height(window.innerHeight *0.2);
  529. if (graph.highcharts !== undefined) {
  530. graph.highcharts().reflow();
  531. }
  532. }
  533. setInterval(function () {
  534. resizeAll();
  535. }, 5000);
  536. resizeAll();
  537. //startClock();
  538. </script>
  539. </body>
  540. </html>
  541. <!---
  542. ### SVR_BASE 类似 "http://127.0.0.1:8803" 实际上线之后是确定值,写死在HTML里的JS里面
  543. ### 各个拉实时产量数据接口地址
  544. SVR_BASE + "/server/fcWorkRaw/allFlows"
  545. ### 单个拉内,所有工位实时产量数据接口地址 e.g. 拉线ID = 2
  546. SVR_BASE + "/server/fcWorkRaw/allSpots" + "?" + "flowId=2"
  547. ### 员工上班记录API e.g. 拉线ID = 2 工位顺序 = 1 员工ID = 33404
  548. SVR_BASE + "/server/fcWorkStartend/goOnline" + "?" + "flowId=2&sequence=1&workerId=33404"
  549. ### 查询已上班员工 e.g. 拉线ID = 2
  550. SVR_BASE + "/server/fcWorkRaw/getAll" + "?" + "flowId=2"
  551. -->