作者 朱兆平

部分报文格式生成及验证

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 * CER 11 * CER
5 * Shipper's Certification 12 * Shipper's Certification
@@ -10,7 +17,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; @@ -10,7 +17,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb;
10 * CER/ZHENGZHOU NAVITRANS 17 * CER/ZHENGZHOU NAVITRANS
11 * CRLF 18 * CRLF
12 */ 19 */
13 -public class FWB_CER { 20 +public class FWB_CER extends BASE implements FWB_BASE{
14 21
15 /** 22 /**
16 * NODE:CER 23 * NODE:CER
@@ -22,4 +29,42 @@ public class FWB_CER { @@ -22,4 +29,42 @@ public class FWB_CER {
22 * CER/ZHENGZHOU NAVITRANS 29 * CER/ZHENGZHOU NAVITRANS
23 */ 30 */
24 private String cer_signature; 31 private String cer_signature;
  32 +
  33 + public String getCer_signature() throws FWBException {
  34 +
  35 + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,20}$";
  36 + Pattern pattern = Pattern.compile(patternStr);
  37 + Matcher matcher = pattern.matcher(cer_signature);
  38 + if (!matcher.find()){
  39 + throw new FWBException(FWBExceptionType.CER_ERROR);
  40 + }
  41 + return cer_signature;
  42 + }
  43 +
  44 + public void setCer_signature(String cer_signature) {
  45 + this.cer_signature = cer_signature;
  46 + }
  47 +
  48 + @Override
  49 + public String getFWBNodeText() throws FWBException {
  50 + String SPLIT_CODE = "/";
  51 + String CRLF = "\n";
  52 + StringBuilder sb = new StringBuilder("");
  53 +
  54 + if (hasText(cer_signature)){
  55 + sb.append(getNodeName()).append(SPLIT_CODE).append(getCer_signature());
  56 + sb.append(CRLF);
  57 + }
  58 +
  59 +
  60 +
  61 +
  62 +
  63 + return sb.toString();
  64 + }
  65 +
  66 + @Override
  67 + public String getNodeName() {
  68 + return "CER";
  69 + }
25 } 70 }
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; 3 import com.sunyo.wlpt.base.model.efreight.BASE;
5 import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; 4 import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException;
6 import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; 5 import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType;
1 package com.sunyo.wlpt.base.model.efreight.fwb; 1 package com.sunyo.wlpt.base.model.efreight.fwb;
2 2
3 3
  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 +
