正在显示
6 个修改的文件
包含
470 行增加
和
21 行删除
1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
2 | 2 | ||
3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
6 | + | ||
7 | +import java.util.regex.Matcher; | ||
8 | +import java.util.regex.Pattern; | ||
9 | + | ||
3 | /** | 10 | /** |
4 | * 电子运单主运单 | 11 | * 电子运单主运单 |
5 | * @author mrz | 12 | * @author mrz |
6 | * @date 2023-05-30 | 13 | * @date 2023-05-30 |
7 | * | 14 | * |
8 | */ | 15 | */ |
9 | -public class FWB { | 16 | +public class FWB extends BASE implements FWB_BASE { |
10 | /** | 17 | /** |
11 | * 版本号 | 18 | * 版本号 |
12 | * 默认16 | 19 | * 默认16 |
@@ -14,35 +21,36 @@ public class FWB { | @@ -14,35 +21,36 @@ public class FWB { | ||
14 | public String ver = "16"; | 21 | public String ver = "16"; |
15 | /** | 22 | /** |
16 | * 主运单格式 | 23 | * 主运单格式 |
24 | + * [0-9]{3}-[0-9]{8} | ||
17 | */ | 25 | */ |
18 | - private String waybillNum; | 26 | + private String waybillNum = ""; |
19 | /** | 27 | /** |
20 | * 运单起始站 | 28 | * 运单起始站 |
21 | */ | 29 | */ |
22 | - private String origin; | 30 | + private String origin = ""; |
23 | /** | 31 | /** |
24 | * 运单目的站 | 32 | * 运单目的站 |
25 | */ | 33 | */ |
26 | - private String destination; | 34 | + private String destination = ""; |
27 | /** | 35 | /** |
28 | * 运单总件数 | 36 | * 运单总件数 |
29 | * number of pieces | 37 | * number of pieces |
30 | */ | 38 | */ |
31 | - private String quantity_picecs; | 39 | + private String quantity_picecs = ""; |
32 | /** | 40 | /** |
33 | * 运单毛重,运单的实际称重 | 41 | * 运单毛重,运单的实际称重 |
34 | */ | 42 | */ |
35 | - private String quantity_weight; | 43 | + private String quantity_weight = ""; |
36 | /** | 44 | /** |
37 | * 计重单位, | 45 | * 计重单位, |
38 | * K 代表KG 公斤 | 46 | * K 代表KG 公斤 |
39 | * L 代表公升 | 47 | * L 代表公升 |
40 | */ | 48 | */ |
41 | - private String quantity_weight_code; | 49 | + private String quantity_weight_code = ""; |
42 | /** | 50 | /** |
43 | * 体积 | 51 | * 体积 |
44 | */ | 52 | */ |
45 | - private String quantity_volume; | 53 | + private String quantity_volume = ""; |
46 | /** | 54 | /** |
47 | * 体积单位 | 55 | * 体积单位 |
48 | * MC 代表 立方米 Cubic Metres | 56 | * MC 代表 立方米 Cubic Metres |
@@ -50,19 +58,199 @@ public class FWB { | @@ -50,19 +58,199 @@ public class FWB { | ||
50 | * CF 代表 立方英尺 Cubic Feet | 58 | * CF 代表 立方英尺 Cubic Feet |
51 | * CI 代表 立方英寸 Cubic Inches | 59 | * CI 代表 立方英寸 Cubic Inches |
52 | */ | 60 | */ |
53 | - private String quantity_volume_code; | 61 | + private String quantity_volume_code = ""; |
54 | /** | 62 | /** |
55 | * 密度 | 63 | * 密度 |
56 | * 可选节点 | 64 | * 可选节点 |
57 | */ | 65 | */ |
58 | - private String quantity_density ; | 66 | + private String quantity_density = ""; |
59 | /** | 67 | /** |
60 | * 密度 | 68 | * 密度 |
61 | * 可选节点 | 69 | * 可选节点 |
62 | */ | 70 | */ |
63 | private String quantity_density_code = "DG"; | 71 | private String quantity_density_code = "DG"; |
64 | 72 | ||
73 | + public String getWaybillNum() throws FWBException { | ||
74 | + | ||
75 | + String patternStr = "^[0-9]{3}-[0-9]{8}$"; | ||
76 | + Pattern pattern = Pattern.compile(patternStr); | ||
77 | + Matcher matcher = pattern.matcher(waybillNum); | ||
78 | + if (!matcher.find()){ | ||
79 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_ERR); | ||
80 | + } | ||
81 | + | ||
82 | + String serialNumber = waybillNum.split("-")[1]; | ||
83 | + Integer serialNumber7 = Integer.valueOf(serialNumber.substring(0,7)) ; | ||
84 | + Integer serialNumberEnd = Integer.valueOf(serialNumber.substring(7)); | ||
85 | + | ||
86 | + //模七校验 | ||
87 | + if ((serialNumber7%7) != serialNumberEnd){ | ||
88 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_REGX_ERR); | ||
89 | + } | ||
90 | + | ||
91 | + return waybillNum; | ||
92 | + } | ||
93 | + | ||
94 | + public void setWaybillNum(String waybillNum) { | ||
95 | + this.waybillNum = waybillNum; | ||
96 | + } | ||
97 | + | ||
98 | + public String getOrigin() throws FWBException { | ||
99 | + String patternStr = "^[A-Z]{3}$"; | ||
100 | + Pattern pattern = Pattern.compile(patternStr); | ||
101 | + Matcher matcher = pattern.matcher(origin); | ||
102 | + if (!matcher.find()){ | ||
103 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_ORGN_ERR); | ||
104 | + } | ||
105 | + return origin; | ||
106 | + } | ||
107 | + | ||
108 | + public void setOrigin(String origin) { | ||
109 | + this.origin = origin; | ||
110 | + } | ||
111 | + | ||
112 | + public String getDestination() throws FWBException { | ||
113 | + String patternStr = "^[A-Z]{3}$"; | ||
114 | + Pattern pattern = Pattern.compile(patternStr); | ||
115 | + Matcher matcher = pattern.matcher(origin); | ||
116 | + if (!matcher.find()){ | ||
117 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_DES_ERR); | ||
118 | + } | ||
119 | + return destination; | ||
120 | + } | ||
121 | + | ||
122 | + public void setDestination(String destination) { | ||
123 | + this.destination = destination; | ||
124 | + } | ||
125 | + | ||
126 | + public String getQuantity_picecs() throws FWBException { | ||
127 | + | ||
128 | + String patternStr = "^[0-9]{1,4}$"; | ||
129 | + Pattern pattern = Pattern.compile(patternStr); | ||
130 | + Matcher matcher = pattern.matcher(quantity_picecs); | ||
131 | + if (!matcher.find()){ | ||
132 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_PCE_ERR); | ||
133 | + } | ||
134 | + return quantity_picecs; | ||
135 | + } | ||
136 | + | ||
137 | + public void setQuantity_picecs(String quantity_picecs) { | ||
138 | + this.quantity_picecs = quantity_picecs; | ||
139 | + } | ||
140 | + | ||
141 | + public String getQuantity_weight() throws FWBException { | ||
142 | + | ||
143 | + String patternStr = "^[1-9][0-9\\.]{1,6}$"; | ||
144 | + Pattern pattern = Pattern.compile(patternStr); | ||
145 | + Matcher matcher = pattern.matcher(quantity_weight); | ||
146 | + if (!matcher.find()){ | ||
147 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_WGT_ERR); | ||
148 | + } | ||
149 | + return quantity_weight; | ||
150 | + } | ||
151 | + | ||
152 | + public void setQuantity_weight(String quantity_weight) { | ||
153 | + this.quantity_weight = quantity_weight; | ||
154 | + } | ||
155 | + | ||
156 | + public String getQuantity_weight_code() throws FWBException { | ||
157 | + | ||
158 | + String patternStr = "^[KL]$"; | ||
159 | + Pattern pattern = Pattern.compile(patternStr); | ||
160 | + Matcher matcher = pattern.matcher(quantity_weight_code); | ||
161 | + if (!matcher.find()){ | ||
162 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_WGT_CODE_ERR); | ||
163 | + } | ||
164 | + | ||
165 | + return quantity_weight_code; | ||
166 | + } | ||
167 | + | ||
168 | + public void setQuantity_weight_code(String quantity_weight_code) { | ||
169 | + this.quantity_weight_code = quantity_weight_code; | ||
170 | + } | ||
171 | + | ||
172 | + public String getQuantity_volume() throws FWBException { | ||
173 | + | ||
174 | + if (hasText(quantity_volume)){ | ||
175 | + String patternStr = "^[1-9][0-9\\.]{0,8}$"; | ||
176 | + Pattern pattern = Pattern.compile(patternStr); | ||
177 | + Matcher matcher = pattern.matcher(quantity_volume); | ||
178 | + if (!matcher.find()){ | ||
179 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_VOL_ERR); | ||
180 | + } | ||
181 | + } | ||
182 | + | ||
183 | + return quantity_volume; | ||
184 | + } | ||
185 | + | ||
186 | + public void setQuantity_volume(String quantity_volume) { | ||
187 | + this.quantity_volume = quantity_volume; | ||
188 | + } | ||
189 | + | ||
190 | + public String getQuantity_volume_code() throws FWBException { | ||
191 | + String patternStr = "^MC|CC|CI|CF$"; | ||
192 | + Pattern pattern = Pattern.compile(patternStr); | ||
193 | + Matcher matcher = pattern.matcher(quantity_volume_code); | ||
194 | + if (!matcher.find()){ | ||
195 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_VOL_CODE_ERR); | ||
196 | + } | ||
197 | + return quantity_volume_code; | ||
198 | + } | ||
199 | + | ||
200 | + public void setQuantity_volume_code(String quantity_volume_code) { | ||
201 | + this.quantity_volume_code = quantity_volume_code; | ||
202 | + } | ||
203 | + | ||
204 | + public String getQuantity_density() throws FWBException { | ||
205 | + String patternStr = "^[1-9]?[0-9]?$"; | ||
206 | + Pattern pattern = Pattern.compile(patternStr); | ||
207 | + Matcher matcher = pattern.matcher(quantity_density); | ||
208 | + if (!matcher.find()){ | ||
209 | + throw new FWBException(FWBExceptionType.FWB_WAYBILL_DG_ERR); | ||
210 | + } | ||
211 | + return quantity_density; | ||
212 | + } | ||
213 | + | ||
214 | + public void setQuantity_density(String quantity_density) { | ||
215 | + this.quantity_density = quantity_density; | ||
216 | + } | ||
217 | + | ||
218 | + public String getQuantity_density_code() { | ||
219 | + return quantity_density_code; | ||
220 | + } | ||
221 | + | ||
222 | + public void setQuantity_density_code(String quantity_density_code) { | ||
223 | + this.quantity_density_code = quantity_density_code; | ||
224 | + } | ||
225 | + | ||
226 | + @Override | ||
227 | + public String getFWBNodeText() throws FWBException { | ||
228 | + | ||
229 | + String SPLIT_CODE = "/"; | ||
230 | + String CRLF = "\n"; | ||
231 | + StringBuilder sb = new StringBuilder(""); | ||
232 | + | ||
233 | + sb.append(getWaybillNum()).append(getOrigin()).append(getDestination()) | ||
234 | + .append(SPLIT_CODE).append("T").append(getQuantity_picecs()) | ||
235 | + .append(getQuantity_weight_code()).append(getQuantity_weight()); | ||
236 | + | ||
237 | + if (hasText(getQuantity_volume())){ | ||
238 | + sb.append(getQuantity_volume_code()).append(getQuantity_volume()); | ||
239 | + } | ||
240 | + | ||
241 | + if (hasText(getQuantity_density())){ | ||
242 | + sb.append(getQuantity_density_code()).append(getQuantity_density()); | ||
243 | + } | ||
244 | + | ||
245 | + | ||
65 | 246 | ||
247 | + sb.append(CRLF); | ||
66 | 248 | ||
249 | + return sb.toString(); | ||
250 | + } | ||
67 | 251 | ||
252 | + @Override | ||
253 | + public String getNodeName() { | ||
254 | + return "FWB/"+ver+"\n"; | ||
255 | + } | ||
68 | } | 256 | } |
1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
2 | 2 | ||
3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
6 | + | ||
7 | +import java.util.regex.Matcher; | ||
8 | +import java.util.regex.Pattern; | ||
9 | + | ||
3 | /** | 10 | /** |
4 | * Flight Bookings | 11 | * Flight Bookings |
5 | * FLT | 12 | * FLT |
6 | * 运单航程航班 | 13 | * 运单航程航班 |
14 | + * O 可选节点 | ||
15 | + * 可重复最多两次 | ||
7 | */ | 16 | */ |
8 | -public class FWB_FLT { | 17 | +public class FWB_FLT extends BASE implements FWB_BASE { |
9 | /** | 18 | /** |
10 | * 承运人代码 mm | 19 | * 承运人代码 mm |
11 | - * [A-Z]{2} | 20 | + * [A-Z0-9]{2} |
12 | */ | 21 | */ |
13 | - private String cariier; | 22 | + private String cariier = ""; |
14 | /** | 23 | /** |
15 | * 航班号 nnn(n)(a) | 24 | * 航班号 nnn(n)(a) |
16 | * [0-9]{3}\d?[A-Z0-9]? | 25 | * [0-9]{3}\d?[A-Z0-9]? |
17 | */ | 26 | */ |
18 | - private String flightNumber; | 27 | + private String flightNumber = ""; |
19 | /** | 28 | /** |
20 | * 航班日期 - 按日标识 | 29 | * 航班日期 - 按日标识 |
21 | * [0-9]{2} | 30 | * [0-9]{2} |
22 | */ | 31 | */ |
23 | - private String day; | 32 | + private String day = ""; |
33 | + | ||
34 | + public String getCariier() throws FWBException { | ||
35 | + String patternStr = "^[A-Z0-9]{0,2}$"; | ||
36 | + Pattern pattern = Pattern.compile(patternStr); | ||
37 | + Matcher matcher = pattern.matcher(cariier); | ||
38 | + if (!matcher.find()){ | ||
39 | + throw new FWBException(FWBExceptionType.FWB_FLT_CARRIER_ERR); | ||
40 | + } | ||
41 | + return cariier; | ||
42 | + } | ||
43 | + | ||
44 | + public void setCariier(String cariier) { | ||
45 | + this.cariier = cariier; | ||
46 | + } | ||
47 | + | ||
48 | + public String getFlightNumber() throws FWBException { | ||
49 | + String patternStr = "^[0-9]{3}\\d?[A-Z0-9]?$"; | ||
50 | + Pattern pattern = Pattern.compile(patternStr); | ||
51 | + Matcher matcher = pattern.matcher(flightNumber); | ||
52 | + if (!matcher.find()){ | ||
53 | + throw new FWBException(FWBExceptionType.FWB_FLT_NUMBER_ERR); | ||
54 | + } | ||
55 | + | ||
56 | + return flightNumber; | ||
57 | + } | ||
58 | + | ||
59 | + public void setFlightNumber(String flightNumber) { | ||
60 | + this.flightNumber = flightNumber; | ||
61 | + } | ||
62 | + | ||
63 | + public String getDay() throws FWBException { | ||
64 | + String patternStr = "^[0-9]{2}$"; | ||
65 | + Pattern pattern = Pattern.compile(patternStr); | ||
66 | + Matcher matcher = pattern.matcher(day); | ||
67 | + if (!matcher.find() || Integer.parseInt(day) > 31){ | ||
68 | + throw new FWBException(FWBExceptionType.FWB_FLT_DAY_ERR); | ||
69 | + } | ||
70 | + | ||
71 | + return day; | ||
72 | + } | ||
73 | + | ||
74 | + public void setDay(String day) { | ||
75 | + this.day = day; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + public String getFWBNodeText() throws FWBException { | ||
80 | + String SPLIT_CODE = "/"; | ||
81 | + String CRLF = "\n"; | ||
82 | + StringBuilder sb = new StringBuilder(""); | ||
83 | + | ||
84 | + if (hasText(cariier) || hasText(flightNumber) || hasText(day)){ | ||
85 | + sb.append(SPLIT_CODE).append(getCariier()).append(getFlightNumber()).append(SPLIT_CODE).append(getDay()); | ||
86 | + } | ||
87 | + | ||
88 | + //todo:此节点循环的报文内容获取方式 | ||
89 | + | ||
90 | +// sb.append(CRLF); | ||
91 | + | ||
92 | + return sb.toString(); | ||
93 | + } | ||
24 | 94 | ||
95 | + @Override | ||
96 | + public String getNodeName() { | ||
97 | + return "FLT"; | ||
98 | + } | ||
25 | } | 99 | } |
1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
2 | 2 | ||
3 | +import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; | ||
4 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
6 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
7 | + | ||
8 | +import java.util.regex.Matcher; | ||
9 | +import java.util.regex.Pattern; | ||
10 | + | ||
3 | /** | 11 | /** |
4 | * Flight Bookings | 12 | * Flight Bookings |
5 | * Routing | 13 | * Routing |
6 | * RTG | 14 | * RTG |
7 | * 运单航程目的地承运人 | 15 | * 运单航程目的地承运人 |
8 | */ | 16 | */ |
9 | -public class FWB_RTG { | 17 | +public class FWB_RTG extends BASE implements FWB_BASE { |
10 | /** | 18 | /** |
11 | * 首程目的站 | 19 | * 首程目的站 |
12 | * [A-Z]{3} | 20 | * [A-Z]{3} |
@@ -22,10 +30,98 @@ public class FWB_RTG { | @@ -22,10 +30,98 @@ public class FWB_RTG { | ||
22 | * 下一航程起始航站 | 30 | * 下一航程起始航站 |
23 | * 可选节点 | 31 | * 可选节点 |
24 | * 下一航程节点最多可重复两次,结合首程一共三个航程 | 32 | * 下一航程节点最多可重复两次,结合首程一共三个航程 |
33 | + * Onward 部分最多可以出现2次 | ||
25 | */ | 34 | */ |
26 | private String onwardAirport; | 35 | private String onwardAirport; |
27 | /** | 36 | /** |
28 | * 下一航程起始航站承运人 | 37 | * 下一航程起始航站承运人 |
29 | */ | 38 | */ |
30 | private String onwardCarrier; | 39 | private String onwardCarrier; |
40 | + | ||
41 | + public String getDestinationAirport() throws FWBException { | ||
42 | + | ||
43 | + String patternStr = "^[A-Z]{3}$"; | ||
44 | + Pattern pattern = Pattern.compile(patternStr); | ||
45 | + Matcher matcher = pattern.matcher(destinationAirport); | ||
46 | + if (!matcher.find()){ | ||
47 | + throw new FWBException(FWBExceptionType.FWB_RTG_AIRPORT_ERR); | ||
48 | + } | ||
49 | + return destinationAirport; | ||
50 | + } | ||
51 | + | ||
52 | + public void setDestinationAirport(String destinationAirport) { | ||
53 | + this.destinationAirport = destinationAirport; | ||
54 | + } | ||
55 | + | ||
56 | + public String getDestinationCarrier() throws FWBException { | ||
57 | + String patternStr = "^[A-Z0-9]{0,2}$"; | ||
58 | + Pattern pattern = Pattern.compile(patternStr); | ||
59 | + Matcher matcher = pattern.matcher(destinationCarrier); | ||
60 | + if (!matcher.find()){ | ||
61 | + throw new FWBException(FWBExceptionType.FWB_RTG_CARRIER_ERR); | ||
62 | + } | ||
63 | + return destinationCarrier; | ||
64 | + } | ||
65 | + | ||
66 | + public void setDestinationCarrier(String destinationCarrier) { | ||
67 | + this.destinationCarrier = destinationCarrier; | ||
68 | + } | ||
69 | + | ||
70 | + public String getOnwardAirport() throws FWBException { | ||
71 | + String patternStr = "^[A-Z]{3}$"; | ||
72 | + Pattern pattern = Pattern.compile(patternStr); | ||
73 | + Matcher matcher = pattern.matcher(onwardAirport); | ||
74 | + if (!matcher.find()){ | ||
75 | + throw new FWBException(FWBExceptionType.FWB_RTG_AIRPORT_ERR); | ||
76 | + } | ||
77 | + return onwardAirport; | ||
78 | + } | ||
79 | + | ||
80 | + public void setOnwardAirport(String onwardAirport) { | ||
81 | + this.onwardAirport = onwardAirport; | ||
82 | + } | ||
83 | + | ||
84 | + public String getOnwardCarrier() throws FWBException { | ||
85 | + String patternStr = "^[A-Z0-9]{0,2}$"; | ||
86 | + Pattern pattern = Pattern.compile(patternStr); | ||
87 | + Matcher matcher = pattern.matcher(onwardCarrier); | ||
88 | + if (!matcher.find()){ | ||
89 | + throw new FWBException(FWBExceptionType.FWB_RTG_CARRIER_ERR); | ||
90 | + } | ||
91 | + return onwardCarrier; | ||
92 | + } | ||
93 | + | ||
94 | + public void setOnwardCarrier(String onwardCarrier) { | ||
95 | + this.onwardCarrier = onwardCarrier; | ||
96 | + } | ||
97 | + | ||
98 | + | ||
99 | + @Override | ||
100 | + public String getFWBNodeText() throws FWBException { | ||
101 | + String SPLIT_CODE = "/"; | ||
102 | + String CRLF = "\n"; | ||
103 | + StringBuilder sb = new StringBuilder(""); | ||
104 | + sb.append(SPLIT_CODE); | ||
105 | + if (hasText(destinationAirport)) { | ||
106 | + sb.append(getDestinationAirport()); | ||
107 | + } | ||
108 | + sb.append(getDestinationCarrier()); | ||
109 | + if (hasText(onwardAirport)) { | ||
110 | + sb.append(SPLIT_CODE).append(getOnwardAirport()); | ||
111 | + } | ||
112 | + if (hasText(onwardCarrier) ){ | ||
113 | + sb.append(getOnwardCarrier()); | ||
114 | + } | ||
115 | + | ||
116 | + //todo:此节点循环的报文内容获取方式 | ||
117 | + | ||
118 | +// sb.append(CRLF); | ||
119 | + | ||
120 | + return sb.toString(); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public String getNodeName() { | ||
125 | + return "RTG"; | ||
126 | + } | ||
31 | } | 127 | } |
@@ -7,6 +7,32 @@ package com.sunyo.wlpt.base.model.efreight.fwb.exception; | @@ -7,6 +7,32 @@ package com.sunyo.wlpt.base.model.efreight.fwb.exception; | ||
7 | */ | 7 | */ |
8 | 8 | ||
9 | public enum FWBExceptionType { | 9 | public enum FWBExceptionType { |
10 | + | ||
11 | + /** | ||
12 | + * 运单号格式验证错误 | ||
13 | + */ | ||
14 | + FWB_WAYBILL_ERR("21","运单格式错误,格式须为 [0-9]{3}-[0-9]{8}"), | ||
15 | + /** | ||
16 | + * 运单号模七验证错误 | ||
17 | + */ | ||
18 | + FWB_WAYBILL_REGX_ERR("211","运单不符合模七校验"), | ||
19 | + FWB_WAYBILL_ORGN_ERR("221","运单起始地格式错误"), | ||
20 | + FWB_WAYBILL_DES_ERR("222","运单目的地格式错误"), | ||
21 | + FWB_WAYBILL_PCE_ERR("233","运单件数信息错误"), | ||
22 | + FWB_WAYBILL_WGT_CODE_ERR("234","运单重量单位信息错误"), | ||
23 | + FWB_WAYBILL_WGT_ERR("235","运单重量信息错误"), | ||
24 | + FWB_WAYBILL_VOL_CODE_ERR("241","运单体积单位信息错误"), | ||
25 | + FWB_WAYBILL_VOL_ERR("242","运单体积 信息错误"), | ||
26 | + FWB_WAYBILL_DG_ERR("252","运单密度信息错误"), | ||
27 | + | ||
28 | + FWB_FLT_CARRIER_ERR("322","承运人信息错误"), | ||
29 | + FWB_FLT_NUMBER_ERR("323","航班号信息错误"), | ||
30 | + FWB_FLT_DAY_ERR("325","航班日期信息错误,格式为应为[0-9]{2}"), | ||
31 | + | ||
32 | + FWB_RTG_AIRPORT_ERR("422","涉及航站信息有误"), | ||
33 | + FWB_RTG_CARRIER_ERR("422","涉及承运人信息有误"), | ||
34 | + | ||
35 | + | ||
10 | REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"), | 36 | REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"), |
11 | REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"), | 37 | REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"), |
12 | REF_SPID_REGEX_FAILD("206", "REF- Sender Participant Idenfitication RegEx Faild,缺少关联节点信息"), | 38 | REF_SPID_REGEX_FAILD("206", "REF- Sender Participant Idenfitication RegEx Faild,缺少关联节点信息"), |
@@ -14,11 +40,12 @@ public enum FWBExceptionType { | @@ -14,11 +40,12 @@ public enum FWBExceptionType { | ||
14 | OCI_CSRC_ERROR("297", "缺少 Other Customs,Security And Regulatory Control Information Identifier"); | 40 | OCI_CSRC_ERROR("297", "缺少 Other Customs,Security And Regulatory Control Information Identifier"); |
15 | 41 | ||
16 | /** | 42 | /** |
17 | - * 响应业务状态 | 43 | + * 参照字典FWB节点位置 |
44 | + * 如21 为 第二章 第一部分 211 为 第二章 第一部分 第一节 | ||
18 | */ | 45 | */ |
19 | private String code; | 46 | private String code; |
20 | /** | 47 | /** |
21 | - * 响应消息 | 48 | + * 错误信息描述 |
22 | */ | 49 | */ |
23 | private String msg; | 50 | private String msg; |
24 | 51 |
1 | -import com.sunyo.wlpt.base.model.efreight.fwb.FWB_OCI; | ||
2 | -import com.sunyo.wlpt.base.model.efreight.fwb.FWB_REF; | 1 | +import com.sunyo.wlpt.base.model.efreight.fwb.*; |
3 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 2 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
4 | 3 | ||
5 | public class FWBTest { | 4 | public class FWBTest { |
6 | 5 | ||
7 | public static void main(String[] args) { | 6 | public static void main(String[] args) { |
8 | 7 | ||
8 | + FWB_WAYBILL_TEST(); | ||
9 | +// FWB_FLT_TEST(); | ||
10 | + FWB_RTG_TEST(); | ||
9 | REF_TEST(); | 11 | REF_TEST(); |
10 | 12 | ||
11 | // OCI_TEST(); | 13 | // OCI_TEST(); |
@@ -36,10 +38,61 @@ public class FWBTest { | @@ -36,10 +38,61 @@ public class FWBTest { | ||
36 | fwb_ref.setRef_participant_airport("CGO"); | 38 | fwb_ref.setRef_participant_airport("CGO"); |
37 | 39 | ||
38 | try { | 40 | try { |
39 | - String oci = fwb_ref.getFWBNodeText(); | 41 | + String oci = fwb_ref.getNodeName() + fwb_ref.getFWBNodeText(); |
40 | System.out.println(oci); | 42 | System.out.println(oci); |
41 | } catch (FWBException e) { | 43 | } catch (FWBException e) { |
42 | e.printStackTrace(); | 44 | e.printStackTrace(); |
43 | } | 45 | } |
44 | } | 46 | } |
47 | + | ||
48 | + static String FWB_WAYBILL_TEST(){ | ||
49 | + FWB fwb = new FWB(); | ||
50 | + fwb.setWaybillNum("804-31118393"); | ||
51 | + fwb.setOrigin("CGO"); | ||
52 | + fwb.setDestination("ICN"); | ||
53 | + fwb.setQuantity_picecs("1"); | ||
54 | + fwb.setQuantity_weight("102.22"); | ||
55 | + fwb.setQuantity_weight_code("L"); | ||
56 | + fwb.setQuantity_volume("20.22"); | ||
57 | + fwb.setQuantity_volume_code("MC"); | ||
58 | + fwb.setQuantity_density("22"); | ||
59 | + try { | ||
60 | + fwb.getWaybillNum(); | ||
61 | + String nodeText = fwb.getNodeName() + fwb.getFWBNodeText(); | ||
62 | +// System.out.println(nodeText); | ||
63 | + return nodeText; | ||
64 | + } catch (FWBException e) { | ||
65 | + e.printStackTrace(); | ||
66 | + } | ||
67 | + return ""; | ||
68 | + } | ||
69 | + | ||
70 | + static void FWB_FLT_TEST(){ | ||
71 | + FWB_FLT flt = new FWB_FLT(); | ||
72 | + flt.setCariier("CV"); | ||
73 | + flt.setFlightNumber("732"); | ||
74 | + flt.setDay("29"); | ||
75 | + | ||
76 | + try { | ||
77 | + String nodeText = flt.getNodeName() + flt.getFWBNodeText() + "\n"; | ||
78 | + System.out.println(FWB_WAYBILL_TEST()+nodeText); | ||
79 | + } catch (FWBException e) { | ||
80 | + e.printStackTrace(); | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
84 | + static void FWB_RTG_TEST(){ | ||
85 | + FWB_RTG var = new FWB_RTG(); | ||
86 | +// var.setDestinationAirport("ICN"); | ||
87 | + var.setDestinationCarrier("F5"); | ||
88 | + var.setOnwardAirport("SIN"); | ||
89 | +// var.setOnwardCarrier("K9"); | ||
90 | + | ||
91 | + try { | ||
92 | + String nodeText = var.getNodeName() + var.getFWBNodeText() + "\n"; | ||
93 | + System.out.println(FWB_WAYBILL_TEST()+nodeText); | ||
94 | + } catch (FWBException e) { | ||
95 | + e.printStackTrace(); | ||
96 | + } | ||
97 | + } | ||
45 | } | 98 | } |
-
请 注册 或 登录 后发表评论