diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index 31b41ab46..48de1dd5e 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -3316,18 +3316,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } } - // 如果是孟加拉单子,把运单号变为 12位 - if("0880".equals(emisWaybillSave.getReceiveCountry()) || "0880".equals(emisWaybillSave.getSendCountry())){ - if(emisWaybillSave.getBillCode().length()==14 && emisWaybillSave.getBillCode().startsWith("T7080")){ - String str =emisWaybillSave.getBillCode(); - String prefix=str.substring(0,6); - String other = str.substring(8); - - String billCode=prefix+other; + // - 收件国家为 孟加拉:把运单号变为 12 位 + // - 发件国家为 孟加拉:运单号 去除前缀 'T' + String billCodeRaw = emisWaybillSave.getBillCode(); + if (billCodeRaw != null && billCodeRaw.length() == 14 && billCodeRaw.startsWith("T7080")) { + if ("0880".equals(emisWaybillSave.getReceiveCountry())) { + String prefix = billCodeRaw.substring(0, 6); + String other = billCodeRaw.substring(8); + String billCode = prefix + other; emisWaybillSave.setBillCode(billCode); - + } else if ("0880".equals(emisWaybillSave.getSendCountry())) { + emisWaybillSave.setBillCode(billCodeRaw.substring(1)); } - } // 设定为业务开单 @@ -3578,18 +3578,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb // 设定为客户下单,下单时间为当前时间 this.resetOmsWaybillData(emisWaybillSave); - // 如果是孟加拉单子,把运单号变为 12位 - if("0880".equals(emisWaybillSave.getReceiveCountry()) || "0880".equals(emisWaybillSave.getSendCountry())){ - if(emisWaybillSave.getBillCode().length()==14 && emisWaybillSave.getBillCode().startsWith("T7080")){ - String str =emisWaybillSave.getBillCode(); - String prefix=str.substring(0,6); - String other = str.substring(8); - - String billCode=prefix+other; + // - 收件国家为 孟加拉:把运单号变为 12 位 + // - 发件国家为 孟加拉:运单号 去除前缀 'T' + String billCodeRaw = emisWaybillSave.getBillCode(); + if (billCodeRaw != null && billCodeRaw.length() == 14 && billCodeRaw.startsWith("T7080")) { + if ("0880".equals(emisWaybillSave.getReceiveCountry())) { + String prefix = billCodeRaw.substring(0, 6); + String other = billCodeRaw.substring(8); + String billCode = prefix + other; emisWaybillSave.setBillCode(billCode); - + } else if ("0880".equals(emisWaybillSave.getSendCountry())) { + emisWaybillSave.setBillCode(billCodeRaw.substring(1)); } - } // 公共计算部分 @@ -3770,18 +3770,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb */ private void addNewWaybillByApi(EmisWaybill emisWaybillSave) throws EmisBizError { - // 如果是孟加拉单子,把运单号变为 12位 - if("0880".equals(emisWaybillSave.getReceiveCountry()) || "0880".equals(emisWaybillSave.getSendCountry())){ - if(emisWaybillSave.getBillCode().length()==14 && emisWaybillSave.getBillCode().startsWith("T7080")){ - String str =emisWaybillSave.getBillCode(); - String prefix=str.substring(0,6); - String other = str.substring(8); - - String billCode=prefix+other; + // - 收件国家为 孟加拉:把运单号变为 12 位 + // - 发件国家为 孟加拉:运单号 去除前缀 'T' + String billCodeRaw = emisWaybillSave.getBillCode(); + if (billCodeRaw != null && billCodeRaw.length() == 14 && billCodeRaw.startsWith("T7080")) { + if ("0880".equals(emisWaybillSave.getReceiveCountry())) { + String prefix = billCodeRaw.substring(0, 6); + String other = billCodeRaw.substring(8); + String billCode = prefix + other; emisWaybillSave.setBillCode(billCode); - + } else if ("0880".equals(emisWaybillSave.getSendCountry())) { + emisWaybillSave.setBillCode(billCodeRaw.substring(1)); } - } // api 开单 @@ -5481,18 +5481,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb */ private void addNewWaybillByExternal(EmisWaybill emisWaybillSave) throws EmisBizError { - // 如果是孟加拉单子,把运单号变为 12位 - if("0880".equals(emisWaybillSave.getReceiveCountry()) || "0880".equals(emisWaybillSave.getSendCountry())){ - if(emisWaybillSave.getBillCode().length()==14 && emisWaybillSave.getBillCode().startsWith("T7080")){ - String str =emisWaybillSave.getBillCode(); - String prefix=str.substring(0,6); - String other = str.substring(8); - - String billCode=prefix+other; + // - 收件国家为 孟加拉:把运单号变为 12 位 + // - 发件国家为 孟加拉:运单号 去除前缀 'T' + String billCodeRaw = emisWaybillSave.getBillCode(); + if (billCodeRaw != null && billCodeRaw.length() == 14 && billCodeRaw.startsWith("T7080")) { + if ("0880".equals(emisWaybillSave.getReceiveCountry())) { + String prefix = billCodeRaw.substring(0, 6); + String other = billCodeRaw.substring(8); + String billCode = prefix + other; emisWaybillSave.setBillCode(billCode); - + } else if ("0880".equals(emisWaybillSave.getSendCountry())) { + emisWaybillSave.setBillCode(billCodeRaw.substring(1)); } - } // 设定为客户下单,下单时间为当前时间