dry.html 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  1. <!-- 宣告我們要套用模板 -->
  2. {% extends "base.html" %}
  3. {% block title %}{{ title }}{% endblock %}
  4. {% block script %}
  5. <script language="JavaScript">
  6. var status = '{{status}}';
  7. var username = '{{username}}';
  8. $(document).ready(function(){
  9. $("#coffee_title_pc").text("乾燥貨櫃");
  10. $("#coffee_title_phone").text("乾燥貨櫃");
  11. $('#navbarDropdown_user_pc').text(username);
  12. $('#navbarDropdown_user_phone').text(username);
  13. loading_D_status();
  14. });
  15. function loading_D_status(){
  16. $.get('/dry_auto_data', '', function (res) {
  17. dry_tank_status = [res.D1, res.D2, res.D3, res.D4, res.D5, res.D6,
  18. res.D7, res.D8, res.D9, res.D10, res.D11, res.D12 ]
  19. for (let i=0; i<dry_tank_status.length; i++) {
  20. if (dry_tank_status[i] == 'D_InputtingBean') {
  21. $("#D"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  22. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆中")
  23. } else if (dry_tank_status[i] == 'D_InputtingBean_Pause') {
  24. $("#D"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  25. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆暫停")
  26. } else if (dry_tank_status[i] == 'D_InputtingBean_Finish') {
  27. $("#D"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  28. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆完成")
  29. } else if (dry_tank_status[i] == 'D_Waiting') {
  30. $("#D"+parseInt(i+1)+"_bar").css("background-color", "lightgray")
  31. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 空桶等待")
  32. } else if (dry_tank_status[i] == 'D_InputtingWater') {
  33. $("#D"+parseInt(i+1)+"_bar").css("background-color", "DeepSkyBlue")
  34. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 外桶入水中")
  35. } else if (dry_tank_status[i] == 'D_Cleaning') {
  36. $("#D"+parseInt(i+1)+"_bar").css("background-color", "plum")
  37. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 清洗中")
  38. } else if (dry_tank_status[i] == 'D_Drying') {
  39. $("#D"+parseInt(i+1)+"_bar").css("background-color", "Peru")
  40. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 乾燥中")
  41. } else if (dry_tank_status[i] == 'D_OutputtingBean') {
  42. $("#D"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  43. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 可出豆")
  44. } else if (dry_tank_status[i] == 'D_Warning') {
  45. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 發生錯誤")
  46. $("#D"+parseInt(i+1)+"_status").css("color", "crimson")
  47. $("#D"+parseInt(i+1)+"_bar").css("background-color", "crimson")
  48. } else {
  49. console.log('pass')
  50. }
  51. }
  52. dry_input_status = [res.DI1, res.DI2]
  53. for (let i=0; i<dry_input_status.length; i++) {
  54. if (dry_input_status[i] == 'DI_InputtingBean') {
  55. $("#DI"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  56. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 入豆中")
  57. } else if (dry_input_status[i] == 'DI_Waiting') {
  58. $("#DI"+parseInt(i+1)+"_bar").css("background-color", "lightgray")
  59. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 空桶等待")
  60. } else if (dry_input_status[i] == 'DI_OutputtingBean') {
  61. $("#DI"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  62. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 可出豆")
  63. } else if (dry_input_status[i] == 'DI_Stand_by') {
  64. $("#DI"+parseInt(i+1)+"_bar").css("background-color", "HotPink")
  65. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 待命")
  66. } else {
  67. console.log('DI pass')
  68. }
  69. }
  70. dry_output_status = [res.DO1, res.DO2]
  71. for (let i=0; i<dry_output_status.length; i++) {
  72. if (dry_output_status[i] == 'DO_InputtingBean') {
  73. $("#DO"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  74. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 入豆中")
  75. } else if (dry_output_status[i] == 'DO_Waiting') {
  76. $("#DO"+parseInt(i+1)+"_bar").css("background-color", "lightgray")
  77. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 空桶等待")
  78. } else if (dry_output_status[i] == 'DO_OutputtingBean') {
  79. $("#DO"+parseInt(i+1)+"_bar").css("background-color", "MediumSeaGreen")
  80. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 可出豆")
  81. } else if (dry_output_status[i] == 'DO_Stand_by') {
  82. $("#DO"+parseInt(i+1)+"_bar").css("background-color", "HotPink")
  83. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 待命")
  84. } else {
  85. console.log('DO pass')
  86. }
  87. }
  88. $("#tank_temp1_t_status").text(res.tank_temp1);
  89. }, 'json');
  90. }
  91. // 指定 10秒 刷新網頁一次
  92. setInterval('loading_D_status()',1000);
  93. </script>
  94. {% endblock %}
  95. {% block style %}
  96. <style>
  97. /* 各桶槽狀態大小的共同 CSS */
  98. .div_DryTank_position {
  99. text-align: center;
  100. font-weight: bold;
  101. border: 0px aquamarine solid;
  102. }
  103. .td-clickable:hover {
  104. /* background-color: rgb(238, 236, 236); */
  105. background-color: lavender;
  106. border: 2px Gray solid;
  107. }
  108. /* 桶槽狀態顯示的顏色條 */
  109. .div_DryTank_Status {
  110. height: 20px;
  111. border-style: solid;
  112. border-color: whitesmoke;
  113. background-color: black;
  114. }
  115. .footer{
  116. position: absolute;
  117. bottom: 0px;
  118. width: 100%;
  119. background-color: #eee;
  120. text-align: center;
  121. }
  122. /* 致動器狀態的圈圈 */
  123. .actuator_status {
  124. width: 18px;
  125. height: 18px;
  126. background-color:black;
  127. border-radius: 50%;
  128. }
  129. /* 狀態外框的 CSS */
  130. .table_css {
  131. border: 0px lightsteelblue solid;
  132. margin-right: auto;
  133. margin-left: auto;
  134. text-align: center;
  135. margin-top: 5px;
  136. width: 80%;
  137. }
  138. </style>
  139. {% endblock %}
  140. {% block main %}
  141. <!-- 乾燥槽互動視窗(模态框) -->
  142. <div class="modal fade" id="D_Modal">
  143. <div class="modal-dialog modal-dialog-centered" style="width: 400px;">
  144. <div class="modal-content">
  145. <!-- 互動視窗 標題 -->
  146. <div class="modal-header">
  147. <h4 id="Modal_title" class="modal-title">乾燥槽 D1 狀態</h4>
  148. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  149. </div>
  150. <!-- 互動視窗 內容 -->
  151. <div class="modal-body">
  152. <table style="border:0px gray solid; width: 100%;" cellpadding="3">
  153. <!--<table style="border:0px gray solid;-->
  154. <tr>
  155. <td><strong><a id="actuator_link" href="">致動器狀態</a></strong></td>
  156. <td><strong><a id="sensor_link" href="">感測器狀態</a></strong></td>
  157. </tr>
  158. <tr>
  159. <td style="vertical-align:text-top;">
  160. <table style="border:0px gray solid;" cellpadding="3">
  161. <!--font-size:12px; -->
  162. <tr>
  163. <td>
  164. <div id="tank_vacuum_status" class="actuator_status">
  165. </div>
  166. </td>
  167. <td>
  168. <a id="Vacuum" href="">真空吸料機</a>
  169. <!--<span id="tank_vacuum_t_status"></span>-->
  170. </td>
  171. </tr>
  172. <tr>
  173. <td>
  174. <div id="tank_threewayvalve_input_status" class="actuator_status">
  175. </div>
  176. </td>
  177. <td>
  178. <a id="ThreeWayValveInput" href="">入料三通閥</a>
  179. <!--<span id="tank_threewayvalve_t_status"></span>-->
  180. </td>
  181. </tr>
  182. <tr>
  183. <td>
  184. <div id="tank_solenoid_disinfect_status" class="actuator_status">
  185. </div>
  186. </td>
  187. <td>
  188. <a id="SolenoidDisinfect" href="">桶內消毒電磁閥</a>
  189. <!--<span id="tank_solenoid_disinfect_t_status"></span>-->
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>
  194. <div id="outer_solenoid_water_status" class="actuator_status">
  195. </div>
  196. </td>
  197. <td>
  198. <a id="SolenoidOuterWater" href="">保溫夾層進水電磁閥</a>
  199. <!--<span id="tank_solenoid_disinfect_t_status"></span>-->
  200. </td>
  201. </tr>
  202. <tr>
  203. <td>
  204. <div id="tank_motor_status" class="actuator_status">
  205. </div>
  206. </td>
  207. <td>
  208. <a id="Motor" href="">馬達</a>
  209. <!--<span id="tank_motor_t_status"></span>-->
  210. </td>
  211. </tr>
  212. <tr>
  213. <td>
  214. <div id="tank_vacuum_pump_status" class="actuator_status">
  215. </div>
  216. </td>
  217. <td>
  218. <a id="Blower" href="">乾燥真空機</a>
  219. <!--<span id="tank_blower_t_status"></span>-->
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>
  224. <div id="tank_heater1_status" class="actuator_status">
  225. </div>
  226. </td>
  227. <td>
  228. <a id="Heater1" href="">加熱器 1</a>
  229. <!--<span id="tank_heater1_t_status"></span>-->
  230. </td>
  231. </tr>
  232. <tr>
  233. <td>
  234. <div id="tank_heater2_status" class="actuator_status">
  235. </div>
  236. </td>
  237. <td>
  238. <a id="Heater2" href="">加熱器 2</a>
  239. <!--<span id="tank_heater2_t_status"></span>-->
  240. </td>
  241. </tr>
  242. <tr>
  243. <td>
  244. <div id="tank_solenoid_water_status" class="actuator_status">
  245. </div>
  246. </td>
  247. <td>
  248. <a id="SolenoidWater" href="">排水廢水電磁閥</a>
  249. <!--<span id="tank_solenoid_water_t_status"></span>-->
  250. </td>
  251. </tr>
  252. <tr>
  253. <td>
  254. <div id="tank_diskvalve_status" class="actuator_status">
  255. </div>
  256. </td>
  257. <td>
  258. <a id="DiskValve" href="">蝴蝶閥</a>
  259. <!--<span id="tank_diskvalve_t_status"></span>-->
  260. </td>
  261. </tr>
  262. <tr>
  263. <td>
  264. <div id="Warning_Light_status" class="actuator_status">
  265. </div>
  266. </td>
  267. <td>
  268. <a id="Warning_Light" href="">警示燈</a>
  269. <!--<span id="tank_diskvalve_t_status"></span>-->
  270. </td>
  271. </tr>
  272. </table>
  273. </td>
  274. <td style="vertical-align:text-top;">
  275. <table style="border:0px gray solid;" cellpadding="3">
  276. <!--font-size:12px; -->
  277. <tr>
  278. <td>
  279. <a id="UltraSonic" href="">咖啡生豆高度</a>
  280. </td>
  281. <td>
  282. <span id="UltraSonic_t_status"></span>
  283. </td>
  284. </tr>
  285. <tr>
  286. <td>
  287. <a id="SHT11_Temp" href="">溫度</a>
  288. </td>
  289. <td>
  290. <span id="SHT11_Temp_t_status"></span>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td>
  295. <a id="SHT11_Humidity" href="">濕度</a>
  296. </td>
  297. <td>
  298. <span id="SHT11_Humidity_t_status"></span>
  299. </td>
  300. </tr>
  301. <tr>
  302. <td>
  303. <a id="soil_Temp" href="">咖啡生豆溫度</a>
  304. </td>
  305. <td>
  306. <span id="soil_Temp_t_status"></span>
  307. </td>
  308. </tr>
  309. <tr>
  310. <td>
  311. <a id="soil_Humidity" href="">咖啡生豆濕度</a>
  312. </td>
  313. <td>
  314. <span id="soil_Humidity_t_status"></span>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td>
  319. <a id="soil_EC" href="">咖啡生豆 EC</a>
  320. </td>
  321. <td>
  322. <span id="soil_EC_t_status"></span>
  323. </td>
  324. </tr>
  325. <tr>
  326. <td>
  327. <a id="PA" href="">大氣壓力</a>
  328. </td>
  329. <td>
  330. <span id="PA_t_status"></span>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td>
  335. <a id="motorEncoder" href="">馬達編碼器</a>
  336. </td>
  337. <td>
  338. <span id="motorEncoder_status"></span>
  339. </td>
  340. </tr>
  341. <tr>
  342. <td>
  343. <a id="butterflyvalve" href="">蝴蝶閥編碼器</a>
  344. </td>
  345. <td>
  346. <span id="butterflyvalve_status"></span>
  347. </td>
  348. </tr>
  349. <tr>
  350. <td>
  351. <a id="WaterLevel" href="">保溫夾層水位</a>
  352. </td>
  353. <td>
  354. <span id="WaterLevel_t_status"></span>
  355. </td>
  356. </tr>
  357. <tr>
  358. <td>
  359. <a id="camera_dry_tid" href=""><strong>攝影機畫面</strong></a>
  360. </td>
  361. </tr>
  362. <tr>
  363. <td><strong><a id="D_set" href="">自動化設定</a></strong></td>
  364. </tr>
  365. </table>
  366. </td>
  367. </tr>
  368. </table>
  369. </div>
  370. </div>
  371. </div>
  372. </div>
  373. <!-- 乾燥槽入料儲豆槽互動視窗(模态框) -->
  374. <div class="modal fade" id="DI_Modal">
  375. <div class="modal-dialog modal-dialog-centered" style="width: 400px;">
  376. <div class="modal-content">
  377. <!-- 互動視窗 標題 -->
  378. <div class="modal-header">
  379. <h4 id="Modal_title_input" class="modal-title">乾燥入料儲豆槽 DI1 狀態</h4>
  380. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  381. </div>
  382. <!-- 互動視窗 內容 -->
  383. <div class="modal-body">
  384. <table style="border:0px gray solid; width: 100%;" cellpadding="3">
  385. <!--<table style="border:0px gray solid;-->
  386. <tr>
  387. <td><strong><a id="actuator_link_input" href="">致動器狀態</a></strong></td>
  388. <td><strong><a id="sensor_link_input" href="">感測器狀態</a></strong></td>
  389. </tr>
  390. <tr>
  391. <td style="vertical-align:text-top;">
  392. <table style="border:0px gray solid;" cellpadding="3">
  393. <!--font-size:12px; -->
  394. <tr>
  395. <td>
  396. <div id="input_vacuum_status" class="actuator_status">
  397. </div>
  398. </td>
  399. <td>
  400. <a id="Vacuum_input" href="">真空吸料機</a>
  401. <!--<span id="tank_vacuum_t_status"></span>-->
  402. </td>
  403. </tr>
  404. </table>
  405. </td>
  406. <td style="vertical-align:text-top;">
  407. <table style="border:0px gray solid;" cellpadding="3">
  408. <!--font-size:12px; -->
  409. <tr>
  410. <td>
  411. <a id="DI_UltraSonic" href="">咖啡生豆高度</a>
  412. </td>
  413. <td>
  414. <span id="DI_UltraSonic_t_status"></span>
  415. </td>
  416. </tr>
  417. <tr>
  418. <td>
  419. <a id="DI_camera_dry_tid" href=""><strong>攝影機畫面</strong></a>
  420. </td>
  421. </tr>
  422. <tr>
  423. <td><strong><a id="DI_set" href="">自動化設定</a></strong></td>
  424. </tr>
  425. </table>
  426. </td>
  427. </tr>
  428. </table>
  429. </div>
  430. </div>
  431. </div>
  432. </div>
  433. <!-- 乾燥槽出料儲豆槽互動視窗(模态框) -->
  434. <div class="modal fade" id="DO_Modal">
  435. <div class="modal-dialog modal-dialog-centered" style="width: 400px;">
  436. <div class="modal-content">
  437. <!-- 互動視窗 標題 -->
  438. <div class="modal-header">
  439. <h4 id="Modal_title_output" class="modal-title">乾燥入料儲豆槽 DI1 狀態</h4>
  440. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  441. </div>
  442. <!-- 互動視窗 內容 -->
  443. <div class="modal-body">
  444. <table style="border:0px gray solid; width: 100%;" cellpadding="3">
  445. <!--<table style="border:0px gray solid;-->
  446. <tr>
  447. <td><strong><a id="actuator_link_output" href="">致動器狀態</a></strong></td>
  448. <td><strong><a id="sensor_link_output" href="">感測器狀態</a></strong></td>
  449. </tr>
  450. <tr>
  451. <td style="vertical-align:text-top;">
  452. <table style="border:0px gray solid;" cellpadding="3">
  453. <!--font-size:12px; -->
  454. <tr>
  455. <td>
  456. <div id="output_vacuum_status"
  457. style="width: 18px; height: 18px; background-color:black; border-radius: 50%;">
  458. </div>
  459. </td>
  460. <td>
  461. <a id="Vacuum_output" href="">真空吸料機</a>
  462. <!--<span id="tank_vacuum_t_status"></span>-->
  463. </td>
  464. </tr>
  465. </table>
  466. </td>
  467. <td style="vertical-align:text-top;">
  468. <table style="border:0px gray solid;" cellpadding="3">
  469. <!--font-size:12px; -->
  470. <tr>
  471. <td>
  472. <a id="DO_UltraSonic" href="/chart_DO/UltraSonic/1">咖啡生豆高度</a>
  473. </td>
  474. <td>
  475. <span id="DO_UltraSonic_status"></span>
  476. </td>
  477. </tr>
  478. <tr>
  479. <td>
  480. <a id="DO_camera_dry_tid" href=""><strong>攝影機畫面</strong></a>
  481. </td>
  482. </tr>
  483. <tr>
  484. <td><strong><a id="DO_set" href="">自動化設定</a></strong></td>
  485. </tr>
  486. </table>
  487. </td>
  488. </tr>
  489. </table>
  490. </div>
  491. </div>
  492. </div>
  493. </div>
  494. </div>
  495. <div class="album py-5 bg-light">
  496. <div class="container">
  497. <div class="row row-cols-1 row-cols-sm-1 row-cols-md-1 g-3">
  498. <div class="col">
  499. <div class="card shadow-sm">
  500. <div class="card-body">
  501. <div class="d-flex justify-content-between align-items-center">
  502. <table class="table_css" cellpadding="6" border="1" style="width: 100%" >
  503. <tr>
  504. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  505. <div id="DI1" tabindex="0" class="div_DryTank_position" role="button">
  506. <span id="DI1_status" class="demo_status_css">DI1 status</span>
  507. </div>
  508. </td>
  509. <td style="width: 10px; font-weight: 900; border: lightsteelblue 1px solid;">
  510. 入料
  511. </td>
  512. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  513. <div id="D1" tabindex="0" class="div_DryTank_position" role="button">
  514. <span id="D1_status" class="demo_status_css">D1 status</span>
  515. </div>
  516. </td>
  517. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  518. <div id="D2" tabindex="0" class="div_DryTank_position" role="button">
  519. <span id="D2_status" class="demo_status_css">D2 status</span>
  520. </div>
  521. </td>
  522. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  523. <div id="D3" tabindex="0" class="div_DryTank_position" role="button">
  524. <span id="D3_status" class="demo_status_css">D3 status</span>
  525. </div>
  526. </td>
  527. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  528. <div id="D4" tabindex="0" class="div_DryTank_position" role="button">
  529. <span id="D4_status" class="demo_status_css">D4 status</span>
  530. </div>
  531. </td>
  532. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  533. <div id="D5" tabindex="0" class="div_DryTank_position" role="button">
  534. <span id="D5_status" class="demo_status_css">D5 status</span>
  535. </div>
  536. </td>
  537. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  538. <div id="D6" tabindex="0" class="div_DryTank_position" role="button">
  539. <span id="D6_status" class="demo_status_css">D6 status</span>
  540. </div>
  541. </td>
  542. <td style="width: 10px; font-weight: 900; border: lightsteelblue 1px solid;">
  543. 出料
  544. </td>
  545. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  546. <div id="DO1" tabindex="0" class="div_DryTank_position" role="button">
  547. <span id="DO1_status" class="demo_status_css">DO1 status</span>
  548. </div>
  549. </td>
  550. </tr>
  551. <tr>
  552. <td style="border: lightsteelblue 1px solid;">
  553. <center><div id="DI1_bar" class="div_DryTank_Status"></div></center>
  554. </td>
  555. <td style="border: lightsteelblue 1px solid;">
  556. </td>
  557. <td style="border: lightsteelblue 1px solid;">
  558. <center><div id="D1_bar" class="div_DryTank_Status"></div></center>
  559. </td>
  560. <td style="border: lightsteelblue 1px solid;">
  561. <center><div id="D2_bar" class="div_DryTank_Status"></div></center>
  562. </td>
  563. <td style="border: lightsteelblue 1px solid;">
  564. <center><div id="D3_bar" class="div_DryTank_Status"></div></center>
  565. </td>
  566. <td style="border: lightsteelblue 1px solid;">
  567. <center><div id="D4_bar" class="div_DryTank_Status"></div></center>
  568. </td>
  569. <td style="border: lightsteelblue 1px solid;">
  570. <center><div id="D5_bar" class="div_DryTank_Status"></div></center>
  571. </td>
  572. <td style="border: lightsteelblue 1px solid;">
  573. <center><div id="D6_bar" class="div_DryTank_Status"></div></center>
  574. </td>
  575. <td style="border: lightsteelblue 1px solid;">
  576. </td>
  577. <td style="border: lightsteelblue 1px solid;">
  578. <center><div id="DO1_bar" class="div_DryTank_Status"></div></center>
  579. </td>
  580. </tr>
  581. </table>
  582. </div>
  583. </div>
  584. <img src="../static/img/web_dry_container.png">
  585. <div class="card-body">
  586. <div class="d-flex justify-content-between align-items-center">
  587. <table class="table_css" cellpadding="6" border="1" style="width: 100%">
  588. <tr>
  589. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  590. <div id="DI2" tabindex="0" class="div_DryTank_position" role="button">
  591. <span id="DI2_status" class="demo_status_css">DI2 status</span>
  592. </div>
  593. </td>
  594. <td style="width: 10px; font-weight: 900; border: lightsteelblue 1px solid;">
  595. 入料
  596. </td>
  597. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  598. <div id="D7" tabindex="0" class="div_DryTank_position" role="button">
  599. <span id="D7_status" class="demo_status_css">D7 status</span>
  600. </div>
  601. </td>
  602. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  603. <div id="D8" tabindex="0" class="div_DryTank_position" role="button">
  604. <span id="D8_status" class="demo_status_css">D8 status</span>
  605. </div>
  606. </td>
  607. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  608. <div id="D9" tabindex="0" class="div_DryTank_position" role="button">
  609. <span id="D9_status" class="demo_status_css">D9 status</span>
  610. </div>
  611. </td>
  612. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  613. <div id="D10" tabindex="0" class="div_DryTank_position" role="button">
  614. <span id="D10_status" class="demo_status_css">D10 status</span>
  615. </div>
  616. </td>
  617. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  618. <div id="D11" tabindex="0" class="div_DryTank_position" role="button">
  619. <span id="D11_status" class="demo_status_css">D11 status</span>
  620. </div>
  621. </td>
  622. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  623. <div id="D12" tabindex="0" class="div_DryTank_position" role="button">
  624. <span id="D12_status" class="demo_status_css">D12 status</span>
  625. </div>
  626. </td>
  627. <td style="width: 10px; font-weight: 900; border: lightsteelblue 1px solid;">
  628. 出料
  629. </td>
  630. <td class="td-clickable" width="12%" style="border: lightsteelblue 1px solid;">
  631. <div id="DO2" tabindex="0" class="div_DryTank_position" role="button">
  632. <span id="DO2_status" class="demo_status_css">DO2 status</span>
  633. </div>
  634. </td>
  635. </tr>
  636. <tr>
  637. <td style="border: lightsteelblue 1px solid;">
  638. <center><div id="DI2_bar" class="div_DryTank_Status"></div></center>
  639. </td>
  640. <td style="border: lightsteelblue 1px solid;">
  641. </td>
  642. <td style="border: lightsteelblue 1px solid;">
  643. <center><div id="D7_bar" class="div_DryTank_Status"></div></center>
  644. </td>
  645. <td style="border: lightsteelblue 1px solid;">
  646. <center><div id="D8_bar" class="div_DryTank_Status"></div></center>
  647. </td>
  648. <td style="border: lightsteelblue 1px solid;">
  649. <center><div id="D9_bar" class="div_DryTank_Status"></div></center>
  650. </td>
  651. <td style="border: lightsteelblue 1px solid;">
  652. <center><div id="D10_bar" class="div_DryTank_Status"></div></center>
  653. </td>
  654. <td style="border: lightsteelblue 1px solid;">
  655. <center><div id="D11_bar" class="div_DryTank_Status"></div></center>
  656. </td>
  657. <td style="border: lightsteelblue 1px solid;">
  658. <center><div id="D12_bar" class="div_DryTank_Status"></div></center>
  659. </td>
  660. <td style="border: lightsteelblue 1px solid;">
  661. </td>
  662. <td style="border: lightsteelblue 1px solid;">
  663. <center><div id="DO2_bar" class="div_DryTank_Status"></div></center>
  664. </td>
  665. </tr>
  666. </table>
  667. </div>
  668. </div>
  669. </div>
  670. </div>
  671. </div>
  672. </div>
  673. </div>
  674. {% endblock %}
  675. {% block script2 %}
  676. <script>
  677. function update_data_D(dtid) {
  678. $.get('/loading/D' + dtid, '', function (res) {
  679. if (res.vacuum == 0) {
  680. $("#tank_vacuum_status").css("background-color", "#C0C0C0")
  681. } else if (res.vacuum == 1) {
  682. $("#tank_vacuum_status").css("background-color", "forestgreen")
  683. } else { $("#tank_vacuum_status").css("background-color", "crimson") }
  684. if (res.threewayvalve_input == 0) {
  685. $("#tank_threewayvalve_input_status").css("background-color", "#C0C0C0")
  686. } else if (res.threewayvalve_input == 1) {
  687. $("#tank_threewayvalve_input_status").css("background-color", "forestgreen")
  688. } else { $("#tank_threewayvalve_input_status").css("background-color", "crimson") }
  689. if (res.diskvalve == 0) {
  690. $("#tank_diskvalve_status").css("background-color", "#C0C0C0")
  691. } else if (res.diskvalve == 1) {
  692. $("#tank_diskvalve_status").css("background-color", "forestgreen")
  693. } else { $("#tank_diskvalve_status").css("background-color", "crimson") }
  694. if (res.solenoid_disinfect == 0) {
  695. $("#tank_solenoid_disinfect_status").css("background-color", "#C0C0C0")
  696. } else if (res.solenoid_disinfect == 1) {
  697. $("#tank_solenoid_disinfect_status").css("background-color", "forestgreen")
  698. } else { $("#tank_solenoid_disinfect_status").css("background-color", "crimson") }
  699. if (res.solenoid_outer_water == 0) {
  700. $("#outer_solenoid_water_status").css("background-color", "#C0C0C0")
  701. } else if (res.solenoid_outer_water == 1) {
  702. $("#outer_solenoid_water_status").css("background-color", "forestgreen")
  703. } else { $("#outer_solenoid_water_status").css("background-color", "crimson") }
  704. if (res.solenoid_water_out == 0) {
  705. $("#tank_solenoid_water_status").css("background-color", "#C0C0C0")
  706. } else if (res.solenoid_water_out == 1) {
  707. $("#tank_solenoid_water_status").css("background-color", "forestgreen")
  708. } else { $("#tank_solenoid_water_status").css("background-color", "crimson") }
  709. if (res.motor == 0) {
  710. $("#tank_motor_status").css("background-color", "#C0C0C0")
  711. } else if (res.motor == 1) {
  712. $("#tank_motor_status").css("background-color", "forestgreen")
  713. } else { $("#tank_motor_status").css("background-color", "crimson") }
  714. if (res.vacuum_pump == 0) {
  715. $("#tank_vacuum_pump_status").css("background-color", "#C0C0C0")
  716. } else if (res.vacuum_pump == 1) {
  717. $("#tank_vacuum_pump_status").css("background-color", "forestgreen")
  718. } else { $("#tank_vacuum_pump_status").css("background-color", "crimson") }
  719. if (res.heater1 == 0) {
  720. $("#tank_heater1_status").css("background-color", "#C0C0C0")
  721. } else if (res.heater1 == 1) {
  722. $("#tank_heater1_status").css("background-color", "forestgreen")
  723. } else { $("#tank_heater1_status").css("background-color", "crimson") }
  724. if (res.heater2 == 0) {
  725. $("#tank_heater2_status").css("background-color", "#C0C0C0")
  726. } else if (res.heater2 == 1) {
  727. $("#tank_heater2_status").css("background-color", "forestgreen")
  728. } else { $("#tank_heater2_status").css("background-color", "crimson") }
  729. if (res.warning_light== 0) {
  730. $("#Warning_Light_status").css("background-color", "#C0C0C0")
  731. } else if (res.warning_light == 1) {
  732. $("#Warning_Light_status").css("background-color", "forestgreen")
  733. } else { $("#Warning_Light_status").css("background-color", "crimson") }
  734. $("#UltraSonic_t_status").text(res.UltraSonic);
  735. $("#SHT11_Temp_t_status").text(res.SHT11_Temp);
  736. $("#SHT11_Humidity_t_status").text(res.SHT11_Humidity);
  737. $("#soil_Temp_t_status").text(res.soil_Temp);
  738. $("#soil_Humidity_t_status").text(res.soil_Humidity);
  739. $("#soil_EC_t_status").text(res.soil_EC);
  740. $("#PA_t_status").text(res.PA);
  741. $("#motorEncoder_status").text(res.motorEncoder);
  742. $("#butterflyvalve_status").text(res.butterflyvalve);
  743. if (res.WaterLevel == 0) {
  744. $("#WaterLevel_t_status").text("未滿");
  745. } else if (res.WaterLevel == 1) {
  746. $("#WaterLevel_t_status").text("滿");}
  747. else {$("#WaterLevel_t_status").text("null");}
  748. }, 'json');
  749. $('#Modal_title').text("乾燥槽 D" + dtid + " 狀態")
  750. if (status == 2) {
  751. $('#actuator_link').attr("title", "該使用者無修改權限")
  752. $('#sensor_link').attr("title", "該使用者無修改權限")
  753. $('#Vacuum').attr("title", "該使用者無修改權限")
  754. $('#ThreeWayValveInput').attr("title", "該使用者無修改權限")
  755. $('#ThreeWayValveBean').attr("title", "該使用者無修改權限")
  756. $('#SolenoidDisinfect').attr("title", "該使用者無修改權限")
  757. $('#Motor').attr("title", "該使用者無修改權限")
  758. $('#Blower').attr("title", "該使用者無修改權限")
  759. $('#Heater1').attr("title", "該使用者無修改權限")
  760. $('#Heater2').attr("title", "該使用者無修改權限")
  761. $('#TempEnable').attr("title", "該使用者無修改權限")
  762. $('#Temp').attr("title", "該使用者無修改權限")
  763. $('#SolenoidWater').attr("title", "該使用者無修改權限")
  764. $('#DiskValve').attr("title", "該使用者無修改權限")
  765. } else if ( (status == 0) || (status == 1) ) {
  766. $('#actuator_link').attr("href", "/dry_container_tank/" + dtid)
  767. $('#sensor_link').attr("href", "/dry_container_tank/" + dtid)
  768. $('#Vacuum').attr("href", "/ctrl_D_Vacuum/" + dtid)
  769. $('#ThreeWayValveInput').attr("href", "/ctrl_D_ThreeWayValveInput/" + dtid)
  770. $('#ThreeWayValveBean').attr("href", "/ctrl_D_ThreeWayValveBean/" + dtid)
  771. $('#SolenoidDisinfect').attr("href", "/ctrl_D_SolenoidDisinfect/" + dtid)
  772. $('#Motor').attr("href", "/ctrl_D_Motor/" + dtid)
  773. $('#Blower').attr("href", "/ctrl_D_Blower/" + dtid)
  774. $('#Heater1').attr("href", "/ctrl_D_Heater1/" + dtid)
  775. $('#Heater2').attr("href", "/ctrl_D_Heater2/" + dtid)
  776. $('#TempEnable').attr("href", "/ctrl_D_TempEnable/" + dtid)
  777. $('#Temp').attr("href", "/ctrl_D_Temp/" + dtid)
  778. $('#SolenoidWater').attr("href", "/ctrl_D_SolenoidWater/" + dtid)
  779. $('#DiskValve').attr("href", "/ctrl_D_DiskValve/" + dtid)
  780. }
  781. $('#Vacuum').attr("href", "/actuator_chart_D/vacuum/" + dtid)
  782. $('#ThreeWayValveInput').attr("href", "/actuator_chart_D/threewayvalve_input/" + dtid)
  783. $('#SolenoidDisinfect').attr("href", "/actuator_chart_D/solenoid_disinfect/" + dtid)
  784. $('#Motor').attr("href", "/actuator_chart_D/motor/" + dtid)
  785. $('#Blower').attr("href", "/actuator_chart_D/vacuum_pump/" + dtid)
  786. $('#Heater1').attr("href", "/actuator_chart_D/heater1/" + dtid)
  787. $('#Heater2').attr("href", "/actuator_chart_D/heater2/" + dtid)
  788. $('#SolenoidWater').attr("href", "/actuator_chart_D/solenoid_water_out/" + dtid)
  789. $('#DiskValve').attr("href", "/actuator_chart_D/diskvalve/" + dtid)
  790. $('#SolenoidOuterWater').attr("href", "/actuator_chart_D/solenoid_outer_water/" + dtid)
  791. $('#Warning_Light').attr("href", "/actuator_chart_D/Warning_Light/" + dtid)
  792. $('#SHT11_Temp').attr("href", "/sensor_chart_D/SHT11_Temp/" + dtid)
  793. $('#SHT11_Humidity').attr("href", "/sensor_chart_D/SHT11_Humidity/" + dtid)
  794. $('#UltraSonic').attr("href", "/sensor_chart_D/UltraSonic/" + dtid)
  795. $('#PA').attr("href", "/sensor_chart_D/PA/" + dtid)
  796. $('#soil_Temp').attr("href", "/sensor_chart_D/soil_Temp/" + dtid)
  797. $('#soil_Humidity').attr("href", "/sensor_chart_D/soil_Humidity/" + dtid)
  798. $('#soil_EC').attr("href", "/sensor_chart_D/soil_EC/" + dtid)
  799. $('#butterflyvalve').attr("href", "/sensor_chart_D/butterflyvalve/" + dtid)
  800. $('#WaterLevel').attr("href", "/sensor_chart_D/WaterLevel/" + dtid)
  801. $('#motorEncoder').attr("href", "/sensor_chart_D/motorEncoder/" + dtid)
  802. $('#camera_dry_tid').attr("href", "/camera_D" + dtid)
  803. $('#D_set').attr("href", "/auto_D/" + dtid)
  804. $('#D_Modal').modal('show')
  805. }
  806. function update_data_DI(ditid){
  807. $.get('/loading/DI' + ditid, '', function (res) {
  808. if (res.input_vacuum == 0) {
  809. $("#input_vacuum_status").css("background-color", "#C0C0C0")
  810. } else if (res.input_vacuum == 1) {
  811. $("#input_vacuum_status").css("background-color", "forestgreen")
  812. } else { $("#input_vacuum_status").css("background-color", "crimson") }
  813. $("#DI_UltraSonic_t_status").text(res.input_UltraSonic);
  814. }, 'json');
  815. $('#Modal_title_input').text("乾燥入料儲豆槽 DI" + ditid + " 狀態")
  816. if (status == 2) {
  817. $('#actuator_link').attr("title", "該使用者無修改權限")
  818. $('#sensor_link').attr("title", "該使用者無修改權限")
  819. $('#Vacuum_input').attr("title", "該使用者無修改權限")
  820. } else if ( (status == 0) || (status == 1) ) {
  821. $('#actuator_link_input').attr("href", "/dry_container_input/" + ditid)
  822. $('#sensor_link_input').attr("href", "/dry_container_input/" + ditid)
  823. $('#Vacuum_input').attr("href", "/ctrl_DI_Vacuum/" + ditid)
  824. }
  825. $('#Vacuum_input').attr("href", "/actuator_chart_DI/vacuum/" + ditid)
  826. $('#DI_UltraSonic').attr("href", "/sensor_chart_DI/UltraSonic/" + ditid)
  827. $('#DI_camera_dry_tid').attr("href", "/camera_DI" + ditid)
  828. $('#DI_set').attr("href", "/auto_DI/" + ditid)
  829. $('#DI_Modal').modal('show');
  830. };
  831. function update_data_DO(dotid){
  832. $.get('/loading/DO' + dotid, function (res) {
  833. if (res.output_vacuum == 0) {
  834. $("#output_vacuum_status").css("background-color", "#C0C0C0")
  835. } else if (res.output_vacuum == 1) {
  836. $("#output_vacuum_status").css("background-color", "forestgreen")
  837. } else { $("#output_vacuum_status").css("background-color", "crimson") }
  838. $("#DO_UltraSonic_status").text(res.output_UltraSonic);
  839. }, 'json');
  840. $('#Modal_title_output').text("乾燥出料儲豆槽 DO" + dotid + " 狀態")
  841. if (status == 2) {
  842. $('#actuator_link').attr("title", "該使用者無修改權限")
  843. $('#sensor_link').attr("title", "該使用者無修改權限")
  844. $('#Vacuum_output').attr("title", "該使用者無修改權限")
  845. } else if ( (status == 0) || (status == 1) ) {
  846. $('#actuator_link_output').attr("href", "/dry_container_output/" + dotid)
  847. $('#sensor_link_output').attr("href", "/dry_container_output/" + dotid)
  848. $('#Vacuum_output').attr("href", "/ctrl_DO_Vacuum/" + dotid)
  849. }
  850. $('#Vacuum_output').attr("href", "/actuator_chart_DO/vacuum/" + dotid)
  851. $('#DO_UltraSonic').attr("href", "/sensor_chart_DO/UltraSonic/" + dotid)
  852. $('#DO_camera_dry_tid').attr("href", "/camera_DO" + dotid)
  853. $('#DO_set').attr("href", "/auto_DO/" + dotid)
  854. $('#DO_Modal').modal('show');
  855. };
  856. var button_D1 = document.getElementById('D1');
  857. button_D1.addEventListener('click', function () { update_data_D("1") });
  858. var button_D2 = document.getElementById('D2');
  859. button_D2.addEventListener('click', function () { update_data_D("2") });
  860. var button_D3 = document.getElementById('D3');
  861. button_D3.addEventListener('click', function () { update_data_D("3") });
  862. var button_D4 = document.getElementById('D4');
  863. button_D4.addEventListener('click', function () { update_data_D("4") });
  864. var button_D5 = document.getElementById('D5');
  865. button_D5.addEventListener('click', function () { update_data_D("5") });
  866. var button_D6 = document.getElementById('D6');
  867. button_D6.addEventListener('click', function () { update_data_D("6") });
  868. var button_D7 = document.getElementById('D7');
  869. button_D7.addEventListener('click', function () { update_data_D("7") });
  870. var button_D8 = document.getElementById('D8');
  871. button_D8.addEventListener('click', function () { update_data_D("8") });
  872. var button_D9 = document.getElementById('D9');
  873. button_D9.addEventListener('click', function () { update_data_D("9") });
  874. var button_D10 = document.getElementById('D10');
  875. button_D10.addEventListener('click', function () { update_data_D("10") });
  876. var button_D11 = document.getElementById('D11');
  877. button_D11.addEventListener('click', function () { update_data_D("11") });
  878. var button_D12 = document.getElementById('D12');
  879. button_D12.addEventListener('click', function () { update_data_D("12") });
  880. var button_DI1 = document.getElementById('DI1');
  881. button_DI1.addEventListener('click', function () { update_data_DI("1") });
  882. var button_DI2 = document.getElementById('DI2');
  883. button_DI2.addEventListener('click', function () { update_data_DI("2") });
  884. var button_DO1 = document.getElementById('DO1');
  885. button_DO1.addEventListener('click', function () { update_data_DO("1") });
  886. var button_DO2 = document.getElementById('DO2');
  887. button_DO2.addEventListener('click', function () { update_data_DO("2") });
  888. </script>
  889. {% endblock %}