1
0

cargo2_actuator.html 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Aisky-coffee</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!-- 新 Bootstrap4 核心 CSS 文件 -->
  8. <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
  9. <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  10. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  11. <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
  12. <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
  13. <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
  14. <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
  15. <!--可用來建立使用者小圖示-->
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  17. <style>
  18. body {
  19. margin:0;
  20. }
  21. .navbar-dark .navbar-nav .nav-link {
  22. color: white;
  23. cursor: pointer;
  24. text-decoration:none;
  25. width: 110px;
  26. height: 46px;
  27. }
  28. .nav-top {
  29. line-height:40px;
  30. background-color: #C4C4C4;
  31. }
  32. .website_title{
  33. font-family: Roboto;
  34. font-style: normal;
  35. font-weight: normal;
  36. font-size: 30px;
  37. color: #000000;
  38. }
  39. .navbar-nav > li{
  40. float: none;
  41. display: inline-block;
  42. width: 100px;
  43. margin: 0 auto;
  44. text-align: center;
  45. }
  46. .navbar-nav > li a{
  47. font-size: 20px;
  48. }
  49. .main-page {
  50. margin-top: 200px;
  51. }
  52. .page-title {
  53. font-family: Roboto;
  54. font-style: normal;
  55. font-weight: bold;
  56. font-size: 36px;
  57. }
  58. .flex {
  59. display: flex;
  60. flex-direction: row;
  61. flex-wrap: wrap;
  62. justify-content: center;
  63. }
  64. .set-link {
  65. display: inline-block;
  66. width: 350px;
  67. height: 100px;
  68. line-height: 100px;
  69. background: #008CBA;
  70. border: 1px solid #CFCFCF;
  71. box-sizing: border-box;
  72. color: #FFFFFF;
  73. border-radius: 10px;
  74. font-size: 36px;
  75. }
  76. .cmn-toggle {
  77. position: absolute;
  78. margin-left: 0px;
  79. visibility: hidden;
  80. }
  81. .cmn-toggle + label {
  82. display: block;
  83. position: relative;
  84. cursor: pointer;
  85. outline: none;
  86. user-select: none;
  87. }
  88. input.cmn-toggle-round-flat + label {
  89. padding: 2px;
  90. width: 60px;
  91. height: 30px;
  92. background-color: #C0C0C0;
  93. border-radius: 60px;
  94. transition: background 0.4s;
  95. }
  96. input.cmn-toggle-round-flat + label:before,
  97. input.cmn-toggle-round-flat + label:after {
  98. display: block;
  99. position: absolute;
  100. content: "";
  101. }
  102. input.cmn-toggle-round-flat + label:before {
  103. top: 2px;
  104. left: 2px;
  105. bottom: 2px;
  106. right: 2px;
  107. background-color: #fff;
  108. border-radius: 60px;
  109. transition: background 0.4s;
  110. }
  111. input.cmn-toggle-round-flat + label:after {
  112. top: 4px;
  113. left: 4px;
  114. bottom: 4px;
  115. width: 24px;
  116. background-color: #dddddd;
  117. border-radius: 52px;
  118. transition: margin 0.4s, background 0.4s;
  119. }
  120. input.cmn-toggle-round-flat:checked + label {
  121. background-color: #C0C0C0;
  122. }
  123. input.cmn-toggle-round-flat:checked + label:after {
  124. margin-left: 27px;
  125. background-color: #008CBA;
  126. }
  127. @media(max-width:373px){
  128. .card {
  129. margin-right: 0px;
  130. }
  131. .set-link {
  132. width: 250px;
  133. }
  134. }
  135. @media(max-width:577px){
  136. }
  137. @media(min-width:576px){
  138. }
  139. @media(min-width:768px){
  140. .navbar-nav > li {
  141. margin-left: 0px;
  142. }
  143. .navbar-nav .li-block {
  144. display:none;
  145. }
  146. }
  147. @media(min-width:991px){
  148. .navbar-nav > li {
  149. margin-left: 20px;
  150. }
  151. .navbar-nav .li-block {
  152. display:none;
  153. }
  154. }
  155. @media(min-width:1200px){
  156. .navbar-nav > li {
  157. margin-left: 50px;
  158. }
  159. .navbar-nav .li-block {
  160. display: inline-block;
  161. width: 100px;
  162. }
  163. }
  164. @media(min-width:1400px){
  165. .navbar-nav .li-block {
  166. display: inline-block;
  167. width: 200px;
  168. }
  169. }
  170. @media(min-width:1689px) {
  171. .navbar-nav > li {
  172. margin-left: 50px;
  173. }
  174. .navbar-nav .li-block {
  175. display: inline-block;
  176. width: 500px;
  177. }
  178. }
  179. </style>
  180. <script>
  181. //relay抓取狀態函數
  182. function Relay(){
  183. $.get('/relay','',function(res){
  184. //console.log(res.relay);
  185. if(res.relay == '1'){
  186. $("#relay-status").text('加熱中!(每10秒更新一次)');
  187. }else{
  188. $("#relay-status").text('斷電中!');
  189. };
  190. },'json');
  191. };
  192. //脫皮機抓取狀態函數
  193. function Peeling(){
  194. $.get('/peeling','',function(res){
  195. //console.log(res.peeling);
  196. $("#peeling-status").text(res.peeling + ' rpm(每1分鐘更新一次)');
  197. },'json');
  198. };
  199. //控制蝴蝶閥函數
  200. function ButterflyValve(){
  201. //<!--setInterval(Relay,10000);-->
  202. var status = "off";
  203. var check = $("input[name=butterfly-valve-on]:checked");
  204. //大於0代表有被選中
  205. if(check.length > 0){
  206. status = "on";
  207. $("#cmn-toggle-02").prop('checked', false);
  208. if(!confirm("你確定要開啟蝴蝶閥嗎?")){
  209. return false;
  210. };
  211. }else{
  212. $("#cmn-toggle-02").prop('checked', true);
  213. if(!confirm("你確定要關閉蝴蝶閥嗎?")){
  214. return false;
  215. };
  216. };
  217. var data = {"tank-number":"1", "command":"butterfly-valve", "value":status};
  218. $.post('/mqtt/{{params.tid}}', data, function(res){
  219. if(res == 'on'){
  220. $("#cmn-toggle-02").prop('checked', true);
  221. setTimeout("alert('開啟成功!')", 500);
  222. }else if(res == 'off'){
  223. $("#cmn-toggle-02").prop('checked', false);
  224. setTimeout("alert('關閉成功!')", 500);
  225. }else{
  226. alert(res);
  227. };
  228. }, 'text')
  229. };
  230. //控制抽水馬達函數
  231. function PumpingMotor(){
  232. var status = "off";
  233. var check = $("input[name=pumping-motor-on]:checked");
  234. //大於0代表有被選中
  235. if(check.length > 0){
  236. status = "on";
  237. $("#cmn-toggle-05").prop('checked', false);
  238. if(!confirm("你確定要開啟抽水馬達嗎?")){
  239. return false;
  240. };
  241. }else{
  242. $("#cmn-toggle-05").prop('checked', true);
  243. if(!confirm("你確定要關閉抽水馬達嗎?")){
  244. return false;
  245. };
  246. };
  247. var data = {"tank-number":"1", "command":"pump", "value":status};
  248. $.post('/mqtt/{{params.tid}}', data, function(res){
  249. if(res == 'on'){
  250. $("#cmn-toggle-05").prop('checked', true);
  251. setTimeout("alert('開啟成功!')", 500);
  252. }else if(res == 'off'){
  253. $("#cmn-toggle-05").prop('checked', false);
  254. setTimeout("alert('關閉成功!')", 500);
  255. }else{
  256. alert(res);
  257. };
  258. }, 'text')
  259. };
  260. //控制真空吸料機函數
  261. function SuctionMachine(){
  262. var status = "off";
  263. var check = $("input[name=suction-machine-on]:checked");
  264. //大於0代表有被選中
  265. if(check.length > 0){
  266. status = "on";
  267. $("#cmn-toggle-08").prop('checked', false);
  268. if(!confirm("你確定要開啟真空吸料機嗎?")){
  269. return false;
  270. };
  271. }else{
  272. $("#cmn-toggle-08").prop('checked', true);
  273. if(!confirm("你確定要關閉真空吸料機嗎?")){
  274. return false;
  275. };
  276. };
  277. var data = {"tank-number":"1", "command":"suction-machine", "value":status};
  278. $.post('/mqtt/{{params.tid}}', data, function(res){
  279. if(res == 'on'){
  280. $("#cmn-toggle-08").prop('checked', true);
  281. setTimeout("alert('開啟成功!')", 500);
  282. }else if(res == 'off'){
  283. $("#cmn-toggle-08").prop('checked', false);
  284. setTimeout("alert('關閉成功!')", 500);
  285. }else{
  286. alert(res);
  287. };
  288. }, 'text')
  289. };
  290. //控制真空吸料機閥門函數
  291. function SuctionMachineValve(){
  292. var status = "off";
  293. var check = $("input[name=suction-machine-valve-on]:checked");
  294. //大於0代表有被選中
  295. if(check.length > 0){
  296. status = "on";
  297. $("#cmn-toggle-11").prop('checked', false);
  298. if(!confirm("你確定要開啟真空吸料機閥門嗎?")){
  299. return false;
  300. };
  301. }else{
  302. $("#cmn-toggle-11").prop('checked', true);
  303. if(!confirm("你確定要關閉真空吸料機閥門嗎?")){
  304. return false;
  305. };
  306. };
  307. var data = {"tank-number":"1", "command":"suction-machine-valve", "value":status};
  308. $.post('/mqtt/{{params.tid}}', data, function(res){
  309. if(res == 'on'){
  310. $("#cmn-toggle-11").prop('checked', true);
  311. setTimeout("alert('開啟成功!')", 500);
  312. }else if(res == 'off'){
  313. $("#cmn-toggle-11").prop('checked', false);
  314. setTimeout("alert('關閉成功!')", 500);
  315. }else{
  316. alert(res);
  317. };
  318. }, 'text')
  319. };
  320. //控制脫皮機馬達函數
  321. function PeelingMachine(){
  322. var peeling_data = $("input[name=peeling-data]").val();
  323. if(peeling_data == ''){
  324. $("#cmn-toggle-14").prop('checked', false);
  325. alert("請先輸入要運轉的值!");
  326. return false;
  327. }else if(Number(peeling_data) < -50 || Number(peeling_data) > 50 || !Number(peeling_data)){
  328. $("#cmn-toggle-14").prop('checked', false);
  329. alert("您輸入的值已超過範圍,請重新輸入!");
  330. return false;
  331. };
  332. var value = "off";
  333. var check = $("input[name=peeling-machine-on]:checked");
  334. //大於0代表有被選中
  335. if(check.length > 0){
  336. value = "on";
  337. $("#cmn-toggle-14").prop('checked', false);
  338. if(!confirm("你確定要開啟脫皮機馬達,運轉速度為" + peeling_data + "rpm嗎?")){
  339. return false;
  340. };
  341. }else{
  342. $("#cmn-toggle-14").prop('checked', true);
  343. if(!confirm("你確定要關閉脫皮機馬達嗎?")){
  344. return false;
  345. };
  346. };
  347. var data = {"tank-number":"1", "command":"peeling-machine", "value":value, "volume":peeling_data};
  348. $.post('/mqtt/{{params.tid}}', data, function(res){
  349. if(res == 'on'){
  350. $("#cmn-toggle-14").prop('checked', true);
  351. setTimeout("alert('開啟成功!')", 500);
  352. var timer = setInterval(Peeling,60000);
  353. }else if(res == 'off'){
  354. $("#cmn-toggle-14").prop('checked', false);
  355. setTimeout("alert('關閉成功!')", 500);
  356. clearInterval(timer);
  357. $("#peeling-status").text('');
  358. }else{
  359. alert(res);
  360. };
  361. }, 'text')
  362. };
  363. //改變脫皮機rpm函數
  364. function ChangePeeling(){
  365. var peeling_data = $("input[name=peeling-data]").val();
  366. if(!confirm("你確定要更改轉速為" + peeling_data + "嗎?")){
  367. return false;
  368. };
  369. var data = {"tank-number":"1", "command":"peeling-machine", "value":"on", "volume":peeling_data};
  370. $.post('/mqtt/{{params.tid}}', data, function(res){
  371. if(res == 'on'){
  372. alert('更改成功');
  373. }else{
  374. alert(res);
  375. };
  376. }, 'text');
  377. };
  378. //控制攪拌函數
  379. function Stir(){
  380. var stir_data = $("input[name=stir-data]").val();
  381. if(stir_data == ''){
  382. $("#cmn-toggle-17").prop('checked', false);
  383. alert("請先輸入要運轉的數值!");
  384. return false;
  385. }else if(Number(stir_data) < 0 || Number(stir_data) > 50){
  386. $("#cmn-toggle-17").prop('checked', false);
  387. alert("您輸入的值已超過範圍,請重新輸入!");
  388. return false;
  389. };
  390. var value = 'off';
  391. var check = $("input[name=stir-on]:checked");
  392. if(check.length > 0){
  393. value = 'on';
  394. $("#cmn-toggle-17").prop('checked', false);
  395. if(!confirm("你確定要開啟攪拌機馬達,運轉速度為" + stir_data + "rpm嗎?")){
  396. return false;
  397. };
  398. }else{
  399. $("#cmn-toggle-17").prop('checked', true);
  400. if(!confirm("你確定要關閉攪拌機馬達嗎?")){
  401. return false;
  402. };
  403. };
  404. var data = {"tank-number":"1", "command":'stir', "value":value, "volume":stir_data}
  405. $.post('/mqtt/{{params.tid}}', data, function(res){
  406. if(res == 'on'){
  407. $("#cmn-toggle-17").prop('checked', true);
  408. setTimeout("alert('開啟成功!')", 500);
  409. }else if(res == 'off'){
  410. $("#cmn-toggle-17").prop('checked', false);
  411. setTimeout("alert('關閉成功!')", 500);
  412. }else{
  413. alert(res);
  414. };
  415. }, 'text')
  416. };
  417. //改變攪拌機rpm函數
  418. function ChangeStir(){
  419. var stir_data = $("input[name=stir-data]").val();
  420. if(!confirm("你確定要更改轉速為" + stir_data + "嗎?")){
  421. return false;
  422. };
  423. var data = {"tank-number":"1", "command":"stir", "value":"on", "volume":stir_data};
  424. $.post('/mqtt/{{params.tid}}', data, function(res){
  425. if(res == 'on'){
  426. alert('更改成功');
  427. }else{
  428. alert(res);
  429. };
  430. }, 'text');
  431. };
  432. //恆溫控制函數
  433. function TemSubmit(){
  434. var tem_data = $("input[name=tem-data]").val();
  435. if(tem_data == ''){
  436. alert('請先填入要恆溫的數值!');
  437. return false;
  438. }else{
  439. if(!confirm('你填入的溫度為' + tem_data + '度,確定送出?')){
  440. return false;
  441. };
  442. };
  443. var data = {"command":"temp","value":tem_data};
  444. $.post('/mqtt/{{params.tid}}', data, function(res){
  445. if(res == 'on'){
  446. alert('送出成功!');
  447. setInterval(Relay,10000);
  448. }else{
  449. alert(res);
  450. };
  451. }, 'text')
  452. };
  453. //Valve1函數
  454. function Valve1(){
  455. var status = "off";
  456. var check = $("input[name=valve1-on]:checked");
  457. //大於0代表有被選中
  458. if(check.length > 0){
  459. status = "on";
  460. $("#cmn-toggle-20").prop('checked', false);
  461. if(!confirm("你確定要開啟Valve1嗎?")){
  462. return false;
  463. };
  464. }else{
  465. $("#cmn-toggle-20").prop('checked', true);
  466. if(!confirm("你確定要關閉Valve1嗎?")){
  467. return false;
  468. };
  469. };
  470. var data = {"tank-number":"1", "command":"valve1", "value":status};
  471. $.post('/mqtt/{{params.tid}}', data, function(res){
  472. if(res == 'on'){
  473. $("#cmn-toggle-20").prop('checked', true);
  474. setTimeout("alert('開啟成功!')", 500);
  475. }else if(res == 'off'){
  476. $("#cmn-toggle-20").prop('checked', false);
  477. setTimeout("alert('關閉成功!')", 500);
  478. }else{
  479. alert(res);
  480. };
  481. }, 'text')
  482. };
  483. //Valve2函數
  484. function Valve2(){
  485. var status = "off";
  486. var check = $("input[name=valve2-on]:checked");
  487. //大於0代表有被選中
  488. if(check.length > 0){
  489. status = "on";
  490. $("#cmn-toggle-23").prop('checked', false);
  491. if(!confirm("你確定要開啟Valve2嗎?")){
  492. return false;
  493. };
  494. }else{
  495. $("#cmn-toggle-23").prop('checked', true);
  496. if(!confirm("你確定要關閉Valve2嗎?")){
  497. return false;
  498. };
  499. };
  500. var data = {"tank-number":"1", "command":"valve2", "value":status};
  501. $.post('/mqtt/{{params.tid}}', data, function(res){
  502. if(res == 'on'){
  503. $("#cmn-toggle-23").prop('checked', true);
  504. setTimeout("alert('開啟成功!')", 500);
  505. }else if(res == 'off'){
  506. $("#cmn-toggle-23").prop('checked', false);
  507. setTimeout("alert('關閉成功!')", 500);
  508. }else{
  509. alert(res);
  510. };
  511. }, 'text')
  512. };
  513. //Pump1函數
  514. function Pump1(){
  515. var status = "off";
  516. var check = $("input[name=pump1-on]:checked");
  517. //大於0代表有被選中
  518. if(check.length > 0){
  519. status = "on";
  520. $("#cmn-toggle-26").prop('checked', false);
  521. if(!confirm("你確定要開啟Pump1嗎?")){
  522. return false;
  523. };
  524. }else{
  525. $("#cmn-toggle-26").prop('checked', true);
  526. if(!confirm("你確定要關閉Pump1嗎?")){
  527. return false;
  528. };
  529. };
  530. var data = {"tank-number":"1", "command":"pump1", "value":status};
  531. $.post('/mqtt/{{params.tid}}', data, function(res){
  532. if(res == 'on'){
  533. $("#cmn-toggle-26").prop('checked', true);
  534. setTimeout("alert('開啟成功!')", 500);
  535. }else if(res == 'off'){
  536. $("#cmn-toggle-26").prop('checked', false);
  537. setTimeout("alert('關閉成功!')", 500);
  538. }else{
  539. alert(res);
  540. };
  541. }, 'text')
  542. };
  543. //Pump2函數
  544. function Pump2(){
  545. var status = "off";
  546. var check = $("input[name=pump2-on]:checked");
  547. //大於0代表有被選中
  548. if(check.length > 0){
  549. status = "on";
  550. $("#cmn-toggle-29").prop('checked', false);
  551. if(!confirm("你確定要開啟Pump2嗎?")){
  552. return false;
  553. };
  554. }else{
  555. $("#cmn-toggle-29").prop('checked', true);
  556. if(!confirm("你確定要關閉Pump2嗎?")){
  557. return false;
  558. };
  559. };
  560. var data = {"tank-number":"1", "command":"pump2", "value":status};
  561. $.post('/mqtt/{{params.tid}}', data, function(res){
  562. if(res == 'on'){
  563. $("#cmn-toggle-29").prop('checked', true);
  564. setTimeout("alert('開啟成功!')", 500);
  565. }else if(res == 'off'){
  566. $("#cmn-toggle-29").prop('checked', false);
  567. setTimeout("alert('關閉成功!')", 500);
  568. }else{
  569. alert(res);
  570. };
  571. }, 'text')
  572. };
  573. //Pump3函數
  574. function Pump3(){
  575. var status = "off";
  576. var check = $("input[name=pump3-on]:checked");
  577. //大於0代表有被選中
  578. if(check.length > 0){
  579. status = "on";
  580. $("#cmn-toggle-32").prop('checked', false);
  581. if(!confirm("你確定要開啟Pump3嗎?")){
  582. return false;
  583. };
  584. }else{
  585. $("#cmn-toggle-32").prop('checked', true);
  586. if(!confirm("你確定要關閉Pump3嗎?")){
  587. return false;
  588. };
  589. };
  590. var data = {"tank-number":"1", "command":"pump3", "value":status};
  591. $.post('/mqtt/{{params.tid}}', data, function(res){
  592. if(res == 'on'){
  593. $("#cmn-toggle-32").prop('checked', true);
  594. setTimeout("alert('開啟成功!')", 500);
  595. }else if(res == 'off'){
  596. $("#cmn-toggle-32").prop('checked', false);
  597. setTimeout("alert('關閉成功!')", 500);
  598. }else{
  599. alert(res);
  600. };
  601. }, 'text')
  602. };
  603. //鼓風機函數
  604. function Blower(){
  605. var status = "off";
  606. var check = $("input[name=blower-on]:checked");
  607. //大於0代表有被選中
  608. if(check.length > 0){
  609. status = "on";
  610. $("#cmn-toggle-35").prop('checked', false);
  611. if(!confirm("你確定要開啟鼓風機嗎?")){
  612. return false;
  613. };
  614. }else{
  615. $("#cmn-toggle-35").prop('checked', true);
  616. if(!confirm("你確定要關閉鼓風機嗎?")){
  617. return false;
  618. };
  619. };
  620. var data = {"tank-number":"1", "command":"blower", "value":status};
  621. $.post('/mqtt/{{params.tid}}', data, function(res){
  622. if(res == 'on'){
  623. $("#cmn-toggle-35").prop('checked', true);
  624. setTimeout("alert('開啟成功!')", 500);
  625. }else if(res == 'off'){
  626. $("#cmn-toggle-35").prop('checked', false);
  627. setTimeout("alert('關閉成功!')", 500);
  628. }else{
  629. alert(res);
  630. };
  631. }, 'text')
  632. };
  633. //電熱管1函數
  634. function Heater1(){
  635. var status = "off";
  636. var check = $("input[name=heater1-on]:checked");
  637. //大於0代表有被選中
  638. if(check.length > 0){
  639. status = "on";
  640. $("#cmn-toggle-38").prop('checked', false);
  641. if(!confirm("你確定要開啟電熱管1嗎?")){
  642. return false;
  643. };
  644. }else{
  645. $("#cmn-toggle-38").prop('checked', true);
  646. if(!confirm("你確定要關閉電熱管1嗎?")){
  647. return false;
  648. };
  649. };
  650. var data = {"tank-number":"1", "command":"heater1", "value":status};
  651. $.post('/mqtt/{{params.tid}}', data, function(res){
  652. if(res == 'on'){
  653. $("#cmn-toggle-38").prop('checked', true);
  654. setTimeout("alert('開啟成功!')", 500);
  655. }else if(res == 'off'){
  656. $("#cmn-toggle-38").prop('checked', false);
  657. setTimeout("alert('關閉成功!')", 500);
  658. }else{
  659. alert(res);
  660. };
  661. }, 'text')
  662. };
  663. //電熱管2函數
  664. function Heater2(){
  665. var status = "off";
  666. var check = $("input[name=heater2-on]:checked");
  667. //大於0代表有被選中
  668. if(check.length > 0){
  669. status = "on";
  670. $("#cmn-toggle-41").prop('checked', false);
  671. if(!confirm("你確定要開啟電熱管2嗎?")){
  672. return false;
  673. };
  674. }else{
  675. $("#cmn-toggle-41").prop('checked', true);
  676. if(!confirm("你確定要關閉電熱管2嗎?")){
  677. return false;
  678. };
  679. };
  680. var data = {"tank-number":"1", "command":"heater2", "value":status};
  681. $.post('/mqtt/{{params.tid}}', data, function(res){
  682. if(res == 'on'){
  683. $("#cmn-toggle-41").prop('checked', true);
  684. setTimeout("alert('開啟成功!')", 500);
  685. }else if(res == 'off'){
  686. $("#cmn-toggle-41").prop('checked', false);
  687. setTimeout("alert('關閉成功!')", 500);
  688. }else{
  689. alert(res);
  690. };
  691. }, 'text')
  692. };
  693. </script>
  694. </head>
  695. <body>
  696. <nav class="fixed-top">
  697. <nav class="navbar navbar-expand-md nav-top justify-content-center">
  698. <div>
  699. <span class="website_title">發酵槽{{params.tid}}</span>
  700. </div>
  701. </nav>
  702. <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
  703. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
  704. <span class="navbar-toggler-icon"></span>
  705. </button>
  706. <div class="collapse navbar-collapse" id="collapsibleNavbar">
  707. <ul class="navbar-nav">
  708. <li class="nav-item">
  709. <a class="nav-link" href="/">首頁</a>
  710. </li>
  711. <li class="nav-item">
  712. <a class="nav-link" href="#">關於我們</a>
  713. </li>
  714. <li class="nav-item">
  715. <a class="nav-link" href="#">資訊</a>
  716. </li>
  717. <li class="nav-item">
  718. <a class="nav-link" href="#">聯絡方法</a>
  719. </li>
  720. <li class="nav-item">
  721. <a class="nav-link" href="/cargo_list">咖啡貨櫃</a>
  722. </li>
  723. <li class="nav-item">
  724. <a class="nav-link" href="/video">影像串流</a>
  725. </li>
  726. <li class="li-block"></li>
  727. <li class="nav-item">
  728. <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
  729. </li>
  730. <li class="nav-item">
  731. <a class="nav-link" href="/logout">Logout</a>
  732. </li>
  733. </ul>
  734. </div>
  735. </nav>
  736. </nav>
  737. <div class="main-page">
  738. <div class="text-center">
  739. <h1 style="margin-bottom:50px;">制動器狀態</h1>
  740. </div>
  741. <form method="" action="">
  742. <div class="container-fluid row">
  743. <div class="col-2"></div>
  744. <!--<div class="col-4">-->
  745. <div class="col-md-4 col-sm-12">
  746. <table border="1px solid black" style="font-size:20px;">
  747. <tr>
  748. <td style="color:red;">Valve</td>
  749. <td>
  750. <span style="color:#C0C0C0;">off</span>
  751. <span style="color:#008CBA;">on</span>
  752. </td>
  753. </tr>
  754. <tr>
  755. <td>1.蝴蝶閥</td>
  756. <td>
  757. <div class="switch_div">
  758. <div class="switch">
  759. <input id="cmn-toggle-01" class="cmn-toggle cmn-toggle-round" type="checkbox">
  760. <label for="cmn-toggle-01"></label>
  761. </div>
  762. <div class="switch text-center">
  763. <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="butterfly-valve-on" value="ON" onclick="ButterflyValve()">
  764. <label for="cmn-toggle-02"></label>
  765. </div>
  766. <div class="switch">
  767. <input id="cmn-toggle-03" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  768. <label for="cmn-toggle-03" data-on="Yes" data-off="No"></label>
  769. </div>
  770. </div>
  771. </td>
  772. </tr>
  773. <tr>
  774. <td>2.抽水馬達</td>
  775. <td>
  776. <div class="switch_div">
  777. <div class="switch">
  778. <input id="cmn-toggle-04" class="cmn-toggle cmn-toggle-round" type="checkbox">
  779. <label for="cmn-toggle-04"></label>
  780. </div>
  781. <div class="switch text-center">
  782. <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="pumping-motor-on" value="ON" onclick="PumpingMotor()">
  783. <label for="cmn-toggle-05"></label>
  784. </div>
  785. <div class="switch">
  786. <input id="cmn-toggle-06" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  787. <label for="cmn-toggle-06" data-on="Yes" data-off="No"></label>
  788. </div>
  789. </div>
  790. </td>
  791. </tr>
  792. <tr>
  793. <td>3.真空吸料機</td>
  794. <td>
  795. <div class="switch_div">
  796. <div class="switch">
  797. <input id="cmn-toggle-07" class="cmn-toggle cmn-toggle-round" type="checkbox">
  798. <label for="cmn-toggle-07"></label>
  799. </div>
  800. <div class="switch text-center">
  801. <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="suction-machine-on" value="ON" onclick="SuctionMachine()">
  802. <label for="cmn-toggle-08"></label>
  803. </div>
  804. <div class="switch">
  805. <input id="cmn-toggle-09" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  806. <label for="cmn-toggle-09" data-on="Yes" data-off="No"></label>
  807. </div>
  808. </div>
  809. </td>
  810. </tr>
  811. <tr>
  812. <td>4.真空吸料機閥門</td>
  813. <td>
  814. <div class="switch_div">
  815. <div class="switch">
  816. <input id="cmn-toggle-10" class="cmn-toggle cmn-toggle-round" type="checkbox">
  817. <label for="cmn-toggle-10"></label>
  818. </div>
  819. <div class="switch text-center">
  820. <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="suction-machine-valve-on" value="ON" onclick="SuctionMachineValve()">
  821. <label for="cmn-toggle-11"></label>
  822. </div>
  823. <div class="switch">
  824. <input id="cmn-toggle-12" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  825. <label for="cmn-toggle-12" data-on="Yes" data-off="No"></label>
  826. </div>
  827. </div>
  828. </td>
  829. </tr>
  830. <tr>
  831. <td>5.Valve1</td>
  832. <td>
  833. <div class="switch_div">
  834. <div class="switch">
  835. <input id="cmn-toggle-19" class="cmn-toggle cmn-toggle-round" type="checkbox">
  836. <label for="cmn-toggle-19"></label>
  837. </div>
  838. <div class="switch text-center">
  839. <input id="cmn-toggle-20" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="valve1-on" value="ON" onclick="Valve1()">
  840. <label for="cmn-toggle-20"></label>
  841. </div>
  842. <div class="switch">
  843. <input id="cmn-toggle-21" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  844. <label for="cmn-toggle-21" data-on="Yes" data-off="No"></label>
  845. </div>
  846. </div>
  847. </td>
  848. </tr>
  849. <tr>
  850. <td>6.Valve2</td>
  851. <td>
  852. <div class="switch_div">
  853. <div class="switch">
  854. <input id="cmn-toggle-22" class="cmn-toggle cmn-toggle-round" type="checkbox">
  855. <label for="cmn-toggle-22"></label>
  856. </div>
  857. <div class="switch text-center">
  858. <input id="cmn-toggle-23" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="valve2-on" value="ON" onclick="Valve2()">
  859. <label for="cmn-toggle-23"></label>
  860. </div>
  861. <div class="switch">
  862. <input id="cmn-toggle-24" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  863. <label for="cmn-toggle-24" data-on="Yes" data-off="No"></label>
  864. </div>
  865. </div>
  866. </td>
  867. </tr>
  868. <tr>
  869. <td>7.Pump1</td>
  870. <td>
  871. <div class="switch_div">
  872. <div class="switch">
  873. <input id="cmn-toggle-25" class="cmn-toggle cmn-toggle-round" type="checkbox">
  874. <label for="cmn-toggle-25"></label>
  875. </div>
  876. <div class="switch text-center">
  877. <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="pump1-on" value="ON" onclick="Pump1()">
  878. <label for="cmn-toggle-26"></label>
  879. </div>
  880. <div class="switch">
  881. <input id="cmn-toggle-27" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  882. <label for="cmn-toggle-27" data-on="Yes" data-off="No"></label>
  883. </div>
  884. </div>
  885. </td>
  886. </tr>
  887. <tr>
  888. <td>8.Pump2</td>
  889. <td>
  890. <div class="switch_div">
  891. <div class="switch">
  892. <input id="cmn-toggle-28" class="cmn-toggle cmn-toggle-round" type="checkbox">
  893. <label for="cmn-toggle-28"></label>
  894. </div>
  895. <div class="switch text-center">
  896. <input id="cmn-toggle-29" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="pump2-on" value="ON" onclick="Pump2()">
  897. <label for="cmn-toggle-29"></label>
  898. </div>
  899. <div class="switch">
  900. <input id="cmn-toggle-30" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  901. <label for="cmn-toggle-30" data-on="Yes" data-off="No"></label>
  902. </div>
  903. </div>
  904. </td>
  905. </tr>
  906. <tr>
  907. <td>9.Pump3</td>
  908. <td>
  909. <div class="switch_div">
  910. <div class="switch">
  911. <input id="cmn-toggle-31" class="cmn-toggle cmn-toggle-round" type="checkbox">
  912. <label for="cmn-toggle-31"></label>
  913. </div>
  914. <div class="switch text-center">
  915. <input id="cmn-toggle-32" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="pump3-on" value="ON" onclick="Pump3()">
  916. <label for="cmn-toggle-32"></label>
  917. </div>
  918. <div class="switch">
  919. <input id="cmn-toggle-33" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  920. <label for="cmn-toggle-33" data-on="Yes" data-off="No"></label>
  921. </div>
  922. </div>
  923. </td>
  924. </tr>
  925. </table>
  926. </div>
  927. <!--<div>-->
  928. <!--&lt;!&ndash;<div class="switch_div">&ndash;&gt;-->
  929. <!--&lt;!&ndash;<span>蝴蝶閥</span>&ndash;&gt;-->
  930. <!--&lt;!&ndash;<div class="switch">&ndash;&gt;-->
  931. <!--&lt;!&ndash;<input id="cmn-toggle-01" class="cmn-toggle cmn-toggle-round" type="checkbox">&ndash;&gt;-->
  932. <!--&lt;!&ndash;<label for="cmn-toggle-01"></label>&ndash;&gt;-->
  933. <!--&lt;!&ndash;</div>&ndash;&gt;-->
  934. <!--&lt;!&ndash;<div class="switch text-center">&ndash;&gt;-->
  935. <!--&lt;!&ndash;<input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="butterfly-valve-on" value="ON" onclick="ButterflyValve()">&ndash;&gt;-->
  936. <!--&lt;!&ndash;<label for="cmn-toggle-02"></label>&ndash;&gt;-->
  937. <!--&lt;!&ndash;</div>&ndash;&gt;-->
  938. <!--&lt;!&ndash;<div class="switch">&ndash;&gt;-->
  939. <!--&lt;!&ndash;<input id="cmn-toggle-03" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">&ndash;&gt;-->
  940. <!--&lt;!&ndash;<label for="cmn-toggle-03" data-on="Yes" data-off="No"></label>&ndash;&gt;-->
  941. <!--&lt;!&ndash;</div>&ndash;&gt;-->
  942. <!--&lt;!&ndash;</div>&ndash;&gt;-->
  943. <!--</div>-->
  944. <!--<div>-->
  945. <!--攪拌機馬達:-->
  946. <!--<input name="" type="text" placeholder="請輸入你要運轉的趴數(1~100)" style="width:225px;"> %-->
  947. <!--<input name="" type="button" value="送出">-->
  948. <!--</div>-->
  949. <div class="col-md-4 col-sm-12">
  950. <table border="1px solid black" style="width:500px;height:300px;font-size:20px;">
  951. <tr>
  952. <td>10.鼓風機</td>
  953. <td>
  954. <div class="switch_div">
  955. <div class="switch">
  956. <input id="cmn-toggle-34" class="cmn-toggle cmn-toggle-round" type="checkbox">
  957. <label for="cmn-toggle-34"></label>
  958. </div>
  959. <div class="switch text-center">
  960. <input id="cmn-toggle-35" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="blower-on" value="ON" onclick="Blower()">
  961. <label for="cmn-toggle-35"></label>
  962. </div>
  963. <div class="switch">
  964. <input id="cmn-toggle-36" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  965. <label for="cmn-toggle-36" data-on="Yes" data-off="No"></label>
  966. </div>
  967. </div>
  968. </td>
  969. </tr>
  970. <tr>
  971. <td>11.電熱管1</td>
  972. <td>
  973. <div class="switch_div">
  974. <div class="switch">
  975. <input id="cmn-toggle-37" class="cmn-toggle cmn-toggle-round" type="checkbox">
  976. <label for="cmn-toggle-37"></label>
  977. </div>
  978. <div class="switch text-center">
  979. <input id="cmn-toggle-38" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="heater1-on" value="ON" onclick="Heater1()">
  980. <label for="cmn-toggle-38"></label>
  981. </div>
  982. <div class="switch">
  983. <input id="cmn-toggle-39" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  984. <label for="cmn-toggle-39" data-on="Yes" data-off="No"></label>
  985. </div>
  986. </div>
  987. </td>
  988. </tr>
  989. <tr>
  990. <td>12.電熱管2</td>
  991. <td>
  992. <div class="switch_div">
  993. <div class="switch">
  994. <input id="cmn-toggle-40" class="cmn-toggle cmn-toggle-round" type="checkbox">
  995. <label for="cmn-toggle-40"></label>
  996. </div>
  997. <div class="switch text-center">
  998. <input id="cmn-toggle-41" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="heater2-on" value="ON" onclick="Heater2()">
  999. <label for="cmn-toggle-41"></label>
  1000. </div>
  1001. <div class="switch">
  1002. <input id="cmn-toggle-42" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1003. <label for="cmn-toggle-42" data-on="Yes" data-off="No"></label>
  1004. </div>
  1005. </div>
  1006. </td>
  1007. </tr>
  1008. <tr>
  1009. <td>10.脫皮機馬達</td>
  1010. <td>
  1011. <input name="peeling-data" type="text" placeholder="請輸入你要運轉的rpm(-50~50)" style="width:280px;"> rpm
  1012. <div class="switch_div">
  1013. <div class="switch">
  1014. <input id="cmn-toggle-13" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1015. <label for="cmn-toggle-13"></label>
  1016. </div>
  1017. <div class="switch text-center">
  1018. <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="peeling-machine-on" value="ON" onclick="PeelingMachine()">
  1019. <label for="cmn-toggle-14"></label>
  1020. </div>
  1021. <div class="switch">
  1022. <input id="cmn-toggle-15" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1023. <label for="cmn-toggle-15" data-on="Yes" data-off="No"></label>
  1024. </div>
  1025. </div>
  1026. 狀態:
  1027. <span id="peeling-status" style="color:red;"></span>
  1028. <br>
  1029. <input type="button" value="送出(需改變rpm值時請點擊)" name="change-peeling" onclick="ChangePeeling()">
  1030. </td>
  1031. </tr>
  1032. <tr>
  1033. <td>11.攪拌機馬達:</td>
  1034. <td>
  1035. <input name="stir-data" type="text" placeholder="請輸入你要運轉的rpm(0~50)" style="width:280px;"> rpm
  1036. <div class="switch_div">
  1037. <div class="switch">
  1038. <input id="cmn-toggle-16" class="cmn-toggle cmn-toggle-round" type="checkbox">
  1039. <label for="cmn-toggle-16"></label>
  1040. </div>
  1041. <div class="switch text-center">
  1042. <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" name="stir-on" value="ON" onclick="Stir()">
  1043. <label for="cmn-toggle-17"></label>
  1044. </div>
  1045. <div class="switch">
  1046. <input id="cmn-toggle-18" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
  1047. <label for="cmn-toggle-18" data-on="Yes" data-off="No"></label>
  1048. </div>
  1049. </div>
  1050. <input type="button" value="送出(需改變rpm值時請點擊)" name="change-stir" onclick="ChangeStir()">
  1051. <!--<input name="stir-on" type="button" value="開啟" onclick="Stir('on')">-->
  1052. <!--<input name="stir-off" type="button" value="關閉" onclick="Stir('off')">-->
  1053. </td>
  1054. </tr>
  1055. <tr>
  1056. <td>12.恆溫的目標溫度:</td>
  1057. <td>
  1058. <input name="tem-data" type="text" placeholder="請輸入你要設定的目標溫度" style="width:280px;"> &#8451;
  1059. <input name="tem-submit" type="button" value="送出" onclick="TemSubmit()">
  1060. Relay狀態:
  1061. <span id="relay-status" style="color:red;"></span>
  1062. </td>
  1063. </tr>
  1064. </table>
  1065. </div>
  1066. </div>
  1067. </form>
  1068. </div>
  1069. </body>
  1070. </html>