...
|
...
|
@@ -10,6 +10,8 @@ import org.slf4j.Logger |
|
|
import org.slf4j.LoggerFactory
|
|
|
import org.springframework.context.ApplicationContext
|
|
|
|
|
|
import java.text.DecimalFormat
|
|
|
|
|
|
/**
|
|
|
* 重量验放
|
|
|
* 分拨调拨流转验放
|
...
|
...
|
@@ -32,16 +34,18 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript |
|
|
Double inAisleWT = (Double) executeParams.get("inAisleWT");
|
|
|
List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
|
|
|
|
|
|
logger.info("[AllocateOrDispatch-Weight-Check]-备案重:{}",selfWt);
|
|
|
logger.info("[AllocateOrDispatch-Weight-Check]-货重:{}",goodsWt);
|
|
|
logger.info("[AllocateOrDispatch-Weight-Check]-入场重:{}",inAisleWT);
|
|
|
logger.info("[AllocateOrDispatch-Weight-Check]-过磅重:{}",gatherInfo.getGrosswt());
|
|
|
|
|
|
//3.车辆备案验证
|
|
|
// 调用方法
|
|
|
ApplicationContext context = getContext();
|
|
|
// 获取容器中的bean
|
|
|
GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
|
|
|
//重量校验算法
|
|
|
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
|
|
|
|
|
|
logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype());
|
|
|
if (weightCheckHandleService.checkAllocateOrDispatch(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){
|
|
|
if (checkAllocateOrDispatch(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){
|
|
|
return true;
|
|
|
}else {
|
|
|
gatherInfoHandle.sendBw(gatherInfo,false,GROWSSEXCETION,landBusinessTypeList,listinfos);
|
...
|
...
|
@@ -49,7 +53,7 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript |
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
logger.error("[ExportUnloadWeightCheck-ERROR]:",e);
|
|
|
logger.error("[AllocateOrDispatch-Weight-Check-ERROR]:",e);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -65,4 +69,57 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript |
|
|
ApplicationContext context = applicationContext;
|
|
|
return context;
|
|
|
}
|
|
|
|
|
|
boolean checkAllocateOrDispatch(double grossWt, double wt, double goodsWt,double inWt){
|
|
|
// 调用方法
|
|
|
ApplicationContext context = getContext();
|
|
|
|
|
|
//重量校验算法
|
|
|
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
|
|
|
//todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该以空车进行判定.
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
boolean flag = false;
|
|
|
//载货离场判定
|
|
|
double result= 0.00;
|
|
|
//空车离场判定
|
|
|
double result2= 0.00;
|
|
|
|
|
|
//卸货离场判定
|
|
|
double result3= 0.00;
|
|
|
double result4= 0.00;
|
|
|
|
|
|
//货重为0 有BUG,0不能作为被除数
|
|
|
if (goodsWt > 0){
|
|
|
logger.info("货重正常")
|
|
|
}else {
|
|
|
logger.info("货重不正常,被除数改为1")
|
|
|
goodsWt = 1.0;
|
|
|
}
|
|
|
|
|
|
if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
|
|
|
//带货出,入场重量+带货重量 = 离场重量
|
|
|
result = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt));
|
|
|
//带货出,用车辆备案重量对碰,车辆备案重量+带货重量 = 离场重量
|
|
|
// result4 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt));
|
|
|
result4 = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / goodsWt));
|
|
|
//空车出,过磅重量 = 车辆备案重量
|
|
|
result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / wt));
|
|
|
//卸货出,入场重量-卸货重量 = 离场重量
|
|
|
result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / goodsWt));
|
|
|
|
|
|
System.out.println("进场提货离场差值:"+result);
|
|
|
System.out.println("空车离场差值:"+result2);
|
|
|
System.out.println("进场卸货离场差值:"+result3);
|
|
|
System.out.println("备案重量进场装载货物离场差值:"+result4);
|
|
|
}
|
|
|
double range = weightCheckHandleService.valueDob();
|
|
|
if (result2 <= range
|
|
|
|| result <= range
|
|
|
|| result3 <= range
|
|
|
|| result4 <= range
|
|
|
) {
|
|
|
flag = true;
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
} |
...
|
...
|
|