dry_auto.html 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  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_pc").text('乾燥自動化');
  23. $("#coffee_title_phone").text('乾燥自動化');
  24. // 桶槽入料顯示
  25. dry_input_status_N = ['{{DI1}}', '{{DI2}}']
  26. for (let i=0; i<dry_input_status_N.length; i++) {
  27. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  28. // console.log(i+1 + ' : '+ dry_input_status_N[i])
  29. // 1 : F_InputtingBean
  30. // 2 : F_Waiting
  31. if (dry_input_status_N[i] == 'DI_InputtingBean') {
  32. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  33. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 入豆中")
  34. } else if (dry_input_status_N[i] == 'DI_Waiting') {
  35. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  36. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 空桶等待")
  37. } else if (dry_input_status_N[i] == 'DI_OutputtingBean') {
  38. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  39. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 可出豆")
  40. } else if (dry_input_status_N[i] == 'DI_Stand_by') {
  41. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "HotPink")
  42. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 待命")
  43. } else {
  44. console.log('pass')
  45. }
  46. }
  47. // 桶槽狀態顯示
  48. dry_tank_status_N = ['{{D1}}', '{{D2}}', '{{D3}}', '{{D4}}', '{{D5}}', '{{D6}}',
  49. '{{D7}}', '{{D8}}', '{{D9}}', '{{D10}}', '{{D11}}', '{{D12}}']
  50. for (let i=0; i<dry_tank_status_N.length; i++) {
  51. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  52. // console.log(i+1 + ' : '+ dry_tank_status_N[i])
  53. // 1 : D_InputtingBean
  54. // 2 : D_Waiting
  55. if (dry_tank_status_N[i] == 'D_InputtingBean') {
  56. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  57. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆中")
  58. } else if (dry_tank_status_N[i] == 'D_InputtingBean_Pause') {
  59. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  60. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆暫停")
  61. } else if (dry_tank_status_N[i] == 'D_InputtingBean_Finish') {
  62. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  63. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆完成")
  64. } else if (dry_tank_status_N[i] == 'D_Waiting') {
  65. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  66. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 空桶等待")
  67. } else if (dry_tank_status_N[i] == 'D_Cleaning') {
  68. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "plum")
  69. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 清洗中")
  70. } else if (dry_tank_status_N[i] == 'D_Drying') {
  71. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  72. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 乾燥中")
  73. } else if (dry_tank_status_N[i] == 'D_OutputtingBean') {
  74. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  75. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 可出豆")
  76. } else if (dry_tank_status_N[i] == 'D_Warning') {
  77. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  78. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 發生錯誤")
  79. $("#D"+parseInt(i+1)+"_status").css("color", "crimson")
  80. } else if (dry_input_status_N[i] == 'D_Stand_by') {
  81. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "HotPink")
  82. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 待命")
  83. } else {
  84. console.log('pass')
  85. }
  86. }
  87. // 桶槽出料顯示
  88. dry_output_status_N = ['{{DO1}}', '{{DO2}}']
  89. for (let i=0; i<dry_output_status_N.length; i++) {
  90. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  91. // console.log(i+1 + ' : '+ dry_output_status[i])
  92. // 1 : D_InputtingBean
  93. // 2 : D_Waiting
  94. if (dry_output_status_N[i] == 'DO_InputtingBean') {
  95. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  96. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 入豆中")
  97. } else if (dry_output_status_N[i] == 'DO_Waiting') {
  98. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  99. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 空桶等待")
  100. } else if (dry_output_status_N[i] == 'DO_OutputtingBean') {
  101. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  102. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 可出豆")
  103. } else if (dry_output_status_N[i] == 'DO_Stand_by') {
  104. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "HotPink")
  105. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 待命")
  106. } else {
  107. console.log('pass')
  108. }
  109. }
  110. loading_D_status()
  111. loading_D()
  112. var data
  113. var dry_status_interval
  114. // css
  115. // height: 185px; 取代成 height: 210px;
  116. // DI2 DO2 top: 620px; 取代成 top: 645px;
  117. });
  118. function loading_D_status(){
  119. // console.log('dry_input_status_N: ' + dry_input_status_N)
  120. for (let i=0; i<dry_input_status_N.length; i++) {
  121. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  122. // console.log(i+1 + ' : '+ dry_input_status_N[i])
  123. // 1 : F_InputtingBean
  124. // 2 : F_Waiting
  125. if (dry_input_status_N[i] == 'DI_InputtingBean') {
  126. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  127. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 入豆中")
  128. } else if (dry_input_status_N[i] == 'DI_Waiting') {
  129. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  130. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 空桶等待")
  131. } else if (dry_input_status_N[i] == 'DI_OutputtingBean') {
  132. $("#DI"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  133. $("#DI"+parseInt(i+1)+"_status").text("DI" + parseInt(i+1) + " 可出豆")
  134. } else {
  135. console.log('pass')
  136. }
  137. }
  138. // console.log('dry_tank_status_N: ' + dry_tank_status_N)
  139. for (let i=0; i<dry_tank_status_N.length; i++) {
  140. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  141. // console.log(i+1 + ' : '+ dry_tank_status_N[i])
  142. // 1 : D_InputtingBean
  143. // 2 : D_Waiting
  144. if (dry_tank_status_N[i] == 'D_InputtingBean') {
  145. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  146. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆中")
  147. } else if (dry_tank_status_N[i] == 'D_InputtingBean_Pause') {
  148. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  149. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆暫停")
  150. } else if (dry_tank_status_N[i] == 'D_InputtingBean_Finish') {
  151. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  152. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 入豆完成")
  153. } else if (dry_tank_status_N[i] == 'D_Waiting') {
  154. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  155. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 空桶等待")
  156. } else if (dry_tank_status_N[i] == 'D_Cleaning') {
  157. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "plum")
  158. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 清洗中")
  159. } else if (dry_tank_status_N[i] == 'D_Drying') {
  160. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  161. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 乾燥中")
  162. } else if (dry_tank_status_N[i] == 'D_OutputtingBean') {
  163. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  164. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 可出豆")
  165. } else if (dry_tank_status_N[i] == 'D_Warning') {
  166. $("#D"+parseInt(i+1)+"_status_dot").css("background-color", "crimson")
  167. $("#D"+parseInt(i+1)+"_status").text("D" + parseInt(i+1) + " 發生錯誤")
  168. $("#D"+parseInt(i+1)+"_status").css("color", "crimson")
  169. } else {
  170. console.log('pass')
  171. }
  172. }
  173. // console.log('dry_output_status_N: ' + dry_output_status_N)
  174. for (let i=0; i<dry_output_status_N.length; i++) {
  175. // 顯示對應乾燥桶槽號碼 D1~D6 和目前狀態
  176. // console.log(i+1 + ' : '+ dry_output_status[i])
  177. // 1 : D_InputtingBean
  178. // 2 : D_Waiting
  179. if (dry_output_status_N[i] == 'DO_InputtingBean') {
  180. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  181. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 入豆中")
  182. } else if (dry_output_status_N[i] == 'DO_Waiting') {
  183. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "lightgray")
  184. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 空桶等待")
  185. } else if (dry_output_status_N[i] == 'DO_OutputtingBean') {
  186. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "MediumSeaGreen")
  187. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 可出豆")
  188. } else if (dry_output_status_N[i] == 'DO_Stand_by') {
  189. $("#DO"+parseInt(i+1)+"_status_dot").css("background-color", "HotPink")
  190. $("#DO"+parseInt(i+1)+"_status").text("DO" + parseInt(i+1) + " 待命")
  191. } else {
  192. console.log('pass')
  193. }
  194. }
  195. }
  196. function loading_D(){
  197. $.get('/loading/DI1', '', function (res) {
  198. $("#actuator_00").text(res.input_vacuum);
  199. $("#sensor_00").text(res.input_UltraSonic);
  200. }, 'json');
  201. $.get('/loading/D2', '', function (res) {
  202. $("#actuator_1").text(res.tank_vacuum);
  203. $("#actuator_2").text(res.tank_threewayvalve);
  204. $("#actuator_3").text(res.tank_diskvalve);
  205. $("#actuator_4").text(res.tank_solenoid_disinfect);
  206. $("#actuator_5").text(res.tank_solenoid_water);
  207. $("#actuator_6").text(res.tank_motor);
  208. $("#actuator_7").text(res.tank_blower);
  209. $("#actuator_8").text(res.tank_heater1);
  210. $("#actuator_9").text(res.tank_heater2);
  211. $("#actuator_10").text(res.tank_temp1_enable);
  212. $("#actuator_11").text(res.tank_temp1);
  213. $("#sensor_1").text(res.UltraSonic);
  214. $("#sensor_2").text(res.SHT11_Temp);
  215. $("#sensor_3").text(res.SHT11_Humidity);
  216. $("#sensor_4").text(res.soil_Temp);
  217. $("#sensor_5").text(res.soil_Humidity);
  218. $("#sensor_6").text(res.soil_EC);
  219. $("#sensor_7").text(res.PA);
  220. }, 'json');
  221. $.get('/loading/DO1', '', function (res) {
  222. $("#actuator_99").text(res.output_vacuum);
  223. $("#sensor_99").text(res.output_UltraSonic);
  224. }, 'json');
  225. };
  226. function getting_parameters_D(){
  227. var Dry_Input_bean_height = $("input[name=Dry_Input_bean_height]").val();
  228. var Dry_Input_vacuumON_time = $("input[name=Dry_Input_vacuumON_time]").val();
  229. var Dry_Input_vacuumOFF_time = $("input[name=Dry_Input_vacuumOFF_time]").val();
  230. var Dry_Tank_bean_height = $("input[name=Dry_Tank_bean_height]").val();
  231. var Dry_Tank_vacuumON_time = $("input[name=Dry_Tank_vacuumON_time]").val();
  232. var Dry_Tank_vacuumOFF_time = $("input[name=Dry_Tank_vacuumOFF_time]").val();
  233. var Dry_Tank_drying_temp = $("input[name=Dry_Tank_drying_temp]").val();
  234. var Dry_Tank_drying_time = $("input[name=Dry_Tank_drying_time]").val();
  235. var Dry_Tank_drying_EC = $("input[name=Dry_Tank_drying_EC]").val();
  236. var Dry_Tank_motor_rpm = $("input[name=Dry_Tank_motor_rpm]").val();
  237. var Dry_Tank_TempWeight_SHT11 = $("input[name=Dry_Tank_TempWeight_SHT11]").val();
  238. var Dry_Tank_TempWeight_soil = $("input[name=Dry_Tank_TempWeight_soil]").val();
  239. var Dry_Tank_drying_Humidity = $("input[name=Dry_Tank_drying_Humidity]").val();
  240. var Dry_Output_bean_height = $("input[name=Dry_Output_bean_height]").val();
  241. var Dry_Output_vacuumON_time = $("input[name=Dry_Output_vacuumON_time]").val();
  242. var Dry_Output_vacuumOFF_time = $("input[name=Dry_Output_vacuumOFF_time]").val();
  243. var Dry_Tank_Disinfect_time = $("input[name=Dry_Tank_Disinfect_time]").val();
  244. data = {"command": "Dry_auto_parameter",
  245. "Dry_Input_bean_height": Dry_Input_bean_height,
  246. "Dry_Input_vacuumON_time": Dry_Input_vacuumON_time,
  247. "Dry_Input_vacuumOFF_time": Dry_Input_vacuumOFF_time,
  248. "Dry_Tank_bean_height": Dry_Tank_bean_height,
  249. "Dry_Tank_vacuumON_time": Dry_Tank_vacuumON_time,
  250. "Dry_Tank_vacuumOFF_time": Dry_Tank_vacuumOFF_time,
  251. "Dry_Tank_drying_temp": Dry_Tank_drying_temp,
  252. "Dry_Tank_drying_time": Dry_Tank_drying_time,
  253. "Dry_Tank_drying_EC": Dry_Tank_drying_EC,
  254. "Dry_Tank_motor_rpm": Dry_Tank_motor_rpm,
  255. "Dry_Tank_TempWeight_SHT11": Dry_Tank_TempWeight_SHT11,
  256. "Dry_Tank_TempWeight_soil": Dry_Tank_TempWeight_soil,
  257. "Dry_Tank_drying_Humidity": Dry_Tank_drying_Humidity,
  258. "Dry_Output_bean_height": Dry_Output_bean_height,
  259. "Dry_Output_vacuumON_time": Dry_Output_vacuumON_time,
  260. "Dry_Output_vacuumOFF_time": Dry_Output_vacuumOFF_time,
  261. "Dry_Tank_Disinfect_time": Dry_Tank_Disinfect_time
  262. };
  263. }
  264. </script>
  265. <style>
  266. .D_status_css {
  267. font-weight: bold;
  268. text-align: center;
  269. }
  270. .DryContainer_position {
  271. position: absolute;
  272. top: 95px;
  273. left: 53px;
  274. }
  275. .D1_position {
  276. width: 110px;
  277. }
  278. .D2_position {
  279. width: 110px;
  280. }
  281. .D3_position {
  282. width: 110px;
  283. }
  284. .D4_position {
  285. width: 110px;
  286. }
  287. .D5_position {
  288. width: 110px;
  289. }
  290. .D6_position {
  291. width: 110px;
  292. }
  293. .D7_position {
  294. width: 110px;
  295. }
  296. .D8_position {
  297. width: 110px;
  298. }
  299. .D9_position {
  300. width: 110px;
  301. }
  302. .D10_position {
  303. width: 110px;
  304. }
  305. .D11_position {
  306. width: 110px;
  307. }
  308. .D12_position {
  309. width: 110px;
  310. }
  311. .DI1_position {
  312. width: 110px;
  313. }
  314. .DI2_position {
  315. width: 110px;
  316. }
  317. .DO1_position {
  318. width: 110px;
  319. }
  320. .DO2_position {
  321. width: 110px;
  322. }
  323. .footer{
  324. position: absolute;
  325. bottom: 0px;
  326. width: 100%;
  327. background-color: #eee;
  328. text-align: center;
  329. }
  330. .input-text {
  331. height: 25px;
  332. width: 40px;
  333. text-align: center;
  334. margin-left: 2px;
  335. margin-right: 5px;
  336. }
  337. </style>
  338. </head>
  339. <body>
  340. <div id="wrapper">
  341. <div id="coffee_header">
  342. <!-- 匯入共同使用的 header.html 內容 -->
  343. {% include 'header.html' %}
  344. </div>
  345. <div>
  346. <div style="text-align: center;">
  347. <button style="margin: 5px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="dry_auto_status_stop()">
  348. <u>狀態判斷_停止</u></button>
  349. <script>
  350. function dry_auto_status_stop(){
  351. // clearInterval(loading_D_interval)
  352. clearInterval(dry_status_interval)
  353. console.log("------- 狀態自動化判斷 停止 -------")
  354. }
  355. </script>
  356. <button style="margin: 5px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="dry_auto_status_testing()">
  357. <u>[測試] 乾燥自動化_狀態判斷</u></button>
  358. <script>
  359. var loading_D_interval
  360. // var loading_D_interval
  361. var dry_status_process = 0;
  362. function dry_auto_status_testing(){
  363. console.log("------- 狀態自動化判斷 開始 -------")
  364. // 取得桶槽狀態
  365. // loading_D_interval = setInterval(loading_D, 10*1000)
  366. // 取得目前乾燥參數
  367. getting_parameters_D()
  368. // 更新桶槽狀態
  369. dry_status_interval = setInterval(dry_auto_status, 10*1000);
  370. function dry_auto_status(){
  371. if (dry_status_process == 1) { return };
  372. dry_status_process = 1;
  373. $.get('dry_auto_status', data, function (res){
  374. DI1 = res.Dry_Input_1
  375. D1 = res.Dry_Tank_1
  376. D2 = res.Dry_Tank_2
  377. D3 = res.Dry_Tank_3
  378. D4 = res.Dry_Tank_4
  379. D5 = res.Dry_Tank_5
  380. D6 = res.Dry_Tank_6
  381. DO1 = res.Dry_Output_1
  382. console.log('DI1: ' + DI1)
  383. console.log('D1: ' + D1)
  384. console.log('D2: ' + D2)
  385. console.log('D3: ' + D3)
  386. console.log('D4: ' + D4)
  387. console.log('D5: ' + D5)
  388. console.log('D6: ' + D6)
  389. console.log('DO1: ' + DO1)
  390. // ----- 乾燥入料 DI1 狀態 --------------------------------------------------------------
  391. dry_input_status_N = [res.Dry_Input_1]
  392. // ----- 乾燥桶槽 D1~D6 狀態 --------------------------------------------------------------
  393. dry_tank_status_N = [res.Dry_Tank_1, res.Dry_Tank_2, res.Dry_Tank_3, res.Dry_Tank_4, res.Dry_Tank_5, res.Dry_Tank_6]
  394. // ----- 乾燥出料 DO1 狀態 --------------------------------------------------------------
  395. dry_output_status_N = [res.Dry_Output_1]
  396. loading_D_status()
  397. dry_status_process = 0;
  398. }, 'json');
  399. };
  400. };
  401. </script>
  402. </div>
  403. <!-- 乾燥貨櫃 狀態表格 -->
  404. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 10px;" cellpadding="5" border="1">
  405. <tr>
  406. <td style="border: lightsteelblue 1px solid;">
  407. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  408. <tr>
  409. <td>
  410. <!-- 乾燥槽入料儲豆槽 DI1 -->
  411. <div id="DI1" tabindex="0" class="DI1_position" role="button" style="text-align: center;">
  412. <span id="DI1_status" class="D_status_css">DI1 status</span>
  413. <div id="DI1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  414. </div>
  415. </td>
  416. </tr>
  417. </table>
  418. </td>
  419. <td style="border: lightsteelblue 1px solid;">
  420. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  421. <tr>
  422. <td>
  423. <!-- 乾燥槽 D1 -->
  424. <div id="D1" tabindex="0" class="D1_position" role="button">
  425. <span id="D1_status" class="D_status_css">D1 status</span>
  426. <!-- D1 狀態點點-->
  427. <div id="D1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  428. </div>
  429. </td>
  430. <td>
  431. <!-- 乾燥槽 D2 -->
  432. <div id="D2" tabindex="0" class="D2_position" role="button">
  433. <span id="D2_status" class="D_status_css">D2 status</span>
  434. <div id="D2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  435. </div>
  436. </td>
  437. <td>
  438. <!-- 乾燥槽 D3 -->
  439. <div id="D3" tabindex="0" class="D3_position" role="button">
  440. <span id="D3_status" class="D_status_css">D3 status</span>
  441. <div id="D3_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  442. </div>
  443. </td>
  444. <td>
  445. <!-- 乾燥槽 D4 -->
  446. <div id="D4" tabindex="0" class="D4_position" role="button">
  447. <span id="D4_status" class="D_status_css">D4 status</span>
  448. <div id="D4_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  449. </div>
  450. </td>
  451. <td>
  452. <!-- 乾燥槽 D5 -->
  453. <div id="D5" tabindex="0" class="D5_position" role="button">
  454. <span id="D5_status" class="D_status_css">D5 status</span>
  455. <div id="D5_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  456. </div>
  457. </td>
  458. <td>
  459. <!-- 乾燥槽 D6 -->
  460. <div id="D6" tabindex="0" class="D6_position" role="button">
  461. <span id="D6_status" class="D_status_css">D6 status</span>
  462. <div id="D6_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  463. </div>
  464. </td>
  465. </tr>
  466. </table>
  467. </td>
  468. <td style="border: lightsteelblue 1px solid;">
  469. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  470. <tr>
  471. <td>
  472. <!-- 乾燥槽出料儲豆槽 DO1 -->
  473. <div id="DO1" tabindex="0" class="DO1_position" role="button">
  474. <span id="DO1_status" class="D_status_css">DO1 status</span>
  475. <div id="DO1_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  476. </div>
  477. </td>
  478. </tr>
  479. </table>
  480. </td>
  481. </tr>
  482. <tr>
  483. <td style="border: lightsteelblue 1px solid;">
  484. 入料儲豆槽
  485. </td>
  486. <td style="border: lightsteelblue 1px solid;">
  487. 乾燥桶槽
  488. </td>
  489. <td style="border: lightsteelblue 1px solid;">
  490. 出料儲豆槽
  491. </td>
  492. </tr>
  493. <tr>
  494. <td style="border: lightsteelblue 1px solid;">
  495. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  496. <tr>
  497. <td>
  498. <!-- 乾燥槽入料儲豆槽 DI2 -->
  499. <div id="DI2" tabindex="0" class="DI2_position" role="button">
  500. <span id="DI2_status" class="D_status_css">DI2 status</span>
  501. <div id="DI2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  502. </div>
  503. </td>
  504. </tr>
  505. </table>
  506. </td>
  507. <td style="border: lightsteelblue 1px solid;">
  508. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  509. <tr>
  510. <td>
  511. <!-- 乾燥槽 D7 -->
  512. <div id="D7" tabindex="0" class="D7_position" role="button" style="vertical-align: bottom;">
  513. <span id="D7_status" class="D_status_css">D7 status</span>
  514. <div id="D7_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  515. </div>
  516. </td>
  517. <td>
  518. <!-- 乾燥槽 D8 -->
  519. <div id="D8" tabindex="0" class="D8_position" role="button">
  520. <span id="D8_status" class="D_status_css">D8 status</span>
  521. <div id="D8_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  522. </div>
  523. </td>
  524. <td>
  525. <!-- 乾燥槽 D9 -->
  526. <div id="D9" tabindex="0" class="D9_position" role="button">
  527. <span id="D9_status" class="D_status_css">D9 status</span>
  528. <div id="D9_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  529. </div>
  530. </td>
  531. <td>
  532. <!-- 乾燥槽 D10 -->
  533. <div id="D10" tabindex="0" class="D10_position" role="button">
  534. <span id="D10_status" class="D_status_css">D10 status</span>
  535. <div id="D10_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  536. </div>
  537. </td>
  538. <td>
  539. <!-- 乾燥槽 D11 -->
  540. <div id="D11" tabindex="0" class="D11_position" role="button">
  541. <span id="D11_status" class="D_status_css">D11 status</span>
  542. <div id="D11_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  543. </div>
  544. </td>
  545. <td>
  546. <!-- 乾燥槽 D12 -->
  547. <div id="D12" tabindex="0" class="D12_position" role="button">
  548. <span id="D12_status" class="D_status_css">D12 status</span>
  549. <div id="D12_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  550. </div>
  551. </td>
  552. </tr>
  553. </table>
  554. </td>
  555. <td style="border: lightsteelblue 1px solid;">
  556. <table style="border: 0px plum solid; margin-right: auto; margin-left: auto; text-align: center;" cellpadding="5">
  557. <tr>
  558. <td>
  559. <!-- 乾燥槽出料儲豆槽 DO2 -->
  560. <div id="DO2" tabindex="0" class="DO2_position" role="button">
  561. <span id="DO2_status" class="D_status_css">DO2 status</span>
  562. <div id="DO2_status_dot" style="width: 110px; height: 20px; background-color: black;"></div>
  563. </div>
  564. </td>
  565. </tr>
  566. </table>
  567. </td>
  568. </tr>
  569. </table>
  570. <!-- 乾燥貨櫃 致動器狀態 感測器數值 -->
  571. <div style="text-align: center;">
  572. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 5px;" cellpadding="5" border="1">
  573. <tr>
  574. <td>
  575. 入料<br>Vacuum
  576. </td>
  577. <td>
  578. 桶槽<br>
  579. Vacuum
  580. </td>
  581. <td>
  582. 入料<br>三通閥
  583. </td>
  584. <td>
  585. 蝴蝶閥
  586. </td>
  587. <td>
  588. 消毒<br>電磁閥
  589. </td>
  590. <td>
  591. 排水<br>電磁閥
  592. </td>
  593. <td>
  594. 馬達
  595. </td>
  596. <td>
  597. 鼓風機
  598. </td>
  599. <td>
  600. 加熱器<br>1
  601. </td>
  602. <td>
  603. 加熱器<br>2
  604. </td>
  605. <td>
  606. 溫控開關
  607. </td>
  608. <td>
  609. 設定溫度
  610. </td>
  611. <td>
  612. 出料<br>Vacuum
  613. </td>
  614. </tr>
  615. <tr>
  616. <td>
  617. <span id="actuator_00">x</span>
  618. </td>
  619. <td>
  620. <span id="actuator_1">x</span>
  621. </td>
  622. <td>
  623. <span id="actuator_2">x</span>
  624. </td>
  625. <td>
  626. <span id="actuator_3">x</span>
  627. </td>
  628. <td>
  629. <span id="actuator_4">x</span>
  630. </td>
  631. <td>
  632. <span id="actuator_5">x</span>
  633. </td>
  634. <td>
  635. <span id="actuator_6">x</span>
  636. </td>
  637. <td>
  638. <span id="actuator_7">x</span>
  639. </td>
  640. <td>
  641. <span id="actuator_8">x</span>
  642. </td>
  643. <td>
  644. <span id="actuator_9">x</span>
  645. </td>
  646. <td>
  647. <span id="actuator_10">x</span>
  648. </td>
  649. <td>
  650. <span id="actuator_11">x</span>
  651. </td>
  652. <td>
  653. <span id="actuator_99">x</span>
  654. </td>
  655. </tr>
  656. </table>
  657. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 5px;" cellpadding="5" border="1">
  658. <tr>
  659. <td>
  660. 入料<br>高度
  661. </td>
  662. <td>
  663. 桶內<br>高度
  664. </td>
  665. <td>
  666. SHT11<br>溫度
  667. </td>
  668. <td>
  669. SHT11<br>濕度
  670. </td>
  671. <td>
  672. Soil<br>溫度
  673. </td>
  674. <td>
  675. Soil<br>濕度
  676. </td>
  677. <td>
  678. Soil<br>EC
  679. </td>
  680. <td>
  681. PA
  682. </td>
  683. <td>
  684. 出料<br>高度
  685. </td>
  686. </tr>
  687. <tr>
  688. <td>
  689. <span id="sensor_00">{{UltraSonic_input}}</span>
  690. </td>
  691. <td>
  692. <span id="sensor_1">{{UltraSonic_tank}}</span>
  693. </td>
  694. <td>
  695. <span id="sensor_2">{{sht11_Temp}}</span>
  696. </td>
  697. <td>
  698. <span id="sensor_3">{{sht11_Humidity}}</span>
  699. </td>
  700. <td>
  701. <span id="sensor_4">{{Soil_Temp}}</span>
  702. </td>
  703. <td>
  704. <span id="sensor_5">{{Soil_Humidity}}</span>
  705. </td>
  706. <td>
  707. <span id="sensor_6">{{Soil_EC}}</span>
  708. </td>
  709. <td>
  710. <span id="sensor_7">{{PA}}</span>
  711. </td>
  712. <td>
  713. <span id="sensor_99">{{UltraSonic_output}}</span>
  714. </td>
  715. </tr>
  716. </table>
  717. </div>
  718. <!-- 乾燥貨櫃 參數設定 -->
  719. <table style="border: 3px lightsteelblue solid; margin-right: auto; margin-left: auto; text-align: center; margin-top: 10px;" cellpadding="5" border="1">
  720. <tr>
  721. <td>
  722. 入料儲豆槽<br>
  723. 參數設定
  724. </td>
  725. <td>
  726. 桶槽<br>
  727. 參數設定
  728. </td>
  729. <td>
  730. 出料儲豆槽<br>
  731. 參數設定
  732. </td>
  733. </tr>
  734. <tr>
  735. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  736. 生豆高度
  737. <input name="Dry_Input_bean_height" type="text" class="input-text" value="5">公分<br>
  738. 吸料時間
  739. <input name="Dry_Input_vacuumON_time" type="text" class="input-text" value="5">秒<br>
  740. 放料時間
  741. <input name="Dry_Input_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  742. </td>
  743. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  744. 生豆高度
  745. <input name="Dry_Tank_bean_height" type="text" class="input-text" value="5">公分<br>
  746. 吸料時間
  747. <input name="Dry_Tank_vacuumON_time" type="text" class="input-text" value="10">秒,
  748. 放料時間
  749. <input name="Dry_Tank_vacuumOFF_time" type="text" class="input-text" value="10">秒<br>
  750. 馬達轉速
  751. <input name="Dry_Tank_motor_rpm" type="text" class="input-text" value="30">rpm<br>
  752. ----- 溫度權重設定 ----------------------------------------------<br>
  753. [SHT11]桶內溫度×權重
  754. <input name="Dry_Tank_TempWeight_SHT11" type="text" class="input-text" value="0.5">
  755. +
  756. [soil]生豆溫度×權重
  757. <input name="Dry_Tank_TempWeight_soil" type="text" class="input-text" value="0.5">
  758. <br>
  759. ----- 乾燥完成條件 (輸入 0 代表不設定) ------------------------<br>
  760. 指定溫度
  761. <input name="Dry_Tank_drying_temp" type="text" class="input-text" value="40">℃
  762. , 指定濕度
  763. <input name="Dry_Tank_drying_Humidity" type="text" class="input-text" value="30">%
  764. , 持溫時間
  765. <input name="Dry_Tank_drying_time" type="text" class="input-text" value="60">秒<br>
  766. <del>指定 EC</del>
  767. <input name="Dry_Tank_drying_EC" type="text" class="input-text" value="300">,
  768. 消毒開啟
  769. <input name="Dry_Tank_Disinfect_time" class="input-text" type="text" value="10">秒
  770. </td>
  771. <td style="padding: 10px; text-align: left; vertical-align: text-top;">
  772. 生豆高度
  773. <input name="Dry_Output_bean_height" type="text" class="input-text" value="5">公分<br>
  774. 吸料時間
  775. <input name="Dry_Output_vacuumON_time" type="text" class="input-text" value="5"> 秒<br>
  776. 放料時間
  777. <input name="Dry_Output_vacuumOFF_time" type="text" class="input-text" value="10"> 秒<br>
  778. </td>
  779. </tr>
  780. </table>
  781. <center><button style="margin: 15px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="dry_auto()">
  782. [測試] MQTT + 每 60 秒更新貨櫃狀態</button></center>
  783. <script>
  784. function dry_auto(){
  785. getting_parameters_D()
  786. $.post('/mqtt/101', data, function (res) {
  787. console.log('data: ', data)
  788. console.log('res: ', res)
  789. }, 'text')
  790. var dry_interval = setInterval(testing_D_auto, 30*1000)
  791. }
  792. </script>
  793. <center><button style="margin: 15px 10px 0px 10px;" type="submit" class="btn btn-primary" onclick="testing_D_auto()">
  794. [測試] 乾燥貨櫃狀態</button></center>
  795. <script>
  796. function testing_D_auto(){
  797. $.get('/dry_auto', '', function (res) {
  798. console.log('DI1: ' + res.Dry_Input_1)
  799. console.log('D1: ' + res.Dry_Tank_1)
  800. console.log('D2: ' + res.Dry_Tank_2)
  801. console.log('D3: ' + res.Dry_Tank_3)
  802. console.log('D4: ' + res.Dry_Tank_4)
  803. console.log('D5: ' + res.Dry_Tank_5)
  804. console.log('D6: ' + res.Dry_Tank_6)
  805. console.log('DO1: ' + res.Dry_Output_1)
  806. // ----- 乾燥入料 DI1 狀態 --------------------------------------------------------------
  807. dry_input_status_N = [res.Dry_Input_1]
  808. // ----- 乾燥桶槽 D1~D6 狀態 --------------------------------------------------------------
  809. dry_tank_status_N = [res.Dry_Tank_1, res.Dry_Tank_2, res.Dry_Tank_3, res.Dry_Tank_4, res.Dry_Tank_5, res.Dry_Tank_6]
  810. // ----- 乾燥出料 DO1 狀態 --------------------------------------------------------------
  811. dry_output_status_N = [res.Dry_Output_1]
  812. loading_D_status()
  813. }, 'json');
  814. // console.log("-- 自動化程式 end --")
  815. }
  816. </script>
  817. </div>
  818. <br>
  819. <br>
  820. <br>
  821. </div>
  822. </body>
  823. </html>