作者 朱兆平

分拨业务查询优化,进场提货增加指令判定

@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 <groupId>com.sy</groupId> 6 <groupId>com.sy</groupId>
7 <artifactId>analysis_imf</artifactId> 7 <artifactId>analysis_imf</artifactId>
8 - <version>0.0.1-SNAPSHOT</version> 8 + <version>2.1-BH-SNAPSHOT</version>
9 <packaging>jar</packaging> 9 <packaging>jar</packaging>
10 10
11 <name>analysis_imf</name> 11 <name>analysis_imf</name>
@@ -17,7 +17,8 @@ public class IMF_Tesk { @@ -17,7 +17,8 @@ public class IMF_Tesk {
17 public static boolean isSuc = true; 17 public static boolean isSuc = true;
18 public static IMFClient client = null; 18 public static IMFClient client = null;
19 19
20 -// @Scheduled(fixedRate = 5000) 20 + //todo:测试关,生产开
  21 + @Scheduled(fixedRate = 5000)
21 private static void start() { 22 private static void start() {
22 //尝试catch SDK异常 23 //尝试catch SDK异常
23 try{ 24 try{
@@ -31,7 +31,7 @@ public class KAKO_Reader extends Thread{ @@ -31,7 +31,7 @@ public class KAKO_Reader extends Thread{
31 while(true) { 31 while(true) {
32 if (IMF_Tesk.LOGIN_OK){ 32 if (IMF_Tesk.LOGIN_OK){
33 String message = this.client.getMSG(); 33 String message = this.client.getMSG();
34 - logger.info(t.toString()+"读取线程已获取到消息"); 34 +// logger.info(t.toString()+"读取线程已获取到消息");
35 if (StringUtils.isNotEmpty(message)) { 35 if (StringUtils.isNotEmpty(message)) {
36 // logger.info(message); 36 // logger.info(message);
37 analysisRoute = new AnalysisRoute(); 37 analysisRoute = new AnalysisRoute();
@@ -48,7 +48,8 @@ public class KAKO_Reader extends Thread{ @@ -48,7 +48,8 @@ public class KAKO_Reader extends Thread{
48 // this.client.sendMSG(); 48 // this.client.sendMSG();
49 // } 49 // }
50 }else { 50 }else {
51 - logger.info("[READER-INFO]-获取到空消息,不处理"); 51 +// logger.info("[READER-INFO]-获取到空消息,不处理");
  52 +// System.out.println("[READER-INFO]-获取到空消息,不处理");
52 } 53 }
53 } 54 }
54 else { 55 else {
@@ -195,12 +195,17 @@ public class LiftBar { @@ -195,12 +195,17 @@ public class LiftBar {
195 //货物类型判断,直接放行的.todo:这个逻辑比较强大,后期要看怎么处理 195 //货物类型判断,直接放行的.todo:这个逻辑比较强大,后期要看怎么处理
196 }else if(!"普通货物".equals(list.getCocode()) && !"转关货物".equals(list.getCocode())){ 196 }else if(!"普通货物".equals(list.getCocode()) && !"转关货物".equals(list.getCocode())){
197 //todo:比如货物类型为快件货物,只走重量校验,不走放行信息等校验. 197 //todo:比如货物类型为快件货物,只走重量校验,不走放行信息等校验.
  198 + //todo:退库货物可以关联货运系统,得到退库信息进行比对
  199 + //todo:查验货物走查验信息比对
  200 + //todo:快件暂不校验直接放行,不过得录单
  201 + //todo:换单货物校验逻辑待定
198 logger.info("车辆装载货物为:"+list.getCocode()); 202 logger.info("车辆装载货物为:"+list.getCocode());
199 checkResult=true; 203 checkResult=true;
200 }else { 204 }else {
201 // 出场校验根据业务类型 205 // 出场校验根据业务类型
202 logger.info("[进出场申请]-业务类型为:"+list.getCocode()+list.getBusinesstype()); 206 logger.info("[进出场申请]-业务类型为:"+list.getCocode()+list.getBusinesstype());
203 switch (list.getBusinesstype()){ 207 switch (list.getBusinesstype()){
  208 + case "出口转关":
204 case "出口送货": 209 case "出口送货":
205 if (logic.weightCheckHandleService.checkExportDownLoading(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){ 210 if (logic.weightCheckHandleService.checkExportDownLoading(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){
206 checkResult=true; 211 checkResult=true;
@@ -333,8 +338,9 @@ public class LiftBar { @@ -333,8 +338,9 @@ public class LiftBar {
333 int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode()); 338 int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode());
334 //二维码失效 339 //二维码失效
335 if(count==0){ 340 if(count==0){
336 - //测试注释掉  
337 -// buildBarCode.cancleBarCode(vaName); 341 + //todo:测试注释掉,二维码释放
  342 + logger.info("[进出场申请]-二维码释放:"+vaName);
  343 + buildBarCode.cancleBarCode(vaName);
338 } 344 }
339 345
340 /** 346 /**
@@ -662,7 +668,8 @@ public class LiftBar { @@ -662,7 +668,8 @@ public class LiftBar {
662 */ 668 */
663 public Map nmmsAllocate(@NotNull String waybill){ 669 public Map nmmsAllocate(@NotNull String waybill){
664 logger.info("新舱单查询分拨申请数据开始"); 670 logger.info("新舱单查询分拨申请数据开始");
665 - Map map = logic.nmmsService.getAllocate(waybill,0,10); 671 + Feign_Allocate_Search feignAllocateSearch = new Feign_Allocate_Search(waybill,0,10);
  672 + Map map = logic.nmmsService.getAllocate(feignAllocateSearch);
666 logger.info(""+map); 673 logger.info(""+map);
667 return map; 674 return map;
668 } 675 }
  1 +package com.sy.model;
  2 +
  3 +public class Feign_Allocate_Search {
  4 + public String waybill;
  5 + public Integer pageIndex=0;
  6 + public Integer pageSize = 10;
  7 +
  8 + public Feign_Allocate_Search(String waybill, Integer pageIndex, Integer pageSize) {
  9 + this.waybill = waybill;
  10 + this.pageIndex = pageIndex;
  11 + this.pageSize = pageSize;
  12 + }
  13 +}
1 package com.sy.service; 1 package com.sy.service;
2 2
3 3
4 -import com.sy.service.impl.MessageServiceHystrix; 4 +import com.sy.model.Feign_Allocate_Search;
5 import com.sy.service.impl.NmmsServiceHystrix; 5 import com.sy.service.impl.NmmsServiceHystrix;
6 import org.springframework.cloud.openfeign.FeignClient; 6 import org.springframework.cloud.openfeign.FeignClient;
7 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
8 -import org.springframework.web.bind.annotation.PostMapping;  
9 -import org.springframework.web.bind.annotation.RequestParam;  
10 -import org.springframework.web.bind.annotation.ResponseBody; 8 +import org.springframework.web.bind.annotation.*;
11 9
12 import java.util.Map; 10 import java.util.Map;
13 11
@@ -20,12 +18,8 @@ import java.util.Map; @@ -20,12 +18,8 @@ import java.util.Map;
20 public interface NmmsService { 18 public interface NmmsService {
21 19
22 @ResponseBody 20 @ResponseBody
23 - @PostMapping("/Allocate/querypage_inportallocate")  
24 - Map getAllocate(  
25 - @RequestParam(value = "waybill", required = true) String waybill,  
26 - @RequestParam(value = "pageIndex", required = true,defaultValue = "0") int pageIndex,  
27 - @RequestParam(value = "pageSize", required = true,defaultValue = "10") int pageSize  
28 - ); 21 + @PostMapping(value = "/Allocate/querypage_inportallocate")
  22 + Map getAllocate(@RequestBody Feign_Allocate_Search feignAllocateSearch);
29 23
30 24
31 } 25 }
1 package com.sy.service.impl; 1 package com.sy.service.impl;
2 2
  3 +import com.sy.model.Feign_Allocate_Search;
3 import com.sy.service.NmmsService; 4 import com.sy.service.NmmsService;
4 import org.slf4j.Logger; 5 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
@@ -13,8 +14,8 @@ public class NmmsServiceHystrix implements NmmsService { @@ -13,8 +14,8 @@ public class NmmsServiceHystrix implements NmmsService {
13 private static final Logger logger = LoggerFactory.getLogger(NmmsServiceHystrix.class); 14 private static final Logger logger = LoggerFactory.getLogger(NmmsServiceHystrix.class);
14 15
15 @Override 16 @Override
16 - public Map<String, Object> getAllocate(String waybill, int pageIndex, int pageSize) {  
17 - logger.error("查询分拨申请数据失败,{}",waybill); 17 + public Map<String, Object> getAllocate(Feign_Allocate_Search feignAllocateSearch) {
  18 + logger.error("feign查询分拨申请数据失败,{}",feignAllocateSearch.waybill);
18 return new HashMap<>(); 19 return new HashMap<>();
19 } 20 }
20 } 21 }
@@ -101,11 +101,17 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { @@ -101,11 +101,17 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
101 boolean flag = false; 101 boolean flag = false;
102 double result= 0.00; 102 double result= 0.00;
103 double result1= 0.00; 103 double result1= 0.00;
  104 + double result2= 0.00;
  105 + double emptyOut= 0.00;
104 if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){ 106 if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
105 //进场过磅重量+带货重量 = 出场过磅重量 107 //进场过磅重量+带货重量 = 出场过磅重量
106 result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); 108 result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt));
107 109
108 //todo:这里没有加空车离场判定,暂时不加,进口提货业务空车离场走空车验放判定系统. 110 //todo:这里没有加空车离场判定,暂时不加,进口提货业务空车离场走空车验放判定系统.
  111 + result2 = Double.parseDouble(df.format(Math.abs((inWt - grossWt)) / grossWt));
  112 +
  113 + //个别原因不提货了,空车离场
  114 + emptyOut = Double.parseDouble(df.format(Math.abs((wt - grossWt)) / grossWt));
109 115
110 //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭 116 //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭
111 result1 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt)); 117 result1 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt));
@@ -119,11 +125,11 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { @@ -119,11 +125,11 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
119 flag = true; 125 flag = true;
120 } 126 }
121 127
122 -// //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭  
123 -// if (result1 <= range) {  
124 -//  
125 -// return true;  
126 -// } 128 + //车辆备案重量+货物重量 = 出场过磅重量,测试用,生产关闭
  129 + if (result1 <= range || result2 <= range || emptyOut <= range) {
  130 +
  131 + return true;
  132 + }
127 133
128 return flag; 134 return flag;
129 } 135 }
@@ -74,7 +74,7 @@ public class TaskAnalysis { @@ -74,7 +74,7 @@ public class TaskAnalysis {
74 private void threadJbob(File file,CountDownLatch latch,String transToCfps,ThreadPoolExecutor threadPool){ 74 private void threadJbob(File file,CountDownLatch latch,String transToCfps,ThreadPoolExecutor threadPool){
75 try{ 75 try{
76 AnalysisRoute analysisRoute=new AnalysisRoute(); 76 AnalysisRoute analysisRoute=new AnalysisRoute();
77 - String message = com.sy.utils.FileTool.readfile(file); 77 + String message = com.sy.utils.FileTool.readfile(file,"UTF-8");
78 analysisRoute.setMessage(message); 78 analysisRoute.setMessage(message);
79 threadPool.execute(analysisRoute); 79 threadPool.execute(analysisRoute);
80 FileUtils.moveFileToDirectory(file,new File("bw/handled/"),true); 80 FileUtils.moveFileToDirectory(file,new File("bw/handled/"),true);