1
0

clean_container_0805.html 68 KB

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