demo.html 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  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. <!-- 新 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. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <style>
  18. .span-sensor-value {
  19. font-weight:600;
  20. padding-left: 3px;
  21. }
  22. .demo_status_css {
  23. font-weight: bold;
  24. text-align: center;
  25. }
  26. .input-text {
  27. height: 25px;
  28. width: 35px;
  29. text-align: center;
  30. margin-left: 2px;
  31. margin-right: 5px;
  32. }
  33. </style>
  34. <script>
  35. $(document).ready(function(){
  36. $("#coffee_title_pc").text('DEMO 貨櫃');
  37. $("#coffee_title_phone").text('DEMO 貨櫃');
  38. // $(document).attr("title", '{{title}}');
  39. loading_status();
  40. loading_sensors();
  41. });
  42. clean_input_status = ['{{CI1}}', '{{CI2}}']
  43. // console.log('clean_input_status: ' + clean_input_status)
  44. clean_tank_status = ['{{C1}}', '{{C2}}']
  45. // console.log('clean_tank_status: ' + clean_tank_status)
  46. colorselect_tank_status = ['{{S1}}', '{{S2}}']
  47. // console.log('colorselect_tank_status: ' + colorselect_tank_status)
  48. colorselect_outputg_status = ['{{SOg1}}', '{{SOg2}}']
  49. // console.log('colorselect_outputg_status: ' + colorselect_outputg_status)
  50. colorselect_outputb_status = ['{{SOb1}}', '{{SOb2}}']
  51. // console.log('colorselect_outputb_status: ' + colorselect_outputb_status)
  52. peel_tank_status = ['{{P1}}', '{{P2}}']
  53. // console.log('peel_tank_status: ' + peel_tank_status)
  54. peel_output_status = ['{{PO1}}', '{{PO2}}']
  55. // console.log('peel_output_status: ' + peel_output_status)
  56. ferment_tank_status = ['{{F1}}', '{{F2}}']
  57. dry_tank_status = ['{{D1}}', '{{D2}}']
  58. dry_output_status = ['{{DO1}}', '{{DO2}}']
  59. peel_outputb_status = ['{{POb1}}']
  60. // console.log('peel_outputb_status: ' + peel_outputb_status)
  61. // 更新桶槽狀態
  62. function loading_status(){
  63. for (let i=0; i<clean_input_status.length; i++) {
  64. if (clean_input_status[i] == 'CI_InputtingBean') {
  65. $("#CI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  66. $("#CI"+parseInt(i+1)+"_status").text("CI" + parseInt(i+1) + " 入豆中")
  67. } else if (clean_input_status[i] == 'CI_Waiting') {
  68. $("#CI"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  69. $("#CI"+parseInt(i+1)+"_status").text("CI" + parseInt(i+1) + " 空桶等待")
  70. } else if (clean_input_status[i] == 'CI_OutputtingBean') {
  71. $("#CI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  72. $("#CI"+parseInt(i+1)+"_status").text("CI" + parseInt(i+1) + " 可出豆")
  73. } else if (clean_input_status[i] == 'CI_Warning') {
  74. $("#CI"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  75. $("#CI"+parseInt(i+1)+"_status").text("CI" + parseInt(i+1) + " 發生錯誤")
  76. $("#CI"+parseInt(i+1)+"_status").css("color", "crimson")
  77. } else {
  78. console.log('CI pass')
  79. }
  80. }
  81. for (let i=0; i<clean_tank_status.length; i++) {
  82. if (clean_tank_status[i] == 'C_InputtingBean') {
  83. $("#C"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  84. $("#C"+parseInt(i+1)+"_status").text("C" + parseInt(i+1) + " 入豆中")
  85. } else if (clean_tank_status[i] == 'C_Waiting') {
  86. $("#C"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  87. $("#C"+parseInt(i+1)+"_status").text("C" + parseInt(i+1) + " 空桶等待")
  88. } else if (clean_tank_status[i] == 'C_OutputtingBean') {
  89. $("#C"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  90. $("#C"+parseInt(i+1)+"_status").text("C" + parseInt(i+1) + " 可出豆")
  91. } else if (clean_tank_status[i] == 'C_Warning') {
  92. $("#C"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  93. $("#C"+parseInt(i+1)+"_status").text("C" + parseInt(i+1) + " 發生錯誤")
  94. $("#C"+parseInt(i+1)+"_status").css("color", "crimson")
  95. } else {
  96. console.log('C pass')
  97. }
  98. }
  99. for (let i=0; i<colorselect_tank_status.length; i++) {
  100. if (colorselect_tank_status[i] == 'S_InputtingBean') {
  101. $("#S"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  102. $("#S"+parseInt(i+1)+"_status").text("S" + parseInt(i+1) + " 入豆中")
  103. } else if (colorselect_tank_status[i] == 'S_Waiting') {
  104. $("#S"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  105. $("#S"+parseInt(i+1)+"_status").text("S" + parseInt(i+1) + " 空桶等待")
  106. } else if (colorselect_tank_status[i] == 'S_OutputtingBean') {
  107. $("#S"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  108. $("#S"+parseInt(i+1)+"_status").text("S" + parseInt(i+1) + " 可出豆")
  109. } else if (colorselect_tank_status[i] == 'S_Warning') {
  110. $("#S"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  111. $("#S"+parseInt(i+1)+"_status").text("S" + parseInt(i+1) + " 發生錯誤")
  112. $("#S"+parseInt(i+1)+"_status").css("color", "crimson")
  113. } else {
  114. console.log('S pass')
  115. }
  116. }
  117. for (let i=0; i<colorselect_outputg_status.length; i++) {
  118. if (colorselect_outputg_status[i] == 'SO_InputtingBean') {
  119. $("#SOg"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  120. $("#SOg"+parseInt(i+1)+"_status").text("SOg" + parseInt(i+1) + " 入豆中")
  121. } else if (colorselect_outputg_status[i] == 'SO_Waiting') {
  122. $("#SOg"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  123. $("#SOg"+parseInt(i+1)+"_status").text("SOg" + parseInt(i+1) + " 空桶等待")
  124. } else if (colorselect_outputg_status[i] == 'SO_OutputtingBean') {
  125. $("#SOg"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  126. $("#SOg"+parseInt(i+1)+"_status").text("SOg" + parseInt(i+1) + " 可出豆")
  127. } else if (colorselect_outputg_status[i] == 'SO_Warning') {
  128. $("#SOg"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  129. $("#SOg"+parseInt(i+1)+"_status").text("SOg" + parseInt(i+1) + " 發生錯誤")
  130. $("#SOg"+parseInt(i+1)+"_status").css("color", "crimson")
  131. } else {
  132. console.log('SOg pass')
  133. }
  134. }
  135. for (let i=0; i<colorselect_outputb_status.length; i++) {
  136. if (colorselect_outputb_status[i] == 'SO_InputtingBean') {
  137. $("#SOb"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  138. $("#SOb"+parseInt(i+1)+"_status").text("SOb" + parseInt(i+1) + " 入豆中")
  139. } else if (colorselect_outputb_status[i] == 'SO_Waiting') {
  140. $("#SOb"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  141. $("#SOb"+parseInt(i+1)+"_status").text("SOb" + parseInt(i+1) + " 空桶等待")
  142. } else if (colorselect_outputb_status[i] == 'SO_OutputtingBean') {
  143. $("#SOb"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  144. $("#SOb"+parseInt(i+1)+"_status").text("SOb" + parseInt(i+1) + " 可出豆")
  145. } else if (colorselect_outputb_status[i] == 'SO_Warning') {
  146. $("#SOb"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  147. $("#SOb"+parseInt(i+1)+"_status").text("SOb" + parseInt(i+1) + " 發生錯誤")
  148. $("#SOb"+parseInt(i+1)+"_status").css("color", "crimson")
  149. } else {
  150. console.log('SOb pass')
  151. }
  152. }
  153. for (let i=0; i<peel_tank_status.length; i++) {
  154. if (peel_tank_status[i] == 'P_Waiting') {
  155. $("#P"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  156. $("#P"+parseInt(i+1)+"_status").text("P" + parseInt(i+1) + " 等待中")
  157. } else if (peel_tank_status[i] == 'P_Peeling') {
  158. $("#P"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  159. $("#P"+parseInt(i+1)+"_status").text("P" + parseInt(i+1) + " 脫皮中")
  160. // } else if (peel_tank_status[i] == 'P_InputtingBean') {
  161. // $("#P"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  162. // $("#P"+parseInt(i+1)+"_status").text("P" + parseInt(i+1) + " 入豆中")
  163. // } else if (peel_tank_status[i] == 'P_OutputtingBean') {
  164. // $("#P"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  165. // $("#P"+parseInt(i+1)+"_status").text("P" + parseInt(i+1) + " 可出豆")
  166. } else if (peel_tank_status[i] == 'P_Warning') {
  167. $("#P"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  168. $("#P"+parseInt(i+1)+"_status").text("P" + parseInt(i+1) + " 發生錯誤")
  169. $("#P"+parseInt(i+1)+"_status").css("color", "crimson")
  170. } else {
  171. console.log('P pass')
  172. }
  173. }
  174. for (let i=0; i<peel_output_status.length; i++) {
  175. if (peel_output_status[i] == 'PO_InputtingBean') {
  176. $("#PO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  177. $("#PO"+parseInt(i+1)+"_status").text("PO" + parseInt(i+1) + " 入豆中")
  178. } else if (peel_output_status[i] == 'PO_Waiting') {
  179. $("#PO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  180. $("#PO"+parseInt(i+1)+"_status").text("PO" + parseInt(i+1) + " 空桶等待")
  181. } else if (peel_output_status[i] == 'PO_OutputtingBean') {
  182. $("#PO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  183. $("#PO"+parseInt(i+1)+"_status").text("PO" + parseInt(i+1) + " 可出豆")
  184. } else if (peel_output_status[i] == 'PO_Warning') {
  185. $("#PO"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  186. $("#PO"+parseInt(i+1)+"_status").text("PO" + parseInt(i+1) + " 發生錯誤")
  187. $("#PO"+parseInt(i+1)+"_status").css("color", "crimson")
  188. } else {
  189. console.log('PO pass')
  190. }
  191. }
  192. for (let i=0; i<ferment_tank_status.length; i++) {
  193. if (ferment_tank_status[i] == 'F_InputtingBean') {
  194. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  195. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆中")
  196. } else if (ferment_tank_status[i] == 'F_InputtingBean_Pause') {
  197. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  198. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆暫停")
  199. } else if (ferment_tank_status[i] == 'F_InputtingBean_Finish') {
  200. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  201. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入豆完成")
  202. } else if (ferment_tank_status[i] == 'F_InputtingWater') {
  203. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  204. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 入水中")
  205. } else if (ferment_tank_status[i] == 'F_Waiting') {
  206. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  207. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 空桶等待")
  208. } else if (ferment_tank_status[i] == 'F_Cleaning') {
  209. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "plum")
  210. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 清洗中")
  211. } else if (ferment_tank_status[i] == 'F_Fermenting') {
  212. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  213. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發酵中")
  214. } else if (ferment_tank_status[i] == 'F_OutputtingBean') {
  215. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  216. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 可出豆")
  217. } else if (ferment_tank_status[i] == 'F_Warning') {
  218. $("#F"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  219. $("#F"+parseInt(i+1)+"_status").text("F" + parseInt(i+1) + " 發生錯誤")
  220. $("#F"+parseInt(i+1)+"_status").css("color", "crimson")
  221. } else {
  222. console.log('F pass')
  223. }
  224. }
  225. for (let i=0; i<dry_tank_status.length; i++) {
  226. if (dry_tank_status[i] == 'D_InputtingBean') {
  227. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  228. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆中")
  229. } else if (dry_tank_status[i] == 'D_InputtingBean_Pause') {
  230. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  231. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆暫停")
  232. } else if (dry_tank_status[i] == 'D_InputtingBean_Finish') {
  233. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  234. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆完成")
  235. } else if (dry_tank_status[i] == 'D_Waiting') {
  236. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  237. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 空桶等待")
  238. } else if (dry_tank_status[i] == 'D_Cleaning') {
  239. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "plum")
  240. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 清洗中")
  241. } else if (dry_tank_status[i] == 'D_Drying') {
  242. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  243. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 乾燥中")
  244. } else if (dry_tank_status[i] == 'D_OutputtingBean') {
  245. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  246. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 可出豆")
  247. } else if (dry_tank_status[i] == 'D_Warning') {
  248. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  249. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 發生錯誤")
  250. $("#D"+parseInt(i+1)+"_status").css("color", "crimson")
  251. } else {
  252. console.log('pass')
  253. }
  254. }
  255. for (let i=0; i<dry_output_status.length; i++) {
  256. if (dry_output_status[i] == 'DO_InputtingBean') {
  257. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  258. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 入豆中")
  259. } else if (dry_output_status[i] == 'DO_Waiting') {
  260. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  261. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 空桶等待")
  262. } else if (dry_output_status[i] == 'DO_OutputtingBean') {
  263. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  264. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 可出豆")
  265. } else {
  266. console.log('DO pass')
  267. }
  268. }
  269. for (let i=0; i<peel_outputb_status.length; i++) {
  270. if (peel_outputb_status[i] == 'PO_InputtingBean') {
  271. $("#POb"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  272. $("#POb"+parseInt(i+1)+"_status").text("POb" + parseInt(i+1) + " 入豆中")
  273. } else if (peel_outputb_status[i] == 'PO_Waiting') {
  274. $("#POb"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  275. $("#POb"+parseInt(i+1)+"_status").text("POb" + parseInt(i+1) + " 空桶等待")
  276. } else if (peel_outputb_status[i] == 'PO_OutputtingBean') {
  277. $("#POb"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  278. $("#POb"+parseInt(i+1)+"_status").text("POb" + parseInt(i+1) + " 可出豆")
  279. } else {
  280. console.log('POb pass')
  281. }
  282. }
  283. //
  284. };
  285. // 更新 UltraSonic 數值
  286. function loading_sensors(){
  287. $.get('/loading_sensors', '', function (res){
  288. $("#C1_UltraSonic").text(res.C1_UltraSonic);
  289. $("#C2_UltraSonic").text(res.C2_UltraSonic);
  290. $("#PO1_UltraSonic").text(res.PO1_UltraSonic);
  291. $("#PO2_UltraSonic").text(res.PO2_UltraSonic);
  292. $("#F1_UltraSonic").text(res.F1_UltraSonic);
  293. $("#F1_SHT11Temp").text(res.F1_SHT11Temp);
  294. $("#F1_SHT11Humidity").text(res.F1_SHT11Humidity);
  295. $("#F2_UltraSonic").text(res.F2_UltraSonic);
  296. $("#D1_UltraSonic").text(res.D1_UltraSonic);
  297. $("#D1_SHT11Temp").text(res.D1_SHT11Temp);
  298. $("#D1_SHT11Humidity").text(res.D1_SHT11Humidity);
  299. $("#D2_UltraSonic").text(res.D2_UltraSonic);
  300. $("#DO1_UltraSonic").text(res.DO1_UltraSonic);
  301. $("#DO2_UltraSonic").text(res.DO2_UltraSonic);
  302. }, 'json');
  303. }
  304. var data; // 狀態判斷傳參數用
  305. var peel_status_process = 0;
  306. var peel_status_interval; // 脫皮機自動化, 間隔 5 秒執行
  307. var ferment_status_process = 0;
  308. var ferment_status_interval; // 發酵槽自動化, 間隔 5 秒執行
  309. var dry_status_process = 0;
  310. var dry_status_interval; // 乾燥槽自動化, 間隔 5 秒執行
  311. </script>
  312. </head>
  313. <body>
  314. <div id="wrapper">
  315. <div id="coffee_header">
  316. <!-- 匯入共同使用的 header.html 內容 -->
  317. {% include 'header.html' %}
  318. </div>
  319. <div>
  320. <!-- DEMO 貨櫃 狀態表格 -->
  321. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 5px;" cellpadding="5" border="1">
  322. <tr>
  323. <td>
  324. <!-- 清洗浮選槽入料 CI1 -->
  325. <div id="CI1" tabindex="0" class="CI1_position" role="button" style="text-align: center;">
  326. <span id="CI1_status" class="demo_status_css">CI1 status</span>
  327. <div id="CI1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  328. </div>
  329. </td>
  330. <td>
  331. <!-- 清洗浮選槽 C1 -->
  332. <div id="C1" tabindex="0" class="C1_position" role="button" style="text-align: center;">
  333. <span id="C1_status" class="demo_status_css">C1 status</span>
  334. <div id="C1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  335. </div>
  336. </td>
  337. <td>
  338. 中水桶
  339. </td>
  340. <td>
  341. <!-- 色選機 S1 -->
  342. <div id="S1" tabindex="0" class="S1_position" role="button" style="text-align: center;">
  343. <span id="S1_status" class="demo_status_css">S1 status</span>
  344. <div id="S1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  345. </div>
  346. </td>
  347. <td>
  348. <!-- 色選機好果 SOg1 -->
  349. <div id="SOg1" tabindex="0" class="SOg1_position" role="button" style="text-align: center;">
  350. <span id="SOg1_status" class="demo_status_css">SOg1 status</span>
  351. <div id="SOg1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  352. </div>
  353. </td>
  354. <td>
  355. <!-- 色選機好果 SOb1 -->
  356. <div id="SOb1" tabindex="0" class="SOb1_position" role="button" style="text-align: center;">
  357. <span id="SOb1_status" class="demo_status_css">SOb1 status</span>
  358. <div id="SOb1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  359. </div>
  360. </td>
  361. <td>
  362. <!-- 脫皮機 P1 -->
  363. <div id="P1" tabindex="0" class="P1_position" role="button" style="text-align: center;">
  364. <span id="P1_status" class="demo_status_css">P1 status</span>
  365. <div id="P1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  366. </div>
  367. </td>
  368. <td>
  369. <!-- 脫皮機出料儲豆槽 PO1 -->
  370. <div id="PO1" tabindex="0" class="PO1_position" role="button" style="text-align: center;">
  371. <span id="PO1_status" class="demo_status_css">PO1 status</span>
  372. <div id="PO1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  373. </div>
  374. </td>
  375. <td>
  376. <!-- 發酵槽 F1 -->
  377. <div id="F1" tabindex="0" class="F1_position" role="button" style="vertical-align: bottom;">
  378. <span id="F1_status" class="demo_status_css">F1 status</span>
  379. <div id="F1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  380. </div>
  381. </td>
  382. <td>
  383. <!-- 乾燥槽 D1 -->
  384. <div id="D1" tabindex="0" class="D1_position" role="button" style="vertical-align: bottom;">
  385. <span id="D1_status" class="demo_status_css">D1 status</span>
  386. <div id="D1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  387. </div>
  388. </td>
  389. <td>
  390. <!-- 乾燥槽 DO1 -->
  391. <div id="DO1" tabindex="0" class="DO1_position" role="button" style="vertical-align: bottom;">
  392. <span id="DO1_status" class="demo_status_css">DO1 status</span>
  393. <div id="DO1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  394. </div>
  395. </td>
  396. <td>
  397. </td>
  398. </tr>
  399. <tr>
  400. <td>
  401. 清洗<br>
  402. 入料儲豆槽
  403. </td>
  404. <td>
  405. 清洗浮選槽
  406. </td>
  407. <td>
  408. 中水桶
  409. </td>
  410. <td>
  411. 色選機
  412. </td>
  413. <td>
  414. 色選機出料<br>好果
  415. </td>
  416. <td>
  417. 色選機出料<br>壞果
  418. </td>
  419. <td>
  420. 脫皮機
  421. </td>
  422. <td>
  423. 脫皮機<br>出料儲豆槽
  424. </td>
  425. <td>
  426. 發酵槽
  427. </td>
  428. <td>
  429. 乾燥槽
  430. </td>
  431. <td>
  432. 乾燥<br>
  433. 出料除豆槽
  434. </td>
  435. <td>
  436. 壞豆
  437. </td>
  438. </tr>
  439. <tr>
  440. <td>
  441. <!-- 清洗浮選槽入料 CI2 -->
  442. <div id="CI2" tabindex="0" class="CI2_position" role="button" style="text-align: center;">
  443. <span id="CI2_status" class="demo_status_css">CI2 status</span>
  444. <div id="CI2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  445. </div>
  446. </td>
  447. <td>
  448. <!-- 清洗浮選槽 C2 -->
  449. <div id="C2" tabindex="0" class="C2_position" role="button" style="text-align: center;">
  450. <span id="C2_status" class="demo_status_css">C2 status</span>
  451. <div id="C2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  452. </div>
  453. </td>
  454. <td>
  455. 中水桶
  456. </td>
  457. <td>
  458. <!-- 色選機 S2 -->
  459. <div id="S2" tabindex="0" class="S2_position" role="button" style="text-align: center;">
  460. <span id="S2_status" class="demo_status_css">S2 status</span>
  461. <div id="S2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  462. </div>
  463. </td>
  464. <td>
  465. <!-- 色選機好果 SOg2 -->
  466. <div id="SOg2" tabindex="0" class="SOg2_position" role="button" style="text-align: center;">
  467. <span id="SOg2_status" class="demo_status_css">SOg2 status</span>
  468. <div id="SOg2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  469. </div>
  470. </td>
  471. <td>
  472. <!-- 色選機好果 SOb2 -->
  473. <div id="SOb2" tabindex="0" class="SOb2_position" role="button" style="text-align: center;">
  474. <span id="SOb2_status" class="demo_status_css">SOb2 status</span>
  475. <div id="SOb2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  476. </div>
  477. </td>
  478. <td>
  479. <!-- 脫皮機 P2 -->
  480. <div id="P2" tabindex="0" class="P2_position" role="button" style="text-align: center;">
  481. <span id="P2_status" class="demo_status_css">P2 status</span>
  482. <div id="P2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  483. </div>
  484. </td>
  485. <td>
  486. <!-- 脫皮機出料儲豆槽 PO2 -->
  487. <div id="PO2" tabindex="0" class="PO2_position" role="button" style="text-align: center;">
  488. <span id="PO2_status" class="demo_status_css">PO2 status</span>
  489. <div id="PO2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  490. </div>
  491. </td>
  492. <td>
  493. <!-- 發酵槽 F2 -->
  494. <div id="F2" tabindex="0" class="F2_position" role="button" style="vertical-align: bottom;">
  495. <span id="F2_status" class="demo_status_css">F2 status</span>
  496. <div id="F2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  497. </div>
  498. </td>
  499. <td>
  500. <!-- 乾燥槽 D2 -->
  501. <div id="D2" tabindex="0" class="D2_position" role="button" style="vertical-align: bottom;">
  502. <span id="D2_status" class="demo_status_css">D2 status</span>
  503. <div id="D2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  504. </div>
  505. </td>
  506. <td>
  507. <!-- 乾燥槽 DO2 -->
  508. <div id="DO2" tabindex="0" class="DO2_position" role="button" style="vertical-align: bottom;">
  509. <span id="DO2_status" class="demo_status_css">DO2 status</span>
  510. <div id="DO2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  511. </div>
  512. </td>
  513. <td>
  514. <!-- 壞豆槽 POb1 -->
  515. <div id="POb1" tabindex="0" class="POb1_position" role="button" style="vertical-align: bottom;">
  516. <span id="POb1_status" class="demo_status_css">POb1 status</span>
  517. <div id="POb1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  518. </div>
  519. </td>
  520. </tr>
  521. </table>
  522. <!-- DEMO 貨櫃 參數設定 -->
  523. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 10px;" cellpadding="5" border="1">
  524. <tr>
  525. <td>
  526. 清洗入料
  527. </td>
  528. <td>
  529. 清洗浮選
  530. </td>
  531. <td>
  532. 中水桶
  533. </td>
  534. <td>
  535. 色選機
  536. </td>
  537. <td>
  538. 出料好果
  539. </td>
  540. <td>
  541. 出料壞果
  542. </td>
  543. <td>
  544. 脫皮機
  545. </td>
  546. <td>
  547. 脫皮機出料
  548. </td>
  549. <td>
  550. 發酵槽
  551. </td>
  552. <td>
  553. 乾燥槽
  554. </td>
  555. <td>
  556. 乾燥出料
  557. </td>
  558. </tr>
  559. <tr style="vertical-align: top;">
  560. <td colspan="3">
  561. CI1_UltraSonic: <span id="CI1_UltraSonic" class="span-sensor-value">null</span><br>
  562. C1_UltraSonic: <span id="C1_UltraSonic" class="span-sensor-value">null</span><br>
  563. ----- 清洗入料 -----<br>
  564. 生豆高度
  565. <input id="DEMO_CI_Bean_height" type="text" class="input-text" value="10">cm<br>
  566. 吸料時間
  567. <input id="DEMO_CI_vacuumON_time" type="text" class="input-text" value="5">秒<br>
  568. 放料時間
  569. <input id="DEMO_CI_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  570. ----- 清洗浮選 -----<br>
  571. 生豆高度
  572. <input id="DEMO_C_Bean_height" type="text" class="input-text" value="10">cm<br>
  573. 吸料時間
  574. <input id="DEMO_C_vacuumON_time" type="text" class="input-text" value="5">秒<br>
  575. 放料時間
  576. <input id="DEMO_C_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  577. 水位高度
  578. <input id="DEMO_W_Bean_height" type="text" class="input-text" value="10">cm<br>
  579. ------ 中水桶 ------<br>
  580. 水位高度
  581. <input id="DEMO_WaterTank_Water_height" type="text" class="input-text" value="50">cm<br>
  582. </td>
  583. <td colspan="3">
  584. S1_UltraSonic: <span id="S1_UltraSonic" class="span-sensor-value">null</span><br>
  585. ------ 色選機 ------<br>
  586. 生豆高度
  587. <input id="DEMO_S_Bean_height" type="text" class="input-text" value="10">cm<br>
  588. 吸料時間
  589. <input id="DEMO_S_vacuumON_time" type="text" class="input-text" value="5">秒<br>
  590. 放料時間
  591. <input id="DEMO_S_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  592. ----- 出料好果 -----<br>
  593. 生豆高度
  594. <input id="DEMO_SOg_Bean_height" type="text" class="input-text" value="10">cm<br>
  595. ----- 出料壞果 -----<br>
  596. 生豆高度
  597. <input id="DEMO_SOb_Bean_height" type="text" class="input-text" value="10">cm<br>
  598. </td>
  599. <td colspan="2">
  600. PO1_UltraSonic: <span id="PO1_UltraSonic" class="span-sensor-value">null</span><br>
  601. ------ 脫皮機 ------<br>
  602. 馬達轉速
  603. <input name="Peel_Tank_motor_rpm" type="text" class="input-text" value="30">rpm<br>
  604. 吸料時間
  605. <input name="Peel_Tank_vacuumON_time" type="text" class="input-text" value="3">秒<br>
  606. 放料時間
  607. <input name="Peel_Tank_vacuumOFF_time" type="text" class="input-text" value="30">秒<br>
  608. --- 脫皮機出料 ---<br>
  609. 生豆高度
  610. <input name="Peel_Tank_bean_height" type="text" class="input-text" value="10">cm<br>
  611. </td>
  612. <td>
  613. F1_UltraSonic: <span id="F1_UltraSonic" class="span-sensor-value">null</span><br>
  614. F1_SHT11Temp: <span id="F1_SHT11Temp" class="span-sensor-value">null</span><br>
  615. F1_SHT11Humidity: <span id="F1_SHT11Humidity" class="span-sensor-value">null</span><br>
  616. ------ 發酵槽 ------<br>
  617. 生豆高度
  618. <input name="Ferment_Tank_bean_height" class="input-text" type="text" value="10">cm<br>
  619. 吸料時間
  620. <input name="Ferment_Tank_vacuumON_time" class="input-text" type="text" value="5">秒<br>
  621. 放料時間
  622. <input name="Ferment_Tank_vacuumOFF_time" class="input-text" type="text" value="10">秒<br>
  623. <br>
  624. 水位高度
  625. <input name="Ferment_Tank_water_height" class="input-text" type="text" value="15">cm<br>
  626. 馬達轉速
  627. <input name="Ferment_Tank_motor_rpm" class="input-text" type="text" value="15">rpm<br>
  628. <br>
  629. 發酵溫度
  630. <input name="Ferment_Tank_fermenting_temp" class="input-text" type="text" value="10">℃<br>
  631. 發酵等待
  632. <input name="Ferment_Tank_fermenting_time" class="input-text" type="text" value="5">秒<br>
  633. 廢水排放
  634. <input name="Ferment_Tank_WaterOut_time" class="input-text" type="text" value="5">秒
  635. </td>
  636. <td>
  637. D1_UltraSonic: <span id="D1_UltraSonic" class="span-sensor-value">null</span><br>
  638. D1_SHT11Temp: <span id="D1_SHT11Temp" class="span-sensor-value">null</span><br>
  639. D1_SHT11Humidity: <span id="D1_SHT11Humidity" class="span-sensor-value">null</span><br>
  640. ------ 乾燥槽 ------<br>
  641. <!-- 乾燥槽 -->
  642. 生豆高度
  643. <input name="Dry_Tank_bean_height" type="text" class="input-text" value="10">cm<br>
  644. 吸料時間
  645. <input name="Dry_Tank_vacuumON_time" type="text" class="input-text" value="5">秒<br>
  646. 放料時間
  647. <input name="Dry_Tank_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  648. 馬達轉速
  649. <input name="Dry_Tank_motor_rpm" type="text" class="input-text" value="0">rpm<br>
  650. <br>
  651. 指定溫度
  652. <input name="Dry_Tank_drying_temp" type="text" class="input-text" value="38">℃<br>
  653. 指定濕度
  654. <input name="Dry_Tank_drying_Humidity" type="text" class="input-text" value="11">%<br>
  655. 返潮時間
  656. <input name="Dry_Tank_drying_time" type="text" class="input-text" value="5">秒<br>
  657. </td>
  658. <td>
  659. DO1_UltraSonic: <span id="DO1_UltraSonic" class="span-sensor-value">null</span><br>
  660. ----- 乾燥出料 -----<br>
  661. <!-- 乾燥出料 -->
  662. 生豆高度
  663. <input name="Dry_Output_bean_height" type="text" class="input-text" value="10">cm<br>
  664. 吸料時間
  665. <input name="Dry_Output_vacuumON_time" type="text" class="input-text" value="5"> 秒<br>
  666. 放料時間
  667. <input name="Dry_Output_vacuumOFF_time" type="text" class="input-text" value="10"> 秒<br>
  668. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="stop_Drying_OutputtingBean()">
  669. 暫停乾燥<br><u>開啟 D1 蝴蝶閥</u></button>
  670. <br>
  671. <br>
  672. <div style="font-size: 12px; color: crimson; line-height: 15px;">測試水份後<br>將桶槽改為入料中<br>D1_UltraSonic 改為 0</div>
  673. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="DtankDiskValve('1')">
  674. D1 蝴蝶閥 ON</u></button><br>
  675. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="DtankDiskValve('0')">
  676. D1 蝴蝶閥 OFF</u></button>
  677. <script>
  678. function DtankDiskValve(params) {
  679. if (params == '1') {
  680. data = { "tank_num": "D1", "command": "tank_diskvalve_status", "value": "on" };
  681. } else if (params == '0') {
  682. data = { "tank_num": "D1", "command": "tank_diskvalve_status", "value": "off" };
  683. } else {
  684. data = { "tank_num": "D1", "command": "tank_diskvalve_status", "value": params };
  685. }
  686. $.post('/mqtt/1', data, function (res) {
  687. console.log('data: ', data)
  688. console.log('res: ', res)
  689. }, 'text')
  690. }
  691. // var outputtingBean_interval
  692. // function stop_Drying_OutputtingBean_IN(){
  693. // console.log("---- 測試後入料 ----")
  694. // }
  695. function stop_Drying_OutputtingBean(){
  696. clearInterval(dry_status_interval)
  697. console.log("------- 狀態自動化判斷 停止 -------")
  698. console.log("---- 出料至儲豆槽 ----")
  699. var Dry_Output_bean_height = $("input[name=Dry_Output_bean_height]").val();
  700. var Dry_Output_vacuumON_time = $("input[name=Dry_Output_vacuumON_time]").val();
  701. var Dry_Output_vacuumOFF_time = $("input[name=Dry_Output_vacuumOFF_time]").val();
  702. data = {"command": "stop_Drying_OutputtingBean",
  703. "Dry_Output_bean_height": Dry_Output_bean_height,
  704. "Dry_Output_vacuumON_time": Dry_Output_vacuumON_time,
  705. "Dry_Output_vacuumOFF_time": Dry_Output_vacuumOFF_time
  706. };
  707. // 更新桶槽狀態
  708. $.get('/dryDEMO_outputtingBean', data, function (res){
  709. D1 = res.Dry_Tank_1
  710. D2 = res.Dry_Tank_2
  711. DO1 = res.Dry_Output_1
  712. DO2 = res.Dry_Output_2
  713. dry_tank_status = [D1, D2]
  714. dry_output_status = [DO1, DO2]
  715. loading_status();
  716. loading_sensors();
  717. }, 'json');
  718. }
  719. </script>
  720. </td>
  721. </tr>
  722. <tr>
  723. <td colspan="3">
  724. 清洗自動化
  725. </td>
  726. <td colspan="3">
  727. 色選自動化
  728. </td>
  729. <td colspan="2">
  730. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="peel_auto_status_testing()">
  731. 脫皮自動化</button>
  732. <br>
  733. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="peel_auto_status_stop()">
  734. <u>脫皮停止</u></button>
  735. <script>
  736. function peel_auto_status_stop(){
  737. clearInterval(peel_status_interval)
  738. console.log("------- 脫皮自動化判斷 停止 -------")
  739. }
  740. function peel_auto_status_testing(){
  741. console.log("------- 脫皮自動化判斷 開始 -------")
  742. var Peel_Tank_bean_height = $('input[name=Peel_Tank_bean_height]').val();
  743. var Peel_Tank_motor_rpm = $('input[name=Peel_Tank_motor_rpm]').val();
  744. var Peel_Tank_vacuumON_time = $('input[name=Peel_Tank_vacuumON_time]').val();
  745. var Peel_Tank_vacuumOFF_time = $('input[name=Peel_Tank_vacuumOFF_time]').val();
  746. data = {"Peel_Tank_bean_height":Peel_Tank_bean_height,
  747. "Peel_Tank_motor_rpm":Peel_Tank_motor_rpm,
  748. "Peel_Tank_vacuumON_time":Peel_Tank_vacuumON_time,
  749. "Peel_Tank_vacuumOFF_time":Peel_Tank_vacuumOFF_time
  750. }
  751. // 更新桶槽狀態
  752. peel_status_interval = setInterval(peel_auto_status, 5*1000);
  753. // peel_auto_status()
  754. function peel_auto_status(){
  755. if (peel_status_process == 1) { return }
  756. peel_status_process = 1;
  757. $.get('/peel_auto_status', data, function (res){
  758. P1 = res.Peel_Tank_1
  759. P2 = res.Peel_Tank_2
  760. PO1 = res.Peel_Output_1
  761. PO2 = res.Peel_Output_2
  762. peel_tank_status = [P1, P2]
  763. peel_output_status = [PO1, PO2]
  764. loading_status();
  765. loading_sensors();
  766. peel_status_process = 0;
  767. }, 'json');
  768. }
  769. }
  770. </script>
  771. </td>
  772. <td>
  773. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="ferment_auto_status_testing()">
  774. 發酵自動化</button>
  775. <br>
  776. <button style="margin: 5px 5px 0px 5px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="ferment_auto_status_stop()">
  777. <u>發酵停止</u></button>
  778. <script>
  779. function ferment_auto_status_stop(){
  780. clearInterval(ferment_status_interval)
  781. console.log("------- 發酵自動化判斷 停止 -------")
  782. }
  783. function ferment_auto_status_testing(){
  784. console.log("------- 發酵自動化判斷 開始 -------")
  785. var Ferment_Tank_bean_height = $("input[name=Ferment_Tank_bean_height]").val();
  786. var Ferment_Tank_vacuumON_time = $("input[name=Ferment_Tank_vacuumON_time]").val();
  787. var Ferment_Tank_vacuumOFF_time = $("input[name=Ferment_Tank_vacuumOFF_time]").val();
  788. var Ferment_Tank_water_height = $("input[name=Ferment_Tank_water_height]").val();
  789. var Ferment_Tank_motor_rpm = $("input[name=Ferment_Tank_motor_rpm]").val();
  790. var Ferment_Tank_fermenting_temp = $("input[name=Ferment_Tank_fermenting_temp]").val();
  791. var Ferment_Tank_fermenting_time = $("input[name=Ferment_Tank_fermenting_time]").val();
  792. var Ferment_Tank_WaterOut_time = $("input[name=Ferment_Tank_WaterOut_time]").val();
  793. data = {"Ferment_Tank_bean_height":Ferment_Tank_bean_height,
  794. "Ferment_Tank_vacuumON_time":Ferment_Tank_vacuumON_time,
  795. "Ferment_Tank_vacuumOFF_time":Ferment_Tank_vacuumOFF_time,
  796. "Ferment_Tank_water_height":Ferment_Tank_water_height,
  797. "Ferment_Tank_motor_rpm":Ferment_Tank_motor_rpm,
  798. "Ferment_Tank_fermenting_temp":Ferment_Tank_fermenting_temp,
  799. "Ferment_Tank_fermenting_time":Ferment_Tank_fermenting_time,
  800. "Ferment_Tank_WaterOut_time":Ferment_Tank_WaterOut_time
  801. }
  802. // 更新桶槽狀態
  803. ferment_status_interval = setInterval(ferment_auto_status, 5*1000);
  804. // ferment_auto_status();
  805. function ferment_auto_status(){
  806. if (ferment_status_process == 1) { return }
  807. ferment_status_process = 1;
  808. $.get('/fermentDEMO_auto_status', data, function (res){
  809. F1 = res.Ferment_Tank_1
  810. F2 = res.Ferment_Tank_2
  811. ferment_tank_status = [F1, F2]
  812. loading_status();
  813. loading_sensors();
  814. ferment_status_process = 0;
  815. }, 'json');
  816. }
  817. }
  818. </script>
  819. </td>
  820. <td colspan="2">
  821. <button style="margin: 5px 10px 0px 10px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="dry_auto_status_testing()">
  822. <u>乾燥自動化</u></button>
  823. <br>
  824. <button style="margin: 5px 10px 0px 10px; font-size: 10px;" type="submit" class="btn btn-primary" onclick="dry_auto_status_stop()">
  825. <u>乾燥停止</u></button>
  826. <script>
  827. function dry_auto_status_stop(){
  828. clearInterval(dry_status_interval)
  829. console.log("------- 狀態自動化判斷 停止 -------")
  830. }
  831. function dry_auto_status_testing(){
  832. console.log("------- 發酵自動化判斷 開始 -------")
  833. var Dry_Tank_bean_height = $("input[name=Dry_Tank_bean_height]").val();
  834. var Dry_Tank_vacuumON_time = $("input[name=Dry_Tank_vacuumON_time]").val();
  835. var Dry_Tank_vacuumOFF_time = $("input[name=Dry_Tank_vacuumOFF_time]").val();
  836. var Dry_Tank_motor_rpm = $("input[name=Dry_Tank_motor_rpm]").val();
  837. var Dry_Tank_drying_temp = $("input[name=Dry_Tank_drying_temp]").val();
  838. var Dry_Tank_drying_Humidity = $("input[name=Dry_Tank_drying_Humidity]").val();
  839. var Dry_Tank_drying_time = $("input[name=Dry_Tank_drying_time]").val();
  840. var Dry_Output_bean_height = $("input[name=Dry_Output_bean_height]").val();
  841. var Dry_Output_vacuumON_time = $("input[name=Dry_Output_vacuumON_time]").val();
  842. var Dry_Output_vacuumOFF_time = $("input[name=Dry_Output_vacuumOFF_time]").val();
  843. data = {"command": "Dry_auto_parameter",
  844. "Dry_Tank_bean_height": Dry_Tank_bean_height,
  845. "Dry_Tank_vacuumON_time": Dry_Tank_vacuumON_time,
  846. "Dry_Tank_vacuumOFF_time": Dry_Tank_vacuumOFF_time,
  847. "Dry_Tank_motor_rpm": Dry_Tank_motor_rpm,
  848. "Dry_Tank_drying_temp": Dry_Tank_drying_temp,
  849. "Dry_Tank_drying_Humidity": Dry_Tank_drying_Humidity,
  850. "Dry_Tank_drying_time": Dry_Tank_drying_time,
  851. "Dry_Output_bean_height": Dry_Output_bean_height,
  852. "Dry_Output_vacuumON_time": Dry_Output_vacuumON_time,
  853. "Dry_Output_vacuumOFF_time": Dry_Output_vacuumOFF_time
  854. };
  855. // 更新桶槽狀態
  856. dry_status_interval = setInterval(dry_auto_status, 5*1000);
  857. // dry_auto_status();
  858. function dry_auto_status(){
  859. if (dry_status_process == 1) { return }
  860. dry_status_process = 1;
  861. $.get('/dryDEMO_auto_status', data, function (res){
  862. D1 = res.Dry_Tank_1
  863. D2 = res.Dry_Tank_2
  864. DO1 = res.Dry_Output_1
  865. DO2 = res.Dry_Output_2
  866. dry_tank_status = [D1, D2]
  867. dry_output_status = [DO1, DO2]
  868. loading_status();
  869. loading_sensors();
  870. dry_status_process = 0;
  871. }, 'json');
  872. }
  873. }
  874. </script>
  875. </td>
  876. </tr>
  877. </table>
  878. </div>
  879. <div id="coffee_footer">
  880. <!-- 匯入共同使用的 footer.html 內容 -->
  881. {% include 'footer.html' %}
  882. </div>
  883. </div>
  884. </body>
  885. </html>