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 + '';