123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>{{ title }}</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- <meta http-equiv="refresh" content="5" /> 每 content 秒網頁自動更新-->
- <!-- 新 Bootstrap4 核心 CSS 文件 -->
- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
- <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
- <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
- <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
- <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
- <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
- <!--可用來建立使用者小圖示-->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <!-- Socket.IO -->
- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.dev.js"></script>
-
- <script language="JavaScript">
- // 指定 10秒 刷新網頁一次
- var ctn = '{{tid}}';
- var status = '{{status}}';
- console.log('ctn:' + ctn)
- $(function(){
- $("#coffee_title_pc").text('C' + ctn + ' 清洗浮選槽操作介面');
- $("#coffee_title_phone").text('C' + ctn + ' 清洗浮選槽操作介面');
- if (status == 2) {
- $('input').prop('disabled', true);
- $('button').prop('disabled', true);
- } else if ( (status == 0) || (status == 1) ) {
- $('input').prop('disabled', false);
- $('button').prop('disabled', false);
- }
- });
- // WebUpdate_set = setInterval(function(){WebUpdate(ctn)} , 30 * 1000)
-
- </script>
- <style>
- .footer{
- position: absolute;
- width: 100%;
- background-color: #eee;
- text-align: center;
- }
- body {
- margin: 0;
- }
- .input-text {
- height: 25px;
- width: 40px;
- text-align: center;
- margin-left: 2px;
- margin-right: 5px;
- }
- .label_ActuatorStatus {
- margin: auto;
- }
- .input-button-on {
- color: #008CBA;
- border: 2px rgb(182, 181, 181) solid;
- background-color: whitesmoke;
- padding: 1px 3px;
- width: 45px;
- }
- .input-button-off {
- color: #707070;
- border: 2px rgb(192, 192, 192) solid;
- background-color: whitesmoke;
- padding: 1px 3px;
- width: 45px;
- }
- .input-button {
- font-size: 14px;
- color: #008CBA;
- border: 2px rgb(182, 181, 181) solid;
- background-color: whitesmoke;
- padding: 1px 3px;
- }
- .table-all {
- font-size:18px;
- border:2px #cccccc solid;
- margin-left: 10px;
- margin-right: 10px;
- width: 98%;
- }
-
- </style>
- <script>
- // 清洗浮選 制動器開關
- var tank_num = '{{tid}}';
- // 入料 真空吸料機
- function inputVacuum() {
- var status = "off";
- var check = $("input[name=input_vacuum_status]:checked"); // 這裡面是 jQuery 撈取資料的方法, jQuery 常使用到 $ 錢字號
- console.log('check:', check);
- //大於0代表有被選中, 如果有多個可以呈現勾取的項目數量
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-02").prop('checked', false); // 確認是否勾選
- if (!confirm("你確定要開啟入料儲豆槽真空吸料機嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-02").prop('checked', true);
- if (!confirm("你確定要關閉入料儲豆槽真空吸料機嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": status };
- // jquery 請求 '/mqtt/{{tid}}' 頁面
- $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-02").prop('checked', true);
- setTimeout("alert('入料儲豆槽真空吸料機_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-02").prop('checked', false);
- setTimeout("alert('入料儲豆槽真空吸料機_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function inputVacuum_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": "on" };
- // jquery 請求 '/mqtt/{{tid}}' 頁面
- $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-02").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-02").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function inputVacuum_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "input_vacuum_status", "value": "off" };
- // jquery 請求 '/mqtt/{{tid}}' 頁面
- $.post('/mqtt/{{tid}}', data, function (res) { //res:HTTP response argument to the middleware function
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-02").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-02").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 桶內 真空吸料機
- function tankVacuum() {
- var status = "off";
- var check = $("input[name=tank_vacuum_status]:checked");
- console.log('check:', check);
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-05").prop('checked', false);
- if (!confirm("你確定要開啟真空吸料機嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-05").prop('checked', true);
- if (!confirm("你確定要關閉真空吸料機嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-05").prop('checked', true);
- setTimeout("alert('真空吸料機_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-05").prop('checked', false);
- setTimeout("alert('真空吸料機_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankVacuum_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-05").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-05").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankVacuum_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_vacuum_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-05").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-05").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 浮選槽注水 雙核隔膜泵 出水口 2、3_雙核泵
- function tankPumpWaterL2L3() {
- //<!--setInterval(Relay,10000);-->
- var status = "off";
- var check = $("input[name=tank_pump_waterL2L3_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-08").prop('checked', false);
- if (!confirm("你確定要開啟浮選槽注水嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-08").prop('checked', true);
- if (!confirm("你確定要關閉浮選槽注水嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-08").prop('checked', true);
- setTimeout("alert('浮選槽注水入料_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-08").prop('checked', false);
- setTimeout("alert('浮選槽注水排氣_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterL2L3_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-08").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-08").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterL2L3_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL2L3_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-08").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-08").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 第 2 層灑水 雙核隔膜泵 出水口 4、5_雙核泵
- function tankPumpWaterL4L5() {
- //<!--setInterval(Relay,10000);-->
- var status = "off";
- var check = $("input[name=tank_pump_waterL4L5_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-11").prop('checked', false);
- if (!confirm("你確定要開啟清洗第 2 層灑水嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-11").prop('checked', true);
- if (!confirm("你確定要關閉清洗第 2 層灑水嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-11").prop('checked', true);
- setTimeout("alert('清洗第 2 層灑水_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-11").prop('checked', false);
- setTimeout("alert('清洗第 2 層灑水_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterL4L5_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-11").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-11").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterL4L5_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterL4L5_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-11").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-11").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 第 4 層灑水 雙核隔膜泵 入水口_雙核泵
- function tankPumpWaterInput() {
- var status = "off";
- var check = $("input[name=tank_pump_waterInput_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-14").prop('checked', false);
- if (!confirm("你確定要開啟清洗第 4 層灑水嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-14").prop('checked', true);
- if (!confirm("你確定要關閉清洗第 4 層灑水嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-14").prop('checked', true);
- setTimeout("alert('清洗第 4 層灑水_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-14").prop('checked', false);
- setTimeout("alert('清洗第 4 層灑水_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterInput_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-14").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-14").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankPumpWaterInput_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_pump_waterInput_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-14").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-14").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 清洗第 3 層 電磁閥 出水口 2、3_電磁閥
- function tankSolenoidWaterL2L3() {
- var status = "off";
- var check = $("input[name=tank_solenoid_waterL2L3_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-17").prop('checked', false);
- if (!confirm("你確定要開啟清洗第 3 層電磁閥嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-17").prop('checked', true);
- if (!confirm("你確定要關閉清洗第 3 層電磁閥嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-17").prop('checked', true);
- setTimeout("alert('清洗第 3 層電磁閥_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-17").prop('checked', false);
- setTimeout("alert('清洗第 3 層電磁閥_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSolenoidWaterL2L3_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-17").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-17").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSolenoidWaterL2L3_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL2L3_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-17").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-17").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 清洗第 5 層 電磁閥 出水口 4、5_電磁閥
- function tankSolenoidWaterL4L5() {
- var status = "off";
- var check = $("input[name=tank_solenoid_waterL4L5_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-20").prop('checked', false);
- if (!confirm("你確定要開啟清洗第 5 層電磁閥嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-20").prop('checked', true);
- if (!confirm("你確定要關閉清洗第 5 層電磁閥嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": status };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-20").prop('checked', true);
- setTimeout("alert('清洗第 5 層電磁閥_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-20").prop('checked', false);
- setTimeout("alert('清洗第 5 層電磁閥_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSolenoidWaterL4L5_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": "on" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-20").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-20").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSolenoidWaterL4L5_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "tank_solenoid_waterL4L5_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- $("#cmn-toggle-20").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-20").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- // 步進馬達
- /*
- function tankSteppingMotor() {
- var motor_data = $("input[name=steppingmotor_rpm_data]").val();
- if (motor_data == '') {
- alert("請先輸入要運轉的值!");
- return false;
- } else if (motor_data == 0) {
- alert("轉速 0 為關閉步進馬達");
- } else if (Number(motor_data) < -50 || Number(motor_data) > 50 || !Number(motor_data)) {
- alert("您輸入的值已超過範圍,請重新輸入!" + !Number(motor_data));
- return false;
- };
- if (motor_data != 0) {
- value = motor_data;
- if (!confirm("你確定要開啟步進馬達,運轉速度為 " + motor_data + " 嗎?")) {
- return false;
- };
- } else {
- if (!confirm("你確定要關閉步進馬達嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": motor_data };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- if (res == 'on') {
- setTimeout("alert('步進馬達_開啟成功!')", 500);
- } else if (res == 'off') {
- setTimeout("alert('步進馬達_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- */
- function tankSteppingMotor_STOP() {
- var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSteppingMotor_UP() {
- var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"up"};
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSteppingMotor_DOWN() {
- var data = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"down" };
- $.post('/mqtt/{{tid}}', data, function (res) {
- console.log('data:', data)
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function tankSteppingMotor_UPSTOP() {
- var data_up = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"up"};
- $.post('/mqtt/{{tid}}', data_up, function (res) {
- console.log('data:', data_up)
- }, 'text')
- var time = new Date();
- while ((new Date() - time) < 1 * 1000) { };
- var data_stop = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data_stop, function (res) {
- console.log('data:', data_stop)
- }, 'text')
- };
- function tankSteppingMotor_DOWNSTOP() {
- var data_down = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "on", "dir":"down"};
- $.post('/mqtt/{{tid}}', data_down, function (res) {
- console.log('data:', data_down)
- }, 'text')
- var time = new Date();
- while ((new Date() - time) < 1 * 1000) { };
- var data_stop = { "tank_num": "C" + tank_num, "command": "step_motor_status", "value": "off" };
- $.post('/mqtt/{{tid}}', data_stop, function (res) {
- console.log('data:', data_stop)
- }, 'text')
- };
- // 出料 真空吸料機
- function outputVacuum() {
- var status = "off";
- var check = $("input[name=output_vacuum_status]:checked");
- //大於0代表有被選中
- if (check.length > 0) {
- status = "on";
- $("#cmn-toggle-26").prop('checked', false);
- if (!confirm("你確定要開啟出料儲豆槽真空吸料機嗎?")) {
- return false;
- };
- } else {
- $("#cmn-toggle-26").prop('checked', true);
- if (!confirm("你確定要關閉出料儲豆槽真空吸料機嗎?")) {
- return false;
- };
- };
- var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": status };
- console.log('data:', data)
- $.post('/mqtt/{{tid}}', data, function (res) {
- if (res == 'on') {
- $("#cmn-toggle-26").prop('checked', true);
- setTimeout("alert('出料儲豆槽真空吸料機_開啟成功!')", 500);
- } else if (res == 'off') {
- $("#cmn-toggle-26").prop('checked', false);
- setTimeout("alert('出料儲豆槽真空吸料機_關閉成功!')", 500);
- } else {
- alert(res);
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function outputVacuum_ON() {
- var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": "on" };
- console.log('data:', data)
- $.post('/mqtt/{{tid}}', data, function (res) {
- if (res == 'on') {
- $("#cmn-toggle-26").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-26").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- function outputVacuum_OFF() {
- var data = { "tank_num": "C" + tank_num, "command": "output_vacuum_status", "value": "off" };
- console.log('data:', data)
- $.post('/mqtt/{{tid}}', data, function (res) {
- if (res == 'on') {
- $("#cmn-toggle-26").prop('checked', true);
- } else if (res == 'off') {
- $("#cmn-toggle-26").prop('checked', false);
- } else {
- };
- }, 'text')
- // setTimeout(function () { location.reload(); }, 500);
- };
- </script>
- </head>
- <body>
- <div id="wrapper">
- <div id="coffee_header">
- <!-- 匯入共同使用的 header.html 內容 -->
- {% include 'header.html' %}
- </div>
-
- <h4>制動器</h4>
- <table border="1" class="table-all" cellpadding="3" style="text-align: center;">
- <tr>
- <td style="color:red;">Valve</td>
- <td>入料<br>真空吸料機</td>
- <td>浮選入豆<br>真空吸料機</td>
- <td>出水口 2、3_<br>雙核隔膜泵</td>
- <td>出水口 4、5_<br>雙核隔膜泵</td>
- <td>入水口_<br>雙核隔膜泵</td>
- <td>清洗第 3 層<br>電磁閥</td>
- <td>清洗第 5 層<br>電磁閥</td>
- <td>
- 步進馬達
- <span id="tank_stepping_motor_t_status">{{tank_stepping_motor}}</span>
- </td>
- <td>出料<br>真空吸料機</td>
- </tr>
- <tr>
- <td>
- <span style="color:#C0C0C0;">off</span>
- <span style="color:#008CBA;">on</span>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-01" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-01"></label>
- </div>
- <div class="switch text-center">
- {% if input_vacuum=='ON' %}
- <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_vacuum_status" value="ON" onclick="inputVacuum()">
- {% else %}
- <input id="cmn-toggle-02" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_vacuum_status" value="OFF" onclick="inputVacuum()">
- {% endif %}
- <label for="cmn-toggle-02" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-03" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-03" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-04" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-04"></label>
- </div>
- <div class="switch text-center">
- {% if tank_vacuum=='ON' %}
- <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_vacuum_status" value="ON" onclick="tankVacuum()">
- {% else %}
- <input id="cmn-toggle-05" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_vacuum_status" value="OFF" onclick="tankVacuum()">
- {% endif %}
- <label for="cmn-toggle-05" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-06" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-06" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-07" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-07"></label>
- </div>
- <div class="switch text-center">
- {% if tank_pump_waterL2L3=='ON' %}
- <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_pump_waterL2L3_status" value="ON" onclick="tankPumpWaterL2L3()">
- {% else %}
- <input id="cmn-toggle-08" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_pump_waterL2L3_status" value="OFF" onclick="tankPumpWaterL2L3()">
- {% endif %}
- <label for="cmn-toggle-08" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-09" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-09" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-10" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-10"></label>
- </div>
- <div class="switch text-center">
- {% if tank_pump_waterL4L5=='ON' %}
- <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_pump_waterL4L5_status" value="ON" onclick="tankPumpWaterL4L5()">
- {% else %}
- <input id="cmn-toggle-11" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_pump_waterL4L5_status" value="OFF" onclick="tankPumpWaterL4L5()">
- {% endif %}
- <label for="cmn-toggle-11" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-12" class="cmn-toggle cmn-toggle-on-off" type="checkbox">
- <label for="cmn-toggle-12" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-13" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-13"></label>
- </div>
- <div class="switch text-center">
- {% if tank_pump_waterInput=='ON' %}
- <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_pump_waterInput_status" value="ON" onclick="tankPumpWaterInput()">
- {% else %}
- <input id="cmn-toggle-14" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_pump_waterInput_status" value="OFF" onclick="tankPumpWaterInput()">
- {% endif %}
- <label for="cmn-toggle-14" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-15" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-15" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-16" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-16"></label>
- </div>
- <div class="switch text-center">
- {% if tank_solenoid_waterL2L3=='ON' %}
- <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" checked type="checkbox"
- name="tank_solenoid_waterL2L3_status" value="ON" onclick="tankSolenoidWaterL2L3()">
- {% else %}
- <input id="cmn-toggle-17" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_solenoid_waterL2L3_status" value="OFF" onclick="tankSolenoidWaterL2L3()">
- {% endif %}
- <label for="cmn-toggle-17" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-18" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-18" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-19" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-19"></label>
- </div>
- <div class="switch text-center">
- {% if tank_solenoid_waterL4L5=='ON' %}
- <input id="cmn-toggle-20" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="tank_solenoid_waterL4L5_status" value="ON" onclick="tankSolenoidWaterL4L5()">
- {% else %}
- <input id="cmn-toggle-20" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="tank_solenoid_waterL4L5_status" value="OFF" onclick="tankSolenoidWaterL4L5()">
- {% endif %}
- <label for="cmn-toggle-20" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-21" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-21" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- <td>
- <input type="button" value="UP" name="tank_stepping_motor_UP" onclick="tankSteppingMotor_UP()">
- <input type="button" value="STOP" name="tank_stepping_motor_STOP" onclick="tankSteppingMotor_STOP()">
- <input type="button" value="DOWN" name="tank_stepping_motor_DOWN" onclick="tankSteppingMotor_DOWN()">
- </td>
- <td>
- <div class="switch_div">
- <div class="switch">
- <input id="cmn-toggle-25" class="cmn-toggle cmn-toggle-round" type="checkbox">
- <label for="cmn-toggle-25"></label>
- </div>
- <div class="switch text-center">
- {% if output_vacuum=='ON' %}
- <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" checked
- name="output_vacuum_status" value="ON" onclick="outputVacuum()">
- {% else %}
- <input id="cmn-toggle-26" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"
- name="output_vacuum_status" value="OFF" onclick="outputVacuum()">
- {% endif %}
- <label for="cmn-toggle-26" class="label_ActuatorStatus"></label>
- </div>
- <div class="switch">
- <input id="cmn-toggle-27" class="cmn-toggle cmn-toggle-yes-no" type="checkbox">
- <label for="cmn-toggle-27" data-on="Yes" data-off="No"></label>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <td><span style="color:#008CBA;"><b>ON</b></span></td>
- <td><input type="button" class="input-button-on" value="ON" name="input_vacuum_ON" onclick="inputVacuum_ON()"></td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_vacuum_ON" onclick="tankVacuum_ON()"></td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_pump_water_float_ON" onclick="tankPumpWaterL2L3_ON()"></td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_pump_waterL4L5_ON" onclick="tankPumpWaterL4L5_ON()">
- </td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_pump_waterInput_ON" onclick="tankPumpWaterInput_ON()">
- </td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_solenoid_waterL2L3_ON" onclick="tankSolenoidWaterL2L3_ON()">
- </td>
- <td><input type="button" class="input-button-on" value="ON" name="tank_solenoid_waterL4L5_ON" onclick="tankSolenoidWaterL4L5_ON()">
- </td>
- <td><input type="button" value="UP" name="tank_stepping_motor_UP" onclick="tankSteppingMotor_UPSTOP()">
- </td>
- <td><input type="button" class="input-button-on" value="ON" name="output_vacuum_ON" onclick="outputVacuum_ON()"></td>
- </tr>
- <tr>
- <td><span style="color:#C0C0C0;"><b>OFF</b></span></td>
- <td><input type="button" class="input-button-off" value="OFF" name="input_vacuum_OFF" onclick="inputVacuum_OFF()"></td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_vacuum_OFF" onclick="tankVacuum_OFF()"></td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_water_float_OFF" onclick="tankPumpWaterL2L3_OFF()">
- </td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_waterL4L5_OFF" onclick="tankPumpWaterL4L5_OFF()">
- </td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_pump_waterInput_OFF" onclick="tankPumpWaterInput_OFF()">
- </td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_solenoid_waterL2L3_OFF" onclick="tankSolenoidWaterL2L3_OFF()">
- </td>
- <td><input type="button" class="input-button-off" value="OFF" name="tank_solenoid_waterL4L5_OFF" onclick="tankSolenoidWaterL4L5_OFF()">
- </td>
- <td><input type="button" value="DOWN" name="tank_stepping_motor_STOP" onclick="tankSteppingMotor_DOWNSTOP()">
- </td>
- <td><input type="button" class="input-button-off" value="OFF" name="output_vacuum_OFF" onclick="outputVacuum_OFF()"></td>
- </tr>
- </table>
- <br>
- <h4>感測器</h4>
- <table border="1" class="table-all" cellpadding="5">
- <tr>
- <td>[桶內] 生豆高度:<span id="UltraSonic_t_status">{{tank_UltraSonic.UltraSonic}}</span></td>
- </tr>
- </table>
- <br>
- <h4>排程測試</h4>
- <table border="1" class="table-all" cellpadding="5">
- <tr>
- <td>水路測試</td>
- <td>排氣下豆測試</td>
- <td>生豆閘門測試</td>
- <td>出料測試</td>
- <td>出水口 4、5 <br>電磁閥逆洗</td>
- <td>出水口 2、3 <br>電磁閥逆洗</td>
- <td>清洗浮選連動</td>
- </tr>
- <tr>
- <td>
- 入水口_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_1" value="30" style="width:50px;">
- 秒
- <br>
- 出水口 4、5_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_2" value="30" style="width:50px;">
- 秒
- <br>
- 出水口 2、3_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_3" value="0" style="width:50px;">
- 秒
- </td>
- <td>
- 真空吸料機 ON
- <input type="text" class="input-text" name="waiting_time_8" value="1" style="width:50px;">
- 秒
- <br>
- 真空吸料機 OFF
- <input type="text" class="input-text" name="waiting_time_9" value="10" style="width:50px;">
- 秒
- <br>
- * 循環次數
- <input type="text" class="input-text" name="waiting_loop_3" value="3" style="width:50px;">
- </td>
- <td>
- 上升
- <input type="text" class="input-text" name="waiting_time_4" value="3.5" style="width:50px;">
- 秒
- <br>
- 停止
- <input type="text" class="input-text" name="waiting_time_5" value="3" style="width:50px;">
- 秒
- <br>
- 下降
- <input type="text" class="input-text" name="waiting_time_6" value="3.5" style="width:50px;">
- 秒
- <br>
- 停止
- <input type="text" class="input-text" name="waiting_time_7" value="3" style="width:50px;">
- 秒
- <br>
- * 循環次數
- <input type="text" class="input-text" name="waiting_loop_2" value="3" style="width:50px;">
- </td>
- <td>
- 出料_吸料機 ON
- <input type="text" class="input-text" name="waiting_time_16" value="1" style="width:50px;">
- 秒
- <br>
- 出料_吸料機 OFF
- <input type="text" class="input-text" name="waiting_time_17" value="10" style="width:50px;">
- 秒
- <br>
- * 循環次數
- <input type="text" class="input-text" name="waiting_loop_4" value="3" style="width:50px;">
- </td>
- <td>
- 請依序開啟:
- <br>
- 入_雙核泵
- <br>
- 水龍頭
- <br>
- 出 4、5_電磁閥
- </td>
- <td>
- 請依序開啟:
- <br>
- 入_雙核泵
- <br>
- 水龍頭
- <br>
- 出 4、5_雙核泵
- <br>
- 出 2、3_電磁閥
- </td>
- <td>
- <font color = "red">生豆閘門零點</font>
- <br>
- 入水口_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_10" value="30" style="width:50px;">
- 秒
- <br>
- 出水口 4、5_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_11" value="30" style="width:50px;">
- 秒
- <br>
- 出水口 2、3_雙核泵 ON
- <input type="text" class="input-text" name="waiting_time_12" value="60" style="width:50px;">
- 秒
- <br>
- 真空吸料機 ON
- <input type="text" class="input-text" name="waiting_time_13" value="1" style="width:50px;">
- 秒
- <br>
- 真空吸料機 OFF
- <input type="text" class="input-text" name="waiting_time_14" value="10" style="width:50px;">
- 秒
- <br>
- * 循環次數
- <input type="text" class="input-text" name="waiting_loop_6" value="3" style="width:50px;">
- <br>
- 生豆閘門 升
- <br>
- <input type="text" class="input-text" name="waiting_time_15" value="10" style="width:50px;">
- 秒
- <br>
- 生豆閘門 降
- <br>
- 等待出豆時間
- <input type="text" class="input-text" name="waiting_time_20" value="120" style="width:50px;">
- 秒
- <br>
- 出料_吸料機 ON
- <input type="text" class="input-text" name="waiting_time_18" value="1" style="width:50px;">
- 秒
- <br>
- 出料_吸料機 OFF
- <input type="text" class="input-text" name="waiting_time_19" value="10" style="width:50px;">
- 秒
- <br>
- * 循環次數
- <input type="text" class="input-text" name="waiting_loop_5" value="3" style="width:50px;">
- </td>
- </tr>
- <tr>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_testing()">水路測試</button>
- <button type="submit" class="btn btn-primary" onclick="tank_WaterIn_testing_OFF()">水路測試 OFF</button>
- <script>
- function tank_WaterIn_testing() {
- // 清洗第 4 層灑水 ON
- tankPumpWaterInput_ON()
- console.log('tank_pump_waterInput_status ON')
- // 等待時間(秒)
- var time1 = $("input[name=waiting_time_1]").val();
- console.log('等待 ' + time1 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time1 * 1000) { };
- // 清洗第 2 層灑水 ON
- tankPumpWaterL4L5_ON()
- console.log('tank_pump_waterL4L5_status ON')
- // 等待時間(秒)
- var time2 = $("input[name=waiting_time_2]").val();
- console.log('等待 ' + time2 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time2 * 1000) { };
- // 浮選槽注水 ON
- tankPumpWaterL2L3_ON()
- console.log('tank_pump_waterL2L3_status ON')
- // 等待時間(秒)
- var time3 = $("input[name=waiting_time_3]").val();
- console.log('等待 ' + time3 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time3 * 1000) { };
- };
- </script>
- <script>
- function tank_WaterIn_testing_OFF(){
- tankPumpWaterInput_OFF()
- console.log('tankPumpWaterInput_OFF')
- var time = new Date();
- while ((new Date() - time) < 2 * 1000) { };
- tankPumpWaterL4L5_OFF()
- console.log('tankPumpWaterL4L5_OFF')
- var time = new Date();
- while ((new Date() - time) < 2 * 1000) { };
- tankPumpWaterL2L3_OFF()
- console.log('tankPumpWaterL2L3_OFF')
- }
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_BeanInputAir_testing()">排氣下豆測試</button>
- <script>
- function tank_BeanInputAir_testing() {
- // 循環次數
- var loop3 = $("input[name=waiting_loop_3]").val();
- console.log('--- 循環 ' + loop3 + ' 次 ---')
- for (step = 1; step <= loop3; step++) {
- // 真空吸料機 ON
- tankVacuum_ON()
- console.log('tankVacuum_ON')
- // 吸料時間
- var time8 = $("input[name=waiting_time_8]").val();
- console.log('等待 ' + time8 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time8 * 1000) { };
- // 真空吸料機 OFF
- tankVacuum_OFF()
- console.log('tankVacuum_OFF')
- // 吸料時間
- var time9 = $("input[name=waiting_time_9]").val();
- console.log('等待 ' + time9 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time9 * 1000) { };
- }
- }
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_BeanBaffle_testing()">生豆閘門測試</button>
- <script>
- function tank_BeanBaffle_testing() {
- // 循環次數
- var loop2 = $("input[name=waiting_loop_2]").val();
- console.log('--- 循環 ' + loop2 + ' 次 ---')
- for (step = 1; step <= loop2; step++) {
- // 生豆閘門 上升
- tankSteppingMotor_UP()
- console.log('tankSteppingMotor_UP')
- // 上升持續時間(秒)
- var time4 = $("input[name=waiting_time_4]").val();
- console.log('等待 ' + time4 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time4 * 1000) { };
- // 生豆閘門 停止
- tankSteppingMotor_STOP()
- console.log('tankSteppingMotor_STOP')
- // 暫停時間(秒)
- var time5 = $("input[name=waiting_time_5]").val();
- console.log('等待 ' + time5 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time5 * 1000) { };
- // 生豆閘門 下降
- tankSteppingMotor_DOWN()
- console.log('tankSteppingMotor_DOWN')
- // 下降持續時間(秒)
- var time6 = $("input[name=waiting_time_6]").val();
- console.log('等待 ' + time6 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time6 * 1000) { };
- // 生豆閘門 停止
- tankSteppingMotor_STOP()
- console.log('tankSteppingMotor_STOP')
- // 暫停時間(秒)
- var time7 = $("input[name=waiting_time_7]").val();
- console.log('等待 ' + time7 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time7 * 1000) { };
- }
- }
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="output_Bean_testing()">出料測試</button>
- <script>
- function output_Bean_testing(){
- // 循環次數
- var loop4 = $("input[name=waiting_loop_4]").val();
- console.log('--- 循環 ' + loop4 + ' 次 ---')
- for (step = 1; step <= loop4; step++) {
- // 出料_吸料機 ON
- outputVacuum_ON()
- console.log('outputVacuum_ON')
- // 吸料時間
- var time16 = $("input[name=waiting_time_16]").val();
- console.log('等待 ' + time16 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time16 * 1000) { };
- // 出料_吸料機 OFF
- outputVacuum_OFF()
- console.log('outputVacuum_OFF')
- // 放料時間
- var time17 = $("input[name=waiting_time_17]").val();
- console.log('等待 ' + time17 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time17 * 1000) { };
- };
- };
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL4L5_testing()">出 4、5 閥逆洗</button>
- <br>
- <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL4L5_testing_OFF()">出 4、5 閥逆洗 OFF</button>
- <script>
- function tank_SolenoidWaterL4L5_testing(){
- // 入水口_雙核泵 ON
- tankPumpWaterInput_ON()
- console.log('tankPumpWaterInput_ON')
- // 水龍頭 ON
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- // 出水口 4、5_電磁閥 ON
- tankSolenoidWaterL4L5_ON()
- console.log('tankSolenoidWaterL4L5_ON')
- };
- function tank_SolenoidWaterL4L5_testing_OFF(){
- // 出水口 4、5_電磁閥 OFF
- tankSolenoidWaterL4L5_OFF()
- console.log('tankSolenoidWaterL4L5_OFF')
- // 水龍頭 OFF
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- // 入水口_雙核泵 OFF
- tankPumpWaterInput_OFF()
- console.log('tankPumpWaterInput_OFF')
- };
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL2L3_testing()">出 2、3 閥逆洗</button>
- <br>
- <button type="submit" class="btn btn-primary" onclick="tank_SolenoidWaterL2L3_testing_OFF()">出 2、3 閥逆洗 OFF</button>
- <script>
- function tank_SolenoidWaterL2L3_testing(){
- // 入水口_雙核泵 ON
- tankPumpWaterInput_ON()
- console.log('tankPumpWaterInput_ON')
- // 水龍頭 ON
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- // 出水口 4、5_雙核泵 ON
- tankPumpWaterL4L5_ON()
- console.log('tankPumpWaterL4L5_ON')
- // 出水口 2、3_電磁閥 ON
- tankSolenoidWaterL2L3_ON()
- console.log('tankSolenoidWaterL2L3_ON')
- };
- function tank_SolenoidWaterL2L3_testing_OFF(){
- // 出水口 2、3_電磁閥 OFF
- tankSolenoidWaterL2L3_OFF()
- console.log('tankSolenoidWaterL2L3_OFF')
- // 出水口 4、5_雙核泵 OFF
- tankPumpWaterL4L5_OFF()
- console.log('tankPumpWaterL4L5_OFF')
- // 水龍頭 OFF
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- // 入水口_雙核泵 OFF
- tankPumpWaterInput_OFF()
- console.log('tankPumpWaterInput_OFF')
- };
- </script>
- </td>
- <td>
- <button type="submit" class="btn btn-primary" onclick="tank_CleanWash_testing()">清洗浮選連動測試</button>
- <script>
- function tank_CleanWash_testing(){
-
- // 生豆閘門 DOWN
- // tankSteppingMotor_DOWNSTOP()
- // console.log('tankSteppingMotor_DOWN')
- //入水口_雙核泵 ON
- tankPumpWaterInput_ON()
- console.log('tankPumpWaterInput_ON')
- //入水口_雙核泵 ON 等待時間
- var time10 = $("input[name=waiting_time_10]").val();
- console.log('等待 ' + time10 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time10 * 1000) { };
- //出水口 4、5_雙核泵 ON
- tankPumpWaterL4L5_ON()
- console.log('tankPumpWaterL4L5_ON')
- //出水口 4、5_雙核泵 ON 等待時間
- var time11 = $("input[name=waiting_time_11]").val();
- console.log('等待 ' + time11 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time11 * 1000) { };
- //出水口 2、3_雙核泵 ON
- tankPumpWaterL2L3_ON()
- console.log('tankPumpWaterL2L3_ON')
- //出水口 2、3_雙核泵 ON 等待時間
- var time12 = $("input[name=waiting_time_12]").val();
- console.log('等待 ' + time12 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time12 * 1000) { };
- //* 循環次數
- var loop6 = $("input[name=waiting_loop_6]").val();
- console.log('--- 循環 ' + loop6 + ' 次 ---')
- for (step = 1; step <= loop6; step++) {
- // 真空吸料機 ON
- tankVacuum_ON()
- console.log('tankVacuum_ON')
- // 吸料時間
- var time13 = $("input[name=waiting_time_13]").val();
- console.log('等待 ' + time13 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time13 * 1000) { };
- // 真空吸料機 OFF
- tankVacuum_OFF()
- console.log('tankVacuum_OFF')
- // 吸料時間
- var time14 = $("input[name=waiting_time_14]").val();
- console.log('等待 ' + time14 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time14 * 1000) { };
- };
- // 生豆閘門 UP
- tankSteppingMotor_UP()
- console.log('tankSteppingMotor_UP')
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- tankSteppingMotor_STOP()
- console.log('tankSteppingMotor_STOP')
- // 閘門開啟時間
- var time15 = $("input[name=waiting_time_15]").val();
- console.log('等待 ' + time15 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time15 * 1000) { };
- // 生豆閘門 DOWN
- tankSteppingMotor_DOWN()
- console.log('tankSteppingMotor_DOWN')
- var time = new Date();
- while ((new Date() - time) < 3 * 1000) { };
- tankSteppingMotor_STOP()
- console.log('tankSteppingMotor_STOP')
- var time20 = $("input[name=waiting_time_20]").val();
- console.log('等待 ' + time20 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time20 * 1000) { };
- // 循環次數
- var loop5 = $("input[name=waiting_loop_5]").val();
- console.log('--- 循環 ' + loop5 + ' 次 ---')
- for (step = 1; step <= loop5; step++) {
- // 出料_吸料機 ON
- outputVacuum_ON()
- console.log('outputVacuum_ON')
- // 吸料時間
- var time18 = $("input[name=waiting_time_18]").val();
- console.log('等待 ' + time18 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time18 * 1000) { };
- // 出料_吸料機 OFF
- outputVacuum_OFF()
- console.log('outputVacuum_OFF')
- // 放料時間
- var time19 = $("input[name=waiting_time_19]").val();
- console.log('等待 ' + time19 + ' 秒')
- var time = new Date();
- while ((new Date() - time) < time19 * 1000) { };
- };
- };
- </script>
- <button type="submit" class="btn btn-primary" onclick="tank_CleanWash_OFF_testing()">清洗浮選出入水 OFF</button>
- <script>
- function tank_CleanWash_OFF_testing(){
- //入水口_雙核泵 OFF
- tankPumpWaterInput_OFF()
- console.log('tankPumpWaterInput_OFF')
- var time = new Date();
- while ((new Date() - time) < 1 * 1000) { };
- //出水口 4、5_雙核泵 OFF
- tankPumpWaterL4L5_OFF()
- console.log('tankPumpWaterL4L5_OFF')
- var time = new Date();
- while ((new Date() - time) < 1 * 1000) { };
- //出水口 2、3_雙核泵 OFF
- tankPumpWaterL2L3_OFF()
- console.log('tankPumpWaterL2L3_OFF')
- };
- </script>
-
- </td>
- </tr>
- </table>
- <br>
- <div style="text-align: center;">
- 狀態更新時間(秒):
- <input class="input-text" name="webupdate_time" value="5" style="width:100px;">
- <input type="button" class="input-button" value="設定更新時間" onclick="changeUpdate()">
- <script language="JavaScript">
- function changeUpdate() {
- clearInterval(WebUpdate_set);
- var webupdate_time = $("input[name=webupdate_time]").val()
- console.log('webupdate_time' + webupdate_time)
- WebUpdate_set = setTimeout(function(){WebUpdate(ctn)} , webupdate_time * 1000);
- }
- // jQuery 更新感測器制動器狀態
- function WebUpdate(ctn) {
- $.get('/loading/C' + ctn, '', function (res) {
- if (res.tank_vacuum == 0) {
- $("#cmn-toggle-05").prop('checked', false);
- } else if (res.tank_vacuum == 1) {
- $("#cmn-toggle-05").prop('checked', true);
- }
- if (res.tank_pump_waterFloat == 0) {
- $("#cmn-toggle-08").prop('checked', false);
- } else if (res.tank_pump_waterFloat == 1) {
- $("#cmn-toggle-08").prop('checked', true);
- }
- if (res.tank_pump_waterL4L5 == 0) {
- $("#cmn-toggle-11").prop('checked', false);
- } else if (res.tank_pump_waterL4L5 == 1) {
- $("#cmn-toggle-11").prop('checked', true);
- }
- if (res.tank_pump_waterInput == 0) {
- $("#cmn-toggle-14").prop('checked', false);
- } else if (res.tank_pump_waterInput == 1) {
- $("#cmn-toggle-14").prop('checked', true);
- }
- if (res.tank_solenoid_waterL2L3 == 0) {
- $("#cmn-toggle-17").prop('checked', false);
- } else if (res.tank_solenoid_waterL2L3 == 1) {
- $("#cmn-toggle-17").prop('checked', true);
- }
- if (res.tank_solenoid_waterL4L5 == 0) {
- $("#cmn-toggle-20").prop('checked', false);
- } else if (res.tank_solenoid_waterL4L5 == 1) {
- $("#cmn-toggle-20").prop('checked', true);
- }
- if (res.tank_stepping_motor == 0) {
- $("#cmn-toggle-23").prop('checked', false);
- } else if (res.tank_stepping_motor == 1) {
- $("#cmn-toggle-23").prop('checked', true);
- }
- $("#tank_stepping_motor_t_status").text(res.tank_stepping_motor);
- $("#UltraSonic_t_status").text(res.UltraSonic);
- setTimeout(function(){WebUpdate(ctn)}, 5 * 1000);
- }, 'json');
-
- }
- </script>
- </div>
- <br>
- <br>
- <div id="coffee_footer">
- <!-- 匯入共同使用的 footer.html 內容 -->
- {% include 'footer.html' %}
- </div>
- </div>
- </body>
- </html>
|