正在显示
20 个修改的文件
包含
811 行增加
和
442 行删除
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; | 3 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
5 | -import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
6 | 4 | ||
7 | -import java.util.regex.Matcher; | ||
8 | -import java.util.regex.Pattern; | 5 | +import java.util.List; |
6 | + | ||
7 | +public class FWB { | ||
8 | + public FWB_Bill bill; | ||
9 | + public FWB_FLT flt; | ||
10 | + public FWB_RTG rtg; | ||
11 | + public FWB_SHP shp; | ||
12 | + public FWB_CNE cne; | ||
13 | + public FWB_AGT agt; | ||
14 | + public FWB_SSR ssr; | ||
15 | + public FWB_NFY nfy; | ||
16 | + public List<FWB_ACC> acc; | ||
17 | + public FWB_CVD cvd; | ||
18 | + public FWB_RTD rtd; | ||
19 | + public FWB_OTH oth; | ||
20 | + public FWB_PPD ppd; | ||
21 | + public FWB_CER cer; | ||
22 | + public FWB_ISU isu; | ||
23 | + public List<FWB_OSI> osi; | ||
24 | + public FWB_REF ref; | ||
25 | + public List<FWB_OCI> oci; | ||
26 | + | ||
27 | + public String getFWBText(){ | ||
28 | + StringBuilder text = new StringBuilder(); | ||
29 | + try { | ||
30 | + text.append(bill.getNodeName()).append(bill.getFWBNodeText()) ; | ||
31 | + text.append(flt.getNodeName()).append(flt.getFWBNodeText()); | ||
32 | + text.append(rtg.getNodeName()).append(rtg.getFWBNodeText()); | ||
33 | + text.append(shp.getNodeName()).append(shp.getFWBNodeText()); | ||
34 | + text.append(cne.getNodeName()).append(cne.getFWBNodeText()); | ||
35 | + text.append(agt.getFWBNodeText()); | ||
36 | + text.append(ssr.getFWBNodeText()); | ||
37 | + text.append(nfy.getFWBNodeText()); | ||
38 | + | ||
39 | + if (acc!=null && !acc.isEmpty()){ | ||
40 | + for (int i = 0; i < acc.size(); i++) { | ||
41 | + if (i==0){ | ||
42 | + text.append(acc.get(i).getNodeName()); | ||
43 | + } | ||
44 | + text.append(acc.get(i).getFWBNodeText()); | ||
45 | + } | ||
9 | 46 | ||
10 | -/** | ||
11 | - * 电子运单主运单 | ||
12 | - * @author mrz | ||
13 | - * @date 2023-05-30 | ||
14 | - * | ||
15 | - */ | ||
16 | -public class FWB extends BASE implements FWB_BASE { | ||
17 | - /** | ||
18 | - * 版本号 | ||
19 | - * 默认16 | ||
20 | - */ | ||
21 | - public String ver = "16"; | ||
22 | - /** | ||
23 | - * 主运单格式 | ||
24 | - * [0-9]{3}-[0-9]{8} | ||
25 | - */ | ||
26 | - private String waybillNum = ""; | ||
27 | - /** | ||
28 | - * 运单起始站 | ||
29 | - */ | ||
30 | - private String origin = ""; | ||
31 | - /** | ||
32 | - * 运单目的站 | ||
33 | - */ | ||
34 | - private String destination = ""; | ||
35 | - /** | ||
36 | - * 运单总件数 | ||
37 | - * number of pieces | ||
38 | - */ | ||
39 | - private String quantity_picecs = ""; | ||
40 | - /** | ||
41 | - * 运单毛重,运单的实际称重 | ||
42 | - */ | ||
43 | - private String quantity_weight = ""; | ||
44 | - /** | ||
45 | - * 计重单位, | ||
46 | - * K 代表KG 公斤 | ||
47 | - * L 代表公升 | ||
48 | - */ | ||
49 | - private String quantity_weight_code = ""; | ||
50 | - /** | ||
51 | - * 体积 | ||
52 | - */ | ||
53 | - private String quantity_volume = ""; | ||
54 | - /** | ||
55 | - * 体积单位 | ||
56 | - * MC 代表 立方米 Cubic Metres | ||
57 | - * CC 代表 立方厘米 Cubic Centimeters | ||
58 | - * CF 代表 立方英尺 Cubic Feet | ||
59 | - * CI 代表 立方英寸 Cubic Inches | ||
60 | - */ | ||
61 | - private String quantity_volume_code = ""; | ||
62 | - /** | ||
63 | - * 密度 | ||
64 | - * 可选节点 | ||
65 | - */ | ||
66 | - private String quantity_density = ""; | ||
67 | - /** | ||
68 | - * 密度 | ||
69 | - * 可选节点 | ||
70 | - */ | ||
71 | - private String quantity_density_code = "DG"; | ||
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 = "^[0-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 | } | 47 | } |
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 | 48 | ||
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 | - } | 49 | + text.append(cvd.getFWBNodeText()); |
50 | + text.append(rtd.getFWBNodeText()); | ||
51 | + text.append(oth.getFWBNodeText()); | ||
52 | + text.append(ppd.getFWBNodeText()); | ||
53 | + text.append(cer.getFWBNodeText()); | ||
54 | + text.append(isu.getFWBNodeText()); | ||
55 | + | ||
56 | + if (osi!=null && !osi.isEmpty()){ | ||
57 | + for (int i = 0; i < osi.size(); i++) { | ||
58 | + if (i==0){ | ||
59 | + text.append(osi.get(i).getNodeName()); | ||
60 | + } | ||
61 | + text.append(osi.get(i).getFWBNodeText()); | ||
62 | + } | ||
213 | 63 | ||
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 { | 64 | + } |
228 | 65 | ||
229 | - String SPLIT_CODE = "/"; | ||
230 | - String CRLF = "\n"; | ||
231 | - StringBuilder sb = new StringBuilder(""); | 66 | + text.append(ref.getFWBNodeText()); |
232 | 67 | ||
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()); | 68 | + if (oci!=null && !oci.isEmpty()){ |
69 | + for (int i = 0; i < oci.size(); i++) { | ||
70 | + if (i==0){ | ||
71 | + text.append(oci.get(i).getNodeName()); | ||
72 | + } | ||
73 | + text.append(oci.get(i).getFWBNodeText()); | ||
74 | + } | ||
236 | 75 | ||
237 | - if (hasText(getQuantity_volume())){ | ||
238 | - sb.append(getQuantity_volume_code()).append(getQuantity_volume()); | ||
239 | - } | 76 | + } |
240 | 77 | ||
241 | - if (hasText(getQuantity_density())){ | ||
242 | - sb.append(getQuantity_density_code()).append(getQuantity_density()); | 78 | + return text.toString(); |
79 | + } catch (FWBException e) { | ||
80 | + e.printStackTrace(); | ||
243 | } | 81 | } |
244 | - | ||
245 | - | ||
246 | - | ||
247 | - sb.append(CRLF); | ||
248 | - | ||
249 | - return sb.toString(); | ||
250 | - } | ||
251 | - | ||
252 | - @Override | ||
253 | - public String getNodeName() { | ||
254 | - return "FWB/"+ver+"\n"; | 82 | + return ""; |
255 | } | 83 | } |
256 | } | 84 | } |
@@ -36,6 +36,14 @@ public class FWB_ACC extends BASE implements FWB_BASE { | @@ -36,6 +36,14 @@ public class FWB_ACC extends BASE implements FWB_BASE { | ||
36 | */ | 36 | */ |
37 | private String acc_info; | 37 | private String acc_info; |
38 | 38 | ||
39 | + public FWB_ACC() { | ||
40 | + } | ||
41 | + | ||
42 | + public FWB_ACC(String acc_info_id, String acc_info) { | ||
43 | + this.acc_info_id = acc_info_id; | ||
44 | + this.acc_info = acc_info; | ||
45 | + } | ||
46 | + | ||
39 | public String getAcc_info_id() throws FWBException { | 47 | public String getAcc_info_id() throws FWBException { |
40 | String patternStr = "^[A-Z]{3}$"; | 48 | String patternStr = "^[A-Z]{3}$"; |
41 | Pattern pattern = Pattern.compile(patternStr); | 49 | Pattern pattern = Pattern.compile(patternStr); |
@@ -72,7 +80,7 @@ public class FWB_ACC extends BASE implements FWB_BASE { | @@ -72,7 +80,7 @@ public class FWB_ACC extends BASE implements FWB_BASE { | ||
72 | StringBuilder sb = new StringBuilder(""); | 80 | StringBuilder sb = new StringBuilder(""); |
73 | 81 | ||
74 | if (hasText(acc_info) || hasText(acc_info_id)){ | 82 | if (hasText(acc_info) || hasText(acc_info_id)){ |
75 | - sb.append(getNodeName()).append(SPLIT_CODE); | 83 | + sb.append(SPLIT_CODE); |
76 | sb.append(getAcc_info_id()).append(SPLIT_CODE).append(getAcc_info()); | 84 | sb.append(getAcc_info_id()).append(SPLIT_CODE).append(getAcc_info()); |
77 | sb.append(CRLF); | 85 | sb.append(CRLF); |
78 | } | 86 | } |
1 | +package com.sunyo.wlpt.base.model.efreight.fwb; | ||
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 | + | ||
10 | +/** | ||
11 | + * 电子运单主运单 | ||
12 | + * @author mrz | ||
13 | + * @date 2023-05-30 | ||
14 | + * | ||
15 | + */ | ||
16 | +public class FWB_Bill extends BASE implements FWB_BASE { | ||
17 | + /** | ||
18 | + * 版本号 | ||
19 | + * 默认16 | ||
20 | + */ | ||
21 | + public String ver = "16"; | ||
22 | + /** | ||
23 | + * 主运单格式 | ||
24 | + * [0-9]{3}-[0-9]{8} | ||
25 | + */ | ||
26 | + private String waybillNum = ""; | ||
27 | + /** | ||
28 | + * 运单起始站 | ||
29 | + */ | ||
30 | + private String origin = ""; | ||
31 | + /** | ||
32 | + * 运单目的站 | ||
33 | + */ | ||
34 | + private String destination = ""; | ||
35 | + /** | ||
36 | + * 运单总件数 | ||
37 | + * number of pieces | ||
38 | + */ | ||
39 | + private String quantity_picecs = ""; | ||
40 | + /** | ||
41 | + * 运单毛重,运单的实际称重 | ||
42 | + */ | ||
43 | + private String quantity_weight = ""; | ||
44 | + /** | ||
45 | + * 计重单位, | ||
46 | + * K 代表KG 公斤 | ||
47 | + * L 代表公升 | ||
48 | + */ | ||
49 | + private String quantity_weight_code = ""; | ||
50 | + /** | ||
51 | + * 体积 | ||
52 | + */ | ||
53 | + private String quantity_volume = ""; | ||
54 | + /** | ||
55 | + * 体积单位 | ||
56 | + * MC 代表 立方米 Cubic Metres | ||
57 | + * CC 代表 立方厘米 Cubic Centimeters | ||
58 | + * CF 代表 立方英尺 Cubic Feet | ||
59 | + * CI 代表 立方英寸 Cubic Inches | ||
60 | + */ | ||
61 | + private String quantity_volume_code = ""; | ||
62 | + /** | ||
63 | + * 密度 | ||
64 | + * 可选节点 | ||
65 | + */ | ||
66 | + private String quantity_density = ""; | ||
67 | + /** | ||
68 | + * 密度 | ||
69 | + * 可选节点 | ||
70 | + */ | ||
71 | + private String quantity_density_code = "DG"; | ||
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 = "^[0-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 | + | ||
227 | + public FWB_Bill() { | ||
228 | + } | ||
229 | + | ||
230 | + public FWB_Bill(String ver, String waybillNum, String origin, String destination, String quantity_picecs, String quantity_weight, String quantity_weight_code, String quantity_volume, String quantity_volume_code, String quantity_density, String quantity_density_code) { | ||
231 | + this.ver = ver; | ||
232 | + this.waybillNum = waybillNum; | ||
233 | + this.origin = origin; | ||
234 | + this.destination = destination; | ||
235 | + this.quantity_picecs = quantity_picecs; | ||
236 | + this.quantity_weight = quantity_weight; | ||
237 | + this.quantity_weight_code = quantity_weight_code; | ||
238 | + this.quantity_volume = quantity_volume; | ||
239 | + this.quantity_volume_code = quantity_volume_code; | ||
240 | + this.quantity_density = quantity_density; | ||
241 | + this.quantity_density_code = quantity_density_code; | ||
242 | + } | ||
243 | + | ||
244 | + @Override | ||
245 | + public String getFWBNodeText() throws FWBException { | ||
246 | + | ||
247 | + String SPLIT_CODE = "/"; | ||
248 | + String CRLF = "\n"; | ||
249 | + StringBuilder sb = new StringBuilder(""); | ||
250 | + | ||
251 | + sb.append(getWaybillNum()).append(getOrigin()).append(getDestination()) | ||
252 | + .append(SPLIT_CODE).append("T").append(getQuantity_picecs()) | ||
253 | + .append(getQuantity_weight_code()).append(getQuantity_weight()); | ||
254 | + | ||
255 | + if (hasText(getQuantity_volume())){ | ||
256 | + sb.append(getQuantity_volume_code()).append(getQuantity_volume()); | ||
257 | + } | ||
258 | + | ||
259 | + if (hasText(getQuantity_density())){ | ||
260 | + sb.append(getQuantity_density_code()).append(getQuantity_density()); | ||
261 | + } | ||
262 | + | ||
263 | + | ||
264 | + | ||
265 | + sb.append(CRLF); | ||
266 | + | ||
267 | + return sb.toString(); | ||
268 | + } | ||
269 | + | ||
270 | + @Override | ||
271 | + public String getNodeName() { | ||
272 | + return "FWB/"+ver+"\n"; | ||
273 | + } | ||
274 | + | ||
275 | +} |
@@ -30,6 +30,13 @@ public class FWB_CER extends BASE implements FWB_BASE{ | @@ -30,6 +30,13 @@ public class FWB_CER extends BASE implements FWB_BASE{ | ||
30 | */ | 30 | */ |
31 | private String cer_signature; | 31 | private String cer_signature; |
32 | 32 | ||
33 | + public FWB_CER() { | ||
34 | + | ||
35 | + } | ||
36 | + public FWB_CER(String cer_signature) { | ||
37 | + this.cer_signature = cer_signature; | ||
38 | + } | ||
39 | + | ||
33 | public String getCer_signature() throws FWBException { | 40 | public String getCer_signature() throws FWBException { |
34 | 41 | ||
35 | String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,20}$"; | 42 | String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,20}$"; |
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | @@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | 5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; |
6 | 6 | ||
7 | +import java.util.List; | ||
7 | import java.util.regex.Matcher; | 8 | import java.util.regex.Matcher; |
8 | import java.util.regex.Pattern; | 9 | import java.util.regex.Pattern; |
9 | 10 | ||
@@ -51,18 +52,8 @@ public class FWB_CNE extends BASE implements FWB_BASE { | @@ -51,18 +52,8 @@ public class FWB_CNE extends BASE implements FWB_BASE { | ||
51 | * [A-Z0-9-<=/\s\.]{0,9} | 52 | * [A-Z0-9-<=/\s\.]{0,9} |
52 | */ | 53 | */ |
53 | private String cne_postcode=""; | 54 | private String cne_postcode=""; |
54 | - /** | ||
55 | - * 收货人联系方式类别 | ||
56 | - * FX|TE|TL | ||
57 | - * 传真|电话|电传(电报) | ||
58 | - * 可重复未标识重复次数 | ||
59 | - */ | ||
60 | - private String cne_contact_id; | ||
61 | - /** | ||
62 | - * 收货人联系方式具体信息(号码) | ||
63 | - * [A-Z0-9]{1,25} | ||
64 | - */ | ||
65 | - private String cne_contact_number; | 55 | + |
56 | + private List<SHP_CNE_CONTACT> contacts; | ||
66 | 57 | ||
67 | public String getCne_account_number() throws FWBException { | 58 | public String getCne_account_number() throws FWBException { |
68 | 59 | ||
@@ -97,7 +88,7 @@ public class FWB_CNE extends BASE implements FWB_BASE { | @@ -97,7 +88,7 @@ public class FWB_CNE extends BASE implements FWB_BASE { | ||
97 | 88 | ||
98 | public String getCne_adr() throws FWBException { | 89 | public String getCne_adr() throws FWBException { |
99 | 90 | ||
100 | - String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | 91 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{1,35}$"; |
101 | Pattern pattern = Pattern.compile(patternStr); | 92 | Pattern pattern = Pattern.compile(patternStr); |
102 | Matcher matcher = pattern.matcher(cne_adr); | 93 | Matcher matcher = pattern.matcher(cne_adr); |
103 | if (!matcher.find()){ | 94 | if (!matcher.find()){ |
@@ -170,33 +161,25 @@ public class FWB_CNE extends BASE implements FWB_BASE { | @@ -170,33 +161,25 @@ public class FWB_CNE extends BASE implements FWB_BASE { | ||
170 | this.cne_postcode = cne_postcode; | 161 | this.cne_postcode = cne_postcode; |
171 | } | 162 | } |
172 | 163 | ||
173 | - public String getCne_contact_id() throws FWBException { | ||
174 | - | ||
175 | - String patternStr = "^FX|TE|TL$"; | ||
176 | - Pattern pattern = Pattern.compile(patternStr); | ||
177 | - Matcher matcher = pattern.matcher(cne_contact_id); | ||
178 | - if (!matcher.find()){ | ||
179 | - throw new FWBException(FWBExceptionType.FWB_CNE_CID_ERR); | ||
180 | - } | ||
181 | - return cne_contact_id; | 164 | + public List<SHP_CNE_CONTACT> getContacts() { |
165 | + return contacts; | ||
182 | } | 166 | } |
183 | 167 | ||
184 | - public void setCne_contact_id(String cne_contact_id) { | ||
185 | - this.cne_contact_id = cne_contact_id; | 168 | + public void setContacts(List<SHP_CNE_CONTACT> contacts) { |
169 | + this.contacts = contacts; | ||
186 | } | 170 | } |
187 | 171 | ||
188 | - public String getCne_contact_number() throws FWBException { | ||
189 | - String patternStr = "^[A-Z0-9]{1,25}$"; | ||
190 | - Pattern pattern = Pattern.compile(patternStr); | ||
191 | - Matcher matcher = pattern.matcher(cne_contact_number); | ||
192 | - if (!matcher.find()){ | ||
193 | - throw new FWBException(FWBExceptionType.FWB_CNE_CN_ERR); | ||
194 | - } | ||
195 | - return cne_contact_number; | 172 | + public FWB_CNE() { |
196 | } | 173 | } |
197 | 174 | ||
198 | - public void setCne_contact_number(String cne_contact_number) { | ||
199 | - this.cne_contact_number = cne_contact_number; | 175 | + public FWB_CNE( String cne_name, String cne_adr, String cne_loc_place, String cne_loc_province, String cne_country, String cne_postcode, List<SHP_CNE_CONTACT> contacts) { |
176 | + this.cne_name = cne_name; | ||
177 | + this.cne_adr = cne_adr; | ||
178 | + this.cne_loc_place = cne_loc_place; | ||
179 | + this.cne_loc_province = cne_loc_province; | ||
180 | + this.cne_country = cne_country; | ||
181 | + this.cne_postcode = cne_postcode; | ||
182 | + this.contacts = contacts; | ||
200 | } | 183 | } |
201 | 184 | ||
202 | @Override | 185 | @Override |
@@ -219,14 +202,16 @@ public class FWB_CNE extends BASE implements FWB_BASE { | @@ -219,14 +202,16 @@ public class FWB_CNE extends BASE implements FWB_BASE { | ||
219 | if (hasText(getCne_postcode())) { | 202 | if (hasText(getCne_postcode())) { |
220 | sb.append(SPLIT_CODE).append(getCne_postcode()); | 203 | sb.append(SPLIT_CODE).append(getCne_postcode()); |
221 | }else { | 204 | }else { |
222 | - if (hasText(getCne_contact_number())){ | 205 | + if (contacts!=null && !contacts.isEmpty()){ |
223 | sb.append(SPLIT_CODE); | 206 | sb.append(SPLIT_CODE); |
224 | } | 207 | } |
225 | } | 208 | } |
226 | 209 | ||
227 | //联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的 | 210 | //联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的 |
228 | - if (hasText(getCne_contact_number())){ | ||
229 | - sb.append(SPLIT_CODE).append(getCne_contact_id()).append(SPLIT_CODE).append(getCne_contact_number()); | 211 | + if (contacts!=null && !contacts.isEmpty()){ |
212 | + for (SHP_CNE_CONTACT item : contacts) { | ||
213 | + sb.append(SPLIT_CODE).append(item.getContact_id()).append(SPLIT_CODE).append(item.getContact_number()); | ||
214 | + } | ||
230 | } | 215 | } |
231 | //todo:此节点循环的报文内容获取方式 | 216 | //todo:此节点循环的报文内容获取方式 |
232 | 217 |
@@ -163,6 +163,19 @@ public class FWB_CVD extends BASE implements FWB_BASE{ | @@ -163,6 +163,19 @@ public class FWB_CVD extends BASE implements FWB_BASE{ | ||
163 | this.cvd_amount_of_insurance = cvd_amount_of_insurance; | 163 | this.cvd_amount_of_insurance = cvd_amount_of_insurance; |
164 | } | 164 | } |
165 | 165 | ||
166 | + public FWB_CVD() { | ||
167 | + | ||
168 | + } | ||
169 | + | ||
170 | + public FWB_CVD(String cvd_currency_code, String cvd_charge_code, String cvd_charge_prepaid, String cvd_value_for_carriage, String cvd_value_for_customs, String cvd_amount_of_insurance) { | ||
171 | + this.cvd_currency_code = cvd_currency_code; | ||
172 | + this.cvd_charge_code = cvd_charge_code; | ||
173 | + this.cvd_charge_prepaid = cvd_charge_prepaid; | ||
174 | + this.cvd_value_for_carriage = cvd_value_for_carriage; | ||
175 | + this.cvd_value_for_customs = cvd_value_for_customs; | ||
176 | + this.cvd_amount_of_insurance = cvd_amount_of_insurance; | ||
177 | + } | ||
178 | + | ||
166 | @Override | 179 | @Override |
167 | public String getFWBNodeText() throws FWBException { | 180 | public String getFWBNodeText() throws FWBException { |
168 | String SPLIT_CODE = "/"; | 181 | String SPLIT_CODE = "/"; |
@@ -75,6 +75,16 @@ public class FWB_FLT extends BASE implements FWB_BASE { | @@ -75,6 +75,16 @@ public class FWB_FLT extends BASE implements FWB_BASE { | ||
75 | this.day = day; | 75 | this.day = day; |
76 | } | 76 | } |
77 | 77 | ||
78 | + public FWB_FLT(){ | ||
79 | + | ||
80 | + } | ||
81 | + | ||
82 | + public FWB_FLT(String cariier, String flightNumber, String day) { | ||
83 | + this.cariier = cariier; | ||
84 | + this.flightNumber = flightNumber; | ||
85 | + this.day = day; | ||
86 | + } | ||
87 | + | ||
78 | @Override | 88 | @Override |
79 | public String getFWBNodeText() throws FWBException { | 89 | public String getFWBNodeText() throws FWBException { |
80 | String SPLIT_CODE = "/"; | 90 | String SPLIT_CODE = "/"; |
@@ -87,7 +97,7 @@ public class FWB_FLT extends BASE implements FWB_BASE { | @@ -87,7 +97,7 @@ public class FWB_FLT extends BASE implements FWB_BASE { | ||
87 | 97 | ||
88 | //todo:此节点循环的报文内容获取方式 | 98 | //todo:此节点循环的报文内容获取方式 |
89 | 99 | ||
90 | -// sb.append(CRLF); | 100 | + sb.append(CRLF); |
91 | 101 | ||
92 | return sb.toString(); | 102 | return sb.toString(); |
93 | } | 103 | } |
@@ -53,6 +53,17 @@ public class FWB_ISU extends BASE implements FWB_BASE{ | @@ -53,6 +53,17 @@ public class FWB_ISU extends BASE implements FWB_BASE{ | ||
53 | */ | 53 | */ |
54 | private String isu_signature; | 54 | private String isu_signature; |
55 | 55 | ||
56 | + public FWB_ISU() { | ||
57 | + | ||
58 | + } | ||
59 | + | ||
60 | + | ||
61 | + public FWB_ISU(String isu_day_mounth_year, String isu_place_or_airport_code, String isu_signature) { | ||
62 | + this.isu_day_mounth_year = isu_day_mounth_year; | ||
63 | + this.isu_place_or_airport_code = isu_place_or_airport_code; | ||
64 | + this.isu_signature = isu_signature; | ||
65 | + } | ||
66 | + | ||
56 | public String getIsu_day_mounth_year() throws FWBException { | 67 | public String getIsu_day_mounth_year() throws FWBException { |
57 | String patternStr = "^[0-9]{2}[A-Z]{3}[0-9]{2}$"; | 68 | String patternStr = "^[0-9]{2}[A-Z]{3}[0-9]{2}$"; |
58 | Pattern pattern = Pattern.compile(patternStr); | 69 | Pattern pattern = Pattern.compile(patternStr); |
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | @@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | 5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; |
6 | 6 | ||
7 | +import java.util.List; | ||
7 | import java.util.regex.Matcher; | 8 | import java.util.regex.Matcher; |
8 | import java.util.regex.Pattern; | 9 | import java.util.regex.Pattern; |
9 | 10 | ||
@@ -62,19 +63,8 @@ public class FWB_NFY extends BASE implements FWB_BASE { | @@ -62,19 +63,8 @@ public class FWB_NFY extends BASE implements FWB_BASE { | ||
62 | * O 可选 | 63 | * O 可选 |
63 | */ | 64 | */ |
64 | private String nfy_postcode; | 65 | private String nfy_postcode; |
65 | - /** | ||
66 | - * Contact Detail 可重复多次 | ||
67 | - * 联系方式代码 | ||
68 | - * TE|FX|TL | ||
69 | - * M | ||
70 | - */ | ||
71 | - private String nfy_contact_id; | ||
72 | - /** | ||
73 | - * 联系方式号码 | ||
74 | - * [A-Z0-9]{1,25} | ||
75 | - * M | ||
76 | - */ | ||
77 | - private String nfy_contact_NUM; | 66 | + |
67 | + private List<SHP_CNE_CONTACT> contacts; | ||
78 | 68 | ||
79 | public String getNfy_name() throws FWBException { | 69 | public String getNfy_name() throws FWBException { |
80 | String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | 70 | String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; |
@@ -160,32 +150,12 @@ public class FWB_NFY extends BASE implements FWB_BASE { | @@ -160,32 +150,12 @@ public class FWB_NFY extends BASE implements FWB_BASE { | ||
160 | this.nfy_postcode = nfy_postcode; | 150 | this.nfy_postcode = nfy_postcode; |
161 | } | 151 | } |
162 | 152 | ||
163 | - public String getNfy_contact_id() throws FWBException { | ||
164 | - String patternStr = "^FX|TE|TL$"; | ||
165 | - Pattern pattern = Pattern.compile(patternStr); | ||
166 | - Matcher matcher = pattern.matcher(nfy_contact_id); | ||
167 | - if (!matcher.find()){ | ||
168 | - throw new FWBException(FWBExceptionType.FWB_NFY_CID_ERR); | ||
169 | - } | ||
170 | - return nfy_contact_id; | ||
171 | - } | ||
172 | - | ||
173 | - public void setNfy_contact_id(String nfy_contact_id) { | ||
174 | - this.nfy_contact_id = nfy_contact_id; | 153 | + public List<SHP_CNE_CONTACT> getContacts() { |
154 | + return contacts; | ||
175 | } | 155 | } |
176 | 156 | ||
177 | - public String getNfy_contact_NUM() throws FWBException { | ||
178 | - String patternStr = "^[A-Z0-9]{1,25}$"; | ||
179 | - Pattern pattern = Pattern.compile(patternStr); | ||
180 | - Matcher matcher = pattern.matcher(nfy_contact_NUM); | ||
181 | - if (!matcher.find()){ | ||
182 | - throw new FWBException(FWBExceptionType.FWB_NFY_CN_ERR); | ||
183 | - } | ||
184 | - return nfy_contact_NUM; | ||
185 | - } | ||
186 | - | ||
187 | - public void setNfy_contact_NUM(String nfy_contact_NUM) { | ||
188 | - this.nfy_contact_NUM = nfy_contact_NUM; | 157 | + public void setContacts(List<SHP_CNE_CONTACT> contacts) { |
158 | + this.contacts = contacts; | ||
189 | } | 159 | } |
190 | 160 | ||
191 | @Override | 161 | @Override |
@@ -209,13 +179,15 @@ public class FWB_NFY extends BASE implements FWB_BASE { | @@ -209,13 +179,15 @@ public class FWB_NFY extends BASE implements FWB_BASE { | ||
209 | if (hasText(nfy_postcode)){ | 179 | if (hasText(nfy_postcode)){ |
210 | sb.append(SPLIT_CODE).append(getNfy_postcode()); | 180 | sb.append(SPLIT_CODE).append(getNfy_postcode()); |
211 | }else { | 181 | }else { |
212 | - if (hasText(nfy_contact_NUM)){ | 182 | + if (contacts!=null && !contacts.isEmpty()){ |
213 | sb.append(SPLIT_CODE); | 183 | sb.append(SPLIT_CODE); |
214 | } | 184 | } |
215 | } | 185 | } |
216 | 186 | ||
217 | - if (hasText(nfy_contact_NUM)){ | ||
218 | - sb.append(SPLIT_CODE).append(getNfy_contact_id()).append(SPLIT_CODE).append(getNfy_contact_NUM()); | 187 | + if (contacts!=null && !contacts.isEmpty()){ |
188 | + for (SHP_CNE_CONTACT item : contacts) { | ||
189 | + sb.append(SPLIT_CODE).append(item.getContact_id()).append(SPLIT_CODE).append(item.getContact_number()); | ||
190 | + } | ||
219 | } | 191 | } |
220 | sb.append(CRLF); | 192 | sb.append(CRLF); |
221 | 193 |
@@ -73,6 +73,16 @@ public class FWB_OCI implements FWB_BASE { | @@ -73,6 +73,16 @@ public class FWB_OCI implements FWB_BASE { | ||
73 | private String oci_csrc_info=""; | 73 | private String oci_csrc_info=""; |
74 | 74 | ||
75 | 75 | ||
76 | + public FWB_OCI() { | ||
77 | + } | ||
78 | + | ||
79 | + public FWB_OCI(String oci_country_code, String oci_information_id, String oci_csrc_id, String oci_csrc_info) { | ||
80 | + this.oci_country_code = oci_country_code; | ||
81 | + this.oci_information_id = oci_information_id; | ||
82 | + this.oci_csrc_id = oci_csrc_id; | ||
83 | + this.oci_csrc_info = oci_csrc_info; | ||
84 | + } | ||
85 | + | ||
76 | /** | 86 | /** |
77 | * --------------------------------------------------------------------------------------------------- | 87 | * --------------------------------------------------------------------------------------------------- |
78 | * | 88 | * |
@@ -127,11 +137,16 @@ public class FWB_OCI implements FWB_BASE { | @@ -127,11 +137,16 @@ public class FWB_OCI implements FWB_BASE { | ||
127 | */ | 137 | */ |
128 | public String getOci_csrc_info() throws FWBException { | 138 | public String getOci_csrc_info() throws FWBException { |
129 | if (StringUtils.hasText(oci_csrc_info)){ | 139 | if (StringUtils.hasText(oci_csrc_info)){ |
130 | - if ( | ||
131 | - !StringUtils.hasLength(this.oci_csrc_id) | ||
132 | - ){ | 140 | + if (!StringUtils.hasLength(this.oci_csrc_id)){ |
133 | throw new FWBException(FWBExceptionType.OCI_CSRC_ERROR); | 141 | throw new FWBException(FWBExceptionType.OCI_CSRC_ERROR); |
134 | } | 142 | } |
143 | + | ||
144 | + String patternStr = "^[A-Z0-9<=/\\s\\.\\-]{1,35}$"; | ||
145 | + Pattern pattern = Pattern.compile(patternStr); | ||
146 | + Matcher matcher = pattern.matcher(oci_csrc_info); | ||
147 | + if (!matcher.find()){ | ||
148 | + throw new FWBException(FWBExceptionType.OCI_CSRCI_ERROR,oci_csrc_info); | ||
149 | + } | ||
135 | } | 150 | } |
136 | 151 | ||
137 | return oci_csrc_info; | 152 | return oci_csrc_info; |
@@ -148,7 +163,6 @@ public class FWB_OCI implements FWB_BASE { | @@ -148,7 +163,6 @@ public class FWB_OCI implements FWB_BASE { | ||
148 | String CRLF = "\n"; | 163 | String CRLF = "\n"; |
149 | StringBuilder sb = new StringBuilder(""); | 164 | StringBuilder sb = new StringBuilder(""); |
150 | if (StringUtils.hasLength(getOci_csrc_info())){ | 165 | if (StringUtils.hasLength(getOci_csrc_info())){ |
151 | - sb.append(getNodeName()); | ||
152 | sb.append(SPLIT_CODE) | 166 | sb.append(SPLIT_CODE) |
153 | .append(getOci_country_code()) | 167 | .append(getOci_country_code()) |
154 | .append(SPLIT_CODE) | 168 | .append(SPLIT_CODE) |
@@ -5,6 +5,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | @@ -5,6 +5,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | ||
5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
6 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | 6 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; |
7 | 7 | ||
8 | +import java.util.List; | ||
8 | import java.util.regex.Matcher; | 9 | import java.util.regex.Matcher; |
9 | import java.util.regex.Pattern; | 10 | import java.util.regex.Pattern; |
10 | 11 | ||
@@ -33,19 +34,24 @@ public class FWB_OSI extends BASE implements FWB_BASE{ | @@ -33,19 +34,24 @@ public class FWB_OSI extends BASE implements FWB_BASE{ | ||
33 | * OSI/ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 13 27 | 34 | * OSI/ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 13 27 |
34 | * /ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 16 46 | 35 | * /ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 16 46 |
35 | */ | 36 | */ |
36 | - private String osi_text; | ||
37 | - | ||
38 | - public String getOsi_text() throws FWBException { | ||
39 | - String patternStr = "^[A-Z0-9-<=/\\s\\.]{1,65}$"; | ||
40 | - Pattern pattern = Pattern.compile(patternStr); | ||
41 | - Matcher matcher = pattern.matcher(osi_text); | ||
42 | - if (!matcher.find()){ | ||
43 | - throw new FWBException(FWBExceptionType.OSI_TEXT_ERROR); | 37 | + private List<String> osi_text; |
38 | + | ||
39 | + public List<String> getOsi_text() throws FWBException { | ||
40 | + if (osi_text!=null && !osi_text.isEmpty()){ | ||
41 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{1,65}$"; | ||
42 | + Pattern pattern = Pattern.compile(patternStr); | ||
43 | + for (String item : osi_text) { | ||
44 | + Matcher matcher = pattern.matcher(item); | ||
45 | + if (!matcher.find()){ | ||
46 | + throw new FWBException(FWBExceptionType.OSI_TEXT_ERROR,item); | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
44 | } | 50 | } |
45 | return osi_text; | 51 | return osi_text; |
46 | } | 52 | } |
47 | 53 | ||
48 | - public void setOsi_text(String osi_text) { | 54 | + public void setOsi_text(List<String> osi_text) { |
49 | this.osi_text = osi_text; | 55 | this.osi_text = osi_text; |
50 | } | 56 | } |
51 | 57 | ||
@@ -56,12 +62,11 @@ public class FWB_OSI extends BASE implements FWB_BASE{ | @@ -56,12 +62,11 @@ public class FWB_OSI extends BASE implements FWB_BASE{ | ||
56 | String CRLF = "\n"; | 62 | String CRLF = "\n"; |
57 | StringBuilder sb = new StringBuilder(""); | 63 | StringBuilder sb = new StringBuilder(""); |
58 | 64 | ||
59 | - if (hasText(osi_text)){ | ||
60 | - sb.append(getNodeName()) | ||
61 | - .append(SPLIT_CODE).append(getOsi_text()); | ||
62 | - | 65 | + if (osi_text!=null && !osi_text.isEmpty()){ |
66 | + for (String item : osi_text) { | ||
67 | + sb.append(SPLIT_CODE).append(item).append(CRLF); | ||
68 | + } | ||
63 | 69 | ||
64 | - sb.append(CRLF); | ||
65 | } | 70 | } |
66 | 71 | ||
67 | 72 |
@@ -79,6 +79,14 @@ public class FWB_REF implements FWB_BASE{ | @@ -79,6 +79,14 @@ public class FWB_REF implements FWB_BASE{ | ||
79 | */ | 79 | */ |
80 | private String ref_participant_airport=""; | 80 | private String ref_participant_airport=""; |
81 | 81 | ||
82 | + public FWB_REF() { | ||
83 | + | ||
84 | + } | ||
85 | + | ||
86 | + public FWB_REF(String ref_address) { | ||
87 | + this.ref_address = ref_address; | ||
88 | + } | ||
89 | + | ||
82 | public String getRef_address() throws FWBException { | 90 | public String getRef_address() throws FWBException { |
83 | if (!StringUtils.hasText(ref_address)){ | 91 | if (!StringUtils.hasText(ref_address)){ |
84 | throw new FWBException(FWBExceptionType.REF_ERROR); | 92 | throw new FWBException(FWBExceptionType.REF_ERROR); |
@@ -177,9 +185,11 @@ public class FWB_REF implements FWB_BASE{ | @@ -177,9 +185,11 @@ public class FWB_REF implements FWB_BASE{ | ||
177 | if (StringUtils.hasText(getRef_file_reference())){ | 185 | if (StringUtils.hasText(getRef_file_reference())){ |
178 | sb.append(SPLIT_CODE) | 186 | sb.append(SPLIT_CODE) |
179 | .append(getRef_file_reference()); | 187 | .append(getRef_file_reference()); |
180 | - }else { | ||
181 | - sb.append(SPLIT_CODE); | ||
182 | } | 188 | } |
189 | + //todo:这里有BUG | ||
190 | +// else { | ||
191 | +// sb.append(SPLIT_CODE); | ||
192 | +// } | ||
183 | 193 | ||
184 | if (StringUtils.hasText(getRef_participant_id()) | 194 | if (StringUtils.hasText(getRef_participant_id()) |
185 | && StringUtils.hasText(getRef_participant_code()) | 195 | && StringUtils.hasText(getRef_participant_code()) |
@@ -277,6 +277,25 @@ public class FWB_RTD extends BASE implements FWB_BASE{ | @@ -277,6 +277,25 @@ public class FWB_RTD extends BASE implements FWB_BASE{ | ||
277 | this.rtd_volume = rtd_volume; | 277 | this.rtd_volume = rtd_volume; |
278 | } | 278 | } |
279 | 279 | ||
280 | + public FWB_RTD() { | ||
281 | + } | ||
282 | + | ||
283 | + public FWB_RTD(String rtd_number_pieces, String rtd_combination_point, String rtd_gross_weight, String rtd_rate_class, String rtd_commodity_NUM, String rtd_charge_weight, String rtd_rate_charge, String rtd_total, String rtd_goods_DES, String rtd_goods_consol_DES, List<FWB_RTD_Dimension> dimensions, String rtd_volume_code, String rtd_volume) { | ||
284 | + this.rtd_number_pieces = rtd_number_pieces; | ||
285 | + this.rtd_combination_point = rtd_combination_point; | ||
286 | + this.rtd_gross_weight = rtd_gross_weight; | ||
287 | + this.rtd_rate_class = rtd_rate_class; | ||
288 | + this.rtd_commodity_NUM = rtd_commodity_NUM; | ||
289 | + this.rtd_charge_weight = rtd_charge_weight; | ||
290 | + this.rtd_rate_charge = rtd_rate_charge; | ||
291 | + this.rtd_total = rtd_total; | ||
292 | + this.rtd_goods_DES = rtd_goods_DES; | ||
293 | + this.rtd_goods_consol_DES = rtd_goods_consol_DES; | ||
294 | + this.dimensions = dimensions; | ||
295 | + this.rtd_volume_code = rtd_volume_code; | ||
296 | + this.rtd_volume = rtd_volume; | ||
297 | + } | ||
298 | + | ||
280 | //todo: 还有NU,NS,NH,NO等信息后面完善 | 299 | //todo: 还有NU,NS,NH,NO等信息后面完善 |
281 | 300 | ||
282 | @Override | 301 | @Override |
@@ -94,7 +94,14 @@ public class FWB_RTG extends BASE implements FWB_BASE { | @@ -94,7 +94,14 @@ public class FWB_RTG extends BASE implements FWB_BASE { | ||
94 | public void setOnwardCarrier(String onwardCarrier) { | 94 | public void setOnwardCarrier(String onwardCarrier) { |
95 | this.onwardCarrier = onwardCarrier; | 95 | this.onwardCarrier = onwardCarrier; |
96 | } | 96 | } |
97 | + public FWB_RTG(){ | ||
97 | 98 | ||
99 | + } | ||
100 | + | ||
101 | + public FWB_RTG(String destinationAirport, String destinationCarrier) { | ||
102 | + this.destinationAirport = destinationAirport; | ||
103 | + this.destinationCarrier = destinationCarrier; | ||
104 | + } | ||
98 | 105 | ||
99 | @Override | 106 | @Override |
100 | public String getFWBNodeText() throws FWBException { | 107 | public String getFWBNodeText() throws FWBException { |
@@ -115,7 +122,7 @@ public class FWB_RTG extends BASE implements FWB_BASE { | @@ -115,7 +122,7 @@ public class FWB_RTG extends BASE implements FWB_BASE { | ||
115 | 122 | ||
116 | //todo:此节点循环的报文内容获取方式 | 123 | //todo:此节点循环的报文内容获取方式 |
117 | 124 | ||
118 | -// sb.append(CRLF); | 125 | + sb.append(CRLF); |
119 | 126 | ||
120 | return sb.toString(); | 127 | return sb.toString(); |
121 | } | 128 | } |
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | @@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | 5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; |
6 | 6 | ||
7 | +import java.util.List; | ||
7 | import java.util.regex.Matcher; | 8 | import java.util.regex.Matcher; |
8 | import java.util.regex.Pattern; | 9 | import java.util.regex.Pattern; |
9 | 10 | ||
@@ -50,18 +51,9 @@ public class FWB_SHP extends BASE implements FWB_BASE { | @@ -50,18 +51,9 @@ public class FWB_SHP extends BASE implements FWB_BASE { | ||
50 | * [A-Z0-9-<=/\s\.]{0,9} | 51 | * [A-Z0-9-<=/\s\.]{0,9} |
51 | */ | 52 | */ |
52 | private String shp_postcode; | 53 | private String shp_postcode; |
53 | - /** | ||
54 | - * 发货人联系方式类别 | ||
55 | - * FX|TE|TL | ||
56 | - * 传真|电话|电传(电报) | ||
57 | - * 可重复未标识重复次数 | ||
58 | - */ | ||
59 | - private String shp_contact_id; | ||
60 | - /** | ||
61 | - * 发货人联系方式具体信息(号码) | ||
62 | - * [A-Z0-9]{1,25} | ||
63 | - */ | ||
64 | - private String shp_contact_number; | 54 | + |
55 | + private List<SHP_CNE_CONTACT> contacts; | ||
56 | + | ||
65 | 57 | ||
66 | 58 | ||
67 | 59 | ||
@@ -166,32 +158,37 @@ public class FWB_SHP extends BASE implements FWB_BASE { | @@ -166,32 +158,37 @@ public class FWB_SHP extends BASE implements FWB_BASE { | ||
166 | this.shp_postcode = shp_postcode; | 158 | this.shp_postcode = shp_postcode; |
167 | } | 159 | } |
168 | 160 | ||
169 | - public String getShp_contact_id() throws FWBException { | ||
170 | - String patternStr = "^FX|TE|TL$"; | ||
171 | - Pattern pattern = Pattern.compile(patternStr); | ||
172 | - Matcher matcher = pattern.matcher(shp_contact_id); | ||
173 | - if (!matcher.find()){ | ||
174 | - throw new FWBException(FWBExceptionType.FWB_SHP_CID_ERR); | ||
175 | - } | ||
176 | - return shp_contact_id; | 161 | + |
162 | + public List<SHP_CNE_CONTACT> getContacts() { | ||
163 | + return contacts; | ||
177 | } | 164 | } |
178 | 165 | ||
179 | - public void setShp_contact_id(String shp_contact_id) { | ||
180 | - this.shp_contact_id = shp_contact_id; | 166 | + public void setContacts(List<SHP_CNE_CONTACT> contacts) { |
167 | + this.contacts = contacts; | ||
181 | } | 168 | } |
182 | 169 | ||
183 | - public String getShp_contact_number() throws FWBException { | ||
184 | - String patternStr = "^[A-Z0-9]{1,25}$"; | ||
185 | - Pattern pattern = Pattern.compile(patternStr); | ||
186 | - Matcher matcher = pattern.matcher(shp_contact_number); | ||
187 | - if (!matcher.find()){ | ||
188 | - throw new FWBException(FWBExceptionType.FWB_SHP_CN_ERR); | ||
189 | - } | ||
190 | - return shp_contact_number; | 170 | + |
171 | + public FWB_SHP() { | ||
191 | } | 172 | } |
192 | 173 | ||
193 | - public void setShp_contact_number(String shp_contact_number) { | ||
194 | - this.shp_contact_number = shp_contact_number; | 174 | + /** |
175 | + * | ||
176 | + * @param shp_name 名称 | ||
177 | + * @param shp_adr 地址 | ||
178 | + * @param shp_loc_place 城市 | ||
179 | + * @param shp_loc_province 省 | ||
180 | + * @param shp_country 国家 | ||
181 | + * @param shp_postcode 邮编 | ||
182 | + * @param contacts 联系信息 | ||
183 | + */ | ||
184 | + public FWB_SHP(String shp_name, String shp_adr, String shp_loc_place, String shp_loc_province, String shp_country, String shp_postcode, List<SHP_CNE_CONTACT> contacts) { | ||
185 | + this.shp_name = shp_name; | ||
186 | + this.shp_adr = shp_adr; | ||
187 | + this.shp_loc_place = shp_loc_place; | ||
188 | + this.shp_loc_province = shp_loc_province; | ||
189 | + this.shp_country = shp_country; | ||
190 | + this.shp_postcode = shp_postcode; | ||
191 | + this.contacts = contacts; | ||
195 | } | 192 | } |
196 | 193 | ||
197 | @Override | 194 | @Override |
@@ -214,16 +211,17 @@ public class FWB_SHP extends BASE implements FWB_BASE { | @@ -214,16 +211,17 @@ public class FWB_SHP extends BASE implements FWB_BASE { | ||
214 | if (hasText(shp_postcode)) { | 211 | if (hasText(shp_postcode)) { |
215 | sb.append(SPLIT_CODE).append(getShp_postcode()); | 212 | sb.append(SPLIT_CODE).append(getShp_postcode()); |
216 | }else { | 213 | }else { |
217 | - if (hasText(shp_contact_number)){ | 214 | + if (contacts!=null && !contacts.isEmpty()){ |
218 | sb.append(SPLIT_CODE); | 215 | sb.append(SPLIT_CODE); |
219 | } | 216 | } |
220 | } | 217 | } |
221 | 218 | ||
222 | - //联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的 | ||
223 | - if (hasText(shp_contact_number)){ | ||
224 | - sb.append(SPLIT_CODE).append(getShp_contact_id()).append(SPLIT_CODE).append(getShp_contact_number()); | 219 | + //联系方式可重复不限次数 |
220 | + if (contacts!=null && !contacts.isEmpty()){ | ||
221 | + for (SHP_CNE_CONTACT item : contacts) { | ||
222 | + sb.append(SPLIT_CODE).append(item.getContact_id()).append(SPLIT_CODE).append(item.getContact_number()); | ||
223 | + } | ||
225 | } | 224 | } |
226 | - //todo:此节点循环的报文内容获取方式 | ||
227 | 225 | ||
228 | sb.append(CRLF); | 226 | sb.append(CRLF); |
229 | 227 |
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | @@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE; | ||
4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 4 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | 5 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; |
6 | 6 | ||
7 | +import java.util.List; | ||
7 | import java.util.regex.Matcher; | 8 | import java.util.regex.Matcher; |
8 | import java.util.regex.Pattern; | 9 | import java.util.regex.Pattern; |
9 | 10 | ||
@@ -21,21 +22,26 @@ public class FWB_SSR extends BASE implements FWB_BASE { | @@ -21,21 +22,26 @@ public class FWB_SSR extends BASE implements FWB_BASE { | ||
21 | * 特殊服务请求内容 | 22 | * 特殊服务请求内容 |
22 | * [A-Z0-9-<=/\s\.]{0,65} | 23 | * [A-Z0-9-<=/\s\.]{0,65} |
23 | */ | 24 | */ |
24 | - private String ssr_request_content; | 25 | + private List<String> ssr_request_content; |
25 | 26 | ||
26 | - public String getSsr_request_content() throws FWBException { | 27 | + public List<String> getSsr_request_content() throws FWBException { |
27 | 28 | ||
28 | - String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,65}$"; | ||
29 | - Pattern pattern = Pattern.compile(patternStr); | ||
30 | - Matcher matcher = pattern.matcher(ssr_request_content); | ||
31 | - if (!matcher.find()){ | ||
32 | - throw new FWBException(FWBExceptionType.FWB_SSR_CONT_ERR); | 29 | + if (ssr_request_content!=null && !ssr_request_content.isEmpty()){ |
30 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,65}$"; | ||
31 | + Pattern pattern = Pattern.compile(patternStr); | ||
32 | + for (String item : ssr_request_content) { | ||
33 | + Matcher matcher = pattern.matcher(item); | ||
34 | + if (!matcher.find()){ | ||
35 | + throw new FWBException(FWBExceptionType.FWB_SSR_CONT_ERR,item); | ||
36 | + } | ||
37 | + } | ||
33 | } | 38 | } |
34 | 39 | ||
40 | + | ||
35 | return ssr_request_content; | 41 | return ssr_request_content; |
36 | } | 42 | } |
37 | 43 | ||
38 | - public void setSsr_request_content(String ssr_request_content) { | 44 | + public void setSsr_request_content(List<String> ssr_request_content) { |
39 | this.ssr_request_content = ssr_request_content; | 45 | this.ssr_request_content = ssr_request_content; |
40 | } | 46 | } |
41 | 47 | ||
@@ -45,10 +51,12 @@ public class FWB_SSR extends BASE implements FWB_BASE { | @@ -45,10 +51,12 @@ public class FWB_SSR extends BASE implements FWB_BASE { | ||
45 | String CRLF = "\n"; | 51 | String CRLF = "\n"; |
46 | StringBuilder sb = new StringBuilder(""); | 52 | StringBuilder sb = new StringBuilder(""); |
47 | 53 | ||
48 | - if (hasText(ssr_request_content)){ | 54 | + if (ssr_request_content!=null && !ssr_request_content.isEmpty()){ |
49 | sb.append(getNodeName()); | 55 | sb.append(getNodeName()); |
50 | - sb.append(SPLIT_CODE).append(getSsr_request_content()); | ||
51 | - sb.append(CRLF); | 56 | + for (String item : ssr_request_content) { |
57 | + sb.append(SPLIT_CODE).append(item); | ||
58 | + sb.append(CRLF); | ||
59 | + } | ||
52 | } | 60 | } |
53 | 61 | ||
54 | return sb.toString(); | 62 | return sb.toString(); |
1 | +package com.sunyo.wlpt.base.model.efreight.fwb; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
5 | + | ||
6 | +import java.util.regex.Matcher; | ||
7 | +import java.util.regex.Pattern; | ||
8 | + | ||
9 | +/** | ||
10 | + * 收发货人共用联系方式实体 | ||
11 | + */ | ||
12 | +public class SHP_CNE_CONTACT { | ||
13 | + | ||
14 | + /** | ||
15 | + * 发货人联系方式类别 | ||
16 | + * FX|TE|TL | ||
17 | + * 传真|电话|电传(电报) | ||
18 | + * 可重复未标识重复次数 | ||
19 | + */ | ||
20 | + private String contact_id; | ||
21 | + /** | ||
22 | + * 发货人联系方式具体信息(号码) | ||
23 | + * [A-Z0-9]{1,25} | ||
24 | + */ | ||
25 | + private String contact_number; | ||
26 | + | ||
27 | + | ||
28 | + public String getContact_id() throws FWBException { | ||
29 | + String patternStr = "^FX|TE|TL$"; | ||
30 | + Pattern pattern = Pattern.compile(patternStr); | ||
31 | + Matcher matcher = pattern.matcher(contact_id); | ||
32 | + if (!matcher.find()){ | ||
33 | + throw new FWBException(FWBExceptionType.FWB_SHP_CID_ERR,contact_id); | ||
34 | + } | ||
35 | + return contact_id; | ||
36 | + } | ||
37 | + | ||
38 | + public void setContact_id(String contact_id) { | ||
39 | + this.contact_id = contact_id; | ||
40 | + } | ||
41 | + | ||
42 | + public String getContact_number() throws FWBException { | ||
43 | + String patternStr = "^[A-Z0-9]{1,25}$"; | ||
44 | + Pattern pattern = Pattern.compile(patternStr); | ||
45 | + Matcher matcher = pattern.matcher(contact_number); | ||
46 | + if (!matcher.find()){ | ||
47 | + throw new FWBException(FWBExceptionType.FWB_SHP_CN_ERR); | ||
48 | + } | ||
49 | + return contact_number; | ||
50 | + } | ||
51 | + | ||
52 | + public void setContact_number(String contact_number) { | ||
53 | + this.contact_number = contact_number; | ||
54 | + } | ||
55 | + | ||
56 | + public SHP_CNE_CONTACT() { | ||
57 | + | ||
58 | + } | ||
59 | + | ||
60 | + public SHP_CNE_CONTACT(String contact_id, String contact_number) { | ||
61 | + this.contact_id = contact_id; | ||
62 | + this.contact_number = contact_number; | ||
63 | + } | ||
64 | +} |
@@ -39,8 +39,8 @@ public enum FWBExceptionType { | @@ -39,8 +39,8 @@ public enum FWBExceptionType { | ||
39 | FWB_SHP_PVC_ERR("565","发货人省份信息格式有误"), | 39 | FWB_SHP_PVC_ERR("565","发货人省份信息格式有误"), |
40 | FWB_SHP_CNT_ERR("572","发货人国家信息格式有误"), | 40 | FWB_SHP_CNT_ERR("572","发货人国家信息格式有误"), |
41 | FWB_SHP_PC_ERR("573","发货人邮编信息格式有误"), | 41 | FWB_SHP_PC_ERR("573","发货人邮编信息格式有误"), |
42 | - FWB_SHP_CID_ERR("582","发货人联系方式代码格式有误"), | ||
43 | - FWB_SHP_CN_ERR("584","发货人联系方式信息格式有误"), | 42 | + FWB_SHP_CID_ERR("582","收发货人联系方式代码格式有误"), |
43 | + FWB_SHP_CN_ERR("584","收发货人联系方式信息格式有误"), | ||
44 | 44 | ||
45 | FWB_CNE_ACC_ERR("622","收货人账号信息格式有误"), | 45 | FWB_CNE_ACC_ERR("622","收货人账号信息格式有误"), |
46 | FWB_CNE_NAME_ERR("643","收货人名称信息格式有误"), | 46 | FWB_CNE_NAME_ERR("643","收货人名称信息格式有误"), |
@@ -49,8 +49,6 @@ public enum FWBExceptionType { | @@ -49,8 +49,6 @@ public enum FWBExceptionType { | ||
49 | FWB_CNE_PVC_ERR("665","收货人省份信息格式有误"), | 49 | FWB_CNE_PVC_ERR("665","收货人省份信息格式有误"), |
50 | FWB_CNE_CNT_ERR("672","收货人国家信息格式有误"), | 50 | FWB_CNE_CNT_ERR("672","收货人国家信息格式有误"), |
51 | FWB_CNE_PC_ERR("673","收货人邮编信息格式有误"), | 51 | FWB_CNE_PC_ERR("673","收货人邮编信息格式有误"), |
52 | - FWB_CNE_CID_ERR("682","收货人联系方式代码格式有误"), | ||
53 | - FWB_CNE_CN_ERR("684","收货人联系方式信息格式有误"), | ||
54 | 52 | ||
55 | 53 | ||
56 | FWB_AGT_ACC_ERR("722","代理人账号信息格式有误"), | 54 | FWB_AGT_ACC_ERR("722","代理人账号信息格式有误"), |
@@ -107,7 +105,8 @@ public enum FWBExceptionType { | @@ -107,7 +105,8 @@ public enum FWBExceptionType { | ||
107 | SPH_CODE_FAILD("2522", "SPH-代码格式信息有误"), | 105 | SPH_CODE_FAILD("2522", "SPH-代码格式信息有误"), |
108 | 106 | ||
109 | 107 | ||
110 | - OCI_CSRC_ERROR("2970", "缺少 Other Customs,Security And Regulatory Control Information Identifier"); | 108 | + OCI_CSRC_ERROR("2970", "缺少 Other Customs,Security And Regulatory Control Information Identifier"), |
109 | + OCI_CSRCI_ERROR("2990", "缺少 Other Customs,Security And Regulatory Control Information"); | ||
111 | 110 | ||
112 | /** | 111 | /** |
113 | * 参照字典FWB节点位置 | 112 | * 参照字典FWB节点位置 |
@@ -37,15 +37,15 @@ public class FWB_804_31118511 { | @@ -37,15 +37,15 @@ public class FWB_804_31118511 { | ||
37 | } | 37 | } |
38 | 38 | ||
39 | static String FWB_WAYBILL_TEST(){ | 39 | static String FWB_WAYBILL_TEST(){ |
40 | - FWB fwb = new FWB(); | ||
41 | - fwb.setWaybillNum("804-31118485"); | 40 | + FWB_Bill fwb = new FWB_Bill(); |
41 | + fwb.setWaybillNum("804-31118146"); | ||
42 | fwb.setOrigin("CGO"); | 42 | fwb.setOrigin("CGO"); |
43 | fwb.setDestination("ICN"); | 43 | fwb.setDestination("ICN"); |
44 | - fwb.setQuantity_picecs("2"); | 44 | + fwb.setQuantity_picecs("170"); |
45 | fwb.setQuantity_weight_code("K"); | 45 | fwb.setQuantity_weight_code("K"); |
46 | - fwb.setQuantity_weight("10"); | 46 | + fwb.setQuantity_weight("1650"); |
47 | fwb.setQuantity_volume_code("MC"); | 47 | fwb.setQuantity_volume_code("MC"); |
48 | - fwb.setQuantity_volume("0.10"); | 48 | + fwb.setQuantity_volume("5.97"); |
49 | 49 | ||
50 | // fwb.setQuantity_density("22"); | 50 | // fwb.setQuantity_density("22"); |
51 | try { | 51 | try { |
@@ -63,7 +63,7 @@ public class FWB_804_31118511 { | @@ -63,7 +63,7 @@ public class FWB_804_31118511 { | ||
63 | FWB_FLT flt = new FWB_FLT(); | 63 | FWB_FLT flt = new FWB_FLT(); |
64 | flt.setCariier("CF"); | 64 | flt.setCariier("CF"); |
65 | flt.setFlightNumber("221"); | 65 | flt.setFlightNumber("221"); |
66 | - flt.setDay("13"); | 66 | + flt.setDay("15"); |
67 | 67 | ||
68 | try { | 68 | try { |
69 | String nodeText = flt.getNodeName() + flt.getFWBNodeText() + "\n"; | 69 | String nodeText = flt.getNodeName() + flt.getFWBNodeText() + "\n"; |
@@ -93,15 +93,13 @@ public class FWB_804_31118511 { | @@ -93,15 +93,13 @@ public class FWB_804_31118511 { | ||
93 | 93 | ||
94 | static String FWB_SHP_TEST(){ | 94 | static String FWB_SHP_TEST(){ |
95 | FWB_SHP var = new FWB_SHP(); | 95 | FWB_SHP var = new FWB_SHP(); |
96 | - var.setShp_name("MCL ELECTRONIC MATERIALS CO LTD"); | 96 | + var.setShp_name("TIANSHUI HUATIAN TECHNOLOGY CO LTD"); |
97 | // var.setShp_account_number("ABC"); | 97 | // var.setShp_account_number("ABC"); |
98 | - var.setShp_adr("NO99 BINHEBEI ROAD GAOXIN DISTRICT"); | ||
99 | - var.setShp_loc_place("LUOYANG"); | ||
100 | - var.setShp_loc_province("HENAN"); | 98 | + var.setShp_adr("NO14 SHUANGQIAO ROAD QINZHOU TOWN"); |
99 | + var.setShp_loc_place("TIANSHUI"); | ||
100 | + var.setShp_loc_province("GANSU"); | ||
101 | var.setShp_country("CN"); | 101 | var.setShp_country("CN"); |
102 | - var.setShp_postcode("471000"); | ||
103 | - var.setShp_contact_id("TE"); | ||
104 | - var.setShp_contact_number("86037963390432"); | 102 | + var.setShp_postcode("741000"); |
105 | 103 | ||
106 | 104 | ||
107 | try { | 105 | try { |
@@ -115,15 +113,14 @@ public class FWB_804_31118511 { | @@ -115,15 +113,14 @@ public class FWB_804_31118511 { | ||
115 | 113 | ||
116 | static String FWB_CNE_TEST(){ | 114 | static String FWB_CNE_TEST(){ |
117 | FWB_CNE var = new FWB_CNE(); | 115 | FWB_CNE var = new FWB_CNE(); |
118 | - var.setCne_name("EASY TRADING CO LTD"); | 116 | + var.setCne_name("HUATIAN KOREA CORPORATION"); |
119 | // var.setShp_account_number("ABC"); | 117 | // var.setShp_account_number("ABC"); |
120 | - var.setCne_adr("201 111 BALLYONG RO DEOKJIN GU"); | ||
121 | - var.setCne_loc_place("JEONJU SI"); | 118 | + var.setCne_adr("RM 401 4TH FL 55 SEONGSUIL RO"); |
119 | + var.setCne_loc_place("SEOUL"); | ||
122 | // var.setCne_loc_province("HENAN"); | 120 | // var.setCne_loc_province("HENAN"); |
123 | var.setCne_country("KR"); | 121 | var.setCne_country("KR"); |
124 | - var.setCne_postcode("54853"); | ||
125 | - var.setCne_contact_id("TE"); | ||
126 | - var.setCne_contact_number("82637143737"); | 122 | + var.setCne_postcode("121842"); |
123 | + | ||
127 | 124 | ||
128 | 125 | ||
129 | try { | 126 | try { |
@@ -220,25 +217,27 @@ public class FWB_804_31118511 { | @@ -220,25 +217,27 @@ public class FWB_804_31118511 { | ||
220 | static String FWB_RTD_TEST(){ | 217 | static String FWB_RTD_TEST(){ |
221 | //todo:做个计费单价x计费重量 与 total 总价的对比验证 | 218 | //todo:做个计费单价x计费重量 与 total 总价的对比验证 |
222 | FWB_RTD var = new FWB_RTD(); | 219 | FWB_RTD var = new FWB_RTD(); |
223 | - var.setRtd_number_pieces("2"); | ||
224 | - var.setRtd_gross_weight("10"); | 220 | + var.setRtd_number_pieces("170"); |
221 | + var.setRtd_gross_weight("1650"); | ||
225 | var.setRtd_rate_class("Q"); | 222 | var.setRtd_rate_class("Q"); |
226 | // var.setRtd_commodity_NUM("12398"); | 223 | // var.setRtd_commodity_NUM("12398"); |
227 | - var.setRtd_charge_weight("45"); | 224 | + var.setRtd_charge_weight("1650"); |
228 | var.setRtd_rate_charge("14.32"); | 225 | var.setRtd_rate_charge("14.32"); |
229 | - var.setRtd_total("644.40"); | ||
230 | - var.setRtd_goods_DES("POLISHED SILICON WAFER"); | 226 | + var.setRtd_total("23628.00"); |
227 | + var.setRtd_goods_DES("INTEGRATED CIRCUIT"); | ||
231 | // var.setRtd_goods_consol_DES("CONSOL"); | 228 | // var.setRtd_goods_consol_DES("CONSOL"); |
232 | -// var.setRtd_goods_DIM_weightcode("W"); | ||
233 | -// var.setRtd_goods_DIM_weight("302.33"); | 229 | + |
234 | 230 | ||
235 | List<FWB_RTD_Dimension> measurement_list = new ArrayList(); | 231 | List<FWB_RTD_Dimension> measurement_list = new ArrayList(); |
236 | - measurement_list.add(new FWB_RTD_Dimension("136.73","47-42-26/4")); | ||
237 | - measurement_list.add(new FWB_RTD_Dimension("22.08","27-33-44/1")); | 232 | + measurement_list.add(new FWB_RTD_Dimension("","34-40-29/36")); |
233 | + measurement_list.add(new FWB_RTD_Dimension("","36-36-22/66")); | ||
234 | + measurement_list.add(new FWB_RTD_Dimension("","36-43-37/19")); | ||
235 | + measurement_list.add(new FWB_RTD_Dimension("","58-28-20/48")); | ||
236 | + measurement_list.add(new FWB_RTD_Dimension("","56-27-15/1")); | ||
238 | var.setDimensions(measurement_list); | 237 | var.setDimensions(measurement_list); |
239 | 238 | ||
240 | var.setRtd_volume_code("MC"); | 239 | var.setRtd_volume_code("MC"); |
241 | - var.setRtd_volume("0.10"); | 240 | + var.setRtd_volume("5.97"); |
242 | try { | 241 | try { |
243 | String nodeText = var.getFWBNodeText() ; | 242 | String nodeText = var.getFWBNodeText() ; |
244 | return nodeText; | 243 | return nodeText; |
@@ -264,12 +263,12 @@ public class FWB_804_31118511 { | @@ -264,12 +263,12 @@ public class FWB_804_31118511 { | ||
264 | static String FWB_PPD_TEST(){ | 263 | static String FWB_PPD_TEST(){ |
265 | //todo:做个计费单价x计费重量 与 total 总价的对比验证 | 264 | //todo:做个计费单价x计费重量 与 total 总价的对比验证 |
266 | FWB_PPD var = new FWB_PPD(); | 265 | FWB_PPD var = new FWB_PPD(); |
267 | - var.setPpd_weight_amount("1"); | ||
268 | - var.setPpd_valuation_amount("2"); | ||
269 | - var.setPpd_taxes_amount("3"); | ||
270 | - var.setPpd_other_charges_due_agent("4"); | ||
271 | - var.setPpd_other_charges_due_carrier("5"); | ||
272 | - var.setPpd_charge_summary_total("6"); | 266 | + var.setPpd_weight_amount("23628.00"); |
267 | +// var.setPpd_valuation_amount("2"); | ||
268 | +// var.setPpd_taxes_amount("3"); | ||
269 | +// var.setPpd_other_charges_due_agent("4"); | ||
270 | +// var.setPpd_other_charges_due_carrier("5"); | ||
271 | + var.setPpd_charge_summary_total("23628.00"); | ||
273 | 272 | ||
274 | try { | 273 | try { |
275 | String nodeText = var.getFWBNodeText() ; | 274 | String nodeText = var.getFWBNodeText() ; |
@@ -282,7 +281,7 @@ public class FWB_804_31118511 { | @@ -282,7 +281,7 @@ public class FWB_804_31118511 { | ||
282 | 281 | ||
283 | static String FWB_CER_TEST(){ | 282 | static String FWB_CER_TEST(){ |
284 | FWB_CER var = new FWB_CER(); | 283 | FWB_CER var = new FWB_CER(); |
285 | - var.setCer_signature("ZHENGZHOU NAVITRANS"); | 284 | + var.setCer_signature("KERRY EAS LOGISTICS"); |
286 | 285 | ||
287 | 286 | ||
288 | try { | 287 | try { |
@@ -296,7 +295,7 @@ public class FWB_804_31118511 { | @@ -296,7 +295,7 @@ public class FWB_804_31118511 { | ||
296 | 295 | ||
297 | static String FWB_ISU_TEST(){ | 296 | static String FWB_ISU_TEST(){ |
298 | FWB_ISU var = new FWB_ISU(); | 297 | FWB_ISU var = new FWB_ISU(); |
299 | - var.setIsu_day_mounth_year("12JUL23"); | 298 | + var.setIsu_day_mounth_year("14JUL23"); |
300 | var.setIsu_place_or_airport_code("ZHENGZHOU"); | 299 | var.setIsu_place_or_airport_code("ZHENGZHOU"); |
301 | // var.setIsu_signature("JUNWEI WANG"); | 300 | // var.setIsu_signature("JUNWEI WANG"); |
302 | 301 | ||
@@ -333,24 +332,24 @@ public class FWB_804_31118511 { | @@ -333,24 +332,24 @@ public class FWB_804_31118511 { | ||
333 | 332 | ||
334 | FWB_OCI var = new FWB_OCI(); | 333 | FWB_OCI var = new FWB_OCI(); |
335 | var.setOci_csrc_id("T"); | 334 | var.setOci_csrc_id("T"); |
336 | - var.setOci_csrc_info("USCI91410300623912049A"); | 335 | + var.setOci_csrc_info("USCI91620500756558610D"); |
337 | var.setOci_country_code("CN"); | 336 | var.setOci_country_code("CN"); |
338 | var.setOci_information_id("SHP"); | 337 | var.setOci_information_id("SHP"); |
339 | 338 | ||
340 | - FWB_OCI var_CP = new FWB_OCI(); | ||
341 | - var_CP.setOci_csrc_id("CP"); | ||
342 | - var_CP.setOci_csrc_info("LI"); | ||
343 | - var_CP.setOci_country_code("CN"); | ||
344 | - var_CP.setOci_information_id("SHP"); | 339 | +// FWB_OCI var_CP = new FWB_OCI(); |
340 | +// var_CP.setOci_csrc_id("CP"); | ||
341 | +// var_CP.setOci_csrc_info("BRUCE LI"); | ||
342 | +// var_CP.setOci_country_code("CN"); | ||
343 | +// var_CP.setOci_information_id("SHP"); | ||
345 | 344 | ||
346 | FWB_OCI var_CT = new FWB_OCI(); | 345 | FWB_OCI var_CT = new FWB_OCI(); |
347 | - var_CT.setOci_csrc_id("CT"); | ||
348 | - var_CT.setOci_csrc_info("12384511"); | ||
349 | - var_CT.setOci_country_code("CN"); | ||
350 | - var_CT.setOci_information_id("SHP"); | 346 | + var_CT.setOci_csrc_id("T"); |
347 | + var_CT.setOci_csrc_info("CRN546 88 00805"); | ||
348 | + var_CT.setOci_country_code("KR"); | ||
349 | + var_CT.setOci_information_id("CNE"); | ||
351 | 350 | ||
352 | ociList.add(var); | 351 | ociList.add(var); |
353 | - ociList.add(var_CP); | 352 | +// ociList.add(var_CP); |
354 | ociList.add(var_CT); | 353 | ociList.add(var_CT); |
355 | 354 | ||
356 | try { | 355 | try { |
src/test/java/FWB_TEST.java
0 → 100644
1 | + | ||
2 | +import com.sunyo.wlpt.base.model.efreight.fwb.*; | ||
3 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
4 | + | ||
5 | +import java.util.ArrayList; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public class FWB_TEST { | ||
9 | + public static void main(String[] args) { | ||
10 | + | ||
11 | + FWB fwb = new FWB(); | ||
12 | + fwb.bill= new FWB_Bill("16", | ||
13 | + "804-31118636", | ||
14 | + "CGO", | ||
15 | + "ICN", | ||
16 | + "22", | ||
17 | + "1540.0", | ||
18 | + "K", | ||
19 | + "8.37", | ||
20 | + "MC", | ||
21 | + "", | ||
22 | + ""); | ||
23 | + | ||
24 | + fwb.flt = new FWB_FLT("CF","221","18"); | ||
25 | + fwb.rtg = new FWB_RTG("ICN","CF"); | ||
26 | + | ||
27 | + //发货人 | ||
28 | + List<SHP_CNE_CONTACT> shp_contacts = new ArrayList<SHP_CNE_CONTACT>(); | ||
29 | + SHP_CNE_CONTACT shp_cne_te = new SHP_CNE_CONTACT("TE","008637155528940"); | ||
30 | + SHP_CNE_CONTACT shp_cne_fx = new SHP_CNE_CONTACT("FX","86037761367800"); | ||
31 | + shp_contacts.add(shp_cne_te); | ||
32 | +// shp_contacts.add(shp_cne_fx); | ||
33 | + | ||
34 | + | ||
35 | + fwb.shp = new FWB_SHP("KERRY EAS LOGISTICS LIMITED", | ||
36 | + "KERRY LOGISTICS PARK 500M EAST", | ||
37 | + "ZHENGZHOU", | ||
38 | + "HENAN", | ||
39 | + "CN", | ||
40 | + "450000", | ||
41 | + shp_contacts); | ||
42 | + | ||
43 | + //收货人 | ||
44 | + List<SHP_CNE_CONTACT> cne_contacts = new ArrayList<SHP_CNE_CONTACT>(); | ||
45 | + SHP_CNE_CONTACT cne_cne_te = new SHP_CNE_CONTACT("TE","82312703625"); | ||
46 | + SHP_CNE_CONTACT cne_cne_fx = new SHP_CNE_CONTACT("FX","82312703671"); | ||
47 | + cne_contacts.add(cne_cne_te); | ||
48 | + cne_contacts.add(cne_cne_fx); | ||
49 | + | ||
50 | + | ||
51 | + fwb.cne = new FWB_CNE("SAMSUNG ELECTRONICS LOGITECH", | ||
52 | + "416 MAETAN-DONG YOUNGTONG-GU", | ||
53 | + "SUWON", | ||
54 | + "", | ||
55 | + "KR", | ||
56 | + "", | ||
57 | + cne_contacts); | ||
58 | + | ||
59 | + fwb.agt = new FWB_AGT(); | ||
60 | + fwb.ssr= new FWB_SSR(); | ||
61 | + fwb.nfy = new FWB_NFY(); | ||
62 | + | ||
63 | + //ACC | ||
64 | + FWB_ACC fwb_acc = new FWB_ACC("GEN","FREIGHT PREPAID"); | ||
65 | + List<FWB_ACC> accList = new ArrayList<FWB_ACC>(); | ||
66 | + accList.add(fwb_acc); | ||
67 | + fwb.acc = accList; | ||
68 | + | ||
69 | + fwb.cvd = new FWB_CVD("CNY", | ||
70 | + "", | ||
71 | + "PP", | ||
72 | + "NVD", | ||
73 | + "NCV", | ||
74 | + "XXX"); | ||
75 | + | ||
76 | + | ||
77 | + //货物计费信息 | ||
78 | + List<FWB_RTD_Dimension> dimensions = new ArrayList<FWB_RTD_Dimension>(); | ||
79 | + FWB_RTD_Dimension dimension_1 = new FWB_RTD_Dimension("33-33-33/13"); | ||
80 | + FWB_RTD_Dimension dimension_2 = new FWB_RTD_Dimension("51-37-22/2"); | ||
81 | + FWB_RTD_Dimension dimension_3 = new FWB_RTD_Dimension("110-110-83/1"); | ||
82 | + FWB_RTD_Dimension dimension_4 = new FWB_RTD_Dimension("110-110-106/2"); | ||
83 | + FWB_RTD_Dimension dimension_5 = new FWB_RTD_Dimension("110-110-113/2"); | ||
84 | + FWB_RTD_Dimension dimension_6 = new FWB_RTD_Dimension("80-120-79/2"); | ||
85 | + dimensions.add(dimension_1); | ||
86 | + dimensions.add(dimension_2); | ||
87 | + dimensions.add(dimension_3); | ||
88 | + dimensions.add(dimension_4); | ||
89 | + dimensions.add(dimension_5); | ||
90 | + dimensions.add(dimension_6); | ||
91 | + fwb.rtd = new FWB_RTD("22", | ||
92 | + "", | ||
93 | + "1540.0", | ||
94 | + "Q", | ||
95 | + "", | ||
96 | + "1540.0", | ||
97 | + "14.32", | ||
98 | + "22052.80", | ||
99 | + "", | ||
100 | + "CONSOL", | ||
101 | + dimensions, | ||
102 | + "MC", | ||
103 | + "8.37"); | ||
104 | + | ||
105 | + fwb.oth = new FWB_OTH(); | ||
106 | + | ||
107 | + fwb.ppd = new FWB_PPD(); | ||
108 | + | ||
109 | + fwb.cer = new FWB_CER("KERRY EAS LOGISTICS"); | ||
110 | + | ||
111 | + fwb.isu = new FWB_ISU("17JUL23", | ||
112 | + "ZHENGZHOU", | ||
113 | + ""); | ||
114 | + | ||
115 | + fwb.osi = new ArrayList<FWB_OSI>(); | ||
116 | + | ||
117 | + fwb.ref=new FWB_REF("CGOFD1E"); | ||
118 | + | ||
119 | + List<FWB_OCI> fwbOciList = new ArrayList<FWB_OCI>(); | ||
120 | + FWB_OCI oci_shp_T = new FWB_OCI("CN", | ||
121 | + "SHP", | ||
122 | + "T", | ||
123 | + "USCI91410100712647021U"); | ||
124 | + fwbOciList.add(oci_shp_T); | ||
125 | + fwb.oci = fwbOciList; | ||
126 | + | ||
127 | + | ||
128 | + String fwbText = fwb.getFWBText(); | ||
129 | + System.out.println(fwbText); | ||
130 | + | ||
131 | + | ||
132 | + } | ||
133 | + | ||
134 | + | ||
135 | + | ||
136 | + | ||
137 | +} |
-
请 注册 或 登录 后发表评论