作者 朱兆平

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

@@ -10,6 +10,8 @@ import org.slf4j.Logger @@ -10,6 +10,8 @@ import org.slf4j.Logger
10 import org.slf4j.LoggerFactory 10 import org.slf4j.LoggerFactory
11 import org.springframework.context.ApplicationContext 11 import org.springframework.context.ApplicationContext
12 12
  13 +import java.text.DecimalFormat
  14 +
13 /** 15 /**
14 * 重量验放 16 * 重量验放
15 * 空车验放 17 * 空车验放
@@ -30,8 +32,6 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript { @@ -30,8 +32,6 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
30 GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo"); 32 GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 33 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
32 Double selfWt = (Double) executeParams.get("selfWt"); 34 Double selfWt = (Double) executeParams.get("selfWt");
33 - Double goodsWt = (Double) executeParams.get("goodsWt");  
34 - Double inAisleWT = (Double) executeParams.get("inAisleWT");  
35 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists"); 35 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
36 36
37 //3.车辆备案验证 37 //3.车辆备案验证
@@ -40,10 +40,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript { @@ -40,10 +40,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
40 // 获取容器中的bean 40 // 获取容器中的bean
41 GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class); 41 GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
42 //重量校验算法 42 //重量校验算法
43 - WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);  
44 -  
45 - logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype());  
46 - if (weightCheckHandleService.checkEmpty(gatherInfo.getGrosswt(), selfWt)){ 43 + if (checkEmpty(gatherInfo.getGrosswt(), selfWt)){
47 return true; 44 return true;
48 }else { 45 }else {
49 logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION); 46 logger.error("[空车业务]-出场重量未通过校验:"+GROWSSEXCETION);
@@ -52,7 +49,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript { @@ -52,7 +49,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
52 } 49 }
53 }catch (Exception e){ 50 }catch (Exception e){
54 e.printStackTrace(); 51 e.printStackTrace();
55 - logger.error("[VE-CHECK-ERROR]:",e); 52 + logger.error("[WEIGHT-CHECK-EMPTY-ERROR]:",e);
56 return false; 53 return false;
57 } 54 }
58 } 55 }
@@ -68,4 +65,37 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript { @@ -68,4 +65,37 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
68 ApplicationContext context = applicationContext; 65 ApplicationContext context = applicationContext;
69 return context; 66 return context;
70 } 67 }
  68 +
  69 + /**
  70 + * 空车入区重量验放判定
  71 + * @param grossWt 车辆过卡总重量
  72 + * @param wt 车辆备案重量
  73 + * @param goodsWt 流转申请单货物总重量
  74 + * @param inWt 车辆出区时的入区重量
  75 + * @return
  76 + */
  77 + boolean checkEmpty(double grossWt, double wt){
  78 +
  79 + // 调用方法
  80 + ApplicationContext context = getContext();
  81 +
  82 + //重量校验算法
  83 + WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
  84 +
  85 + double emptyIN= 0.00;
  86 + DecimalFormat df = new DecimalFormat("0.00");
  87 + if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
  88 + //空车入场判定,入场重量-车辆备案重量
  89 + emptyIN = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / wt));
  90 +
  91 + double range = weightCheckHandleService.valueDob();
  92 +
  93 + if (emptyIN <= range) {
  94 + logger.info("[WEIGHT-CHECK]-进口提货入口重量验放:入场重量{},车辆备案重量:{},差值:{}",grossWt,wt,emptyIN);
  95 + return true;
  96 + }
  97 + }
  98 +
  99 + return false;
  100 + }
71 } 101 }
@@ -41,8 +41,6 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { @@ -41,8 +41,6 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript {
41 ApplicationContext context = getContext(); 41 ApplicationContext context = getContext();
42 // 获取容器中的bean 42 // 获取容器中的bean
43 GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class); 43 GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
44 - //重量校验算法  
45 - WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);  
46 44
47 logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype()); 45 logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype());
48 if (checkImportDlv(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){ 46 if (checkImportDlv(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){