From e3bee41bf99ace7d9265c44cceca399d8b59942b Mon Sep 17 00:00:00 2001 From: liuwu <975499773@qq.com> Date: Mon, 27 Nov 2023 17:34:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=A0=A1=E5=87=86=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F=EF=BC=8C?= =?UTF-8?q?=E9=A5=B2=E5=96=82=E7=8A=B6=E6=80=81=E8=A7=A6=E5=8F=91=E9=87=8D?= =?UTF-8?q?=E8=BF=9E=EF=BC=8C=E8=A3=85=E6=96=99=E8=B6=85=E8=BF=87=E4=B9=9F?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BD=AC=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/config.html | 26 ++++++++++++++++++++++++++ html/index1.html | 4 ++-- script/ble.js | 13 +++++++++++-- script/index.js | 11 +++++++++-- 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/html/config.html b/html/config.html index fb9418a..01ced96 100644 --- a/html/config.html +++ b/html/config.html @@ -193,6 +193,32 @@ }) } + + var requireFix = api.getPrefs({ + sync: true, + key: 'fixbeforeload' + }); + if (requireFix) { + fixData.forEach(p => { + if (requireFix == p.value) { + document.getElementById('fixbeforeload').innerHTML = p.text + } + }) + } + + var weightSize = api.getPrefs({ + sync: true, + key: 'weightSize' + }); + if (weightSize) { + weiData.forEach(p => { + if (weightSize == p.value) { + console.log(requireFix === p.value) + document.getElementById('weightSize').innerHTML = p.text + } + }) + } + } function downloadApp(){ diff --git a/html/index1.html b/html/index1.html index b00767b..b097644 100644 --- a/html/index1.html +++ b/html/index1.html @@ -163,7 +163,7 @@
- 未校准 + 未校准
@@ -664,7 +664,7 @@ }); // 误差小于100必须校准才能自动跳转 allowAuto = false; - document.getElementById('isfix').innerHTML = '未校准' + document.getElementById('isfix').innerHTML = '未校准' document.getElementById('feedNum').innerHTML = ':' + _planSum + '/已装:' + _feedNum + ''; text = feedName + _planSum; batchName = e.className + e.trainNumber; diff --git a/script/ble.js b/script/ble.js index 399706f..2021034 100644 --- a/script/ble.js +++ b/script/ble.js @@ -155,7 +155,7 @@ function connect(param) { wifiDom.innerHTML = '连接失败'; api.hideProgress(); setTimeout(function (){ - if (!connetcedStatus && uuid){ + if (!connetcedStatus && uuid && feedStatus){ console.log("连接失败!尝试重连" + uuid); wifiDom.innerHTML = '尝试重连'; connect({peripheralUUID: uuid}); @@ -386,6 +386,15 @@ function discoverService(param) { weightDataFilter.dataBuffer = [] document.getElementById('submitData').click(); } + }else if(_feedNum > _planSum && (allowAuto || weightBeforefix === '1')){ + // 重量稳定计数 + var filteredValue = weightDataFilter.filter(nowWeight); + // 重量稳定自动跳转 + if (weightDataFilter.dataBuffer.length === weightSize) { + console.log("重量稳定", currTimeFn(new Date())); + weightDataFilter.dataBuffer = [] + document.getElementById('submitData').click(); + } } } } @@ -526,7 +535,7 @@ function getMess(param, callback) { param1.msg = newmsg + Math.abs(Number(_planSum - _feedNum)).toFixed(0) + 'kg'; } // param1.msg = newmsg + Math.abs(Number(param.value)).toFixed(0) + 'kg' - console.log(param1.msg) + // console.log(param1.msg) //组装字符卡LED报文 zfk.getMsg(param1, function (ret, err) { var str = ret.sendMsg; diff --git a/script/index.js b/script/index.js index 18f3b60..0821b32 100644 --- a/script/index.js +++ b/script/index.js @@ -16,7 +16,7 @@ function weightFix() { } else { beforeWeight = nowWeight; allowAuto = true - document.getElementById('isfix').innerHTML = '已校准' + document.getElementById('isfix').innerHTML = '已校准' mui.toast("校准完成"); } }); @@ -118,6 +118,13 @@ function submitData() { var newmsg = batchName+'次'; var msglen = newmsg.getByteLen(); var ttr = ''; + if (Number(_planSum - _feedNum) >= 0) { + ttr = '少'; + echartsType = '少'; + } else { + ttr = '多'; + echartsType = '多'; + } if (msglen < 8) { for (var i = 0; i < 8 - msglen; i++) { newmsg = newmsg + ' '; @@ -182,7 +189,7 @@ function submitData() { }); // 误差小于100必须校准才能自动跳转 allowAuto = false; - document.getElementById('isfix').innerHTML = '未校准' + document.getElementById('isfix').innerHTML = '未校准' text = feedName + _planSum; document.getElementById('nowFeed').innerHTML = '' + batchName + ',' + feedName + ''; document.getElementById('feedNum').innerHTML = ':' + _planSum + '/已装:' + _feedNum + '';