ferment_container.html 136 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998
  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="300" /><!-- <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. <style>
  19. .footer{
  20. position: absolute;
  21. width: 100%;
  22. background-color: #eee;
  23. text-align: center;
  24. }
  25. body {
  26. margin: 0;
  27. }
  28. input[type="button"] {
  29. padding: 4px 15px;
  30. background: #f3f3f3;
  31. border: 0 none;
  32. cursor: pointer;
  33. -webkit-border-radius: 5px;
  34. border-radius: 5px;
  35. }
  36. .navbar-dark .navbar-nav .nav-link {
  37. color: white;
  38. cursor: pointer;
  39. text-decoration: none;
  40. width: 110px;
  41. height: 46px;
  42. }
  43. .nav-top {
  44. line-height: 40px;
  45. background-color: #C4C4C4;
  46. }
  47. .website_title {
  48. font-family: Roboto;
  49. font-style: normal;
  50. font-weight: normal;
  51. font-size: 30px;
  52. color: #000000;
  53. }
  54. .navbar-nav>li {
  55. float: none;
  56. display: inline-block;
  57. width: 70px;
  58. margin: 0 auto;
  59. text-align: center;
  60. }
  61. .navbar-nav>li a {
  62. font-size: 20px;
  63. }
  64. .main-page {
  65. margin-top: 200px;
  66. }
  67. .page-title {
  68. font-family: Roboto;
  69. font-style: normal;
  70. font-weight: bold;
  71. font-size: 36px;
  72. }
  73. .flex {
  74. display: flex;
  75. flex-direction: row;
  76. flex-wrap: wrap;
  77. justify-content: center;
  78. }
  79. .set-link {
  80. display: inline-block;
  81. width: 350px;
  82. height: 70px;
  83. line-height: 70px;
  84. background: #008CBA;
  85. border: 1px solid #CFCFCF;
  86. box-sizing: border-box;
  87. color: #FFFFFF;
  88. border-radius: 10px;
  89. font-size: 36px;
  90. }
  91. .cmn-toggle {
  92. position: absolute;
  93. margin-left: 0px;
  94. visibility: hidden;
  95. }
  96. .cmn-toggle+label {
  97. display: block;
  98. position: relative;
  99. cursor: pointer;
  100. outline: none;
  101. user-select: none;
  102. }
  103. input.cmn-toggle-round-flat+label {
  104. padding: 2px;
  105. width: 60px;
  106. height: 30px;
  107. background-color: #C0C0C0;
  108. border-radius: 60px;
  109. transition: background 0.4s;
  110. }
  111. input.cmn-toggle-round-flat+label:before,
  112. input.cmn-toggle-round-flat+label:after {
  113. display: block;
  114. position: absolute;
  115. content: "";
  116. }
  117. input.cmn-toggle-round-flat+label:before {
  118. top: 2px;
  119. left: 2px;
  120. bottom: 2px;
  121. right: 2px;
  122. background-color: #fff;
  123. border-radius: 60px;
  124. transition: background 0.4s;
  125. }
  126. input.cmn-toggle-round-flat+label:after {
  127. top: 4px;
  128. left: 4px;
  129. bottom: 4px;
  130. width: 24px;
  131. background-color: #dddddd;
  132. border-radius: 52px;
  133. transition: margin 0.4s, background 0.4s;
  134. }
  135. input.cmn-toggle-round-flat:checked+label {
  136. background-color: #C0C0C0;
  137. }
  138. input.cmn-toggle-round-flat:checked+label:after {
  139. margin-left: 27px;
  140. background-color: #008CBA;
  141. }
  142. @media(max-width:373px) {
  143. .card {
  144. margin-right: 0px;
  145. }
  146. .set-link {
  147. width: 250px;
  148. }
  149. }
  150. @media(max-width:577px) {}
  151. @media(min-width:576px) {}
  152. @media(min-width:768px) {
  153. .navbar-nav>li {
  154. margin-left: 0px;
  155. }
  156. .navbar-nav .li-block {
  157. display: none;
  158. }
  159. }
  160. @media(min-width:991px) {
  161. .navbar-nav>li {
  162. margin-left: 20px;
  163. }
  164. .navbar-nav .li-block {
  165. display: none;
  166. }
  167. }
  168. @media(min-width:1200px) {
  169. .navbar-nav>li {
  170. margin-left: 50px;
  171. }
  172. .navbar-nav .li-block {
  173. display: inline-block;
  174. width: 70px;
  175. }
  176. }
  177. @media(min-width:1400px) {
  178. .navbar-nav .li-block {
  179. display: inline-block;
  180. width: 200px;
  181. }
  182. }
  183. @media(min-width:1689px) {
  184. .navbar-nav>li {
  185. margin-left: 50px;
  186. }
  187. .navbar-nav .li-block {
  188. display: inline-block;
  189. width: 500px;
  190. }
  191. }
  192. </style>
  193. <script language="JavaScript">
  194. // 指定 10秒 刷新網頁一次
  195. var ftid = '{{tid}}';
  196. console.log('ftid:' + ftid)
  197. $(function(){
  198. $("#ferment_tank_page").text('發酵槽 F' + ftid + ' 攝影機畫面 ')
  199. $('#ferment_tank_page').attr("href", "/camera_F" + ftid)
  200. $("#ferment_container_title").text('發酵槽 F' + ftid + ' 操作介面')
  201. });
  202. // WebUpdate_set = setInterval(function(){WebUpdate(ftid)} , 60 * 1000)
  203. var WebUpdate_set
  204. </script>
  205. <script>
  206. // 發酵槽_制動器控制
  207. var tank_num = '{{tid}}';
  208. function inputVacuum() {
  209. var status = "off";
  210. var check = $("input[name=input_vacuum_status]:checked"); // 這裡面是 jQuery 撈取資料的方法, jQuery 常使用到 $ 錢字號
  211. console.log('check:', check);
  212. //大於0代表有被選中, 如果有多個可以呈現勾取的項目數量
  213. if (check.length > 0) {
  214. status = "on";
  215. $("#cmn-toggle-02").prop('checked', false); // 確認是否勾選
  216. if (!confirm("你確定要開啟入料儲豆槽真空吸料機嗎?")) {
  217. return false;
  218. };
  219. } else {
  220. $("#cmn-toggle-02").prop('checked', true);
  221. if (!confirm("你確定要關閉入料儲豆槽真空吸料機嗎?")) {
  222. return false;
  223. };
  224. };
  225. var data = { "tank_num": "F" + tank_num, "command": "input_vacuum_status", "value": status };
  226. // jquery 請求 '/mqtt/{{tid}}' 頁面
  227. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  228. console.log('data:', data)
  229. if (res == 'on') {
  230. $("#cmn-toggle-02").prop('checked', true);
  231. setTimeout("alert('入料儲豆槽真空吸料機_開啟成功!')", 500);
  232. } else if (res == 'off') {
  233. $("#cmn-toggle-02").prop('checked', false);
  234. setTimeout("alert('入料儲豆槽真空吸料機_關閉成功!')", 500);
  235. } else {
  236. alert(res);
  237. };
  238. }, 'text')
  239. // setTimeout(function () { location.reload(); }, 500);
  240. };
  241. function inputVacuum_ON() {
  242. var data = { "tank_num": "F" + tank_num, "command": "input_vacuum_status", "value": "on" };
  243. // jquery 請求 '/mqtt/{{tid}}' 頁面
  244. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  245. console.log('data:', data)
  246. if (res == 'on') {
  247. $("#cmn-toggle-02").prop('checked', true);
  248. } else if (res == 'off') {
  249. $("#cmn-toggle-02").prop('checked', false);
  250. } else {
  251. };
  252. }, 'text')
  253. // setTimeout(function () { location.reload(); }, 500);
  254. };
  255. function inputVacuum_OFF() {
  256. var data = { "tank_num": "F" + tank_num, "command": "input_vacuum_status", "value": "off" };
  257. // jquery 請求 '/mqtt/{{tid}}' 頁面
  258. $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
  259. console.log('data:', data)
  260. if (res == 'on') {
  261. $("#cmn-toggle-02").prop('checked', true);
  262. } else if (res == 'off') {
  263. $("#cmn-toggle-02").prop('checked', false);
  264. } else {
  265. };
  266. }, 'text')
  267. // setTimeout(function () { location.reload(); }, 500);
  268. };
  269. function tankVacuum() {
  270. var status = "off";
  271. var check = $("input[name=tank_vacuum_status]:checked");
  272. console.log('check:', check);
  273. //大於0代表有被選中
  274. if (check.length > 0) {
  275. status = "on";
  276. $("#cmn-toggle-05").prop('checked', false);
  277. if (!confirm("你確定要開啟真空吸料機嗎?")) {
  278. return false;
  279. };
  280. } else {
  281. $("#cmn-toggle-05").prop('checked', true);
  282. if (!confirm("你確定要關閉真空吸料機嗎?")) {
  283. return false;
  284. };
  285. };
  286. var data = { "tank_num": "F" + tank_num, "command": "tank_vacuum_status", "value": status };
  287. $.post('/mqtt/{{tid}}', data, function (res) {
  288. console.log('data:', data)
  289. if (res == 'on') {
  290. $("#cmn-toggle-05").prop('checked', true);
  291. setTimeout("alert('真空吸料機_開啟成功!')", 500);
  292. } else if (res == 'off') {
  293. $("#cmn-toggle-05").prop('checked', false);
  294. setTimeout("alert('真空吸料機_關閉成功!')", 500);
  295. } else {
  296. alert(res);
  297. };
  298. }, 'text')
  299. // setTimeout(function () { location.reload(); }, 500);
  300. };
  301. function tankVacuum_ON() {
  302. var data = { "tank_num": "F" + tank_num, "command": "tank_vacuum_status", "value": "on" };
  303. $.post('/mqtt/{{tid}}', data, function (res) {
  304. console.log('data:', data)
  305. if (res == 'on') {
  306. $("#cmn-toggle-05").prop('checked', true);
  307. } else if (res == 'off') {
  308. $("#cmn-toggle-05").prop('checked', false);
  309. } else {
  310. };
  311. }, 'text')
  312. // setTimeout(function () { location.reload(); }, 500);
  313. };
  314. function tankVacuum_OFF() {
  315. var data = { "tank_num": "F" + tank_num, "command": "tank_vacuum_status", "value": "off" };
  316. $.post('/mqtt/{{tid}}', data, function (res) {
  317. console.log('data:', data)
  318. if (res == 'on') {
  319. $("#cmn-toggle-05").prop('checked', true);
  320. } else if (res == 'off') {
  321. $("#cmn-toggle-05").prop('checked', false);
  322. } else {
  323. };
  324. }, 'text')
  325. // setTimeout(function () { location.reload(); }, 500);
  326. };
  327. // Benson 真空吸料機 (END)
  328. function tankThreeWayValveInput() {
  329. //<!--setInterval(Relay,10000);-->
  330. var status = "off";
  331. var check = $("input[name=tank_threewayvalve_input_status]:checked");
  332. //大於0代表有被選中
  333. if (check.length > 0) {
  334. status = "on";
  335. $("#cmn-toggle-08").prop('checked', false);
  336. if (!confirm("你確定要開啟入料三通閥嗎?")) {
  337. return false;
  338. };
  339. } else {
  340. $("#cmn-toggle-08").prop('checked', true);
  341. if (!confirm("你確定要關閉入料三通閥嗎?")) {
  342. return false;
  343. };
  344. };
  345. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_input_status", "value": status };
  346. $.post('/mqtt/{{tid}}', data, function (res) {
  347. console.log('data:', data)
  348. if (res == 'on') {
  349. $("#cmn-toggle-08").prop('checked', true);
  350. setTimeout("alert('入料三通閥入料_開啟成功!')", 500);
  351. } else if (res == 'off') {
  352. $("#cmn-toggle-08").prop('checked', false);
  353. setTimeout("alert('入料三通閥排氣_關閉成功!')", 500);
  354. } else {
  355. alert(res);
  356. };
  357. }, 'text')
  358. // setTimeout(function () { location.reload(); }, 500);
  359. };
  360. function tankThreeWayValveInput_ON() {
  361. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_input_status", "value": "on" };
  362. $.post('/mqtt/{{tid}}', data, function (res) {
  363. console.log('data:', data)
  364. if (res == 'on') {
  365. $("#cmn-toggle-08").prop('checked', true);
  366. } else if (res == 'off') {
  367. $("#cmn-toggle-08").prop('checked', false);
  368. } else {
  369. };
  370. }, 'text')
  371. // setTimeout(function () { location.reload(); }, 500);
  372. };
  373. function tankThreeWayValveInput_OFF() {
  374. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_input_status", "value": "off" };
  375. $.post('/mqtt/{{tid}}', data, function (res) {
  376. console.log('data:', data)
  377. if (res == 'on') {
  378. $("#cmn-toggle-08").prop('checked', true);
  379. } else if (res == 'off') {
  380. $("#cmn-toggle-08").prop('checked', false);
  381. } else {
  382. };
  383. }, 'text')
  384. // setTimeout(function () { location.reload(); }, 500);
  385. };
  386. // Benson cargo2_actuator.html 控制蝴蝶閥函數 (START)
  387. function tankDiskValve() {
  388. //<!--setInterval(Relay,10000);-->
  389. var status = "off";
  390. var check = $("input[name=tank_diskvalve_status]:checked");
  391. //大於0代表有被選中
  392. if (check.length > 0) {
  393. status = "on";
  394. $("#cmn-toggle-11").prop('checked', false);
  395. if (!confirm("你確定要開啟蝴蝶閥嗎?")) {
  396. return false;
  397. };
  398. } else {
  399. $("#cmn-toggle-11").prop('checked', true);
  400. if (!confirm("你確定要關閉蝴蝶閥嗎?")) {
  401. return false;
  402. };
  403. };
  404. var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": status };
  405. $.post('/mqtt/{{tid}}', data, function (res) {
  406. console.log('data:', data)
  407. if (res == 'on') {
  408. $("#cmn-toggle-11").prop('checked', true);
  409. setTimeout("alert('蝴蝶閥_開啟成功!')", 500);
  410. } else if (res == 'off') {
  411. $("#cmn-toggle-11").prop('checked', false);
  412. setTimeout("alert('蝴蝶閥_關閉成功!')", 500);
  413. } else {
  414. alert(res);
  415. };
  416. }, 'text')
  417. // setTimeout(function () { location.reload(); }, 500);
  418. };
  419. function tankDiskValve_ON() {
  420. var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "on" };
  421. $.post('/mqtt/{{tid}}', data, function (res) {
  422. console.log('data:', data)
  423. if (res == 'on') {
  424. $("#cmn-toggle-11").prop('checked', true);
  425. } else if (res == 'off') {
  426. $("#cmn-toggle-11").prop('checked', false);
  427. } else {
  428. };
  429. }, 'text')
  430. // setTimeout(function () { location.reload(); }, 500);
  431. };
  432. function tankDiskValve_OFF() {
  433. var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "off" };
  434. $.post('/mqtt/{{tid}}', data, function (res) {
  435. console.log('data:', data)
  436. if (res == 'on') {
  437. $("#cmn-toggle-11").prop('checked', true);
  438. } else if (res == 'off') {
  439. $("#cmn-toggle-11").prop('checked', false);
  440. } else {
  441. };
  442. }, 'text')
  443. // setTimeout(function () { location.reload(); }, 500);
  444. };
  445. // Benson cargo2_actuator.html 閥 (START) 電磁閥 總進水
  446. function tankSolenoidWaterTotal() {
  447. var status = "off";
  448. var check = $("input[name=tank_solenoid_water_total_status]:checked");
  449. //大於0代表有被選中
  450. if (check.length > 0) {
  451. status = "on";
  452. $("#cmn-toggle-14").prop('checked', false);
  453. if (!confirm("你確定要開啟總進水電磁閥嗎?")) {
  454. return false;
  455. };
  456. } else {
  457. $("#cmn-toggle-14").prop('checked', true);
  458. if (!confirm("你確定要關閉總進水電磁閥嗎?")) {
  459. return false;
  460. };
  461. };
  462. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_total_status", "value": status };
  463. $.post('/mqtt/{{tid}}', data, function (res) {
  464. console.log('data:', data)
  465. if (res == 'on') {
  466. $("#cmn-toggle-14").prop('checked', true);
  467. setTimeout("alert('總進水電磁閥_開啟成功!')", 500);
  468. } else if (res == 'off') {
  469. $("#cmn-toggle-14").prop('checked', false);
  470. setTimeout("alert('總進水電磁閥_關閉成功!')", 500);
  471. } else {
  472. alert(res);
  473. };
  474. }, 'text')
  475. // setTimeout(function () { location.reload(); }, 500);
  476. };
  477. function tankSolenoidWaterTotal_ON() {
  478. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_total_status", "value": "on" };
  479. $.post('/mqtt/{{tid}}', data, function (res) {
  480. console.log('data:', data)
  481. if (res == 'on') {
  482. $("#cmn-toggle-14").prop('checked', true);
  483. } else if (res == 'off') {
  484. $("#cmn-toggle-14").prop('checked', false);
  485. } else {
  486. };
  487. }, 'text')
  488. // setTimeout(function () { location.reload(); }, 500);
  489. };
  490. function tankSolenoidWaterTotal_OFF() {
  491. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_total_status", "value": "off" };
  492. $.post('/mqtt/{{tid}}', data, function (res) {
  493. console.log('data:', data)
  494. if (res == 'on') {
  495. $("#cmn-toggle-14").prop('checked', true);
  496. } else if (res == 'off') {
  497. $("#cmn-toggle-14").prop('checked', false);
  498. } else {
  499. };
  500. }, 'text')
  501. // setTimeout(function () { location.reload(); }, 500);
  502. };
  503. // Benson cargo2_actuator.html 閥 (START) 電磁閥消毒打菌
  504. function tankSolenoidDisinfect() {
  505. var status = "off";
  506. var check = $("input[name=tank_solenoid_disinfect_status]:checked");
  507. //大於0代表有被選中
  508. if (check.length > 0) {
  509. status = "on";
  510. $("#cmn-toggle-17").prop('checked', false);
  511. if (!confirm("你確定要開啟消毒電磁閥嗎?")) {
  512. return false;
  513. };
  514. } else {
  515. $("#cmn-toggle-17").prop('checked', true);
  516. if (!confirm("你確定要關閉消毒電磁閥嗎?")) {
  517. return false;
  518. };
  519. };
  520. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_disinfect_status", "value": status };
  521. $.post('/mqtt/{{tid}}', data, function (res) {
  522. console.log('data:', data)
  523. if (res == 'on') {
  524. $("#cmn-toggle-17").prop('checked', true);
  525. setTimeout("alert('消毒電磁閥_開啟成功!')", 500);
  526. } else if (res == 'off') {
  527. $("#cmn-toggle-17").prop('checked', false);
  528. setTimeout("alert('消毒電磁閥_關閉成功!')", 500);
  529. } else {
  530. alert(res);
  531. };
  532. }, 'text')
  533. // setTimeout(function () { location.reload(); }, 500);
  534. };
  535. function tankSolenoidDisinfect_ON() {
  536. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "on" };
  537. $.post('/mqtt/{{tid}}', data, function (res) {
  538. console.log('data:', data)
  539. if (res == 'on') {
  540. $("#cmn-toggle-17").prop('checked', true);
  541. } else if (res == 'off') {
  542. $("#cmn-toggle-17").prop('checked', false);
  543. } else {
  544. };
  545. }, 'text')
  546. // setTimeout(function () { location.reload(); }, 500);
  547. };
  548. function tankSolenoidDisinfect_OFF() {
  549. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "off" };
  550. $.post('/mqtt/{{tid}}', data, function (res) {
  551. console.log('data:', data)
  552. if (res == 'on') {
  553. $("#cmn-toggle-17").prop('checked', true);
  554. } else if (res == 'off') {
  555. $("#cmn-toggle-17").prop('checked', false);
  556. } else {
  557. };
  558. }, 'text')
  559. // setTimeout(function () { location.reload(); }, 500);
  560. };
  561. // 電磁閥 保溫夾層加水
  562. function outerSolenoidWater() {
  563. var status = "off";
  564. var check = $("input[name=outer_solenoid_water_status]:checked");
  565. //大於0代表有被選中
  566. if (check.length > 0) {
  567. status = "on";
  568. $("#cmn-toggle-38").prop('checked', false);
  569. if (!confirm("你確定要開啟\"保溫夾層\"進水電磁閥嗎?")) {
  570. return false;
  571. };
  572. } else {
  573. $("#cmn-toggle-38").prop('checked', true);
  574. if (!confirm("你確定要關閉\"保溫夾層\"進水電磁閥嗎?")) {
  575. return false;
  576. };
  577. };
  578. var data = { "tank_num": "F" + tank_num, "command": "outer_solenoid_water_status", "value": status };
  579. $.post('/mqtt/{{tid}}', data, function (res) {
  580. console.log('data:', data)
  581. if (res == 'on') {
  582. $("#cmn-toggle-38").prop('checked', true);
  583. setTimeout("alert('\"保溫夾層\"進水電磁閥_開啟成功!')", 500);
  584. } else if (res == 'off') {
  585. $("#cmn-toggle-38").prop('checked', false);
  586. setTimeout("alert('\"保溫夾層\"進水電磁閥_關閉成功!')", 500);
  587. } else {
  588. alert(res);
  589. };
  590. }, 'text')
  591. // setTimeout(function () { location.reload(); }, 500);
  592. };
  593. function outerSolenoidWater_ON() {
  594. var data = { "tank_num": "F" + tank_num, "command": "outer_solenoid_water_status", "value": "on" };
  595. $.post('/mqtt/{{tid}}', data, function (res) {
  596. console.log('data:', data)
  597. if (res == 'on') {
  598. $("#cmn-toggle-38").prop('checked', true);
  599. } else if (res == 'off') {
  600. $("#cmn-toggle-38").prop('checked', false);
  601. } else {
  602. };
  603. }, 'text')
  604. // setTimeout(function () { location.reload(); }, 500);
  605. };
  606. function outerSolenoidWater_OFF() {
  607. var data = { "tank_num": "F" + tank_num, "command": "outer_solenoid_water_status", "value": "off" };
  608. $.post('/mqtt/{{tid}}', data, function (res) {
  609. console.log('data:', data)
  610. if (res == 'on') {
  611. $("#cmn-toggle-38").prop('checked', true);
  612. } else if (res == 'off') {
  613. $("#cmn-toggle-38").prop('checked', false);
  614. } else {
  615. };
  616. }, 'text')
  617. // setTimeout(function () { location.reload(); }, 500);
  618. };
  619. // 電磁閥 桶內加水
  620. function tankSolenoidWaterIn() {
  621. var status = "off";
  622. var check = $("input[name=tank_solenoid_water_in_status]:checked");
  623. //大於0代表有被選中
  624. if (check.length > 0) {
  625. status = "on";
  626. $("#cmn-toggle-50").prop('checked', false);
  627. if (!confirm("你確定要開啟\"桶內\"進水電磁閥嗎?")) {
  628. return false;
  629. };
  630. } else {
  631. $("#cmn-toggle-50").prop('checked', true);
  632. if (!confirm("你確定要關閉\"桶內\"進水電磁閥嗎?")) {
  633. return false;
  634. };
  635. };
  636. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_in_status", "value": status };
  637. $.post('/mqtt/{{tid}}', data, function (res) {
  638. console.log('data:', data)
  639. if (res == 'on') {
  640. $("#cmn-toggle-50").prop('checked', true);
  641. setTimeout("alert('\"桶內\"進水電磁閥_開啟成功!')", 500);
  642. } else if (res == 'off') {
  643. $("#cmn-toggle-50").prop('checked', false);
  644. setTimeout("alert('\"桶內\"進水電磁閥_關閉成功!')", 500);
  645. } else {
  646. alert(res);
  647. };
  648. }, 'text')
  649. // setTimeout(function () { location.reload(); }, 500);
  650. };
  651. function tankSolenoidWaterIn_ON() {
  652. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_in_status", "value": "on" };
  653. $.post('/mqtt/{{tid}}', data, function (res) {
  654. console.log('data:', data)
  655. if (res == 'on') {
  656. $("#cmn-toggle-50").prop('checked', true);
  657. } else if (res == 'off') {
  658. $("#cmn-toggle-50").prop('checked', false);
  659. } else {
  660. };
  661. }, 'text')
  662. // setTimeout(function () { location.reload(); }, 500);
  663. };
  664. function tankSolenoidWaterIn_OFF() {
  665. var data = { "tank_num": "F" + tank_num, "command": "tank_solenoid_water_in_status", "value": "off" };
  666. $.post('/mqtt/{{tid}}', data, function (res) {
  667. console.log('data:', data)
  668. if (res == 'on') {
  669. $("#cmn-toggle-50").prop('checked', true);
  670. } else if (res == 'off') {
  671. $("#cmn-toggle-50").prop('checked', false);
  672. } else {
  673. };
  674. }, 'text')
  675. // setTimeout(function () { location.reload(); }, 500);
  676. };
  677. // 感測器用 pump 雙核隔膜泵
  678. function tankPumpSensor() {
  679. var status = "off";
  680. var check = $("input[name=tank_pump_sensor_status]:checked");
  681. //大於0代表有被選中
  682. if (check.length > 0) {
  683. status = "on";
  684. $("#cmn-toggle-41").prop('checked', false);
  685. if (!confirm("你確定要開啟感測器用 pump 雙核隔膜泵嗎?")) {
  686. return false;
  687. };
  688. } else {
  689. $("#cmn-toggle-41").prop('checked', true);
  690. if (!confirm("你確定要關閉感測器用 pump 雙核隔膜泵嗎?")) {
  691. return false;
  692. };
  693. };
  694. var data = { "tank_num": "F" + tank_num, "command": "tank_pump_sensor_status", "value": status };
  695. $.post('/mqtt/{{tid}}', data, function (res) {
  696. console.log('data:', data)
  697. if (res == 'on') {
  698. $("#cmn-toggle-41").prop('checked', true);
  699. setTimeout("alert('感測器用 pump _開啟成功!')", 500);
  700. } else if (res == 'off') {
  701. $("#cmn-toggle-41").prop('checked', false);
  702. setTimeout("alert('感測器用 pump _關閉成功!')", 500);
  703. } else {
  704. alert(res);
  705. };
  706. }, 'text')
  707. // setTimeout(function () { location.reload(); }, 500);
  708. };
  709. function tankPumpSensor_ON() {
  710. var data = { "tank_num": "F" + tank_num, "command": "tank_pump_sensor_status", "value": "on" };
  711. $.post('/mqtt/{{tid}}', data, function (res) {
  712. console.log('data:', data)
  713. if (res == 'on') {
  714. $("#cmn-toggle-41").prop('checked', true);
  715. } else if (res == 'off') {
  716. $("#cmn-toggle-41").prop('checked', false);
  717. } else {
  718. };
  719. }, 'text')
  720. // setTimeout(function () { location.reload(); }, 500);
  721. }
  722. function tankPumpSensor_OFF() {
  723. var data = { "tank_num": "F" + tank_num, "command": "tank_pump_sensor_status", "value": "off" };
  724. $.post('/mqtt/{{tid}}', data, function (res) {
  725. console.log('data:', data)
  726. if (res == 'on') {
  727. $("#cmn-toggle-41").prop('checked', true);
  728. } else if (res == 'off') {
  729. $("#cmn-toggle-41").prop('checked', false);
  730. } else {
  731. };
  732. }, 'text')
  733. // setTimeout(function () { location.reload(); }, 500);
  734. }
  735. // 感測模組下豆三通閥
  736. function tankThreeWayValveBean() {
  737. var status = "off";
  738. var check = $("input[name=tank_threewayvalve_bean_status]:checked");
  739. //大於0代表有被選中
  740. if (check.length > 0) {
  741. status = "on";
  742. $("#cmn-toggle-44").prop('checked', false);
  743. if (!confirm("你確定要開啟感測模組下豆三通閥嗎?")) {
  744. return false;
  745. };
  746. } else {
  747. $("#cmn-toggle-44").prop('checked', true);
  748. if (!confirm("你確定要關閉感測模組下豆三通閥嗎?")) {
  749. return false;
  750. };
  751. };
  752. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_bean_status", "value": status };
  753. $.post('/mqtt/{{tid}}', data, function (res) {
  754. console.log('data:', data)
  755. if (res == 'on') {
  756. $("#cmn-toggle-44").prop('checked', true);
  757. setTimeout("alert('感測模組下豆三通閥_開啟成功!')", 500);
  758. } else if (res == 'off') {
  759. $("#cmn-toggle-44").prop('checked', false);
  760. setTimeout("alert('感測模組下豆三通閥_關閉成功!')", 500);
  761. } else {
  762. alert(res);
  763. };
  764. }, 'text')
  765. // setTimeout(function () { location.reload(); }, 500);
  766. };
  767. function tankThreeWayValveBean_ON() {
  768. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_bean_status", "value": "on" };
  769. $.post('/mqtt/{{tid}}', data, function (res) {
  770. console.log('data:', data)
  771. if (res == 'on') {
  772. $("#cmn-toggle-44").prop('checked', true);
  773. } else if (res == 'off') {
  774. $("#cmn-toggle-44").prop('checked', false);
  775. } else {
  776. };
  777. }, 'text')
  778. // setTimeout(function () { location.reload(); }, 500);
  779. };
  780. function tankThreeWayValveBean_OFF() {
  781. var data = { "tank_num": "F" + tank_num, "command": "tank_threewayvalve_bean_status", "value": "off" };
  782. $.post('/mqtt/{{tid}}', data, function (res) {
  783. console.log('data:', data)
  784. if (res == 'on') {
  785. $("#cmn-toggle-44").prop('checked', true);
  786. } else if (res == 'off') {
  787. $("#cmn-toggle-44").prop('checked', false);
  788. } else {
  789. };
  790. }, 'text')
  791. // setTimeout(function () { location.reload(); }, 500);
  792. };
  793. // 外桶浮選三通閥
  794. function outerThreeWayValveFloat() {
  795. var status = "off";
  796. var check = $("input[name=outer_threewayvalve_float_status]:checked");
  797. //大於0代表有被選中
  798. if (check.length > 0) {
  799. status = "on";
  800. $("#cmn-toggle-47").prop('checked', false);
  801. if (!confirm("你確定要開啟外桶浮選三通閥嗎?")) {
  802. return false;
  803. };
  804. } else {
  805. $("#cmn-toggle-47").prop('checked', true);
  806. if (!confirm("你確定要關閉外桶浮選三通閥嗎?")) {
  807. return false;
  808. };
  809. };
  810. var data = { "tank_num": "F" + tank_num, "command": "outer_threewayvalve_float_status", "value": status };
  811. $.post('/mqtt/{{tid}}', data, function (res) {
  812. console.log('data:', data)
  813. if (res == 'on') {
  814. $("#cmn-toggle-47").prop('checked', true);
  815. setTimeout("alert('外桶浮選三通閥_開啟成功!')", 500);
  816. } else if (res == 'off') {
  817. $("#cmn-toggle-47").prop('checked', false);
  818. setTimeout("alert('外桶浮選三通閥_關閉成功!')", 500);
  819. } else {
  820. alert(res);
  821. };
  822. }, 'text')
  823. // setTimeout(function () { location.reload(); }, 500);
  824. };
  825. function outerThreeWayValveFloat_ON() {
  826. var data = { "tank_num": "F" + tank_num, "command": "outer_threewayvalve_float_status", "value": "on" };
  827. $.post('/mqtt/{{tid}}', data, function (res) {
  828. console.log('data:', data)
  829. if (res == 'on') {
  830. $("#cmn-toggle-47").prop('checked', true);
  831. } else if (res == 'off') {
  832. $("#cmn-toggle-47").prop('checked', false);
  833. } else {
  834. };
  835. }, 'text')
  836. // setTimeout(function () { location.reload(); }, 500);
  837. };
  838. function outerThreeWayValveFloat_OFF() {
  839. var data = { "tank_num": "F" + tank_num, "command": "outer_threewayvalve_float_status", "value": "off" };
  840. $.post('/mqtt/{{tid}}', data, function (res) {
  841. console.log('data:', data)
  842. if (res == 'on') {
  843. $("#cmn-toggle-47").prop('checked', true);
  844. } else if (res == 'off') {
  845. $("#cmn-toggle-47").prop('checked', false);
  846. } else {
  847. };
  848. }, 'text')
  849. // setTimeout(function () { location.reload(); }, 500);
  850. };
  851. // Benson cargo2_actuator.html 脫皮機馬達 (START) 馬達攪拌棒
  852. function tankMotor() {
  853. var motor_data = $("input[id=motor_rpm_data]").val();
  854. if (motor_data == '') {
  855. //$("#cmn-toggle-20").prop('checked', false);
  856. alert("請先輸入要運轉的值!");
  857. return false;
  858. } else if (motor_data == 0) {
  859. alert("轉速 0 為關閉馬達");
  860. } else if (Number(motor_data) < -50 || Number(motor_data) > 50 || !Number(motor_data)) {
  861. //
  862. //$("#cmn-toggle-20").prop('checked', false);
  863. alert("您輸入的值已超過範圍,請重新輸入!" + !Number(motor_data));
  864. return false;
  865. };
  866. var value = "off";
  867. //var check = $("input[name=peeling-machine-on]:checked");
  868. if (motor_data != 0) {
  869. value = motor_data;
  870. //$("#cmn-toggle-20").prop('checked', false);
  871. if (!confirm("你確定要開啟攪拌馬達,運轉速度為 " + motor_data + " RPM 嗎?")) {
  872. return false;
  873. };
  874. } else {
  875. //$("#cmn-toggle-20").prop('checked', true);
  876. if (!confirm("你確定要關閉攪拌馬達嗎?")) {
  877. return false;
  878. };
  879. };
  880. var data = { "tank_num": "F" + tank_num, "command": "tank_motor_status", "value": motor_data };
  881. $.post('/mqtt/{{tid}}', data, function (res) {
  882. console.log('data:', data)
  883. if (res == 'on') {
  884. //$("#cmn-toggle-14").prop('checked', true); // prop 設置元素屬型與元素值, 設定 checked 屬性為 true
  885. setTimeout("alert('攪拌馬達_開啟成功!')", 500); // 設定時間執行函式 delay(500), 只執行一次
  886. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  887. } else if (res == 'off') {
  888. //$("#cmn-toggle-14").prop('checked', false);
  889. setTimeout("alert('攪拌馬達_關閉成功!')", 500);
  890. clearInterval(timer); // 取消 timer 的不斷執行
  891. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  892. } else {
  893. alert(res);
  894. };
  895. }, 'text')
  896. // setTimeout(function () { location.reload(); }, 500);
  897. };
  898. function tankMotor_ON() {
  899. var data = { "tank_num": "F" + tank_num, "command": "tank_motor_status", "value": "10" };
  900. $.post('/mqtt/{{tid}}', data, function (res) {
  901. console.log('data:', data)
  902. if (res == 'on') {
  903. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  904. } else if (res == 'off') {
  905. clearInterval(timer); // 取消 timer 的不斷執行
  906. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  907. } else {
  908. };
  909. }, 'text')
  910. // setTimeout(function () { location.reload(); }, 500);
  911. };
  912. function tankMotor_OFF() {
  913. var data = { "tank_num": "F" + tank_num, "command": "tank_motor_status", "value": "0" };
  914. $.post('/mqtt/{{tid}}', data, function (res) {
  915. console.log('data:', data)
  916. if (res == 'on') {
  917. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  918. } else if (res == 'off') {
  919. clearInterval(timer); // 取消 timer 的不斷執行
  920. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  921. } else {
  922. };
  923. }, 'text')
  924. // setTimeout(function () { location.reload(); }, 500);
  925. };
  926. function Rotate() {
  927. $.get('/peeling', '', function (res) {
  928. //console.log(res.peeling);
  929. $("#motor_rpm_status-status").text(res.peeling + ' rpm(每1分鐘更新一次)');
  930. }, 'json');
  931. // setTimeout(function () { location.reload(); }, 500);
  932. };
  933. // Benson cargo2_actuator.html 鼓風機 (START)
  934. //電熱管1函數
  935. function tankHeater1() {
  936. var status = "off";
  937. var check = $("input[name=tank_heater1_status]:checked");
  938. //大於0代表有被選中
  939. if (check.length > 0) {
  940. status = "on";
  941. $("#cmn-toggle-26").prop('checked', false);
  942. if (!confirm("你確定要開啟電熱管1嗎?")) {
  943. return false;
  944. };
  945. } else {
  946. $("#cmn-toggle-26").prop('checked', true);
  947. if (!confirm("你確定要關閉電熱管1嗎?")) {
  948. return false;
  949. };
  950. };
  951. var data = { "tank_num": "F" + tank_num, "command": "tank_heater1_status", "value": status };
  952. $.post('/mqtt/{{tid}}', data, function (res) {
  953. console.log('data:', data)
  954. if (res == 'on') {
  955. $("#cmn-toggle-26").prop('checked', true);
  956. setTimeout("alert('電熱管1_開啟成功!')", 500);
  957. } else if (res == 'off') {
  958. $("#cmn-toggle-26").prop('checked', false);
  959. setTimeout("alert('電熱管1_關閉成功!')", 500);
  960. } else {
  961. alert(res);
  962. };
  963. }, 'text')
  964. // setTimeout(function () { location.reload(); }, 500);
  965. };
  966. function tankHeater1_ON() {
  967. var data = { "tank_num": "F" + tank_num, "command": "tank_heater1_status", "value": "on" };
  968. $.post('/mqtt/{{tid}}', data, function (res) {
  969. console.log('data:', data)
  970. if (res == 'on') {
  971. $("#cmn-toggle-26").prop('checked', true);
  972. } else if (res == 'off') {
  973. $("#cmn-toggle-26").prop('checked', false);
  974. } else {
  975. };
  976. }, 'text')
  977. // setTimeout(function () { location.reload(); }, 500);
  978. };
  979. function tankHeater1_OFF() {
  980. var data = { "tank_num": "F" + tank_num, "command": "tank_heater1_status", "value": "off" };
  981. $.post('/mqtt/{{tid}}', data, function (res) {
  982. console.log('data:', data)
  983. if (res == 'on') {
  984. $("#cmn-toggle-26").prop('checked', true);
  985. } else if (res == 'off') {
  986. $("#cmn-toggle-26").prop('checked', false);
  987. } else {
  988. };
  989. }, 'text')
  990. // setTimeout(function () { location.reload(); }, 500);
  991. };
  992. //電熱管2函數
  993. function tankHeater2() {
  994. var status = "off";
  995. var check = $("input[name=tank_heater2_status]:checked");
  996. //大於0代表有被選中
  997. if (check.length > 0) {
  998. status = "on";
  999. $("#cmn-toggle-29").prop('checked', false);
  1000. if (!confirm("你確定要開啟電熱管2嗎?")) {
  1001. return false;
  1002. };
  1003. } else {
  1004. $("#cmn-toggle-29").prop('checked', true);
  1005. if (!confirm("你確定要關閉電熱管2嗎?")) {
  1006. return false;
  1007. };
  1008. };
  1009. var data = { "tank_num": "F" + tank_num, "command": "tank_heater2_status", "value": status };
  1010. $.post('/mqtt/{{tid}}', data, function (res) {
  1011. console.log('data:', data)
  1012. if (res == 'on') {
  1013. $("#cmn-toggle-29").prop('checked', true);
  1014. setTimeout("alert('電熱管2_開啟成功!')", 500);
  1015. } else if (res == 'off') {
  1016. $("#cmn-toggle-29").prop('checked', false);
  1017. setTimeout("alert('電熱管2_關閉成功!')", 500);
  1018. } else {
  1019. alert(res);
  1020. };
  1021. }, 'text')
  1022. // setTimeout(function () { location.reload(); }, 500);
  1023. };
  1024. function tankHeater2_ON() {
  1025. var data = { "tank_num": "F" + tank_num, "command": "tank_heater2_status", "value": "on" };
  1026. $.post('/mqtt/{{tid}}', data, function (res) {
  1027. console.log('data:', data)
  1028. if (res == 'on') {
  1029. $("#cmn-toggle-29").prop('checked', true);
  1030. } else if (res == 'off') {
  1031. $("#cmn-toggle-29").prop('checked', false);
  1032. } else {
  1033. };
  1034. }, 'text')
  1035. // setTimeout(function () { location.reload(); }, 500);
  1036. };
  1037. function tankHeater2_OFF() {
  1038. var data = { "tank_num": "F" + tank_num, "command": "tank_heater2_status", "value": "off" };
  1039. $.post('/mqtt/{{tid}}', data, function (res) {
  1040. console.log('data:', data)
  1041. if (res == 'on') {
  1042. $("#cmn-toggle-29").prop('checked', true);
  1043. } else if (res == 'off') {
  1044. $("#cmn-toggle-29").prop('checked', false);
  1045. } else {
  1046. };
  1047. }, 'text')
  1048. // setTimeout(function () { location.reload(); }, 500);
  1049. };
  1050. // 溫度控制
  1051. function tankTempEnable() {
  1052. var status = "off";
  1053. var check = $("input[name=tank_temp_enable_status]:checked");
  1054. //大於0代表有被選中
  1055. if (check.length > 0) {
  1056. status = "on";
  1057. $("#cmn-toggle-35").prop('checked', false);
  1058. if (!confirm("你確定要開啟溫度控制嗎?")) {
  1059. return false;
  1060. };
  1061. } else {
  1062. $("#cmn-toggle-35").prop('checked', true);
  1063. if (!confirm("你確定要關閉溫度控制嗎?")) {
  1064. return false;
  1065. };
  1066. };
  1067. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_enable_status", "value": status };
  1068. $.post('/mqtt/{{tid}}', data, function (res) {
  1069. console.log('data:', data)
  1070. if (res == 'on') {
  1071. $("#cmn-toggle-35").prop('checked', true);
  1072. setTimeout("alert('溫度控制_開啟成功!')", 500);
  1073. } else if (res == 'off') {
  1074. $("#cmn-toggle-35").prop('checked', false);
  1075. setTimeout("alert('溫度控制_關閉成功!')", 500);
  1076. } else {
  1077. alert(res);
  1078. };
  1079. }, 'text')
  1080. // setTimeout(function () { location.reload(); }, 500);
  1081. };
  1082. function tankTempEnable_ON() {
  1083. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_enable_status", "value": "on" };
  1084. $.post('/mqtt/{{tid}}', data, function (res) {
  1085. console.log('data:', data)
  1086. if (res == 'on') {
  1087. $("#cmn-toggle-35").prop('checked', true);
  1088. } else if (res == 'off') {
  1089. $("#cmn-toggle-35").prop('checked', false);
  1090. } else {
  1091. };
  1092. }, 'text')
  1093. // setTimeout(function () { location.reload(); }, 500);
  1094. };
  1095. function tankTempEnable_OFF() {
  1096. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_enable_status", "value": "off" };
  1097. $.post('/mqtt/{{tid}}', data, function (res) {
  1098. console.log('data:', data)
  1099. if (res == 'on') {
  1100. $("#cmn-toggle-35").prop('checked', true);
  1101. } else if (res == 'off') {
  1102. $("#cmn-toggle-35").prop('checked', false);
  1103. } else {
  1104. };
  1105. }, 'text')
  1106. // setTimeout(function () { location.reload(); }, 500);
  1107. };
  1108. // 判斷是否整數
  1109. function isInteger(obj) {
  1110. return obj % 1 === 0
  1111. }
  1112. isInteger(3) // true
  1113. // 設定溫度
  1114. function tankTemp() {
  1115. var temp_data = $("input[id=tank_temp_data]").val();
  1116. if (temp_data == '') {
  1117. //$("#cmn-toggle-20").prop('checked', false);
  1118. alert("請先輸入設定溫度!");
  1119. return false;
  1120. } else if (!isInteger(temp_data)) {
  1121. //$("#cmn-toggle-20").prop('checked', false);
  1122. alert("溫度設定僅限整數,請重新輸入!" + !Number(temp_data));
  1123. return false;
  1124. };
  1125. var value = "0";
  1126. //var check = $("input[name=peeling-machine-on]:checked");
  1127. if ($("#cmn-toggle-35").prop('checked')) {
  1128. value = temp_data;
  1129. //$("#cmn-toggle-20").prop('checked', false);
  1130. if (!confirm("你確定要設定內桶溫度為 " + temp_data + " ℃ 嗎?")) {
  1131. return false;
  1132. };
  1133. } else {
  1134. //$("#cmn-toggle-20").prop('checked', true);
  1135. //你確定要停止桶內溫度設定嗎
  1136. if (!confirm("請先開啟溫控開關, 再設定桶內溫度")) {
  1137. return false;
  1138. };
  1139. };
  1140. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_status", "value": temp_data };
  1141. $.post('/mqtt/{{tid}}', data, function (res) {
  1142. console.log('data:', data)
  1143. if (res == 'on') {
  1144. //$("#cmn-toggle-14").prop('checked', true); // prop 設置元素屬型與元素值, 設定 checked 屬性為 true
  1145. setTimeout("alert('溫度設定_開啟成功!')", 500); // 設定時間執行函式 delay(500), 只執行一次
  1146. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  1147. } else if (res == 'off') {
  1148. //$("#cmn-toggle-14").prop('checked', false);
  1149. setTimeout("alert('溫度設定_關閉成功!')", 500);
  1150. clearInterval(timer); // 取消 timer 的不斷執行
  1151. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  1152. } else {
  1153. alert(res);
  1154. };
  1155. }, 'text')
  1156. // setTimeout(function () { location.reload(); }, 500);
  1157. };
  1158. function tankTemp_ON() {
  1159. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_status", "value": "40" };
  1160. $.post('/mqtt/{{tid}}', data, function (res) {
  1161. console.log('data:', data)
  1162. if (res == 'on') {
  1163. } else if (res == 'off') {
  1164. } else {
  1165. };
  1166. }, 'text')
  1167. // setTimeout(function () { location.reload(); }, 500);
  1168. };
  1169. function tankTemp_OFF() {
  1170. var data = { "tank_num": "F" + tank_num, "command": "tank_temp_status", "value": "0" };
  1171. $.post('/mqtt/{{tid}}', data, function (res) {
  1172. console.log('data:', data)
  1173. if (res == 'on') {
  1174. } else if (res == 'off') {
  1175. } else {
  1176. };
  1177. }, 'text')
  1178. // setTimeout(function () { location.reload(); }, 500);
  1179. };
  1180. // Benson 真空吸料機 (START) 出料儲豆槽
  1181. function outputVacuum() {
  1182. var status = "off";
  1183. var check = $("input[name=output_vacuum_status]:checked");
  1184. //大於0代表有被選中
  1185. if (check.length > 0) {
  1186. status = "on";
  1187. $("#cmn-toggle-32").prop('checked', false);
  1188. if (!confirm("你確定要開啟出料儲豆槽真空吸料機嗎?")) {
  1189. return false;
  1190. };
  1191. } else {
  1192. $("#cmn-toggle-32").prop('checked', true);
  1193. if (!confirm("你確定要關閉出料儲豆槽真空吸料機嗎?")) {
  1194. return false;
  1195. };
  1196. };
  1197. var data = { "tank_num": "F" + tank_num, "command": "output_vacuum_status", "value": status };
  1198. console.log('data:', data)
  1199. $.post('/mqtt/{{tid}}', data, function (res) {
  1200. if (res == 'on') {
  1201. $("#cmn-toggle-32").prop('checked', true);
  1202. setTimeout("alert('出料儲豆槽真空吸料機_開啟成功!')", 500);
  1203. } else if (res == 'off') {
  1204. $("#cmn-toggle-32").prop('checked', false);
  1205. setTimeout("alert('出料儲豆槽真空吸料機_關閉成功!')", 500);
  1206. } else {
  1207. alert(res);
  1208. };
  1209. }, 'text')
  1210. // setTimeout(function () { location.reload(); }, 500);
  1211. };
  1212. function outputVacuum_ON() {
  1213. var data = { "tank_num": "F" + tank_num, "command": "output_vacuum_status", "value": "on" };
  1214. console.log('data:', data)
  1215. $.post('/mqtt/{{tid}}', data, function (res) {
  1216. if (res == 'on') {
  1217. $("#cmn-toggle-32").prop('checked', true);
  1218. } else if (res == 'off') {
  1219. $("#cmn-toggle-32").prop('checked', false);
  1220. } else {
  1221. };
  1222. }, 'text')
  1223. // setTimeout(function () { location.reload(); }, 500);
  1224. };
  1225. function outputVacuum_OFF() {
  1226. var data = { "tank_num": "F" + tank_num, "command": "output_vacuum_status", "value": "off" };
  1227. console.log('data:', data)
  1228. $.post('/mqtt/{{tid}}', data, function (res) {
  1229. if (res == 'on') {
  1230. $("#cmn-toggle-32").prop('checked', true);
  1231. } else if (res == 'off') {
  1232. $("#cmn-toggle-32").prop('checked', false);
  1233. } else {
  1234. };
  1235. }, 'text')
  1236. // setTimeout(function () { location.reload(); }, 500);
  1237. };
  1238. </script>
  1239. </head>
  1240. <body>
  1241. <div style="text-align: left;">
  1242. <a href="/ferment" style="float: left;">&nbsp;&nbsp;&nbsp;返回發酵貨櫃首頁</a>
  1243. </div>
  1244. <div style="text-align: right;">
  1245. <a id="ferment_tank_page" href="/index_new" style="float: right;">___________________</a>
  1246. </div>
  1247. <div id="ferment_container_title" style="text-align: center; margin-top: 30px; font-size: 24px; margin-bottom: 15px;">
  1248. 發酵槽 F 操作介面
  1249. </div>
  1250. <!--
  1251. 指定水位高度:
  1252. <input name="testing_water" type="text" value="45" style="width:100px;">
  1253. <input type="button" value="桶內水位測試" onclick="testingWater()">
  1254. <script>
  1255. var proccess = 0; // 下方用來判斷程式是否執行結束, 避免重疊
  1256. function testingWater(){
  1257. var testing_water_height = $("input[name=testing_water]").val()
  1258. console.log("[start]testing_water_height" + testing_water_height)
  1259. var interval = setInterval(tankWaterHeight, 5000);
  1260. function tankWaterHeight(){
  1261. if (proccess == 1){
  1262. return; // 若還在處理就取消, 函式立即停止
  1263. }
  1264. proccess = 1;
  1265. $.ajax({
  1266. type:"GET",
  1267. url:'/ferment_PressureWaterLevel_' + tank_num,
  1268. dataType:'json',
  1269. success:function(response){
  1270. var present_water_height = response.PressureWaterLevel
  1271. console.log('present_water_height: ' + present_water_height)
  1272. if(present_water_height > testing_water_height){
  1273. clearInterval(interval);
  1274. console.log('達到目標水位!')
  1275. }
  1276. proccess = 0;
  1277. },
  1278. error:function(thrownError){
  1279. console.log("Error: " + thrownError)
  1280. proccess = 0;
  1281. }
  1282. });
  1283. proccess = 0;
  1284. };
  1285. };
  1286. </script>
  1287. <hr>
  1288. -->
  1289. 狀態更新時間(秒)
  1290. <input name="webupdate_time" type="text" value="60" style="width:100px;">
  1291. <input type="button" value="設定更新時間" onclick="changeUpdate()">
  1292. <script language="JavaScript">
  1293. function changeUpdate() {
  1294. clearInterval(WebUpdate_set);
  1295. var webupdate_time = $("input[name=webupdate_time]").val()
  1296. console.log('webupdate_time' + webupdate_time)
  1297. WebUpdate_set = setInterval(function(){WebUpdate(ftid)} , webupdate_time * 1000);
  1298. }
  1299. // jQuery 更新感測器制動器狀態
  1300. function WebUpdate(ftid) {
  1301. $.get('/loading/F' + ftid, '', function (res) {
  1302. if (res.tank_vacuum == 0) {
  1303. $("#cmn-toggle-05").prop('checked', false);
  1304. } else if (res.tank_vacuum == 1) {
  1305. $("#cmn-toggle-05").prop('checked', true);}
  1306. if (res.tank_threewayvalve_input == 0) {
  1307. $("#cmn-toggle-08").prop('checked', false);
  1308. } else if (res.tank_threewayvalve_input == 1) {
  1309. $("#cmn-toggle-08").prop('checked', true);}
  1310. if (res.tank_diskvalve == 0) {
  1311. $("#cmn-toggle-11").prop('checked', false);
  1312. } else if (res.tank_diskvalve == 1) {
  1313. $("#cmn-toggle-11").prop('checked', true);}
  1314. if (res.tank_solenoid_water_total == 0) {
  1315. $("#cmn-toggle-14").prop('checked', false);
  1316. } else if (res.tank_solenoid_water_total == 1) {
  1317. $("#cmn-toggle-14").prop('checked', true);}
  1318. if (res.tank_solenoid_disinfect == 0) {
  1319. $("#cmn-toggle-17").prop('checked', false);
  1320. } else if (res.tank_solenoid_disinfect == 1) {
  1321. $("#cmn-toggle-17").prop('checked', true);}
  1322. if (res.outer_solenoid_water == 0) {
  1323. $("#cmn-toggle-38").prop('checked', false);
  1324. } else if (res.outer_solenoid_water == 1) {
  1325. $("#cmn-toggle-38").prop('checked', true);}
  1326. if (res.tank_solenoid_water_in == 0) {
  1327. $("#cmn-toggle-50").prop('checked', false);
  1328. } else if (res.tank_solenoid_water_in == 1) {
  1329. $("#cmn-toggle-50").prop('checked', true);}
  1330. if (res.tank_pump_sensor == 0) {
  1331. $("#cmn-toggle-41").prop('checked', false);
  1332. } else if (res.tank_pump_sensor == 1) {
  1333. $("#cmn-toggle-41").prop('checked', true);}
  1334. if (res.tank_threewayvalve_bean == 0) {
  1335. $("#cmn-toggle-44").prop('checked', false);
  1336. } else if (res.tank_threewayvalve_bean == 1) {
  1337. $("#cmn-toggle-44").prop('checked', true);}
  1338. if (res.outer_threewayvalve_float == 0) {
  1339. $("#cmn-toggle-47").prop('checked', false);
  1340. } else if (res.outer_threewayvalve_float == 1) {
  1341. $("#cmn-toggle-47").prop('checked', true);}
  1342. if (res.tank_heater1 == 0) {
  1343. $("#cmn-toggle-26").prop('checked', false);
  1344. } else if (res.tank_heater1 == 1) {
  1345. $("#cmn-toggle-26").prop('checked', true);}
  1346. if (res.tank_heater2 == 0) {
  1347. $("#cmn-toggle-29").prop('checked', false);
  1348. } else if (res.tank_heater2 == 1) {
  1349. $("#cmn-toggle-29").prop('checked', true);}
  1350. if (res.tank_temp_enable == 0) {
  1351. $("#cmn-toggle-35").prop('checked', false);
  1352. } else if (res.tank_temp_enable == 1) {
  1353. $("#cmn-toggle-35").prop('checked', true);}
  1354. $("#motor_rpm_data").attr("placeholder", res.tank_motor);
  1355. $("#tank_temp_data").attr("placeholder", res.tank_temp);
  1356. $("#SHT11_Temp_t_status").text(res.SHT11_Temp);
  1357. $("#SHT11_Humidity_t_status").text(res.SHT11_Humidity);
  1358. $("#CO2_t_status").text(res.CO2);
  1359. $("#PH_t_status").text(res.PH);
  1360. $("#ORP_t_status").text(res.ORP);
  1361. $("#DO_t_status").text(res.DO);
  1362. $("#EC_t_status").text(res.EC);
  1363. $("#PA_t_status").text(res.PA);
  1364. if (res.WaterLevel == '1') {
  1365. $("#WaterLevel_t_status").text('滿');
  1366. } else if (res.WaterLevel == '0') {
  1367. $("#WaterLevel_t_status").text('可注水');
  1368. } else {
  1369. $("#WaterLevel_t_status").text('ERROR');
  1370. }
  1371. $("[name = LiDAR_t_status]").text(res.LiDAR);
  1372. $("[name = PressureWaterLevel_t_status]").text(res.PressureWaterLevel);
  1373. if (res.WaterLevel == '1' && res.outer_solenoid_water == '1'){
  1374. outerSolenoidWater_OFF();
  1375. console.log('保溫夾層注水 OFF')
  1376. };
  1377. }, 'json');
  1378. }
  1379. </script>
  1380. <h4>制動器</h4>
  1381. <table border="1px solid black" style="font-size:18px;" width=100%>
  1382. <tr>
  1383. <td style="color:red;">Valve</td>
  1384. <td>入料<br>真空吸料機</td>
  1385. <td>桶內<br>真空吸料機</td>
  1386. <td>入料三通閥</td>
  1387. <td>總進水<br>電磁閥</td>
  1388. <td>桶內消毒<br>電磁閥</td>
  1389. <td>保溫夾層進水<br>電磁閥</td>
  1390. <td>桶內進水<br>電磁閥</td>
  1391. <td>感測器<br>雙核隔膜泵</td>
  1392. <td>感測模組<br>下豆三通閥</td>
  1393. <td>外桶浮選<br>三通閥</td>
  1394. <td>馬達</td>
  1395. <td>加熱器 1</td>
  1396. <td>加熱器 2</td>
  1397. <td>溫控開關</td>
  1398. <td>溫度設定</td>
  1399. <td>蝴蝶閥</td>
  1400. <td>出料<br>真空吸料機</td>
  1401. </tr>
  1402. <tr>
  1403. <td>
  1404. <span style="color:#C0C0C0;">off</span>
  1405. <span style="color:#008CBA;">on</span>
  1406. </td>
  1407. <td>
  1408. <div class="switch_div">
  1409. <div class="switch">
  1410. <input id="cmn-toggle-01" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1411. <label for="cmn-toggle-01"></label>
  1412. </div>
  1413. <div class="switch text-center">
  1414. {% if input_vacuum == 1 %}
  1415. <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1416. name="tank_vacuum_status" value="ON" onclick="inputVacuum()">
  1417. {% else %}
  1418. <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1419. name="tank_vacuum_status" value="OFF" onclick="inputVacuum()">
  1420. {% endif %}
  1421. <label for="cmn-toggle-02"></label>
  1422. </div>
  1423. <div class="switch">
  1424. <input id="cmn-toggle-03" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1425. <label for="cmn-toggle-03" data-on="Yes" data-off="No"></label>
  1426. </div>
  1427. </div>
  1428. </td>
  1429. <td>
  1430. <div class="switch_div">
  1431. <div class="switch">
  1432. <input id="cmn-toggle-04" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1433. <label for="cmn-toggle-04"></label>
  1434. </div>
  1435. <div class="switch text-center">
  1436. {% if tank_vacuum=='ON' %}
  1437. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1438. name="tank_vacuum_status" value="ON" onclick="tankVacuum()">
  1439. {% else %}
  1440. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1441. name="tank_vacuum_status" value="OFF" onclick="tankVacuum()">
  1442. {% endif %}
  1443. <label for="cmn-toggle-05"></label>
  1444. </div>
  1445. <div class="switch">
  1446. <input id="cmn-toggle-06" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1447. <label for="cmn-toggle-06" data-on="Yes" data-off="No"></label>
  1448. </div>
  1449. </div>
  1450. </td>
  1451. <td>
  1452. <div class="switch_div">
  1453. <div class="switch">
  1454. <input id="cmn-toggle-07" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1455. <label for="cmn-toggle-07"></label>
  1456. </div>
  1457. <div class="switch text-center">
  1458. {% if tank_threewayvalve_input=='ON' %}
  1459. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1460. name="tank_threewayvalve_input_status" value="ON" onclick="tankThreeWayValveInput()">
  1461. {% else %}
  1462. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1463. name="tank_threewayvalve_input_status" value="OFF" onclick="tankThreeWayValveInput()">
  1464. {% endif %}
  1465. <label for="cmn-toggle-08"></label>
  1466. </div>
  1467. <div class="switch">
  1468. <input id="cmn-toggle-09" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1469. <label for="cmn-toggle-09" data-on="Yes" data-off="No"></label>
  1470. </div>
  1471. </div>
  1472. </td>
  1473. <td>
  1474. <div class="switch_div">
  1475. <div class="switch">
  1476. <input id="cmn-toggle-13" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1477. <label for="cmn-toggle-13"></label>
  1478. </div>
  1479. <div class="switch text-center">
  1480. {% if tank_solenoid_water_total=='ON' %}
  1481. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1482. name="tank_solenoid_water_total_status" value="ON" onclick="tankSolenoidWaterTotal()">
  1483. {% else %}
  1484. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1485. name="tank_solenoid_water_total_status" value="OFF" onclick="tankSolenoidWaterTotal()">
  1486. {% endif %}
  1487. <label for="cmn-toggle-14"></label>
  1488. </div>
  1489. <div class="switch">
  1490. <input id="cmn-toggle-15" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1491. <label for="cmn-toggle-15" data-on="Yes" data-off="No"></label>
  1492. </div>
  1493. </div>
  1494. </td>
  1495. <td>
  1496. <div class="switch_div">
  1497. <div class="switch">
  1498. <input id="cmn-toggle-16" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1499. <label for="cmn-toggle-16"></label>
  1500. </div>
  1501. <div class="switch text-center">
  1502. {% if tank_solenoid_disinfect=='ON' %}
  1503. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1504. name="tank_solenoid_disinfect_status" value="ON" onclick="tankSolenoidDisinfect()">
  1505. {% else %}
  1506. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1507. name="tank_solenoid_disinfect_status" value="OFF" onclick="tankSolenoidDisinfect()">
  1508. {% endif %}
  1509. <label for="cmn-toggle-17"></label>
  1510. </div>
  1511. <div class="switch">
  1512. <input id="cmn-toggle-18" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1513. <label for="cmn-toggle-18" data-on="Yes" data-off="No"></label>
  1514. </div>
  1515. </div>
  1516. </td>
  1517. <td>
  1518. <div class="switch_div">
  1519. <div class="switch">
  1520. <input id="cmn-toggle-37" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1521. <label for="cmn-toggle-37"></label>
  1522. </div>
  1523. <div class="switch text-center">
  1524. {% if outer_solenoid_water=='ON' %}
  1525. <input id="cmn-toggle-38" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1526. name="outer_solenoid_water_status" value="ON" onclick="outerSolenoidWater()">
  1527. {% else %}
  1528. <input id="cmn-toggle-38" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1529. name="outer_solenoid_water_status" value="OFF" onclick="outerSolenoidWater()">
  1530. {% endif %}
  1531. <label for="cmn-toggle-38"></label>
  1532. </div>
  1533. <div class="switch">
  1534. <input id="cmn-toggle-39" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1535. <label for="cmn-toggle-39" data-on="Yes" data-off="No"></label>
  1536. </div>
  1537. </div>
  1538. </td>
  1539. <td>
  1540. <div class="switch_div">
  1541. <div class="switch">
  1542. <input id="cmn-toggle-49" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1543. <label for="cmn-toggle-49"></label>
  1544. </div>
  1545. <div class="switch text-center">
  1546. {% if tank_solenoid_water_in=='ON' %}
  1547. <input id="cmn-toggle-50" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1548. name="tank_solenoid_water_in_status" value="ON" onclick="tankSolenoidWaterIn()">
  1549. {% else %}
  1550. <input id="cmn-toggle-50" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1551. name="tank_solenoid_water_in_status" value="OFF" onclick="tankSolenoidWaterIn()">
  1552. {% endif %}
  1553. <label for="cmn-toggle-50"></label>
  1554. </div>
  1555. <div class="switch">
  1556. <input id="cmn-toggle-51" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1557. <label for="cmn-toggle-51" data-on="Yes" data-off="No"></label>
  1558. </div>
  1559. </div>
  1560. </td>
  1561. <td>
  1562. <div class="switch_div">
  1563. <div class="switch">
  1564. <input id="cmn-toggle-40" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1565. <label for="cmn-toggle-40"></label>
  1566. </div>
  1567. <div class="switch text-center">
  1568. {% if tank_pump_sensor=='ON' %}
  1569. <input id="cmn-toggle-41" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1570. name="tank_pump_sensor_status" value="ON" onclick="tankPumpSensor()">
  1571. {% else %}
  1572. <input id="cmn-toggle-41" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1573. name="tank_pump_sensor_status" value="OFF" onclick="tankPumpSensor()">
  1574. {% endif %}
  1575. <label for="cmn-toggle-41"></label>
  1576. </div>
  1577. <div class="switch">
  1578. <input id="cmn-toggle-42" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1579. <label for="cmn-toggle-42" data-on="Yes" data-off="No"></label>
  1580. </div>
  1581. </div>
  1582. </td>
  1583. <td>
  1584. <div class="switch_div">
  1585. <div class="switch">
  1586. <input id="cmn-toggle-43" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1587. <label for="cmn-toggle-43"></label>
  1588. </div>
  1589. <div class="switch text-center">
  1590. {% if tank_threewayvalve_bean=='ON' %}
  1591. <input id="cmn-toggle-44" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1592. name="tank_threewayvalve_bean_status" value="ON" onclick="tankThreeWayValveBean()">
  1593. {% else %}
  1594. <input id="cmn-toggle-44" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1595. name="tank_threewayvalve_bean_status" value="OFF" onclick="tankThreeWayValveBean()">
  1596. {% endif %}
  1597. <label for="cmn-toggle-44"></label>
  1598. </div>
  1599. <div class="switch">
  1600. <input id="cmn-toggle-45" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1601. <label for="cmn-toggle-45" data-on="Yes" data-off="No"></label>
  1602. </div>
  1603. </div>
  1604. </td>
  1605. <td>
  1606. <div class="switch_div">
  1607. <div class="switch">
  1608. <input id="cmn-toggle-46" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1609. <label for="cmn-toggle-46"></label>
  1610. </div>
  1611. <div class="switch text-center">
  1612. {% if outer_threewayvalve_float=='ON' %}
  1613. <input id="cmn-toggle-47" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1614. name="outer_threewayvalve_float_status" value="ON" onclick="outerThreeWayValveFloat()">
  1615. {% else %}
  1616. <input id="cmn-toggle-47" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1617. name="outer_threewayvalve_float_status" value="OFF" onclick="outerThreeWayValveFloat()">
  1618. {% endif %}
  1619. <label for="cmn-toggle-47"></label>
  1620. </div>
  1621. <div class="switch">
  1622. <input id="cmn-toggle-48" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1623. <label for="cmn-toggle-48" data-on="Yes" data-off="No"></label>
  1624. </div>
  1625. </div>
  1626. </td>
  1627. <td>
  1628. <input id="motor_rpm_data" type="text" placeholder="{{tank_motor}}" value="" style="width:50px;">RPM
  1629. <br>
  1630. <span id="motor_rpm_status" style="color:red;"></span>
  1631. <input type="button" value="送出" name="tank_motor_status" onclick="tankMotor()">
  1632. </td>
  1633. <td>
  1634. <div class="switch_div">
  1635. <div class="switch">
  1636. <input id="cmn-toggle-25" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1637. <label for="cmn-toggle-25"></label>
  1638. </div>
  1639. <div class="switch text-center">
  1640. {% if tank_heater1=='ON' %}
  1641. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1642. name="tank_heater1_status" value="ON" onclick="tankHeater1()">
  1643. {% else %}
  1644. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1645. name="tank_heater1_status" value="OFF" onclick="tankHeater1()">
  1646. {% endif %}
  1647. <label for="cmn-toggle-26"></label>
  1648. </div>
  1649. <div class="switch">
  1650. <input id="cmn-toggle-27" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1651. <label for="cmn-toggle-27" data-on="Yes" data-off="No"></label>
  1652. </div>
  1653. </div>
  1654. </td>
  1655. <td>
  1656. <div class="switch_div">
  1657. <div class="switch">
  1658. <input id="cmn-toggle-28" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1659. <label for="cmn-toggle-28"></label>
  1660. </div>
  1661. <div class="switch text-center">
  1662. {% if tank_heater2=='ON' %}
  1663. <input id="cmn-toggle-29" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1664. name="tank_heater2_status" value="ON" onclick="tankHeater2()">
  1665. {% else %}
  1666. <input id="cmn-toggle-29" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1667. name="tank_heater2_status" value="OFF" onclick="tankHeater2()">
  1668. {% endif %}
  1669. <label for="cmn-toggle-29"></label>
  1670. </div>
  1671. <div class="switch">
  1672. <input id="cmn-toggle-30" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1673. <label for="cmn-toggle-30" data-on="Yes" data-off="No"></label>
  1674. </div>
  1675. </div>
  1676. </td>
  1677. <td>
  1678. <div class="switch_div">
  1679. <div class="switch">
  1680. <input id="cmn-toggle-34" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1681. <label for="cmn-toggle-34"></label>
  1682. </div>
  1683. <div class="switch text-center">
  1684. {% if tank_temp_enable=='ON' %}
  1685. <input id="cmn-toggle-35" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1686. name="tank_temp_enable_status" value="ON" onclick="tankTempEnable()">
  1687. {% else %}
  1688. <input id="cmn-toggle-35" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1689. name="tank_temp_enable_status" value="OFF" onclick="tankTempEnable()">
  1690. {% endif %}
  1691. <label for="cmn-toggle-35"></label>
  1692. </div>
  1693. <div class="switch">
  1694. <input id="cmn-toggle-36" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1695. <label for="cmn-toggle-36" data-on="Yes" data-off="No"></label>
  1696. </div>
  1697. </div>
  1698. </td>
  1699. <td>
  1700. <input id="tank_temp_data" type="text" placeholder="{{tank_temp}}" value="" style="width:50px;">℃
  1701. <span id="tank_temp_status" style="color:red;"></span>
  1702. <br>
  1703. <input type="button" value="送出" name="tank_temp_status" onclick="tankTemp()">
  1704. </td>
  1705. <td>
  1706. <div class="switch_div">
  1707. <div class="switch">
  1708. <input id="cmn-toggle-10" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1709. <label for="cmn-toggle-10"></label>
  1710. </div>
  1711. <div class="switch text-center">
  1712. {% if tank_diskvalve=='ON' %}
  1713. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1714. name="tank_diskvalve_status" value="ON" onclick="tankDiskValve()">
  1715. {% else %}
  1716. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1717. name="tank_diskvalve_status" value="OFF" onclick="tankDiskValve()">
  1718. {% endif %}
  1719. <label for="cmn-toggle-11"></label>
  1720. </div>
  1721. <div class="switch">
  1722. <input id="cmn-toggle-12" class="cmn-toggle cmn-toggle-on-off" type="checkbox">
  1723. <label for="cmn-toggle-12" data-on="Yes" data-off="No"></label>
  1724. </div>
  1725. </div>
  1726. </td>
  1727. <td>
  1728. <div class="switch_div">
  1729. <div class="switch">
  1730. <input id="cmn-toggle-31" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1731. <label for="cmn-toggle-31"></label>
  1732. </div>
  1733. <div class="switch text-center">
  1734. {% if output_vacuum == 1 %}
  1735. <input id="cmn-toggle-32" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1736. name="output_vacuum_status" value="ON" onclick="outputVacuum()">
  1737. {% else %}
  1738. <input id="cmn-toggle-32" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1739. name="output_vacuum_status" value="OFF" onclick="outputVacuum()">
  1740. {% endif %}
  1741. <label for="cmn-toggle-32"></label>
  1742. </div>
  1743. <div class="switch">
  1744. <input id="cmn-toggle-33" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1745. <label for="cmn-toggle-33" data-on="Yes" data-off="No"></label>
  1746. </div>
  1747. </div>
  1748. </td>
  1749. </tr>
  1750. <tr>
  1751. <td><span style="color:#008CBA;"><b>ON</b></span></td>
  1752. <td><input type="button" value="ON" name="input_vacuum_ON" onclick="inputVacuum_ON()"></td>
  1753. <td><input type="button" value="ON" name="tank_vacuum_ON" onclick="tankVacuum_ON()"></td>
  1754. <td><input type="button" value="ON" name="tank_threewayvalve_input_ON"
  1755. onclick="tankThreeWayValveInput_ON()"></td>
  1756. <td><input type="button" value="ON" name="tank_solenoid_water_in_ON" onclick="tankSolenoidWaterTotal_ON()">
  1757. </td>
  1758. <td><input type="button" value="ON" name="tank_solenoid_disinfect_ON" onclick="tankSolenoidDisinfect_ON()">
  1759. </td>
  1760. <td><input type="button" value="ON" name="outer_solenoid_water_ON" onclick="outerSolenoidWater_ON()">
  1761. </td>
  1762. <td><input type="button" value="ON" name="tank_solenoid_water_in_ON" onclick="tankSolenoidWaterIn_ON()">
  1763. </td>
  1764. <td><input type="button" value="ON" name="tank_pump_sensor_ON" onclick="tankPumpSensor_ON()">
  1765. </td>
  1766. <td><input type="button" value="ON" name="tank_threewayvalve_bean_ON" onclick="tankThreeWayValveBean_ON()">
  1767. </td>
  1768. <td><input type="button" value="ON" name="outer_threewayvalve_float_ON"
  1769. onclick="outerThreeWayValveFloat_ON()">
  1770. </td>
  1771. <td><input type="button" value="ON" name="tank_motor_ON" onclick="tankMotor_ON()"></td>
  1772. <td><input type="button" value="ON" name="tank_heater1_ON" onclick="tankHeater1_ON()"></td>
  1773. <td><input type="button" value="ON" name="tank_heater2_ON" onclick="tankHeater2_ON()"></td>
  1774. <td><input type="button" value="ON" name="tank_temp_enable_ON" onclick="tankTempEnable_ON()"></td>
  1775. <td><input type="button" value="ON" name="tank_temp_ON" onclick="tankTemp_ON()"></td>
  1776. <td><input type="button" value="ON" name="tank_diskvalve_ON" onclick="tankDiskValve_ON()"></td>
  1777. <td><input type="button" value="ON" name="output_vacuum_ON" onclick="outputVacuum_ON()"></td>
  1778. </tr>
  1779. <tr>
  1780. <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
  1781. <td><input type="button" value="OFF" name="input_vacuum_OFF" onclick="inputVacuum_OFF()"></td>
  1782. <td><input type="button" value="OFF" name="tank_vacuum_OFF" onclick="tankVacuum_OFF()"></td>
  1783. <td><input type="button" value="OFF" name="tank_threewayvalve_input_OFF"
  1784. onclick="tankThreeWayValveInput_OFF()"></td>
  1785. <td><input type="button" value="OFF" name="tank_solenoid_water_in_OFF"
  1786. onclick="tankSolenoidWaterTotal_OFF()">
  1787. </td>
  1788. <td><input type="button" value="OFF" name="tank_solenoid_disinfect_OFF"
  1789. onclick="tankSolenoidDisinfect_OFF()"></td>
  1790. <td><input type="button" value="OFF" name="outer_solenoid_water_OFF" onclick="outerSolenoidWater_OFF()">
  1791. </td>
  1792. <td><input type="button" value="OFF" name="tank_solenoid_water_in_OFF" onclick="tankSolenoidWaterIn_OFF()">
  1793. </td>
  1794. <td><input type="button" value="OFF" name="tank_pump_sensor_OFF" onclick="tankPumpSensor_OFF()"></td>
  1795. <td><input type="button" value="OFF" name="tank_threewayvalve_bean_OFF"
  1796. onclick="tankThreeWayValveBean_OFF()">
  1797. </td>
  1798. <td><input type="button" value="OFF" name="outer_threewayvalve_float_OFF"
  1799. onclick="outerThreeWayValveFloat_OFF()">
  1800. </td>
  1801. <td><input type="button" value="OFF" name="tank_motor_OFF" onclick="tankMotor_OFF()"></td>
  1802. <td><input type="button" value="OFF" name="tank_heater1_OFF" onclick="tankHeater1_OFF()"></td>
  1803. <td><input type="button" value="OFF" name="tank_heater2_OFF" onclick="tankHeater2_OFF()"></td>
  1804. <td><input type="button" value="OFF" name="tank_temp_enable_OFF" onclick="tankTempEnable_OFF()"></td>
  1805. <td><input type="button" value="OFF" name="tank_temp_OFF" onclick="tankTemp_OFF()"></td>
  1806. <td><input type="button" value="OFF" name="tank_diskvalve_OFF" onclick="tankDiskValve_OFF()"></td>
  1807. <td><input type="button" value="OFF" name="output_vacuum_OFF" onclick="outputVacuum_OFF()"></td>
  1808. </tr>
  1809. </table>
  1810. <br>
  1811. <h4>感測器</h4>
  1812. <table style="font-size:18px; border:2px #cccccc solid;" cellpadding="5" border='1' width=100%>
  1813. <tr>
  1814. <td colspan="8">[入料] 生豆高度:{{input_UltraSonic.UltraSonic}} 公分</td>
  1815. </tr>
  1816. <tr>
  1817. <td colspan="4">[桶內] 生豆高度:<span name="LiDAR_t_status">{{tank_LiDAR.LiDAR}}</span> 公分</td>
  1818. <td colspan="4">[桶內] 水位高度:<span name="PressureWaterLevel_t_status">{{PressureWaterLevel}}</span> 公分</td>
  1819. </tr>
  1820. <tr>
  1821. <td style="background-color:#f3f3f3">溫度</td>
  1822. <td><span id="SHT11_Temp_t_status">{{tank_SHT11.SHT11_Temp}}</span> ℃</td>
  1823. <td style="background-color:#f3f3f3">濕度</td>
  1824. <td><span id="SHT11_Humidity_t_status">{{tank_SHT11.SHT11_Humidity}}</span> %</td>
  1825. <td style="background-color:#f3f3f3">二氧化碳</td>
  1826. <td><span id="CO2_t_status">{{tank_CO2.CO2}}</span> ppm</td>
  1827. <td style="background-color:#f3f3f3">氣壓</td>
  1828. <td><span id="PA_t_status">{{tank_PA.PA}}</span> Pa</td>
  1829. </tr>
  1830. <tr>
  1831. <td style="background-color:#f3f3f3">pH</td>
  1832. <td><span id="PH_t_status">{{tank_PH.PH}}</span></td>
  1833. <td style="background-color:#f3f3f3">ORP</td>
  1834. <td><span id="ORP_t_status">{{tank_ORP.ORP}}</span> mV</td>
  1835. <td style="background-color:#f3f3f3">DO</td>
  1836. <td><span id="DO_t_status">{{tank_DO.DO}}</span> mg/L</td>
  1837. <td style="background-color:#f3f3f3">EC</td>
  1838. <td><span id="EC_t_status">{{tank_EC.EC}}</span> μS/cm</td>
  1839. </tr>
  1840. <tr>
  1841. <td colspan="8">[保溫夾層] 水位高度:<span id="WaterLevel_t_status">{{WaterLevel}}</span></td>
  1842. </tr>
  1843. <tr>
  1844. <td colspan="8">[出料] 生豆高度:{{output_UltraSonic.UltraSonic}} 公分</td>
  1845. </tr>
  1846. </table>
  1847. <br>
  1848. <h4>排程測試</h4>
  1849. <table style="font-size:18px; border:2px #cccccc solid;" cellpadding="5" border='1' width=100%>
  1850. <tr>
  1851. <td>發酵</td>
  1852. <td>入水</td>
  1853. <td>入豆</td>
  1854. <td>水質測量 (攪拌、加熱)</td>
  1855. <td>排水出豆</td>
  1856. </tr>
  1857. <tr>
  1858. <td>
  1859. -- 入水 --<br>
  1860. 保溫夾層加滿水<br>
  1861. 指定桶內水位高度
  1862. <input name="testing_tank_water_height_F" value="100" type="text" style="width: 40px;">公分<br>
  1863. -- 入豆 --<br>
  1864. 指定桶內生豆高度
  1865. <input name="testing_tank_bean_height_F" value="20" type="text" style="width: 40px;">公分<br>
  1866. -- 發酵 --<br>
  1867. 指定溫度
  1868. <input name="testing_tank_temp_F" value="21" type="text" style="width: 40px;">℃<br>
  1869. 指定時間
  1870. <input name="testing_tank_time_F" value="10" type="text" style="width: 40px;">秒<br>
  1871. -- 出料 --<br>
  1872. 設定空桶高度
  1873. <input name="testing_tank_empty_height_F" value="10" type="text" style="width: 40px;">公分<br>
  1874. <!--
  1875. 入料吸料時間(秒)
  1876. <input name="testing_tank_vacuum_in_F" value="1" type="text" style="width: 40px;">
  1877. <br>
  1878. 入料放料時間(>10秒)
  1879. <input name="testing_tank_vacuum_out_F" value="10" type="text" style="width: 40px;">
  1880. <br>
  1881. 入料循環次數
  1882. <input name="testing_tank_vacuum_loop_F" value="4" type="text" style="width: 40px;">
  1883. <br>
  1884. 保溫夾層注水
  1885. <br>
  1886. 保溫夾層滿水時加熱
  1887. <br>
  1888. 溫度達設定溫度時, 停止加熱
  1889. <br>
  1890. 馬達 rpm
  1891. <input name="testing_motor_rpm_F" value="20" type="text" style="width:100px;">
  1892. <br>
  1893. 出料吸料時間(秒)
  1894. <input name="testing_out_vacuum_in_F" value="1" type="text"
  1895. style="width: 40px;">
  1896. <br>
  1897. 出料放料時間(>10秒)
  1898. <input name="testing_out_vacuum_out_F" value="10" type="text"
  1899. style="width: 40px;">
  1900. <br>
  1901. 出料循環次數
  1902. <input name="testing_out_vacuum_loop_F" value="4" type="text"
  1903. style="width: 40px;">
  1904. -->
  1905. </td>
  1906. <td>
  1907. [桶內] 水位高度&nbsp;<span name="PressureWaterLevel_t_status">{{PressureWaterLevel}}</span>&nbsp;公分<br>
  1908. 指定水量高度
  1909. <input name="testing_tank_water_height" id="testing_tank_water_height" type="text" value="100" style="width: 40px;">公分
  1910. </td>
  1911. <td>
  1912. [桶內] 生豆高度&nbsp;<span name="LiDAR_t_status">{{tank_LiDAR.LiDAR}}</span>&nbsp;公分<br>
  1913. 指定咖啡豆高度
  1914. <input name="testing_tank_coffee_height" id="testing_tank_coffee_height" type="text" value="0"
  1915. style="width: 40px;">公分<br>
  1916. 入料吸料時間
  1917. <input name="testing_tank_vacuum_in" id="testing_tank_vacuum_in" type="text" value="1" style="width: 40px;">秒<br>
  1918. 入料放料時間(>10)
  1919. <input name="testing_tank_vacuum_out" id="testing_tank_vacuum_out" type="text" value="10" style="width: 40px;">秒<br>
  1920. 入料循環次數
  1921. <input name="testing_tank_vacuum_loop" id="testing_tank_vacuum_loop" type="text" value="3" style="width: 40px;">次
  1922. </td>
  1923. <td>
  1924. 馬達
  1925. <input name="testing_motor_rpm" id="testing_motor_rpm" value="0" type="text" style="width: 40px;">rpm<br>
  1926. <!--
  1927. 發酵時間(秒)
  1928. <input name="testing_tank_dry_time" id="testing_tank_dry_time" type="text" style="width: 40px;">
  1929. <br>
  1930. 溫度控制(℃)
  1931. <input name="AAA" id="AAA" type="text" style="width: 40px;">
  1932. -->
  1933. 加熱器 1、2 ON
  1934. <br>
  1935. pump 開啟時間
  1936. <input name="testing_tank_pump_on" id="testing_tank_pump_on" value="10" type="text" style="width: 40px;">秒<br>
  1937. pump 關閉時間
  1938. <input name="testing_tank_pump_off" id="testing_tank_pump_off" value="10" type="text" style="width: 40px;">秒<br>
  1939. pump 循環次數
  1940. <input name="testing_tank_pump_loop" id="testing_tank_pump_loop" value="3" type="text" style="width: 40px;">次<br>
  1941. </td>
  1942. <td>
  1943. [桶內] 生豆高度&nbsp;<span name="LiDAR_t_status">{{tank_LiDAR.LiDAR}}</span>&nbsp;公分<br>
  1944. 指定空桶高度
  1945. <input name="testing_tank_empty_height" id="testing_tank_empty_height" type="text" value="0"
  1946. style="width: 40px;">公分<br>
  1947. 蝴蝶閥 ON
  1948. <br>
  1949. 出料吸料時間
  1950. <input name="testing_out_vacuum_in" id="testing_out_vacuum_in" value="1" type="text" style="width: 40px;">秒<br>
  1951. 出料放料時間(>10)
  1952. <input name="testing_out_vacuum_out" id="testing_out_vacuum_out" value="10" type="text" style="width: 40px;">秒<br>
  1953. 出料循環次數
  1954. <input name="testing_out_vacuum_loop" id="testing_out_vacuum_loop" value="3" type="text" style="width: 40px;">次
  1955. </td>
  1956. </tr>
  1957. <tr>
  1958. <td>
  1959. <button type="submit" class="btn btn-primary" onclick="testing_F()">發酵測試</button>
  1960. <script>
  1961. // 入水狀態
  1962. var WaterIn_F_Process = 0;
  1963. // 入豆狀態
  1964. var BeanIn_F_Process = 0;
  1965. // 發酵狀態
  1966. var Fermenting_F_Process = 0;
  1967. // 出料狀態
  1968. var WaterBeanOut_F_Process = 0;
  1969. // 發酵
  1970. function testing_F() {
  1971. clearInterval(WebUpdate);
  1972. var testing_tank_water_height_F = $("input[name=testing_tank_water_height_F]").val();
  1973. console.log("指定水高: " + testing_tank_water_height_F)
  1974. // -- 入水 --
  1975. // 若桶內水還沒滿, 開啟桶內入水
  1976. $.get('/ferment_PressureWaterLevel_' + tank_num, '', function (res) {
  1977. if ( res.PressureWaterLevel < testing_tank_water_height_F ){
  1978. console.log('桶內開始入水')
  1979. tankSolenoidWaterIn_ON();
  1980. console.log('tankSolenoidWaterIn_ON')
  1981. console.log('請開啟水龍頭進水')
  1982. };
  1983. }, 'json');
  1984. // 若夾層水還沒滿, 開啟夾層入水
  1985. $.get('/ferment_WaterLevel_' + tank_num, '', function (res) {
  1986. if ( res.WaterLevel != 1 ){
  1987. console.log('夾層開始入水')
  1988. outerSolenoidWater_ON();
  1989. console.log('tankSolenoidWaterIn_ON')
  1990. console.log('請開啟水龍頭進水')
  1991. };
  1992. }, 'json');
  1993. // 入水每五秒判斷
  1994. var WaterIn_F_interval = setInterval(WaterIn_F, 5000);
  1995. var BeanIn_F_interval
  1996. function WaterIn_F(){
  1997. if(WaterIn_F_Process == 1){
  1998. return; // 若還在處理就取消, 函式立即停止
  1999. }
  2000. // 取得桶內目前水位、取得夾層是否達水位計
  2001. WaterIn_F_Process = 1;
  2002. $.ajax({
  2003. async:false,
  2004. type:"GET",
  2005. url:"/ferment_WaterIn_" + tank_num,
  2006. dataType:"JSON",
  2007. success:function(response){
  2008. var present_tank_water_height = response.PressureWaterLevel
  2009. var present_WaterLevel = response.WaterLevel
  2010. if (present_WaterLevel == 1) {
  2011. outerSolenoidWater_OFF()
  2012. console.log("outerSolenoidWater_OFF")
  2013. console.log("保溫夾層入水完成, 桶內加水中")
  2014. }
  2015. if (present_tank_water_height > testing_tank_water_height_F) {
  2016. tankSolenoidWaterIn_OFF()
  2017. console.log("tankSolenoidWaterIn_OFF")
  2018. console.log("桶內入水完成, 保溫夾層加水中")
  2019. }
  2020. if (present_WaterLevel == 1 &&
  2021. present_tank_water_height > testing_tank_water_height_F) {
  2022. clearInterval(WaterIn_F_interval);
  2023. console.log("入水完成!")
  2024. // -- 入豆 --
  2025. BeanIn_F_interval = setInterval(BeanIn_F, 5000);
  2026. }
  2027. WaterIn_F_Process = 0;
  2028. },
  2029. error:function(thrownError){
  2030. console.log("Error: " + thrownError)
  2031. WaterIn_F_Process = 0;
  2032. }
  2033. });
  2034. }
  2035. // 發酵排程
  2036. var Fermenting_F_interval
  2037. function BeanIn_F(){
  2038. if (BeanIn_F_Process == 1) {
  2039. return; // 若還在處理就取消, 函式立即停止
  2040. }
  2041. // 取得桶內生豆高度
  2042. BeanIn_F_Process = 1;
  2043. $.ajax({
  2044. async:false,
  2045. type:"GET",
  2046. url:"/ferment_LiDAR_" + tank_num,
  2047. dataType:'json',
  2048. success:function(response){
  2049. var present_Bean_height = response.LiDAR
  2050. console.log("目前豆高: " + present_Bean_height)
  2051. var testing_tank_bean_height_F = $("input[name=testing_tank_bean_height_F]").val();
  2052. console.log("指定豆高: " + testing_tank_bean_height_F)
  2053. if (present_Bean_height > testing_tank_bean_height_F) {
  2054. clearInterval(BeanIn_F_interval);
  2055. console.log("已達生豆高度!")
  2056. var testing_tank_temp_F = $("input[name=testing_tank_temp_F]").val();
  2057. var testing_tank_time_F = $("input[name=testing_tank_time_F]").val();
  2058. console.log("指定溫度: " + testing_tank_temp_F)
  2059. console.log("指定時間: " + testing_tank_time_F)
  2060. tankMotor_ON()
  2061. console.log("tankMotor_ON")
  2062. // 取得桶內溫度, 若低於指定溫度則開啟加熱器
  2063. $.get('/ferment_SHT11_' + tank_num, '', function(res){
  2064. if (res.SHT11_Temp < testing_tank_temp_F){
  2065. tankHeater1_ON()
  2066. console.log("tankHeater1_ON")
  2067. tankHeater2_ON()
  2068. console.log("tankHeater2_ON")
  2069. }
  2070. });
  2071. Fermenting_F_interval = setInterval(Fermenting_F, 5000);
  2072. } else {
  2073. tankVacuum_ON()
  2074. console.log("tankVacuum_ON")
  2075. var time = new Date();
  2076. while ((new Date() - time) < 2 * 1000) { };
  2077. tankVacuum_OFF()
  2078. console.log("tankVacuum_OFF")
  2079. }
  2080. BeanIn_F_Process = 0;
  2081. },
  2082. error:function(thrownError){
  2083. console.log("Error: " + thrownError)
  2084. BeanIn_F_Process = 0;
  2085. }
  2086. });
  2087. };
  2088. // 出水排豆排程
  2089. var WaterBeanOut_F_interval
  2090. function Fermenting_F(){
  2091. var testing_tank_temp_F = $("input[name=testing_tank_temp_F]").val();
  2092. var testing_tank_time_F = $("input[name=testing_tank_time_F]").val();
  2093. if (Fermenting_F_Process == 1) {
  2094. return;
  2095. }
  2096. // 取得現在溫度
  2097. Fermenting_F_Process = 1;
  2098. $.ajax({
  2099. async:false,
  2100. type:"GET",
  2101. url:"/ferment_SHT11_" + tank_num,
  2102. dataType:"json",
  2103. success:function(response){
  2104. var present_Temp = response.SHT11_Temp
  2105. console.log("現在溫度: " + present_Temp)
  2106. if (present_Temp > testing_tank_temp_F) {
  2107. clearInterval(Fermenting_F_interval)
  2108. console.log("已達指定溫度!")
  2109. tankHeater1_OFF()
  2110. console.log("tankHeater1_OFF")
  2111. tankHeater2_OFF()
  2112. console.log("tankHeater2_OFF")
  2113. console.log("發酵 " + testing_tank_time_F + " 秒")
  2114. var time = new Date();
  2115. while ((new Date() - time) < testing_tank_time_F * 1000) { };
  2116. tankMotor_OFF()
  2117. console.log("tankMotor_OFF")
  2118. WaterBeanOut_F_interval = setInterval(WaterBeanOut_F, 5000);
  2119. }
  2120. Fermenting_F_Process = 0;
  2121. },
  2122. error:function(thrownError){
  2123. console.log("Error: " + thrownError)
  2124. Fermenting_F_Process = 0;
  2125. }
  2126. });
  2127. };
  2128. function WaterBeanOut_F(){
  2129. // -- 出料 --
  2130. // 設定空桶高度
  2131. var testing_tank_empty_height_F = $("input[name=testing_tank_empty_height_F]").val();
  2132. console.log("設定空桶高度: " + testing_tank_empty_height_F)
  2133. if (WaterBeanOut_F_Process == 1){
  2134. return;
  2135. }
  2136. // 取得桶內生豆高度
  2137. WaterBeanOut_F_Process = 1;
  2138. $.ajax({
  2139. async:false,
  2140. type:"GET",
  2141. url:"/ferment_LiDAR_" + tank_num,
  2142. dataType:"json",
  2143. success:function(response){
  2144. var present_Bean_height = response.LiDAR
  2145. console.log("目前發酵豆高: " + present_Bean_height)
  2146. if (present_Bean_height > testing_tank_empty_height_F) {
  2147. outputVacuum_ON()
  2148. console.log("outputVacuum_ON")
  2149. var time = new Date();
  2150. while ((new Date() - time) < 2 * 1000) { };
  2151. outputVacuum_OFF()
  2152. console.log("outputVacuum_OFF")
  2153. } else {
  2154. clearInterval(WaterBeanOut_F_interval);
  2155. console.log("發酵完成!槽內已無生豆")
  2156. }
  2157. WaterBeanOut_F_Process = 0;
  2158. },
  2159. error:function(thrownError){
  2160. console.log("Error: " + thrownError)
  2161. WaterBeanOut_F_Process = 0;
  2162. }
  2163. })
  2164. };
  2165. }
  2166. </script>
  2167. </td>
  2168. <td>
  2169. <button type="submit" class="btn btn-primary" onclick="WaterIn_testing()">入水測試</button>
  2170. <script>
  2171. var WaterIn_Process = 0; // 發酵槽入水狀態
  2172. function WaterIn_testing() {
  2173. var testing_tank_water_height = $("input[name=testing_tank_water_height]").val();
  2174. console.log('testing_tank_water_height: ' + testing_tank_water_height)
  2175. $.get('/ferment_PressureWaterLevel_' + tank_num, '', function (res) {
  2176. if ( res.PressureWaterLevel < testing_tank_water_height ){
  2177. console.log('開始入水')
  2178. tankSolenoidWaterIn_ON();
  2179. console.log('tankSolenoidWaterIn_ON')
  2180. console.log('請開啟水龍頭進水')
  2181. var time = new Date();
  2182. while ((new Date() - time) < 1000) { };
  2183. };
  2184. }, 'json');
  2185. var WaterIn_interval = setInterval(tankWaterIn, 5000);
  2186. function tankWaterIn(){
  2187. if(WaterIn_Process == 1){
  2188. return;
  2189. }
  2190. WaterIn_Process = 1;
  2191. $.ajax({
  2192. type:"GET",
  2193. url:'/ferment_PressureWaterLevel_' + tank_num,
  2194. dataType:'json',
  2195. success:function(response){
  2196. var present_water_height = response.PressureWaterLevel
  2197. console.log('目前水位高度: ' + present_water_height)
  2198. if( parseInt(present_water_height) >= parseInt(testing_tank_water_height) ){
  2199. clearInterval(WaterIn_interval);
  2200. console.log('達到目標水位!')
  2201. console.log('請關閉水龍頭')
  2202. var time = new Date();
  2203. while ((new Date() - time) < 1000) { };
  2204. tankSolenoidWaterIn_OFF();
  2205. console.log('tankSolenoidWaterIn_OFF')
  2206. }
  2207. WaterIn_Process = 0;
  2208. },
  2209. error:function(thrownError){
  2210. console.log("Error: " + thrownError)
  2211. WaterIn_Process = 0;
  2212. }
  2213. });
  2214. WaterIn_Process = 0;
  2215. }
  2216. };
  2217. </script>
  2218. </td>
  2219. <td>
  2220. <button type="submit" class="btn btn-primary" onclick="CoffeeIn_testing()">入豆測試</button>
  2221. <script>
  2222. CoffeeIn_Process = 0; // 生豆入豆狀態
  2223. function CoffeeIn_testing() {
  2224. var testing_tank_coffee_height = $("input[name=testing_tank_coffee_height]").val();
  2225. console.log('目標入料高度' + testing_tank_coffee_height)
  2226. var testing_tank_vacuum_in = $("input[name=testing_tank_vacuum_in]").val();
  2227. var testing_tank_vacuum_out = $("input[name=testing_tank_vacuum_out]").val();
  2228. var testing_tank_vacuum_loop = $("input[name=testing_tank_vacuum_loop]").val();
  2229. if (testing_tank_coffee_height != 0) {
  2230. console.log('以目標高度入豆')
  2231. var Coffee_interval = setInterval(tankCoffeeHeight, 5000);
  2232. function tankCoffeeHeight(){
  2233. if (CoffeeIn_Process == 1){
  2234. return;
  2235. }
  2236. CoffeeIn_Process = 1;
  2237. $.ajax({
  2238. async:false,
  2239. type:'GET',
  2240. url:'/ferment_LiDAR_' + tank_num,
  2241. dataType:'JSON',
  2242. success:function(response){
  2243. var present_Coffee_height = response.LiDAR
  2244. console.log("目前生豆高度: ", present_Coffee_height)
  2245. if( present_Coffee_height >= testing_tank_coffee_height){
  2246. clearInterval(Coffee_interval);
  2247. console.log("生豆已達目標高度!")
  2248. CoffeeIn_Process = 0;
  2249. } else {
  2250. tankVacuum_ON()
  2251. console.log('tankVacuum_ON')
  2252. var time = new Date();
  2253. while ((new Date() - time) < testing_tank_vacuum_in * 1000) { };
  2254. tankVacuum_OFF()
  2255. console.log('tankVacuum_OFF')
  2256. var time = new Date();
  2257. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2258. CoffeeIn_Process = 0;
  2259. }
  2260. },
  2261. error:function(thrownError){
  2262. console.log("Error: " + thrownError)
  2263. CoffeeIn_Process = 0;
  2264. }
  2265. });
  2266. CoffeeIn_Process = 0;
  2267. };
  2268. } else if (testing_tank_coffee_height == 0){
  2269. console.log('開始循環入豆')
  2270. for (step = 1; step <= testing_tank_vacuum_loop; step++) {
  2271. console.log('-- 循環第 ' + step + ' 次 --');
  2272. tankVacuum_ON()
  2273. console.log('tankVacuum_ON')
  2274. var time = new Date();
  2275. while ((new Date() - time) < testing_tank_vacuum_in * 1000) { };
  2276. tankVacuum_OFF()
  2277. console.log('tankVacuum_OFF')
  2278. var time = new Date();
  2279. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2280. }
  2281. console.log('-- 循環入豆結束 --')
  2282. }
  2283. }
  2284. </script>
  2285. </td>
  2286. <td>
  2287. <button type="submit" class="btn btn-primary" onclick="WATER_testing()">水質測量(攪拌、加熱)</button>
  2288. <script>
  2289. function WATER_testing() {
  2290. var set_motor_rpm = $("input[name=testing_motor_rpm]").val();
  2291. var data = { "tank_num": "C" + tank_num, "command": "tank_motor_status", "value": set_motor_rpm };
  2292. $.post('/mqtt/{{tid}}', data, function (res) {
  2293. console.log('data:', data)
  2294. if (res == 'on') {
  2295. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  2296. } else if (res == 'off') {
  2297. clearInterval(timer); // 取消 timer 的不斷執行
  2298. } else {
  2299. };
  2300. }, 'text')
  2301. // setTimeout(function () { location.reload(); }, 500);
  2302. console.log('motor rpm:' + set_motor_rpm)
  2303. var time = new Date();
  2304. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2305. tankHeater1_ON()
  2306. console.log('tankHeater1_ON')
  2307. var time = new Date();
  2308. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2309. tankHeater2_ON()
  2310. console.log('tankHeater2_ON')
  2311. console.log('暫停 5 秒鐘')
  2312. var time = new Date();
  2313. while ((new Date() - time) < 5 * 1000) { };
  2314. var testing_tank_pump_on = $("input[name=testing_tank_pump_on]").val();
  2315. var testing_tank_pump_off = $("input[name=testing_tank_pump_off]").val();
  2316. var testing_tank_pump_loop = $("input[name=testing_tank_pump_loop]").val();
  2317. for (step = 1; step <= testing_tank_pump_loop; step++) {
  2318. console.log('-- pump 循環第 ' + step + ' 次 --')
  2319. tankPumpSensor_ON()
  2320. console.log('tankPumpSensor_ON')
  2321. var time = new Date();
  2322. while ((new Date() - time) < testing_tank_pump_on * 1000) { };
  2323. tankPumpSensor_OFF()
  2324. console.log('tankPumpSensor_OFF')
  2325. var time = new Date();
  2326. while ((new Date() - time) < testing_tank_pump_off * 1000) { };
  2327. }
  2328. console.log('暫停 5 秒鐘')
  2329. var time = new Date();
  2330. while ((new Date() - time) < 5 * 1000) { };
  2331. tankMotor_OFF()
  2332. console.log('tankMotor_OFF')
  2333. var time = new Date();
  2334. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2335. tankHeater1_OFF()
  2336. console.log('tankHeater1_OFF')
  2337. var time = new Date();
  2338. while ((new Date() - time) < testing_tank_vacuum_out * 1000) { };
  2339. tankHeater2_OFF()
  2340. console.log('tankHeater2_OFF')
  2341. };
  2342. </script>
  2343. </td>
  2344. <td>
  2345. <button type="submit" class="btn btn-primary" onclick="CoffeeOut_testing()">排水出豆</button>
  2346. <script>
  2347. var CoffeeOut_process = 0;
  2348. function CoffeeOut_testing() {
  2349. var testing_tank_empty_height = $("input[name=testing_tank_empty_height]").val();
  2350. var testing_out_vacuum_in = $("input[name=testing_out_vacuum_in]").val();
  2351. var testing_out_vacuum_out = $("input[name=testing_out_vacuum_out]").val();
  2352. var testing_out_vacuum_loop = $("input[name=testing_out_vacuum_loop]").val();
  2353. if (testing_tank_empty_height != 0){
  2354. console.log('指定高度 ' + testing_tank_empty_height + ' 入豆')
  2355. $.get('/ferment_LiDAR_' + tank_num, '', function (res) {
  2356. if ( parseInt(res.LiDAR) > parseInt(testing_tank_empty_height) ){
  2357. tankDiskValve_ON()
  2358. console.log('tankDiskValve_ON')
  2359. };
  2360. }, 'json');
  2361. var CoffeeOut_interval = setInterval(tankEmptyHeight, 5000);
  2362. function tankEmptyHeight(){
  2363. if (CoffeeOut_process == 1) {
  2364. return;
  2365. }
  2366. CoffeeOut_process = 1 ;
  2367. $.ajax({
  2368. type:"GET",
  2369. url:"/ferment_LiDAR_" + tank_num,
  2370. dataType:"json",
  2371. success:function (response) {
  2372. var present_Coffee_height = response.LiDAR
  2373. console.log("目前桶內生豆高度: ", present_Coffee_height)
  2374. console.log("指定空桶生豆高度: ", testing_tank_empty_height)
  2375. if( parseInt(present_Coffee_height) < parseInt(testing_tank_empty_height)){
  2376. clearInterval(CoffeeOut_interval);
  2377. console.log("桶內已淨空!")
  2378. CoffeeOut_process = 0;
  2379. } else {
  2380. outputVacuum_ON();
  2381. console.log('outputVacuum_ON')
  2382. var time = new Date();
  2383. while ((new Date() - time) < testing_out_vacuum_in * 1000) { };
  2384. outputVacuum_OFF()
  2385. console.log('outputVacuum_OFF')
  2386. var time = new Date();
  2387. while ((new Date() - time) < testing_out_vacuum_out * 1000) { };
  2388. CoffeeOut_process = 0;
  2389. }
  2390. },
  2391. error:function(thrownError){
  2392. console.log("Error: " + thrownError)
  2393. CoffeeIn_Process = 0;
  2394. }
  2395. })
  2396. }
  2397. tankDiskValve_OFF()
  2398. console.log('tankDiskValve_OFF')
  2399. } else if ( testing_tank_empty_height == 0){
  2400. console.log('循環方式入豆')
  2401. for (step = 1; step <= testing_out_vacuum_loop; step++) {
  2402. console.log('循環第 ' + step + ' 次')
  2403. outputVacuum_ON();
  2404. console.log('outputVacuum_ON')
  2405. var time = new Date();
  2406. while ((new Date() - time) < testing_out_vacuum_in * 1000) { };
  2407. if (step == 1) {
  2408. tankDiskValve_ON();
  2409. console.log('tankDiskValve_ON')
  2410. var time = new Date();
  2411. while ((new Date() - time) < testing_out_vacuum_in * 1000) { };
  2412. }
  2413. outputVacuum_OFF();
  2414. console.log('outputVacuum_OFF')
  2415. var time = new Date();
  2416. while ((new Date() - time) < testing_out_vacuum_out * 1000) { };
  2417. }
  2418. tankDiskValve_OFF();
  2419. console.log('tankDiskValve_OFF')
  2420. };
  2421. };
  2422. </script>
  2423. </td>
  2424. </tr>
  2425. </table>
  2426. <br>
  2427. <h4>攝影機畫面</h4>
  2428. <div class="container-fluid">
  2429. <div class="row" style="margin-top:5px;">
  2430. <div class="col flex">
  2431. <div class="col-md-12 row flex" style="text-align:center;margin-top:5px;">
  2432. <div class="col-md-12 row flex">
  2433. <img src="" id="two" width="80%" height="80%">
  2434. </div>
  2435. </div>
  2436. <script>
  2437. // M5 攝影機
  2438. //const img = document.querySelector('#one');
  2439. const img1 = document.querySelector('#two');
  2440. const WS_URL1 = 'ws:///60.250.156.230:8089';
  2441. const ws1 = new WebSocket(WS_URL1);
  2442. let urlObject1;
  2443. ws1.onopen = () => console.log(`Connected to ${WS_URL1}`);
  2444. ws1.onmessage = message1 => {
  2445. const arrayBuffer1 = message1.data;
  2446. if (urlObject1) {
  2447. URL.revokeObjectURL(urlObject1);
  2448. }
  2449. urlObject1 = URL.createObjectURL(new Blob([arrayBuffer1]));
  2450. img1.src = urlObject1;
  2451. }
  2452. </script>
  2453. </div>
  2454. </div>
  2455. </div>
  2456. <br>
  2457. <h4>水路排程測試</h4>
  2458. [保溫夾層] 水位高度:<span id="WaterLevel_t_status">{{WaterLevel}}</span>
  2459. <table style="font-size:18px; border:2px #cccccc solid;" cellpadding="5" border='1' width=100%>
  2460. <tr>
  2461. <td colspan="2">桶內進水</td>
  2462. <td colspan="2">保溫夾層進水</td>
  2463. <td colspan="2">消毒/打菌</td>
  2464. <td colspan="2">感測器 pump 進水</td>
  2465. </tr>
  2466. <tr>
  2467. <td>桶內進水 ON</td>
  2468. <td>桶內進水 OFF</td>
  2469. <td>保溫夾層進水 ON</td>
  2470. <td>保溫夾層進水 OFF</td>
  2471. <td>消毒/打菌 ON</td>
  2472. <td>消毒/打菌 OFF</td>
  2473. <td>感測器 pump 進水 ON</td>
  2474. <td>感測器 pump 進水 OFF</td>
  2475. </tr>
  2476. <tr>
  2477. <td>保溫夾層電磁閥 OFF<br>桶內電磁閥 ON<br><font color="#FF0000">水龍頭 ON</font></td>
  2478. <td><font color="#FF0000">水龍頭 OFF</font><br>桶內電磁閥 OFF</td>
  2479. <td>桶內電磁閥 OFF<br>保溫夾層電磁閥 ON<br><font color="#FF0000">水龍頭 ON</font></td>
  2480. <td><font color="#FF0000">水龍頭 OFF</font><br>保溫夾層電磁閥 OFF</td>
  2481. <td>消毒電磁閥 ON<br><font color="#FF0000">水龍頭 ON</font></td>
  2482. <td><font color="#FF0000">水龍頭 OFF</font><br>消毒電磁閥 OFF</td>
  2483. <td>桶內電磁閥 ON<br>pump ON</td>
  2484. <td>pump OFF<br>桶內電磁閥 OFF</td>
  2485. </tr>
  2486. <tr>
  2487. <td>
  2488. <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_ON_testing()">桶內進水 ON</button>
  2489. <script>
  2490. // 保溫夾層電磁閥 OFF<br>桶內電磁閥 ON<br>總進水電磁閥 ON<br><font color="#FF0000">水龍頭 ON</font>
  2491. function tank_WaterIn_ON_testing(){
  2492. outerSolenoidWater_OFF()
  2493. console.log('outerSolenoidWater_OFF')
  2494. var time = new Date();
  2495. while ((new Date() - time) < 1000) { };
  2496. tankSolenoidWaterIn_ON()
  2497. console.log('tankSolenoidWaterIn_ON')
  2498. console.log('請開啟水龍頭進水')
  2499. }
  2500. </script>
  2501. </td>
  2502. <td>
  2503. <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_OFF_testing()">桶內進水 OFF</button>
  2504. <script>
  2505. // <font color="#FF0000">水龍頭 OFF</font><br>總進水電磁閥 OFF<br>桶內電磁閥 OFF
  2506. function tank_WaterIn_OFF_testing(){
  2507. console.log('請關閉水龍頭進水')
  2508. var time = new Date();
  2509. while ((new Date() - time) < 1000) { };
  2510. tankSolenoidWaterIn_OFF()
  2511. console.log('tankSolenoidWaterIn_OFF')
  2512. }
  2513. </script>
  2514. </td>
  2515. <td>
  2516. <button type="submit" class="btn btn-primary" onclick="outer_WaterIn_ON_testing()">保溫夾層進水 ON</button>
  2517. <script>
  2518. // 桶內電磁閥 OFF<br>保溫夾層電磁閥 ON<br>總進水電磁閥 ON<br><font color="#FF0000">水龍頭 ON
  2519. function outer_WaterIn_ON_testing(){
  2520. tankSolenoidWaterIn_OFF()
  2521. console.log('tankSolenoidWaterIn_OFF')
  2522. var time = new Date();
  2523. while ((new Date() - time) < 1000) { };
  2524. outerSolenoidWater_ON()
  2525. console.log('outerSolenoidWater_ON')
  2526. var time = new Date();
  2527. while ((new Date() - time) < 1000) { };
  2528. console.log('請開啟水龍頭進水')
  2529. }
  2530. </script>
  2531. </td>
  2532. <td>
  2533. <button type="submit" class="btn btn-primary" onclick="outer_WaterIn_OFF_testing()">保溫夾層進水 OFF</button>
  2534. <script>
  2535. // <font color="#FF0000">水龍頭 OFF</font><br>總進水電磁閥 OFF<br>保溫夾層電磁閥 OFF
  2536. function outer_WaterIn_OFF_testing(){
  2537. console.log('請關閉水龍頭進水')
  2538. var time = new Date();
  2539. while ((new Date() - time) < 1000) { };
  2540. outerSolenoidWater_OFF()
  2541. console.log('outerSolenoidWater_OFF')
  2542. }
  2543. </script>
  2544. </td>
  2545. <td>
  2546. <button type="submit" class="btn btn-primary" onclick="tank_Disinfect_ON_testing()">消毒/打菌 ON</button>
  2547. <script>
  2548. // 消毒電磁閥 ON<br><font color="#FF0000">水龍頭 ON</font>
  2549. function tank_Disinfect_ON_testing(){
  2550. tankSolenoidDisinfect_ON()
  2551. console.log('tankSolenoidDisinfect_ON')
  2552. var time = new Date();
  2553. while ((new Date() - time) < 1000) { };
  2554. console.log('請開啟水龍頭進水')
  2555. }
  2556. </script>
  2557. </td>
  2558. <td>
  2559. <button type="submit" class="btn btn-primary" onclick="tank_Disinfect_OFF_testing()">消毒/打菌 OFF</button>
  2560. <script>
  2561. // <font color="#FF0000">水龍頭 OFF</font><br>消毒電磁閥 OFF
  2562. function tank_Disinfect_OFF_testing(){
  2563. console.log('請關閉水龍頭進水')
  2564. var time = new Date();
  2565. while ((new Date() - time) < 1000) { };
  2566. tankSolenoidDisinfect_OFF()
  2567. console.log('tankSolenoidDisinfect_OFF')
  2568. }
  2569. </script>
  2570. </td>
  2571. <td>
  2572. <button type="submit" class="btn btn-primary" onclick="tank_SensorPump_ON_testing()">感測器 pump 進水 ON</button>
  2573. <script>
  2574. // 桶內電磁閥 ON<br>pump ON
  2575. function tank_SensorPump_ON_testing(){
  2576. tankSolenoidWaterIn_ON()
  2577. console.log('tankSolenoidWaterIn_ON')
  2578. var time = new Date();
  2579. while ((new Date() - time) < 2 * 1000) { };
  2580. tankPumpSensor_ON()
  2581. console.log('tankPumpSensor_ON')
  2582. }
  2583. </script>
  2584. </td>
  2585. <td>
  2586. <button type="submit" class="btn btn-primary" onclick="tank_SensorPump_OFF_testing()">感測器 pump 進水 OFF</button>
  2587. <script>
  2588. // pump OFF<br>桶內電磁閥 OFF
  2589. function tank_SensorPump_OFF_testing(){
  2590. tankPumpSensor_OFF()
  2591. console.log('tankPumpSensor_OFF')
  2592. var time = new Date();
  2593. while ((new Date() - time) < 2 * 1000) { };
  2594. tankSolenoidWaterIn_OFF()
  2595. console.log('tankSolenoidWaterIn_OFF')
  2596. }
  2597. </script>
  2598. </td>
  2599. </tr>
  2600. </table>
  2601. <br>
  2602. <!--
  2603. 入料儲豆槽液位計高度 公分{{input_UltraSonic.UltraSonic}}
  2604. <div id="input_UltraSonic" d={{input_UltraSonic.UltraSonic}} style="display:none"></div>
  2605. <br>
  2606. 溫溼度感測器 溫度 ℃{{tank_SHT11.SHT11_Temp}}
  2607. <div id="tank_Temp" d={{tank_SHT11.SHT11_Temp}} style="display:none"></div>
  2608. <br>
  2609. 溫溼度感測器 濕度 %{{tank_SHT11.SHT11_Humidity}}
  2610. <div id="tank_EC" d={{tank_SHT11.SHT11_Humidity}} style="display:none"></div>
  2611. <br>
  2612. 二氧化碳 CO2{{tank_CO2.CO2}}
  2613. <div id="tank_CO2" d={{tank_CO2.CO2}} style="display:none"></div>
  2614. <br>
  2615. 酸鹼值 PH{{tank_PH.PH}}
  2616. <div id="tank_PH" d={{tank_PH.PH}} style="display:none"></div>
  2617. <br>
  2618. 桶內壓力 PA{{tank_PA.PA}}
  2619. <div id="tank_PA" d={{tank_PA.PA}} style="display:none"></div>
  2620. <br>
  2621. 發酵槽液位計高度 公分{{tank_UltraSonic.UltraSonic}}
  2622. <div id="tank_UltraSonic" d={{tank_UltraSonic.UltraSonic}} style="display:none"></div>
  2623. <br>
  2624. 出料儲豆槽液位計高度 公分{{output_UltraSonic.UltraSonic}}
  2625. <div id="output_UltraSonic" d={{output_UltraSonic.UltraSonic}} style="display:none"></div>
  2626. -->
  2627. <footer class="footer">
  2628. <div style="text-align: center; margin-top: 10px; font-size: 13px; margin-bottom: 10px;">
  2629. Copyright © 2021 Gold-in Tech. All Rights Reserved. 金子進科技股份有限公司 版權所有
  2630. <a href="mailto:service.gitc@gmail.com" target="_blank">service.gitc@gmail.com</a>
  2631. </div>
  2632. </footer>
  2633. </body>
  2634. </html>