作者 朱兆平

空车重量验放逻辑放到脚本中

... ... @@ -10,6 +10,8 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext
import java.text.DecimalFormat
/**
* 重量验放
* 空车验放
... ... @@ -30,8 +32,6 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
Double selfWt = (Double) executeParams.get("selfWt");
Double goodsWt = (Double) executeParams.get("goodsWt");
Double inAisleWT = (Double) executeParams.get("inAisleWT");
List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
//3.车辆备案验证
... ... @@ -40,10 +40,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
// 获取容器中的bean
GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
//重量校验算法
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype());
if (weightCheckHandleService.checkEmpty(gatherInfo.getGrosswt(), selfWt)){
if (checkEmpty(gatherInfo.getGrosswt(), selfWt)){
return true;
}else {
logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION);
... ... @@ -52,7 +49,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
}
}catch (Exception e){
e.printStackTrace();
logger.error("[VE-CHECK-ERROR]:",e);
logger.error("[WEIGHT-CHECK-EMPTY-ERROR]:",e);
return false;
}
}
... ... @@ -68,4 +65,37 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
ApplicationContext context = applicationContext;
return context;
}
/**
* 空车入区重量验放判定
* @param grossWt 车辆过卡总重量
* @param wt 车辆备案重量
* @param goodsWt 流转申请单货物总重量
* @param inWt 车辆出区时的入区重量
* @return
*/
boolean checkEmpty(double grossWt, double wt){
// 调用方法
ApplicationContext context = getContext();
//重量校验算法
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
double emptyIN= 0.00;
DecimalFormat df = new DecimalFormat("0.00");
if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
//空车入场判定,入场重量-车辆备案重量
emptyIN = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / wt));
double range = weightCheckHandleService.valueDob();
if (emptyIN <= range) {
logger.info("[WEIGHT-CHECK]-进口提货入口重量验放:入场重量{},车辆备案重量:{},差值:{}",grossWt,wt,emptyIN);
return true;
}
}
return false;
}
}
... ...
... ... @@ -41,8 +41,6 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript {
ApplicationContext context = getContext();
// 获取容器中的bean
GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
//重量校验算法
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype());
if (checkImportDlv(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){
... ...