作者 朱兆平

优化部分验放规则脚本

... ... @@ -3,11 +3,16 @@ server.port=8848
#eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/
eureka.client.service-url.defaultZone=http://192.168.1.53:12345/eureka/
spring.application.name=kako_analysisforstation
spring.cloud.service-registry.auto-registration.enabled=false
spring.cloud.discovery.client.health-indicator.enabled=false
spring.cloud.service-registry.auto-registration.register-management=false
eureka.client.registry-fetch-interval-seconds=30
eureka.instance.status-page-url=http://${eureka.instance.hostname}:${server.port}/
eureka.instance.prefer-ip-address=true
eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port}
eureka.instance.hostname=${spring.cloud.client.ip-address}
spring.application.name=kako-analysisforstation
spring.cloud.service-registry.auto-registration.enabled=true
spring.cloud.discovery.client.health-indicator.enabled=true
spring.cloud.service-registry.auto-registration.register-management=true
spring.cloud.features.enabled=false
spring.cloud.discovery.enabled=false
spring.cloud.config.enabled=false
... ... @@ -23,8 +28,8 @@ spring.mvc.view.prefix=.jsp
spring.redis.host=192.168.1.53
spring.redis.port=6379
#spring.redis.database=2
spring.redis.lettuce.pool.max-active=16
spring.redis.lettuce.pool.min-idle=16
spring.redis.lettuce.pool.max-active=40
spring.redis.lettuce.pool.min-idle=20
spring.redis.lettuce.pool.max-wait=5000
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
... ...
... ... @@ -5,7 +5,7 @@
<groupId>com.sy</groupId>
<artifactId>analysis_imf</artifactId>
<version>5.0.0-ENGIN-SNAPSHOT</version>
<version>6.0.0-ENGIN-SNAPSHOT</version>
<packaging>jar</packaging>
<name>analysis_imf</name>
<description>北货集成金二抬杆指令判定</description>
... ...
... ... @@ -35,14 +35,16 @@ class BillAllocateCheck extends Script implements ChannelCheckScript {
LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
// 调用方法
ApplicationContext context = getContext();
// 获取容器中的bean
GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
boolean allocatCheck = checkNmmsAllocate(landBusinessTypeList.getMasterList());
// boolean allocatCheck = checkNmmsAllocate(landBusinessTypeList.getMasterList());
boolean allocatCheckByList = checkNMMSAllocateByList(listinfos);
if(!allocatCheck){
if(!allocatCheckByList){
logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO);
gatherInfoHandle.sendBw(gatherInfo,false,FENBO,landBusinessTypeList,listinfos);
return false;
... ... @@ -126,4 +128,29 @@ class BillAllocateCheck extends Script implements ChannelCheckScript {
}
return true;
}
boolean checkNMMSAllocateByList(List<LAND_BUSINEESTYPE_LIST_INFO> listinfos){
//单证类型- 提运单
String BILL_TYPE_WAYBILL = "B"
//单证类型-集装器
String BILL_TYPE_ULD = "C"
if (listinfos!=null && !listinfos.isEmpty() ){
for(LAND_BUSINEESTYPE_LIST_INFO item : listinfos){
if (BILL_TYPE_WAYBILL.equals(item.getExt4())){
logger.info("分拨申请验放-单证[{}]:提运单",item.getAwba());
if (!checkNmmsAllocate(item.getAwba())){
return false;
}
}
if (BILL_TYPE_ULD.equals(item.getExt4())){
logger.info("分拨申请验放-单证[{}]:集装器",item.getAwba());
}else {
logger.info("分拨申请验放-单证[{}]:其他类型[{}]",item.getAwba(),item.getExt4());
}
}
return true;
}
return false;
}
}
... ...
... ... @@ -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;
}
}
... ...
... ... @@ -10,6 +10,8 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext
import java.text.DecimalFormat
/**
* 重量验放
* 卸货验放
... ... @@ -39,11 +41,10 @@ class WeightCheckExportUnload 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 (weightCheckHandleService.checkExportDownLoading(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){
if (checkExportDownLoading(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){
return true;
}else {
logger.error("[ExportUnloadWeightCheck]-出场重量未通过校验:"+GROWSSEXCETION);
... ... @@ -68,4 +69,50 @@ class WeightCheckExportUnload extends Script implements ChannelCheckScript {
ApplicationContext context = applicationContext;
return context;
}
boolean checkExportDownLoading(double grossWt, double wt, double goodsWt, double inWt){
// 调用方法
ApplicationContext context = getContext();
//重量校验算法
WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class);
/**
* 异常情况判定
* 送货业务的入场重量必须大于离场重量
* 比如申请单申请的时候本来是进口提货 申请成出口送货
*/
if (inWt<grossWt){
logger.info("出区重量比入区重量大,信息异常");
return false;
}
DecimalFormat df = new DecimalFormat("0.00");
boolean flag = false;
//卸货判定
double result= 0.0;
//以防万一 空车离场判定
double result2= 0.0;
logger.info("进场卸货-入场重量:[{}]",inWt);
logger.info("进场卸货-离场重量:[{}]",grossWt);
logger.info("进场卸货-申请货重:[{}]",goodsWt);
if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
/**
* 入场重量 - 离场重量 = (实际卸货重量 - 申请货重)/申请货重
* 再将卸货重量与申请单的卸货数据比对差值
*/
result = Double.parseDouble(df.format(Math.abs((inWt - grossWt - goodsWt)) / goodsWt));
result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / wt));
logger.info("[WEIGHT-UNLOADING-CHECK]-进出场比对差值:{},空车出场差值:{},进出场比对重量差:{},空车比对重量差:{}",result,result2,Math.abs(inWt - goodsWt - grossWt),Math.abs(grossWt-wt));
}
double range = weightCheckHandleService.valueDob();
//车辆离场重量与车辆备案重量验放,只允许空车离场
if (result <= range) {
flag = true;
}
return flag;
}
}
... ...
... ... @@ -28,7 +28,7 @@ class WeightCheckHandleServiceImplTest {
@Test
void checkAllocateOrDispatch(){
weightCheckHandleService.checkAllocateOrDispatch(10560,10500,175.6,10310);
weightCheckHandleService.checkAllocateOrDispatch(13220,10500,3125,0);
}
@Test
... ...
# VER 6.0 Date:2023-06-07 周三
## 大版本更新,更新验放规则为动态验放,采用动态脚本引擎.
- 可进行通道与验放规则的关联配置进行验放
- 根据通道号\业务类型\货物类型绑定对应的验放规则
- 新增一线进口业务
- 新增一线出口业务
- 新增规则管理
- 新增验放管理
- 新增业务类型管理
- 操作界面优化
- 服务名更改为kako-analysisforstation
- eureka注册打开
### 更新流程.
#### 验放端:
1. 配置文件增加redis连接池配置部分
> spring.redis.lettuce.pool.max-active=40
spring.redis.lettuce.pool.min-idle=20
spring.redis.lettuce.pool.max-wait=5000
2. 配置文件增加groove引擎配置部分
> # 规则引擎相关配置
# 脚本检查更新周期(单位:秒),(默认300L)
enhance.groovy.engine.polling-cycle=10000
# 开启功能
enhance.groovy.engine.enable=true
# 缓存过期时间(默认600L分钟)
enhance.groovy.engine.cache-expire-after-write=600
#缓存初始容量(默认100)
enhance.groovy.engine.cache-initial-capacity=50
# 缓存最大容量(默认500)
enhance.groovy.engine.cache-maximum-size=50
# 开启基于Redis加载groovy脚本
enhance.groovy.engine.redis-loader.namespace=kako-release-check
enhance.groovy.engine.redis-loader.enable=true
3. 打开IMF定时器
4. 打开本地报文读取定时器
5. 编译文件
6. 上传正式服务器
7. 备份正在运行版本
8. 更改start.sh脚本中的 执行jar名称.
9. 关闭运行的验放端
10. 执行start.sh脚本
11. 更新完成
#### 申报端:
1. 配置文件同步
- 无更新
2. 数据库表同步
- rule_config、
- rule_channel_config、
- land_business_type_config
3. 打开二维码正式环境获取接口,申请接口\取消申请接口\异常处理接口
4. 打包编译
5. 上传正式服务器
7. 备份正在运行版本
8. 更改start.sh脚本中的 执行jar名称.
9. 关闭运行的验放端
10. 执行start.sh脚本
11. 通道验放规则同步.
12. redis有没有相关配置更改?
13. 更新完成
#### 前端:
1. 备份前端文件 压缩成.zip 带日期
2. 上传新版本前端,解压部署前端
3. 更改version.json
4. 前端更新完毕.
5. 通知用户刷新前端
### 业务配置
1. 系统权限配置
- 配置验放管理权限
- 配置规则管理权限
- 配置业务类型管理权限
- 重新配置验放端规则信息到redis
... ...