clean_container.html 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626
  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="5" /> 每 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. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  18. <!-- Socket.IO -->
  19. <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.dev.js"></script>
  20. <script language="JavaScript">
  21. // 指定 10秒 刷新網頁一次
  22. var ctn = '{{tid}}';
  23. var status = '{{status}}';
  24. console.log('ctn:' + ctn)
  25. $(function(){
  26. $("#coffee_title_pc").text('C' + ctn + ' 清洗浮選槽操作介面');
  27. $("#coffee_title_phone").text('C' + ctn + ' 清洗浮選槽操作介面');
  28. if (status == 2) {
  29. $('input').prop('disabled', true);
  30. $('button').prop('disabled', true);
  31. } else if ( (status == 0) || (status == 1) ) {
  32. $('input').prop('disabled', false);
  33. $('button').prop('disabled', false);
  34. }
  35. });
  36. // WebUpdate_set = setInterval(function(){WebUpdate(ctn)} , 30 * 1000)
  37. </script>
  38. <style>
  39. .footer{
  40. position: absolute;
  41. width: 100%;
  42. background-color: #eee;
  43. text-align: center;
  44. }
  45. body {
  46. margin: 0;
  47. }
  48. .input-text {
  49. height: 25px;
  50. width: 40px;
  51. text-align: center;
  52. margin-left: 2px;
  53. margin-right: 5px;
  54. }
  55. .label_ActuatorStatus {
  56. margin: auto;
  57. }
  58. .input-button-on {
  59. color: #008CBA;
  60. border: 2px rgb(182, 181, 181) solid;
  61. background-color: whitesmoke;
  62. padding: 1px 3px;
  63. width: 45px;
  64. }
  65. .input-button-off {
  66. color: #707070;
  67. border: 2px rgb(192, 192, 192) solid;
  68. background-color: whitesmoke;
  69. padding: 1px 3px;
  70. width: 45px;
  71. }
  72. .input-button {
  73. font-size: 14px;
  74. color: #008CBA;
  75. border: 2px rgb(182, 181, 181) solid;
  76. background-color: whitesmoke;
  77. padding: 1px 3px;
  78. }
  79. .table-all {
  80. font-size:18px;
  81. border:2px #cccccc solid;
  82. margin-left: 10px;
  83. margin-right: 10px;
  84. width: 98%;
  85. }
  86. </style>
  87. <script>
  88. // 清洗浮選 制動器開關
  89. var tank_num = '{{tid}}';
  90. // 入料 真空吸料機
  91. function inputVacuum() {
  92. var status = "off";
  93. var check = $("input[name=input_vacuum_status]:checked"); // 這裡面是 jQuery 撈取資料的方法, jQuery 常使用到 $ 錢字號
  94. console.log('check:', check);
  95. //大於0代表有被選中, 如果有多個可以呈現勾取的項目數量
  96. if (check.length > 0) {
  97. status = "on";
  98. $("#cmn-toggle-02").prop('checked', false); // 確認是否勾選
  99. if (!confirm("你確定要開啟入料儲豆槽真空吸料機嗎?")) {
  100. return false;
  101. };
  102. } else {
  103. $("#cmn-toggle-02").prop('checked', true);
  104. if (!confirm("你確定要關閉入料儲豆槽真空吸料機嗎?")) {
  105. return false;
  106. };
  107. };
  108. var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": status };
  109. // jquery 請求 '/mqtt/{{tid}}' 頁面
  110. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  111. console.log('data:', data)
  112. if (res == 'on') {
  113. $("#cmn-toggle-02").prop('checked', true);
  114. setTimeout("alert('入料儲豆槽真空吸料機_開啟成功!')", 500);
  115. } else if (res == 'off') {
  116. $("#cmn-toggle-02").prop('checked', false);
  117. setTimeout("alert('入料儲豆槽真空吸料機_關閉成功!')", 500);
  118. } else {
  119. alert(res);
  120. };
  121. }, 'text')
  122. // setTimeout(function () { location.reload(); }, 500);
  123. };
  124. function inputVacuum_ON() {
  125. var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": "on" };
  126. // jquery 請求 '/mqtt/{{tid}}' 頁面
  127. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  128. console.log('data:', data)
  129. if (res == 'on') {
  130. $("#cmn-toggle-02").prop('checked', true);
  131. } else if (res == 'off') {
  132. $("#cmn-toggle-02").prop('checked', false);
  133. } else {
  134. };
  135. }, 'text')
  136. // setTimeout(function () { location.reload(); }, 500);
  137. };
  138. function inputVacuum_OFF() {
  139. var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": "off" };
  140. // jquery 請求 '/mqtt/{{tid}}' 頁面
  141. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  142. console.log('data:', data)
  143. if (res == 'on') {
  144. $("#cmn-toggle-02").prop('checked', true);
  145. } else if (res == 'off') {
  146. $("#cmn-toggle-02").prop('checked', false);
  147. } else {
  148. };
  149. }, 'text')
  150. // setTimeout(function () { location.reload(); }, 500);
  151. };
  152. // 桶內 真空吸料機
  153. function tankVacuum() {
  154. var status = "off";
  155. var check = $("input[name=tank_vacuum_status]:checked");
  156. console.log('check:', check);
  157. //大於0代表有被選中
  158. if (check.length > 0) {
  159. status = "on";
  160. $("#cmn-toggle-05").prop('checked', false);
  161. if (!confirm("你確定要開啟真空吸料機嗎?")) {
  162. return false;
  163. };
  164. } else {
  165. $("#cmn-toggle-05").prop('checked', true);
  166. if (!confirm("你確定要關閉真空吸料機嗎?")) {
  167. return false;
  168. };
  169. };
  170. var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": status };
  171. $.post('/mqtt/{{tid}}', data, function (res) {
  172. console.log('data:', data)
  173. if (res == 'on') {
  174. $("#cmn-toggle-05").prop('checked', true);
  175. setTimeout("alert('真空吸料機_開啟成功!')", 500);
  176. } else if (res == 'off') {
  177. $("#cmn-toggle-05").prop('checked', false);
  178. setTimeout("alert('真空吸料機_關閉成功!')", 500);
  179. } else {
  180. alert(res);
  181. };
  182. }, 'text')
  183. // setTimeout(function () { location.reload(); }, 500);
  184. };
  185. function tankVacuum_ON() {
  186. var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": "on" };
  187. $.post('/mqtt/{{tid}}', data, function (res) {
  188. console.log('data:', data)
  189. if (res == 'on') {
  190. $("#cmn-toggle-05").prop('checked', true);
  191. } else if (res == 'off') {
  192. $("#cmn-toggle-05").prop('checked', false);
  193. } else {
  194. };
  195. }, 'text')
  196. // setTimeout(function () { location.reload(); }, 500);
  197. };
  198. function tankVacuum_OFF() {
  199. var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": "off" };
  200. $.post('/mqtt/{{tid}}', data, function (res) {
  201. console.log('data:', data)
  202. if (res == 'on') {
  203. $("#cmn-toggle-05").prop('checked', true);
  204. } else if (res == 'off') {
  205. $("#cmn-toggle-05").prop('checked', false);
  206. } else {
  207. };
  208. }, 'text')
  209. // setTimeout(function () { location.reload(); }, 500);
  210. };
  211. // 浮選槽注水 雙核隔膜泵 出水口 2、3_雙核泵
  212. function tankPumpWaterL2L3() {
  213. //<!--setInterval(Relay,10000);-->
  214. var status = "off";
  215. var check = $("input[name=tank_pump_waterL2L3_status]:checked");
  216. //大於0代表有被選中
  217. if (check.length > 0) {
  218. status = "on";
  219. $("#cmn-toggle-08").prop('checked', false);
  220. if (!confirm("你確定要開啟浮選槽注水嗎?")) {
  221. return false;
  222. };
  223. } else {
  224. $("#cmn-toggle-08").prop('checked', true);
  225. if (!confirm("你確定要關閉浮選槽注水嗎?")) {
  226. return false;
  227. };
  228. };
  229. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": status };
  230. $.post('/mqtt/{{tid}}', data, function (res) {
  231. console.log('data:', data)
  232. if (res == 'on') {
  233. $("#cmn-toggle-08").prop('checked', true);
  234. setTimeout("alert('浮選槽注水入料_開啟成功!')", 500);
  235. } else if (res == 'off') {
  236. $("#cmn-toggle-08").prop('checked', false);
  237. setTimeout("alert('浮選槽注水排氣_關閉成功!')", 500);
  238. } else {
  239. alert(res);
  240. };
  241. }, 'text')
  242. // setTimeout(function () { location.reload(); }, 500);
  243. };
  244. function tankPumpWaterL2L3_ON() {
  245. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": "on" };
  246. $.post('/mqtt/{{tid}}', data, function (res) {
  247. console.log('data:', data)
  248. if (res == 'on') {
  249. $("#cmn-toggle-08").prop('checked', true);
  250. } else if (res == 'off') {
  251. $("#cmn-toggle-08").prop('checked', false);
  252. } else {
  253. };
  254. }, 'text')
  255. // setTimeout(function () { location.reload(); }, 500);
  256. };
  257. function tankPumpWaterL2L3_OFF() {
  258. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": "off" };
  259. $.post('/mqtt/{{tid}}', data, function (res) {
  260. console.log('data:', data)
  261. if (res == 'on') {
  262. $("#cmn-toggle-08").prop('checked', true);
  263. } else if (res == 'off') {
  264. $("#cmn-toggle-08").prop('checked', false);
  265. } else {
  266. };
  267. }, 'text')
  268. // setTimeout(function () { location.reload(); }, 500);
  269. };
  270. // 第 2 層灑水 雙核隔膜泵 出水口 4、5_雙核泵
  271. function tankPumpWaterL4L5() {
  272. //<!--setInterval(Relay,10000);-->
  273. var status = "off";
  274. var check = $("input[name=tank_pump_waterL4L5_status]:checked");
  275. //大於0代表有被選中
  276. if (check.length > 0) {
  277. status = "on";
  278. $("#cmn-toggle-11").prop('checked', false);
  279. if (!confirm("你確定要開啟清洗第 2 層灑水嗎?")) {
  280. return false;
  281. };
  282. } else {
  283. $("#cmn-toggle-11").prop('checked', true);
  284. if (!confirm("你確定要關閉清洗第 2 層灑水嗎?")) {
  285. return false;
  286. };
  287. };
  288. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": status };
  289. $.post('/mqtt/{{tid}}', data, function (res) {
  290. console.log('data:', data)
  291. if (res == 'on') {
  292. $("#cmn-toggle-11").prop('checked', true);
  293. setTimeout("alert('清洗第 2 層灑水_開啟成功!')", 500);
  294. } else if (res == 'off') {
  295. $("#cmn-toggle-11").prop('checked', false);
  296. setTimeout("alert('清洗第 2 層灑水_關閉成功!')", 500);
  297. } else {
  298. alert(res);
  299. };
  300. }, 'text')
  301. // setTimeout(function () { location.reload(); }, 500);
  302. };
  303. function tankPumpWaterL4L5_ON() {
  304. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": "on" };
  305. $.post('/mqtt/{{tid}}', data, function (res) {
  306. console.log('data:', data)
  307. if (res == 'on') {
  308. $("#cmn-toggle-11").prop('checked', true);
  309. } else if (res == 'off') {
  310. $("#cmn-toggle-11").prop('checked', false);
  311. } else {
  312. };
  313. }, 'text')
  314. // setTimeout(function () { location.reload(); }, 500);
  315. };
  316. function tankPumpWaterL4L5_OFF() {
  317. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": "off" };
  318. $.post('/mqtt/{{tid}}', data, function (res) {
  319. console.log('data:', data)
  320. if (res == 'on') {
  321. $("#cmn-toggle-11").prop('checked', true);
  322. } else if (res == 'off') {
  323. $("#cmn-toggle-11").prop('checked', false);
  324. } else {
  325. };
  326. }, 'text')
  327. // setTimeout(function () { location.reload(); }, 500);
  328. };
  329. // 第 4 層灑水 雙核隔膜泵 入水口_雙核泵
  330. function tankPumpWaterInput() {
  331. var status = "off";
  332. var check = $("input[name=tank_pump_waterInput_status]:checked");
  333. //大於0代表有被選中
  334. if (check.length > 0) {
  335. status = "on";
  336. $("#cmn-toggle-14").prop('checked', false);
  337. if (!confirm("你確定要開啟清洗第 4 層灑水嗎?")) {
  338. return false;
  339. };
  340. } else {
  341. $("#cmn-toggle-14").prop('checked', true);
  342. if (!confirm("你確定要關閉清洗第 4 層灑水嗎?")) {
  343. return false;
  344. };
  345. };
  346. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": status };
  347. $.post('/mqtt/{{tid}}', data, function (res) {
  348. console.log('data:', data)
  349. if (res == 'on') {
  350. $("#cmn-toggle-14").prop('checked', true);
  351. setTimeout("alert('清洗第 4 層灑水_開啟成功!')", 500);
  352. } else if (res == 'off') {
  353. $("#cmn-toggle-14").prop('checked', false);
  354. setTimeout("alert('清洗第 4 層灑水_關閉成功!')", 500);
  355. } else {
  356. alert(res);
  357. };
  358. }, 'text')
  359. // setTimeout(function () { location.reload(); }, 500);
  360. };
  361. function tankPumpWaterInput_ON() {
  362. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": "on" };
  363. $.post('/mqtt/{{tid}}', data, function (res) {
  364. console.log('data:', data)
  365. if (res == 'on') {
  366. $("#cmn-toggle-14").prop('checked', true);
  367. } else if (res == 'off') {
  368. $("#cmn-toggle-14").prop('checked', false);
  369. } else {
  370. };
  371. }, 'text')
  372. // setTimeout(function () { location.reload(); }, 500);
  373. };
  374. function tankPumpWaterInput_OFF() {
  375. var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": "off" };
  376. $.post('/mqtt/{{tid}}', data, function (res) {
  377. console.log('data:', data)
  378. if (res == 'on') {
  379. $("#cmn-toggle-14").prop('checked', true);
  380. } else if (res == 'off') {
  381. $("#cmn-toggle-14").prop('checked', false);
  382. } else {
  383. };
  384. }, 'text')
  385. // setTimeout(function () { location.reload(); }, 500);
  386. };
  387. // 清洗第 3 層 電磁閥 出水口 2、3_電磁閥
  388. function tankSolenoidWaterL2L3() {
  389. var status = "off";
  390. var check = $("input[name=tank_solenoid_waterL2L3_status]:checked");
  391. //大於0代表有被選中
  392. if (check.length > 0) {
  393. status = "on";
  394. $("#cmn-toggle-17").prop('checked', false);
  395. if (!confirm("你確定要開啟清洗第 3 層電磁閥嗎?")) {
  396. return false;
  397. };
  398. } else {
  399. $("#cmn-toggle-17").prop('checked', true);
  400. if (!confirm("你確定要關閉清洗第 3 層電磁閥嗎?")) {
  401. return false;
  402. };
  403. };
  404. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": status };
  405. $.post('/mqtt/{{tid}}', data, function (res) {
  406. console.log('data:', data)
  407. if (res == 'on') {
  408. $("#cmn-toggle-17").prop('checked', true);
  409. setTimeout("alert('清洗第 3 層電磁閥_開啟成功!')", 500);
  410. } else if (res == 'off') {
  411. $("#cmn-toggle-17").prop('checked', false);
  412. setTimeout("alert('清洗第 3 層電磁閥_關閉成功!')", 500);
  413. } else {
  414. alert(res);
  415. };
  416. }, 'text')
  417. // setTimeout(function () { location.reload(); }, 500);
  418. };
  419. function tankSolenoidWaterL2L3_ON() {
  420. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": "on" };
  421. $.post('/mqtt/{{tid}}', data, function (res) {
  422. console.log('data:', data)
  423. if (res == 'on') {
  424. $("#cmn-toggle-17").prop('checked', true);
  425. } else if (res == 'off') {
  426. $("#cmn-toggle-17").prop('checked', false);
  427. } else {
  428. };
  429. }, 'text')
  430. // setTimeout(function () { location.reload(); }, 500);
  431. };
  432. function tankSolenoidWaterL2L3_OFF() {
  433. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": "off" };
  434. $.post('/mqtt/{{tid}}', data, function (res) {
  435. console.log('data:', data)
  436. if (res == 'on') {
  437. $("#cmn-toggle-17").prop('checked', true);
  438. } else if (res == 'off') {
  439. $("#cmn-toggle-17").prop('checked', false);
  440. } else {
  441. };
  442. }, 'text')
  443. // setTimeout(function () { location.reload(); }, 500);
  444. };
  445. // 清洗第 5 層 電磁閥 出水口 4、5_電磁閥
  446. function tankSolenoidWaterL4L5() {
  447. var status = "off";
  448. var check = $("input[name=tank_solenoid_waterL4L5_status]:checked");
  449. //大於0代表有被選中
  450. if (check.length > 0) {
  451. status = "on";
  452. $("#cmn-toggle-20").prop('checked', false);
  453. if (!confirm("你確定要開啟清洗第 5 層電磁閥嗎?")) {
  454. return false;
  455. };
  456. } else {
  457. $("#cmn-toggle-20").prop('checked', true);
  458. if (!confirm("你確定要關閉清洗第 5 層電磁閥嗎?")) {
  459. return false;
  460. };
  461. };
  462. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": status };
  463. $.post('/mqtt/{{tid}}', data, function (res) {
  464. console.log('data:', data)
  465. if (res == 'on') {
  466. $("#cmn-toggle-20").prop('checked', true);
  467. setTimeout("alert('清洗第 5 層電磁閥_開啟成功!')", 500);
  468. } else if (res == 'off') {
  469. $("#cmn-toggle-20").prop('checked', false);
  470. setTimeout("alert('清洗第 5 層電磁閥_關閉成功!')", 500);
  471. } else {
  472. alert(res);
  473. };
  474. }, 'text')
  475. // setTimeout(function () { location.reload(); }, 500);
  476. };
  477. function tankSolenoidWaterL4L5_ON() {
  478. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": "on" };
  479. $.post('/mqtt/{{tid}}', data, function (res) {
  480. console.log('data:', data)
  481. if (res == 'on') {
  482. $("#cmn-toggle-20").prop('checked', true);
  483. } else if (res == 'off') {
  484. $("#cmn-toggle-20").prop('checked', false);
  485. } else {
  486. };
  487. }, 'text')
  488. // setTimeout(function () { location.reload(); }, 500);
  489. };
  490. function tankSolenoidWaterL4L5_OFF() {
  491. var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": "off" };
  492. $.post('/mqtt/{{tid}}', data, function (res) {
  493. console.log('data:', data)
  494. if (res == 'on') {
  495. $("#cmn-toggle-20").prop('checked', true);
  496. } else if (res == 'off') {
  497. $("#cmn-toggle-20").prop('checked', false);
  498. } else {
  499. };
  500. }, 'text')
  501. // setTimeout(function () { location.reload(); }, 500);
  502. };
  503. // 步進馬達
  504. /*
  505. function tankSteppingMotor() {
  506. var motor_data = $("input[name=steppingmotor_rpm_data]").val();
  507. if (motor_data == '') {
  508. alert("請先輸入要運轉的值!");
  509. return false;
  510. } else if (motor_data == 0) {
  511. alert("轉速 0 為關閉步進馬達");
  512. } else if (Number(motor_data) < -50 || Number(motor_data) > 50 || !Number(motor_data)) {
  513. alert("您輸入的值已超過範圍,請重新輸入!" + !Number(motor_data));
  514. return false;
  515. };
  516. if (motor_data != 0) {
  517. value = motor_data;
  518. if (!confirm("你確定要開啟步進馬達,運轉速度為 " + motor_data + " 嗎?")) {
  519. return false;
  520. };
  521. } else {
  522. if (!confirm("你確定要關閉步進馬達嗎?")) {
  523. return false;
  524. };
  525. };
  526. var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": motor_data };
  527. $.post('/mqtt/{{tid}}', data, function (res) {
  528. console.log('data:', data)
  529. if (res == 'on') {
  530. setTimeout("alert('步進馬達_開啟成功!')", 500);
  531. } else if (res == 'off') {
  532. setTimeout("alert('步進馬達_關閉成功!')", 500);
  533. } else {
  534. alert(res);
  535. };
  536. }, 'text')
  537. // setTimeout(function () { location.reload(); }, 500);
  538. };
  539. */
  540. function tankSteppingMotor_STOP() {
  541. var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
  542. $.post('/mqtt/{{tid}}', data, function (res) {
  543. console.log('data:', data)
  544. }, 'text')
  545. // setTimeout(function () { location.reload(); }, 500);
  546. };
  547. function tankSteppingMotor_UP() {
  548. var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"up"};
  549. $.post('/mqtt/{{tid}}', data, function (res) {
  550. console.log('data:', data)
  551. }, 'text')
  552. // setTimeout(function () { location.reload(); }, 500);
  553. };
  554. function tankSteppingMotor_DOWN() {
  555. var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"down" };
  556. $.post('/mqtt/{{tid}}', data, function (res) {
  557. console.log('data:', data)
  558. }, 'text')
  559. // setTimeout(function () { location.reload(); }, 500);
  560. };
  561. function tankSteppingMotor_UPSTOP() {
  562. var data_up = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"up"};
  563. $.post('/mqtt/{{tid}}', data_up, function (res) {
  564. console.log('data:', data_up)
  565. }, 'text')
  566. var time = new Date();
  567. while ((new Date() - time) < 1 * 1000) { };
  568. var data_stop = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
  569. $.post('/mqtt/{{tid}}', data_stop, function (res) {
  570. console.log('data:', data_stop)
  571. }, 'text')
  572. };
  573. function tankSteppingMotor_DOWNSTOP() {
  574. var data_down = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"down"};
  575. $.post('/mqtt/{{tid}}', data_down, function (res) {
  576. console.log('data:', data_down)
  577. }, 'text')
  578. var time = new Date();
  579. while ((new Date() - time) < 1 * 1000) { };
  580. var data_stop = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
  581. $.post('/mqtt/{{tid}}', data_stop, function (res) {
  582. console.log('data:', data_stop)
  583. }, 'text')
  584. };
  585. // 出料 真空吸料機
  586. function outputVacuum() {
  587. var status = "off";
  588. var check = $("input[name=output_vacuum_status]:checked");
  589. //大於0代表有被選中
  590. if (check.length > 0) {
  591. status = "on";
  592. $("#cmn-toggle-26").prop('checked', false);
  593. if (!confirm("你確定要開啟出料儲豆槽真空吸料機嗎?")) {
  594. return false;
  595. };
  596. } else {
  597. $("#cmn-toggle-26").prop('checked', true);
  598. if (!confirm("你確定要關閉出料儲豆槽真空吸料機嗎?")) {
  599. return false;
  600. };
  601. };
  602. var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": status };
  603. console.log('data:', data)
  604. $.post('/mqtt/{{tid}}', data, function (res) {
  605. if (res == 'on') {
  606. $("#cmn-toggle-26").prop('checked', true);
  607. setTimeout("alert('出料儲豆槽真空吸料機_開啟成功!')", 500);
  608. } else if (res == 'off') {
  609. $("#cmn-toggle-26").prop('checked', false);
  610. setTimeout("alert('出料儲豆槽真空吸料機_關閉成功!')", 500);
  611. } else {
  612. alert(res);
  613. };
  614. }, 'text')
  615. // setTimeout(function () { location.reload(); }, 500);
  616. };
  617. function outputVacuum_ON() {
  618. var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": "on" };
  619. console.log('data:', data)
  620. $.post('/mqtt/{{tid}}', data, function (res) {
  621. if (res == 'on') {
  622. $("#cmn-toggle-26").prop('checked', true);
  623. } else if (res == 'off') {
  624. $("#cmn-toggle-26").prop('checked', false);
  625. } else {
  626. };
  627. }, 'text')
  628. // setTimeout(function () { location.reload(); }, 500);
  629. };
  630. function outputVacuum_OFF() {
  631. var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": "off" };
  632. console.log('data:', data)
  633. $.post('/mqtt/{{tid}}', data, function (res) {
  634. if (res == 'on') {
  635. $("#cmn-toggle-26").prop('checked', true);
  636. } else if (res == 'off') {
  637. $("#cmn-toggle-26").prop('checked', false);
  638. } else {
  639. };
  640. }, 'text')
  641. // setTimeout(function () { location.reload(); }, 500);
  642. };
  643. </script>
  644. </head>
  645. <body>
  646. <div id="wrapper">
  647. <div id="coffee_header">
  648. <!-- 匯入共同使用的 header.html 內容 -->
  649. {% include 'header.html' %}
  650. </div>
  651. <h4>制動器</h4>
  652. <table border="1" class="table-all" cellpadding="3" style="text-align: center;">
  653. <tr>
  654. <td style="color:red;">Valve</td>
  655. <td>入料<br>真空吸料機</td>
  656. <td>浮選入豆<br>真空吸料機</td>
  657. <td>出水口 2、3_<br>雙核隔膜泵</td>
  658. <td>出水口 4、5_<br>雙核隔膜泵</td>
  659. <td>入水口_<br>雙核隔膜泵</td>
  660. <td>清洗第 3 層<br>電磁閥</td>
  661. <td>清洗第 5 層<br>電磁閥</td>
  662. <td>
  663. 步進馬達
  664. <span id="tank_stepping_motor_t_status">{{tank_stepping_motor}}</span>
  665. </td>
  666. <td>出料<br>真空吸料機</td>
  667. </tr>
  668. <tr>
  669. <td>
  670. <span style="color:#C0C0C0;">off</span>
  671. <span style="color:#008CBA;">on</span>
  672. </td>
  673. <td>
  674. <div class="switch_div">
  675. <div class="switch">
  676. <input id="cmn-toggle-01" class="cmn-toggle cmn-toggle-round" type="checkbox">
  677. <label for="cmn-toggle-01"></label>
  678. </div>
  679. <div class="switch text-center">
  680. {% if input_vacuum=='ON' %}
  681. <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  682. name="tank_vacuum_status" value="ON" onclick="inputVacuum()">
  683. {% else %}
  684. <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  685. name="tank_vacuum_status" value="OFF" onclick="inputVacuum()">
  686. {% endif %}
  687. <label for="cmn-toggle-02" class="label_ActuatorStatus"></label>
  688. </div>
  689. <div class="switch">
  690. <input id="cmn-toggle-03" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  691. <label for="cmn-toggle-03" data-on="Yes" data-off="No"></label>
  692. </div>
  693. </div>
  694. </td>
  695. <td>
  696. <div class="switch_div">
  697. <div class="switch">
  698. <input id="cmn-toggle-04" class="cmn-toggle cmn-toggle-round" type="checkbox">
  699. <label for="cmn-toggle-04"></label>
  700. </div>
  701. <div class="switch text-center">
  702. {% if tank_vacuum=='ON' %}
  703. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  704. name="tank_vacuum_status" value="ON" onclick="tankVacuum()">
  705. {% else %}
  706. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  707. name="tank_vacuum_status" value="OFF" onclick="tankVacuum()">
  708. {% endif %}
  709. <label for="cmn-toggle-05" class="label_ActuatorStatus"></label>
  710. </div>
  711. <div class="switch">
  712. <input id="cmn-toggle-06" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  713. <label for="cmn-toggle-06" data-on="Yes" data-off="No"></label>
  714. </div>
  715. </div>
  716. </td>
  717. <td>
  718. <div class="switch_div">
  719. <div class="switch">
  720. <input id="cmn-toggle-07" class="cmn-toggle cmn-toggle-round" type="checkbox">
  721. <label for="cmn-toggle-07"></label>
  722. </div>
  723. <div class="switch text-center">
  724. {% if tank_pump_waterL2L3=='ON' %}
  725. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  726. name="tank_pump_waterL2L3_status" value="ON" onclick="tankPumpWaterL2L3()">
  727. {% else %}
  728. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  729. name="tank_pump_waterL2L3_status" value="OFF" onclick="tankPumpWaterL2L3()">
  730. {% endif %}
  731. <label for="cmn-toggle-08" class="label_ActuatorStatus"></label>
  732. </div>
  733. <div class="switch">
  734. <input id="cmn-toggle-09" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  735. <label for="cmn-toggle-09" data-on="Yes" data-off="No"></label>
  736. </div>
  737. </div>
  738. </td>
  739. <td>
  740. <div class="switch_div">
  741. <div class="switch">
  742. <input id="cmn-toggle-10" class="cmn-toggle cmn-toggle-round" type="checkbox">
  743. <label for="cmn-toggle-10"></label>
  744. </div>
  745. <div class="switch text-center">
  746. {% if tank_pump_waterL4L5=='ON' %}
  747. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  748. name="tank_pump_waterL4L5_status" value="ON" onclick="tankPumpWaterL4L5()">
  749. {% else %}
  750. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  751. name="tank_pump_waterL4L5_status" value="OFF" onclick="tankPumpWaterL4L5()">
  752. {% endif %}
  753. <label for="cmn-toggle-11" class="label_ActuatorStatus"></label>
  754. </div>
  755. <div class="switch">
  756. <input id="cmn-toggle-12" class="cmn-toggle cmn-toggle-on-off" type="checkbox">
  757. <label for="cmn-toggle-12" data-on="Yes" data-off="No"></label>
  758. </div>
  759. </div>
  760. </td>
  761. <td>
  762. <div class="switch_div">
  763. <div class="switch">
  764. <input id="cmn-toggle-13" class="cmn-toggle cmn-toggle-round" type="checkbox">
  765. <label for="cmn-toggle-13"></label>
  766. </div>
  767. <div class="switch text-center">
  768. {% if tank_pump_waterInput=='ON' %}
  769. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  770. name="tank_pump_waterInput_status" value="ON" onclick="tankPumpWaterInput()">
  771. {% else %}
  772. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  773. name="tank_pump_waterInput_status" value="OFF" onclick="tankPumpWaterInput()">
  774. {% endif %}
  775. <label for="cmn-toggle-14" class="label_ActuatorStatus"></label>
  776. </div>
  777. <div class="switch">
  778. <input id="cmn-toggle-15" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  779. <label for="cmn-toggle-15" data-on="Yes" data-off="No"></label>
  780. </div>
  781. </div>
  782. </td>
  783. <td>
  784. <div class="switch_div">
  785. <div class="switch">
  786. <input id="cmn-toggle-16" class="cmn-toggle cmn-toggle-round" type="checkbox">
  787. <label for="cmn-toggle-16"></label>
  788. </div>
  789. <div class="switch text-center">
  790. {% if tank_solenoid_waterL2L3=='ON' %}
  791. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  792. name="tank_solenoid_waterL2L3_status" value="ON" onclick="tankSolenoidWaterL2L3()">
  793. {% else %}
  794. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  795. name="tank_solenoid_waterL2L3_status" value="OFF" onclick="tankSolenoidWaterL2L3()">
  796. {% endif %}
  797. <label for="cmn-toggle-17" class="label_ActuatorStatus"></label>
  798. </div>
  799. <div class="switch">
  800. <input id="cmn-toggle-18" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  801. <label for="cmn-toggle-18" data-on="Yes" data-off="No"></label>
  802. </div>
  803. </div>
  804. </td>
  805. <td>
  806. <div class="switch_div">
  807. <div class="switch">
  808. <input id="cmn-toggle-19" class="cmn-toggle cmn-toggle-round" type="checkbox">
  809. <label for="cmn-toggle-19"></label>
  810. </div>
  811. <div class="switch text-center">
  812. {% if tank_solenoid_waterL4L5=='ON' %}
  813. <input id="cmn-toggle-20" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  814. name="tank_solenoid_waterL4L5_status" value="ON" onclick="tankSolenoidWaterL4L5()">
  815. {% else %}
  816. <input id="cmn-toggle-20" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  817. name="tank_solenoid_waterL4L5_status" value="OFF" onclick="tankSolenoidWaterL4L5()">
  818. {% endif %}
  819. <label for="cmn-toggle-20" class="label_ActuatorStatus"></label>
  820. </div>
  821. <div class="switch">
  822. <input id="cmn-toggle-21" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  823. <label for="cmn-toggle-21" data-on="Yes" data-off="No"></label>
  824. </div>
  825. </div>
  826. </td>
  827. <td>
  828. <input type="button" value="UP" name="tank_stepping_motor_UP" onclick="tankSteppingMotor_UP()">
  829. <input type="button" value="STOP" name="tank_stepping_motor_STOP" onclick="tankSteppingMotor_STOP()">
  830. <input type="button" value="DOWN" name="tank_stepping_motor_DOWN" onclick="tankSteppingMotor_DOWN()">
  831. </td>
  832. <td>
  833. <div class="switch_div">
  834. <div class="switch">
  835. <input id="cmn-toggle-25" class="cmn-toggle cmn-toggle-round" type="checkbox">
  836. <label for="cmn-toggle-25"></label>
  837. </div>
  838. <div class="switch text-center">
  839. {% if output_vacuum=='ON' %}
  840. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  841. name="output_vacuum_status" value="ON" onclick="outputVacuum()">
  842. {% else %}
  843. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  844. name="output_vacuum_status" value="OFF" onclick="outputVacuum()">
  845. {% endif %}
  846. <label for="cmn-toggle-26" class="label_ActuatorStatus"></label>
  847. </div>
  848. <div class="switch">
  849. <input id="cmn-toggle-27" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  850. <label for="cmn-toggle-27" data-on="Yes" data-off="No"></label>
  851. </div>
  852. </div>
  853. </td>
  854. </tr>
  855. <tr>
  856. <td><span style="color:#008CBA;"><b>ON</b></span></td>
  857. <td><input type="button" class="input-button-on" value="ON" name="input_vacuum_ON" onclick="inputVacuum_ON()"></td>
  858. <td><input type="button" class="input-button-on" value="ON" name="tank_vacuum_ON" onclick="tankVacuum_ON()"></td>
  859. <td><input type="button" class="input-button-on" value="ON" name="tank_pump_water_float_ON" onclick="tankPumpWaterL2L3_ON()"></td>
  860. <td><input type="button" class="input-button-on" value="ON" name="tank_pump_waterL4L5_ON" onclick="tankPumpWaterL4L5_ON()">
  861. </td>
  862. <td><input type="button" class="input-button-on" value="ON" name="tank_pump_waterInput_ON" onclick="tankPumpWaterInput_ON()">
  863. </td>
  864. <td><input type="button" class="input-button-on" value="ON" name="tank_solenoid_waterL2L3_ON" onclick="tankSolenoidWaterL2L3_ON()">
  865. </td>
  866. <td><input type="button" class="input-button-on" value="ON" name="tank_solenoid_waterL4L5_ON" onclick="tankSolenoidWaterL4L5_ON()">
  867. </td>
  868. <td><input type="button" value="UP" name="tank_stepping_motor_UP" onclick="tankSteppingMotor_UPSTOP()">
  869. </td>
  870. <td><input type="button" class="input-button-on" value="ON" name="output_vacuum_ON" onclick="outputVacuum_ON()"></td>
  871. </tr>
  872. <tr>
  873. <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
  874. <td><input type="button" class="input-button-off" value="OFF" name="input_vacuum_OFF" onclick="inputVacuum_OFF()"></td>
  875. <td><input type="button" class="input-button-off" value="OFF" name="tank_vacuum_OFF" onclick="tankVacuum_OFF()"></td>
  876. <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_water_float_OFF" onclick="tankPumpWaterL2L3_OFF()">
  877. </td>
  878. <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_waterL4L5_OFF" onclick="tankPumpWaterL4L5_OFF()">
  879. </td>
  880. <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_waterInput_OFF" onclick="tankPumpWaterInput_OFF()">
  881. </td>
  882. <td><input type="button" class="input-button-off" value="OFF" name="tank_solenoid_waterL2L3_OFF" onclick="tankSolenoidWaterL2L3_OFF()">
  883. </td>
  884. <td><input type="button" class="input-button-off" value="OFF" name="tank_solenoid_waterL4L5_OFF" onclick="tankSolenoidWaterL4L5_OFF()">
  885. </td>
  886. <td><input type="button" value="DOWN" name="tank_stepping_motor_STOP" onclick="tankSteppingMotor_DOWNSTOP()">
  887. </td>
  888. <td><input type="button" class="input-button-off" value="OFF" name="output_vacuum_OFF" onclick="outputVacuum_OFF()"></td>
  889. </tr>
  890. </table>
  891. <br>
  892. <h4>感測器</h4>
  893. <table border="1" class="table-all" cellpadding="5">
  894. <tr>
  895. <td>[桶內] 生豆高度:<span id="UltraSonic_t_status">{{tank_UltraSonic.UltraSonic}}</span></td>
  896. </tr>
  897. </table>
  898. <br>
  899. <h4>排程測試</h4>
  900. <table border="1" class="table-all" cellpadding="5">
  901. <tr>
  902. <td>水路測試</td>
  903. <td>排氣下豆測試</td>
  904. <td>生豆閘門測試</td>
  905. <td>出料測試</td>
  906. <td>出水口 4、5 <br>電磁閥逆洗</td>
  907. <td>出水口 2、3 <br>電磁閥逆洗</td>
  908. <td>清洗浮選連動</td>
  909. </tr>
  910. <tr>
  911. <td>
  912. 入水口_雙核泵 ON
  913. <input type="text" class="input-text" name="waiting_time_1" value="30" style="width:50px;">
  914. <br>
  915. 出水口 4、5_雙核泵 ON
  916. <input type="text" class="input-text" name="waiting_time_2" value="30" style="width:50px;">
  917. <br>
  918. 出水口 2、3_雙核泵 ON
  919. <input type="text" class="input-text" name="waiting_time_3" value="0" style="width:50px;">
  920. </td>
  921. <td>
  922. 真空吸料機 ON
  923. <input type="text" class="input-text" name="waiting_time_8" value="1" style="width:50px;">
  924. <br>
  925. 真空吸料機 OFF
  926. <input type="text" class="input-text" name="waiting_time_9" value="10" style="width:50px;">
  927. <br>
  928. * 循環次數
  929. <input type="text" class="input-text" name="waiting_loop_3" value="3" style="width:50px;">
  930. </td>
  931. <td>
  932. 上升
  933. <input type="text" class="input-text" name="waiting_time_4" value="3.5" style="width:50px;">
  934. <br>
  935. 停止
  936. <input type="text" class="input-text" name="waiting_time_5" value="3" style="width:50px;">
  937. <br>
  938. 下降
  939. <input type="text" class="input-text" name="waiting_time_6" value="3.5" style="width:50px;">
  940. <br>
  941. 停止
  942. <input type="text" class="input-text" name="waiting_time_7" value="3" style="width:50px;">
  943. <br>
  944. * 循環次數
  945. <input type="text" class="input-text" name="waiting_loop_2" value="3" style="width:50px;">
  946. </td>
  947. <td>
  948. 出料_吸料機 ON
  949. <input type="text" class="input-text" name="waiting_time_16" value="1" style="width:50px;">
  950. <br>
  951. 出料_吸料機 OFF
  952. <input type="text" class="input-text" name="waiting_time_17" value="10" style="width:50px;">
  953. <br>
  954. * 循環次數
  955. <input type="text" class="input-text" name="waiting_loop_4" value="3" style="width:50px;">
  956. </td>
  957. <td>
  958. 請依序開啟:
  959. <br>
  960. 入_雙核泵
  961. <br>
  962. 水龍頭
  963. <br>
  964. 出 4、5_電磁閥
  965. </td>
  966. <td>
  967. 請依序開啟:
  968. <br>
  969. 入_雙核泵
  970. <br>
  971. 水龍頭
  972. <br>
  973. 出 4、5_雙核泵
  974. <br>
  975. 出 2、3_電磁閥
  976. </td>
  977. <td>
  978. <font color = "red">生豆閘門零點</font>
  979. <br>
  980. 入水口_雙核泵 ON
  981. <input type="text" class="input-text" name="waiting_time_10" value="30" style="width:50px;">
  982. <br>
  983. 出水口 4、5_雙核泵 ON
  984. <input type="text" class="input-text" name="waiting_time_11" value="30" style="width:50px;">
  985. <br>
  986. 出水口 2、3_雙核泵 ON
  987. <input type="text" class="input-text" name="waiting_time_12" value="60" style="width:50px;">
  988. <br>
  989. 真空吸料機 ON
  990. <input type="text" class="input-text" name="waiting_time_13" value="1" style="width:50px;">
  991. <br>
  992. 真空吸料機 OFF
  993. <input type="text" class="input-text" name="waiting_time_14" value="10" style="width:50px;">
  994. <br>
  995. * 循環次數
  996. <input type="text" class="input-text" name="waiting_loop_6" value="3" style="width:50px;">
  997. <br>
  998. 生豆閘門 升
  999. <br>
  1000. <input type="text" class="input-text" name="waiting_time_15" value="10" style="width:50px;">
  1001. <br>
  1002. 生豆閘門 降
  1003. <br>
  1004. 等待出豆時間
  1005. <input type="text" class="input-text" name="waiting_time_20" value="120" style="width:50px;">
  1006. <br>
  1007. 出料_吸料機 ON
  1008. <input type="text" class="input-text" name="waiting_time_18" value="1" style="width:50px;">
  1009. <br>
  1010. 出料_吸料機 OFF
  1011. <input type="text" class="input-text" name="waiting_time_19" value="10" style="width:50px;">
  1012. <br>
  1013. * 循環次數
  1014. <input type="text" class="input-text" name="waiting_loop_5" value="3" style="width:50px;">
  1015. </td>
  1016. </tr>
  1017. <tr>
  1018. <td>
  1019. <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_testing()">水路測試</button>&nbsp;
  1020. <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_testing_OFF()">水路測試 OFF</button>
  1021. <script>
  1022. function tank_WaterIn_testing() {
  1023. // 清洗第 4 層灑水 ON
  1024. tankPumpWaterInput_ON()
  1025. console.log('tank_pump_waterInput_status ON')
  1026. // 等待時間(秒)
  1027. var time1 = $("input[name=waiting_time_1]").val();
  1028. console.log('等待 ' + time1 + ' 秒')
  1029. var time = new Date();
  1030. while ((new Date() - time) < time1 * 1000) { };
  1031. // 清洗第 2 層灑水 ON
  1032. tankPumpWaterL4L5_ON()
  1033. console.log('tank_pump_waterL4L5_status ON')
  1034. // 等待時間(秒)
  1035. var time2 = $("input[name=waiting_time_2]").val();
  1036. console.log('等待 ' + time2 + ' 秒')
  1037. var time = new Date();
  1038. while ((new Date() - time) < time2 * 1000) { };
  1039. // 浮選槽注水 ON
  1040. tankPumpWaterL2L3_ON()
  1041. console.log('tank_pump_waterL2L3_status ON')
  1042. // 等待時間(秒)
  1043. var time3 = $("input[name=waiting_time_3]").val();
  1044. console.log('等待 ' + time3 + ' 秒')
  1045. var time = new Date();
  1046. while ((new Date() - time) < time3 * 1000) { };
  1047. };
  1048. </script>
  1049. <script>
  1050. function tank_WaterIn_testing_OFF(){
  1051. tankPumpWaterInput_OFF()
  1052. console.log('tankPumpWaterInput_OFF')
  1053. var time = new Date();
  1054. while ((new Date() - time) < 2 * 1000) { };
  1055. tankPumpWaterL4L5_OFF()
  1056. console.log('tankPumpWaterL4L5_OFF')
  1057. var time = new Date();
  1058. while ((new Date() - time) < 2 * 1000) { };
  1059. tankPumpWaterL2L3_OFF()
  1060. console.log('tankPumpWaterL2L3_OFF')
  1061. }
  1062. </script>
  1063. </td>
  1064. <td>
  1065. <button type="submit" class="btn btn-primary" onclick="tank_BeanInputAir_testing()">排氣下豆測試</button>
  1066. <script>
  1067. function tank_BeanInputAir_testing() {
  1068. // 循環次數
  1069. var loop3 = $("input[name=waiting_loop_3]").val();
  1070. console.log('--- 循環 ' + loop3 + ' 次 ---')
  1071. for (step = 1; step <= loop3; step++) {
  1072. // 真空吸料機 ON
  1073. tankVacuum_ON()
  1074. console.log('tankVacuum_ON')
  1075. // 吸料時間
  1076. var time8 = $("input[name=waiting_time_8]").val();
  1077. console.log('等待 ' + time8 + ' 秒')
  1078. var time = new Date();
  1079. while ((new Date() - time) < time8 * 1000) { };
  1080. // 真空吸料機 OFF
  1081. tankVacuum_OFF()
  1082. console.log('tankVacuum_OFF')
  1083. // 吸料時間
  1084. var time9 = $("input[name=waiting_time_9]").val();
  1085. console.log('等待 ' + time9 + ' 秒')
  1086. var time = new Date();
  1087. while ((new Date() - time) < time9 * 1000) { };
  1088. }
  1089. }
  1090. </script>
  1091. </td>
  1092. <td>
  1093. <button type="submit" class="btn btn-primary" onclick="tank_BeanBaffle_testing()">生豆閘門測試</button>
  1094. <script>
  1095. function tank_BeanBaffle_testing() {
  1096. // 循環次數
  1097. var loop2 = $("input[name=waiting_loop_2]").val();
  1098. console.log('--- 循環 ' + loop2 + ' 次 ---')
  1099. for (step = 1; step <= loop2; step++) {
  1100. // 生豆閘門 上升
  1101. tankSteppingMotor_UP()
  1102. console.log('tankSteppingMotor_UP')
  1103. // 上升持續時間(秒)
  1104. var time4 = $("input[name=waiting_time_4]").val();
  1105. console.log('等待 ' + time4 + ' 秒')
  1106. var time = new Date();
  1107. while ((new Date() - time) < time4 * 1000) { };
  1108. // 生豆閘門 停止
  1109. tankSteppingMotor_STOP()
  1110. console.log('tankSteppingMotor_STOP')
  1111. // 暫停時間(秒)
  1112. var time5 = $("input[name=waiting_time_5]").val();
  1113. console.log('等待 ' + time5 + ' 秒')
  1114. var time = new Date();
  1115. while ((new Date() - time) < time5 * 1000) { };
  1116. // 生豆閘門 下降
  1117. tankSteppingMotor_DOWN()
  1118. console.log('tankSteppingMotor_DOWN')
  1119. // 下降持續時間(秒)
  1120. var time6 = $("input[name=waiting_time_6]").val();
  1121. console.log('等待 ' + time6 + ' 秒')
  1122. var time = new Date();
  1123. while ((new Date() - time) < time6 * 1000) { };
  1124. // 生豆閘門 停止
  1125. tankSteppingMotor_STOP()
  1126. console.log('tankSteppingMotor_STOP')
  1127. // 暫停時間(秒)
  1128. var time7 = $("input[name=waiting_time_7]").val();
  1129. console.log('等待 ' + time7 + ' 秒')
  1130. var time = new Date();
  1131. while ((new Date() - time) < time7 * 1000) { };
  1132. }
  1133. }
  1134. </script>
  1135. </td>
  1136. <td>
  1137. <button type="submit" class="btn btn-primary" onclick="output_Bean_testing()">出料測試</button>
  1138. <script>
  1139. function output_Bean_testing(){
  1140. // 循環次數
  1141. var loop4 = $("input[name=waiting_loop_4]").val();
  1142. console.log('--- 循環 ' + loop4 + ' 次 ---')
  1143. for (step = 1; step <= loop4; step++) {
  1144. // 出料_吸料機 ON
  1145. outputVacuum_ON()
  1146. console.log('outputVacuum_ON')
  1147. // 吸料時間
  1148. var time16 = $("input[name=waiting_time_16]").val();
  1149. console.log('等待 ' + time16 + ' 秒')
  1150. var time = new Date();
  1151. while ((new Date() - time) < time16 * 1000) { };
  1152. // 出料_吸料機 OFF
  1153. outputVacuum_OFF()
  1154. console.log('outputVacuum_OFF')
  1155. // 放料時間
  1156. var time17 = $("input[name=waiting_time_17]").val();
  1157. console.log('等待 ' + time17 + ' 秒')
  1158. var time = new Date();
  1159. while ((new Date() - time) < time17 * 1000) { };
  1160. };
  1161. };
  1162. </script>
  1163. </td>
  1164. <td>
  1165. <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL4L5_testing()">出 4、5 閥逆洗</button>
  1166. <br>
  1167. <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL4L5_testing_OFF()">出 4、5 閥逆洗 OFF</button>
  1168. <script>
  1169. function tank_SolenoidWaterL4L5_testing(){
  1170. // 入水口_雙核泵 ON
  1171. tankPumpWaterInput_ON()
  1172. console.log('tankPumpWaterInput_ON')
  1173. // 水龍頭 ON
  1174. var time = new Date();
  1175. while ((new Date() - time) < 3 * 1000) { };
  1176. // 出水口 4、5_電磁閥 ON
  1177. tankSolenoidWaterL4L5_ON()
  1178. console.log('tankSolenoidWaterL4L5_ON')
  1179. };
  1180. function tank_SolenoidWaterL4L5_testing_OFF(){
  1181. // 出水口 4、5_電磁閥 OFF
  1182. tankSolenoidWaterL4L5_OFF()
  1183. console.log('tankSolenoidWaterL4L5_OFF')
  1184. // 水龍頭 OFF
  1185. var time = new Date();
  1186. while ((new Date() - time) < 3 * 1000) { };
  1187. // 入水口_雙核泵 OFF
  1188. tankPumpWaterInput_OFF()
  1189. console.log('tankPumpWaterInput_OFF')
  1190. };
  1191. </script>
  1192. </td>
  1193. <td>
  1194. <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL2L3_testing()">出 2、3 閥逆洗</button>
  1195. <br>
  1196. <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL2L3_testing_OFF()">出 2、3 閥逆洗 OFF</button>
  1197. <script>
  1198. function tank_SolenoidWaterL2L3_testing(){
  1199. // 入水口_雙核泵 ON
  1200. tankPumpWaterInput_ON()
  1201. console.log('tankPumpWaterInput_ON')
  1202. // 水龍頭 ON
  1203. var time = new Date();
  1204. while ((new Date() - time) < 3 * 1000) { };
  1205. // 出水口 4、5_雙核泵 ON
  1206. tankPumpWaterL4L5_ON()
  1207. console.log('tankPumpWaterL4L5_ON')
  1208. // 出水口 2、3_電磁閥 ON
  1209. tankSolenoidWaterL2L3_ON()
  1210. console.log('tankSolenoidWaterL2L3_ON')
  1211. };
  1212. function tank_SolenoidWaterL2L3_testing_OFF(){
  1213. // 出水口 2、3_電磁閥 OFF
  1214. tankSolenoidWaterL2L3_OFF()
  1215. console.log('tankSolenoidWaterL2L3_OFF')
  1216. // 出水口 4、5_雙核泵 OFF
  1217. tankPumpWaterL4L5_OFF()
  1218. console.log('tankPumpWaterL4L5_OFF')
  1219. // 水龍頭 OFF
  1220. var time = new Date();
  1221. while ((new Date() - time) < 3 * 1000) { };
  1222. // 入水口_雙核泵 OFF
  1223. tankPumpWaterInput_OFF()
  1224. console.log('tankPumpWaterInput_OFF')
  1225. };
  1226. </script>
  1227. </td>
  1228. <td>
  1229. <button type="submit" class="btn btn-primary" onclick="tank_CleanWash_testing()">清洗浮選連動測試</button>
  1230. <script>
  1231. function tank_CleanWash_testing(){
  1232. // 生豆閘門 DOWN
  1233. // tankSteppingMotor_DOWNSTOP()
  1234. // console.log('tankSteppingMotor_DOWN')
  1235. //入水口_雙核泵 ON
  1236. tankPumpWaterInput_ON()
  1237. console.log('tankPumpWaterInput_ON')
  1238. //入水口_雙核泵 ON 等待時間
  1239. var time10 = $("input[name=waiting_time_10]").val();
  1240. console.log('等待 ' + time10 + ' 秒')
  1241. var time = new Date();
  1242. while ((new Date() - time) < time10 * 1000) { };
  1243. //出水口 4、5_雙核泵 ON
  1244. tankPumpWaterL4L5_ON()
  1245. console.log('tankPumpWaterL4L5_ON')
  1246. //出水口 4、5_雙核泵 ON 等待時間
  1247. var time11 = $("input[name=waiting_time_11]").val();
  1248. console.log('等待 ' + time11 + ' 秒')
  1249. var time = new Date();
  1250. while ((new Date() - time) < time11 * 1000) { };
  1251. //出水口 2、3_雙核泵 ON
  1252. tankPumpWaterL2L3_ON()
  1253. console.log('tankPumpWaterL2L3_ON')
  1254. //出水口 2、3_雙核泵 ON 等待時間
  1255. var time12 = $("input[name=waiting_time_12]").val();
  1256. console.log('等待 ' + time12 + ' 秒')
  1257. var time = new Date();
  1258. while ((new Date() - time) < time12 * 1000) { };
  1259. //* 循環次數
  1260. var loop6 = $("input[name=waiting_loop_6]").val();
  1261. console.log('--- 循環 ' + loop6 + ' 次 ---')
  1262. for (step = 1; step <= loop6; step++) {
  1263. // 真空吸料機 ON
  1264. tankVacuum_ON()
  1265. console.log('tankVacuum_ON')
  1266. // 吸料時間
  1267. var time13 = $("input[name=waiting_time_13]").val();
  1268. console.log('等待 ' + time13 + ' 秒')
  1269. var time = new Date();
  1270. while ((new Date() - time) < time13 * 1000) { };
  1271. // 真空吸料機 OFF
  1272. tankVacuum_OFF()
  1273. console.log('tankVacuum_OFF')
  1274. // 吸料時間
  1275. var time14 = $("input[name=waiting_time_14]").val();
  1276. console.log('等待 ' + time14 + ' 秒')
  1277. var time = new Date();
  1278. while ((new Date() - time) < time14 * 1000) { };
  1279. };
  1280. // 生豆閘門 UP
  1281. tankSteppingMotor_UP()
  1282. console.log('tankSteppingMotor_UP')
  1283. var time = new Date();
  1284. while ((new Date() - time) < 3 * 1000) { };
  1285. tankSteppingMotor_STOP()
  1286. console.log('tankSteppingMotor_STOP')
  1287. // 閘門開啟時間
  1288. var time15 = $("input[name=waiting_time_15]").val();
  1289. console.log('等待 ' + time15 + ' 秒')
  1290. var time = new Date();
  1291. while ((new Date() - time) < time15 * 1000) { };
  1292. // 生豆閘門 DOWN
  1293. tankSteppingMotor_DOWN()
  1294. console.log('tankSteppingMotor_DOWN')
  1295. var time = new Date();
  1296. while ((new Date() - time) < 3 * 1000) { };
  1297. tankSteppingMotor_STOP()
  1298. console.log('tankSteppingMotor_STOP')
  1299. var time20 = $("input[name=waiting_time_20]").val();
  1300. console.log('等待 ' + time20 + ' 秒')
  1301. var time = new Date();
  1302. while ((new Date() - time) < time20 * 1000) { };
  1303. // 循環次數
  1304. var loop5 = $("input[name=waiting_loop_5]").val();
  1305. console.log('--- 循環 ' + loop5 + ' 次 ---')
  1306. for (step = 1; step <= loop5; step++) {
  1307. // 出料_吸料機 ON
  1308. outputVacuum_ON()
  1309. console.log('outputVacuum_ON')
  1310. // 吸料時間
  1311. var time18 = $("input[name=waiting_time_18]").val();
  1312. console.log('等待 ' + time18 + ' 秒')
  1313. var time = new Date();
  1314. while ((new Date() - time) < time18 * 1000) { };
  1315. // 出料_吸料機 OFF
  1316. outputVacuum_OFF()
  1317. console.log('outputVacuum_OFF')
  1318. // 放料時間
  1319. var time19 = $("input[name=waiting_time_19]").val();
  1320. console.log('等待 ' + time19 + ' 秒')
  1321. var time = new Date();
  1322. while ((new Date() - time) < time19 * 1000) { };
  1323. };
  1324. };
  1325. </script>
  1326. <button type="submit" class="btn btn-primary" onclick="tank_CleanWash_OFF_testing()">清洗浮選出入水 OFF</button>
  1327. <script>
  1328. function tank_CleanWash_OFF_testing(){
  1329. //入水口_雙核泵 OFF
  1330. tankPumpWaterInput_OFF()
  1331. console.log('tankPumpWaterInput_OFF')
  1332. var time = new Date();
  1333. while ((new Date() - time) < 1 * 1000) { };
  1334. //出水口 4、5_雙核泵 OFF
  1335. tankPumpWaterL4L5_OFF()
  1336. console.log('tankPumpWaterL4L5_OFF')
  1337. var time = new Date();
  1338. while ((new Date() - time) < 1 * 1000) { };
  1339. //出水口 2、3_雙核泵 OFF
  1340. tankPumpWaterL2L3_OFF()
  1341. console.log('tankPumpWaterL2L3_OFF')
  1342. };
  1343. </script>
  1344. </td>
  1345. </tr>
  1346. </table>
  1347. <br>
  1348. <div style="text-align: center;">
  1349. 狀態更新時間(秒):
  1350. <input class="input-text" name="webupdate_time" value="5" style="width:100px;">
  1351. <input type="button" class="input-button" value="設定更新時間" onclick="changeUpdate()">
  1352. <script language="JavaScript">
  1353. function changeUpdate() {
  1354. clearInterval(WebUpdate_set);
  1355. var webupdate_time = $("input[name=webupdate_time]").val()
  1356. console.log('webupdate_time' + webupdate_time)
  1357. WebUpdate_set = setTimeout(function(){WebUpdate(ctn)} , webupdate_time * 1000);
  1358. }
  1359. // jQuery 更新感測器制動器狀態
  1360. function WebUpdate(ctn) {
  1361. $.get('/loading/C' + ctn, '', function (res) {
  1362. if (res.tank_vacuum == 0) {
  1363. $("#cmn-toggle-05").prop('checked', false);
  1364. } else if (res.tank_vacuum == 1) {
  1365. $("#cmn-toggle-05").prop('checked', true);
  1366. }
  1367. if (res.tank_pump_waterFloat == 0) {
  1368. $("#cmn-toggle-08").prop('checked', false);
  1369. } else if (res.tank_pump_waterFloat == 1) {
  1370. $("#cmn-toggle-08").prop('checked', true);
  1371. }
  1372. if (res.tank_pump_waterL4L5 == 0) {
  1373. $("#cmn-toggle-11").prop('checked', false);
  1374. } else if (res.tank_pump_waterL4L5 == 1) {
  1375. $("#cmn-toggle-11").prop('checked', true);
  1376. }
  1377. if (res.tank_pump_waterInput == 0) {
  1378. $("#cmn-toggle-14").prop('checked', false);
  1379. } else if (res.tank_pump_waterInput == 1) {
  1380. $("#cmn-toggle-14").prop('checked', true);
  1381. }
  1382. if (res.tank_solenoid_waterL2L3 == 0) {
  1383. $("#cmn-toggle-17").prop('checked', false);
  1384. } else if (res.tank_solenoid_waterL2L3 == 1) {
  1385. $("#cmn-toggle-17").prop('checked', true);
  1386. }
  1387. if (res.tank_solenoid_waterL4L5 == 0) {
  1388. $("#cmn-toggle-20").prop('checked', false);
  1389. } else if (res.tank_solenoid_waterL4L5 == 1) {
  1390. $("#cmn-toggle-20").prop('checked', true);
  1391. }
  1392. if (res.tank_stepping_motor == 0) {
  1393. $("#cmn-toggle-23").prop('checked', false);
  1394. } else if (res.tank_stepping_motor == 1) {
  1395. $("#cmn-toggle-23").prop('checked', true);
  1396. }
  1397. $("#tank_stepping_motor_t_status").text(res.tank_stepping_motor);
  1398. $("#UltraSonic_t_status").text(res.UltraSonic);
  1399. setTimeout(function(){WebUpdate(ctn)}, 5 * 1000);
  1400. }, 'json');
  1401. }
  1402. </script>
  1403. </div>
  1404. <br>
  1405. <br>
  1406. <div id="coffee_footer">
  1407. <!-- 匯入共同使用的 footer.html 內容 -->
  1408. {% include 'footer.html' %}
  1409. </div>
  1410. </div>
  1411. </body>
  1412. </html>