dry_container_tank.html 105 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ title }}</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <meta http-equiv="refresh" content="300" /><!-- <meta http-equiv="refresh" content="5" /> 每 content 秒網頁自動更新-->
  8. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  9. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  10. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  11. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  12. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  13. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  14. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  15. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  16. <!--可用來建立使用者小圖示-->
  17. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  18. <script language="JavaScript">
  19. // 指定 秒 刷新網頁一次
  20. var dtn = '{{tid}}';
  21. var status = '{{status}}';
  22. console.log('dtn:' + dtn)
  23. $(function(){
  24. $("#coffee_title").text("D" + dtn + " 乾燥槽操作介面");
  25. $("#dry_tank_page").text('乾燥槽 D' + dtn + ' 攝影機畫面 ')
  26. $('#dry_tank_page').attr("href", "/camera_D" + dtn)
  27. $("#dry_container_tank_title").text('乾燥槽 D' + dtn + ' 操作介面')
  28. if (status == 2) {
  29. $('input').prop('disabled', true);
  30. $('button').prop('disabled', true);
  31. } else if ( (status == 0) || (status == 1) ) {
  32. $('input').prop('disabled', false);
  33. $('button').prop('disabled', false);
  34. }
  35. });
  36. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 30 * 1000)
  37. </script>
  38. <style>
  39. .footer{
  40. position: absolute;
  41. width: 100%;
  42. background-color: #eee;
  43. text-align: center;
  44. }
  45. body {
  46. margin: 0;
  47. }
  48. .navbar-dark .navbar-nav .nav-link {
  49. color: white;
  50. cursor: pointer;
  51. text-decoration: none;
  52. width: 110px;
  53. height: 46px;
  54. }
  55. .nav-top {
  56. line-height: 40px;
  57. background-color: #C4C4C4;
  58. }
  59. .website_title {
  60. font-family: Roboto;
  61. font-style: normal;
  62. font-weight: normal;
  63. font-size: 30px;
  64. color: #000000;
  65. }
  66. .navbar-nav>li {
  67. float: none;
  68. display: inline-block;
  69. width: 100px;
  70. margin: 0 auto;
  71. text-align: center;
  72. }
  73. .navbar-nav>li a {
  74. font-size: 20px;
  75. }
  76. .main-page {
  77. margin-top: 200px;
  78. }
  79. .page-title {
  80. font-family: Roboto;
  81. font-style: normal;
  82. font-weight: bold;
  83. font-size: 36px;
  84. }
  85. .flex {
  86. display: flex;
  87. flex-direction: row;
  88. flex-wrap: wrap;
  89. justify-content: center;
  90. }
  91. .set-link {
  92. display: inline-block;
  93. width: 350px;
  94. height: 100px;
  95. line-height: 100px;
  96. background: #008CBA;
  97. border: 1px solid #CFCFCF;
  98. box-sizing: border-box;
  99. color: #FFFFFF;
  100. border-radius: 10px;
  101. font-size: 36px;
  102. }
  103. .cmn-toggle {
  104. position: absolute;
  105. margin-left: 0px;
  106. visibility: hidden;
  107. }
  108. .cmn-toggle+label {
  109. display: block;
  110. position: relative;
  111. cursor: pointer;
  112. outline: none;
  113. user-select: none;
  114. }
  115. input.cmn-toggle-round-flat+label {
  116. padding: 2px;
  117. width: 60px;
  118. height: 30px;
  119. background-color: #C0C0C0;
  120. border-radius: 60px;
  121. transition: background 0.4s;
  122. }
  123. input.cmn-toggle-round-flat+label:before,
  124. input.cmn-toggle-round-flat+label:after {
  125. display: block;
  126. position: absolute;
  127. content: "";
  128. }
  129. input.cmn-toggle-round-flat+label:before {
  130. top: 2px;
  131. left: 2px;
  132. bottom: 2px;
  133. right: 2px;
  134. background-color: #fff;
  135. border-radius: 60px;
  136. transition: background 0.4s;
  137. }
  138. input.cmn-toggle-round-flat+label:after {
  139. top: 4px;
  140. left: 4px;
  141. bottom: 4px;
  142. width: 24px;
  143. background-color: #dddddd;
  144. border-radius: 52px;
  145. transition: margin 0.4s, background 0.4s;
  146. }
  147. input.cmn-toggle-round-flat:checked+label {
  148. background-color: #C0C0C0;
  149. }
  150. input.cmn-toggle-round-flat:checked+label:after {
  151. margin-left: 27px;
  152. background-color: #008CBA;
  153. }
  154. @media(max-width:373px) {
  155. .card {
  156. margin-right: 0px;
  157. }
  158. .set-link {
  159. width: 250px;
  160. }
  161. }
  162. @media(max-width:577px) {}
  163. @media(min-width:576px) {}
  164. @media(min-width:768px) {
  165. .navbar-nav>li {
  166. margin-left: 0px;
  167. }
  168. .navbar-nav .li-block {
  169. display: none;
  170. }
  171. }
  172. @media(min-width:991px) {
  173. .navbar-nav>li {
  174. margin-left: 20px;
  175. }
  176. .navbar-nav .li-block {
  177. display: none;
  178. }
  179. }
  180. @media(min-width:1200px) {
  181. .navbar-nav>li {
  182. margin-left: 50px;
  183. }
  184. .navbar-nav .li-block {
  185. display: inline-block;
  186. width: 100px;
  187. }
  188. }
  189. @media(min-width:1400px) {
  190. .navbar-nav .li-block {
  191. display: inline-block;
  192. width: 200px;
  193. }
  194. }
  195. @media(min-width:1689px) {
  196. .navbar-nav>li {
  197. margin-left: 50px;
  198. }
  199. .navbar-nav .li-block {
  200. display: inline-block;
  201. width: 500px;
  202. }
  203. }
  204. </style>
  205. <script>
  206. // Rita 制動器運作
  207. var tank_num = '{{tid}}';
  208. // Benson 真空吸料機 (END)入料儲豆槽
  209. // Benson 真空吸料機 (START)
  210. function tankVacuum() {
  211. var status = "off";
  212. var check = $("input[name=tank_vacuum_status]:checked");
  213. console.log('check:', check);
  214. //大於0代表有被選中
  215. if (check.length > 0) {
  216. status = "on";
  217. $("#cmn-toggle-05").prop('checked', false);
  218. if (!confirm("你確定要開啟真空吸料機嗎?")) {
  219. return false;
  220. };
  221. } else {
  222. $("#cmn-toggle-05").prop('checked', true);
  223. if (!confirm("你確定要關閉真空吸料機嗎?")) {
  224. return false;
  225. };
  226. };
  227. var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": status };
  228. $.post('/mqtt/{{tid}}', data, function (res) {
  229. console.log('data:', data)
  230. if (res == 'on') {
  231. $("#cmn-toggle-05").prop('checked', true);
  232. setTimeout("alert('真空吸料機_開啟成功!')", 500);
  233. } else if (res == 'off') {
  234. $("#cmn-toggle-05").prop('checked', false);
  235. setTimeout("alert('真空吸料機_關閉成功!')", 500);
  236. } else {
  237. alert(res);
  238. };
  239. }, 'text')
  240. $.get('/loading/D{{tid}}', '', function (res) {
  241. if (res.tank_vacuum == 0) {
  242. $("#cmn-toggle-05").prop('checked', false);
  243. } else if (res.tank_vacuum == 1) {
  244. $("#cmn-toggle-05").prop('checked', true);
  245. }
  246. }, 'json');
  247. };
  248. function tankVacuum_ON() {
  249. var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": "on" };
  250. $.post('/mqtt/{{tid}}', data, function (res) {
  251. console.log('data:', data)
  252. if (res == 'on') {
  253. $("#cmn-toggle-05").prop('checked', true);
  254. } else if (res == 'off') {
  255. $("#cmn-toggle-05").prop('checked', false);
  256. } else {
  257. console.log('res error')
  258. };
  259. }, 'text')
  260. }
  261. function tankVacuum_OFF() {
  262. var data = { "tank_num": "D" + tank_num, "command": "tank_vacuum_status", "value": "off" };
  263. $.post('/mqtt/{{tid}}', data, function (res) {
  264. console.log('data:', data)
  265. if (res == 'on') {
  266. $("#cmn-toggle-05").prop('checked', true);
  267. } else if (res == 'off') {
  268. $("#cmn-toggle-05").prop('checked', false);
  269. } else {
  270. console.log('res error')
  271. };
  272. }, 'text')
  273. }
  274. // Benson 真空吸料機 (END)
  275. function tankThreeWayValve() {
  276. //<!--setInterval(Relay,10000);-->
  277. var status = "off";
  278. var check = $("input[name=tank_threewayvalve_status]:checked");
  279. //大於0代表有被選中
  280. if (check.length > 0) {
  281. status = "on";
  282. $("#cmn-toggle-08").prop('checked', false);
  283. if (!confirm("你確定要開啟三通閥嗎?")) {
  284. return false;
  285. };
  286. } else {
  287. $("#cmn-toggle-08").prop('checked', true);
  288. if (!confirm("你確定要關閉三通閥嗎?")) {
  289. return false;
  290. };
  291. };
  292. var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_status", "value": status };
  293. $.post('/mqtt/{{tid}}', data, function (res) {
  294. console.log('data:', data)
  295. if (res == 'on') {
  296. $("#cmn-toggle-08").prop('checked', true);
  297. setTimeout("alert('三通閥入料_開啟成功!')", 500);
  298. } else if (res == 'off') {
  299. $("#cmn-toggle-08").prop('checked', false);
  300. setTimeout("alert('三通閥排氣_關閉成功!')", 500);
  301. } else {
  302. alert(res);
  303. };
  304. }, 'text')
  305. $.get('/loading/D{{tid}}', '', function (res) {
  306. if (res.tank_threewayvalve == 0) {
  307. $("#cmn-toggle-08").prop('checked', false);
  308. } else if (res.tank_threewayvalve == 1) {
  309. $("#cmn-toggle-08").prop('checked', true);
  310. }
  311. }, 'json');
  312. };
  313. function tankThreeWayValve_ON() {
  314. var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_status", "value": "on" };
  315. $.post('/mqtt/{{tid}}', data, function (res) {
  316. console.log('data:', data)
  317. if (res == 'on') {
  318. $("#cmn-toggle-08").prop('checked', true);
  319. } else if (res == 'off') {
  320. $("#cmn-toggle-08").prop('checked', false);
  321. } else {
  322. console.log('res error')
  323. };
  324. }, 'text')
  325. }
  326. function tankThreeWayValve_OFF() {
  327. var data = { "tank_num": "D" + tank_num, "command": "tank_threewayvalve_status", "value": "off" };
  328. $.post('/mqtt/{{tid}}', data, function (res) {
  329. console.log('data:', data)
  330. if (res == 'on') {
  331. $("#cmn-toggle-08").prop('checked', true);
  332. } else if (res == 'off') {
  333. $("#cmn-toggle-08").prop('checked', false);
  334. } else {
  335. console.log('res error')
  336. };
  337. }, 'text')
  338. }
  339. // Benson cargo2_actuator.html 控制蝴蝶閥函數 (START)
  340. function tankDiskValve() {
  341. //<!--setInterval(Relay,10000);-->
  342. var status = "off";
  343. var check = $("input[name=tank_diskvalve_status]:checked");
  344. //大於0代表有被選中
  345. if (check.length > 0) {
  346. status = "on";
  347. $("#cmn-toggle-11").prop('checked', false);
  348. if (!confirm("你確定要開啟蝴蝶閥嗎?")) {
  349. return false;
  350. };
  351. } else {
  352. $("#cmn-toggle-11").prop('checked', true);
  353. if (!confirm("你確定要關閉蝴蝶閥嗎?")) {
  354. return false;
  355. };
  356. };
  357. var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": status };
  358. $.post('/mqtt/{{tid}}', data, function (res) {
  359. console.log('data:', data)
  360. if (res == 'on') {
  361. $("#cmn-toggle-11").prop('checked', true);
  362. setTimeout("alert('蝴蝶閥_開啟成功!')", 500);
  363. } else if (res == 'off') {
  364. $("#cmn-toggle-11").prop('checked', false);
  365. setTimeout("alert('蝴蝶閥_關閉成功!')", 500);
  366. } else {
  367. alert(res);
  368. };
  369. }, 'text')
  370. $.get('/loading/D{{tid}}', '', function (res) {
  371. if (res.tank_diskvalve == 0) {
  372. $("#cmn-toggle-11").prop('checked', false);
  373. } else if (res.tank_diskvalve == 1) {
  374. $("#cmn-toggle-11").prop('checked', true);
  375. }
  376. }, 'json');
  377. };
  378. function tankDiskValve_ON() {
  379. var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": "on" };
  380. $.post('/mqtt/{{tid}}', data, function (res) {
  381. console.log('data:', data)
  382. if (res == 'on') {
  383. $("#cmn-toggle-11").prop('checked', true);
  384. } else if (res == 'off') {
  385. $("#cmn-toggle-11").prop('checked', false);
  386. } else {
  387. console.log('res error')
  388. };
  389. }, 'text')
  390. }
  391. function tankDiskValve_OFF() {
  392. var data = { "tank_num": "D" + tank_num, "command": "tank_diskvalve_status", "value": "off" };
  393. $.post('/mqtt/{{tid}}', data, function (res) {
  394. console.log('data:', data)
  395. if (res == 'on') {
  396. $("#cmn-toggle-11").prop('checked', true);
  397. } else if (res == 'off') {
  398. $("#cmn-toggle-11").prop('checked', false);
  399. } else {
  400. console.log('res error')
  401. };
  402. }, 'text')
  403. }
  404. // Benson cargo2_actuator.html 控制蝴蝶閥函數 (END)
  405. // Benson cargo2_actuator.html 閥 (START) 電磁閥消毒
  406. function tankSolenoidDisinfect() {
  407. var status = "off";
  408. var check = $("input[name=tank_solenoid_disinfect_status]:checked");
  409. //大於0代表有被選中
  410. if (check.length > 0) {
  411. status = "on";
  412. $("#cmn-toggle-14").prop('checked', false);
  413. if (!confirm("你確定要開啟電磁閥消毒嗎?")) {
  414. return false;
  415. };
  416. } else {
  417. $("#cmn-toggle-14").prop('checked', true);
  418. if (!confirm("你確定要關閉消毒電磁閥嗎?")) {
  419. return false;
  420. };
  421. };
  422. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": status };
  423. $.post('/mqtt/{{tid}}', data, function (res) {
  424. console.log('data:', data)
  425. if (res == 'on') {
  426. $("#cmn-toggle-14").prop('checked', true);
  427. setTimeout("alert('電磁閥消毒_開啟成功!')", 500);
  428. } else if (res == 'off') {
  429. $("#cmn-toggle-14").prop('checked', false);
  430. setTimeout("alert('電磁閥消毒_關閉成功!')", 500);
  431. } else {
  432. alert(res);
  433. };
  434. }, 'text')
  435. $.get('/loading/D{{tid}}', '', function (res) {
  436. if (res.tank_solenoid_disinfect == 0) {
  437. $("#cmn-toggle-14").prop('checked', false);
  438. } else if (res.tank_solenoid_disinfect == 1) {
  439. $("#cmn-toggle-14").prop('checked', true);
  440. }
  441. }, 'json');
  442. };
  443. function tankSolenoidDisinfect_ON() {
  444. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "on" };
  445. $.post('/mqtt/{{tid}}', data, function (res) {
  446. console.log('data:', data)
  447. if (res == 'on') {
  448. $("#cmn-toggle-14").prop('checked', true);
  449. } else if (res == 'off') {
  450. $("#cmn-toggle-14").prop('checked', false);
  451. } else {
  452. console.log('res error')
  453. };
  454. }, 'text')
  455. }
  456. function tankSolenoidDisinfect_OFF() {
  457. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_disinfect_status", "value": "off" };
  458. $.post('/mqtt/{{tid}}', data, function (res) {
  459. console.log('data:', data)
  460. if (res == 'on') {
  461. $("#cmn-toggle-14").prop('checked', true);
  462. } else if (res == 'off') {
  463. $("#cmn-toggle-14").prop('checked', false);
  464. } else {
  465. console.log('res error')
  466. };
  467. }, 'text')
  468. }
  469. // Benson cargo2_actuator.html 閥 (END) 電磁閥消毒
  470. // Benson cargo2_actuator.html 閥 (START) 電磁閥排水
  471. function tankSolenoidWater() {
  472. var status = "off";
  473. var check = $("input[name=tank_solenoid_water_status]:checked");
  474. //大於0代表有被選中
  475. if (check.length > 0) {
  476. status = "on";
  477. $("#cmn-toggle-17").prop('checked', false);
  478. if (!confirm("你確定要開啟電磁閥排水嗎?")) {
  479. return false;
  480. };
  481. } else {
  482. $("#cmn-toggle-17").prop('checked', true);
  483. if (!confirm("你確定要關閉排水電磁閥嗎?")) {
  484. return false;
  485. };
  486. };
  487. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": status };
  488. $.post('/mqtt/{{tid}}', data, function (res) {
  489. console.log('data:', data)
  490. if (res == 'on') {
  491. $("#cmn-toggle-17").prop('checked', true);
  492. setTimeout("alert('電磁閥排水_開啟成功!')", 500);
  493. } else if (res == 'off') {
  494. $("#cmn-toggle-17").prop('checked', false);
  495. setTimeout("alert('電磁閥排水_關閉成功!')", 500);
  496. } else {
  497. alert(res);
  498. };
  499. }, 'text')
  500. $.get('/loading/D{{tid}}', '', function (res) {
  501. if (res.tank_solenoid_water == 0) {
  502. $("#cmn-toggle-17").prop('checked', false);
  503. } else if (res.tank_solenoid_water == 1) {
  504. $("#cmn-toggle-17").prop('checked', true);
  505. }
  506. }, 'json');
  507. };
  508. function tankSolenoidWater_ON() {
  509. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": "on" };
  510. $.post('/mqtt/{{tid}}', data, function (res) {
  511. console.log('data:', data)
  512. if (res == 'on') {
  513. $("#cmn-toggle-17").prop('checked', true);
  514. } else if (res == 'off') {
  515. $("#cmn-toggle-17").prop('checked', false);
  516. } else {
  517. console.log('res error')
  518. };
  519. }, 'text')
  520. }
  521. function tankSolenoidWater_OFF() {
  522. var data = { "tank_num": "D" + tank_num, "command": "tank_solenoid_water_status", "value": "off" };
  523. $.post('/mqtt/{{tid}}', data, function (res) {
  524. console.log('data:', data)
  525. if (res == 'on') {
  526. $("#cmn-toggle-17").prop('checked', true);
  527. } else if (res == 'off') {
  528. $("#cmn-toggle-17").prop('checked', false);
  529. } else {
  530. console.log('res error')
  531. };
  532. }, 'text')
  533. }
  534. // Benson cargo2_actuator.html 閥 (END) 電磁閥排水
  535. /*
  536. function Motor() {
  537. $.get('/peeling', '', function (res) {
  538. //console.log(res.peeling);
  539. $("#motor_rpm_status").text(res.peeling + ' rpm(每1分鐘更新一次)');
  540. }, 'json');
  541. };
  542. function ChangeMotor() {
  543. var motor_data = $("input[name=tank_motor_status]").val();
  544. if (!confirm("你確定要更改轉速為" + motor_data + "嗎?")) {
  545. return false;
  546. };
  547. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": motor_data };
  548. console.log('data:', data)
  549. $.post('/mqtt/{{tid}}', data, function (res) {
  550. if (res == 'on') {
  551. alert('更改成功');
  552. } else {
  553. alert(res);
  554. };
  555. }, 'text');
  556. setTimeout(function(){ location.reload(); }, 500);
  557. };
  558. */
  559. // Benson cargo2_actuator.html 脫皮機馬達 (START) 馬達攪拌棒
  560. function ChangeMotor() {
  561. var motor_data = $("input[id=motor_rpm_data]").val();
  562. if (motor_data == '') {
  563. //$("#cmn-toggle-20").prop('checked', false);
  564. alert("請先輸入要運轉的值!");
  565. return false;
  566. } else if (motor_data == 0) {
  567. alert("轉速 0 為關閉馬達");
  568. } else if (Number(motor_data) < -50 || Number(motor_data) > 50 || !Number(motor_data)) {
  569. //
  570. //$("#cmn-toggle-20").prop('checked', false);
  571. alert("您輸入的值已超過範圍,請重新輸入!" + !Number(motor_data));
  572. return false;
  573. };
  574. var value = "off";
  575. //var check = $("input[name=peeling-machine-on]:checked");
  576. if (motor_data != 0) {
  577. value = motor_data;
  578. //$("#cmn-toggle-20").prop('checked', false);
  579. if (!confirm("你確定要開啟攪拌馬達,運轉速度為 " + motor_data + " RPM 嗎?")) {
  580. return false;
  581. };
  582. } else {
  583. //$("#cmn-toggle-20").prop('checked', true);
  584. if (!confirm("你確定要關閉攪拌馬達嗎?")) {
  585. return false;
  586. };
  587. };
  588. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": motor_data };
  589. $.post('/mqtt/{{tid}}', data, function (res) {
  590. console.log('data:', data)
  591. if (res == 'on') {
  592. //$("#cmn-toggle-14").prop('checked', true); // prop 設置元素屬型與元素值, 設定 checked 屬性為 true
  593. setTimeout("alert('攪拌馬達_開啟成功!')", 500); // 設定時間執行函式 delay(500), 只執行一次
  594. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  595. } else if (res == 'off') {
  596. //$("#cmn-toggle-14").prop('checked', false);
  597. setTimeout("alert('攪拌馬達_關閉成功!')", 500);
  598. clearInterval(timer); // 取消 timer 的不斷執行
  599. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  600. } else {
  601. alert(res);
  602. };
  603. }, 'text')
  604. $.get('/loading/D{{tid}}', '', function (res) {
  605. $("#motor_rpm_data").attr("placeholder", res.tank_motor)
  606. }, 'json');
  607. };
  608. function setMotor(RPMData) {
  609. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": RPMData };
  610. $.post('/mqtt/' + tank_num, data, function (res) {
  611. console.log('data:', data)
  612. if (res == 'on') {
  613. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  614. } else if (res == 'off') {
  615. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  616. } else {
  617. console.log(res)
  618. };
  619. }, 'text')
  620. $.get('/loading/D' + tank_num, '', function (res) {
  621. $("#motor_rpm_data").attr("placeholder", res.tank_motor)
  622. }, 'json');
  623. };
  624. function ChangeMotor_ON() {
  625. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": "20" };
  626. $.post('/mqtt/{{tid}}', data, function (res) {
  627. console.log('data:', data)
  628. if (res == 'on') {
  629. var timer = setInterval(Rotate, 60000);
  630. } else if (res == 'off') {
  631. clearInterval(timer);
  632. $("#motor_rpm_status").text('');
  633. } else {
  634. console.log('res error')
  635. };
  636. }, 'text')
  637. }
  638. function ChangeMotor_OFF() {
  639. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": "0" };
  640. $.post('/mqtt/{{tid}}', data, function (res) {
  641. console.log('data:', data)
  642. if (res == 'on') {
  643. var timer = setInterval(Rotate, 60000);
  644. } else if (res == 'off') {
  645. clearInterval(timer);
  646. $("#motor_rpm_status").text('');
  647. } else {
  648. console.log('res error')
  649. };
  650. }, 'text')
  651. }
  652. function Rotate() {
  653. $.get('/peeling', '', function (res) {
  654. //console.log(res.peeling);
  655. $("#motor_rpm_status-status").text(res.peeling + ' rpm(每1分鐘更新一次)');
  656. }, 'json');
  657. setTimeout(function () { location.reload(); }, 500);
  658. };
  659. // Benson cargo2_actuator.html 脫皮機馬達 (END) 馬達攪拌棒
  660. // Benson cargo2_actuator.html 鼓風機機 (START)
  661. // 鼓風機函數
  662. function tankBlower() {
  663. var status = "off";
  664. var check = $("input[name=tank_blower_status]:checked");
  665. //大於0代表有被選中
  666. if (check.length > 0) {
  667. status = "on";
  668. $("#cmn-toggle-23").prop('checked', false);
  669. if (!confirm("你確定要開啟鼓風機嗎?")) {
  670. return false;
  671. };
  672. } else {
  673. $("#cmn-toggle-23").prop('checked', true);
  674. if (!confirm("你確定要關閉鼓風機嗎?")) {
  675. return false;
  676. };
  677. };
  678. var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": status };
  679. $.post('/mqtt/{{tid}}', data, function (res) {
  680. console.log('data:', data)
  681. if (res == 'on') {
  682. $("#cmn-toggle-23").prop('checked', true);
  683. setTimeout("alert('鼓風機_開啟成功!')", 500);
  684. } else if (res == 'off') {
  685. $("#cmn-toggle-23").prop('checked', false);
  686. setTimeout("alert('鼓風機_關閉成功!')", 500);
  687. } else {
  688. alert(res);
  689. };
  690. }, 'text')
  691. $.get('/loading/D{{tid}}', '', function (res) {
  692. if (res.tank_blower == 0) {
  693. $("#cmn-toggle-23").prop('checked', false);
  694. } else if (res.tank_blower == 1) {
  695. $("#cmn-toggle-23").prop('checked', true);
  696. }
  697. }, 'json');
  698. };
  699. function tankBlower_ON() {
  700. var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": "on" };
  701. $.post('/mqtt/{{tid}}', data, function (res) {
  702. console.log('data:', data)
  703. if (res == 'on') {
  704. $("#cmn-toggle-23").prop('checked', true);
  705. } else if (res == 'off') {
  706. $("#cmn-toggle-23").prop('checked', false);
  707. } else {
  708. console.log('res error')
  709. };
  710. }, 'text')
  711. }
  712. function tankBlower_OFF() {
  713. var data = { "tank_num": "D" + tank_num, "command": "tank_blower_status", "value": "off" };
  714. $.post('/mqtt/{{tid}}', data, function (res) {
  715. console.log('data:', data)
  716. if (res == 'on') {
  717. $("#cmn-toggle-23").prop('checked', true);
  718. } else if (res == 'off') {
  719. $("#cmn-toggle-23").prop('checked', false);
  720. } else {
  721. console.log('res error')
  722. };
  723. }, 'text')
  724. }
  725. // Benson cargo2_actuator.html 鼓風機 (START)
  726. //電熱管1函數
  727. function tankHeater1() {
  728. var status = "off";
  729. var check = $("input[name=tank_heater1_status]:checked");
  730. //大於0代表有被選中
  731. if (check.length > 0) {
  732. status = "on";
  733. $("#cmn-toggle-26").prop('checked', false);
  734. if (!confirm("你確定要開啟電熱管1嗎?")) {
  735. return false;
  736. };
  737. } else {
  738. $("#cmn-toggle-26").prop('checked', true);
  739. if (!confirm("你確定要關閉電熱管1嗎?")) {
  740. return false;
  741. };
  742. };
  743. var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": status };
  744. $.post('/mqtt/{{tid}}', data, function (res) {
  745. console.log('data:', data)
  746. if (res == 'on') {
  747. $("#cmn-toggle-26").prop('checked', true);
  748. setTimeout("alert('電熱管1_開啟成功!')", 500);
  749. } else if (res == 'off') {
  750. $("#cmn-toggle-26").prop('checked', false);
  751. setTimeout("alert('電熱管1_關閉成功!')", 500);
  752. } else {
  753. alert(res);
  754. };
  755. }, 'text')
  756. $.get('/loading/D{{tid}}', '', function (res) {
  757. if (res.tank_heater1 == 0) {
  758. $("#cmn-toggle-26").prop('checked', false);
  759. } else if (res.tank_heater1 == 1) {
  760. $("#cmn-toggle-26").prop('checked', true);
  761. }
  762. }, 'json');
  763. };
  764. function tankHeater1_ON() {
  765. var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": "on" };
  766. $.post('/mqtt/{{tid}}', data, function (res) {
  767. console.log('data:', data)
  768. if (res == 'on') {
  769. $("#cmn-toggle-26").prop('checked', true);
  770. } else if (res == 'off') {
  771. $("#cmn-toggle-26").prop('checked', false);
  772. } else {
  773. console.log('res error')
  774. };
  775. }, 'text')
  776. }
  777. function tankHeater1_OFF() {
  778. var data = { "tank_num": "D" + tank_num, "command": "tank_heater1_status", "value": "off" };
  779. $.post('/mqtt/{{tid}}', data, function (res) {
  780. console.log('data:', data)
  781. if (res == 'on') {
  782. $("#cmn-toggle-26").prop('checked', true);
  783. } else if (res == 'off') {
  784. $("#cmn-toggle-26").prop('checked', false);
  785. } else {
  786. console.log('res error')
  787. };
  788. }, 'text')
  789. };
  790. //電熱管2函數
  791. function tankHeater2() {
  792. var status = "off";
  793. var check = $("input[name=tank_heater2_status]:checked");
  794. //大於0代表有被選中
  795. if (check.length > 0) {
  796. status = "on";
  797. $("#cmn-toggle-29").prop('checked', false);
  798. if (!confirm("你確定要開啟電熱管2嗎?")) {
  799. return false;
  800. };
  801. } else {
  802. $("#cmn-toggle-29").prop('checked', true);
  803. if (!confirm("你確定要關閉電熱管2嗎?")) {
  804. return false;
  805. };
  806. };
  807. var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": status };
  808. $.post('/mqtt/{{tid}}', data, function (res) {
  809. console.log('data:', data)
  810. if (res == 'on') {
  811. $("#cmn-toggle-29").prop('checked', true);
  812. setTimeout("alert('電熱管2_開啟成功!')", 500);
  813. } else if (res == 'off') {
  814. $("#cmn-toggle-29").prop('checked', false);
  815. setTimeout("alert('電熱管2_關閉成功!')", 500);
  816. } else {
  817. alert(res);
  818. };
  819. }, 'text')
  820. $.get('/loading/D{{tid}}', '', function (res) {
  821. if (res.tank_heater2 == 0) {
  822. $("#cmn-toggle-29").prop('checked', false);
  823. } else if (res.tank_heater2 == 1) {
  824. $("#cmn-toggle-29").prop('checked', true);
  825. }
  826. }, 'json');
  827. };
  828. function tankHeater2_ON() {
  829. var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": "on" };
  830. $.post('/mqtt/{{tid}}', data, function (res) {
  831. console.log('data:', data)
  832. if (res == 'on') {
  833. $("#cmn-toggle-29").prop('checked', true);
  834. } else if (res == 'off') {
  835. $("#cmn-toggle-29").prop('checked', false);
  836. } else {
  837. console.log('res error')
  838. };
  839. }, 'text')
  840. };
  841. function tankHeater2_OFF() {
  842. var data = { "tank_num": "D" + tank_num, "command": "tank_heater2_status", "value": "off" };
  843. $.post('/mqtt/{{tid}}', data, function (res) {
  844. console.log('data:', data)
  845. if (res == 'on') {
  846. $("#cmn-toggle-29").prop('checked', true);
  847. } else if (res == 'off') {
  848. $("#cmn-toggle-29").prop('checked', false);
  849. } else {
  850. console.log('res error')
  851. };
  852. }, 'text')
  853. };
  854. // 溫度控制
  855. function tankTemp1Enable() {
  856. var status = "off";
  857. var check = $("input[name=tank_temp1_enable_status]:checked");
  858. //大於0代表有被選中
  859. if (check.length > 0) {
  860. status = "on";
  861. $("#cmn-toggle-35").prop('checked', false);
  862. if (!confirm("你確定要開啟溫度控制嗎?")) {
  863. return false;
  864. };
  865. } else {
  866. $("#cmn-toggle-35").prop('checked', true);
  867. if (!confirm("你確定要關閉溫度控制嗎?")) {
  868. return false;
  869. };
  870. };
  871. var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": status };
  872. $.post('/mqtt/{{tid}}', data, function (res) {
  873. console.log('data:', data)
  874. if (res == 'on') {
  875. $("#cmn-toggle-35").prop('checked', true);
  876. setTimeout("alert('溫度控制_開啟成功!')", 500);
  877. } else if (res == 'off') {
  878. $("#cmn-toggle-35").prop('checked', false);
  879. setTimeout("alert('溫度控制_關閉成功!')", 500);
  880. } else {
  881. alert(res);
  882. };
  883. }, 'text')
  884. $.get('/loading/D{{tid}}', '', function (res) {
  885. if (res.tank_temp1_enable == 0) {
  886. $("#cmn-toggle-35").prop('checked', false);
  887. } else if (res.tank_temp1_enable == 1) {
  888. $("#cmn-toggle-35").prop('checked', true);
  889. }
  890. }, 'json');
  891. };
  892. function tankTemp1Enable_ON() {
  893. var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": "on" };
  894. $.post('/mqtt/{{tid}}', data, function (res) {
  895. console.log('data:', data)
  896. if (res == 'on') {
  897. $("#cmn-toggle-35").prop('checked', true);
  898. } else if (res == 'off') {
  899. $("#cmn-toggle-35").prop('checked', false);
  900. } else {
  901. console.log('res error')
  902. };
  903. }, 'text')
  904. };
  905. function tankTemp1Enable_OFF() {
  906. var data = { "tank_num": "D" + tank_num, "command": "temp1_enable", "value": "off" };
  907. $.post('/mqtt/{{tid}}', data, function (res) {
  908. console.log('data:', data)
  909. if (res == 'on') {
  910. $("#cmn-toggle-35").prop('checked', true);
  911. } else if (res == 'off') {
  912. $("#cmn-toggle-35").prop('checked', false);
  913. } else {
  914. console.log('res error')
  915. };
  916. }, 'text')
  917. };
  918. /* 判斷是否整數
  919. function isInteger(obj) {
  920. return obj % 1 === 0
  921. }
  922. isInteger(3) // true
  923. */
  924. // 設定溫度
  925. /*
  926. <h2>溫度控制設定(單位 ℃):(目前設定溫度) {{tank_temp1}}</h2>
  927. <input name="tank_temp1_data" type="text" placeholder="{{tank_temp1}}" style="width: 40px;">℃ (限整數數值)
  928. <span id="tank_temp1_status" style="color:red;"></span>
  929. <input type="button" value="送出(設定溫度時請點擊)" name="tank_temp1_status" onclick="ChangeTemp1()">
  930. */
  931. function ChangeTemp1() {
  932. var temp_data = $("input[id=tank_temp1_data]").val();
  933. if (temp_data == '') {
  934. //$("#cmn-toggle-20").prop('checked', false);
  935. alert("請先輸入設定溫度!");
  936. return false;
  937. }
  938. var value = "0";
  939. //var check = $("input[name=peeling-machine-on]:checked");
  940. if ($("#cmn-toggle-35").prop('checked')) {
  941. value = temp_data;
  942. //$("#cmn-toggle-20").prop('checked', false);
  943. if (!confirm("你確定要設定內桶溫度為 " + temp_data + " ℃ 嗎?")) {
  944. return false;
  945. };
  946. } else {
  947. //$("#cmn-toggle-20").prop('checked', true);
  948. //你確定要停止桶內溫度設定嗎
  949. if (!confirm("請先開啟溫控開關, 再設定桶內溫度")) {
  950. return false;
  951. };
  952. };
  953. var data = { "tank_num": "D" + tank_num, "command": "temp1", "value": temp_data };
  954. $.post('/mqtt/{{tid}}', data, function (res) {
  955. console.log('data:', data)
  956. if (res == 'on') {
  957. //$("#cmn-toggle-14").prop('checked', true); // prop 設置元素屬型與元素值, 設定 checked 屬性為 true
  958. setTimeout("alert('溫度設定_開啟成功!')", 500); // 設定時間執行函式 delay(500), 只執行一次
  959. var timer = setInterval(Rotate, 60000); // 啟動後會在 60000 毫秒(更新時間一分鐘)內不斷執行 (原因須配合更新時間?)
  960. } else if (res == 'off') {
  961. //$("#cmn-toggle-14").prop('checked', false);
  962. setTimeout("alert('溫度設定_關閉成功!')", 500);
  963. clearInterval(timer); // 取消 timer 的不斷執行
  964. $("#motor_rpm_status").text(''); // 設置 #motor_rpm_status 的文字為空, #井字號
  965. } else {
  966. alert(res);
  967. };
  968. }, 'text')
  969. $.get('/loading/D{{tid}}', '', function (res) {
  970. $("#tank_temp1_data").attr("placeholder", res.tank_temp1);
  971. }, 'json');
  972. };
  973. function ChangeTemp1_ON() {
  974. var data = { "tank_num": "D" + tank_num, "command": "temp1", "value": "30" };
  975. $.post('/mqtt/{{tid}}', data, function (res) {
  976. console.log('data:', data)
  977. }, 'text')
  978. };
  979. function ChangeTemp1_OFF() {
  980. var data = { "tank_num": "D" + tank_num, "command": "temp1", "value": "25" };
  981. $.post('/mqtt/{{tid}}', data, function (res) {
  982. console.log('data:', data)
  983. }, 'text')
  984. };
  985. </script>
  986. </head>
  987. <body>
  988. <div id="wrapper">
  989. <div id="coffee_header">
  990. <!-- 匯入共同使用的 header.html 內容 -->
  991. {% include 'header.html' %}
  992. </div>
  993. <!--
  994. <div style="text-align: left;">
  995. <a href="/dry" style="float: left;">&nbsp;&nbsp;&nbsp;返回乾燥貨櫃首頁</a>
  996. </div>
  997. <div style="text-align: right;">
  998. <a id="dry_tank_page" href="/index_new" style="float: right;">___________________</a>
  999. </div>
  1000. <div id="dry_container_tank_title" style="text-align: center; margin-top: 30px; font-size: 24px; margin-bottom: 15px;">
  1001. 乾燥槽 D 操作介面
  1002. </div>
  1003. -->
  1004. <script language="JavaScript">
  1005. function changeUpdate() {
  1006. clearInterval(WebUpdate_set);
  1007. var webupdate_time = $("input[name=webupdate_time]").val()
  1008. console.log('webupdate_time' + webupdate_time)
  1009. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , webupdate_time * 1000);
  1010. }
  1011. // jQuery 更新感測器制動器狀態
  1012. function WebUpdate(dtn) {
  1013. $.get('/loading/D' + dtn, '', function (res) {
  1014. if (res.tank_vacuum == 0) {
  1015. $("#cmn-toggle-05").prop('checked', false);
  1016. } else if (res.tank_vacuum == 1) {
  1017. $("#cmn-toggle-05").prop('checked', true);
  1018. }
  1019. if (res.tank_threewayvalve == 0) {
  1020. $("#cmn-toggle-08").prop('checked', false);
  1021. } else if (res.tank_threewayvalve == 1) {
  1022. $("#cmn-toggle-08").prop('checked', true);
  1023. }
  1024. if (res.tank_diskvalve == 0) {
  1025. $("#cmn-toggle-11").prop('checked', false);
  1026. } else if (res.tank_diskvalve == 1) {
  1027. $("#cmn-toggle-11").prop('checked', true);
  1028. }
  1029. if (res.tank_solenoid_disinfect == 0) {
  1030. $("#cmn-toggle-14").prop('checked', false);
  1031. } else if (res.tank_solenoid_disinfect == 1) {
  1032. $("#cmn-toggle-14").prop('checked', true);
  1033. }
  1034. if (res.tank_solenoid_water == 0) {
  1035. $("#cmn-toggle-17").prop('checked', false);
  1036. } else if (res.tank_solenoid_water == 1) {
  1037. $("#cmn-toggle-17").prop('checked', true);
  1038. }
  1039. if (res.tank_blower == 0) {
  1040. $("#cmn-toggle-23").prop('checked', false);
  1041. } else if (res.tank_blower == 1) {
  1042. $("#cmn-toggle-23").prop('checked', true);
  1043. }
  1044. if (res.tank_heater1 == 0) {
  1045. $("#cmn-toggle-26").prop('checked', false);
  1046. } else if (res.tank_heater1 == 1) {
  1047. $("#cmn-toggle-26").prop('checked', true);
  1048. }
  1049. if (res.tank_heater2 == 0) {
  1050. $("#cmn-toggle-29").prop('checked', false);
  1051. } else if (res.tank_heater2 == 1) {
  1052. $("#cmn-toggle-29").prop('checked', true);
  1053. }
  1054. if (res.tank_temp1_enable == 0) {
  1055. $("#cmn-toggle-35").prop('checked', false);
  1056. } else if (res.tank_temp1_enable == 1) {
  1057. $("#cmn-toggle-35").prop('checked', true);
  1058. }
  1059. $("#motor_rpm_data").attr("placeholder", res.tank_motor);
  1060. $("#tank_temp1_data").attr("placeholder", res.tank_temp1);
  1061. $("#UltraSonic_t_status").text(res.UltraSonic);
  1062. $("#SHT11_Temp_t_status").text(res.SHT11_Temp);
  1063. $("#SHT11_Humidity_t_status").text(res.SHT11_Humidity);
  1064. $("#soil_Temp_t_status").text(res.soil_Temp);
  1065. $("#soil_Humidity_t_status").text(res.soil_Humidity);
  1066. $("#soil_EC_t_status").text(res.soil_EC);
  1067. $("#PA_t_status").text(res.PA);
  1068. var present_SHT11_Temp = res.SHT11_Temp
  1069. var present_SOIL_Temp = res.soil_Temp
  1070. var Temp_Weights_SHT11 = parseFloat($("#Temp_Weights_SHT11").val());
  1071. var Temp_Weights_Soil = parseFloat($("#Temp_Weights_Soil").val());
  1072. present_temp = Math.round((present_SHT11_Temp*Temp_Weights_SHT11 + present_SOIL_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
  1073. $("#testing_Temp_Weight").text(present_temp);
  1074. var float_SHT11_Temp = parseFloat(res.SHT11_Temp);
  1075. }, 'json');
  1076. }
  1077. </script>
  1078. <h4>制動器</h4>
  1079. <table border="1" style="font-size:18px; border:2px #cccccc solid; margin-left: 2px; margin-right: 2px;" width=98%>
  1080. <tr>
  1081. <td style="color:red;">Valve</td>
  1082. <td>乾燥桶<br>真空吸料機</td>
  1083. <td>三通閥</td>
  1084. <td>桶內消毒<br>電磁閥</td>
  1085. <td>馬達</td>
  1086. <td>鼓風機</td>
  1087. <td>加熱器 1</td>
  1088. <td>加熱器 2</td>
  1089. <td>溫控開關</td>
  1090. <td>溫度設定</td>
  1091. <td>排水<br>電磁閥</td>
  1092. <td>蝴蝶閥</td>
  1093. </tr>
  1094. <tr>
  1095. <td>
  1096. <span style="color:#C0C0C0;">off</span>
  1097. <span style="color:#008CBA;">on</span>
  1098. </td>
  1099. <td>
  1100. <div class="switch_div">
  1101. <div class="switch">
  1102. <input id="cmn-toggle-04" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1103. <label for="cmn-toggle-04"></label>
  1104. </div>
  1105. <div class="switch text-center">
  1106. {% if tank_vacuum == 1 %}
  1107. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1108. name="tank_vacuum_status" value="ON" onclick="tankVacuum()">
  1109. {% else %}
  1110. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1111. name="tank_vacuum_status" value="OFF" onclick="tankVacuum()">
  1112. {% endif %}
  1113. <label for="cmn-toggle-05"></label>
  1114. </div>
  1115. <div class="switch">
  1116. <input id="cmn-toggle-06" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1117. <label for="cmn-toggle-06" data-on="Yes" data-off="No"></label>
  1118. </div>
  1119. </div>
  1120. </td>
  1121. <td>
  1122. <div class="switch_div">
  1123. <div class="switch">
  1124. <input id="cmn-toggle-07" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1125. <label for="cmn-toggle-07"></label>
  1126. </div>
  1127. <div class="switch text-center">
  1128. {% if tank_threewayvalve == 1 %}
  1129. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1130. name="tank_threewayvalve_status" value="ON" onclick="tankThreeWayValve()">
  1131. {% else %}
  1132. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1133. name="tank_threewayvalve_status" value="OFF" onclick="tankThreeWayValve()">
  1134. {% endif %}
  1135. <label for="cmn-toggle-08"></label>
  1136. </div>
  1137. <div class="switch">
  1138. <input id="cmn-toggle-09" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1139. <label for="cmn-toggle-09" data-on="Yes" data-off="No"></label>
  1140. </div>
  1141. </div>
  1142. </td>
  1143. <td>
  1144. <div class="switch_div">
  1145. <div class="switch">
  1146. <input id="cmn-toggle-13" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1147. <label for="cmn-toggle-13"></label>
  1148. </div>
  1149. <div class="switch text-center">
  1150. {% if tank_solenoid_disinfect == 1 %}
  1151. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1152. name="tank_solenoid_disinfect_status" value="ON" onclick="tankSolenoidDisinfect()">
  1153. {% else %}
  1154. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1155. name="tank_solenoid_disinfect_status" value="OFF" onclick="tankSolenoidDisinfect()">
  1156. {% endif %}
  1157. <label for="cmn-toggle-14"></label>
  1158. </div>
  1159. <div class="switch">
  1160. <input id="cmn-toggle-15" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1161. <label for="cmn-toggle-15" data-on="Yes" data-off="No"></label>
  1162. </div>
  1163. </div>
  1164. </td>
  1165. <td>
  1166. <input id="motor_rpm_data" type="text" placeholder="{{tank_motor}}" style="width: 40px;">
  1167. <span style="font-size: 12px;" >RPM (±50)</span>
  1168. <span id="motor_rpm_status" style="color:red;"></span>
  1169. <br>
  1170. <input type="button" value="送出" name="tank_motor_status" onclick="ChangeMotor()">
  1171. </td>
  1172. <td>
  1173. <div class="switch_div">
  1174. <div class="switch">
  1175. <input id="cmn-toggle-22" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1176. <label for="cmn-toggle-22"></label>
  1177. </div>
  1178. <div class="switch text-center">
  1179. {% if tank_blower == 1 %}
  1180. <input id="cmn-toggle-23" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1181. name="tank_blower_status" value="ON" onclick="tankBlower()">
  1182. {% else %}
  1183. <input id="cmn-toggle-23" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1184. name="tank_blower_status" value="OFF" onclick="tankBlower()">
  1185. {% endif %}
  1186. <label for="cmn-toggle-23"></label>
  1187. </div>
  1188. <div class="switch">
  1189. <input id="cmn-toggle-24" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1190. <label for="cmn-toggle-24" data-on="Yes" data-off="No"></label>
  1191. </div>
  1192. </div>
  1193. </td>
  1194. <td>
  1195. <div class="switch_div">
  1196. <div class="switch">
  1197. <input id="cmn-toggle-25" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1198. <label for="cmn-toggle-25"></label>
  1199. </div>
  1200. <div class="switch text-center">
  1201. {% if tank_heater1 == 1 %}
  1202. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1203. name="tank_heater1_status" value="ON" onclick="tankHeater1()">
  1204. {% else %}
  1205. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1206. name="tank_heater1_status" value="OFF" onclick="tankHeater1()">
  1207. {% endif %}
  1208. <label for="cmn-toggle-26"></label>
  1209. </div>
  1210. <div class="switch">
  1211. <input id="cmn-toggle-27" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1212. <label for="cmn-toggle-27" data-on="Yes" data-off="No"></label>
  1213. </div>
  1214. </div>
  1215. </td>
  1216. <td>
  1217. <div class="switch_div">
  1218. <div class="switch">
  1219. <input id="cmn-toggle-28" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1220. <label for="cmn-toggle-28"></label>
  1221. </div>
  1222. <div class="switch text-center">
  1223. {% if tank_heater2== 1 %}
  1224. <input id="cmn-toggle-29" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1225. name="tank_heater2_status" value="ON" onclick="tankHeater2()">
  1226. {% else %}
  1227. <input id="cmn-toggle-29" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1228. name="tank_heater2_status" value="OFF" onclick="tankHeater2()">
  1229. {% endif %}
  1230. <label for="cmn-toggle-29"></label>
  1231. </div>
  1232. <div class="switch">
  1233. <input id="cmn-toggle-30" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1234. <label for="cmn-toggle-30" data-on="Yes" data-off="No"></label>
  1235. </div>
  1236. </div>
  1237. </td>
  1238. <td>
  1239. <div class="switch_div">
  1240. <div class="switch">
  1241. <input id="cmn-toggle-34" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1242. <label for="cmn-toggle-34"></label>
  1243. </div>
  1244. <div class="switch text-center">
  1245. {% if tank_temp1_enable== 1 %}
  1246. <input id="cmn-toggle-35" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1247. name="tank_temp1_enable_status" value="ON" onclick="tankTemp1Enable()">
  1248. {% else %}
  1249. <input id="cmn-toggle-35" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1250. name="tank_temp1_enable_status" value="OFF" onclick="tankTemp1Enable()">
  1251. {% endif %}
  1252. <label for="cmn-toggle-35"></label>
  1253. </div>
  1254. <div class="switch">
  1255. <input id="cmn-toggle-36" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1256. <label for="cmn-toggle-36" data-on="Yes" data-off="No"></label>
  1257. </div>
  1258. </div>
  1259. </td>
  1260. <td>
  1261. <input id="tank_temp1_data" type="text" placeholder="{{tank_temp1}}" style="width: 40px;">℃
  1262. <span id="tank_temp1_status" style="color:red;"></span>
  1263. <br>
  1264. <input type="button" value="送出" name="tank_temp1_status" onclick="ChangeTemp1()">
  1265. </td>
  1266. <td>
  1267. <div class="switch_div">
  1268. <div class="switch">
  1269. <input id="cmn-toggle-16" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1270. <label for="cmn-toggle-16"></label>
  1271. </div>
  1272. <div class="switch text-center">
  1273. {% if tank_solenoid_water== 1 %}
  1274. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
  1275. name="tank_solenoid_water_status" value="ON" onclick="tankSolenoidWater()">
  1276. {% else %}
  1277. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1278. name="tank_solenoid_water_status" value="OFF" onclick="tankSolenoidWater()">
  1279. {% endif %}
  1280. <label for="cmn-toggle-17"></label>
  1281. </div>
  1282. <div class="switch">
  1283. <input id="cmn-toggle-18" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1284. <label for="cmn-toggle-18" data-on="Yes" data-off="No"></label>
  1285. </div>
  1286. </div>
  1287. </td>
  1288. <td>
  1289. <div class="switch_div">
  1290. <div class="switch">
  1291. <input id="cmn-toggle-10" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1292. <label for="cmn-toggle-10"></label>
  1293. </div>
  1294. <div class="switch text-center">
  1295. {% if tank_diskvalve== 1 %}
  1296. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
  1297. name="tank_diskvalve_status" value="ON" onclick="tankDiskValve()">
  1298. {% else %}
  1299. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
  1300. name="tank_diskvalve_status" value="OFF" onclick="tankDiskValve()">
  1301. {% endif %}
  1302. <label for="cmn-toggle-11"></label>
  1303. </div>
  1304. <div class="switch">
  1305. <input id="cmn-toggle-12" class="cmn-toggle cmn-toggle-on-off" type="checkbox">
  1306. <label for="cmn-toggle-12" data-on="Yes" data-off="No"></label>
  1307. </div>
  1308. </div>
  1309. </td>
  1310. </tr>
  1311. <tr>
  1312. <td><span style="color:#008CBA;"><b>ON</b></span></td>
  1313. <td><input type="button" value="ON" onclick="tankVacuum_ON()"></td>
  1314. <td><input type="button" value="ON" onclick="tankThreeWayValve_ON()"></td>
  1315. <td><input type="button" value="ON" onclick="tankSolenoidDisinfect_ON()"></td>
  1316. <td><input type="button" value="ON" onclick="ChangeMotor_ON()"></td>
  1317. <td><input type="button" value="ON" onclick="tankBlower_ON()"></td>
  1318. <td><input type="button" value="ON" onclick="tankHeater1_ON()"></td>
  1319. <td><input type="button" value="ON" onclick="tankHeater2_ON()"></td>
  1320. <td><input type="button" value="ON" onclick="tankTemp1Enable_ON()"></td>
  1321. <td><input type="button" value="ON" onclick="ChangeTemp1_ON()"></td>
  1322. <td><input type="button" value="ON" onclick="tankSolenoidWater_ON()"></td>
  1323. <td><input type="button" value="ON" onclick="tankDiskValve_ON()"></td>
  1324. </tr>
  1325. <tr>
  1326. <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
  1327. <td><input type="button" value="OFF" onclick="tankVacuum_OFF()"></td>
  1328. <td><input type="button" value="OFF" onclick="tankThreeWayValve_OFF()"></td>
  1329. <td><input type="button" value="OFF" onclick="tankSolenoidDisinfect_OFF()"></td>
  1330. <td><input type="button" value="OFF" onclick="ChangeMotor_OFF()"></td>
  1331. <td><input type="button" value="OFF" onclick="tankBlower_OFF()"></td>
  1332. <td><input type="button" value="OFF" onclick="tankHeater1_OFF()"></td>
  1333. <td><input type="button" value="OFF" onclick="tankHeater2_OFF()"></td>
  1334. <td><input type="button" value="OFF" onclick="tankTemp1Enable_OFF()"></td>
  1335. <td><input type="button" value="OFF" onclick="ChangeTemp1_OFF()"></td>
  1336. <td><input type="button" value="OFF" onclick="tankSolenoidWater_OFF()"></td>
  1337. <td><input type="button" value="OFF" onclick="tankDiskValve_OFF()"></td>
  1338. </tr>
  1339. </table>
  1340. <br>
  1341. <h4>感測器</h4>
  1342. <table border="1" style="font-size:18px; border:2px #cccccc solid; margin-left: 2px; margin-right: 2px;" cellpadding="10" width=98%>
  1343. <tr>
  1344. <td colspan="6">[桶內] 生豆高度:<span id="UltraSonic_t_status">{{tank_UltraSonic.UltraSonic}}</span> 公分</td>
  1345. </tr>
  1346. <tr>
  1347. <td style="background-color:#f3f3f3">桶內溫度</td>
  1348. <td><span id="SHT11_Temp_t_status">{{tank_SHT11.SHT11_Temp}}</span> ℃</td>
  1349. <td style="background-color:#f3f3f3">桶內濕度</td>
  1350. <td><span id="SHT11_Humidity_t_status">{{tank_SHT11.SHT11_Humidity}}</span> %</td>
  1351. <td style="background-color:#f3f3f3">桶內壓力</td>
  1352. <td><span id="PA_t_status">{{tank_PA.PA}}</span> Pa</td>
  1353. </tr>
  1354. <tr>
  1355. <td style="background-color:#f3f3f3">咖啡生豆溫度</td>
  1356. <td><span id="soil_Temp_t_status">{{tank_Soil.soil_Temp}}</span> ℃</td>
  1357. <td style="background-color:#f3f3f3">咖啡生豆濕度</td>
  1358. <td><span id="soil_Humidity_t_status">{{tank_Soil.soil_Humidity}}</span> %</td>
  1359. <td style="background-color:#f3f3f3">咖啡生豆 EC</td>
  1360. <td><span id="soil_EC_t_status">{{tank_Soil.soil_EC}}</span> uS/cm</td>
  1361. </tr>
  1362. </table>
  1363. <br>
  1364. <table border="1" style="font-size:18px; border:2px #cccccc solid; margin-left: 2px; margin-right: 2px;" cellpadding="10" width=98%>
  1365. <tr>
  1366. <td>
  1367. 溫度權重設定:
  1368. 桶內溫度&nbsp;×&nbsp;<input id="Temp_Weights_SHT11" type="text" value="0.5" style="width: 40px;">&nbsp;+&nbsp;
  1369. 咖啡生豆溫度&nbsp;×&nbsp;<input id="Temp_Weights_Soil" type="text" value="0.5" style="width: 40px;" >
  1370. </td>
  1371. <td>
  1372. <strong>溫度[權重]:<span id="testing_Temp_Weight">{{Temp_weight}}</span></strong>
  1373. </td>
  1374. </tr>
  1375. </table>
  1376. <br>
  1377. <h4>排程設計</h4>
  1378. <table border="1" style="font-size:18px; border:2px #cccccc solid; margin-left: 2px; margin-right: 2px;" width=98%>
  1379. <tr>
  1380. <td>乾燥</td>
  1381. <td>入料</td>
  1382. <td>攪拌加熱</td>
  1383. <td>消毒清洗</td>
  1384. <td>循環測試</td>
  1385. </tr>
  1386. <tr>
  1387. <td>
  1388. -- 入料 --<br>
  1389. 指定生豆高度
  1390. <input name="testing_BeanIn_Height_D" type="text" value="45" style="width: 40px;">公分<br>
  1391. 吸料時間
  1392. <input name="testing_in_vacuum_in_D" type="text" value="3" style="width: 40px;">秒<br>
  1393. 放料時間(>10)
  1394. <input name="testing_in_vacuum_out_D" type="text" value="5" style="width: 40px;">秒<br>
  1395. 循環次數
  1396. <input name="testing_in_vacuum_loop_D" type="text" value="3" style="width: 40px;">次<br>
  1397. -- 乾燥 --<br>
  1398. 馬達轉速
  1399. <input name="testing_Heat_Motor_D" type="text" value="30" style="width: 40px;">rpm<br>
  1400. 指定溫度
  1401. <input name="testing_Heat_Temp_D" type="text" value="35" style="width: 40px;">℃<br>
  1402. 指定濕度
  1403. <input name="testing_Heat_Humidity_D" type="text" value="35" style="width: 40px;">%<br>
  1404. 乾燥秒數
  1405. <input name="testing_Heat_time_D" type="text" value="20" style="width: 40px;">秒<br>
  1406. -- 出料 --<br>
  1407. 指定空桶高度
  1408. <input name="testing_BeanEmpty_Height_D" type="text" value="10" style="width: 40px;">公分<br>
  1409. 吸料時間
  1410. <input name="testing_out_vacuum_in_D" type="text" value="3" style="width: 40px;">秒<br>
  1411. 放料時間(>10)
  1412. <input name="testing_out_vacuum_out_D" type="text" value="5" style="width: 40px;">秒<br>
  1413. 循環次數
  1414. <input name="testing_out_vacuum_loop_D" type="text" value="3" style="width: 40px;">次<br>
  1415. </td>
  1416. <td>
  1417. 指定桶內生豆高度
  1418. <input name="testing_BeanIn_Height" type="text" value="0" style="width: 40px;">公分<br>
  1419. 吸料時間
  1420. <input name="testing_in_vacuum_in" type="text" value="1" style="width: 40px;">秒<br>
  1421. 放料時間
  1422. <input name="testing_in_vacuum_out" type="text" value="10" style="width: 40px;">秒<br>
  1423. 循環次數
  1424. <input name="testing_in_vacuum_loop" type="text" value="3" style="width: 40px;">次<br>
  1425. </td>
  1426. <td>
  1427. 馬達轉速
  1428. <input name="testing_Heat_Motor" type="text" value="20" style="width: 40px;">rpm<br>
  1429. 指定溫度
  1430. <input name="testing_Heat_Temp" type="text" value="25" style="width: 40px;">℃<br>
  1431. 指定濕度
  1432. <input name="testing_Heat_Humidity" type="text" value="35" style="width: 40px;">%<br>
  1433. 乾燥秒數
  1434. <input name="testing_Heat_time" type="text" value="20" style="width: 40px;">秒<br>
  1435. </td>
  1436. <td>
  1437. 排水電磁閥 OFF<br>
  1438. 馬達轉速
  1439. <input id="testing_clean_motor" type="text" value="30" style="width: 40px;">rpm<br>
  1440. 消毒噴灑時間
  1441. <input id="testing_disinfect_time" type="text" value="30" style="width: 40px;">秒<br>
  1442. 排水電磁閥 ON
  1443. </td>
  1444. <td>
  1445. ON (開)
  1446. <input name="Testing_starttime" value="3" type="text" style="width: 40px;">秒<br>
  1447. OFF (關)
  1448. <input name="Testing_endtime" value="5" type="text" style="width: 40px;">秒<br>
  1449. 循環
  1450. <input name="Testing_loop" value="3" type="text" style="width: 40px;">次
  1451. </td>
  1452. <tr>
  1453. <td>
  1454. <button type="submit" class="btn btn-primary" onclick="F_tankDiskValve_ON()">發酵槽蝴蝶閥 ON</button><br>
  1455. <button type="submit" class="btn btn-primary" onclick="F_tankDiskValve_OFF()">發酵槽蝴蝶閥 OFF</button><br>
  1456. <button type="submit" class="btn btn-primary" onclick="testing_D()">乾燥排程測試</button>
  1457. <script>
  1458. function F_tankDiskValve_ON() {
  1459. var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "on" };
  1460. $.post('/mqtt/{{tid}}', data, function (res) {
  1461. console.log('data:', data)
  1462. }, 'text')
  1463. };
  1464. function F_tankDiskValve_OFF() {
  1465. var data = { "tank_num": "F" + tank_num, "command": "tank_diskvalve_status", "value": "off" };
  1466. $.post('/mqtt/{{tid}}', data, function (res) {
  1467. console.log('data:', data)
  1468. }, 'text')
  1469. };
  1470. function testing_D() {
  1471. clearInterval(WebUpdate_set);
  1472. var BeanIn_D_Process = 0; // 入豆
  1473. var Heat_D_Process = 0; // 乾燥
  1474. var BeanOut_D_Process = 0; // 出豆
  1475. var BeanIn_D_interval;
  1476. var Heat_D_interval;
  1477. var BeanOut_D_interval;
  1478. var testing_BeanIn_Height_D = $("input[name=testing_BeanIn_Height_D]").val();
  1479. var testing_in_vacuum_in_D = $("input[name=testing_in_vacuum_in_D]").val();
  1480. var testing_in_vacuum_out_D = $("input[name=testing_in_vacuum_out_D]").val();
  1481. var testing_in_vacuum_loop_D = $("input[name=testing_in_vacuum_loop_D]").val();
  1482. if (testing_BeanIn_Height_D != 0) {
  1483. console.log('以指定高度入豆')
  1484. BeanIn_D_interval = setInterval(BeanInHeight_D, 5000);
  1485. } else if (testing_BeanIn_Height_D == 0) {
  1486. console.log('以循環次數入豆')
  1487. for (step = 1; step <= testing_in_vacuum_loop_D; step++) {
  1488. console.log('-- 循環第 ' + step + ' 次 --');
  1489. // aaa tankVacuum_ON()
  1490. console.log('tankVacuum_ON')
  1491. var time = new Date();
  1492. while ((new Date() - time) < testing_in_vacuum_in_D * 1000) { };
  1493. // aaa tankVacuum_OFF()
  1494. console.log('tankVacuum_OFF')
  1495. var time = new Date();
  1496. while ((new Date() - time) < testing_in_vacuum_out_D * 1000) { };
  1497. }
  1498. console.log('循環入豆結束')
  1499. var testing_Heat_Motor_D = $("input[name=testing_Heat_Motor_D]").val();
  1500. var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
  1501. var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
  1502. var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
  1503. console.log('指定馬達轉速: ' + testing_Heat_Motor_D)
  1504. console.log('指定溫度: ' + testing_Heat_Temp_D)
  1505. console.log('指定濕度: ' + testing_Heat_Humidity_D)
  1506. console.log('指定乾燥秒數: ' + testing_Heat_time_D)
  1507. $.get('/dry_SHT11_' + tank_num, '', function (res) {
  1508. present_temp = Math.round((res.SHT11_Temp*Temp_Weights_SHT11 + res.soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
  1509. if ( (present_temp < testing_Heat_Temp_D) || (res.SHT11_Humidity < testing_Heat_Humidity_D) ) {
  1510. // aaa tankHeater1_ON()
  1511. console.log('tankHeater1_ON')
  1512. // aaa tankHeater2_ON()
  1513. console.log('tankHeater2_ON')
  1514. // aaa tankBlower_ON()
  1515. console.log('tankBlower_ON')
  1516. }
  1517. }, 'json');
  1518. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor_D };
  1519. $.post('/mqtt/{{tid}}', data, function (res) {
  1520. console.log('data:', data)
  1521. }, 'text')
  1522. console.log('Motor ' + testing_Heat_Motor_D)
  1523. Heat_D_interval = setInterval(Heater_D, 5000);
  1524. }
  1525. function BeanInHeight_D(){
  1526. if (BeanIn_D_Process == 1) {
  1527. return;
  1528. }
  1529. BeanIn_D_Process == 1;
  1530. $.ajax({
  1531. async:false,
  1532. type:"GET",
  1533. url:"/dry_UltraSonic_" + tank_num,
  1534. dataType:"json",
  1535. success:function(response){
  1536. var present_Bean_height = response.UltraSonic
  1537. console.log('目前生豆高度: ' + present_Bean_height)
  1538. if ( parseInt(present_Bean_height) < parseInt(testing_BeanIn_Height_D) ) {
  1539. // aaa tankVacuum_ON()
  1540. console.log('tankVacuum_ON')
  1541. var time = new Date();
  1542. while ((new Date() - time) < testing_in_vacuum_in_D * 1000) { };
  1543. // aaa tankVacuum_OFF()
  1544. console.log('tankVacuum_OFF')
  1545. var time = new Date();
  1546. while ((new Date() - time) < testing_in_vacuum_out_D * 1000) { };
  1547. } else {
  1548. clearInterval(BeanIn_D_interval)
  1549. console.log('生豆已達指定高度!')
  1550. var testing_Heat_Motor_D = $("input[name=testing_Heat_Motor_D]").val();
  1551. var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
  1552. var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
  1553. var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
  1554. console.log('指定馬達轉速: ' + testing_Heat_Motor_D)
  1555. console.log('指定溫度: ' + testing_Heat_Temp_D)
  1556. console.log('指定濕度: ' + testing_Heat_Humidity_D)
  1557. console.log('指定乾燥秒數: ' + testing_Heat_time_D)
  1558. $.get('/dry_SHT11_' + tank_num, '', function (res) {
  1559. if ( (res.SHT11_Temp < testing_Heat_Temp_D) || (res.SHT11_Humidity < testing_Heat_Humidity_D) ) {
  1560. // aaa tankHeater1_ON()
  1561. console.log('tankHeater1_ON')
  1562. // aaa tankHeater2_ON()
  1563. console.log('tankHeater2_ON')
  1564. // aaa tankBlower_ON()
  1565. console.log('tankBlower_ON')
  1566. var time = new Date();
  1567. while ((new Date() - time) < 5 * 1000) { };
  1568. }
  1569. }, 'json');
  1570. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor_D };
  1571. $.post('/mqtt/{{tid}}', data, function (res) {
  1572. console.log('data:', data)
  1573. }, 'text')
  1574. console.log('Motor ' + testing_Heat_Motor_D)
  1575. var time = new Date();
  1576. while ((new Date() - time) < 5 * 1000) { };
  1577. Heat_D_interval = setInterval(Heater_D, 5000);
  1578. }
  1579. BeanIn_D_Process == 0;
  1580. },
  1581. error:function(thrownError){
  1582. console.log('Error: ' + thrownError)
  1583. BeanIn_D_Process = 0;
  1584. }
  1585. })
  1586. };
  1587. function Heater_D(){
  1588. if ( Heat_D_Process == 1 ) {
  1589. return;
  1590. }
  1591. Heat_D_Process = 1;
  1592. $.ajax({
  1593. async:false,
  1594. type:"GET",
  1595. url:"/dry_SHT11_" + tank_num,
  1596. dataType:"json",
  1597. success:function(response){
  1598. var present_Humidity = response.SHT11_Humidity
  1599. var testing_Heat_Temp_D = $("input[name=testing_Heat_Temp_D]").val();
  1600. var testing_Heat_Humidity_D = $("input[name=testing_Heat_Humidity_D]").val();
  1601. var testing_Heat_time_D = $("input[name=testing_Heat_time_D]").val();
  1602. present_temp = Math.round((res.SHT11_Temp*Temp_Weights_SHT11 + res.soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
  1603. if ( (present_Humidity > testing_Heat_Humidity_D) && (present_temp > testing_Heat_Temp_D) ) {
  1604. clearInterval(Heat_D_interval)
  1605. console.log("已達指定溫濕度, 乾燥 " + testing_Heat_time_D + " 秒")
  1606. var time = new Date();
  1607. while ( (new Date() - time) < testing_Heat_time_D * 1000 ) { }
  1608. // aaa ChangeMotor_OFF()
  1609. console.log('ChangeMotor_OFF')
  1610. // aaa tankHeater1_OFF()
  1611. console.log('tankHeater1_OFF')
  1612. // aaa tankHeater2_OFF()
  1613. console.log('tankHeater2_OFF')
  1614. // aaa tankBlower_OFF()
  1615. console.log('tankBlower_OFF')
  1616. console.log('攪拌加熱完成!')
  1617. var testing_BeanEmpty_Height_D = $('input[name=testing_BeanEmpty_Height_D]').val();
  1618. var testing_out_vacuum_in_D = $('input[name=testing_out_vacuum_in_D]').val();
  1619. var testing_out_vacuum_out_D = $('input[name=testing_out_vacuum_out_D]').val();
  1620. var testing_out_vacuum_loop_D = $('input[name=testing_out_vacuum_loop_D]').val();
  1621. console.log('指定空桶高度: ' + testing_BeanEmpty_Height_D)
  1622. if (testing_BeanEmpty_Height_D != 0) {
  1623. console.log('以空桶高度出豆')
  1624. BeanOut_D_interval = setInterval(BeanOutHeight_D, 5000);
  1625. } else if (testing_BeanEmpty_Height == 0) {
  1626. console.log('以循環方式出豆')
  1627. for (step = 1; step <= testing_out_vacuum_loop; step++) {
  1628. console.log('-- 循環第 ' + step + ' 次 --');
  1629. tankVacuum_ON()
  1630. console.log('tankVacuum_ON')
  1631. var time = new Date();
  1632. while ((new Date() - time) < testing_out_vacuum_in_D * 1000) { };
  1633. tankVacuum_OFF()
  1634. console.log('tankVacuum_OFF')
  1635. var time = new Date();
  1636. while ((new Date() - time) < testing_out_vacuum_out_D * 1000) { };
  1637. }
  1638. console.log('循環出豆結束')
  1639. }
  1640. } else if ( parseInt(present_Humidity) > parseInt(testing_Heat_Humidity_D) ) {
  1641. console.log("已達指定濕度!")
  1642. } else if ( parseInt(present_temp) > parseInt(testing_Heat_Temp_D) ){
  1643. console.log("已達指定溫度!")
  1644. } else {
  1645. console.log('加熱中, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
  1646. }
  1647. Heat_D_Process = 0;
  1648. },
  1649. error:function(thrownError){
  1650. console.log('Error: ' + thrownError)
  1651. Heat_D_Process = 0;
  1652. }
  1653. })
  1654. };
  1655. function BeanOutHeight_D(){
  1656. if (BeanOut_D_Process == 1) {
  1657. return;
  1658. }
  1659. BeanOut_D_Process = 1;
  1660. $.ajax({
  1661. async:false,
  1662. type:"GET",
  1663. url:"/dry_UltraSonic_" + tank_num,
  1664. dataType:"json",
  1665. success:function(response){
  1666. var present_Bean_height = response.UltraSonic
  1667. console.log("目前豆高: " + present_Bean_height)
  1668. var testing_BeanEmpty_Height_D = $('input[name=testing_BeanEmpty_Height_D]').val();
  1669. var testing_out_vacuum_in_D = $('input[name=testing_out_vacuum_in_D]').val();
  1670. var testing_out_vacuum_out_D = $('input[name=testing_out_vacuum_out_D]').val();
  1671. var testing_out_vacuum_loop_D = $('input[name=testing_out_vacuum_loop_D]').val();
  1672. if ( parseInt(present_Bean_height) < parseInt(testing_BeanEmpty_Height_D) ) {
  1673. clearInterval(BeanOut_D_interval)
  1674. console.log("已達指定空桶高度!")
  1675. } else {
  1676. // aaa outputVacuum_ON()
  1677. console.log('outputVacuum_ON')
  1678. var time = new Date()
  1679. while ( (new Date() - time) < testing_out_vacuum_in_D * 1000) { }
  1680. // aaa outputVacuum_OFF()
  1681. console.log('outputVacuum_OFF')
  1682. var time = new Date()
  1683. while ( (new Date() - time) < testing_out_vacuum_out_D * 1000) { }
  1684. }
  1685. BeanOut_D_Process = 0;
  1686. },
  1687. error:function(thrownError){
  1688. console.log("Error: " + thrownError)
  1689. BeanOut_D_Process = 0;
  1690. }
  1691. })
  1692. };
  1693. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1694. }
  1695. </script>
  1696. </td>
  1697. <td>
  1698. <button type="submit" class="btn btn-primary" onclick="BeanInput()">入料測試</button>
  1699. <script>
  1700. var BeanIn_Process = 0;
  1701. var BeanIn_interval;
  1702. function BeanInput() {
  1703. clearInterval(WebUpdate_set);
  1704. var testing_BeanIn_Height = $("input[name=testing_BeanIn_Height]").val();
  1705. var testing_in_vacuum_in = $("input[name=testing_in_vacuum_in]").val();
  1706. var testing_in_vacuum_out = $("input[name=testing_in_vacuum_out]").val();
  1707. var testing_in_vacuum_loop = $("input[name=testing_in_vacuum_loop]").val();
  1708. if (testing_BeanIn_Height != 0) {
  1709. console.log('以指定高度入豆')
  1710. var BeanIn_interval = setInterval(BeanInHeight, 5000);
  1711. function BeanInHeight(){
  1712. if (BeanIn_Process == 1) {
  1713. return;
  1714. }
  1715. BeanIn_Process == 1;
  1716. $.ajax({
  1717. async:false,
  1718. type:"GET",
  1719. url:"/dry_UltraSonic_" + tank_num,
  1720. dataType:"json",
  1721. success:function(response){
  1722. var present_Bean_height = response.UltraSonic
  1723. console.log('目前生豆高度: ' + present_Bean_height)
  1724. if ( parseInt(present_Bean_height) < parseInt(testing_BeanIn_Height) ) {
  1725. // aaa tankVacuum_ON()
  1726. console.log('tankVacuum_ON')
  1727. var time = new Date();
  1728. while ((new Date() - time) < testing_in_vacuum_in * 1000) { };
  1729. // aaa tankVacuum_OFF()
  1730. console.log('tankVacuum_OFF')
  1731. var time = new Date();
  1732. while ((new Date() - time) < testing_in_vacuum_out * 1000) { };
  1733. } else {
  1734. clearInterval(BeanIn_interval)
  1735. console.log('生豆已達指定高度!')
  1736. }
  1737. BeanIn_Process == 0;
  1738. },
  1739. error:function(thrownError){
  1740. console.log('Error: ' + thrownError)
  1741. BeanIn_Process = 0;
  1742. }
  1743. })
  1744. };
  1745. } else if (testing_BeanIn_Height == 0) {
  1746. console.log('以循環次數入豆')
  1747. for (step = 1; step <= testing_in_vacuum_loop; step++) {
  1748. console.log('-- 循環第 ' + step + ' 次 --');
  1749. // aaa tankVacuum_ON()
  1750. console.log('tankVacuum_ON')
  1751. var time = new Date();
  1752. while ((new Date() - time) < testing_in_vacuum_in * 1000) { };
  1753. // aaa tankVacuum_OFF()
  1754. console.log('tankVacuum_OFF')
  1755. var time = new Date();
  1756. while ((new Date() - time) < testing_in_vacuum_out * 1000) { };
  1757. }
  1758. console.log('循環入豆結束')
  1759. }
  1760. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1761. }
  1762. </script>
  1763. </td>
  1764. <td>
  1765. <button type="submit" class="btn btn-primary" onclick="Heat()">攪拌加熱</button>
  1766. <script>
  1767. var Heat_Process = 0;
  1768. function Heat(){
  1769. clearInterval(WebUpdate_set);
  1770. var testing_Heat_Motor = $("input[name=testing_Heat_Motor]").val();
  1771. var testing_Heat_Temp = $("input[name=testing_Heat_Temp]").val();
  1772. var testing_Heat_Humidity = $("input[name=testing_Heat_Humidity]").val();
  1773. var testing_Heat_time = $("input[name=testing_Heat_time]").val();
  1774. console.log('指定馬達轉速: ' + testing_Heat_Motor)
  1775. console.log('指定溫度: ' + testing_Heat_Temp)
  1776. console.log('指定濕度: ' + testing_Heat_Humidity)
  1777. console.log('指定乾燥秒數: ' + testing_Heat_time)
  1778. $.get('/dry_SHT11_' + tank_num, '', function (res) {
  1779. if ( (res.SHT11_Temp < testing_Heat_Temp) || (res.SHT11_Humidity < testing_Heat_Humidity) ) {
  1780. // aaa tankHeater1_ON()
  1781. console.log('tankHeater1_ON')
  1782. // aaa tankHeater2_ON()
  1783. console.log('tankHeater2_ON')
  1784. // aaa tankBlower_ON()
  1785. console.log('tankBlower_ON')
  1786. }
  1787. }, 'json');
  1788. var data = { "tank_num": "D" + tank_num, "command": "tank_motor_status", "value": testing_Heat_Motor };
  1789. $.post('/mqtt/{{tid}}', data, function (res) {
  1790. console.log('data:', data)
  1791. }, 'text')
  1792. console.log('Motor ' + testing_Heat_Motor)
  1793. var Heat_interval = setInterval(Heater, 5000);
  1794. function Heater(){
  1795. var Temp_Weights_SHT11 = parseFloat($("#Temp_Weights_SHT11").val());
  1796. var Temp_Weights_Soil = parseFloat($("#Temp_Weights_Soil").val());
  1797. if ( Heat_Process == 1 ) {
  1798. return;
  1799. }
  1800. Heat_Process = 1;
  1801. $.ajax({
  1802. async:false,
  1803. type:"GET",
  1804. url:"/dry_SHT11_" + tank_num,
  1805. dataType:"json",
  1806. success:function(response){
  1807. var present_temp = Math.round((response.SHT11_Temp*Temp_Weights_SHT11 + response.Soil_Temp*Temp_Weights_Soil)/(Temp_Weights_SHT11+Temp_Weights_Soil)*100) / 100
  1808. var present_Humidity = response.SHT11_Humidity
  1809. if ( (present_Humidity > testing_Heat_Humidity) &&
  1810. (present_temp > testing_Heat_Temp) ) {
  1811. console.log("已達指定溫濕度, 乾燥 " + testing_Heat_time + " 秒")
  1812. clearInterval(Heat_interval)
  1813. var time = new Date();
  1814. while ( (new Date() - time) < testing_Heat_time * 1000 ) { }
  1815. // aaa ChangeMotor_OFF()
  1816. console.log('ChangeMotor_OFF')
  1817. // aaa tankHeater1_OFF()
  1818. console.log('tankHeater1_OFF')
  1819. // aaa tankHeater2_OFF()
  1820. console.log('tankHeater2_OFF')
  1821. // aaa tankBlower_OFF()
  1822. console.log('tankBlower_OFF')
  1823. console.log('攪拌加熱完成!')
  1824. } else if ( present_Humidity > testing_Heat_Humidity ) {
  1825. console.log('已達指定濕度, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
  1826. } else if ( present_temp > testing_Heat_Temp ) {
  1827. console.log('已達指定溫度, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
  1828. } else {
  1829. console.log('加熱中, 溫: ' + present_temp + ' / 濕: ' + present_Humidity)
  1830. }
  1831. Heat_Process = 0;
  1832. },
  1833. error:function(thrownError){
  1834. console.log('Error: ' + thrownError)
  1835. Heat_Process = 0;
  1836. }
  1837. })
  1838. };
  1839. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1840. };
  1841. </script>
  1842. </td>
  1843. <td>
  1844. <button type="submit" class="btn btn-primary" onclick="disinfectTest()">消毒清洗測試</button>
  1845. <script>
  1846. function disinfectTest(){
  1847. var testing_clean_motor = $('#testing_clean_motor').val();
  1848. var testing_disinfect_time = parseInt($('#testing_disinfect_time').val());
  1849. setMotor(testing_clean_motor)
  1850. var time = new Date();
  1851. while ((new Date() - time) < 1 * 1000) { }
  1852. // aaa tankSolenoidDisinfect_ON()
  1853. console.log('tankSolenoidDisinfect_ON')
  1854. var time = new Date();
  1855. while ((new Date() - time) < testing_disinfect_time * 1000) { }
  1856. // aaa tankSolenoidDisinfect_OFF()
  1857. console.log('tankSolenoidDisinfect_OFF')
  1858. setMotor('0')
  1859. var time = new Date();
  1860. while ((new Date() - time) < 1 * 1000) { }
  1861. };
  1862. </script>
  1863. </td>
  1864. <td>
  1865. <button type="submit" class="btn btn-primary" onclick="diskValveTest()">蝴蝶閥測試(秒)</button><br>
  1866. <button type="submit" class="btn btn-primary" onclick="tankVacuumTest()">真空吸料機測試(秒)</button><br>
  1867. <button type="submit" class="btn btn-primary" onclick="threewayvalveTest()">三通閥測試(秒)</button>
  1868. <script>
  1869. function threewayvalveTest() {
  1870. clearInterval(WebUpdate_set);
  1871. var Testing_starttime = $("input[name=Testing_starttime]").val();
  1872. var Testing_endtime = $("input[name=Testing_endtime]").val();
  1873. var Testing_loop = $("input[name=Testing_loop]").val();
  1874. alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
  1875. var step;
  1876. for (step = 1; step <= Testing_loop; step++) {
  1877. console.log('循環第 ' + step + ' 次');
  1878. tankThreeWayValve_ON()
  1879. console.log('tankThreeWayValve_ON')
  1880. var time = new Date();
  1881. while ((new Date() - time) < Testing_starttime * 1000) { }
  1882. tankThreeWayValve_OFF()
  1883. console.log('tankThreeWayValve_OFF')
  1884. var time = new Date();
  1885. while ((new Date() - time) < Testing_endtime * 1000) { }
  1886. }
  1887. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1888. }
  1889. </script>
  1890. <script>
  1891. function tankVacuumTest() {
  1892. clearInterval(WebUpdate_set);
  1893. var Testing_starttime = $("input[name=Testing_starttime]").val();
  1894. var Testing_endtime = $("input[name=Testing_endtime]").val();
  1895. var Testing_loop = $("input[name=Testing_loop]").val();
  1896. alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
  1897. var step;
  1898. for (step = 1; step <= Testing_loop; step++) {
  1899. console.log('循環第 ' + step + ' 次');
  1900. tankVacuum_ON()
  1901. console.log('tankVacuum_ON')
  1902. var time = new Date();
  1903. while ((new Date() - time) < Testing_starttime * 1000) { }
  1904. tankVacuum_OFF()
  1905. console.log('tankVacuum_OFF')
  1906. var time = new Date();
  1907. while ((new Date() - time) < Testing_endtime * 1000) { }
  1908. }
  1909. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1910. }
  1911. </script>
  1912. <script>
  1913. function diskValveTest() {
  1914. clearInterval(WebUpdate_set);
  1915. var Testing_starttime = $("input[name=Testing_starttime]").val();
  1916. var Testing_endtime = $("input[name=Testing_endtime]").val();
  1917. var Testing_loop = $("input[name=Testing_loop]").val();
  1918. alert('測試間隔' + Testing_starttime + ':' + Testing_endtime + ' 次數' + Testing_loop)
  1919. var step;
  1920. for (step = 1; step <= Testing_loop; step++) {
  1921. console.log('循環第 ' + step + ' 次');
  1922. tankDiskValve_ON()
  1923. console.log('tankDiskValve_ON')
  1924. var time = new Date();
  1925. while ((new Date() - time) < Testing_starttime * 1000) { }
  1926. tankDiskValve_OFF()
  1927. console.log('tankDiskValve_OFF')
  1928. var time = new Date();
  1929. while ((new Date() - time) < Testing_endtime * 1000) { }
  1930. }
  1931. WebUpdate_set = setInterval(function(){WebUpdate(dtn)} , 10 * 1000);
  1932. }
  1933. </script>
  1934. </td>
  1935. </tr>
  1936. </table>
  1937. <br>
  1938. <h4>M5 攝影機畫面</h4>
  1939. <div class="container-fluid">
  1940. <div class="row" style="margin-top:10px;">
  1941. <div class="col flex">
  1942. <div class="col-md-12 row flex" style="text-align:center;margin-top:5px;">
  1943. <div class="col-md-12 row flex">
  1944. <img src="" id="four" width="70%" height="70%">
  1945. </div>
  1946. </div>
  1947. <script>
  1948. // M5 攝影機
  1949. //const img = document.querySelector('#one');
  1950. const img3 = document.querySelector('#four');
  1951. const WS_URL3 = 'ws:///60.250.156.230:8093';
  1952. //const WS_URL3 = 'ws:///60.250.156.230:8091';
  1953. const ws3 = new WebSocket(WS_URL3);
  1954. let urlObject3;
  1955. ws3.onopen = () => console.log(`Connected to ${WS_URL3}`);
  1956. ws3.onmessage = message3 => {
  1957. const arrayBuffer3 = message3.data;
  1958. if (urlObject3) {
  1959. URL.revokeObjectURL(urlObject3);
  1960. }
  1961. urlObject3 = URL.createObjectURL(new Blob([arrayBuffer3]));
  1962. img3.src = urlObject3;
  1963. }
  1964. </script>
  1965. </div>
  1966. </div>
  1967. </div>
  1968. <br>
  1969. <div style="text-align: center;">
  1970. <span id="user_status">管理者權限:_____</span><br>
  1971. 狀態更新時間(秒):
  1972. <input name="webupdate_time" type="text" value="5" style="width: 40px;">
  1973. <input type="button" value="設定更新時間" onclick="changeUpdate()">
  1974. </div>
  1975. <br>
  1976. <br>
  1977. <!--
  1978. <footer class="footer">
  1979. <div style="text-align: center; margin-top: 10px; font-size: 13px; margin-bottom: 10px;">
  1980. Copyright © 2021 Gold-in Tech. All Rights Reserved. 金子進科技股份有限公司 版權所有
  1981. <a href="mailto:service.gitc@gmail.com" target="_blank">service.gitc@gmail.com</a>
  1982. </div>
  1983. </footer>
  1984. -->
  1985. <div id="coffee_footer">
  1986. <!-- 匯入共同使用的 footer.html 內容 -->
  1987. {% include 'footer.html' %}
  1988. </div>
  1989. </div>
  1990. </body>
  1991. </html>