作者 朱兆平

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

@@ -77,16 +77,18 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript @@ -77,16 +77,18 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
77 //重量校验算法 77 //重量校验算法
78 WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class); 78 WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
79 //todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该以空车进行判定. 79 //todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该以空车进行判定.
  80 + //todo: 进卡口判定 带货进 或者空车进 加个 此次任务 上个出卡口的重量信息比对
  81 + //todo: 出卡口判定 卸货出 或者 空车出
80 DecimalFormat df = new DecimalFormat("0.00"); 82 DecimalFormat df = new DecimalFormat("0.00");
81 boolean flag = false; 83 boolean flag = false;
82 //载货离场判定 84 //载货离场判定
83 - double result= 0.00; 85 + double result= 1.00;
84 //空车离场判定 86 //空车离场判定
85 - double result2= 0.00; 87 + double result2= 1.00;
86 88
87 //卸货离场判定 89 //卸货离场判定
88 - double result3= 0.00;  
89 - double result4= 0.00; 90 + double result3= 1.00;
  91 + double result4= 1.00;
90 92
91 //货重为0 有BUG,0不能作为被除数 93 //货重为0 有BUG,0不能作为被除数
92 if (goodsWt > 0){ 94 if (goodsWt > 0){
@@ -96,6 +98,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript @@ -96,6 +98,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
96 goodsWt = 1.0; 98 goodsWt = 1.0;
97 } 99 }
98 100
  101 + if (wt>10){
  102 + logger.info("车重正常")
  103 + }else {
  104 + logger.info("车重不正常,被除数改为1")
  105 + wt=1.0;
  106 + }
  107 +
99 if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ 108 if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
100 //带货出,入场重量+带货重量 = 离场重量 109 //带货出,入场重量+带货重量 = 离场重量
101 result = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt)); 110 result = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt));
@@ -113,11 +122,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript @@ -113,11 +122,13 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
113 System.out.println("备案重量进场装载货物离场差值:"+result4); 122 System.out.println("备案重量进场装载货物离场差值:"+result4);
114 } 123 }
115 double range = weightCheckHandleService.valueDob(); 124 double range = weightCheckHandleService.valueDob();
116 - if (result2 <= range  
117 - || result <= range  
118 - || result3 <= range  
119 - || result4 <= range  
120 - ) { 125 + // 进场重量为正常数值时才可作为入场重量判定依据
  126 + if (inWt>50){
  127 + if (result <= range || result3 <= range){
  128 + flag = true;
  129 + }
  130 + }
  131 + if (result2 <= range || result4 <= range) {
121 flag = true; 132 flag = true;
122 } 133 }
123 return flag; 134 return flag;