4 /** 11 /**
5 * ISU 12 * ISU
6 * Carrier's Execution 13 * Carrier's Execution
@@ -11,7 +18,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; @@ -11,7 +18,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb;
11 * ISU/29MAY23/ZHENGZHOU/ZHU YUAN ZHANG 18 * ISU/29MAY23/ZHENGZHOU/ZHU YUAN ZHANG
12 * CRLF 19 * CRLF
13 */ 20 */
14 -public class FWB_ISU { 21 +public class FWB_ISU extends BASE implements FWB_BASE{
15 /** 22 /**
16 * NODE:ISU 23 * NODE:ISU
17 * Day Mounth Year 24 * Day Mounth Year
@@ -45,4 +52,74 @@ public class FWB_ISU { @@ -45,4 +52,74 @@ public class FWB_ISU {
45 * ZHU YUANZHANG 52 * ZHU YUANZHANG
46 */ 53 */
47 private String isu_signature; 54 private String isu_signature;
  55 +
  56 + public String getIsu_day_mounth_year() throws FWBException {
  57 + String patternStr = "^[0-9]{2}[A-Z]{3}[0-9]{2}$";
  58 + Pattern pattern = Pattern.compile(patternStr);
  59 + Matcher matcher = pattern.matcher(isu_day_mounth_year);
  60 + if (!matcher.find()){
  61 + throw new FWBException(FWBExceptionType.ISU_DATE_ERROR);
  62 + }
  63 + return isu_day_mounth_year;
  64 + }
  65 +
  66 + public void setIsu_day_mounth_year(String isu_day_mounth_year) {
  67 + this.isu_day_mounth_year = isu_day_mounth_year;
  68 + }
  69 +
  70 + public String getIsu_place_or_airport_code() throws FWBException {
  71 + String patternStr = "^[A-Z0-9-<=/\\s\\.]{1,17}$";
  72 + Pattern pattern = Pattern.compile(patternStr);
  73 + Matcher matcher = pattern.matcher(isu_place_or_airport_code);
  74 + if (!matcher.find()){
  75 + throw new FWBException(FWBExceptionType.ISU_PLACE_ERROR);
  76 + }
  77 + return isu_place_or_airport_code;
  78 + }
  79 +
  80 + public void setIsu_place_or_airport_code(String isu_place_or_airport_code) {
  81 + this.isu_place_or_airport_code = isu_place_or_airport_code;
  82 + }
  83 +
  84 + public String getIsu_signature() throws FWBException {
  85 + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,20}$";
  86 + Pattern pattern = Pattern.compile(patternStr);
  87 + Matcher matcher = pattern.matcher(isu_signature);
  88 + if (!matcher.find()){
  89 + throw new FWBException(FWBExceptionType.ISU_SIGN_ERROR);
  90 + }
  91 + return isu_signature;
  92 + }
  93 +
  94 + public void setIsu_signature(String isu_signature) {
  95 + this.isu_signature = isu_signature;
  96 + }
  97 +
  98 + @Override
  99 + public String getFWBNodeText() throws FWBException {
  100 + String SPLIT_CODE = "/";
  101 + String CRLF = "\n";
  102 + StringBuilder sb = new StringBuilder("");
  103 +
  104 + sb.append(getNodeName())
  105 + .append(SPLIT_CODE).append(getIsu_day_mounth_year())
  106 + .append(SPLIT_CODE).append(getIsu_place_or_airport_code());
  107 +
  108 + if (hasText(isu_signature)){
  109 + sb.append(SPLIT_CODE).append(getIsu_signature());
  110 + }
  111 +
  112 + sb.append(CRLF);
  113 +
  114 +
  115 +
  116 +
  117 +
  118 + return sb.toString();
  119 + }
  120 +
  121 + @Override
  122 + public String getNodeName() {
  123 + return "ISU";
  124 + }
48 } 125 }
1 package com.sunyo.wlpt.base.model.efreight.fwb; 1 package com.sunyo.wlpt.base.model.efreight.fwb;
2 2
3 3
  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 +
4 /** 11 /**
5 * OSI 12 * OSI
6 * Other Service Infomation 13 * Other Service Infomation
7 * 其他服务信息 14 * 其他服务信息
8 * O (O 可选, M 必填, C 指定条件下可选) 15 * O (O 可选, M 必填, C 指定条件下可选)
9 - * 16 + * 最多三行
10 * DEMO:(括号里面的是可选项) 17 * DEMO:(括号里面的是可选项)
11 * OSI/SAY TOTAL 8 PACKAGES PLEASE NOTIFY CONSIGNEE UPON FLIGHT ARRIVAL 18 * OSI/SAY TOTAL 8 PACKAGES PLEASE NOTIFY CONSIGNEE UPON FLIGHT ARRIVAL
12 * CRLF 19 * CRLF
13 */ 20 */
14 -public class FWB_OSI { 21 +public class FWB_OSI extends BASE implements FWB_BASE{
15 22
16 /** 23 /**
17 * Parent NODE:OSI 24 * Parent NODE:OSI
@@ -27,4 +34,46 @@ public class FWB_OSI { @@ -27,4 +34,46 @@ public class FWB_OSI {
27 * /ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 16 46 34 * /ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 16 46
28 */ 35 */
29 private String osi_text; 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);
  44 + }
  45 + return osi_text;
  46 + }
  47 +
  48 + public void setOsi_text(String osi_text) {
  49 + this.osi_text = osi_text;
  50 + }
  51 +
  52 +
  53 + @Override
  54 + public String getFWBNodeText() throws FWBException {
  55 + String SPLIT_CODE = "/";
  56 + String CRLF = "\n";
  57 + StringBuilder sb = new StringBuilder("");
  58 +
  59 + if (hasText(osi_text)){
  60 + sb.append(getNodeName())
  61 + .append(SPLIT_CODE).append(getOsi_text());
  62 +
  63 +
  64 + sb.append(CRLF);
  65 + }
  66 +
  67 +
  68 +
  69 +
  70 +
  71 +
  72 + return sb.toString();
  73 + }
  74 +
  75 + @Override
  76 + public String getNodeName() {
  77 + return "OSI";
  78 + }
