增加配置页面初始化,修改校准字体大小,饲喂状态触发重连,装料超过也自动跳转,

This commit is contained in:
liuwu 2023-11-27 17:34:40 +08:00
parent 61867b0f23
commit e3bee41bf9
4 changed files with 48 additions and 6 deletions

View File

@ -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(){ function downloadApp(){

View File

@ -163,7 +163,7 @@
</div> </div>
<div class="mui-col-xs-1" > <div class="mui-col-xs-1" >
<text id="isfix" style="margin-left: 20px;font-weight: 900;font-size: x-large;" >未校准</text> <text id="isfix" style="margin-left: 20px;font-weight: 900;font-size: x-large;" ><font style="color:red;font-size: x-large;">未校准</font></text>
</div> </div>
</div> </div>
</div> </div>
@ -664,7 +664,7 @@
}); });
// 误差小于100必须校准才能自动跳转 // 误差小于100必须校准才能自动跳转
allowAuto = false; allowAuto = false;
document.getElementById('isfix').innerHTML = '未校准' document.getElementById('isfix').innerHTML = '<font style="color:red;font-size: x-large;">未校准</font>'
document.getElementById('feedNum').innerHTML = '<font style="color:blue">:' + _planSum + '</font>/<font style="color:green">已装:' + _feedNum + '</font>'; document.getElementById('feedNum').innerHTML = '<font style="color:blue">:' + _planSum + '</font>/<font style="color:green">已装:' + _feedNum + '</font>';
text = feedName + _planSum; text = feedName + _planSum;
batchName = e.className + e.trainNumber; batchName = e.className + e.trainNumber;

View File

@ -155,7 +155,7 @@ function connect(param) {
wifiDom.innerHTML = '连接失败'; wifiDom.innerHTML = '连接失败';
api.hideProgress(); api.hideProgress();
setTimeout(function (){ setTimeout(function (){
if (!connetcedStatus && uuid){ if (!connetcedStatus && uuid && feedStatus){
console.log("连接失败!尝试重连" + uuid); console.log("连接失败!尝试重连" + uuid);
wifiDom.innerHTML = '尝试重连'; wifiDom.innerHTML = '尝试重连';
connect({peripheralUUID: uuid}); connect({peripheralUUID: uuid});
@ -386,6 +386,15 @@ function discoverService(param) {
weightDataFilter.dataBuffer = [] weightDataFilter.dataBuffer = []
document.getElementById('submitData').click(); 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(_planSum - _feedNum)).toFixed(0) + 'kg';
} }
// param1.msg = newmsg + Math.abs(Number(param.value)).toFixed(0) + 'kg' // param1.msg = newmsg + Math.abs(Number(param.value)).toFixed(0) + 'kg'
console.log(param1.msg) // console.log(param1.msg)
//组装字符卡LED报文 //组装字符卡LED报文
zfk.getMsg(param1, function (ret, err) { zfk.getMsg(param1, function (ret, err) {
var str = ret.sendMsg; var str = ret.sendMsg;

View File

@ -16,7 +16,7 @@ function weightFix() {
} else { } else {
beforeWeight = nowWeight; beforeWeight = nowWeight;
allowAuto = true allowAuto = true
document.getElementById('isfix').innerHTML = '已校准' document.getElementById('isfix').innerHTML = '<font style="color:green;font-size: x-large;">已校准</font>'
mui.toast("校准完成"); mui.toast("校准完成");
} }
}); });
@ -118,6 +118,13 @@ function submitData() {
var newmsg = batchName+'次'; var newmsg = batchName+'次';
var msglen = newmsg.getByteLen(); var msglen = newmsg.getByteLen();
var ttr = ''; var ttr = '';
if (Number(_planSum - _feedNum) >= 0) {
ttr = '少';
echartsType = '少';
} else {
ttr = '多';
echartsType = '多';
}
if (msglen < 8) { if (msglen < 8) {
for (var i = 0; i < 8 - msglen; i++) { for (var i = 0; i < 8 - msglen; i++) {
newmsg = newmsg + ' '; newmsg = newmsg + ' ';
@ -182,7 +189,7 @@ function submitData() {
}); });
// 误差小于100必须校准才能自动跳转 // 误差小于100必须校准才能自动跳转
allowAuto = false; allowAuto = false;
document.getElementById('isfix').innerHTML = '未校准' document.getElementById('isfix').innerHTML = '<font style="color:red;font-size: x-large;">未校准</font>'
text = feedName + _planSum; text = feedName + _planSum;
document.getElementById('nowFeed').innerHTML = '<font style="color:blue;margin-left:10px;">' + batchName + ',' + feedName + '</font>'; document.getElementById('nowFeed').innerHTML = '<font style="color:blue;margin-left:10px;">' + batchName + ',' + feedName + '</font>';
document.getElementById('feedNum').innerHTML = '<font style="color:blue">:' + _planSum + '</font>/<font style="color:green">已装:' + _feedNum + '</font>'; document.getElementById('feedNum').innerHTML = '<font style="color:blue">:' + _planSum + '</font>/<font style="color:green">已装:' + _feedNum + '</font>';