dry_container.html 110 KB

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