ferment_auto.html 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ title }}</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- <meta http-equiv="refresh" content="10" />每 content 秒網頁自動更新-->
  8. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  9. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  10. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  11. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  12. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  13. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  14. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  15. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  16. <!--
  17. <script src="../static/js/sign_in.js"></script>
  18. <link rel="stylesheet" href="../static/css/sign_in.css">
  19. -->
  20. <script>
  21. $(document).ready(function(){
  22. $("#coffee_title").text('發酵自動化');
  23. // 桶槽入料顯示
  24. ferment_input_status_N = ['{{FI1}}', '{{FI2}}']
  25. console.log('ferment_input_status_N: ' + ferment_input_status_N)
  26. for (let i=0; i<ferment_input_status_N.length; i++) {
  27. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  28. // console.log(i+1 + ' : '+ ferment_output_status[i])
  29. // 1 : F_InputtingBean
  30. // 2 : F_Waiting
  31. if (ferment_input_status_N[i] == 'FI_InputtingBean') {
  32. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  33. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 入豆中")
  34. } else if (ferment_input_status_N[i] == 'FI_Waiting') {
  35. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  36. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 空桶等待")
  37. } else if (ferment_input_status_N[i] == 'FI_OutputtingBean') {
  38. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  39. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 可出豆")
  40. } else {
  41. console.log('pass')
  42. }
  43. }
  44. // 桶槽狀態顯示
  45. ferment_tank_status_N = ['{{F1}}', '{{F2}}', '{{F3}}', '{{F4}}', '{{F5}}', '{{F6}}',
  46. '{{F7}}', '{{F8}}', '{{F9}}', '{{F10}}', '{{F11}}', '{{F12}}']
  47. console.log('ferment_tank_status_N: ' + ferment_tank_status_N)
  48. for (let i=0; i<ferment_tank_status_N.length; i++) {
  49. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  50. // console.log(i+1 + ' : '+ ferment_tank_status[i])
  51. // 1 : F_InputtingBean
  52. // 2 : F_Waiting
  53. if (ferment_tank_status_N[i] == 'F_InputtingBean') {
  54. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  55. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆中")
  56. } else if (ferment_tank_status_N[i] == 'F_InputtingBean_Pause') {
  57. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  58. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆暫停")
  59. } else if (ferment_tank_status_N[i] == 'F_InputtingBean_Finish') {
  60. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  61. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆完成")
  62. } else if (ferment_tank_status_N[i] == 'F_InputtingWater') {
  63. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  64. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入水中")
  65. } else if (ferment_tank_status_N[i] == 'F_Waiting') {
  66. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  67. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 空桶等待")
  68. } else if (ferment_tank_status_N[i] == 'F_Cleaning') {
  69. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "plum")
  70. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 清洗中")
  71. } else if (ferment_tank_status_N[i] == 'F_Fermenting') {
  72. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  73. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發酵中")
  74. } else if (ferment_tank_status_N[i] == 'F_OutputtingBean') {
  75. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  76. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 可出豆")
  77. } else if (ferment_tank_status_N[i] == 'F_Warning') {
  78. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  79. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發生錯誤")
  80. $("#F"+parseInt(i+1)+"_status").css("color", "crimson")
  81. } else {
  82. console.log('pass')
  83. }
  84. }
  85. // 桶槽出料顯示
  86. ferment_output_status_N = ['{{FO1}}', '{{FO2}}']
  87. console.log('ferment_output_status_N: ' + ferment_output_status_N)
  88. for (let i=0; i<ferment_output_status_N.length; i++) {
  89. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  90. // console.log(i+1 + ' : '+ ferment_output_status[i])
  91. // 1 : F_InputtingBean
  92. // 2 : F_Waiting
  93. if (ferment_output_status_N[i] == 'FO_InputtingBean') {
  94. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  95. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 入豆中")
  96. } else if (ferment_output_status_N[i] == 'FO_Waiting') {
  97. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  98. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 空桶等待")
  99. } else if (ferment_output_status_N[i] == 'FO_OutputtingBean') {
  100. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  101. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 可出豆")
  102. } else {
  103. console.log('pass')
  104. }
  105. }
  106. // css
  107. // height: 185px; 取代成 height: 210px;
  108. // FI2 FO2 top: 620px; 取代成 top: 645px;
  109. });
  110. </script>
  111. <style>
  112. .F_status_css {
  113. font-weight: bold;
  114. text-align: center;
  115. }
  116. .FermentContainer_position {
  117. position: absolute;
  118. top: 95px;
  119. left: 53px;
  120. }
  121. .F1_position {
  122. width: 110px;
  123. }
  124. .F2_position {
  125. width: 110px;
  126. }
  127. .F3_position {
  128. width: 110px;
  129. }
  130. .F4_position {
  131. width: 110px;
  132. }
  133. .F5_position {
  134. width: 110px;
  135. }
  136. .F6_position {
  137. width: 110px;
  138. }
  139. .F7_position {
  140. width: 110px;
  141. }
  142. .F8_position {
  143. width: 110px;
  144. }
  145. .F9_position {
  146. width: 110px;
  147. }
  148. .F10_position {
  149. width: 110px;
  150. }
  151. .F11_position {
  152. width: 110px;
  153. }
  154. .F12_position {
  155. width: 110px;
  156. }
  157. .FI1_position {
  158. width: 110px;
  159. }
  160. .FI2_position {
  161. width: 110px;
  162. }
  163. .FO1_position {
  164. width: 110px;
  165. }
  166. .FO2_position {
  167. width: 110px;
  168. }
  169. .footer{
  170. position: absolute;
  171. bottom: 0px;
  172. width: 100%;
  173. background-color: #eee;
  174. text-align: center;
  175. }
  176. </style>
  177. <script language="JavaScript">
  178. // 指定 10秒 刷新網頁一次
  179. var WebUpdate_set
  180. // WebUpdate_set = setInterval(function(){WebUpdate()} , 60 * 1000)
  181. function WebUpdate(){
  182. console.log("-- 狀態更新 start --")
  183. /*
  184. $.get('/loading_container_status/F', '', function (res) {
  185. }, 'json');
  186. */
  187. console.log("-- 狀態更新 end --")
  188. };
  189. </script>
  190. </head>
  191. <body>
  192. <div id="wrapper">
  193. <div id="coffee_header">
  194. <!-- 匯入共同使用的 header.html 內容 -->
  195. {% include 'header.html' %}
  196. </div>
  197. <div>
  198. <!-- 發酵貨櫃 狀態表格-->
  199. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 10px;" cellpadding="5" border="1">
  200. <tr>
  201. <td style="border: lightsteelblue 1px solid;">
  202. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  203. <tr>
  204. <td>
  205. <!-- 發酵槽入料儲豆槽 FI1 -->
  206. <div id="FI1" tabindex="0" class="FI1_position" role="button" style="text-align: center;">
  207. <span id="FI1_status" class="F_status_css">FI1 status</span>
  208. <div id="FI1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  209. </div>
  210. </td>
  211. </tr>
  212. </table>
  213. </td>
  214. <td style="border: lightsteelblue 1px solid;">
  215. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  216. <tr>
  217. <td>
  218. <!-- 發酵槽 F1 -->
  219. <div id="F1" tabindex="0" class="F1_position" role="button">
  220. <span id="F1_status" class="F_status_css">F1 status</span>
  221. <!-- F1 狀態點點-->
  222. <div id="F1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  223. </div>
  224. </td>
  225. <td>
  226. <!-- 發酵槽 F2 -->
  227. <div id="F2" tabindex="0" class="F2_position" role="button">
  228. <span id="F2_status" class="F_status_css">F2 status</span>
  229. <div id="F2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  230. </div>
  231. </td>
  232. <td>
  233. <!-- 發酵槽 F3 -->
  234. <div id="F3" tabindex="0" class="F3_position" role="button">
  235. <span id="F3_status" class="F_status_css">F3 status</span>
  236. <div id="F3_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  237. </div>
  238. </td>
  239. <td>
  240. <!-- 發酵槽 F4 -->
  241. <div id="F4" tabindex="0" class="F4_position" role="button">
  242. <span id="F4_status" class="F_status_css">F4 status</span>
  243. <div id="F4_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  244. </div>
  245. </td>
  246. <td>
  247. <!-- 發酵槽 F5 -->
  248. <div id="F5" tabindex="0" class="F5_position" role="button">
  249. <span id="F5_status" class="F_status_css">F5 status</span>
  250. <div id="F5_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  251. </div>
  252. </td>
  253. <td>
  254. <!-- 發酵槽 F6 -->
  255. <div id="F6" tabindex="0" class="F6_position" role="button">
  256. <span id="F6_status" class="F_status_css">F6 status</span>
  257. <div id="F6_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  258. </div>
  259. </td>
  260. </tr>
  261. </table>
  262. </td>
  263. <td style="border: lightsteelblue 1px solid;">
  264. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  265. <tr>
  266. <td>
  267. <!-- 發酵槽出料儲豆槽 FO1 -->
  268. <div id="FO1" tabindex="0" class="FO1_position" role="button">
  269. <span id="FO1_status" class="F_status_css">FO1 status</span>
  270. <div id="FO1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  271. </div>
  272. </td>
  273. </tr>
  274. </table>
  275. </td>
  276. </tr>
  277. <tr>
  278. <td style="border: lightsteelblue 1px solid;">
  279. 入料儲豆槽
  280. </td>
  281. <td style="border: lightsteelblue 1px solid;">
  282. 發酵桶槽
  283. </td>
  284. <td style="border: lightsteelblue 1px solid;">
  285. 出料儲豆槽
  286. </td>
  287. </tr>
  288. <tr>
  289. <td style="border: lightsteelblue 1px solid;">
  290. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  291. <tr>
  292. <td>
  293. <!-- 發酵槽入料儲豆槽 FI2 -->
  294. <div id="FI2" tabindex="0" class="FI2_position" role="button">
  295. <span id="FI2_status" class="F_status_css">FI2 status</span>
  296. <div id="FI2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  297. </div>
  298. </td>
  299. </tr>
  300. </table>
  301. </td>
  302. <td style="border: lightsteelblue 1px solid;">
  303. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  304. <tr>
  305. <td>
  306. <!-- 發酵槽 F7 -->
  307. <div id="F7" tabindex="0" class="F7_position" role="button" style="vertical-align: bottom;">
  308. <span id="F7_status" class="F_status_css">F7 status</span>
  309. <div id="F7_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  310. </div>
  311. </td>
  312. <td>
  313. <!-- 發酵槽 F8 -->
  314. <div id="F8" tabindex="0" class="F8_position" role="button">
  315. <span id="F8_status" class="F_status_css">F8 status</span>
  316. <div id="F8_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  317. </div>
  318. </td>
  319. <td>
  320. <!-- 發酵槽 F9 -->
  321. <div id="F9" tabindex="0" class="F9_position" role="button">
  322. <span id="F9_status" class="F_status_css">F9 status</span>
  323. <div id="F9_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  324. </div>
  325. </td>
  326. <td>
  327. <!-- 發酵槽 F10 -->
  328. <div id="F10" tabindex="0" class="F10_position" role="button">
  329. <span id="F10_status" class="F_status_css">F10 status</span>
  330. <div id="F10_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  331. </div>
  332. </td>
  333. <td>
  334. <!-- 發酵槽 F11 -->
  335. <div id="F11" tabindex="0" class="F11_position" role="button">
  336. <span id="F11_status" class="F_status_css">F11 status</span>
  337. <div id="F11_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  338. </div>
  339. </td>
  340. <td>
  341. <!-- 發酵槽 F12 -->
  342. <div id="F12" tabindex="0" class="F12_position" role="button">
  343. <span id="F12_status" class="F_status_css">F12 status</span>
  344. <div id="F12_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  345. </div>
  346. </td>
  347. </tr>
  348. </table>
  349. </td>
  350. <td style="border: lightsteelblue 1px solid;">
  351. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  352. <tr>
  353. <td>
  354. <!-- 發酵槽出料儲豆槽 FO2 -->
  355. <div id="FO2" tabindex="0" class="FO2_position" role="button">
  356. <span id="FO2_status" class="F_status_css">FO2 status</span>
  357. <div id="FO2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  358. </div>
  359. </td>
  360. </tr>
  361. </table>
  362. </td>
  363. </tr>
  364. </table>
  365. <!-- 發酵貨櫃 參數設定-->
  366. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 10px;" cellpadding="5" border="1">
  367. <tr>
  368. <td>
  369. 發酵自動化<br>
  370. 排程
  371. </td>
  372. <td>
  373. 入料儲豆槽<br>
  374. 參數設定
  375. </td>
  376. <td>
  377. 桶槽<br>
  378. 參數設定
  379. </td>
  380. <td>
  381. 出料儲豆槽<br>
  382. 參數設定
  383. </td>
  384. </tr>
  385. <tr>
  386. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  387. <label><input type="checkbox" id="cb_fermenting" checked>&nbsp; 發酵</label><br>
  388. <label><input type="checkbox" id="cb_cleaning">&nbsp; 清洗</label><br>
  389. <label><input type="checkbox" id="cb_calibratingEC">&nbsp; 校正 EC</label><br>
  390. <label><input type="checkbox" id="cb_calibratingSTIR">&nbsp; 校正攪拌棒</label>
  391. </td>
  392. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  393. 吸料時間&nbsp;
  394. <input name="Ferment_Input_vacuumON_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  395. 放料時間&nbsp;
  396. <input name="Ferment_Input_vacuumOFF_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  397. </td>
  398. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  399. 指定生豆高度&nbsp;
  400. <input name="Ferment_Tank_bean_height" type="text" value="60" style="width:50px;">&nbsp; 公分<br>
  401. 吸料時間&nbsp;
  402. <input name="Ferment_Tank_vacuumON_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  403. 放料時間&nbsp;
  404. <input name="Ferment_Tank_vacuumOFF_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  405. 指定水位高度&nbsp;
  406. <input name="Ferment_Tank_water_height" type="text" value="120" style="width:50px;">&nbsp; 公分<br>
  407. 馬達轉速&nbsp;
  408. <input name="Ferment_Tank_motor_rpm" type="text" value="30" style="width:50px;">&nbsp; rpm<br>
  409. ----- 發酵完成條件 (輸入 0 代表不設定) ------------------------------------------<br>
  410. 指定發酵溫度&nbsp;
  411. <input name="Ferment_Tank_fermenting_temp" type="text" value="40" style="width:50px;">&nbsp; ℃
  412. , 且指定持溫時間&nbsp;
  413. <input name="Ferment_Tank_fermenting_time" type="text" value="30" style="width:50px;">&nbsp; 分鐘<br>
  414. 指定 pH &nbsp;
  415. <input name="Ferment_Tank_fermenting_pH" type="text" value="5" style="width:50px;">&nbsp;/&nbsp;
  416. 指定 DO &nbsp;
  417. <input name="Ferment_Tank_fermenting_DO" type="text" value="43" style="width:50px;">&nbsp;/&nbsp;
  418. 指定 ORP &nbsp;
  419. <input name="Ferment_Tank_fermenting_ORP" type="text" value="-0.5" style="width:50px;">&nbsp;/&nbsp;
  420. 指定 EC &nbsp;
  421. <input name="Ferment_Tank_fermenting_EC" type="text" value="300" style="width:50px;">&nbsp;<br>
  422. </td>
  423. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  424. 吸料時間&nbsp;
  425. <input name="Ferment_Output_vacuumON_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  426. 放料時間&nbsp;
  427. <input name="Ferment_Output_vacuumOFF_time" type="text" value="10" style="width:50px;">&nbsp; 秒<br>
  428. </td>
  429. </tr>
  430. </table>
  431. <center><button style="margin: 15px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="ferment_auto()">
  432. [測試] MQTT + 每 60 秒更新貨櫃狀態</button></center>
  433. <script>
  434. function ferment_auto(){
  435. var Ferment_Input_vacuumON_time = $("input[name=Ferment_Input_vacuumON_time]").val();
  436. var Ferment_Input_vacuumOFF_time = $("input[name=Ferment_Input_vacuumOFF_time]").val();
  437. var Ferment_Tank_bean_height = $("input[name=Ferment_Tank_bean_height]").val();
  438. var Ferment_Tank_vacuumON_time = $("input[name=Ferment_Tank_vacuumON_time]").val();
  439. var Ferment_Tank_vacuumOFF_time = $("input[name=Ferment_Tank_vacuumOFF_time]").val();
  440. var Ferment_Tank_water_height = $("input[name=Ferment_Tank_water_height]").val();
  441. var Ferment_Tank_fermenting_temp = $("input[name=Ferment_Tank_fermenting_temp]").val();
  442. var Ferment_Tank_fermenting_time = $("input[name=Ferment_Tank_fermenting_time]").val();
  443. var Ferment_Tank_fermenting_pH = $("input[name=Ferment_Tank_fermenting_pH]").val();
  444. var Ferment_Tank_fermenting_DO = $("input[name=Ferment_Tank_fermenting_DO]").val();
  445. var Ferment_Tank_fermenting_ORP = $("input[name=Ferment_Tank_fermenting_ORP]").val();
  446. var Ferment_Tank_fermenting_EC = $("input[name=Ferment_Tank_fermenting_EC]").val();
  447. var Ferment_Tank_motor_rpm = $("input[name=Ferment_Tank_motor_rpm]").val();
  448. var Ferment_Output_vacuumON_time = $("input[name=Ferment_Output_vacuumON_time]").val();
  449. var Ferment_Output_vacuumOFF_time = $("input[name=Ferment_Output_vacuumOFF_time]").val();
  450. var data = { 'command': 'Ferment_auto_parameter',
  451. 'Ferment_Input_vacuumON_time': Ferment_Input_vacuumON_time,
  452. 'Ferment_Input_vacuumOFF_time': Ferment_Input_vacuumOFF_time,
  453. 'Ferment_Tank_bean_height': Ferment_Tank_bean_height,
  454. 'Ferment_Tank_vacuumON_time': Ferment_Tank_vacuumON_time,
  455. 'Ferment_Tank_vacuumOFF_time': Ferment_Tank_vacuumOFF_time,
  456. 'Ferment_Tank_water_height': Ferment_Tank_water_height,
  457. 'Ferment_Tank_fermenting_temp': Ferment_Tank_fermenting_temp,
  458. 'Ferment_Tank_fermenting_time': Ferment_Tank_fermenting_time,
  459. 'Ferment_Tank_fermenting_pH': Ferment_Tank_fermenting_pH,
  460. 'Ferment_Tank_fermenting_DO': Ferment_Tank_fermenting_DO,
  461. 'Ferment_Tank_fermenting_ORP': Ferment_Tank_fermenting_ORP,
  462. 'Ferment_Tank_fermenting_EC': Ferment_Tank_fermenting_EC,
  463. 'Ferment_Tank_motor_rpm': Ferment_Tank_motor_rpm,
  464. 'Ferment_Output_vacuumON_time': Ferment_Output_vacuumON_time,
  465. 'Ferment_Output_vacuumOFF_time': Ferment_Output_vacuumOFF_time };
  466. $.post('/mqtt/101', data, function (res) {
  467. console.log('data: ', data)
  468. console.log('res: ', res)
  469. }, 'text')
  470. var ferment_interval = setInterval(testing_F_auto, 30*1000)
  471. }
  472. </script>
  473. <center><button style="margin: 15px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="testing_F_auto()">
  474. [測試] 發酵貨櫃狀態</button></center>
  475. <script>
  476. function test(){
  477. /*
  478. if ($('#cb_fermenting').prop('checked')) {
  479. console.log("發酵自動化:加入發酵排程");
  480. } else {
  481. }
  482. if ($('#cb_cleaning').prop('checked')) {
  483. console.log("發酵自動化:加入清洗排程");
  484. }
  485. if ($('#cb_calibratingEC').prop('checked')) {
  486. console.log("發酵自動化:加入校正 EC 排程");
  487. }
  488. if ($('#cb_calibratingSTIR').prop('checked')) {
  489. console.log("發酵自動化:加入校正攪拌棒排程");
  490. }
  491. */
  492. console.log(FermentAuto_fermenting)
  493. console.log(FermentAuto_cleaning)
  494. console.log(FermentAuto_calibratingEC)
  495. console.log(FermentAuto_calibratingSTIR)
  496. };
  497. function testing_F_auto(){
  498. var FermentAuto_fermenting = $('#cb_fermenting').prop('checked')
  499. var FermentAuto_cleaning = $('#cb_cleaning').prop('checked')
  500. var FermentAuto_calibratingEC = $('#cb_calibratingEC').prop('checked')
  501. var FermentAuto_calibratingSTIR = $('#cb_calibratingSTIR').prop('checked')
  502. var Ferment_Input_vacuumON_time = $("input[name=Ferment_Input_vacuumON_time]").val();
  503. var Ferment_Input_vacuumOFF_time = $("input[name=Ferment_Input_vacuumOFF_time]").val();
  504. var Ferment_Tank_bean_height = $("input[name=Ferment_Tank_bean_height]").val();
  505. var Ferment_Tank_vacuumON_time = $("input[name=Ferment_Tank_vacuumON_time]").val();
  506. var Ferment_Tank_vacuumOFF_time = $("input[name=Ferment_Tank_vacuumOFF_time]").val();
  507. var Ferment_Tank_water_height = $("input[name=Ferment_Tank_water_height]").val();
  508. var Ferment_Tank_fermenting_temp = $("input[name=Ferment_Tank_fermenting_temp]").val();
  509. var Ferment_Tank_fermenting_time = $("input[name=Ferment_Tank_fermenting_time]").val();
  510. var Ferment_Tank_fermenting_pH = $("input[name=Ferment_Tank_fermenting_pH]").val();
  511. var Ferment_Tank_fermenting_DO = $("input[name=Ferment_Tank_fermenting_DO]").val();
  512. var Ferment_Tank_fermenting_ORP = $("input[name=Ferment_Tank_fermenting_ORP]").val();
  513. var Ferment_Tank_fermenting_EC = $("input[name=Ferment_Tank_fermenting_EC]").val();
  514. var Ferment_Tank_motor_rpm = $("input[name=Ferment_Tank_motor_rpm]").val();
  515. var Ferment_Output_vacuumON_time = $("input[name=Ferment_Output_vacuumON_time]").val();
  516. var Ferment_Output_vacuumOFF_time = $("input[name=Ferment_Output_vacuumOFF_time]").val();
  517. var data = { 'command': 'Ferment_auto_parameter',
  518. 'FermentAuto_fermenting': FermentAuto_fermenting,
  519. 'FermentAuto_cleaning': FermentAuto_cleaning,
  520. 'FermentAuto_calibratingEC': FermentAuto_calibratingEC,
  521. 'FermentAuto_calibratingSTIR': FermentAuto_calibratingSTIR,
  522. 'Ferment_Input_vacuumON_time': Ferment_Input_vacuumON_time,
  523. 'Ferment_Input_vacuumOFF_time': Ferment_Input_vacuumOFF_time,
  524. 'Ferment_Tank_bean_height': Ferment_Tank_bean_height,
  525. 'Ferment_Tank_vacuumON_time': Ferment_Tank_vacuumON_time,
  526. 'Ferment_Tank_vacuumOFF_time': Ferment_Tank_vacuumOFF_time,
  527. 'Ferment_Tank_water_height': Ferment_Tank_water_height,
  528. 'Ferment_Tank_fermenting_temp': Ferment_Tank_fermenting_temp,
  529. 'Ferment_Tank_fermenting_time': Ferment_Tank_fermenting_time,
  530. 'Ferment_Tank_fermenting_pH': Ferment_Tank_fermenting_pH,
  531. 'Ferment_Tank_fermenting_DO': Ferment_Tank_fermenting_DO,
  532. 'Ferment_Tank_fermenting_ORP': Ferment_Tank_fermenting_ORP,
  533. 'Ferment_Tank_fermenting_EC': Ferment_Tank_fermenting_EC,
  534. 'Ferment_Tank_motor_rpm': Ferment_Tank_motor_rpm,
  535. 'Ferment_Output_vacuumON_time': Ferment_Output_vacuumON_time,
  536. 'Ferment_Output_vacuumOFF_time': Ferment_Output_vacuumOFF_time };
  537. $.get('/ferment_auto_status', data, function (res) {
  538. Ferment_Input_1_STATUS = res.Ferment_Input_1
  539. console.log('FI1: ' + res.Ferment_Input_1)
  540. console.log('F1: ' + res.Ferment_Tank_1)
  541. console.log('F2: ' + res.Ferment_Tank_2)
  542. console.log('F3: ' + res.Ferment_Tank_3)
  543. console.log('F4: ' + res.Ferment_Tank_4)
  544. console.log('F5: ' + res.Ferment_Tank_5)
  545. console.log('F6: ' + res.Ferment_Tank_6)
  546. console.log('FO1: ' + res.Ferment_Output_1)
  547. // ----- 發酵出料 FO1 狀態 --------------------------------------------------------------
  548. ferment_input_status = [res.Ferment_Input_1]
  549. for (let i=0; i<ferment_input_status.length; i++) {
  550. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  551. // console.log(i+1 + ' : '+ ferment_output_status[i])
  552. // 1 : F_InputtingBean
  553. // 2 : F_Waiting
  554. if (ferment_input_status[i] == 'FI_InputtingBean') {
  555. console.log('[動作] 發酵入料 FI' + parseInt(i+1) + ' 入豆中')
  556. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  557. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 入豆中")
  558. } else if (ferment_input_status[i] == 'FI_Waiting') {
  559. console.log('[動作] 發酵入料 FI' + parseInt(i+1) + ' 空桶等待')
  560. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  561. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 空桶等待")
  562. } else if (ferment_input_status[i] == 'FI_OutputtingBean') {
  563. console.log('[動作] 發酵入料 FI' + parseInt(i+1) + ' 可出豆')
  564. $("#FI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  565. $("#FI"+parseInt(i+1)+"_status").text("FI" + parseInt(i+1) + " 可出豆")
  566. } else {
  567. console.log('pass')
  568. }
  569. }
  570. // ----- 發酵桶槽 F1~F6 狀態 --------------------------------------------------------------
  571. ferment_tank_status = [res.Ferment_Tank_1, res.Ferment_Tank_2, res.Ferment_Tank_3,
  572. res.Ferment_Tank_4, res.Ferment_Tank_5, res.Ferment_Tank_6]
  573. for (let i=0; i<ferment_tank_status.length; i++) {
  574. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  575. // console.log(i+1 + ' : '+ ferment_tank_status[i])
  576. // 1 : F_InputtingBean
  577. // 2 : F_Waiting
  578. if (ferment_tank_status[i] == 'F_InputtingBean') {
  579. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 入豆中')
  580. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  581. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆中")
  582. } else if (ferment_tank_status[i] == 'F_InputtingBean_Pause') {
  583. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 入豆暫停')
  584. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  585. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆暫停")
  586. } else if (ferment_tank_status[i] == 'F_InputtingBean_Finish') {
  587. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 入豆完成')
  588. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  589. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆完成")
  590. } else if (ferment_tank_status[i] == 'F_InputtingWater') {
  591. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 入水中')
  592. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  593. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入水中")
  594. } else if (ferment_tank_status[i] == 'F_Waiting') {
  595. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 空桶等待')
  596. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  597. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 空桶等待")
  598. } else if (ferment_tank_status[i] == 'F_Fermenting') {
  599. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 發酵中')
  600. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  601. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發酵中")
  602. } else if (ferment_tank_status[i] == 'F_OutputtingBean') {
  603. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 可出豆')
  604. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  605. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 可出豆")
  606. } else if (ferment_tank_status[i] == 'F_Warning') {
  607. console.log('[動作] 發酵桶槽 F' + parseInt(i+1) + ' 發生錯誤')
  608. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  609. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發生錯誤")
  610. $("#F"+parseInt(i+1)+"_status").css("color", "crimson")
  611. } else {
  612. console.log('pass')
  613. }
  614. }
  615. // ----- 發酵出料 FO1 狀態 --------------------------------------------------------------
  616. ferment_output_status = [res.Ferment_Output_1]
  617. for (let i=0; i<ferment_output_status.length; i++) {
  618. // 顯示對應發酵桶槽號碼 F1~F6 和目前狀態
  619. // console.log(i+1 + ' : '+ ferment_output_status[i])
  620. // 1 : F_InputtingBean
  621. // 2 : F_Waiting
  622. if (ferment_output_status[i] == 'FO_InputtingBean') {
  623. console.log('[動作] 發酵出料 FO' + parseInt(i+1) + ' 入豆中')
  624. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  625. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 入豆中")
  626. } else if (ferment_output_status[i] == 'FO_Waiting') {
  627. console.log('[動作] 發酵出料 FO' + parseInt(i+1) + ' 空桶等待')
  628. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  629. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 空桶等待")
  630. } else if (ferment_output_status[i] == 'FO_OutputtingBean') {
  631. console.log('[動作] 發酵出料 FO' + parseInt(i+1) + ' 可出豆')
  632. $("#FO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  633. $("#FO"+parseInt(i+1)+"_status").text("FO" + parseInt(i+1) + " 可出豆")
  634. } else {
  635. console.log('pass')
  636. }
  637. }
  638. /*
  639. console.log(res.Ferment_Input_2)
  640. console.log(res.Ferment_Tank_7)
  641. console.log(res.Ferment_Tank_8)
  642. console.log(res.Ferment_Tank_9)
  643. console.log(res.Ferment_Tank_10)
  644. console.log(res.Ferment_Tank_11)
  645. console.log(res.Ferment_Tank_12)
  646. console.log(res.Ferment_Output_1)
  647. console.log(res.Ferment_Output_2)
  648. */
  649. }, 'json');
  650. // console.log("-- 自動化程式 end --")
  651. }
  652. </script>
  653. </div>
  654. <div id="coffee_footer">
  655. <!-- 匯入共同使用的 footer.html 內容 -->
  656. {% include 'footer.html' %}
  657. </div>
  658. </div>
  659. </body>
  660. </html>