dry_0721ajax backup.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Smart Coffee - dry</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--
  16. <script src="../static/js/sign_in.js"></script>
  17. <link rel="stylesheet" href="../static/css/sign_in.css">
  18. -->
  19. <style>
  20. .D1_position {
  21. position: absolute;
  22. top: 135px;
  23. left: 210px;
  24. width: 175px;
  25. height: 230px;
  26. border-style: solid;
  27. border-color: aqua;
  28. }
  29. .D2_position {
  30. position: absolute;
  31. top: 135px;
  32. left: 400px;
  33. width: 175px;
  34. height: 230px;
  35. border-style: solid;
  36. border-color: aqua;
  37. }
  38. .D3_position {
  39. position: absolute;
  40. top: 135px;
  41. left: 590px;
  42. width: 170px;
  43. height: 230px;
  44. border-style: solid;
  45. border-color: aqua;
  46. }
  47. .D4_position {
  48. position: absolute;
  49. top: 135px;
  50. left: 785px;
  51. width: 165px;
  52. height: 230px;
  53. border-style: solid;
  54. border-color: aqua;
  55. }
  56. .D5_position {
  57. position: absolute;
  58. top: 135px;
  59. left: 965px;
  60. width: 165px;
  61. height: 230px;
  62. border-style: solid;
  63. border-color: aqua;
  64. }
  65. .D6_position {
  66. position: absolute;
  67. top: 135px;
  68. left: 1155px;
  69. width: 165px;
  70. height: 230px;
  71. border-style: solid;
  72. border-color: aqua;
  73. }
  74. </style>
  75. <script language="JavaScript">
  76. // 指定 10秒 刷新網頁一次
  77. var WebRestart
  78. // WebRestart = setTimeout(function () { location.reload() }, 10000);
  79. </script>
  80. <script>
  81. $('#D2').click(
  82. function () {
  83. $.get('/loading',
  84. '',
  85. function (res) {
  86. $("#SHT11_Temp_status").text(res.SHT11_Temp);
  87. },
  88. 'json'
  89. );
  90. }
  91. );
  92. function Peeling() {
  93. $.get('/loading', '', function (res) {
  94. //console.log(res.peeling);
  95. $("#SHT11_Temp_status").text(res.SHT11_Temp);
  96. }, 'json');
  97. };
  98. </script>
  99. </head>
  100. <body>
  101. <!--
  102. background-color:rgb(0, 238, 255);
  103. -->
  104. <div style="text-align: center; margin-top: 30px;font-size: 24px;">
  105. Smart Coffee
  106. </div>
  107. <div>
  108. <!-- 底圖 乾燥貨櫃 12 個乾燥桶槽 -->
  109. <center><img src="../static/img/web_dry_container.png" width="1500x" style="margin: auto;"></center>
  110. <!-- 乾燥槽 D1 START-->
  111. <div id="D1" tabindex="0" class="D1_position" role="button">
  112. D1
  113. status
  114. <!-- D1 狀態點點-->
  115. <div id="D1_status"
  116. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  117. </div>
  118. <!-- 乾燥槽 D1 END-->
  119. <!-- 乾燥槽 D2 -->
  120. <div id="D2" tabindex="0" class="D2_position" role="button">
  121. D2
  122. status
  123. <div id="D2_status"
  124. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  125. </div>
  126. <!-- 乾燥槽 D3 -->
  127. <div id="D3" tabindex="0" class="D3_position" role="button">
  128. D3
  129. status
  130. <div id="D3_status"
  131. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  132. </div>
  133. <!-- 乾燥槽 D4 -->
  134. <div id="D4" tabindex="0" class="D4_position" role="button">
  135. D4
  136. status
  137. <div id="D4_status"
  138. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  139. </div>
  140. <!-- 乾燥槽 D5 -->
  141. <div id="D5" tabindex="0" class="D5_position" role="button">
  142. D5
  143. status
  144. <div id="D5_status"
  145. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  146. </div>
  147. <!-- 乾燥槽 D6 -->
  148. <div id="D6" tabindex="0" class="D6_position" role="button">
  149. D6
  150. status
  151. <div id="D6_status"
  152. style="width: 20px; height: 20px; background-color: cornflowerblue; border-radius: 50%;"></div>
  153. </div>
  154. </div>
  155. <!-- 模态框 -->
  156. <div class="modal fade" id="D1_Modal">
  157. <div class="modal-dialog modal-dialog-centered" style="width: 400px;">
  158. <div class="modal-content">
  159. <div class="modal-header">
  160. <h4 id="Modal_title" class="modal-title">乾燥槽 D1 狀態</h4>
  161. <button type="button" class="close" data-dismiss="modal">&times;</button>
  162. </div>
  163. <!-- 模态框主体 -->
  164. <div class="modal-body">
  165. <table style="border:0px gray solid; width: 100%;" cellpadding="3">
  166. <!--<table style="border:0px gray solid;-->
  167. <tr>
  168. <td><strong><a href="/dry_container/1">制動器狀態</a></strong></td>
  169. <td><strong><a href="/dry_container/1">感測器狀態</a></strong></td>
  170. </tr>
  171. <tr>
  172. <td style="vertical-align:text-top;">
  173. <table style="border:0px gray solid;" cellpadding="3">
  174. <!--font-size:12px; -->
  175. <tr>
  176. <td>
  177. <div id="tank_vacuum_status"
  178. style="width: 18px; height: 18px; background-color:crimson; border-radius: 50%;">
  179. </div>
  180. </td>
  181. <td>
  182. 真空吸料機
  183. <span id="tank_vacuum_t_status"></span>
  184. </td>
  185. </tr>
  186. <tr>
  187. <td>
  188. {% if tank_3wayvalve=='ON' %}
  189. <div id="D1_threewwayvalve_status"
  190. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  191. </div>
  192. {% elif tank_3wayvalve=='OFF' %}
  193. <div id="D1_threewwayvalve_status"
  194. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  195. </div>
  196. {% else %}
  197. <div id="D1_threewwayvalve_status"
  198. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  199. </div>
  200. {% endif %}
  201. </td>
  202. <td>
  203. 三通閥
  204. <span id="tank_3wayvalve_t_status"></span>
  205. </td>
  206. </tr>
  207. <tr>
  208. <td>
  209. {% if tank_solenoid_disinfect=='ON' %}
  210. <div id="D1_solenoid_disinfect_status"
  211. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  212. </div>
  213. {% elif tank_solenoid_disinfect=='OFF' %}
  214. <div id="D1_solenoid_disinfect_status"
  215. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  216. </div>
  217. {% else %}
  218. <div id="D1_solenoid_disinfect_status"
  219. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  220. </div>
  221. {% endif %}
  222. </td>
  223. <td>
  224. 消毒電磁閥
  225. <span id="tank_solenoid_disinfect_t_status"></span>
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>
  230. {% if (tank_motor>0) or (0>tank_motor) %}
  231. <div id="D1_motor_status"
  232. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  233. </div>
  234. {% elif tank_motor==0 %}
  235. <div id="D1_motor_status"
  236. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  237. </div>
  238. {% else %}
  239. <div id="D1_motor_status"
  240. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  241. </div>
  242. {% endif %}
  243. </td>
  244. <td>
  245. 馬達
  246. <span id="tank_motor_t_status"></span>
  247. </td>
  248. </tr>
  249. <tr>
  250. <td>
  251. {% if tank_blower=='ON' %}
  252. <div id="D1_blower_status"
  253. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  254. </div>
  255. {% elif tank_blower=='OFF' %}
  256. <div id="D1_blower_status"
  257. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  258. </div>
  259. {% else %}
  260. <div id="D1_blower_status"
  261. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  262. </div>
  263. {% endif %}
  264. </td>
  265. <td>
  266. 鼓風機
  267. <span id="tank_blower_t_status"></span>
  268. </td>
  269. </tr>
  270. <tr>
  271. <td>
  272. {% if tank_heater1=='ON' %}
  273. <div id="D1_heater1_status"
  274. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  275. </div>
  276. {% elif tank_heater1=='OFF' %}
  277. <div id="D1_heater1_status"
  278. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  279. </div>
  280. {% else %}
  281. <div id="D1_heater1_status"
  282. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  283. </div>
  284. {% endif %}
  285. </td>
  286. <td>
  287. 加熱器 1
  288. <span id="tank_heater1_t_status"></span>
  289. </td>
  290. </tr>
  291. <tr>
  292. <td>
  293. {% if tank_heater2=='ON' %}
  294. <div id="D1_heater2_status"
  295. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  296. </div>
  297. {% elif tank_heater2=='OFF' %}
  298. <div id="D1_heater2_status"
  299. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  300. </div>
  301. {% else %}
  302. <div id="D1_heater2_status"
  303. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  304. </div>
  305. {% endif %}
  306. </td>
  307. <td>
  308. 加熱器 2
  309. <span id="tank_heater2_t_status"></span>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td>
  314. {% if tank_temp1_enable=='ON' %}
  315. <div id="D1_temp_enable_status"
  316. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  317. </div>
  318. {% elif tank_temp1_enable=='OFF' %}
  319. <div id="D1_temp_enable_status"
  320. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  321. </div>
  322. {% else %}
  323. <div id="D1_temp_enable_status"
  324. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  325. </div>
  326. {% endif %}
  327. </td>
  328. <td>
  329. 溫控開關
  330. <span id="tank_temp1_enable_t_status"></span>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td>
  335. {% if tank_temp1==0 %}
  336. <div id="D1_temp_status"
  337. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  338. </div>
  339. {% elif tank_temp1>0 %}
  340. <div id="D1_temp_status"
  341. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  342. </div>
  343. {% else %}
  344. <div id="D1_temp_status"
  345. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  346. </div>
  347. {% endif %}
  348. </td>
  349. <td>
  350. 溫度設定
  351. <span id="tank_temp1_t_status"></span>
  352. </td>
  353. </tr>
  354. <tr>
  355. <td>
  356. {% if tank_solenoid_water=='ON' %}
  357. <div id="D1_solenoid_water_status"
  358. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  359. </div>
  360. {% elif tank_solenoid_water=='OFF' %}
  361. <div id="D1_solenoid_water_status"
  362. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  363. </div>
  364. {% else %}
  365. <div id="D1_solenoid_water_status"
  366. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  367. </div>
  368. {% endif %}
  369. </td>
  370. <td>
  371. 排水電磁閥
  372. <span id="tank_solenoid_water_t_status"></span>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td>
  377. {% if tank_diskvalve=='ON' %}
  378. <div id="D1_diskvalve_status"
  379. style="width: 18px; height: 18px; background-color: forestgreen; border-radius: 50%;">
  380. </div>
  381. {% elif tank_diskvalve=='OFF' %}
  382. <div id="D1_diskvalve_status"
  383. style="width: 18px; height: 18px; background-color: #C0C0C0; border-radius: 50%;">
  384. </div>
  385. {% else %}
  386. <div id="D1_diskvalve_status"
  387. style="width: 18px; height: 18px; background-color: crimson; border-radius: 50%;">
  388. </div>
  389. {% endif %}
  390. </td>
  391. <td>
  392. 蝴蝶閥
  393. <span id="tank_diskvalve_t_status"></span>
  394. </td>
  395. </tr>
  396. </table>
  397. </td>
  398. <td style="vertical-align:text-top;">
  399. <table style="border:0px gray solid;" cellpadding="3">
  400. <!--font-size:12px; -->
  401. <tr>
  402. <td>
  403. 咖啡生豆高度
  404. </td>
  405. <td>
  406. {{tank_UltraSonic.UltraSonic}}
  407. <span id="UltraSonic_status"></span>
  408. </td>
  409. </tr>
  410. <tr>
  411. <td>
  412. <a href="/chart/SHT11_Temp">乾燥槽溫度</a>
  413. </td>
  414. <td>
  415. {{tank_SHT11.SHT11_Temp}}
  416. <span id="SHT11_Temp_status"></span>
  417. </td>
  418. </tr>
  419. <tr>
  420. <td>
  421. 乾燥槽濕度
  422. </td>
  423. <td>
  424. {{tank_SHT11.SHT11_Humidity}}
  425. <span id="SHT11_Humidity_status"></span>
  426. </td>
  427. </tr>
  428. <tr>
  429. <td>
  430. 咖啡生豆溫度
  431. </td>
  432. <td>
  433. {{tank_Soil.soil_Temp}}
  434. <span id="soil_Temp_status"></span>
  435. </td>
  436. </tr>
  437. <tr>
  438. <td>
  439. 咖啡生豆濕度
  440. </td>
  441. <td>
  442. {{tank_Soil.soil_Humidity}}
  443. <span id="soil_Humidity_status"></span>
  444. </td>
  445. </tr>
  446. <tr>
  447. <td>
  448. 咖啡生豆 EC
  449. </td>
  450. <td>
  451. {{tank_Soil.soil_EC}}
  452. <span id="soil_EC_status"></span>
  453. </td>
  454. </tr>
  455. <tr>
  456. <td>
  457. 桶內壓力
  458. </td>
  459. <td>
  460. {{tank_PA.PA}}
  461. <span id="PA_status"></span>
  462. </td>
  463. </tr>
  464. </table>
  465. </td>
  466. </tr>
  467. </table>
  468. </div>
  469. </div>
  470. </div>
  471. </div>
  472. <script>
  473. var button_D1 = document.getElementById('D1');
  474. button_D1.addEventListener('click', function () {
  475. $('#D1_Modal').modal('show');
  476. });
  477. function update_data(dtn) {
  478. console.log('dry_tank_num:' + dtn)
  479. // dtn = dry_tank_num
  480. $.get('/loading/' + dtn, '', function (res) {
  481. if (res.tank_vacuum == 0){$("#tank_vacuum_status").css("background-color", "#C0C0C0")
  482. }else if(res.tank_vacuum == 1){$("#tank_vacuum_status").css("background-color", "forestgreen")
  483. }else{$("#tank_vacuum_status").css("background-color", "crimson")}
  484. if (res.tank_3wayvalve == 0){$("#tank_3wayvalve_status").css("background-color", "#C0C0C0")
  485. }else if(res.tank_3wayvalve == 1){$("#tank_3wayvalve_status").css("background-color", "forestgreen")
  486. }else{$("#tank_3wayvalve_status").css("background-color", "crimson")}
  487. if (res.tank_vacuum == 0){$("#tank_vacuum_status").css("background-color", "#C0C0C0")
  488. }else if(res.tank_vacuum == 1){$("#tank_vacuum_status").css("background-color", "forestgreen")
  489. }else{$("#tank_vacuum_status").css("background-color", "crimson")}
  490. $("#tank_vacuum_t_status").text(res.tank_vacuum);
  491. $("#tank_3wayvalve_t_status").text(res.tank_3wayvalve);
  492. $("#tank_diskvalve_t_status").text(res.tank_diskvalve);
  493. $("#tank_solenoid_disinfect_t_status").text(res.tank_solenoid_disinfect);
  494. $("#tank_solenoid_water_t_status").text(res.tank_solenoid_water);
  495. $("#tank_motor_t_status").text(res.tank_motor);
  496. $("#tank_blower_t_status").text(res.tank_blower);
  497. $("#tank_heater1_t_status").text(res.tank_heater1);
  498. $("#tank_heater2_t_status").text(res.tank_heater2);
  499. $("#tank_temp1_enable_t_status").text(res.tank_temp1_enable);
  500. $("#tank_temp1_t_status").text(res.tank_temp1);
  501. $("#UltraSonic_t_status").text(res.UltraSonic);
  502. $("#SHT11_Temp_t_status").text(res.SHT11_Temp);
  503. $("#SHT11_Humidity_t_status").text(res.SHT11_Humidity);
  504. $("#soil_Temp_t_status").text(res.soil_Temp);
  505. $("#soil_Humidity_t_status").text(res.soil_Humidity);
  506. $("#soil_EC_t_status").text(res.soil_EC);
  507. $("#PA_t_status").text(res.PA);
  508. }, 'json');
  509. $('#Modal_title').text("乾燥槽 " + dtn + " 狀態")
  510. $('#D1_Modal').modal('show');
  511. }
  512. var button_D2 = document.getElementById('D2');
  513. button_D2.addEventListener('click', function(){update_data("D2")});
  514. var button_D3 = document.getElementById('D3');
  515. button_D3.addEventListener('click', function(){update_data("D3")});
  516. /*
  517. $('#D2').click(
  518. function(){
  519. $.get('/loading',
  520. '',
  521. function(res) {
  522. $("#SHT11_Temp_status").text(res.SHT11_Temp);
  523. },
  524. 'json'
  525. );
  526. }
  527. );
  528. */
  529. </script>
  530. </body>
  531. </html>