ferment_container_0813.html 131 KB

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