30 } 79 }
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 +
3 /** 6 /**
4 * PPD 7 * PPD
5 * Prepaid Charge Summary 8 * Prepaid Charge Summary
@@ -11,7 +14,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; @@ -11,7 +14,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb;
11 * /OA0/OC14/CT22227.8 14 * /OA0/OC14/CT22227.8
12 * CRLF 15 * CRLF
13 */ 16 */
14 -public class FWB_PPD { 17 +public class FWB_PPD extends BASE implements FWB_BASE{
15 18
16 /** 19 /**
17 * NODE:WT 20 * NODE:WT
@@ -20,7 +23,7 @@ public class FWB_PPD { @@ -20,7 +23,7 @@ public class FWB_PPD {
20 * [0-9\.]{0,12} 23 * [0-9\.]{0,12}
21 * O (可选节点) 24 * O (可选节点)
22 * DEMO: 25 * DEMO:
23 - * /WT/12306.99 26 + * /WT12306.99
24 */ 27 */
25 private String ppd_weight_amount; 28 private String ppd_weight_amount;
26 29
@@ -31,7 +34,7 @@ public class FWB_PPD { @@ -31,7 +34,7 @@ public class FWB_PPD {
31 * [0-9\.]{0,12} 34 * [0-9\.]{0,12}
32 * O (可选节点) 35 * O (可选节点)
33 * DEMO: 36 * DEMO:
34 - * /VC/12306.99 37 + * /VC12306.99
35 */ 38 */
36 private String ppd_valuation_amount; 39 private String ppd_valuation_amount;
37 40
@@ -79,4 +82,106 @@ public class FWB_PPD { @@ -79,4 +82,106 @@ public class FWB_PPD {
79 */ 82 */
80 private String ppd_charge_summary_total; 83 private String ppd_charge_summary_total;
81 84
  85 + public String getPpd_weight_amount() {
  86 + return ppd_weight_amount;
  87 + }
  88 +
  89 + public void setPpd_weight_amount(String ppd_weight_amount) {
  90 + this.ppd_weight_amount = ppd_weight_amount;
  91 + }
  92 +
  93 + public String getPpd_valuation_amount() {
  94 + return ppd_valuation_amount;
  95 + }
  96 +
  97 + public void setPpd_valuation_amount(String ppd_valuation_amount) {
  98 + this.ppd_valuation_amount = ppd_valuation_amount;
  99 + }
  100 +
  101 + public String getPpd_taxes_amount() {
  102 + return ppd_taxes_amount;
  103 + }
  104 +
  105 + public void setPpd_taxes_amount(String ppd_taxes_amount) {
  106 + this.ppd_taxes_amount = ppd_taxes_amount;
  107 + }
  108 +
  109 + public String getPpd_other_charges_due_agent() {
  110 + return ppd_other_charges_due_agent;
  111 + }
  112 +
  113 + public void setPpd_other_charges_due_agent(String ppd_other_charges_due_agent) {
  114 + this.ppd_other_charges_due_agent = ppd_other_charges_due_agent;
  115 + }
  116 +
  117 + public String getPpd_other_charges_due_carrier() {
  118 + return ppd_other_charges_due_carrier;
  119 + }
  120 +
  121 + public void setPpd_other_charges_due_carrier(String ppd_other_charges_due_carrier) {
  122 + this.ppd_other_charges_due_carrier = ppd_other_charges_due_carrier;
  123 + }
  124 +
  125 + public String getPpd_charge_summary_total() {
  126 + return ppd_charge_summary_total;
  127 + }
  128 +
  129 + public void setPpd_charge_summary_total(String ppd_charge_summary_total) {
  130 + this.ppd_charge_summary_total = ppd_charge_summary_total;
  131 + }
  132 +
  133 + @Override
  134 + public String getFWBNodeText() throws FWBException {
  135 + String SPLIT_CODE = "/";
  136 + String CRLF = "\n";
  137 + StringBuilder sb = new StringBuilder("");
  138 +
  139 + if (hasText(ppd_weight_amount)
  140 + || hasText(ppd_valuation_amount)
  141 + || hasText(ppd_taxes_amount)
  142 + || hasText(ppd_other_charges_due_agent)
  143 + || hasText(ppd_other_charges_due_carrier)
  144 + || hasText(ppd_charge_summary_total)
  145 + ){
  146 + sb.append(getNodeName());
  147 + if (hasText(ppd_weight_amount)
  148 + || hasText(ppd_valuation_amount)
  149 + || hasText(ppd_taxes_amount)
  150 +
  151 + ){
  152 + if (hasText(ppd_weight_amount)){
  153 + sb.append(SPLIT_CODE).append("WT").append(getPpd_weight_amount());
  154 +
  155 + }
  156 + if (hasText(ppd_valuation_amount)){
  157 + sb.append(SPLIT_CODE).append("VC").append(getPpd_valuation_amount());
  158 + }
  159 +
  160 + if (hasText(ppd_taxes_amount)){
  161 + sb.append(SPLIT_CODE).append("TX").append(getPpd_taxes_amount());
  162 + }
  163 + }
  164 + sb.append(CRLF);
  165 +
  166 + if (hasText(ppd_other_charges_due_agent)){
  167 + sb.append(SPLIT_CODE).append("OA").append(getPpd_other_charges_due_agent());
  168 + }
  169 + if (hasText(ppd_other_charges_due_carrier)){
  170 + sb.append(SPLIT_CODE).append("OC").append(getPpd_other_charges_due_carrier());
  171 + }
  172 +
  173 + sb.append(SPLIT_CODE).append("CT").append(getPpd_charge_summary_total());
  174 + sb.append(CRLF);
  175 +
  176 +
  177 + }
  178 +
  179 + return sb.toString();
  180 + }
  181 +
  182 + @Override
  183 + public String getNodeName() {
  184 + return "PPD";
  185 + }
  186 +
82 } 187 }
@@ -173,16 +173,16 @@ public class FWB_REF implements FWB_BASE{ @@ -173,16 +173,16 @@ public class FWB_REF implements FWB_BASE{
173 173
174 174
175 175
176 - if (StringUtils.hasLength(getRef_file_reference())){ 176 + if (StringUtils.hasText(getRef_file_reference())){
177 sb.append(SPLIT_CODE) 177 sb.append(SPLIT_CODE)
178 .append(getRef_file_reference()); 178 .append(getRef_file_reference());
179 }else { 179 }else {
180 sb.append(SPLIT_CODE); 180 sb.append(SPLIT_CODE);
181 } 181 }
182 182
183 - if (StringUtils.hasLength(getRef_participant_id())  
184 - && StringUtils.hasLength(getRef_participant_code())  
185 - && StringUtils.hasLength(getRef_participant_airport()) 183 + if (StringUtils.hasText(getRef_participant_id())
  184 + && StringUtils.hasText(getRef_participant_code())
  185 + && StringUtils.hasText(getRef_participant_airport())
186 ){ 186 ){
187 sb.append(SPLIT_CODE) 187 sb.append(SPLIT_CODE)
188 .append(getRef_participant_id()); 188 .append(getRef_participant_id());
1 package com.sunyo.wlpt.base.model.efreight.fwb; 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 +
2 /** 6 /**
3 * RTD 7 * RTD
4 * Rate Description 8 * Rate Description
@@ -13,7 +17,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; @@ -13,7 +17,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb;
13 * /4/NV/MC0.56 17 * /4/NV/MC0.56
14 * CTLF 18 * CTLF
15 */ 19 */
16 -public class FWB_RTD { 20 +public class FWB_RTD extends BASE implements FWB_BASE{
17 /** 21 /**
18 * NODE:P 22 * NODE:P
19 * Number of Pieces 23 * Number of Pieces
@@ -106,7 +110,7 @@ public class FWB_RTD { @@ -106,7 +110,7 @@ public class FWB_RTD {
106 * DEMO: 110 * DEMO:
107 * T2334.73 111 * T2334.73
108 */ 112 */
109 - private String rtd_rate_total; 113 + private String rtd_total;
110 114
111 /** 115 /**
112 * NODE:NG 116 * NODE:NG
@@ -215,5 +219,212 @@ public class FWB_RTD { @@ -215,5 +219,212 @@ public class FWB_RTD {
215 */ 219 */
216 private String rtd_volume; 220 private String rtd_volume;
217 221
  222 + public String getRtd_number_pieces() {
  223 + return rtd_number_pieces;
  224 + }
  225 +
  226 + public void setRtd_number_pieces(String rtd_number_pieces) {
  227 + this.rtd_number_pieces = rtd_number_pieces;
  228 + }
  229 +
  230 + public String getRtd_combination_point() {
  231 + return rtd_combination_point;
  232 + }
  233 +
  234 + public void setRtd_combination_point(String rtd_combination_point) {
  235 + this.rtd_combination_point = rtd_combination_point;
  236 + }
  237 +
  238 + public String getRtd_gross_weight() {
  239 + return rtd_gross_weight;
  240 + }
  241 +
  242 + public void setRtd_gross_weight(String rtd_gross_weight) {
  243 + this.rtd_gross_weight = rtd_gross_weight;
  244 + }
  245 +
  246 + public String getRtd_rate_class() {
  247 + return rtd_rate_class;
  248 + }
  249 +
  250 + public void setRtd_rate_class(String rtd_rate_class) {
  251 + this.rtd_rate_class = rtd_rate_class;
  252 + }
  253 +
  254 + public String getRtd_commodity_NUM() {
  255 + return rtd_commodity_NUM;
  256 + }
  257 +
  258 + public void setRtd_commodity_NUM(String rtd_commodity_NUM) {
  259 + this.rtd_commodity_NUM = rtd_commodity_NUM;
  260 + }
  261 +
  262 + public String getRtd_charge_weight() {
  263 + return rtd_charge_weight;
  264 + }
  265 +
  266 + public void setRtd_charge_weight(String rtd_charge_weight) {
  267 + this.rtd_charge_weight = rtd_charge_weight;
  268 + }
  269 +
  270 + public String getRtd_rate_charge() {
  271 + return rtd_rate_charge;
  272 + }
  273 +
  274 + public void setRtd_rate_charge(String rtd_rate_charge) {
  275 + this.rtd_rate_charge = rtd_rate_charge;
  276 + }
  277 +
  278 + public String getRtd_total() {
  279 + return rtd_total;
  280 + }
  281 +
  282 + public void setRtd_total(String rtd_total) {
  283 + this.rtd_total = rtd_total;
  284 + }
  285 +
  286 + public String getRtd_goods_DES() {
  287 + return rtd_goods_DES;
  288 + }
  289 +
  290 + public void setRtd_goods_DES(String rtd_goods_DES) {
  291 + this.rtd_goods_DES = rtd_goods_DES;
  292 + }
  293 +
  294 + public String getRtd_goods_consol_DES() {
  295 + return rtd_goods_consol_DES;
  296 + }
  297 +
  298 + public void setRtd_goods_consol_DES(String rtd_goods_consol_DES) {
  299 + this.rtd_goods_consol_DES = rtd_goods_consol_DES;
  300 + }
  301 +
  302 + public String getRtd_goods_DIM_weightcode() {
  303 + return rtd_goods_DIM_weightcode;
  304 + }
  305 +
  306 + public void setRtd_goods_DIM_weightcode(String rtd_goods_DIM_weightcode) {
  307 + this.rtd_goods_DIM_weightcode = rtd_goods_DIM_weightcode;
  308 + }
  309 +
  310 + public String getRtd_goods_DIM_weight() {
  311 + return rtd_goods_DIM_weight;
  312 + }
  313 +
  314 + public void setRtd_goods_DIM_weight(String rtd_goods_DIM_weight) {
  315 + this.rtd_goods_DIM_weight = rtd_goods_DIM_weight;
  316 + }
  317 +
  318 + public String getRtd_measurement_code() {
  319 + return rtd_measurement_code;
  320 + }
  321 +
  322 + public void setRtd_measurement_code(String rtd_measurement_code) {
  323 + this.rtd_measurement_code = rtd_measurement_code;
  324 + }
  325 +
  326 + public String getRtd_measurement_info() {
  327 + return rtd_measurement_info;
  328 + }
  329 +
  330 + public void setRtd_measurement_info(String rtd_measurement_info) {
  331 + this.rtd_measurement_info = rtd_measurement_info;
  332 + }
  333 +
  334 + public String getRtd_volume_code() {
  335 + return rtd_volume_code;
  336 + }
  337 +
  338 + public void setRtd_volume_code(String rtd_volume_code) {
  339 + this.rtd_volume_code = rtd_volume_code;
  340 + }
  341 +
  342 + public String getRtd_volume() {
  343 + return rtd_volume;
  344 + }
  345 +
  346 + public void setRtd_volume(String rtd_volume) {
  347 + this.rtd_volume = rtd_volume;
  348 + }
  349 +
218 //todo: 还有NU,NS,NH,NO等信息后面完善 350 //todo: 还有NU,NS,NH,NO等信息后面完善
  351 +
  352 + @Override
  353 + public String getFWBNodeText() throws FWBException {
  354 + String SPLIT_CODE = "/";
  355 + String CRLF = "\n";
  356 + StringBuilder sb = new StringBuilder("");
  357 + Integer lineNumber = 1;
  358 +
  359 + sb.append(getNodeName()).append(SPLIT_CODE).append(lineNumber++);
  360 + ;
  361 + if (hasText(rtd_number_pieces)){
  362 + sb.append(SPLIT_CODE).append("P").append(getRtd_number_pieces());
  363 + }
  364 +
  365 + if (hasText(rtd_gross_weight)){
  366 + sb.append(SPLIT_CODE).append("K").append(getRtd_gross_weight());
  367 + }
  368 +
  369 + if (hasText(rtd_rate_class)){
  370 + sb.append(SPLIT_CODE).append("C").append(getRtd_rate_class());
  371 + }
  372 +
  373 + if (hasText(rtd_commodity_NUM)){
  374 + sb.append(SPLIT_CODE).append("S").append(getRtd_commodity_NUM());
  375 + }
  376 +
  377 + if (hasText(rtd_charge_weight)){
  378 + sb.append(SPLIT_CODE).append("W").append(getRtd_charge_weight());
  379 + }
  380 +
  381 + if (hasText(rtd_rate_charge)){
  382 + sb.append(SPLIT_CODE).append("R").append(getRtd_rate_charge());
  383 + }
  384 +
  385 + if (hasText(rtd_total)){
  386 + sb.append(SPLIT_CODE).append("T").append(getRtd_total());
  387 + }
  388 +
  389 + if (hasText(rtd_goods_DES) || hasText(rtd_goods_consol_DES)){
  390 +
  391 + sb.append(CRLF);
  392 +
  393 + if (hasText(rtd_goods_DES) && hasText(rtd_goods_consol_DES)){
  394 + sb.append(SPLIT_CODE).append("NG").append(SPLIT_CODE).append(getRtd_goods_DES());
  395 + sb.append(CRLF);
  396 + sb.append(SPLIT_CODE).append(lineNumber++).append(SPLIT_CODE)
  397 + .append("NC").append(SPLIT_CODE).append(getRtd_goods_consol_DES());
  398 +
  399 + }else if (hasText(rtd_goods_DES)){
  400 + sb.append(SPLIT_CODE).append("NG").append(SPLIT_CODE).append(getRtd_goods_DES());
  401 + }else if (hasText(rtd_goods_consol_DES)){
  402 + sb.append(SPLIT_CODE).append("NC").append(SPLIT_CODE).append(getRtd_goods_consol_DES());
  403 + }
  404 + sb.append(CRLF);
  405 + }
  406 +
  407 + if (hasText(getRtd_measurement_info())){
  408 + sb.append(SPLIT_CODE).append(lineNumber++).append(SPLIT_CODE).append("ND");
  409 + if (hasText(rtd_goods_DIM_weight)){
  410 + sb.append(getRtd_goods_DIM_weightcode()).append(getRtd_goods_DIM_weight());
  411 + }
  412 + sb.append(SPLIT_CODE);
  413 + sb.append(getRtd_measurement_code()).append(getRtd_measurement_info());
  414 + sb.append(CRLF);
  415 + }
  416 +
  417 + sb.append(SPLIT_CODE).append(lineNumber++).append(SPLIT_CODE).append("NV").append(SPLIT_CODE)
  418 + .append(getRtd_volume_code()).append(getRtd_volume());
  419 +
  420 +
  421 +
  422 + sb.append(CRLF);
  423 + return sb.toString();
  424 + }
  425 +
  426 + @Override
  427 + public String getNodeName() {
  428 + return "RTD";
  429 + }
219 } 430 }
@@ -83,6 +83,14 @@ public enum FWBExceptionType { @@ -83,6 +83,14 @@ public enum FWBExceptionType {
83 83
84 84
85 85
  86 + CER_ERROR("1613", "托运人认证签名信息格式有误"),
  87 +
  88 + ISU_DATE_ERROR("1721", "承运人的执行信息航班日期格式有误"),
  89 + ISU_PLACE_ERROR("1726", "承运人的执行信息地址格式有误"),
  90 + ISU_SIGN_ERROR("1732", "承运人的执行信息签名格式有误"),
  91 +
  92 + OSI_TEXT_ERROR("1830", "其他服务信息格式有误"),
  93 +
86 REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"), 94 REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"),
87 REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"), 95 REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"),
88 REF_SPID_REGEX_FAILD("206", "REF- Sender Participant Idenfitication RegEx Faild,缺少关联节点信息"), 96 REF_SPID_REGEX_FAILD("206", "REF- Sender Participant Idenfitication RegEx Faild,缺少关联节点信息"),
@@ -16,6 +16,7 @@ public class FWBTest { @@ -16,6 +16,7 @@ public class FWBTest {
16 + FWB_NFY_TEST() 16 + FWB_NFY_TEST()
17 + FWB_ACC_TEST() 17 + FWB_ACC_TEST()
18 + FWB_CVD_TEST() 18 + FWB_CVD_TEST()
  19 + + FWB_RTD_TEST()
19 ); 20 );
20 // REF_TEST(); 21 // REF_TEST();
21 22
@@ -183,6 +184,33 @@ public class FWBTest { @@ -183,6 +184,33 @@ public class FWBTest {
183 return ""; 184 return "";
184 } 185 }
185 186
  187 + static String FWB_RTD_TEST(){
  188 + //todo:做个计费单价x计费重量 与 total 总价的对比验证
  189 + FWB_RTD var = new FWB_RTD();
  190 + var.setRtd_number_pieces("3");
  191 + var.setRtd_gross_weight("174");
  192 + var.setRtd_rate_class("Q");
  193 +// var.setRtd_commodity_NUM("12398");
  194 + var.setRtd_charge_weight("176");
  195 +// var.setRtd_rate_charge("21.23");
  196 +// var.setRtd_total("198732.22");
  197 + var.setRtd_goods_DES("DELL COMPUTY");
  198 + var.setRtd_goods_consol_DES("CONSOLE");
  199 +// var.setRtd_goods_DIM_weightcode("W");
  200 +// var.setRtd_goods_DIM_weight("302.33");
  201 + var.setRtd_measurement_code("CMT");
  202 + var.setRtd_measurement_info("120-80-55/2");
  203 + var.setRtd_volume_code("MC");
  204 + var.setRtd_volume("27.76");
  205 + try {
  206 + String nodeText = var.getFWBNodeText() ;
  207 + return nodeText;
  208 + } catch (FWBException e) {
  209 + e.printStackTrace();
  210 + }
  211 + return "";
  212 + }
  213 +
186 214
187 static void OCI_TEST(){ 215 static void OCI_TEST(){
188 FWB_OCI fwb_oci = new FWB_OCI(); 216 FWB_OCI fwb_oci = new FWB_OCI();