正在显示
16 个修改的文件
包含
643 行增加
和
111 行删除
1 | -log4j.rootLogger=INFO, stdout, fileout | 1 | +log4j.rootLogger=ERROR, stdout, fileout |
2 | 2 | ||
3 | log4j.logger.com.fiscal = INFO | 3 | log4j.logger.com.fiscal = INFO |
4 | #******************************* | 4 | #******************************* |
@@ -16,4 +16,13 @@ log4j.appender.fileout.MaxBackupIndex=10 | @@ -16,4 +16,13 @@ log4j.appender.fileout.MaxBackupIndex=10 | ||
16 | log4j.appender.fileout.layout=org.apache.log4j.PatternLayout | 16 | log4j.appender.fileout.layout=org.apache.log4j.PatternLayout |
17 | log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n | 17 | log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss,SSSS}[%p] %m%n |
18 | 18 | ||
19 | +### 输出ERROR 级别以上的日志到=E://logs/error.log ### | ||
20 | +log4j.appender.E = org.apache.log4j.DailyRollingFileAppender | ||
21 | +log4j.appender.E.File = logs/error.log | ||
22 | +log4j.appender.E.MaxFileSize = 50MB | ||
23 | +log4j.appender.E.MaxBackupIndex = 10 | ||
24 | +log4j.appender.E.Append = true | ||
25 | +log4j.appender.E.Threshold = ERROR | ||
26 | +log4j.appender.E.layout = org.apache.log4j.PatternLayout | ||
27 | +log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n | ||
19 | 28 |
@@ -17,7 +17,7 @@ public class IMF_Tesk { | @@ -17,7 +17,7 @@ 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 | +// @Scheduled(fixedRate = 5000) |
21 | private static void start() { | 21 | private static void start() { |
22 | //尝试catch SDK异常 | 22 | //尝试catch SDK异常 |
23 | try{ | 23 | try{ |
@@ -5,6 +5,7 @@ import com.sy.logic.LiftBar; | @@ -5,6 +5,7 @@ import com.sy.logic.LiftBar; | ||
5 | import com.sy.logic.LogicOperation; | 5 | import com.sy.logic.LogicOperation; |
6 | import com.sy.model.*; | 6 | import com.sy.model.*; |
7 | import com.sy.service.*; | 7 | import com.sy.service.*; |
8 | +import org.apache.commons.lang.StringUtils; | ||
8 | import org.apache.log4j.Logger; | 9 | import org.apache.log4j.Logger; |
9 | import org.apache.log4j.PropertyConfigurator; | 10 | import org.apache.log4j.PropertyConfigurator; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -72,6 +73,10 @@ public class AnalysisRoute { | @@ -72,6 +73,10 @@ public class AnalysisRoute { | ||
72 | route.repertoryService = this.repertoryService; | 73 | route.repertoryService = this.repertoryService; |
73 | } | 74 | } |
74 | 75 | ||
76 | + /** | ||
77 | + * 解析从IMF接收过来的报文 | ||
78 | + * @param string 报文内容 | ||
79 | + */ | ||
75 | public static void analysis(String string) { | 80 | public static void analysis(String string) { |
76 | PropertyConfigurator.configure("config/log4j.properties"); | 81 | PropertyConfigurator.configure("config/log4j.properties"); |
77 | string = string.replace("Msg","MSG"); | 82 | string = string.replace("Msg","MSG"); |
@@ -184,7 +189,9 @@ public class AnalysisRoute { | @@ -184,7 +189,9 @@ public class AnalysisRoute { | ||
184 | if("MT9999".equals(message.getManifest().getHead().getMessageType())){ | 189 | if("MT9999".equals(message.getManifest().getHead().getMessageType())){ |
185 | RESMESSAGE resmessage = resMessageAnalysis.saveEntry(message.getManifest()); | 190 | RESMESSAGE resmessage = resMessageAnalysis.saveEntry(message.getManifest()); |
186 | RESMESSAGE msg =route.resMessageService.selectByManifest(resmessage.getManifest()); | 191 | RESMESSAGE msg =route.resMessageService.selectByManifest(resmessage.getManifest()); |
187 | - if(msg==null){ | 192 | + |
193 | + //放行回执中 有航班号的放行回执才入库 | ||
194 | + if(msg==null && StringUtils.isNotEmpty(resmessage.getJourneyid())){ | ||
188 | route.resMessageService.saveEnter(resmessage); | 195 | route.resMessageService.saveEnter(resmessage); |
189 | } | 196 | } |
190 | } | 197 | } |
@@ -52,7 +52,8 @@ public class GatherInfoAnalysis { | @@ -52,7 +52,8 @@ public class GatherInfoAnalysis { | ||
52 | bean.setIcpegdatetime(info.getIc().getIcRegDatetime()); | 52 | bean.setIcpegdatetime(info.getIc().getIcRegDatetime()); |
53 | bean.setIcperdaydue(info.getIc().getIcPerDayDue()); | 53 | bean.setIcperdaydue(info.getIc().getIcPerDayDue()); |
54 | bean.setIcfromtype(info.getIc().getIcFormType()); | 54 | bean.setIcfromtype(info.getIc().getIcFormType()); |
55 | + bean.setGpsid(info.getIc().getGpsId()); | ||
55 | return bean; | 56 | return bean; |
56 | } | 57 | } |
57 | - | 58 | + |
58 | } | 59 | } |
@@ -9,16 +9,16 @@ import java.math.BigDecimal; | @@ -9,16 +9,16 @@ import java.math.BigDecimal; | ||
9 | import java.util.Date; | 9 | import java.util.Date; |
10 | 10 | ||
11 | public class IC { | 11 | public class IC { |
12 | - | 12 | + |
13 | @XStreamAlias("DR_IC_NO") | 13 | @XStreamAlias("DR_IC_NO") |
14 | private String DRICNO; | 14 | private String DRICNO; |
15 | - | 15 | + |
16 | @XStreamAlias("IC_DR_CUSTOMS_NO") | 16 | @XStreamAlias("IC_DR_CUSTOMS_NO") |
17 | private String IcDrCustomsNo; | 17 | private String IcDrCustomsNo; |
18 | - | 18 | + |
19 | @XStreamAlias("IC_CO_CUSTOMS_NO") | 19 | @XStreamAlias("IC_CO_CUSTOMS_NO") |
20 | private String IcCoCustomsNo; | 20 | private String IcCoCustomsNo; |
21 | - | 21 | + |
22 | @XStreamAlias("IC_BILL_NO") | 22 | @XStreamAlias("IC_BILL_NO") |
23 | private String IcBillNo; | 23 | private String IcBillNo; |
24 | 24 | ||
@@ -28,22 +28,22 @@ public class IC { | @@ -28,22 +28,22 @@ public class IC { | ||
28 | @XStreamAlias("IC_GROSS_WT") | 28 | @XStreamAlias("IC_GROSS_WT") |
29 | @XStreamConverter(NumberConverter.class) | 29 | @XStreamConverter(NumberConverter.class) |
30 | private BigDecimal IcGrossWt; | 30 | private BigDecimal IcGrossWt; |
31 | - | 31 | + |
32 | @XStreamAlias("IC_VE_CUSTOMS_NO") | 32 | @XStreamAlias("IC_VE_CUSTOMS_NO") |
33 | private String IcVeCustomsNo; | 33 | private String IcVeCustomsNo; |
34 | - | 34 | + |
35 | @XStreamAlias("IC_VE_NAME") | 35 | @XStreamAlias("IC_VE_NAME") |
36 | private String IcVeName; | 36 | private String IcVeName; |
37 | - | 37 | + |
38 | @XStreamAlias("IC_CONTA_ID") | 38 | @XStreamAlias("IC_CONTA_ID") |
39 | private String IcContaId; | 39 | private String IcContaId; |
40 | - | 40 | + |
41 | @XStreamAlias("IC_ESEAL_ID") | 41 | @XStreamAlias("IC_ESEAL_ID") |
42 | private String IcEsealId; | 42 | private String IcEsealId; |
43 | - | 43 | + |
44 | @XStreamAlias("IC_BUSS_TYPE") | 44 | @XStreamAlias("IC_BUSS_TYPE") |
45 | private String IcBussType; | 45 | private String IcBussType; |
46 | - | 46 | + |
47 | @XStreamAlias("IC_EX_DATA") | 47 | @XStreamAlias("IC_EX_DATA") |
48 | private String IcExData; | 48 | private String IcExData; |
49 | 49 | ||
@@ -54,6 +54,19 @@ public class IC { | @@ -54,6 +54,19 @@ public class IC { | ||
54 | @XStreamAlias("IC_PER_DAY_DUE") | 54 | @XStreamAlias("IC_PER_DAY_DUE") |
55 | private String IcPerDayDue; | 55 | private String IcPerDayDue; |
56 | 56 | ||
57 | + public String getGpsId() { | ||
58 | + return GpsId; | ||
59 | + } | ||
60 | + | ||
61 | + public void setGpsId(String gpsId) { | ||
62 | + GpsId = gpsId; | ||
63 | + } | ||
64 | + | ||
65 | + @XStreamAlias("GPS_ID") | ||
66 | + private String GpsId; | ||
67 | + | ||
68 | + | ||
69 | + | ||
57 | public String getDRICNO() { | 70 | public String getDRICNO() { |
58 | return DRICNO; | 71 | return DRICNO; |
59 | } | 72 | } |
@@ -8,6 +8,7 @@ import com.sy.relation.VeManifestRelation; | @@ -8,6 +8,7 @@ import com.sy.relation.VeManifestRelation; | ||
8 | import com.sy.service.*; | 8 | import com.sy.service.*; |
9 | import com.sy.socket.CommandClient; | 9 | import com.sy.socket.CommandClient; |
10 | import com.sy.utils.FileTool; | 10 | import com.sy.utils.FileTool; |
11 | +import org.apache.commons.lang.StringUtils; | ||
11 | import org.apache.http.HttpEntity; | 12 | import org.apache.http.HttpEntity; |
12 | import org.apache.http.HttpResponse; | 13 | import org.apache.http.HttpResponse; |
13 | import org.apache.http.client.HttpClient; | 14 | import org.apache.http.client.HttpClient; |
@@ -52,6 +53,10 @@ public class LiftBar { | @@ -52,6 +53,10 @@ public class LiftBar { | ||
52 | private BusnesslistinfoService busnesslistinfoService; | 53 | private BusnesslistinfoService busnesslistinfoService; |
53 | @Autowired | 54 | @Autowired |
54 | BusnessViewService busnessViewService; | 55 | BusnessViewService busnessViewService; |
56 | + | ||
57 | + @Autowired | ||
58 | + WeightCheckHandleService weightCheckHandleService; | ||
59 | + | ||
55 | @Value("${wharf.interface.host}") | 60 | @Value("${wharf.interface.host}") |
56 | private String wharfHost; | 61 | private String wharfHost; |
57 | 62 | ||
@@ -59,12 +64,12 @@ public class LiftBar { | @@ -59,12 +64,12 @@ public class LiftBar { | ||
59 | private String nmmsHost; | 64 | private String nmmsHost; |
60 | 65 | ||
61 | private static LiftBar logic = new LiftBar(); | 66 | private static LiftBar logic = new LiftBar(); |
62 | - //从配置文件中读取货物重差可控范围 | ||
63 | - private static String checkWt = FileTool.readProperties("grossWt"); | 67 | + |
64 | //逻辑判断后的返回信息定义 | 68 | //逻辑判断后的返回信息定义 |
65 | private static String PERMITTHOUGH = "直接放行"; | 69 | private static String PERMITTHOUGH = "直接放行"; |
66 | private static String GROWSSEXCETION = "禁止通行,重量不在可控范围"; | 70 | private static String GROWSSEXCETION = "禁止通行,重量不在可控范围"; |
67 | private static String NORECORD = "车辆未备案或者识别错误,车牌号:"; | 71 | private static String NORECORD = "车辆未备案或者识别错误,车牌号:"; |
72 | + private static String NO_CHEPAI = "未识别到车牌号:"; | ||
68 | private static String INPUTSTATION = "此车辆未做进站申请"; | 73 | private static String INPUTSTATION = "此车辆未做进站申请"; |
69 | private static String ENTERSTATION = "此车辆未做出站申请"; | 74 | private static String ENTERSTATION = "此车辆未做出站申请"; |
70 | private static String ISVALID = "二维码数据异常,请使用正确的二维码数据"; | 75 | private static String ISVALID = "二维码数据异常,请使用正确的二维码数据"; |
@@ -74,6 +79,7 @@ public class LiftBar { | @@ -74,6 +79,7 @@ public class LiftBar { | ||
74 | 79 | ||
75 | @Autowired | 80 | @Autowired |
76 | private FeignService feignService; | 81 | private FeignService feignService; |
82 | + | ||
77 | @PostConstruct | 83 | @PostConstruct |
78 | public void init() { | 84 | public void init() { |
79 | logic = this; | 85 | logic = this; |
@@ -84,8 +90,10 @@ public class LiftBar { | @@ -84,8 +90,10 @@ public class LiftBar { | ||
84 | logic.feignService=this.feignService; | 90 | logic.feignService=this.feignService; |
85 | logic.busnesslistinfoService=this.busnesslistinfoService; | 91 | logic.busnesslistinfoService=this.busnesslistinfoService; |
86 | logic.busnessViewService=this.busnessViewService; | 92 | logic.busnessViewService=this.busnessViewService; |
93 | + logic.weightCheckHandleService=this.weightCheckHandleService; | ||
87 | logic.wharfHost=this.wharfHost; | 94 | logic.wharfHost=this.wharfHost; |
88 | logic.nmmsHost=this.nmmsHost; | 95 | logic.nmmsHost=this.nmmsHost; |
96 | + logic.feignService=this.feignService; | ||
89 | } | 97 | } |
90 | 98 | ||
91 | /** | 99 | /** |
@@ -98,50 +106,60 @@ public class LiftBar { | @@ -98,50 +106,60 @@ public class LiftBar { | ||
98 | boolean result = false; | 106 | boolean result = false; |
99 | //获取过磅重量 | 107 | //获取过磅重量 |
100 | double growssWt = info.getGrosswt().doubleValue(); | 108 | double growssWt = info.getGrosswt().doubleValue(); |
109 | + | ||
110 | + //初始化装载货物重量 | ||
101 | double goodsWt=0.0,inWt=0.0,diffVal=0.0; | 111 | double goodsWt=0.0,inWt=0.0,diffVal=0.0; |
102 | //取车牌号,判定卡口是否取到车牌号 | 112 | //取车牌号,判定卡口是否取到车牌号 |
103 | String vaName = info.getVename(); | 113 | String vaName = info.getVename(); |
104 | - //若无车牌号,返回未识别错误 | 114 | + |
115 | + //1. 若无车牌号,返回未识别错误 | ||
105 | if (vaName.length() <= 0) { | 116 | if (vaName.length() <= 0) { |
106 | - CommandClient.Client(info, NORECORD + vaName); | 117 | + CommandClient.Client(info, NO_CHEPAI + vaName); |
118 | + logger.error(NO_CHEPAI+vaName); | ||
107 | return result; | 119 | return result; |
108 | } | 120 | } |
109 | - //校验车辆是否备案 | 121 | + |
122 | + //2. 校验车辆是否备案 | ||
110 | LandRoadVe ve = logic.veService.selectByFrameNo(vaName); | 123 | LandRoadVe ve = logic.veService.selectByFrameNo(vaName); |
111 | //若无备案信息,返回车辆未备案或者识别错误 | 124 | //若无备案信息,返回车辆未备案或者识别错误 |
112 | if (ve == null) { | 125 | if (ve == null) { |
126 | + logger.error(NORECORD+vaName); | ||
113 | CommandClient.Client(info, NORECORD + vaName); | 127 | CommandClient.Client(info, NORECORD + vaName); |
114 | return result; | 128 | return result; |
115 | } | 129 | } |
130 | + | ||
116 | /** | 131 | /** |
117 | - * 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E | 132 | + * 3. 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E |
118 | * 查询是否已有此场站通道的申请 | 133 | * 查询是否已有此场站通道的申请 |
119 | */ | 134 | */ |
120 | //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 | 135 | //通过车牌号,二维码,场站,通道号,进出类型查询进出场站申请列表 |
121 | LandBusinessTypeList list = logic.listService.selectForOne(info.getVename(), info.getBarcode(), info.getAreaid(), info.getChnlno(), info.getIetype()); | 136 | LandBusinessTypeList list = logic.listService.selectForOne(info.getVename(), info.getBarcode(), info.getAreaid(), info.getChnlno(), info.getIetype()); |
122 | - //若查询结果为null,返回无相对应进出场申请 | 137 | + //4. 若查询结果为null,返回无相对应进出场申请 |
123 | if (list == null) { | 138 | if (list == null) { |
139 | + logger.error(vaName+IEPORSE); | ||
124 | CommandClient.Client(info, IEPORSE); | 140 | CommandClient.Client(info, IEPORSE); |
125 | return result; | 141 | return result; |
126 | } | 142 | } |
127 | - //判断进出场申请二维码是否已经失效,若失效,sendError | 143 | + |
144 | + //5. 判断进出场申请二维码是否已经失效,若失效,sendError ,0 未失效 | ||
128 | if ("0".equals(list.getIsvalid())) { | 145 | if ("0".equals(list.getIsvalid())) { |
129 | - //校验重量开始 | 146 | + //6. 校验重量开始 |
130 | boolean checkResult = false; | 147 | boolean checkResult = false; |
131 | boolean check = false; | 148 | boolean check = false; |
132 | boolean checkMainfest =false; | 149 | boolean checkMainfest =false; |
133 | 150 | ||
134 | - //判断是进场申请还是出场申请 | 151 | + //7. 判断是进场申请还是出场申请 |
135 | if("I".equals(info.getIetype())){ | 152 | if("I".equals(info.getIetype())){ |
136 | //进场申请宽进 | 153 | //进场申请宽进 |
137 | checkResult=true; | 154 | checkResult=true; |
155 | + } else { | ||
156 | + //出场判定 | ||
138 | 157 | ||
139 | - } | ||
140 | - else{ | ||
141 | - //获取对应场站进场申请的货物重量,进场过磅重量 | 158 | + //进出场重量差值计算 |
159 | + //获取对应场站进场申请的货物重量,进场过磅重量, | ||
142 | List<LandBusinessTypeList> listWt=logic.listService.selectwt(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),"I"); | 160 | List<LandBusinessTypeList> listWt=logic.listService.selectwt(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),"I"); |
143 | for(LandBusinessTypeList typeList:listWt){ | 161 | for(LandBusinessTypeList typeList:listWt){ |
144 | - if(typeList.getRemark()!=null && typeList.getRemark()!=""){ | 162 | + if(StringUtils.isNotEmpty(typeList.getRemark())){ |
145 | //货物重量 | 163 | //货物重量 |
146 | goodsWt=Double.parseDouble(typeList.getRemark()); | 164 | goodsWt=Double.parseDouble(typeList.getRemark()); |
147 | } | 165 | } |
@@ -151,13 +169,60 @@ public class LiftBar { | @@ -151,13 +169,60 @@ public class LiftBar { | ||
151 | } | 169 | } |
152 | diffVal = inWt- growssWt; | 170 | diffVal = inWt- growssWt; |
153 | } | 171 | } |
154 | - //判断场站出场是否要重量校验 | 172 | + |
173 | + //判断场站出场是否要重量校验,配置文件中配置的场站直接抬杆放行. | ||
155 | if(FileTool.readProperties("station").equals(list.getEndstation())||FileTool.readProperties("stationsf").equals(list.getEndstation())){ | 174 | if(FileTool.readProperties("station").equals(list.getEndstation())||FileTool.readProperties("stationsf").equals(list.getEndstation())){ |
156 | checkResult=true; | 175 | checkResult=true; |
157 | - }else if(!"普通货".equals(list.getCocode())){ | 176 | + //货物类型判断,直接放行的.todo:这个逻辑比较强大,后期要看怎么处理 |
177 | + }else if(!"普通货物".equals(list.getCocode()) && !"转关货物".equals(list.getCocode())){ | ||
178 | + logger.info("车辆装载货物为:"+list.getCocode()); | ||
158 | checkResult=true; | 179 | checkResult=true; |
159 | }else { | 180 | }else { |
160 | - check = logic.checkResult(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt); | 181 | + // 出场校验根据业务类型 |
182 | + switch (list.getBusinesstype()){ | ||
183 | + case "出口送货": | ||
184 | + if (logic.weightCheckHandleService.checkExportDownLoading(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){ | ||
185 | + checkResult=true; | ||
186 | + }else{ | ||
187 | + CommandClient.Client(info, GROWSSEXCETION); | ||
188 | + return false; | ||
189 | + } | ||
190 | + break; | ||
191 | + case "进口转关": | ||
192 | + case "进口提货": | ||
193 | + if (logic.weightCheckHandleService.checkImportDlv(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){ | ||
194 | + checkResult=true; | ||
195 | + //检查运单放行 | ||
196 | + if (logic.resMessageService.checkManifestRelease(list.getMasterList())){ | ||
197 | + checkResult=true; | ||
198 | + }else { | ||
199 | + //有运单未放行 | ||
200 | + CommandClient.Client(info, FANGXING); | ||
201 | + return false; | ||
202 | + } | ||
203 | + | ||
204 | + //todo:装载运单历史数据累加超重判定 | ||
205 | + }else{ | ||
206 | + CommandClient.Client(info, GROWSSEXCETION); | ||
207 | + return false; | ||
208 | + } | ||
209 | + break; | ||
210 | + case "分拨业务": | ||
211 | + case "调拨业务": | ||
212 | + if (logic.weightCheckHandleService.checkAllocateOrDispatch(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){ | ||
213 | + checkResult=true; | ||
214 | + }else{ | ||
215 | + CommandClient.Client(info, GROWSSEXCETION); | ||
216 | + return false; | ||
217 | + } | ||
218 | + break; | ||
219 | + default: | ||
220 | + checkResult=false; | ||
221 | + break; | ||
222 | + } | ||
223 | + | ||
224 | + | ||
225 | + check = logic.weightCheckHandleService.checkResult(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt); | ||
161 | if("出口送货".equals(list.getBusinesstype())){ | 226 | if("出口送货".equals(list.getBusinesstype())){ |
162 | if(check){ | 227 | if(check){ |
163 | checkResult=true; | 228 | checkResult=true; |
@@ -165,6 +230,7 @@ public class LiftBar { | @@ -165,6 +230,7 @@ public class LiftBar { | ||
165 | CommandClient.Client(info, GROWSSEXCETION); | 230 | CommandClient.Client(info, GROWSSEXCETION); |
166 | } | 231 | } |
167 | }else{ | 232 | }else{ |
233 | + //其他业务的装载运单放行判断 | ||
168 | checkMainfest = logic.checkManifest(list.getMasterList()); | 234 | checkMainfest = logic.checkManifest(list.getMasterList()); |
169 | if(checkMainfest){ | 235 | if(checkMainfest){ |
170 | checkResult=check || checkMainfest; | 236 | checkResult=check || checkMainfest; |
@@ -175,33 +241,47 @@ public class LiftBar { | @@ -175,33 +241,47 @@ public class LiftBar { | ||
175 | } | 241 | } |
176 | 242 | ||
177 | } | 243 | } |
178 | - if(logic.sendBw(info, checkResult)){//发送抬杆儿报文 | 244 | + |
245 | + //发送抬杆指令 | ||
246 | +// boolean commandResult = logic.sendBw(info, checkResult); | ||
247 | + //fortest 正式环境删除 | ||
248 | + boolean commandResult = true; | ||
249 | + if(commandResult){//发送抬杆儿报文 | ||
179 | if ("I".equals(info.getIetype())) { | 250 | if ("I".equals(info.getIetype())) { |
251 | + //过卡重量 | ||
180 | list.setAislewt(info.getGrosswt().doubleValue()); | 252 | list.setAislewt(info.getGrosswt().doubleValue()); |
181 | list.setUpdateDate(new Date()); | 253 | list.setUpdateDate(new Date()); |
182 | //list.setRemark(String.format("%.1f", goodsWt)); | 254 | //list.setRemark(String.format("%.1f", goodsWt)); |
255 | + //车辆备案重量 | ||
183 | list.setRemark2(ve.getSelfWt()); | 256 | list.setRemark2(ve.getSelfWt()); |
184 | list.setContrastflag("已进站"); | 257 | list.setContrastflag("已进站"); |
185 | - logic.checkData(list); | 258 | +// logic.checkData(list); |
186 | } else { | 259 | } else { |
187 | LandRoadVe veName = logic.veService.selectByFrameNo(vaName); | 260 | LandRoadVe veName = logic.veService.selectByFrameNo(vaName); |
188 | list.setAislewt(info.getGrosswt().doubleValue()); | 261 | list.setAislewt(info.getGrosswt().doubleValue()); |
189 | list.setUpdateDate(new Date()); | 262 | list.setUpdateDate(new Date()); |
263 | + //装载货物总重量 | ||
190 | list.setRemark(String.format("%.1f", goodsWt)); | 264 | list.setRemark(String.format("%.1f", goodsWt)); |
265 | + //进出差值 | ||
191 | list.setRemark1(String.format("%.1f", diffVal)); | 266 | list.setRemark1(String.format("%.1f", diffVal)); |
192 | list.setRemark2(veName.getSelfWt()); | 267 | list.setRemark2(veName.getSelfWt()); |
193 | list.setContrastflag("已出站"); | 268 | list.setContrastflag("已出站"); |
194 | - logic.checkData(list); | 269 | +// logic.checkData(list); |
195 | } | 270 | } |
196 | - logic.listService.updateById(list);//更新进出场申请业务表 | 271 | + |
272 | + //更新进出场申请业务表 | ||
273 | + logic.listService.updateById(list); | ||
274 | + | ||
197 | //进出场申请业务表对应场站的卡口失效 | 275 | //进出场申请业务表对应场站的卡口失效 |
198 | logic.listService.updateisvalid(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),list.getTurnoverflag()); | 276 | logic.listService.updateisvalid(list.getTrailerFrameNo(),list.getBarcode(),list.getEndstation(),list.getTurnoverflag()); |
277 | + | ||
199 | //判断是否为最后一个场站,若是最后个场站申请为出,二维码失效 | 278 | //判断是否为最后一个场站,若是最后个场站申请为出,二维码失效 |
200 | int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode()); | 279 | int count=logic.listService.selectlaststation(list.getTrailerFrameNo(),list.getBarcode()); |
201 | //二维码失效 | 280 | //二维码失效 |
202 | if(count==0){ | 281 | if(count==0){ |
203 | buildBarCode.cancleBarCode(vaName); | 282 | buildBarCode.cancleBarCode(vaName); |
204 | } | 283 | } |
284 | + | ||
205 | /** | 285 | /** |
206 | * 提前运抵判断 | 286 | * 提前运抵判断 |
207 | * 如果有提前运抵标识,判断是否分批,不分批直接通知 | 287 | * 如果有提前运抵标识,判断是否分批,不分批直接通知 |
@@ -239,7 +319,8 @@ public class LiftBar { | @@ -239,7 +319,8 @@ public class LiftBar { | ||
239 | logic.inOrUpEnterCancel(list); | 319 | logic.inOrUpEnterCancel(list); |
240 | } | 320 | } |
241 | } | 321 | } |
242 | - //绑定车单关系 | 322 | + |
323 | + //绑定车单关系,生成车单关系报文 | ||
243 | if(list.getMasterList().length()>0){ | 324 | if(list.getMasterList().length()>0){ |
244 | boolean flag = VeManifestRelation.createFile(list); | 325 | boolean flag = VeManifestRelation.createFile(list); |
245 | if(flag){ | 326 | if(flag){ |
@@ -248,15 +329,19 @@ public class LiftBar { | @@ -248,15 +329,19 @@ public class LiftBar { | ||
248 | } | 329 | } |
249 | 330 | ||
250 | } else { | 331 | } else { |
251 | - sendError(info); | ||
252 | logger.error("------->>>>>>>二维码数据异常,请使用正确的二维码数据<<<<<<<-----"); | 332 | logger.error("------->>>>>>>二维码数据异常,请使用正确的二维码数据<<<<<<<-----"); |
333 | + sendError(info); | ||
334 | + return false; | ||
253 | } | 335 | } |
254 | return true; | 336 | return true; |
255 | } | 337 | } |
338 | + | ||
339 | + | ||
256 | /** | 340 | /** |
257 | - * 校验重量并发送报文 | 341 | + * 校验重量后并发送抬杆指令报文 |
342 | + * @param info 车辆过卡信息 | ||
343 | + * @param check 是否放行抬杆 | ||
258 | */ | 344 | */ |
259 | - | ||
260 | public boolean sendBw(GatherInfo info, boolean check) { | 345 | public boolean sendBw(GatherInfo info, boolean check) { |
261 | logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); | 346 | logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); |
262 | boolean flag = false; | 347 | boolean flag = false; |
@@ -270,12 +355,13 @@ public class LiftBar { | @@ -270,12 +355,13 @@ public class LiftBar { | ||
270 | } | 355 | } |
271 | return flag; | 356 | return flag; |
272 | } | 357 | } |
358 | + | ||
273 | /** | 359 | /** |
274 | * 给码头发送卡口数据 | 360 | * 给码头发送卡口数据 |
275 | * | 361 | * |
276 | - * @param stationCode | ||
277 | - * @param carNo | ||
278 | - * @param IEtype | 362 | + * @param stationCode 场站编号 |
363 | + * @param carNo 车牌 | ||
364 | + * @param IEtype 进出 | ||
279 | */ | 365 | */ |
280 | public static void sendData(String stationCode, String carNo, boolean IEtype) { | 366 | public static void sendData(String stationCode, String carNo, boolean IEtype) { |
281 | String url = logic.wharfHost+"air-api/car/channelCar?stationCode=" + stationCode + "&carNo=" + carNo + "&isPickup=" + IEtype; | 367 | String url = logic.wharfHost+"air-api/car/channelCar?stationCode=" + stationCode + "&carNo=" + carNo + "&isPickup=" + IEtype; |
@@ -291,10 +377,11 @@ public class LiftBar { | @@ -291,10 +377,11 @@ public class LiftBar { | ||
291 | logger.info(e.toString()); | 377 | logger.info(e.toString()); |
292 | } | 378 | } |
293 | } | 379 | } |
380 | + | ||
294 | /** | 381 | /** |
295 | * 给码头发送卡口数据 | 382 | * 给码头发送卡口数据 |
296 | * | 383 | * |
297 | - * @param list | 384 | + * @param list 进出场申请数据 |
298 | */ | 385 | */ |
299 | public void checkData(LandBusinessTypeList list) { | 386 | public void checkData(LandBusinessTypeList list) { |
300 | String sationCode = null; | 387 | String sationCode = null; |
@@ -319,15 +406,21 @@ public class LiftBar { | @@ -319,15 +406,21 @@ public class LiftBar { | ||
319 | logger.info("码头发送消息异常---"+e.toString()); | 406 | logger.info("码头发送消息异常---"+e.toString()); |
320 | } | 407 | } |
321 | } | 408 | } |
409 | + | ||
410 | + | ||
322 | /** | 411 | /** |
323 | * 查询运单是否全部放行 | 412 | * 查询运单是否全部放行 |
324 | * | 413 | * |
325 | - * @param manifestList | 414 | + * @param manifestList 运单号数组 |
326 | * @return | 415 | * @return |
327 | */ | 416 | */ |
328 | public boolean checkManifest(String manifestList) { | 417 | public boolean checkManifest(String manifestList) { |
329 | - if (manifestList.length() < 1) return false; | 418 | + if (manifestList.length() < 1) { |
419 | + return false; | ||
420 | + } | ||
330 | manifestList = manifestList.replace("-", ""); | 421 | manifestList = manifestList.replace("-", ""); |
422 | + //中文逗号替换 | ||
423 | + manifestList = manifestList.replace(",", ","); | ||
331 | String[] maifest = manifestList.split(","); | 424 | String[] maifest = manifestList.split(","); |
332 | boolean flag = false; | 425 | boolean flag = false; |
333 | int count = 0; | 426 | int count = 0; |
@@ -336,45 +429,22 @@ public class LiftBar { | @@ -336,45 +429,22 @@ public class LiftBar { | ||
336 | if (resmessage != null) { | 429 | if (resmessage != null) { |
337 | if ("11".equals(resmessage.getResponsecode())) { | 430 | if ("11".equals(resmessage.getResponsecode())) { |
338 | count++; | 431 | count++; |
432 | + }else { | ||
433 | + logger.error("车辆装载运单未有放行信息---" + maifest[i]); | ||
339 | } | 434 | } |
435 | + | ||
436 | + }else { | ||
437 | + logger.error("车辆装载运单未有放行信息---" + maifest[i]); | ||
340 | } | 438 | } |
439 | + | ||
341 | } | 440 | } |
342 | if (count == maifest.length) { | 441 | if (count == maifest.length) { |
343 | flag = true; | 442 | flag = true; |
344 | } | 443 | } |
345 | return flag; | 444 | return flag; |
346 | } | 445 | } |
347 | - /** | ||
348 | - * 校验载重和称重是否在合理的范围 | ||
349 | - * | ||
350 | - * @Param grossWt 地磅称重 | ||
351 | - * @Param wt 车辆自重 | ||
352 | - * @Param goodsWt 货物总重 | ||
353 | - * @Result 获取运单重量 | ||
354 | - */ | ||
355 | - /** | ||
356 | - * 进场卸货误差判定 | ||
357 | - * 出场重量 = 进场重量 - 货物重量 | ||
358 | - * 首先计算 进出场差值数 ABS(进场重量-货物重量-出场重量)/出场重量, 计算出出场误差百分比 | ||
359 | - * (出场重量 - 车辆备案重量) /出场重量 | ||
360 | - * (出场重量 - (车辆备案重量+货物重量)/出场重量 | ||
361 | - * (出场重量 - (进场重量+货物重量)/出场重量 | ||
362 | - */ | ||
363 | - public boolean checkResult(double grossWt, double wt, double goodsWt,double inWt) { | ||
364 | - DecimalFormat df = new DecimalFormat("0.00"); | ||
365 | - boolean flag = false; | ||
366 | - double result= 0.0,result2= 0.0,result3= 0.0,result4= 0.0; | ||
367 | - if(grossWt>0){ | ||
368 | - result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | ||
369 | - result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | ||
370 | - result3 = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / grossWt)); | ||
371 | - result4 = Double.parseDouble(df.format(Math.abs((inWt + goodsWt)) / grossWt)); | ||
372 | - } | ||
373 | - if (result <= valueDob() ||result2 <= valueDob() || result3 <= valueDob() || result4 <= valueDob()) { | ||
374 | - flag = true; | ||
375 | - } | ||
376 | - return flag; | ||
377 | - } | 446 | + |
447 | + | ||
378 | 448 | ||
379 | 449 | ||
380 | 450 | ||
@@ -454,34 +524,8 @@ public class LiftBar { | @@ -454,34 +524,8 @@ public class LiftBar { | ||
454 | return bg; | 524 | return bg; |
455 | } | 525 | } |
456 | 526 | ||
457 | - /** | ||
458 | - * 判断备案车重与运单重量和地磅称重是否在合理范围 | ||
459 | - * | ||
460 | - * @param grossWt | ||
461 | - * @param wt | ||
462 | - * @return | ||
463 | - */ | ||
464 | - public boolean checkFlag(double grossWt, double wt) { | ||
465 | - DecimalFormat df = new DecimalFormat("0.00"); | ||
466 | - boolean flag = false; | ||
467 | - double reult = Double.parseDouble(df.format(Math.abs((grossWt - wt)) / grossWt)); | ||
468 | - if (reult <= valueDob()) { | ||
469 | - flag = true; | ||
470 | - } | ||
471 | - return flag; | ||
472 | - } | ||
473 | - //将获取的checkWt进行小数转化 | ||
474 | - public static double valueDob() { | ||
475 | - NumberFormat nf = NumberFormat.getPercentInstance(); | ||
476 | - Number m = null; | ||
477 | - try { | ||
478 | - m = nf.parse(checkWt);//将百分数转换成Number类型 | ||
479 | - } catch (ParseException e) { | ||
480 | - logger.info("重量校验消息异常---"+e.toString()); | ||
481 | - logger.info(e.getMessage()); | ||
482 | - } | ||
483 | - return m.doubleValue(); | ||
484 | - } | 527 | + |
528 | + | ||
485 | /** | 529 | /** |
486 | * 生成或者更新货物冻结标识 | 530 | * 生成或者更新货物冻结标识 |
487 | * | 531 | * |
@@ -4,6 +4,8 @@ import com.sy.model.RESMESSAGE; | @@ -4,6 +4,8 @@ import com.sy.model.RESMESSAGE; | ||
4 | import org.apache.ibatis.annotations.Param; | 4 | import org.apache.ibatis.annotations.Param; |
5 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
6 | 6 | ||
7 | +import java.util.List; | ||
8 | + | ||
7 | @Component | 9 | @Component |
8 | public interface RESMESSAGEMapper { | 10 | public interface RESMESSAGEMapper { |
9 | int deleteByPrimaryKey(String id); | 11 | int deleteByPrimaryKey(String id); |
@@ -19,4 +21,6 @@ public interface RESMESSAGEMapper { | @@ -19,4 +21,6 @@ public interface RESMESSAGEMapper { | ||
19 | int updateByPrimaryKey(RESMESSAGE record); | 21 | int updateByPrimaryKey(RESMESSAGE record); |
20 | 22 | ||
21 | RESMESSAGE selectByManifest(@Param("manifest") String manifest); | 23 | RESMESSAGE selectByManifest(@Param("manifest") String manifest); |
22 | -} | ||
24 | + | ||
25 | + List<RESMESSAGE> selectByManifestList(String[] manifest); | ||
26 | +} |
@@ -86,6 +86,16 @@ public class GatherInfo { | @@ -86,6 +86,16 @@ public class GatherInfo { | ||
86 | 86 | ||
87 | private String ordernum; | 87 | private String ordernum; |
88 | 88 | ||
89 | + public String getGpsid() { | ||
90 | + return gpsid; | ||
91 | + } | ||
92 | + | ||
93 | + public void setGpsid(String gpsid) { | ||
94 | + this.gpsid = gpsid; | ||
95 | + } | ||
96 | + | ||
97 | + private String gpsid; | ||
98 | + | ||
89 | public String getSeqno() { | 99 | public String getSeqno() { |
90 | return seqno; | 100 | return seqno; |
91 | } | 101 | } |
@@ -413,4 +423,4 @@ public class GatherInfo { | @@ -413,4 +423,4 @@ public class GatherInfo { | ||
413 | public void setOrdernum(String ordernum) { | 423 | public void setOrdernum(String ordernum) { |
414 | this.ordernum = ordernum == null ? null : ordernum.trim(); | 424 | this.ordernum = ordernum == null ? null : ordernum.trim(); |
415 | } | 425 | } |
416 | -} | ||
426 | +} |
@@ -2,6 +2,8 @@ package com.sy.service; | @@ -2,6 +2,8 @@ package com.sy.service; | ||
2 | 2 | ||
3 | import com.sy.model.RESMESSAGE; | 3 | import com.sy.model.RESMESSAGE; |
4 | 4 | ||
5 | +import java.util.List; | ||
6 | + | ||
5 | /** | 7 | /** |
6 | * @author | 8 | * @author |
7 | * @time 2019-${MOUTH}-22 21:31 | 9 | * @time 2019-${MOUTH}-22 21:31 |
@@ -11,4 +13,12 @@ public interface ResMessageService { | @@ -11,4 +13,12 @@ public interface ResMessageService { | ||
11 | int saveEnter(RESMESSAGE resmessage); | 13 | int saveEnter(RESMESSAGE resmessage); |
12 | 14 | ||
13 | RESMESSAGE selectByManifest(String manifest); | 15 | RESMESSAGE selectByManifest(String manifest); |
16 | + | ||
17 | + List<RESMESSAGE> selectByManifestList(String[] manifest); | ||
18 | + | ||
19 | + /** | ||
20 | + * @param manifestList 运单号数组字符串 格式为"'69515289724','40692420145','17233862076'" | ||
21 | + * @return 全部放行 返回true 未全部放行返回false | ||
22 | + */ | ||
23 | + boolean checkManifestRelease(String manifestList); | ||
14 | } | 24 | } |
1 | +package com.sy.service; | ||
2 | + | ||
3 | +/** | ||
4 | + * 宽进严出模式的出场站卡口重量判断 | ||
5 | + * 按业务类型进行重量判断 | ||
6 | + * @author mrz | ||
7 | + */ | ||
8 | +public interface WeightCheckHandleService { | ||
9 | + | ||
10 | + boolean checkResult(double grossWt, double wt, double goodsWt,double inWt); | ||
11 | + | ||
12 | + /** | ||
13 | + * 出口普货送货业务重量校验,可支持 带货送货,不支持送货提货 | ||
14 | + * 进场重量-载货重量 = 出场重量 (此逻辑已包含空车离场判定) | ||
15 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
16 | + * @param wt 车辆自重 | ||
17 | + * @param goodsWt 货物总重 | ||
18 | + * @param inWt 进场过磅重量 | ||
19 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
20 | + * @return 返回校验结果 true 通过,false 不通过 | ||
21 | + */ | ||
22 | + boolean checkExportDownLoading(double grossWt, double wt, double goodsWt,double inWt); | ||
23 | + | ||
24 | + /** | ||
25 | + * 进口普货提货业务重量校验,可支持 带货提货,不支持卸货提货 | ||
26 | + * 进口转关业务重量校验 | ||
27 | + * 进场重量+载货重量 = 出场重量 | ||
28 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
29 | + * @param wt 车辆自重 | ||
30 | + * @param goodsWt 货物总重 | ||
31 | + * @param inWt 进场过磅重量 | ||
32 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
33 | + * @return 返回校验结果 true 通过,false 不通过 | ||
34 | + */ | ||
35 | + boolean checkImportDlv(double grossWt, double wt, double goodsWt,double inWt); | ||
36 | + | ||
37 | + /** | ||
38 | + * 分拨/调拨业务重量校验 | ||
39 | + * 进场重量+载货重量 = 出场重量 (装载场站装货离场) | ||
40 | + * 或者 空车出场 (最后卸货离场) | ||
41 | + * 或者 进场重量-载货重量 = 出场重量 (目的场站卸货离场) | ||
42 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
43 | + * @param wt 车辆自重 | ||
44 | + * @param goodsWt 货物总重 | ||
45 | + * @param inWt 进场过磅重量 | ||
46 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
47 | + * @return 返回校验结果 true 通过,false 不通过 | ||
48 | + */ | ||
49 | + boolean checkAllocateOrDispatch(double grossWt, double wt, double goodsWt,double inWt); | ||
50 | +} |
1 | package com.sy.service.impl; | 1 | package com.sy.service.impl; |
2 | 2 | ||
3 | +import com.sy.logic.LiftBar; | ||
3 | import com.sy.mapper.RESMESSAGEMapper; | 4 | import com.sy.mapper.RESMESSAGEMapper; |
4 | import com.sy.model.RESMESSAGE; | 5 | import com.sy.model.RESMESSAGE; |
5 | import com.sy.service.ResMessageService; | 6 | import com.sy.service.ResMessageService; |
7 | +import org.apache.log4j.Logger; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
7 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
8 | 10 | ||
11 | +import java.util.List; | ||
12 | + | ||
9 | /** | 13 | /** |
10 | * @author | 14 | * @author |
11 | * @time 2019-${MOUTH}-22 21:32 | 15 | * @time 2019-${MOUTH}-22 21:32 |
12 | */ | 16 | */ |
13 | @Service | 17 | @Service |
14 | public class ResMessageServiceImpl implements ResMessageService { | 18 | public class ResMessageServiceImpl implements ResMessageService { |
19 | + private static final Logger logger = Logger.getLogger(ResMessageServiceImpl.class); | ||
15 | 20 | ||
16 | @Autowired | 21 | @Autowired |
17 | private RESMESSAGEMapper mapper; | 22 | private RESMESSAGEMapper mapper; |
18 | 23 | ||
19 | 24 | ||
25 | + @Override | ||
20 | public int saveEnter(RESMESSAGE resmessage){ | 26 | public int saveEnter(RESMESSAGE resmessage){ |
21 | return mapper.insertSelective(resmessage); | 27 | return mapper.insertSelective(resmessage); |
22 | } | 28 | } |
23 | 29 | ||
30 | + @Override | ||
24 | public RESMESSAGE selectByManifest(String manifest){ | 31 | public RESMESSAGE selectByManifest(String manifest){ |
25 | return mapper.selectByManifest(manifest); | 32 | return mapper.selectByManifest(manifest); |
26 | } | 33 | } |
34 | + | ||
35 | + @Override | ||
36 | + public List<RESMESSAGE> selectByManifestList(String[] manifest) { | ||
37 | + return mapper.selectByManifestList(manifest); | ||
38 | + } | ||
39 | + | ||
40 | + @Override | ||
41 | + public boolean checkManifestRelease(String manifestList) { | ||
42 | + if (manifestList.length() < 1) { | ||
43 | + return false; | ||
44 | + } | ||
45 | + manifestList = manifestList.replace("-", ""); | ||
46 | + //中文逗号替换 | ||
47 | + manifestList = manifestList.replace(",", ","); | ||
48 | + String[] maifest = manifestList.split(","); | ||
49 | + logger.info("运单列表:" + manifestList); | ||
50 | + boolean flag = false; | ||
51 | + | ||
52 | + List<RESMESSAGE> list = selectByManifestList(maifest); | ||
53 | + | ||
54 | + if (list.size() == maifest.length) { | ||
55 | + flag = true; | ||
56 | + } | ||
57 | + return flag; | ||
58 | + } | ||
27 | } | 59 | } |
1 | +package com.sy.service.impl; | ||
2 | + | ||
3 | +import com.sy.logic.LiftBar; | ||
4 | +import com.sy.service.WeightCheckHandleService; | ||
5 | +import com.sy.utils.FileTool; | ||
6 | +import org.apache.log4j.Logger; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.text.DecimalFormat; | ||
10 | +import java.text.NumberFormat; | ||
11 | +import java.text.ParseException; | ||
12 | + | ||
13 | +@Service | ||
14 | +public class WeightCheckHandleServiceImpl implements WeightCheckHandleService { | ||
15 | + | ||
16 | + private static final Logger logger = Logger.getLogger(WeightCheckHandleServiceImpl.class); | ||
17 | + | ||
18 | + //从配置文件中读取货物重差可控范围 | ||
19 | + private static String checkWt = FileTool.readProperties("grossWt"); | ||
20 | + | ||
21 | + /** | ||
22 | + * 校验载重和称重是否在合理的范围 | ||
23 | + * | ||
24 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
25 | + * @param wt 车辆自重 | ||
26 | + * @param goodsWt 货物总重 | ||
27 | + * @param inWt 进场过磅重量 | ||
28 | + * @return 获取运单重量 | ||
29 | + */ | ||
30 | + /** | ||
31 | + * 进场卸货误差判定 | ||
32 | + * 出场重量 = 进场重量 - 货物重量 | ||
33 | + * 首先计算 进出场差值数 ABS(进场重量-货物重量-出场重量)/出场重量, 计算出出场误差百分比 | ||
34 | + * (出场重量 - 车辆备案重量) /出场重量 空车离场 | ||
35 | + * (出场重量 - (车辆备案重量+货物重量)/出场重量 进场提货(涉及业务,普货提货,调拨,分拨,转关提货) | ||
36 | + * (出场重量 - (进场重量+货物重量)/出场重量 | ||
37 | + */ | ||
38 | + @Override | ||
39 | + public boolean checkResult(double grossWt, double wt, double goodsWt, double inWt) { | ||
40 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
41 | + boolean flag = false; | ||
42 | + double result= 0.0,result2= 0.0,result3= 0.0,result4= 0.0; | ||
43 | + if(grossWt>0){ | ||
44 | + result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | ||
45 | + result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | ||
46 | + result3 = Double.parseDouble(df.format(Math.abs((grossWt-wt-goodsWt)) / grossWt)); | ||
47 | + result4 = Double.parseDouble(df.format(Math.abs((inWt + goodsWt)) / grossWt)); | ||
48 | + } | ||
49 | + if (result <= valueDob() ||result2 <= valueDob() || result3 <= valueDob() || result4 <= valueDob()) { | ||
50 | + flag = true; | ||
51 | + } | ||
52 | + return flag; | ||
53 | + } | ||
54 | + | ||
55 | + /** | ||
56 | + * 出口普货送货业务重量校验,可支持 带货送货,不支持送货提货 | ||
57 | + * 进场重量-载货重量 = 出场重量 (此逻辑已包含空车离场判定) | ||
58 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
59 | + * @param wt 车辆自重 | ||
60 | + * @param goodsWt 货物总重 | ||
61 | + * @param inWt 进场过磅重量 | ||
62 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
63 | + * @return 返回校验结果 true 通过,false 不通过 | ||
64 | + */ | ||
65 | + @Override | ||
66 | + public boolean checkExportDownLoading(double grossWt, double wt, double goodsWt, double inWt){ | ||
67 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
68 | + boolean flag = false; | ||
69 | + //卸货判定 | ||
70 | + double result= 0.0; | ||
71 | + //以防万一 空车离场判定 | ||
72 | + double result2= 0.0; | ||
73 | + if(grossWt>0){ | ||
74 | + result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | ||
75 | + result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | ||
76 | + } | ||
77 | + if (result <= valueDob() || result2 <= valueDob()) { | ||
78 | + flag = true; | ||
79 | + } | ||
80 | + return flag; | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * 进口普货提货业务重量校验,可支持 带货提货,不支持卸货提货 | ||
85 | + * 进口转关业务重量校验 | ||
86 | + * 进场重量+载货重量 = 出场重量 | ||
87 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
88 | + * @param wt 车辆自重 | ||
89 | + * @param goodsWt 货物总重 | ||
90 | + * @param inWt 进场过磅重量 | ||
91 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
92 | + * @return 返回校验结果 true 通过,false 不通过 | ||
93 | + */ | ||
94 | + @Override | ||
95 | + public boolean checkImportDlv(double grossWt, double wt, double goodsWt,double inWt){ | ||
96 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
97 | + boolean flag = false; | ||
98 | + double result= 0.0; | ||
99 | + if(grossWt>0){ | ||
100 | + result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | ||
101 | + } | ||
102 | + if (result <= valueDob()) { | ||
103 | + flag = true; | ||
104 | + } | ||
105 | + return flag; | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * 分拨/调拨业务重量校验 | ||
110 | + * 进场重量+载货重量 = 出场重量 (装载场站装货离场) | ||
111 | + * 或者 空车出场 (最后卸货离场) | ||
112 | + * 或者 进场重量-载货重量 = 出场重量 (目的场站卸货离场) | ||
113 | + * @param grossWt 地磅称重,也称出场过磅重量 | ||
114 | + * @param wt 车辆自重 | ||
115 | + * @param goodsWt 货物总重 | ||
116 | + * @param inWt 进场过磅重量 | ||
117 | + * 误差计算方式 (应该出场重量 - 出场重量) / 出场重量 与 误差比对,超过误差则不放行 | ||
118 | + * @return 返回校验结果 true 通过,false 不通过 | ||
119 | + */ | ||
120 | + @Override | ||
121 | + public boolean checkAllocateOrDispatch(double grossWt, double wt, double goodsWt,double inWt){ | ||
122 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
123 | + boolean flag = false; | ||
124 | + //载货离场判定 | ||
125 | + double result= 0.0; | ||
126 | + //空车离场判定 | ||
127 | + double result2= 0.0; | ||
128 | + | ||
129 | + //卸货离场判定 | ||
130 | + double result3= 0.0; | ||
131 | + | ||
132 | + if(grossWt>0){ | ||
133 | + result = Double.parseDouble(df.format(Math.abs((inWt + goodsWt - grossWt)) / grossWt)); | ||
134 | + result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt)); | ||
135 | + result3 = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt)); | ||
136 | + } | ||
137 | + if (result <= valueDob() || result2 <= valueDob() || result3 <= valueDob() ) { | ||
138 | + flag = true; | ||
139 | + } | ||
140 | + return flag; | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | + * 判断备案车重与运单重量和地磅称重是否在合理范围 | ||
145 | + * | ||
146 | + * @param grossWt | ||
147 | + * @param wt | ||
148 | + * @return | ||
149 | + */ | ||
150 | + public boolean checkFlag(double grossWt, double wt) { | ||
151 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
152 | + boolean flag = false; | ||
153 | + double reult = Double.parseDouble(df.format(Math.abs((grossWt - wt)) / grossWt)); | ||
154 | + if (reult <= valueDob()) { | ||
155 | + flag = true; | ||
156 | + } | ||
157 | + return flag; | ||
158 | + } | ||
159 | + | ||
160 | + //将获取的checkWt进行小数转化 | ||
161 | + private double valueDob() { | ||
162 | + NumberFormat nf = NumberFormat.getPercentInstance(); | ||
163 | + Number m = null; | ||
164 | + try { | ||
165 | + m = nf.parse(checkWt);//将百分数转换成Number类型 | ||
166 | + } catch (ParseException e) { | ||
167 | + logger.info("重量校验消息异常---"+e.toString()); | ||
168 | + logger.info(e.getMessage()); | ||
169 | + } | ||
170 | + return m.doubleValue(); | ||
171 | + } | ||
172 | +} |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | id, JourneyID, Manifest, ResponseCode, ResponseText | 12 | id, JourneyID, Manifest, ResponseCode, ResponseText |
13 | </sql> | 13 | </sql> |
14 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 14 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
15 | - select | 15 | + select |
16 | <include refid="Base_Column_List" /> | 16 | <include refid="Base_Column_List" /> |
17 | from resmessage | 17 | from resmessage |
18 | where id = #{id,jdbcType=VARCHAR} | 18 | where id = #{id,jdbcType=VARCHAR} |
@@ -23,14 +23,24 @@ | @@ -23,14 +23,24 @@ | ||
23 | from resmessage | 23 | from resmessage |
24 | where Manifest = #{manifest,jdbcType=VARCHAR} | 24 | where Manifest = #{manifest,jdbcType=VARCHAR} |
25 | </select> | 25 | </select> |
26 | + <select id="selectByManifestList" resultMap="BaseResultMap"> | ||
27 | + select | ||
28 | + <include refid="Base_Column_List" /> | ||
29 | + from resmessage | ||
30 | + where Manifest in | ||
31 | + <foreach collection="array" item="manifest" index="index" open="(" close=")" separator=","> | ||
32 | + #{manifest,jdbcType=VARCHAR} | ||
33 | + </foreach> | ||
34 | + AND `ResponseCode` = '11' | ||
35 | + </select> | ||
26 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | 36 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> |
27 | delete from resmessage | 37 | delete from resmessage |
28 | where id = #{id,jdbcType=VARCHAR} | 38 | where id = #{id,jdbcType=VARCHAR} |
29 | </delete> | 39 | </delete> |
30 | <insert id="insert" parameterType="com.sy.model.RESMESSAGE"> | 40 | <insert id="insert" parameterType="com.sy.model.RESMESSAGE"> |
31 | - insert into resmessage (id, JourneyID, Manifest, | 41 | + insert into resmessage (id, JourneyID, Manifest, |
32 | ResponseCode, ResponseText) | 42 | ResponseCode, ResponseText) |
33 | - values (#{id,jdbcType=VARCHAR}, #{journeyid,jdbcType=VARCHAR}, #{manifest,jdbcType=VARCHAR}, | 43 | + values (#{id,jdbcType=VARCHAR}, #{journeyid,jdbcType=VARCHAR}, #{manifest,jdbcType=VARCHAR}, |
34 | #{responsecode,jdbcType=VARCHAR}, #{responsetext,jdbcType=VARCHAR}) | 44 | #{responsecode,jdbcType=VARCHAR}, #{responsetext,jdbcType=VARCHAR}) |
35 | </insert> | 45 | </insert> |
36 | <insert id="insertSelective" parameterType="com.sy.model.RESMESSAGE"> | 46 | <insert id="insertSelective" parameterType="com.sy.model.RESMESSAGE"> |
@@ -96,4 +106,4 @@ | @@ -96,4 +106,4 @@ | ||
96 | ResponseText = #{responsetext,jdbcType=VARCHAR} | 106 | ResponseText = #{responsetext,jdbcType=VARCHAR} |
97 | where id = #{id,jdbcType=VARCHAR} | 107 | where id = #{id,jdbcType=VARCHAR} |
98 | </update> | 108 | </update> |
99 | -</mapper> | ||
109 | +</mapper> |
src/test/java/com/sy/BeihuoTests.java
0 → 100644
1 | +package com.sy; | ||
2 | + | ||
3 | +import com.sy.bwAnalysis.AnalysisRoute; | ||
4 | +import com.sy.logic.LiftBar; | ||
5 | +import org.apache.log4j.Logger; | ||
6 | +import org.junit.Test; | ||
7 | +import org.junit.runner.RunWith; | ||
8 | +import org.springframework.boot.test.context.SpringBootTest; | ||
9 | +import org.springframework.test.context.junit4.SpringRunner; | ||
10 | + | ||
11 | +@RunWith(SpringRunner.class) | ||
12 | +@SpringBootTest | ||
13 | +public class BeihuoTests { | ||
14 | + | ||
15 | + private static final Logger logger = Logger.getLogger(LiftBar.class); | ||
16 | + | ||
17 | + //车牌号 | ||
18 | + private String voNo = "豫A61CR7"; | ||
19 | + //备案重量 | ||
20 | + private String vo_weight = "2000"; | ||
21 | + //过卡重量 | ||
22 | + private String cross_weight= "2324"; | ||
23 | + //场站编号 | ||
24 | + private String areaID = "4604600000"; | ||
25 | + //通道编号 | ||
26 | + private String chnlNo = "4604601010"; | ||
27 | + //进出场类型I/E | ||
28 | + private String ie = "I"; | ||
29 | + //二维码 | ||
30 | + private String barcode = "613f5c"; | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + //进通道报文 | ||
35 | + private static String IMPORT_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + | ||
36 | + "<MSG>\n" + | ||
37 | + "\t<META>\n" + | ||
38 | + "\t\t<SNDR>KAO</SNDR>\n" + | ||
39 | + "\t\t<RCVR/>\n" + | ||
40 | + "\t\t<SEQN>20220624063157</SEQN>\n" + | ||
41 | + "\t\t<DDTM>20220624063157</DDTM>\n" + | ||
42 | + "\t\t<TYPE>KAKO</TYPE>\n" + | ||
43 | + "\t\t<STYP>CARM</STYP>\n" + | ||
44 | + "\t</META>\n" + | ||
45 | + "\t<GATHER_INFO AREA_ID=\"${areaID}\" CHNL_NO=\"${chnlNo}\" I_E_TYPE=\"${IETYPE}\" SEQ_NO=\"20220624063118000004\">\n" + | ||
46 | + "\t\t<IC>\n" + | ||
47 | + "\t\t\t<DR_IC_NO/>\n" + | ||
48 | + "\t\t\t<IC_DR_CUSTOMS_NO/>\n" + | ||
49 | + "\t\t\t<IC_CO_CUSTOMS_NO/>\n" + | ||
50 | + "\t\t\t<IC_BILL_NO/>\n" + | ||
51 | + "\t\t\t<IC_FORM_TYPE/>\n" + | ||
52 | + "\t\t\t<IC_GROSS_WT/>\n" + | ||
53 | + "\t\t\t<IC_VE_CUSTOMS_NO/>\n" + | ||
54 | + "\t\t\t<IC_VE_NAME/>\n" + | ||
55 | + "\t\t\t<IC_CONTA_ID/>\n" + | ||
56 | + "\t\t\t<IC_ESEAL_ID/>\n" + | ||
57 | + "\t\t\t<IC_REG_DATETIME/>\n" + | ||
58 | + "\t\t\t<IC_PER_DAY_DUE/>\n" + | ||
59 | + "\t\t\t<GPS_ID/>\n" + | ||
60 | + "\t\t</IC>\n" + | ||
61 | + "\t\t<WEIGHT>\n" + | ||
62 | + "\t\t\t<GROSS_WT>${cross_weight}</GROSS_WT>\n" + | ||
63 | + "\t\t</WEIGHT>\n" + | ||
64 | + "\t\t<CAR>\n" + | ||
65 | + "\t\t\t<VE_NAME>${car}</VE_NAME>\n" + | ||
66 | + "\t\t\t<CAR_EC_NO/>\n" + | ||
67 | + "\t\t\t<CAR_EC_NO2/>\n" + | ||
68 | + "\t\t\t<VE_CUSTOMS_NO/>\n" + | ||
69 | + "\t\t\t<VE_WT/>\n" + | ||
70 | + "\t\t</CAR>\n" + | ||
71 | + "\t\t<CONTA>\n" + | ||
72 | + "\t\t\t<CONTA_NUM/>\n" + | ||
73 | + "\t\t\t<CONTA_RECO>1</CONTA_RECO>\n" + | ||
74 | + "\t\t\t<CONTA_ID_F/>\n" + | ||
75 | + "\t\t\t<CONTA_ID_B/>\n" + | ||
76 | + "\t\t\t<CONTA_MODEL_F/>\n" + | ||
77 | + "\t\t\t<CONTA_MODEL_B/>\n" + | ||
78 | + "\t\t</CONTA>\n" + | ||
79 | + "\t\t<ORDER_NUM/>\n" + | ||
80 | + "\t\t<BAR_CODE>${barcode}</BAR_CODE>\n" + | ||
81 | + "\t\t<SEAL>\n" + | ||
82 | + "\t\t\t<ESEAL_ID/>\n" + | ||
83 | + "\t\t\t<SEAL_KEY/>\n" + | ||
84 | + "\t\t</SEAL>\n" + | ||
85 | + "\t</GATHER_INFO>\n" + | ||
86 | + "</MSG>"; | ||
87 | + | ||
88 | + /** | ||
89 | + * 出口送货_进场测试 | ||
90 | + */ | ||
91 | + @Test | ||
92 | + public void exportDownload_I(){ | ||
93 | + logger.error("开始进场测试"); | ||
94 | + IMPORT_XML= IMPORT_XML.replace("${car}",voNo) | ||
95 | + .replace("${cross_weight}",cross_weight) | ||
96 | + .replace("${areaID}",areaID) | ||
97 | + .replace("${chnlNo}",chnlNo) | ||
98 | + .replace("${IETYPE}",ie) | ||
99 | + .replace("${barcode}",barcode); | ||
100 | + //进港提货测试 | ||
101 | + AnalysisRoute.analysis(IMPORT_XML); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 出口送货_出场测试 | ||
106 | + */ | ||
107 | + @Test | ||
108 | + public void exportDownload_E(){ | ||
109 | + | ||
110 | + //车牌号 | ||
111 | + String voNo = "豫A61CR7"; | ||
112 | + //备案重量 | ||
113 | + String vo_weight = "2000"; | ||
114 | + //过卡重量 | ||
115 | + String cross_weight= "2324"; | ||
116 | + //场站编号 | ||
117 | + String areaID = "4604600000"; | ||
118 | + //通道编号 | ||
119 | + String chnlNo = "4604600011"; | ||
120 | + //进出场类型I/E | ||
121 | + String ie = "E"; | ||
122 | + //二维码 | ||
123 | + String barcode = "613f5c"; | ||
124 | + logger.error("开始出口送货离场测试"); | ||
125 | + IMPORT_XML= IMPORT_XML.replace("${car}",voNo) | ||
126 | + .replace("${cross_weight}",cross_weight) | ||
127 | + .replace("${areaID}",areaID) | ||
128 | + .replace("${chnlNo}",chnlNo) | ||
129 | + .replace("${IETYPE}",ie) | ||
130 | + .replace("${barcode}",barcode); | ||
131 | + //进港提货测试 | ||
132 | + AnalysisRoute.analysis(IMPORT_XML); | ||
133 | + } | ||
134 | + | ||
135 | + | ||
136 | +} |
1 | +package com.sy.service.impl; | ||
2 | + | ||
3 | +import com.sy.logic.LiftBar; | ||
4 | +import com.sy.service.ResMessageService; | ||
5 | +import com.sy.service.WeightCheckHandleService; | ||
6 | +import org.apache.log4j.Logger; | ||
7 | +import org.apache.log4j.PropertyConfigurator; | ||
8 | +import org.junit.jupiter.api.Test; | ||
9 | +import org.junit.runner.RunWith; | ||
10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
11 | +import org.springframework.boot.test.context.SpringBootTest; | ||
12 | +import org.springframework.test.context.junit4.SpringRunner; | ||
13 | + | ||
14 | +import static org.junit.jupiter.api.Assertions.*; | ||
15 | + | ||
16 | +@RunWith(SpringRunner.class) | ||
17 | +@SpringBootTest | ||
18 | +class ResMessageServiceImplTest { | ||
19 | + private static final Logger logger = Logger.getLogger(LiftBar.class); | ||
20 | + | ||
21 | + @Autowired | ||
22 | + WeightCheckHandleService weightCheckHandleService; | ||
23 | + | ||
24 | + //查询运单放行表 | ||
25 | + @Autowired | ||
26 | + private ResMessageService resMessageService; | ||
27 | + | ||
28 | + @Test | ||
29 | + void checkManifestRelease() { | ||
30 | + boolean re = resMessageService.checkManifestRelease("157-55140831,157-55140853,157-55140724,157-76344026"); | ||
31 | + logger.info("结果:"+re); | ||
32 | + } | ||
33 | +} |
-
请 注册 或 登录 后发表评论