dry_container_0817.html 114 KB

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