正在显示
12 个修改的文件
包含
456 行增加
和
32 行删除
src/main/java/com/sy/bean/DEVDEBUG.java
0 → 100644
| 1 | +package com.sy.bean; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import org.springframework.beans.factory.annotation.Value; | ||
| 5 | +import org.springframework.context.annotation.Bean; | ||
| 6 | +import org.springframework.context.annotation.Configuration; | ||
| 7 | + | ||
| 8 | +@Configuration | ||
| 9 | +public class DEVDEBUG { | ||
| 10 | + | ||
| 11 | + @Value("${devdebug}") | ||
| 12 | + private Boolean debug; | ||
| 13 | + | ||
| 14 | + @Bean("devdebug") | ||
| 15 | + public Boolean getDebug(){ | ||
| 16 | + System.out.println("devdebug:"+debug); | ||
| 17 | + return debug; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | +} |
| @@ -9,6 +9,7 @@ import com.sy.model.NoticeLock; | @@ -9,6 +9,7 @@ import com.sy.model.NoticeLock; | ||
| 9 | import com.sy.response.ResultJson; | 9 | import com.sy.response.ResultJson; |
| 10 | import com.sy.service.CommandLogService; | 10 | import com.sy.service.CommandLogService; |
| 11 | import com.sy.service.CustomsLockService; | 11 | import com.sy.service.CustomsLockService; |
| 12 | +import com.sy.service.EnginCheckService; | ||
| 12 | import lombok.extern.slf4j.Slf4j; | 13 | import lombok.extern.slf4j.Slf4j; |
| 13 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -30,6 +31,9 @@ public class CustomsLockController { | @@ -30,6 +31,9 @@ public class CustomsLockController { | ||
| 30 | @Autowired | 31 | @Autowired |
| 31 | CommandLogService commandLogService; | 32 | CommandLogService commandLogService; |
| 32 | 33 | ||
| 34 | + @Autowired | ||
| 35 | + EnginCheckService enginCheckService; | ||
| 36 | + | ||
| 33 | @PostMapping("response") | 37 | @PostMapping("response") |
| 34 | public ResultJson lockResponse(@RequestBody LockFeedBack feedBack){ | 38 | public ResultJson lockResponse(@RequestBody LockFeedBack feedBack){ |
| 35 | try{ | 39 | try{ |
| @@ -73,7 +77,8 @@ public class CustomsLockController { | @@ -73,7 +77,8 @@ public class CustomsLockController { | ||
| 73 | sb.append("成功"); | 77 | sb.append("成功"); |
| 74 | if (gatherInfo!=null){ | 78 | if (gatherInfo!=null){ |
| 75 | commandLogService.commandlog(gatherInfo,true,sb.toString(),null,null,0.0,0.0,0.0,0.0); | 79 | commandLogService.commandlog(gatherInfo,true,sb.toString(),null,null,0.0,0.0,0.0,0.0); |
| 76 | - customsLockService.localGatherInfoHandle(gatherInfo); | 80 | +// customsLockService.localGatherInfoHandle(gatherInfo); |
| 81 | + enginCheckService.lockNoticeContinueCheck(gatherInfo); | ||
| 77 | }else { | 82 | }else { |
| 78 | sb.append("关锁缓存信息读取失败"); | 83 | sb.append("关锁缓存信息读取失败"); |
| 79 | gatherInfo = new GatherInfo(); | 84 | gatherInfo = new GatherInfo(); |
| 1 | +package com.sy.controller; | ||
| 2 | + | ||
| 3 | +import com.sy.model.GatherInfo; | ||
| 4 | +import com.sy.service.EnginCheckService; | ||
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.basis.enhance.groovy.entity.EngineExecutorResult; | ||
| 7 | +import org.basis.enhance.groovy.entity.ExecuteParams; | ||
| 8 | +import org.basis.enhance.groovy.entity.ScriptQuery; | ||
| 9 | +import org.basis.enhance.groovy.executor.EngineExecutor; | ||
| 10 | +import org.basis.enhance.groovy.helper.RefreshScriptHelper; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | + | ||
| 14 | +import java.math.BigDecimal; | ||
| 15 | + | ||
| 16 | +@RestController | ||
| 17 | +@Slf4j | ||
| 18 | +@RequestMapping("/chanel") | ||
| 19 | +public class EnginChanelController { | ||
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + EnginCheckService enginCheckService; | ||
| 23 | + | ||
| 24 | + @PostMapping("/check") | ||
| 25 | + public String x21Check(@RequestBody GatherInfo gatherInfo) { | ||
| 26 | + | ||
| 27 | + ExecuteParams executeParams = enginCheckService.makeParaByGagherInfo(gatherInfo); | ||
| 28 | + Boolean check = enginCheckService.enginCheckByGatherInfo(gatherInfo,executeParams); | ||
| 29 | + if (check){ | ||
| 30 | + log.info("脚本验放测试通过"); | ||
| 31 | + //放行 | ||
| 32 | + enginCheckService.pass(gatherInfo,executeParams); | ||
| 33 | + | ||
| 34 | + enginCheckService.formRelease(gatherInfo,executeParams); | ||
| 35 | + }else { | ||
| 36 | + log.error("脚本验放测试失败或等待关锁施解封"); | ||
| 37 | + } | ||
| 38 | + return "ok"; | ||
| 39 | + } | ||
| 40 | +} |
| @@ -8,6 +8,8 @@ import com.sy.model.LockFeignResponse | @@ -8,6 +8,8 @@ import com.sy.model.LockFeignResponse | ||
| 8 | import com.sy.model.NoticeLock | 8 | import com.sy.model.NoticeLock |
| 9 | import com.sy.service.CommandLogService | 9 | import com.sy.service.CommandLogService |
| 10 | import com.sy.service.CustomsLockService | 10 | import com.sy.service.CustomsLockService |
| 11 | +import com.sy.service.LandBusListService | ||
| 12 | +import com.sy.service.RedisService | ||
| 11 | import com.sy.service.feigin.LockFeignService | 13 | import com.sy.service.feigin.LockFeignService |
| 12 | import com.sy.socket.CommandClient | 14 | import com.sy.socket.CommandClient |
| 13 | import org.apache.commons.lang.StringUtils | 15 | import org.apache.commons.lang.StringUtils |
| @@ -22,6 +24,18 @@ import org.springframework.context.ApplicationContext | @@ -22,6 +24,18 @@ import org.springframework.context.ApplicationContext | ||
| 22 | */ | 24 | */ |
| 23 | class LockNoticeCheck extends Script implements ChannelCheckScript { | 25 | class LockNoticeCheck extends Script implements ChannelCheckScript { |
| 24 | private final Logger log = LoggerFactory.getLogger(getClass()); | 26 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 27 | + /** | ||
| 28 | + * 需要通知 | ||
| 29 | + */ | ||
| 30 | + private final String NEED_NOTICE = "Y"; | ||
| 31 | + /** | ||
| 32 | + * 不需要通知 | ||
| 33 | + */ | ||
| 34 | + private final String DOT_NOTICE = "N"; | ||
| 35 | + /** | ||
| 36 | + * 验证失败 | ||
| 37 | + */ | ||
| 38 | + private final String FAIL_NOTICE = "F"; | ||
| 25 | @Override | 39 | @Override |
| 26 | Object run() { | 40 | Object run() { |
| 27 | return null | 41 | return null |
| @@ -46,8 +60,9 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | @@ -46,8 +60,9 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | ||
| 46 | LandListDao landListDao = context.getBean(LandListDao.class); | 60 | LandListDao landListDao = context.getBean(LandListDao.class); |
| 47 | LockFeignService lockFeignService = context.getBean(LockFeignService.class); | 61 | LockFeignService lockFeignService = context.getBean(LockFeignService.class); |
| 48 | 62 | ||
| 49 | - //需要关锁业务通知 | ||
| 50 | - if (customsLockService.lockNoticeCheck(info)){ | 63 | + //判定是否需要关锁业务通知 |
| 64 | + String checkResult = lockNoticeCheck(info,executeParams); | ||
| 65 | + if (NEED_NOTICE.equals(checkResult)){ | ||
| 51 | /** | 66 | /** |
| 52 | * 关锁号申请检查 | 67 | * 关锁号申请检查 |
| 53 | * 根据二维码查申请是否有关锁信息,没有查到实体返回null | 68 | * 根据二维码查申请是否有关锁信息,没有查到实体返回null |
| @@ -72,7 +87,13 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | @@ -72,7 +87,13 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | ||
| 72 | LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock); | 87 | LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock); |
| 73 | log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success); | 88 | log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success); |
| 74 | record(info,false,"关锁施封通知中,等待下一步指令",null); | 89 | record(info,false,"关锁施封通知中,等待下一步指令",null); |
| 75 | - return true; | 90 | + |
| 91 | + /** | ||
| 92 | + * 因为关锁业务为异步,实际上这里的返回是进行关锁通知成功 | ||
| 93 | + * 但是要返回false,抬杆指令判定才能中断 | ||
| 94 | + * 后续等待关锁服务从接口进行通知并抬杆验放 | ||
| 95 | + */ | ||
| 96 | + return false; | ||
| 76 | }else { | 97 | }else { |
| 77 | if (IN_TYPE.equals(info.getIetype()) && customsLockService.unLockCheck(info)) { | 98 | if (IN_TYPE.equals(info.getIetype()) && customsLockService.unLockCheck(info)) { |
| 78 | customsLockService.cacheWrite(info); | 99 | customsLockService.cacheWrite(info); |
| @@ -83,16 +104,31 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | @@ -83,16 +104,31 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | ||
| 83 | LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock); | 104 | LockFeignResponse lockFeignResponse = lockFeignService.noticeLock(noticeLock); |
| 84 | log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success); | 105 | log.info("[LOCK-API-RSP]-关锁通知接口返回,code:{},message:{},success:{}",lockFeignResponse.code,lockFeignResponse.message,lockFeignResponse.success); |
| 85 | record(info,false,"关锁解封通知中,等待下一步指令",null); | 106 | record(info,false,"关锁解封通知中,等待下一步指令",null); |
| 86 | - return true; | 107 | + return false; |
| 87 | } | 108 | } |
| 88 | } | 109 | } |
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 无需上锁,无需解锁,则返回true | ||
| 113 | + * 继续抬杆指令判定. | ||
| 114 | + */ | ||
| 115 | + return true; | ||
| 116 | + | ||
| 89 | }else { | 117 | }else { |
| 90 | CommandClient.Client(info,"流转业务-未申请关锁号"); | 118 | CommandClient.Client(info,"流转业务-未申请关锁号"); |
| 91 | record(info,false,"业务异常:流转业务-未申请关锁号",null); | 119 | record(info,false,"业务异常:流转业务-未申请关锁号",null); |
| 92 | //这里需要返回true,是关锁业务,但是中断,不抬杆不放行,给予关锁业务异常通知 | 120 | //这里需要返回true,是关锁业务,但是中断,不抬杆不放行,给予关锁业务异常通知 |
| 93 | - return true; | 121 | + return false; |
| 122 | + } | ||
| 94 | } | 123 | } |
| 124 | + if (DOT_NOTICE.equals(checkResult)){ | ||
| 125 | + /** | ||
| 126 | + * 不进行关锁通知, | ||
| 127 | + * 所以可以继续走验放流程,进行自动抬杆 | ||
| 128 | + */ | ||
| 129 | + return true; | ||
| 95 | } | 130 | } |
| 131 | + //关锁通知验放失败 | ||
| 96 | return false; | 132 | return false; |
| 97 | }catch (Exception e){ | 133 | }catch (Exception e){ |
| 98 | e.printStackTrace(); | 134 | e.printStackTrace(); |
| @@ -113,4 +149,72 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | @@ -113,4 +149,72 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { | ||
| 113 | CommandLogService commandLogService = context.getBean(CommandLogService.class); | 149 | CommandLogService commandLogService = context.getBean(CommandLogService.class); |
| 114 | commandLogService.commandlog(info,result,reason,landBusinessTypeList,null,0.0,0.0,0.0,0.0); | 150 | commandLogService.commandlog(info,result,reason,landBusinessTypeList,null,0.0,0.0,0.0,0.0); |
| 115 | } | 151 | } |
| 152 | + | ||
| 153 | + String lockNoticeCheck(GatherInfo info,ExecuteParams executeParams) { | ||
| 154 | + if (info!=null && StringUtils.isNotEmpty(info.getBarcode())) { | ||
| 155 | + | ||
| 156 | + //todo:这里后期判定可以复用场站白名单验证 | ||
| 157 | +// FileTool.readProperties("station").contains(info.getAreaid()); | ||
| 158 | + /** | ||
| 159 | + * 申请业务类型检查 | ||
| 160 | + * 调拨业务及分拨业务装载货物为单证的,必须有关锁号 | ||
| 161 | + * 就算申请信息里面没关锁号也要通知 | ||
| 162 | + */ | ||
| 163 | + LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); | ||
| 164 | + if (landBusinessTypeList!=null){ | ||
| 165 | + if ("调拨业务".equals(landBusinessTypeList.getBusinesstype()) || "分拨业务".equals(landBusinessTypeList.getBusinesstype())) { | ||
| 166 | + | ||
| 167 | + String sfAreaid = "4600541001"; | ||
| 168 | + String zbqAreaid = "4600329012"; | ||
| 169 | + String zbqN3Areaid = "4612199001"; | ||
| 170 | + | ||
| 171 | + ApplicationContext context = getContext(); | ||
| 172 | + // 获取容器中的bean | ||
| 173 | + RedisService redisService = context.getBean(RedisService.class); | ||
| 174 | + | ||
| 175 | + String carEndstationList = redisService.get(info.getVename() + "_endstationList"); | ||
| 176 | + if (StringUtils.isNotEmpty(info.getVename()) && StringUtils.isNotEmpty(carEndstationList)){ | ||
| 177 | + | ||
| 178 | + //涉及综保区场站的申请不核验关锁业务. | ||
| 179 | + if (carEndstationList.contains(zbqAreaid)) { | ||
| 180 | + log.info("[LOCK-CHECK]-申报场站列表包含综保区,不处理关锁业务,当前场站:{}",landBusinessTypeList.getEndstation()); | ||
| 181 | + return DOT_NOTICE; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + //综保区场站及内三不通知,顺丰场站不通知 | ||
| 185 | + if (zbqAreaid.equals(landBusinessTypeList.getEndstation()) | ||
| 186 | + || zbqN3Areaid.equals(landBusinessTypeList.getEndstation()) | ||
| 187 | + || sfAreaid.equals(landBusinessTypeList.getEndstation()) | ||
| 188 | + ) { | ||
| 189 | + log.info("[LOCK-CHECK]-综保区及内三场站,顺丰场站,不处理关锁业务,当前场站:{}",landBusinessTypeList.getEndstation()); | ||
| 190 | + return DOT_NOTICE; | ||
| 191 | + }else { | ||
| 192 | + return NEED_NOTICE; | ||
| 193 | + /** | ||
| 194 | + * 单证验证-取消 | ||
| 195 | + */ | ||
| 196 | +// List<LAND_BUSINEESTYPE_LIST_INFO> land_busineestype_list_infos = landBusinessTypeList.getLandBusineestypeListInfoList(); | ||
| 197 | +// if (!land_busineestype_list_infos.isEmpty()){ | ||
| 198 | +// LAND_BUSINEESTYPE_LIST_INFO list_info = land_busineestype_list_infos.stream().parallel() | ||
| 199 | +// .filter(item -> "B".equals(item.getExt4())) | ||
| 200 | +// .findAny().orElse(null); | ||
| 201 | +// | ||
| 202 | +// //包含单证 | ||
| 203 | +// if (list_info!=null){ | ||
| 204 | +// log.info("[LOCK-CHECK]-包含单证,开始关锁通知"); | ||
| 205 | +// return true; | ||
| 206 | +// } | ||
| 207 | +// } | ||
| 208 | + } | ||
| 209 | + }else { | ||
| 210 | + return FAIL_NOTICE; | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + }else { | ||
| 214 | + log.info("[LOCK-CHECK]-无对应进出场申请"); | ||
| 215 | + return FAIL_NOTICE; | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + return FAIL_NOTICE; | ||
| 219 | + } | ||
| 116 | } | 220 | } |
| @@ -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 | * 提货验放 |
| @@ -43,7 +45,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | @@ -43,7 +45,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | ||
| 43 | WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class); | 45 | WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class); |
| 44 | 46 | ||
| 45 | logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype()); | 47 | logger.info("[进出场申请]-业务类型为:{}-{}",landBusinessTypeList.getCocode(),landBusinessTypeList.getBusinesstype()); |
| 46 | - if (weightCheckHandleService.checkImportDlv(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){ | 48 | + if (checkImportDlv(gatherInfo.getGrosswt(), selfWt, goodsWt,inAisleWT)){ |
| 47 | return true; | 49 | return true; |
| 48 | }else { | 50 | }else { |
| 49 | logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION); | 51 | logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION); |
| @@ -52,7 +54,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | @@ -52,7 +54,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | ||
| 52 | } | 54 | } |
| 53 | }catch (Exception e){ | 55 | }catch (Exception e){ |
| 54 | e.printStackTrace(); | 56 | e.printStackTrace(); |
| 55 | - logger.error("[VE-CHECK-ERROR]:",e); | 57 | + logger.error("[DLV_WEIGHT-CHECK-ERROR]:",e); |
| 56 | return false; | 58 | return false; |
| 57 | } | 59 | } |
| 58 | } | 60 | } |
| @@ -68,4 +70,59 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | @@ -68,4 +70,59 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { | ||
| 68 | ApplicationContext context = applicationContext; | 70 | ApplicationContext context = applicationContext; |
| 69 | return context; | 71 | return context; |
| 70 | } | 72 | } |
| 73 | + | ||
| 74 | + boolean checkImportDlv(double grossWt, double wt, double goodsWt,double inWt){ | ||
| 75 | + | ||
| 76 | + // 调用方法 | ||
| 77 | + ApplicationContext context = getContext(); | ||
| 78 | + | ||
| 79 | + //重量校验算法 | ||
| 80 | + WeightCheckHandleService weightCheckHandleService = context.getBean(WeightCheckHandleService.class); | ||
| 81 | + | ||
| 82 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
| 83 | + boolean flag = false; | ||
| 84 | + double result= 0.00; | ||
| 85 | + double result1= 0.00; | ||
| 86 | + double result2= 0.00; | ||
| 87 | + double emptyOut= 0.00; | ||
| 88 | + double goodCheckResult= 0.00; | ||
| 89 | + if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | ||
| 90 | + //进场过磅重量+带货重量 = 出场过磅重量 | ||
| 91 | +// result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | ||
| 92 | + result = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / goodsWt)); | ||
| 93 | + | ||
| 94 | + //带货提货,不提货判定,非空车离场 | ||
| 95 | + result2 = Double.parseDouble(df.format(Math.abs((inWt - grossWt)) / grossWt)); | ||
| 96 | + | ||
| 97 | + //个别原因不提货了,空车离场 | ||
| 98 | + emptyOut = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / grossWt)); | ||
| 99 | + | ||
| 100 | + //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭 | ||
| 101 | + result1 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt)); | ||
| 102 | + | ||
| 103 | + //带货提货,货重误差 | ||
| 104 | + goodCheckResult = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt)); | ||
| 105 | + | ||
| 106 | + double range = weightCheckHandleService.valueDob(); | ||
| 107 | + logger.info("[WEIGHT-CHECK]-实际离场拉货重量:{},申请离场拉货重量:{},货重差值:{},货重误差:{}",grossWt-inWt,goodsWt,grossWt-inWt-goodsWt,goodCheckResult); | ||
| 108 | + logger.info("[WEIGHT-CHECK]-进出场比对差值:{},提货离场差值:{},进出场比对重量差:{}",result,result1,Math.abs(inWt - grossWt)); | ||
| 109 | + | ||
| 110 | + if (goodCheckResult<=range | ||
| 111 | +// || result <= range | ||
| 112 | + ) { | ||
| 113 | + | ||
| 114 | + flag = true; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | +// //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭 | ||
| 118 | +// if (result1 <= range || result2 <= range || emptyOut <= range) { | ||
| 119 | +// | ||
| 120 | +// return true; | ||
| 121 | +// } | ||
| 122 | + | ||
| 123 | + | ||
| 124 | + } | ||
| 125 | + return flag; | ||
| 126 | + } | ||
| 127 | + | ||
| 71 | } | 128 | } |
| 1 | package com.sy.groovy | 1 | package com.sy.groovy |
| 2 | 2 | ||
| 3 | +import com.sy.crossDomain.BuildBarCode | ||
| 4 | +import com.sy.mapper.LandListDao | ||
| 3 | import com.sy.model.GatherInfo | 5 | import com.sy.model.GatherInfo |
| 4 | import com.sy.model.LandBusinessTypeList | 6 | import com.sy.model.LandBusinessTypeList |
| 7 | +import com.sy.service.CommandLogService | ||
| 8 | +import com.sy.service.LandBusListService | ||
| 9 | +import com.sy.service.RedisService | ||
| 5 | import com.sy.service.impl.GatherInfoHandle | 10 | import com.sy.service.impl.GatherInfoHandle |
| 6 | import org.basis.enhance.groovy.entity.ExecuteParams | 11 | import org.basis.enhance.groovy.entity.ExecuteParams |
| 7 | import org.slf4j.Logger | 12 | import org.slf4j.Logger |
| @@ -73,7 +78,7 @@ class X21FormReleaseCheck extends Script { | @@ -73,7 +78,7 @@ class X21FormReleaseCheck extends Script { | ||
| 73 | //todo:流转申请状态核销 | 78 | //todo:流转申请状态核销 |
| 74 | logger.info("[进出场申请]-流转申请开始核销:"+gatherInfo.getVename()); | 79 | logger.info("[进出场申请]-流转申请开始核销:"+gatherInfo.getVename()); |
| 75 | //二维码核销 | 80 | //二维码核销 |
| 76 | -// gatherInfoHandle.releaseBarCode(); | 81 | + releaseBarCode(gatherInfo,executeParams); |
| 77 | logger.info("[进出场申请]-流转申请已核销:"+gatherInfo.getVename()); | 82 | logger.info("[进出场申请]-流转申请已核销:"+gatherInfo.getVename()); |
| 78 | } | 83 | } |
| 79 | }catch (Exception e){ | 84 | }catch (Exception e){ |
| @@ -94,4 +99,61 @@ class X21FormReleaseCheck extends Script { | @@ -94,4 +99,61 @@ class X21FormReleaseCheck extends Script { | ||
| 94 | return context; | 99 | return context; |
| 95 | } | 100 | } |
| 96 | 101 | ||
| 102 | + void releaseBarCode(GatherInfo info,ExecuteParams executeParams){ | ||
| 103 | + ApplicationContext context = getContext(); | ||
| 104 | + // 获取容器中的bean | ||
| 105 | + LandBusListService listService = context.getBean(LandBusListService.class); | ||
| 106 | + LandListDao landListDao = context.getBean(LandListDao.class); | ||
| 107 | + Boolean devdebug = (Boolean)context.getBean("devdebug"); | ||
| 108 | + | ||
| 109 | + //是否有未驶离的流转记录二维码判定 | ||
| 110 | + int count=listService.selectlaststation(info.getVename(),info.getBarcode()); | ||
| 111 | + //二维码失效通知,已进入场站的与缓存比较. | ||
| 112 | + if(count==0){ | ||
| 113 | + //todo:测试注释掉,二维码释放 | ||
| 114 | + if (!devdebug){ | ||
| 115 | + BuildBarCode.cancleBarCode(info.getVename()); | ||
| 116 | + logger.info("[流转申请]-二维码已释放:"+info.getVename()); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + int rc = landListDao.releaseBarcode(info.getBarcode()); | ||
| 120 | + if (rc>0) { | ||
| 121 | + logger.info("[进出场核销]-{}流转已核销:{}",info.getVename(),info.getBarcode()); | ||
| 122 | + }else{ | ||
| 123 | + logger.error("[进出场核销-ERROR]-{}流转未核销成功:{}",info.getVename(),info.getBarcode()); | ||
| 124 | + } | ||
| 125 | + //车辆流转申请缓存删除 | ||
| 126 | + releaseCache(info,executeParams); | ||
| 127 | + }else{ | ||
| 128 | + logger.error("[进出场核销-ERROR]-{}二维码应该核销,但是不符合核销条件:{}",info.getVename(),info.getBarcode()); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + void releaseCache(GatherInfo info,ExecuteParams executeParams){ | ||
| 133 | + | ||
| 134 | + ApplicationContext context = getContext(); | ||
| 135 | + // 获取容器中的bean | ||
| 136 | + RedisService redisService = context.getBean(RedisService.class); | ||
| 137 | + | ||
| 138 | + //车辆流转申请缓存删除 | ||
| 139 | + redisService.del(info.getVename()); | ||
| 140 | + //流转申请时生成的临时核碰场站代码列表 | ||
| 141 | + redisService.del(info.getVename()+"_endstationList"); | ||
| 142 | + //车辆过卡信息缓存删除-X22金二判定时候生成的这个缓存 | ||
| 143 | + redisService.del(info.getSeqno()); | ||
| 144 | + logger.info("[流转缓存]-{}缓存已核销",info.getVename()); | ||
| 145 | + //核销记录 | ||
| 146 | + releaseRecord(info,executeParams); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 核销记录 | ||
| 151 | + */ | ||
| 152 | + void releaseRecord(GatherInfo info,ExecuteParams executeParams){ | ||
| 153 | + LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); | ||
| 154 | + ApplicationContext context = getContext(); | ||
| 155 | + CommandLogService commandLogService = context.getBean(CommandLogService.class); | ||
| 156 | + commandLogService.commandlog(info,true,"流转核销",chanelFormInfo,null,0.0,0.0,0.0,0.0); | ||
| 157 | + } | ||
| 158 | + | ||
| 97 | } | 159 | } |
| @@ -56,6 +56,10 @@ public interface EnginCheckService { | @@ -56,6 +56,10 @@ public interface EnginCheckService { | ||
| 56 | */ | 56 | */ |
| 57 | void commandlog(GatherInfo info, boolean check, String reason,ExecuteParams executeParams); | 57 | void commandlog(GatherInfo info, boolean check, String reason,ExecuteParams executeParams); |
| 58 | 58 | ||
| 59 | + void formRelease(GatherInfo info,ExecuteParams executeParams); | ||
| 60 | + | ||
| 61 | + void lockNoticeContinueCheck(GatherInfo info); | ||
| 62 | + | ||
| 59 | 63 | ||
| 60 | 64 | ||
| 61 | } | 65 | } |
| @@ -68,4 +68,11 @@ public interface WeightCheckHandleService { | @@ -68,4 +68,11 @@ public interface WeightCheckHandleService { | ||
| 68 | * @return 返回校验结果 true 通过,false 不通过 | 68 | * @return 返回校验结果 true 通过,false 不通过 |
| 69 | */ | 69 | */ |
| 70 | boolean checkEmpty(double grossWt,double wt); | 70 | boolean checkEmpty(double grossWt,double wt); |
| 71 | + | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 误差配置获取 | ||
| 75 | + * @return | ||
| 76 | + */ | ||
| 77 | + double valueDob(); | ||
| 71 | } | 78 | } |
| @@ -77,7 +77,14 @@ public class EnginCheckServiceImpl implements EnginCheckService { | @@ -77,7 +77,14 @@ public class EnginCheckServiceImpl implements EnginCheckService { | ||
| 77 | ruleChannelConfig.setChannelNum(gatherInfo.getChnlno()); | 77 | ruleChannelConfig.setChannelNum(gatherInfo.getChnlno()); |
| 78 | List<RuleChannelConfig> ruleChannelConfigs = ruleChannelConfigDao.selectByChannelAndBusiTypeAndGoodsType(ruleChannelConfig); | 78 | List<RuleChannelConfig> ruleChannelConfigs = ruleChannelConfigDao.selectByChannelAndBusiTypeAndGoodsType(ruleChannelConfig); |
| 79 | 79 | ||
| 80 | + if (ruleChannelConfigs!=null && !ruleChannelConfigs.isEmpty()){ | ||
| 80 | for (int i = 0; i < ruleChannelConfigs.size(); i++) { | 81 | for (int i = 0; i < ruleChannelConfigs.size(); i++) { |
| 82 | + /** | ||
| 83 | + * 核销判定需要另外执行.这里需要跳过. | ||
| 84 | + */ | ||
| 85 | + if (ruleChannelConfigs.get(i).ruleConfig != null && "核销判定".equals(ruleChannelConfigs.get(i).ruleConfig.getRuleType())){ | ||
| 86 | + return true; | ||
| 87 | + } | ||
| 81 | // 执行脚本中指定的方法 changeProduct | 88 | // 执行脚本中指定的方法 changeProduct |
| 82 | EngineExecutorResult executorResult = engineExecutor.execute( | 89 | EngineExecutorResult executorResult = engineExecutor.execute( |
| 83 | ruleChannelConfigs.get(i).ruleConfig.getScriptMethodName(), new ScriptQuery(ruleChannelConfigs.get(i).ruleConfig.getScriptKey()), executeParams); | 90 | ruleChannelConfigs.get(i).ruleConfig.getScriptMethodName(), new ScriptQuery(ruleChannelConfigs.get(i).ruleConfig.getScriptKey()), executeParams); |
| @@ -93,18 +100,19 @@ public class EnginCheckServiceImpl implements EnginCheckService { | @@ -93,18 +100,19 @@ public class EnginCheckServiceImpl implements EnginCheckService { | ||
| 93 | return false; | 100 | return false; |
| 94 | } | 101 | } |
| 95 | } | 102 | } |
| 96 | - | ||
| 97 | - //核销判定 | ||
| 98 | - if (executorResult.getContext()==null && "void".equals(ruleChannelConfigs.get(i).ruleConfig.getScriptMethodReturn())){ | ||
| 99 | - log.info("核销判定"); | ||
| 100 | - } | ||
| 101 | }else { | 103 | }else { |
| 102 | log.error("验证脚本名称:{},验证KEY-NAME:{}-[验放失败]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); | 104 | log.error("验证脚本名称:{},验证KEY-NAME:{}-[验放失败]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); |
| 103 | return false; | 105 | return false; |
| 104 | } | 106 | } |
| 105 | } | 107 | } |
| 106 | return true; | 108 | return true; |
| 109 | + }else { | ||
| 110 | + log.error("[{}]-通道未配置规则,不支持此业务",gatherInfo.getChnlno()); | ||
| 111 | + sendBw(gatherInfo,false,"通道未配置规则,不支持此业务",executeParams); | ||
| 112 | + return false; | ||
| 107 | } | 113 | } |
| 114 | + } | ||
| 115 | + sendBw(gatherInfo,false,"未找到流转申请信息",executeParams); | ||
| 108 | log.error("未找到流转申请信息"); | 116 | log.error("未找到流转申请信息"); |
| 109 | return false; | 117 | return false; |
| 110 | } | 118 | } |
| @@ -192,6 +200,7 @@ public class EnginCheckServiceImpl implements EnginCheckService { | @@ -192,6 +200,7 @@ public class EnginCheckServiceImpl implements EnginCheckService { | ||
| 192 | redisService.incr("kako-total",1); | 200 | redisService.incr("kako-total",1); |
| 193 | } | 201 | } |
| 194 | commandlog(info,check,reason,executeParams); | 202 | commandlog(info,check,reason,executeParams); |
| 203 | + return; | ||
| 195 | } | 204 | } |
| 196 | 205 | ||
| 197 | log.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); | 206 | log.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); |
| @@ -302,4 +311,107 @@ public class EnginCheckServiceImpl implements EnginCheckService { | @@ -302,4 +311,107 @@ public class EnginCheckServiceImpl implements EnginCheckService { | ||
| 302 | } | 311 | } |
| 303 | commandLogService.insert(command); | 312 | commandLogService.insert(command); |
| 304 | } | 313 | } |
| 314 | + | ||
| 315 | + | ||
| 316 | + @Override | ||
| 317 | + public void formRelease(GatherInfo gatherInfo, ExecuteParams executeParams) { | ||
| 318 | + //获取申请信息 | ||
| 319 | + LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); | ||
| 320 | + if (chanelFormInfo!=null) { | ||
| 321 | + //查询验放配置参数生成 | ||
| 322 | + RuleChannelConfig ruleChannelConfig = new RuleChannelConfig(); | ||
| 323 | + ruleChannelConfig.setBusinessType(chanelFormInfo.getBusinesstype()); | ||
| 324 | + ruleChannelConfig.setGoodsType(chanelFormInfo.getCocode()); | ||
| 325 | + ruleChannelConfig.setChannelNum(gatherInfo.getChnlno()); | ||
| 326 | + List<RuleChannelConfig> ruleChannelConfigs = ruleChannelConfigDao.selectByChannelAndBusiTypeAndGoodsType(ruleChannelConfig); | ||
| 327 | + | ||
| 328 | + if (ruleChannelConfigs!=null && !ruleChannelConfigs.isEmpty()){ | ||
| 329 | + for (int i = 0; i < ruleChannelConfigs.size(); i++) { | ||
| 330 | + //核销判定 | ||
| 331 | + if (ruleChannelConfigs.get(i).ruleConfig != null && "核销判定".equals(ruleChannelConfigs.get(i).ruleConfig.getRuleType())){ | ||
| 332 | + // 执行脚本中指定的方法 changeProduct | ||
| 333 | + EngineExecutorResult executorResult = engineExecutor.execute( | ||
| 334 | + ruleChannelConfigs.get(i).ruleConfig.getScriptMethodName(), new ScriptQuery(ruleChannelConfigs.get(i).ruleConfig.getScriptKey()), executeParams); | ||
| 335 | + log.info("核销判定验证脚本名称:{},验证KEY-NAME:{}", ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); | ||
| 336 | + log.info("核销判定判定放行结果=========>>>>>>>>>>>{}", executorResult); | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | + } | ||
| 340 | + }else { | ||
| 341 | + log.error("核销判定通道申请信息无效"); | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + @Override | ||
| 346 | + public void lockNoticeContinueCheck(GatherInfo gatherInfo) { | ||
| 347 | + | ||
| 348 | + ExecuteParams executeParams = makeParaByGagherInfo(gatherInfo); | ||
| 349 | + Boolean check = enginCheckByLockNotice(gatherInfo,executeParams); | ||
| 350 | + if (check){ | ||
| 351 | + log.info("脚本验放测试通过"); | ||
| 352 | + //放行 | ||
| 353 | + pass(gatherInfo,executeParams); | ||
| 354 | + | ||
| 355 | + formRelease(gatherInfo,executeParams); | ||
| 356 | + }else { | ||
| 357 | + log.error("脚本验放测试失败"); | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + private Boolean enginCheckByLockNotice(GatherInfo gatherInfo,ExecuteParams executeParams) { | ||
| 362 | + | ||
| 363 | + //获取申请信息 | ||
| 364 | + LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); | ||
| 365 | + if (chanelFormInfo!=null){ | ||
| 366 | + //查询验放配置参数生成 | ||
| 367 | + RuleChannelConfig ruleChannelConfig = new RuleChannelConfig(); | ||
| 368 | + ruleChannelConfig.setBusinessType(chanelFormInfo.getBusinesstype()); | ||
| 369 | + ruleChannelConfig.setGoodsType(chanelFormInfo.getCocode()); | ||
| 370 | + ruleChannelConfig.setChannelNum(gatherInfo.getChnlno()); | ||
| 371 | + List<RuleChannelConfig> ruleChannelConfigs = ruleChannelConfigDao.selectByChannelAndBusiTypeAndGoodsType(ruleChannelConfig); | ||
| 372 | + | ||
| 373 | + if (ruleChannelConfigs!=null && !ruleChannelConfigs.isEmpty()){ | ||
| 374 | + for (int i = 0; i < ruleChannelConfigs.size(); i++) { | ||
| 375 | + /** | ||
| 376 | + * 核销判定需要另外执行.这里需要跳过. | ||
| 377 | + */ | ||
| 378 | + if (ruleChannelConfigs.get(i).ruleConfig != null && "核销判定".equals(ruleChannelConfigs.get(i).ruleConfig.getRuleType())){ | ||
| 379 | + continue; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + if (ruleChannelConfigs.get(i).ruleConfig != null && ruleChannelConfigs.get(i).ruleConfig.getRuleType().contains("关锁")){ | ||
| 383 | + continue; | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + // 执行脚本中指定的方法 changeProduct | ||
| 387 | + EngineExecutorResult executorResult = engineExecutor.execute( | ||
| 388 | + ruleChannelConfigs.get(i).ruleConfig.getScriptMethodName(), new ScriptQuery(ruleChannelConfigs.get(i).ruleConfig.getScriptKey()), executeParams); | ||
| 389 | + log.info("验证脚本名称:{},验证KEY-NAME:{}", ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); | ||
| 390 | + log.info("使用groovy脚本来验证过卡判定放行结果=========>>>>>>>>>>>执行结果:{}", executorResult); | ||
| 391 | + if (executorResult.getExecutionStatus().equals(ExecutionStatus.SUCCESS)){ | ||
| 392 | + if (executorResult.getContext() instanceof Boolean){ | ||
| 393 | + Boolean execResult = (Boolean) executorResult.getContext(); | ||
| 394 | + if (execResult) { | ||
| 395 | + log.info("验证脚本名称:{},验证KEY-NAME:{}-[验放成功]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); | ||
| 396 | + }else { | ||
| 397 | + log.info("验放失败"); | ||
| 398 | + return false; | ||
| 399 | + } | ||
| 400 | + } | ||
| 401 | + }else { | ||
| 402 | + log.error("验证脚本名称:{},验证KEY-NAME:{}-[验放失败]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey()); | ||
| 403 | + return false; | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + return true; | ||
| 407 | + }else { | ||
| 408 | + log.error("[{}]-通道未配置规则,不支持此业务",gatherInfo.getChnlno()); | ||
| 409 | + sendBw(gatherInfo,false,"通道未配置规则,不支持此业务",executeParams); | ||
| 410 | + return false; | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + sendBw(gatherInfo,false,"未找到流转申请信息",executeParams); | ||
| 414 | + log.error("未找到流转申请信息"); | ||
| 415 | + return false; | ||
| 416 | + } | ||
| 305 | } | 417 | } |
| @@ -58,7 +58,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -58,7 +58,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 58 | * @param wt 车辆自重 | 58 | * @param wt 车辆自重 |
| 59 | * @param goodsWt 货物总重 | 59 | * @param goodsWt 货物总重 |
| 60 | * @param inWt 进场过磅重量 | 60 | * @param inWt 进场过磅重量 |
| 61 | - * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | 61 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行(规则取消) |
| 62 | + * 误差计算方式 (应该出场重量 - 出场重量) / 货物重量 与 误差比对,超过误差则不放行(新规) | ||
| 62 | * @return 返回校验结果 true 通过,false 不通过 | 63 | * @return 返回校验结果 true 通过,false 不通过 |
| 63 | */ | 64 | */ |
| 64 | @Override | 65 | @Override |
| @@ -83,7 +84,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -83,7 +84,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 83 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | 84 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ |
| 84 | result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | 85 | result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); |
| 85 | 86 | ||
| 86 | - result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | 87 | + result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / wt)); |
| 87 | 88 | ||
| 88 | log.info("[WEIGHT-CHECK]-进出场比对差值:{},空车出场差值:{},进出场比对重量差:{},空车比对重量差:{}",result,result2,Math.abs(inWt - goodsWt - grossWt),Math.abs(grossWt-wt)); | 89 | log.info("[WEIGHT-CHECK]-进出场比对差值:{},空车出场差值:{},进出场比对重量差:{},空车比对重量差:{}",result,result2,Math.abs(inWt - goodsWt - grossWt),Math.abs(grossWt-wt)); |
| 89 | } | 90 | } |
| @@ -107,7 +108,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -107,7 +108,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 107 | DecimalFormat df = new DecimalFormat("0.00"); | 108 | DecimalFormat df = new DecimalFormat("0.00"); |
| 108 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | 109 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ |
| 109 | //空车入场判定,入场重量-车辆备案重量 | 110 | //空车入场判定,入场重量-车辆备案重量 |
| 110 | - emptyIN = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / grossWt)); | 111 | + emptyIN = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / wt)); |
| 111 | 112 | ||
| 112 | double range = valueDob(); | 113 | double range = valueDob(); |
| 113 | 114 | ||
| @@ -141,7 +142,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -141,7 +142,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 141 | double goodCheckResult= 0.00; | 142 | double goodCheckResult= 0.00; |
| 142 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | 143 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ |
| 143 | //进场过磅重量+带货重量 = 出场过磅重量 | 144 | //进场过磅重量+带货重量 = 出场过磅重量 |
| 144 | - result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | 145 | +// result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); |
| 146 | + result = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / goodsWt)); | ||
| 145 | 147 | ||
| 146 | //带货提货,不提货判定,非空车离场 | 148 | //带货提货,不提货判定,非空车离场 |
| 147 | result2 = Double.parseDouble(df.format(Math.abs((inWt - grossWt)) / grossWt)); | 149 | result2 = Double.parseDouble(df.format(Math.abs((inWt - grossWt)) / grossWt)); |
| @@ -159,8 +161,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -159,8 +161,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 159 | log.info("[WEIGHT-CHECK]-实际离场拉货重量:{},申请离场拉货重量:{},货重差值:{},货重误差:{}",grossWt-inWt,goodsWt,grossWt-inWt-goodsWt,goodCheckResult); | 161 | log.info("[WEIGHT-CHECK]-实际离场拉货重量:{},申请离场拉货重量:{},货重差值:{},货重误差:{}",grossWt-inWt,goodsWt,grossWt-inWt-goodsWt,goodCheckResult); |
| 160 | log.info("[WEIGHT-CHECK]-进出场比对差值:{},提货离场差值:{},进出场比对重量差:{}",result,result1,Math.abs(inWt - grossWt)); | 162 | log.info("[WEIGHT-CHECK]-进出场比对差值:{},提货离场差值:{},进出场比对重量差:{}",result,result1,Math.abs(inWt - grossWt)); |
| 161 | 163 | ||
| 162 | - if (result <= range | ||
| 163 | -// || goodCheckResult<=range | 164 | + if (goodCheckResult<=range |
| 165 | +// || result <= range | ||
| 164 | ) { | 166 | ) { |
| 165 | 167 | ||
| 166 | flag = true; | 168 | flag = true; |
| @@ -205,20 +207,26 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -205,20 +207,26 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 205 | 207 | ||
| 206 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ | 208 | if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ |
| 207 | //带货出,入场重量+带货重量 = 离场重量 | 209 | //带货出,入场重量+带货重量 = 离场重量 |
| 208 | - result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | 210 | + result = Double.parseDouble(df.format(Math.abs((grossWt-inWt-goodsWt)) / goodsWt)); |
| 209 | //带货出,用车辆备案重量对碰,车辆备案重量+带货重量 = 离场重量 | 211 | //带货出,用车辆备案重量对碰,车辆备案重量+带货重量 = 离场重量 |
| 210 | - result4 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt)); | 212 | +// result4 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt)); |
| 213 | + result4 = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / goodsWt)); | ||
| 211 | //空车出,过磅重量 = 车辆备案重量 | 214 | //空车出,过磅重量 = 车辆备案重量 |
| 212 | - result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | 215 | + result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / wt)); |
| 213 | //卸货出,入场重量-卸货重量 = 离场重量 | 216 | //卸货出,入场重量-卸货重量 = 离场重量 |
| 214 | - result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | 217 | + result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / goodsWt)); |
| 218 | + | ||
| 215 | System.out.println("进场提货离场差值:"+result); | 219 | System.out.println("进场提货离场差值:"+result); |
| 216 | System.out.println("空车离场差值:"+result2); | 220 | System.out.println("空车离场差值:"+result2); |
| 217 | System.out.println("进场卸货离场差值:"+result3); | 221 | System.out.println("进场卸货离场差值:"+result3); |
| 218 | System.out.println("备案重量进场装载货物离场差值:"+result4); | 222 | System.out.println("备案重量进场装载货物离场差值:"+result4); |
| 219 | } | 223 | } |
| 220 | double range = valueDob(); | 224 | double range = valueDob(); |
| 221 | - if (result <= range || result2 <= range || result3 <= range || result4 <= range) { | 225 | + if (result2 <= range |
| 226 | + || result <= range | ||
| 227 | + || result3 <= range | ||
| 228 | + || result4 <= range | ||
| 229 | + ) { | ||
| 222 | flag = true; | 230 | flag = true; |
| 223 | } | 231 | } |
| 224 | return flag; | 232 | return flag; |
| @@ -234,7 +242,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -234,7 +242,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 234 | public boolean checkEmpty(double grossWt, double wt) { | 242 | public boolean checkEmpty(double grossWt, double wt) { |
| 235 | DecimalFormat df = new DecimalFormat("0.00"); | 243 | DecimalFormat df = new DecimalFormat("0.00"); |
| 236 | boolean flag=false; | 244 | boolean flag=false; |
| 237 | - double reult = Double.parseDouble(df.format(Math.abs((grossWt - wt)) / grossWt)); | 245 | + double reult = Double.parseDouble(df.format(Math.abs((grossWt - wt)) / wt)); |
| 238 | if (reult <= valueDob()) { | 246 | if (reult <= valueDob()) { |
| 239 | flag = true; | 247 | flag = true; |
| 240 | } | 248 | } |
| @@ -259,7 +267,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | @@ -259,7 +267,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
| 259 | } | 267 | } |
| 260 | 268 | ||
| 261 | //将获取的checkWt进行小数转化 | 269 | //将获取的checkWt进行小数转化 |
| 262 | - private double valueDob() { | 270 | + @Override |
| 271 | + public double valueDob() { | ||
| 263 | NumberFormat nf = NumberFormat.getPercentInstance(); | 272 | NumberFormat nf = NumberFormat.getPercentInstance(); |
| 264 | Number m = null; | 273 | Number m = null; |
| 265 | try { | 274 | try { |
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | <result column="script_method_name" jdbcType="VARCHAR" property="scriptMethodName" /> | 17 | <result column="script_method_name" jdbcType="VARCHAR" property="scriptMethodName" /> |
| 18 | <result column="script_method_return" jdbcType="VARCHAR" property="scriptMethodReturn" /> | 18 | <result column="script_method_return" jdbcType="VARCHAR" property="scriptMethodReturn" /> |
| 19 | <result column="rule_name" jdbcType="VARCHAR" property="ruleName" /> | 19 | <result column="rule_name" jdbcType="VARCHAR" property="ruleName" /> |
| 20 | + <result column="rule_type" jdbcType="VARCHAR" property="ruleType" /> | ||
| 20 | </association> | 21 | </association> |
| 21 | </resultMap> | 22 | </resultMap> |
| 22 | <sql id="Base_Column_List"> | 23 | <sql id="Base_Column_List"> |
| @@ -39,7 +40,8 @@ | @@ -39,7 +40,8 @@ | ||
| 39 | rule.script_key, | 40 | rule.script_key, |
| 40 | rule.script_method_name, | 41 | rule.script_method_name, |
| 41 | rule.script_method_return, | 42 | rule.script_method_return, |
| 42 | - rule.rule_name | 43 | + rule.rule_name, |
| 44 | + rule.rule_type | ||
| 43 | FROM | 45 | FROM |
| 44 | ( | 46 | ( |
| 45 | SELECT | 47 | SELECT |
| @@ -54,12 +56,12 @@ | @@ -54,12 +56,12 @@ | ||
| 54 | channel_num = #{channelNum,jdbcType=VARCHAR} | 56 | channel_num = #{channelNum,jdbcType=VARCHAR} |
| 55 | AND business_type = #{businessType,jdbcType=VARCHAR} | 57 | AND business_type = #{businessType,jdbcType=VARCHAR} |
| 56 | AND goods_type = #{goodsType,jdbcType=VARCHAR} | 58 | AND goods_type = #{goodsType,jdbcType=VARCHAR} |
| 57 | - ORDER BY config_order | ||
| 58 | ) conf | 59 | ) conf |
| 59 | LEFT JOIN | 60 | LEFT JOIN |
| 60 | rule_config rule | 61 | rule_config rule |
| 61 | ON | 62 | ON |
| 62 | conf.rule_id = rule.rule_id | 63 | conf.rule_id = rule.rule_id |
| 64 | + ORDER BY config_order | ||
| 63 | </select> | 65 | </select> |
| 64 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 66 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
| 65 | delete from rule_channel_config | 67 | delete from rule_channel_config |
| @@ -30,6 +30,7 @@ public class EnginTest { | @@ -30,6 +30,7 @@ public class EnginTest { | ||
| 30 | 30 | ||
| 31 | private static String IEPORSE = "无相对应进出场申请"; | 31 | private static String IEPORSE = "无相对应进出场申请"; |
| 32 | private static String CHANEL_ERR= "无对应通道流转申请,走错通道"; | 32 | private static String CHANEL_ERR= "无对应通道流转申请,走错通道"; |
| 33 | + private final static String PERMITTHOUGH = "直接放行"; | ||
| 33 | 34 | ||
| 34 | 35 | ||
| 35 | @Autowired | 36 | @Autowired |
| @@ -202,9 +203,9 @@ public class EnginTest { | @@ -202,9 +203,9 @@ public class EnginTest { | ||
| 202 | public void enginTest(){ | 203 | public void enginTest(){ |
| 203 | GatherInfo gatherInfo = new GatherInfo(); | 204 | GatherInfo gatherInfo = new GatherInfo(); |
| 204 | gatherInfo.setAreaid("4604600000"); | 205 | gatherInfo.setAreaid("4604600000"); |
| 205 | - gatherInfo.setChnlno("4604600010"); | ||
| 206 | - gatherInfo.setBarcode("681-43e2-925c-7b1e1054fbef"); | ||
| 207 | - gatherInfo.setGrosswt(new BigDecimal("6000")); | 206 | + gatherInfo.setChnlno("4604601010"); |
| 207 | + gatherInfo.setBarcode("bd4-4ee7-8cae-dbc2d6bc75b2"); | ||
| 208 | + gatherInfo.setGrosswt(new BigDecimal("2000")); | ||
| 208 | gatherInfo.setSeqno("20220630184441000028"); | 209 | gatherInfo.setSeqno("20220630184441000028"); |
| 209 | gatherInfo.setIetype("I"); | 210 | gatherInfo.setIetype("I"); |
| 210 | gatherInfo.setVename("豫A61CR7"); | 211 | gatherInfo.setVename("豫A61CR7"); |
| @@ -213,6 +214,7 @@ public class EnginTest { | @@ -213,6 +214,7 @@ public class EnginTest { | ||
| 213 | Boolean check = enginCheckService.enginCheckByGatherInfo(gatherInfo,executeParams); | 214 | Boolean check = enginCheckService.enginCheckByGatherInfo(gatherInfo,executeParams); |
| 214 | if (check){ | 215 | if (check){ |
| 215 | log.info("脚本验放测试通过"); | 216 | log.info("脚本验放测试通过"); |
| 217 | + //放行 | ||
| 216 | enginCheckService.pass(gatherInfo,executeParams); | 218 | enginCheckService.pass(gatherInfo,executeParams); |
| 217 | }else { | 219 | }else { |
| 218 | log.error("脚本验放测试失败"); | 220 | log.error("脚本验放测试失败"); |
-
请 注册 或 登录 后发表评论