作者 朱兆平

bugfix: 流转重量验放 bug修复,被除数不能为0

... ... @@ -77,16 +77,18 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
//重量校验算法
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
//todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该以空车进行判定.
//todo: 进卡口判定 带货进 或者空车进 加个 此次任务 上个出卡口的重量信息比对
//todo: 出卡口判定 卸货出 或者 空车出
DecimalFormat df = new DecimalFormat("0.00");
boolean flag = false;
//载货离场判定
double result= 0.00;
double result= 1.00;
//空车离场判定
double result2= 0.00;
double result2= 1.00;
//卸货离场判定
double result3= 0.00;
double result4= 0.00;
double result3= 1.00;
double result4= 1.00;
//货重为0 有BUG,0不能作为被除数
if (goodsWt > 0){
... ... @@ -96,6 +98,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
goodsWt = 1.0;
}
if (wt>10){
logger.info("车重正常")
}else {
logger.info("车重不正常,被除数改为1")
wt=1.0;
}
if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
//带货出,入场重量+带货重量 = 离场重量
result = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt));
... ... @@ -113,11 +122,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
System.out.println("备案重量进场装载货物离场差值:"+result4);
}
double range = weightCheckHandleService.valueDob();
if (result2 <= range
|| result <= range
|| result3 <= range
|| result4 <= range
) {
// 进场重量为正常数值时才可作为入场重量判定依据
if (inWt>50){
if (result <= range || result3 <= range){
flag = true;
}
}
if (result2 <= range || result4 <= range) {
flag = true;
}
return flag;
... ...