wfg 1 year ago
parent
commit
bd4f15b316

+ 19 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/files/entity/FilesCenter.java

@@ -203,6 +203,25 @@ public class FilesCenter implements Serializable {
 	 */
 	@ApiModelProperty(value = "排序")
 	private Integer sort;
+
+	@ApiModelProperty(value = "发送状态,  0 未发送 1 已发送 2 发送失败")
+	private Integer sendStatus;
+
+	@ApiModelProperty(value = "发送状态,  0 未发送 1 已发送 2 发送失败")
+	private Integer sendCount;
+
+	@ApiModelProperty(value = "发送方式, FTP, EMAIL")
+	private String sendType;
+
+	@ApiModelProperty(value = "发送时间")
+	private Date sendTime;
+
+	@ApiModelProperty(value = "接收方名称")
+	private String receiverName;
+
+	@ApiModelProperty(value = "接收方地址")
+	private String receiverAddress;
+
 	/**
 	 * 是否已删除(0 否 1是)
 	 */

+ 37 - 26
blade-service/blade-los/src/main/java/org/springblade/los/Util/RegularUtils.java

@@ -38,6 +38,10 @@ public class RegularUtils {
 		return ediCode;
 	}
 
+	public static String forceEmpty(String S){
+		return ObjectUtils.isNotNull(S) ? S : "";
+	}
+
 	/**
 	 * 处理字符串中特殊字符
 	 *
@@ -156,7 +160,7 @@ public class RegularUtils {
 	 * @return 结果
 	 */
 	public static String escapeEDILine(String line) {
-		if(line.isEmpty()){
+		if(ObjectUtils.isNull(line) || line.isEmpty()){
 			return "";
 		} else {
 			return line.replaceAll("\\?", "??")
@@ -258,45 +262,52 @@ public class RegularUtils {
 	public static List<String> reformatEDIText(String rawText, int lineLen, Boolean Escape) {
 		String text = ObjectUtils.isNotNull(rawText) ?  rawText : "";
 		List<String> lines = new ArrayList<>();
+		// 去除前面的空行,保留中间的空行
 		if(!text.isEmpty()){
 			String[] buf = text.split("\n");
 			Pattern p1 = Pattern.compile("[a-zA-Z]");
 			for (String item : buf) {
 				String ln = item.trim();
-				while (!ln.isEmpty()) {
-					if (ln.length() <= lineLen) {
-						lines.add(Escape ? escapeEDILine(ln) : ln);
-						ln = "";
-					} else {
-						if (!p1.matcher(ln.charAt(lineLen) + "").matches()) {
-							if (Escape){
-								lines.add(escapeEDILine(ln.substring(0, lineLen)));
-							} else {
-								lines.add(ln.substring(0, lineLen));
-							}
-							ln = ln.substring(lineLen);
+				if(ln.isEmpty()) {
+					if(lines.size()>0) {
+						lines.add("");
+					}
+				}else {
+					while (!ln.isEmpty()) {
+						if (ln.length() <= lineLen) {
+							lines.add(Escape ? escapeEDILine(ln) : ln);
+							ln = "";
 						} else {
-							int p = -1;
-							for (int i = lineLen - 2; i >= 0; i--) {
-								if (!p1.matcher(ln.charAt(i) + "").matches()) {
-									p = i;
-									break;
-								}
-							}
-							if (p == -1) {
-								if (Escape){
+							if (!p1.matcher(ln.charAt(lineLen) + "").matches()) {
+								if (Escape) {
 									lines.add(escapeEDILine(ln.substring(0, lineLen)));
 								} else {
 									lines.add(ln.substring(0, lineLen));
 								}
 								ln = ln.substring(lineLen);
 							} else {
-								if (Escape){
-									lines.add(escapeEDILine(ln.substring(0, p + 1)));
+								int p = -1;
+								for (int i = lineLen - 2; i >= 0; i--) {
+									if (!p1.matcher(ln.charAt(i) + "").matches()) {
+										p = i;
+										break;
+									}
+								}
+								if (p == -1) {
+									if (Escape) {
+										lines.add(escapeEDILine(ln.substring(0, lineLen)));
+									} else {
+										lines.add(ln.substring(0, lineLen));
+									}
+									ln = ln.substring(lineLen);
 								} else {
-									lines.add(ln.substring(0, p + 1));
+									if (Escape) {
+										lines.add(escapeEDILine(ln.substring(0, p + 1)));
+									} else {
+										lines.add(ln.substring(0, p + 1));
+									}
+									ln = ln.substring(p + 1);
 								}
-								ln = ln.substring(p + 1);
 							}
 						}
 					}

+ 49 - 0
blade-service/blade-los/src/main/java/org/springblade/los/Util/Regular_APL.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import org.springblade.los.edi.dto.InttraSoDto;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 public class Regular_APL {
@@ -276,6 +277,54 @@ public class Regular_APL {
 			}
 		}
 
+		if (ObjectUtils.isNull(ediData.getPreCntrs())) {
+			msg += "箱型代码,";
+		} else {
+			List<Map<String, Object>> mapList = ediData.getPreCntrs();
+			for (Map<String, Object> map1 : mapList) {
+				// Double temperature = ObjectUtils.isNotNull(map1.get("temperature")) ? Double.parseDouble(map1.get("temperature").toString()) : 0;
+				//箱型代码
+				if (ObjectUtils.isNull(map1.get("sizeType").toString())) {
+					msg += "箱型代码,";
+				} else {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("sizeType").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						// ediData.setBoxCode(mapString.get("susscess"));
+					} else {
+						character += "箱型代码,";
+					}
+				}
+				//箱量
+				if (ObjectUtils.isNull(map1.get("cntrQty"))) {
+					msg += "箱量,";
+				}
+				//冷藏通风量
+				if (ObjectUtils.isNotNull(map1.get("ventilation"))) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("ventilation").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						if (RegularUtils.regularLength(mapString.get("susscess"), 18)) {
+							textLength += "冷藏通风量,";
+						} else {
+							if (mapString.get("susscess").contains(",")) {
+								special += "冷藏通风量不能出现“,”";
+							} else {
+							}
+						}
+					} else {
+						character += "冷藏通风量,";
+					}
+				}
+				//温度单位
+				if (ObjectUtils.isNotNull(map1.get("temperatureUnit").toString())) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("temperatureUnit").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+					} else {
+						character += "温度单位,";
+					}
+				}
+			}
+		}
+
 		String data = "";
 		if (ObjectUtils.isNotNull(msg)) {
 			code = 500;

+ 216 - 0
blade-service/blade-los/src/main/java/org/springblade/los/Util/Regular_ESL.java

@@ -0,0 +1,216 @@
+package org.springblade.los.Util;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import org.springblade.los.edi.dto.InttraSoDto;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Regular_ESL {
+	public static Map<String, Object> notNullEDIData_Booking(InttraSoDto ediData, String type) {
+		Map<String, Object> map = new HashMap<>();
+		int code = 200;
+		String msg = "";
+		String character = "";
+		String textLength = "";
+		String special = "";
+		if (ObjectUtils.isNull(ediData)) {
+			code = 500;
+			map.put("code", code);
+			map.put("data", "数据不能为空!");
+			return map;
+		}
+
+		//主单号
+		if (ObjectUtils.isNotNull(ediData.getMblNo())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMblNo(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 30)) {
+					textLength += "主单号,";
+				} else {
+					ediData.setMblNo(mapString.get("susscess"));
+				}
+			} else {
+				character += "提单号,";
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getCarrierArgreementNo())) {
+			msg += "船司约号,";
+		}
+
+		if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
+			String bookingRemarks = ediData.getBookingRemarks().trim();
+			if (!bookingRemarks.isEmpty()) {
+				Map<String, String> mapString = RegularUtils.regularEn(bookingRemarks, false);
+				if ("200".equals(mapString.get("code"))) {
+					ediData.setBookingRemarks(mapString.get("susscess"));
+				} else {
+					character += "订舱备注,";
+				}
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getHShipper())) {
+			msg += "发货人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHShipper(), false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHShipper(mapString.get("susscess"));
+			} else {
+				character += "发货人,";
+			}
+		}
+		//收货人
+		if (ObjectUtils.isNull(ediData.getHConsignee())) {
+			msg += "收货人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHConsignee(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHConsignee(mapString.get("susscess"));
+			} else {
+				character += "收货人,";
+			}
+		}
+		//通知人
+		if (ObjectUtils.isNull(ediData.getHNotify())) {
+			msg += "通知人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHNotify(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "通知人,";
+			}
+		}
+
+		if (ObjectUtils.isNotNull(ediData.getHNotify2())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHNotify2(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify2(mapString.get("susscess"));
+			} else {
+				character += "第二通知人,";
+			}
+		}
+
+		//包装描述
+		if (ObjectUtils.isNull(ediData.getPackagesDescribe())) {
+			msg += "包装描述,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPackagesDescribe(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 35)) {
+					textLength += "包装描述,";
+				} else {
+					ediData.setPackagesDescribe(mapString.get("susscess"));
+				}
+			} else {
+				character += "包装描述,";
+			}
+		}
+
+		if("danger".equals(ediData.getCargoType())){
+			if(ObjectUtils.isNull(ediData.getHsCode())){
+				msg += "HS CODE,";
+			}
+			if(ObjectUtils.isNull(ediData.getDgImdgCode())){
+				msg += "IMDG CODE,";
+			}
+			if(ObjectUtils.isNull(ediData.getDgUnCode())){
+				msg += "UN CODE,";
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getMarks())) {
+			msg += "唛头,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMarks(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "唛头,";
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getGoodsDesc())) {
+			msg += "货描,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getGoodsDesc(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "货描,";
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getPreCntrs())) {
+			msg += "箱型代码,";
+		} else {
+			List<Map<String, Object>> mapList = ediData.getPreCntrs();
+			for (Map<String, Object> map1 : mapList) {
+				// Double temperature = ObjectUtils.isNotNull(map1.get("temperature")) ? Double.parseDouble(map1.get("temperature").toString()) : 0;
+				//箱型代码
+				if (ObjectUtils.isNull(map1.get("sizeType").toString())) {
+					msg += "箱型代码,";
+				} else {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("sizeType").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						// ediData.setBoxCode(mapString.get("susscess"));
+					} else {
+						character += "箱型代码,";
+					}
+				}
+				//箱量
+				if (ObjectUtils.isNull(map1.get("cntrQty"))) {
+					msg += "箱量,";
+				}
+				//冷藏通风量
+				if (ObjectUtils.isNotNull(map1.get("ventilation"))) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("ventilation").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						if (RegularUtils.regularLength(mapString.get("susscess"), 18)) {
+							textLength += "冷藏通风量,";
+						} else {
+							if (mapString.get("susscess").contains(",")) {
+								special += "冷藏通风量不能出现“,”";
+							} else {
+							}
+						}
+					} else {
+						character += "冷藏通风量,";
+					}
+				}
+				//温度单位
+				if (ObjectUtils.isNotNull(map1.get("temperatureUnit").toString())) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("temperatureUnit").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+					} else {
+						character += "温度单位,";
+					}
+				}
+			}
+		}
+
+		String data = "";
+		if (ObjectUtils.isNotNull(msg)) {
+			code = 500;
+			data += "非空:" + msg;
+		}
+		if (ObjectUtils.isNotNull(character)) {
+			code = 500;
+			data += "特殊字符:" + character;
+		}
+		if (ObjectUtils.isNotNull(textLength)) {
+			code = 500;
+			data += "长度超长:" + textLength;
+		}
+		if (ObjectUtils.isNotNull(special)) {
+			code = 500;
+			data += "其他:" + special;
+		}
+		map.put("code", code);
+		map.put("data", data);
+		return map;
+	}
+}

+ 97 - 16
blade-service/blade-los/src/main/java/org/springblade/los/Util/Regular_HMM.java

@@ -220,28 +220,39 @@ public class Regular_HMM {
 			}
 		}
 
-		String text = "";
 		if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
 			String bookingRemarks = ediData.getBookingRemarks().trim();
 			if (!bookingRemarks.isEmpty()) {
-				String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
-				// 最多 5 行
-				for (int i = 0; i < bookingRemarksArr.length; i++) {
-					String line = bookingRemarksArr[i].trim();
-					if (!line.isEmpty()) {
-						if (text.isEmpty()) {
-							text = RegularUtils.escapeEDILine(line);
-						} else {
-							text += ":" + RegularUtils.escapeEDILine(line);
-						}
-					}
-					if(i == 4){
-						break;
-					}
+				Map<String, String> mapString = RegularUtils.regularEn(bookingRemarks, false);
+				if ("200".equals(mapString.get("code"))) {
+					ediData.setBookingRemarks(mapString.get("susscess"));
+				} else {
+					character += "订舱备注,";
 				}
 			}
 		}
-		ediData.setBookingRemarks(text);
+//		String text = "";
+//		if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
+//			String bookingRemarks = ediData.getBookingRemarks().trim();
+//			if (!bookingRemarks.isEmpty()) {
+//				String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
+//				// 最多 5 行
+//				for (int i = 0; i < bookingRemarksArr.length; i++) {
+//					String line = bookingRemarksArr[i].trim();
+//					if (!line.isEmpty()) {
+//						if (text.isEmpty()) {
+//							text = RegularUtils.escapeEDILine(line);
+//						} else {
+//							text += ":" + RegularUtils.escapeEDILine(line);
+//						}
+//					}
+//					if(i == 4){
+//						break;
+//					}
+//				}
+//			}
+//		}
+//		ediData.setBookingRemarks(text);
 
 		//发货人
 		if (ObjectUtils.isNull(ediData.getHShipper())) {
@@ -286,6 +297,28 @@ public class Regular_HMM {
 			}
 		}
 
+		if (ObjectUtils.isNull(ediData.getMarks())) {
+			msg += "唛头,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMarks(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "唛头,";
+			}
+		}
+
+		if (ObjectUtils.isNull(ediData.getGoodsDesc())) {
+			msg += "货描,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getGoodsDesc(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "货描,";
+			}
+		}
+
 		//包装代码
 		if (ObjectUtils.isNull(ediData.getPackagesCode())) {
 			msg += "包装代码,";
@@ -313,6 +346,54 @@ public class Regular_HMM {
 			}
 		}
 
+		if (ObjectUtils.isNull(ediData.getPreCntrs())) {
+			msg += "箱型代码,";
+		} else {
+			List<Map<String, Object>> mapList = ediData.getPreCntrs();
+			for (Map<String, Object> map1 : mapList) {
+				// Double temperature = ObjectUtils.isNotNull(map1.get("temperature")) ? Double.parseDouble(map1.get("temperature").toString()) : 0;
+				//箱型代码
+				if (ObjectUtils.isNull(map1.get("sizeType").toString())) {
+					msg += "箱型代码,";
+				} else {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("sizeType").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						// ediData.setBoxCode(mapString.get("susscess"));
+					} else {
+						character += "箱型代码,";
+					}
+				}
+				//箱量
+				if (ObjectUtils.isNull(map1.get("cntrQty"))) {
+					msg += "箱量,";
+				}
+				//冷藏通风量
+				if (ObjectUtils.isNotNull(map1.get("ventilation"))) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("ventilation").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+						if (RegularUtils.regularLength(mapString.get("susscess"), 18)) {
+							textLength += "冷藏通风量,";
+						} else {
+							if (mapString.get("susscess").contains(",")) {
+								special += "冷藏通风量不能出现“,”";
+							} else {
+							}
+						}
+					} else {
+						character += "冷藏通风量,";
+					}
+				}
+				//温度单位
+				if (ObjectUtils.isNotNull(map1.get("temperatureUnit").toString())) {
+					Map<String, String> mapString = RegularUtils.regularEn(map1.get("temperatureUnit").toString(), true);
+					if ("200".equals(mapString.get("code"))) {
+					} else {
+						character += "温度单位,";
+					}
+				}
+			}
+		}
+
 		String data = "";
 		if (ObjectUtils.isNotNull(msg)) {
 			code = 500;

+ 132 - 170
blade-service/blade-los/src/main/java/org/springblade/los/Util/Regular_INTTRA.java

@@ -32,12 +32,12 @@ public class Regular_INTTRA {
 			return map;
 		}
 		//发送方标识
-		if (ObjectUtils.isNull(ediData.getSenderIdentifying())) {
+		if (ObjectUtils.isNull(ediData.getSenderId())) {
 			msg += "发送方标识,";
 		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getSenderIdentifying(),true);
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getSenderId(),true);
 			if ("200".equals(mapString.get("code"))) {
-				ediData.setSenderIdentifying(mapString.get("susscess"));
+				ediData.setSenderId(mapString.get("susscess"));
 			} else {
 				character += "发送方标识,";
 			}
@@ -184,25 +184,46 @@ public class Regular_INTTRA {
 
 		}
 		//付款地代码
-		if (ObjectUtils.isNotNull(ediData.getPaymentLocationCode())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPaymentLocationCode(),true);
+		if (ObjectUtils.isNotNull(ediData.getHPayPlaceCode())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHPayPlaceCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				ediData.setPaymentLocationCode(mapString.get("susscess"));
+				ediData.setHPayPlaceCode(mapString.get("susscess"));
 			} else {
-				character += "付款地代码,";
+				character += "HBL 付款地代码,";
 			}
 		}
 		//付款地
-		if (ObjectUtils.isNotNull(ediData.getPaymentLand())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPaymentLand(),true);
+		if (ObjectUtils.isNotNull(ediData.getHPayPlaceName())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHPayPlaceName(),true);
 			if ("200".equals(mapString.get("code"))) {
 				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
-					textLength += "付款地,";
+					textLength += "HBL 付款地,";
 				} else {
-					ediData.setPaymentLand(mapString.get("susscess"));
+					ediData.setHPayPlaceName(mapString.get("susscess"));
 				}
 			} else {
-				character += "付款地,";
+				character += "HBL 付款地,";
+			}
+		}
+		if (ObjectUtils.isNotNull(ediData.getMPayPlaceCode())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMPayPlaceCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setMPayPlaceCode(mapString.get("susscess"));
+			} else {
+				character += "MBL 付款地代码,";
+			}
+		}
+		//付款地
+		if (ObjectUtils.isNotNull(ediData.getMPayPlaceName())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMPayPlaceName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "MBL 付款地,";
+				} else {
+					ediData.setMPayPlaceName(mapString.get("susscess"));
+				}
+			} else {
+				character += "MBL 付款地,";
 			}
 		}
 		//提单签发地代码
@@ -284,65 +305,12 @@ public class Regular_INTTRA {
 				character += (type=="SO" ? "主拼号" : "特殊编号") + ",";
 			}
 		}
-		//订单号
-		if (ObjectUtils.isNotNull(ediData.getOrderNo())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getOrderNo(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (RegularUtils.regularLength(mapString.get("susscess"), 30)) {
-					textLength += "订单号,";
-				} else {
-					ediData.setOrderNo(mapString.get("susscess"));
-				}
-			} else {
-				character += "订单号,";
-			}
-		}
-		//货代工作编号
-		if (ObjectUtils.isNotNull(ediData.getJobId())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getJobId(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (RegularUtils.regularLength(mapString.get("susscess"), 30)) {
-					textLength += "货代工作编号,";
-				} else {
-					ediData.setJobId(mapString.get("susscess"));
-				}
-			} else {
-				character += "货代工作编号,";
-			}
-		}
 		//付款方式代码
-		if (ObjectUtils.isNull(ediData.getPaymentType())) {
-			msg += "付款方式代码,";
-		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPaymentType(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
-					textLength += "付款方式代码,";
-				} else {
-					ediData.setPaymentType(mapString.get("susscess"));
-				}
-			} else {
-				character += "付款方式代码,";
-			}
+		if (ObjectUtils.isNull(ediData.getHPayMode())) {
+			msg += "HBL 付款方式代码,";
 		}
-		//航次
-		if (ObjectUtils.isNull(ediData.getVoyageNo())) {
-			msg += "航次,";
-		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getVoyageNo(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (RegularUtils.regularLength(mapString.get("susscess"), 17)) {
-					textLength += "航次,";
-				} else {
-					if (mapString.get("susscess").contains("V.")) {
-						special += "航次不能有“V.”,";
-					} else {
-						ediData.setVoyageNo(mapString.get("susscess"));
-					}
-				}
-			} else {
-				character += "航次,";
-			}
+		if (ObjectUtils.isNull(ediData.getMPayMode())) {
+			msg += "MBL 付款方式代码,";
 		}
 		if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
 			Map<String, String> mapString = RegularUtils.regularEn(ediData.getBookingRemarks(),false);
@@ -365,57 +333,37 @@ public class Regular_INTTRA {
 					// 赫伯罗特 或者 达飞
 					String CC = mapString.get("susscess");
 					if ("HLCU".equals(CC) || "CMDU".equals(CC) || "ANNU".equals(CC) || "CHNL".equals(CC) || "MAEU".equals(CC)) {
-						String text = "";
-						if (ObjectUtils.isNotNull(ediData.getMblNo())) {
-							text += ediData.getMblNo() + ";";
-						} else {
-							text += ";";
-						}
-						if (ObjectUtils.isNotNull(ediData.getPaymentType())) {
-							if ("PP".equals(ediData.getPaymentType())) {
-								text += "FREIGHT PREPAID;";
-							} else if ("CC".equals(ediData.getPaymentType())) {
-								text += "FREIGHT COLLECT;";
+						String text = ObjectUtils.isNotNull(ediData.getMblNo()) ? ediData.getMblNo() : "";
+						if (ObjectUtils.isNotNull(ediData.getMPayMode())) {
+							if ("PP".equals(ediData.getMPayMode())) {
+								text += ";FREIGHT PREPAID";
+							} else if ("CC".equals(ediData.getMPayMode())) {
+								text += ";FREIGHT COLLECT";
 							} else {
-								if (ObjectUtils.isNull(ediData.getPaymentLand())) {
-									msg += "付款地,";
+								if (ObjectUtils.isNull(ediData.getMPayPlaceName())) {
+									msg += "MBL 付款地,";
 								} else {
-									text += "FREIGHT PAYABLE AT " + ediData.getPaymentLand() + ";";
+									text += ";FREIGHT PAYABLE AT " + RegularUtils.escapeEDILine(ediData.getMPayPlaceName());
 								}
 							}
 						} else {
 							text += ";";
 						}
-						if (ObjectUtils.isNotNull(ediData.getTransportTermName())) {
-							text += ediData.getTransportTermName() + ";";
-						} else {
-							text += ";";
-						}
-						if (ObjectUtils.isNotNull(ediData.getCorpArgreementNo())) {
-							text += ediData.getCorpArgreementNo() + ";";
-						} else {
-							text += ";";
-						}
+						text += ";" + RegularUtils.forceEmpty(ediData.getTransportTermName());
+						text += ";" + RegularUtils.forceEmpty(ediData.getCorpArgreementNo());
 						if (ObjectUtils.isNotNull(ediData.getPlaceDeliveryName())) {
-							text += ediData.getPlaceDeliveryName() + ";";
+							text += ";" + RegularUtils.escapeEDILine(ediData.getPlaceDeliveryName());
 						} else {
-							text += ediData.getPlaceReceiptName() + ";";
+							text += ";" + RegularUtils.escapeEDILine(ediData.getPlaceDestinationName());
 						}
 						if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
 							String bookingRemarks = ediData.getBookingRemarks().trim();
 							if (!bookingRemarks.isEmpty()) {
 								String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
-								// text += String.join((CharSequence) ",", Arrays.stream(bookingRemarksArr).filter(a->!a.trim().isEmpty()));
-								Boolean firstLine = true;
 								for (int i = 0; i < bookingRemarksArr.length; i++) {
 									String line = bookingRemarksArr[i].trim();
 									if (!line.isEmpty()) {
-										if (firstLine) {
-											text += RegularUtils.escapeEDILine(line);
-											firstLine = false;
-										} else {
-											text += ";" + RegularUtils.escapeEDILine(line);
-										}
+										text += ";" + RegularUtils.escapeEDILine(line);
 									}
 								}
 							}
@@ -424,16 +372,16 @@ public class Regular_INTTRA {
 					} else if ("MCCQ".equals(CC)) {
 						// 马士基
 						String text = "";
-						if (ObjectUtils.isNotNull(ediData.getPaymentType())) {
-							if ("PP".equals(ediData.getPaymentType())) {
-								text += "FREIGHT PREPAID;";
-							} else if ("CC".equals(ediData.getPaymentType())) {
-								text += "FREIGHT COLLECT;";
+						if (ObjectUtils.isNotNull(ediData.getMPayMode())) {
+							if ("PP".equals(ediData.getMPayMode())) {
+								text += ";FREIGHT PREPAID";
+							} else if ("CC".equals(ediData.getMPayMode())) {
+								text += ";FREIGHT COLLECT";
 							} else {
-								if (ObjectUtils.isNull(ediData.getPaymentLand())) {
+								if (ObjectUtils.isNull(ediData.getMPayPlaceName())) {
 									msg += "付款地,";
 								} else {
-									text += "FREIGHT PAYABLE AT " + ediData.getPaymentLand() + ";";
+									text += ";FREIGHT PAYABLE AT " + ediData.getMPayPlaceName();
 								}
 							}
 						}
@@ -450,16 +398,10 @@ public class Regular_INTTRA {
 							if (!bookingRemarks.isEmpty()) {
 								String[] bookingRemarksArr = bookingRemarks.replaceAll("\r", "").split("\n");
 								// text += String.join((CharSequence) ",", Arrays.stream(bookingRemarksArr).filter(a->!a.trim().isEmpty()));
-								Boolean firstLine = true;
 								for (int i = 0; i < bookingRemarksArr.length; i++) {
 									String line = bookingRemarksArr[i].trim();
 									if (!line.isEmpty()) {
-										if (firstLine) {
-											text += RegularUtils.escapeEDILine(line);
-											firstLine = false;
-										} else {
-											text += ";" + RegularUtils.escapeEDILine(line);
-										}
+										text += ";" + RegularUtils.escapeEDILine(line);
 									}
 								}
 							}
@@ -468,21 +410,6 @@ public class Regular_INTTRA {
 					} else {
 						// 其他船公司不写
 						ediData.setBookingRemarks("");
-						//备注
-//					if (ObjectUtils.isNull(ediData.getBookingRemarks())) {
-//						msg += "备注,";
-//					} else {
-//						Map<String, String> mapString1 = regularEn(ediData.getBookingRemarks(),false);
-//						if ("200".equals(mapString1.get("code"))) {
-//							if (regularLength(mapString1.get("susscess"), 512)) {
-//								textLength += "备注,";
-//							} else {
-//								ediData.setBookingRemarks(mapString1.get("susscess"));
-//							}
-//						} else {
-//							character += "备注,";
-//						}
-//					}
 					}
 				}
 
@@ -494,6 +421,9 @@ public class Regular_INTTRA {
 				character += "船司代码,";
 			}
 		}
+
+		// ediData.getVesselCode()
+
 		//船名
 		if (ObjectUtils.isNull(ediData.getVesselName())) {
 			msg += "船名,";
@@ -509,6 +439,38 @@ public class Regular_INTTRA {
 				character += "船名,";
 			}
 		}
+		//航次
+		if (ObjectUtils.isNull(ediData.getVoyageNo())) {
+			msg += "航次,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getVoyageNo(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 17)) {
+					textLength += "航次,";
+				} else {
+					if (mapString.get("susscess").contains("V.")) {
+						special += "航次不能有“V.”,";
+					} else {
+						ediData.setVoyageNo(mapString.get("susscess"));
+					}
+				}
+			} else {
+				character += "航次,";
+			}
+		}
+		//航次
+		if (ObjectUtils.isNull(ediData.getEtd())) {
+			if("MAEU".equals(ediData.getCarrierCode())) {
+				msg += "ETD,";
+			}
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getVoyageNo(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setEtd(mapString.get("susscess"));
+			} else {
+				character += "ETD,";
+			}
+		}
 		//装货港代码
 		if (ObjectUtils.isNull(ediData.getPolCode())) {
 			msg += "装货港代码,";
@@ -661,10 +623,13 @@ public class Regular_INTTRA {
 		if (ObjectUtils.isNull(ediData.getCarrierName())) {
 			msg += "船司名称,";
 		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getCarrierName(),true);
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getCarrierName(),false);
 			if ("200".equals(mapString.get("code"))) {
 				String S = mapString.get("susscess");
-				ediData.setCarrierName(S.substring(0, S.length()));
+				if(S.length()>35){
+					S = S.substring(0, S.length());
+				}
+				ediData.setCarrierName(RegularUtils.escapeEDILine(S));
 			} else {
 				character += "船司名称,";
 			}
@@ -682,32 +647,44 @@ public class Regular_INTTRA {
 				character += "联系信息,";
 			}
 		}
-		//联系人
-		if (ObjectUtils.isNotNull(ediData.getContacts())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getContacts(),true);
+		//INTTRA UCA 联系人
+		if (ObjectUtils.isNotNull(ediData.getInttraUCAContacts())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getInttraUCAContacts(),true);
 			if ("200".equals(mapString.get("code"))) {
 				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
-					textLength += "联系人,";
+					textLength += "INTTRA UCA 联系人,";
 				} else {
-					ediData.setContacts(mapString.get("susscess"));
+					ediData.setInttraUCAContacts(mapString.get("susscess"));
 				}
 			} else {
-				character += "联系人,";
+				character += "INTTRA UCA 联系人,";
 			}
 		}
-		//联系邮箱
-		if (ObjectUtils.isNotNull(ediData.getAttnEmail())) {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getAttnEmail(),true);
+
+		//INTTRA UCA 联系邮箱
+		if (ObjectUtils.isNotNull(ediData.getInttraUCAEmail())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getInttraUCAEmail(),true);
 			if ("200".equals(mapString.get("code"))) {
 				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
-					textLength += "联系邮箱,";
+					textLength += "INTTRA UCA 联系邮箱,";
 				} else {
-					ediData.setAttnEmail(mapString.get("susscess"));
+					ediData.setInttraUCAEmail(mapString.get("susscess"));
 				}
 			} else {
-				character += "联系邮箱,";
+				character += "INTTRA UCA 联系邮箱,";
 			}
 		}
+
+		if("IUCA".equals(ediData.getCarrierCode())) {
+			if (ObjectUtils.isNull(ediData.getInttraUCAContacts())) {
+				msg += "INTTRA UAC 合伙人英文联系人,";
+			}
+
+			if (ObjectUtils.isNull(ediData.getInttraUCAEmail())) {
+				msg += "INTTRA UAC 合伙人联系邮箱,";
+			}
+		}
+
 		//TO DOOR 联系信息
 		if(ediData.isToDoorServiceTerm()) {
 			if (ObjectUtils.isNotNull(ediData.getInttraToDoorName())) {
@@ -809,23 +786,23 @@ public class Regular_INTTRA {
 			}
 		}
 		//货代代码
-		if (ObjectUtils.isNull(ediData.getFreightForwarderCode())) {
+		if (ObjectUtils.isNull(ediData.getForwarderCode())) {
 			msg += "货代代码,";
 		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getFreightForwarderCode(),true);
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getForwarderCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				ediData.setFreightForwarderCode(mapString.get("susscess"));
+				ediData.setForwarderCode(mapString.get("susscess"));
 			} else {
 				character += "货代代码,";
 			}
 		}
 		//货代称呼
-		if (ObjectUtils.isNull(ediData.getFreightForwarderName())) {
+		if (ObjectUtils.isNull(ediData.getForwarderName())) {
 			// msg += "货代称呼,";
 		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getFreightForwarderName(),true);
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getForwarderName(),true);
 			if ("200".equals(mapString.get("code"))) {
-				ediData.setFreightForwarderName(mapString.get("susscess"));
+				ediData.setForwarderName(mapString.get("susscess"));
 			} else {
 				character += "货代称呼,";
 			}
@@ -1037,10 +1014,10 @@ public class Regular_INTTRA {
 //				}
 			}
 			//包装组别
-			if (ObjectUtils.isNull(ediData.getPackingGroup())) {
-				ediData.setPackingGroup("0");
+			if (ObjectUtils.isNull(ediData.getDgPackingLevel())) {
+				ediData.setDgPackingLevel("0");
 			}
-			if(!"0".equals(ediData.getPackingGroup())){
+			if(!"0".equals(ediData.getDgPackingLevel())){
 				if(ObjectUtils.isNull(ediData.getDgFlashPoint())){
 					msg += "闪点,";
 				}
@@ -1232,21 +1209,6 @@ public class Regular_INTTRA {
 				character += "信息编号,";
 			}
 		}
-		//文件交换编号
-		if (ObjectUtils.isNull(ediData.getFileExchangeNumberEnd())) {
-			msg += "文件交换编号,";
-		} else {
-			Map<String, String> mapString = RegularUtils.regularEn(ediData.getFileExchangeNumberEnd(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (RegularUtils.regularLength(mapString.get("susscess"), 14)) {
-					textLength += "文件交换编号,";
-				} else {
-					ediData.setFileExchangeNumberEnd(mapString.get("susscess"));
-				}
-			} else {
-				character += "文件交换编号,";
-			}
-		}
 		//记录行数
 		if (ObjectUtils.isNull(ediData.getRecordRows())) {
 			msg += "记录行数,";

+ 482 - 0
blade-service/blade-los/src/main/java/org/springblade/los/Util/Regular_SML.java

@@ -0,0 +1,482 @@
+package org.springblade.los.Util;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import org.springblade.los.edi.dto.InttraSoDto;
+
+import java.math.RoundingMode;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Regular_SML {
+	public static Map<String, Object> notNullEDIData_Booking(InttraSoDto ediData, String type) {
+		Map<String, Object> map = new HashMap<>();
+		int code = 200;
+		String msg = "";
+		String character = "";
+		String textLength = "";
+		String special = "";
+		if (ObjectUtils.isNull(ediData)) {
+			code = 500;
+			map.put("code", code);
+			map.put("data", "数据不能为空!");
+			return map;
+		}
+
+		//主单号
+		if (ObjectUtils.isNotNull(ediData.getMblNo())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMblNo(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 30)) {
+					textLength += "主单号,";
+				} else {
+					ediData.setMblNo(mapString.get("susscess"));
+				}
+			} else {
+				character += "提单号,";
+			}
+		}
+
+		//运输条款代码
+		if (ObjectUtils.isNull(ediData.getTransportTermCode())) {
+			msg += "运输条款代码,";
+		} else {
+			// V_ServiceItems = if(Serviceterms='CY-DOOR', 2, if(Serviceterms='CY-CY',1,if(Serviceterms='CY-CFS',3,if(SServiceterms='CY-FO',6,9))))
+			String serviceCode = RegularUtils.serviceTermToInttraCode(ediData.getTransportTermCode());
+			serviceCode = RegularUtils.serviceTermFromInttraCode(serviceCode);
+			ediData.setTransportTermName(serviceCode);
+			if("CY-DOOR".equals(serviceCode)){
+				serviceCode = "2";
+			}else
+			if("CY-CY".equals(serviceCode)) {
+				serviceCode = "1";
+			}else
+			if("CY-CFS".equals(serviceCode)) {
+				serviceCode = "3";
+			}else
+			if("CY-FO".equals(serviceCode)) {
+				serviceCode = "6";
+			}else{
+				serviceCode = "9";
+			}
+			ediData.setTransportTermCode(serviceCode);
+		}
+
+		if (ObjectUtils.isNull(ediData.getCarrierArgreementNo())) {
+			msg += "船司约号,";
+		}
+
+		if (ObjectUtils.isNull(ediData.getVesselCode())) {
+			msg += "SML 船名代码,";
+		}
+		ediData.setVesselName(RegularUtils.escapeEDILine(ediData.getVesselName()));
+
+		if(ObjectUtils.isNull(ediData.getPlaceDestinationCode())){
+			msg += "目的地代码,";
+		}
+		ediData.setPlaceDestinationName(RegularUtils.escapeEDILine(ediData.getPlaceDestinationName()));
+
+		if(ObjectUtils.isNull(ediData.getPolCode())){
+			msg += "装货港代码,";
+		}
+		ediData.setPolName(RegularUtils.escapeEDILine(ediData.getPolName()));
+
+		if(ObjectUtils.isNull(ediData.getPodCode())){
+			msg += "卸货港代码,";
+		}
+		ediData.setPodName(RegularUtils.escapeEDILine(ediData.getPodName()));
+
+		if(ObjectUtils.isNull(ediData.getPlaceReceiptCode())){
+			msg += "收货地代码,";
+		}
+		ediData.setPlaceReceiptName(RegularUtils.escapeEDILine(ediData.getPlaceReceiptName()));
+
+		//包装件数
+		if (ObjectUtils.isNull(ediData.getPackagesNumber())) {
+			msg += "包装件数,";
+		} else {
+			if (RegularUtils.regularLength(ediData.getPackagesNumber().toString(), 8)) {
+				textLength += "包装件数,";
+			} else {
+				ediData.setPackagesNumber(ediData.getPackagesNumber().setScale(0, RoundingMode.HALF_UP).abs());
+			}
+		}
+		//包装代码
+		if (ObjectUtils.isNull(ediData.getPackagesCode())) {
+			msg += "包装代码,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPackagesCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setPackagesCode(mapString.get("susscess"));
+			} else {
+				character += "包装代码,";
+			}
+		}
+		//包装描述
+		if (ObjectUtils.isNotNull(ediData.getPackagesDescribe())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPackagesDescribe(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 35)) {
+					textLength += "包装描述,";
+				} else {
+					ediData.setPackagesDescribe(mapString.get("susscess"));
+				}
+			} else {
+				character += "包装描述,";
+			}
+		}
+
+		//货物重量
+		if (ObjectUtils.isNull(ediData.getWeightOfGoods())) {
+			msg += "货物重量,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getWeightOfGoods(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setWeightOfGoods(mapString.get("susscess"));
+			} else {
+				character += "货物重量,";
+			}
+		}
+		//货物体积
+		if (ObjectUtils.isNotNull(ediData.getVolumeOfGoods())) {
+			if (RegularUtils.regularLength(ediData.getVolumeOfGoods().toString(), 18)) {
+				textLength += "货物体积,";
+			} else {
+				ediData.setVolumeOfGoods(ediData.getVolumeOfGoods().setScale(3, RoundingMode.HALF_UP).abs());
+			}
+		}
+
+		//预配总箱数
+		if (ObjectUtils.isNotNull(ediData.getTotalPreCntrQty())) {
+		}
+
+		//付款地代码
+		if (ObjectUtils.isNotNull(ediData.getHPayPlaceCode())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHPayPlaceCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHPayPlaceCode(mapString.get("susscess"));
+			} else {
+				character += "HBL 付款地代码,";
+			}
+		}
+		//付款地
+		if (ObjectUtils.isNotNull(ediData.getHPayPlaceName())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHPayPlaceName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "HBL 付款地,";
+				} else {
+					ediData.setHPayPlaceName(mapString.get("susscess"));
+				}
+			} else {
+				character += "HBL 付款地,";
+			}
+		}
+		//付款方式代码
+		if (ObjectUtils.isNull(ediData.getHPayMode())) {
+			msg += "HBL 付款方式代码,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHPayMode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
+					textLength += "HBL 付款方式代码,";
+				} else {
+					ediData.setHPayMode(mapString.get("susscess"));
+				}
+			} else {
+				character += "HBL 付款方式代码,";
+			}
+		}
+		if (ObjectUtils.isNotNull(ediData.getBookingRemarks())) {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getBookingRemarks(),false);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
+					textLength += "订舱备注,";
+				} else {
+					ediData.setBookingRemarks(mapString.get("susscess"));
+				}
+			} else {
+				character += "订舱备注,";
+			}
+
+		}
+
+		//船名
+		if (ObjectUtils.isNull(ediData.getVesselName())) {
+			msg += "船名,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getVesselName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 30)) {
+					textLength += "船名,";
+				} else {
+					ediData.setVesselName(mapString.get("susscess"));
+				}
+			} else {
+				character += "船名,";
+			}
+		}
+		//装货港代码
+		if (ObjectUtils.isNull(ediData.getPolCode())) {
+			msg += "装货港代码,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPolCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setPolCode(mapString.get("susscess"));
+			} else {
+				character += "装货港代码,";
+			}
+		}
+		//装货港
+		if (ObjectUtils.isNull(ediData.getPolName())) {
+			msg += "装货港,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPolName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "装货港,";
+				} else {
+					ediData.setPolName(mapString.get("susscess"));
+				}
+			} else {
+				character += "装货港,";
+			}
+		}
+		//收货地代码
+		if (ObjectUtils.isNull(ediData.getPlaceReceiptCode())) {
+			msg += "收货地代码,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPlaceReceiptCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setPlaceReceiptCode(mapString.get("susscess"));
+			} else {
+				character += "收货地代码,";
+			}
+		}
+		//收货地
+		if (ObjectUtils.isNull(ediData.getPlaceReceiptName())) {
+			msg += "收货地,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPlaceReceiptName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "收货地,";
+				} else {
+					ediData.setPlaceReceiptName(mapString.get("susscess"));
+				}
+			} else {
+				character += "收货地,";
+			}
+		}
+		//卸货港代码
+		if (ObjectUtils.isNull(ediData.getPodCode())) {
+			msg += "卸货港代码,";
+		} else {
+			Map<String, String> mapString =RegularUtils. regularEn(ediData.getPodCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setPodCode(mapString.get("susscess"));
+			} else {
+				character += "卸货港代码,";
+			}
+		}
+		//卸货港
+		if (ObjectUtils.isNull(ediData.getPodName())) {
+			msg += "卸货港,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPodName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "卸货港,";
+				} else {
+					ediData.setPodName(mapString.get("susscess"));
+				}
+			} else {
+				character += "卸货港,";
+			}
+		}
+		//交货地代码
+		if (ObjectUtils.isNull(ediData.getPlaceDeliveryCode())) {
+			msg += "交货地代码,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPlaceDeliveryCode(),true);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setPlaceDeliveryCode(mapString.get("susscess"));
+			} else {
+				character += "交货地代码,";
+			}
+		}
+		//交货地
+		if (ObjectUtils.isNull(ediData.getPlaceDeliveryName())) {
+			msg += "交货地,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getPlaceDeliveryName(),true);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 256)) {
+					textLength += "交货地,";
+				} else {
+					ediData.setPlaceDeliveryName(mapString.get("susscess"));
+				}
+			} else {
+				character += "交货地,";
+			}
+		}
+		//发货人
+		if (ObjectUtils.isNull(ediData.getHShipper())) {
+			msg += "发货人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHShipper(), false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHShipper(mapString.get("susscess"));
+			} else {
+				character += "发货人,";
+			}
+		}
+		//收货人
+		if (ObjectUtils.isNull(ediData.getHConsignee())) {
+			msg += "收货人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHConsignee(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHConsignee(mapString.get("susscess"));
+			} else {
+				character += "收货人,";
+			}
+		}
+		//通知人
+		if (ObjectUtils.isNull(ediData.getHNotify())) {
+			msg += "通知人,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getHNotify(),false);
+			if ("200".equals(mapString.get("code"))) {
+				ediData.setHNotify(mapString.get("susscess"));
+			} else {
+				character += "通知人,";
+			}
+		}
+		//HS 编码
+		if (ObjectUtils.isNotNull(ediData.getHsCode())) {
+			if (RegularUtils.regularLength(ediData.getHsCode(), 10)) {
+				textLength += "HS 编码,";
+			}
+		}
+		//货描
+		if (ObjectUtils.isNull(ediData.getGoodsDesc())) {
+			msg += "货描,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getGoodsDesc(),false);
+			if ("200".equals(mapString.get("code"))) {
+				if (RegularUtils.regularLength(mapString.get("susscess"), 512)) {
+					textLength += "货描,";
+				} else {
+					ediData.setGoodsDesc(mapString.get("susscess"));
+				}
+			} else {
+				character += "货描,";
+			}
+		}
+		//重量
+		if (ObjectUtils.isNull(ediData.getGrossWeight())) {
+			msg += "重量,";
+		} else {
+			if (RegularUtils.regularLength(ediData.getGrossWeight().toString(), 18)) {
+				textLength += "重量,";
+			}
+		}
+		//体积
+		if (ObjectUtils.isNull(ediData.getMeasurement())) {
+			msg += "体积,";
+		} else {
+			if (RegularUtils.regularLength(ediData.getMeasurement().toString(), 18)) {
+				textLength += "体积,";
+			}
+		}
+		//唛头
+		if (ObjectUtils.isNull(ediData.getMarks())) {
+			msg += "唛头,";
+		} else {
+			Map<String, String> mapString = RegularUtils.regularEn(ediData.getMarks(),false);
+			if ("200".equals(mapString.get("code"))) {
+				//35*50
+				if (RegularUtils.regularLength(mapString.get("susscess"), 1750)) {
+					textLength += "唛头,";
+				} else {
+					ediData.setMarks(mapString.get("susscess"));
+				}
+			} else {
+				character += "唛头,";
+			}
+		}
+
+		if(type.equals("SO")) {
+			// SO 判断预配箱
+			if (ObjectUtils.isNull(ediData.getPreCntrs())) {
+				msg += "箱型代码,";
+			} else {
+				List<Map<String, Object>> mapList = ediData.getPreCntrs();
+				for (Map<String, Object> map1 : mapList) {
+					// Double temperature = ObjectUtils.isNotNull(map1.get("temperature")) ? Double.parseDouble(map1.get("temperature").toString()) : 0;
+					//箱型代码
+					if (ObjectUtils.isNull(map1.get("sizeType").toString())) {
+						msg += "箱型代码,";
+					} else {
+						Map<String, String> mapString = RegularUtils.regularEn(map1.get("sizeType").toString(), true);
+						if ("200".equals(mapString.get("code"))) {
+							// ediData.setBoxCode(mapString.get("susscess"));
+						} else {
+							character += "箱型代码,";
+						}
+					}
+					//箱量
+					if (ObjectUtils.isNull(map1.get("cntrQty"))) {
+						msg += "箱量,";
+					}
+					//冷藏通风量
+					if (ObjectUtils.isNotNull(map1.get("ventilation"))) {
+						Map<String, String> mapString = RegularUtils.regularEn(map1.get("ventilation").toString(), true);
+						if ("200".equals(mapString.get("code"))) {
+							if (RegularUtils.regularLength(mapString.get("susscess"), 18)) {
+								textLength += "冷藏通风量,";
+							} else {
+								if (mapString.get("susscess").contains(",")) {
+									special += "冷藏通风量不能出现“,”";
+								} else {
+								}
+							}
+						} else {
+							character += "冷藏通风量,";
+						}
+					}
+					//温度单位
+					if (ObjectUtils.isNotNull(map1.get("temperatureUnit").toString())) {
+						Map<String, String> mapString = RegularUtils.regularEn(map1.get("temperatureUnit").toString(), true);
+						if ("200".equals(mapString.get("code"))) {
+						} else {
+							character += "温度单位,";
+						}
+					}
+				}
+			}
+		}
+
+		String data = "";
+		if (ObjectUtils.isNotNull(msg)) {
+			code = 500;
+			data += "非空:" + msg;
+		}
+		if (ObjectUtils.isNotNull(character)) {
+			code = 500;
+			data += "特殊字符:" + character;
+		}
+		if (ObjectUtils.isNotNull(textLength)) {
+			code = 500;
+			data += "长度超长:" + textLength;
+		}
+		if (ObjectUtils.isNotNull(special)) {
+			code = 500;
+			data += "其他:" + special;
+		}
+		map.put("code", code);
+		map.put("data", data);
+		return map;
+	}
+}

+ 6 - 0
blade-service/blade-los/src/main/java/org/springblade/los/business/files/mapper/FilesCenterMapper.xml

@@ -37,6 +37,12 @@
         <result column="reference3" property="reference3"/>
         <result column="reference4" property="reference4"/>
         <result column="sort" property="sort"/>
+        <result column="send_status" property="sendStatus"/>
+        <result column="send_count" property="sendCount"/>
+        <result column="send_type" property="sendType"/>
+        <result column="send_time" property="sendTime"/>
+        <result column="receiver_name" property="receiverName"/>
+        <result column="receiver_address" property="receiverAddress"/>
         <result column="is_deleted" property="isDeleted"/>
         <result column="version" property="version"/>
         <result column="status" property="status"/>

+ 84 - 66
blade-service/blade-los/src/main/java/org/springblade/los/edi/dto/InttraSoDto.java

@@ -28,7 +28,45 @@ public class InttraSoDto {
 	/**
 	 * 发送方标识
 	 */
-	private String senderIdentifying;
+	private String senderId;
+	/**
+	 * 发送方代码
+	 */
+	private String senderCode;
+	/**
+	 * 发送方称呼
+	 */
+	private String senderName;
+
+	/*   CTA+IC+:  */
+	/**
+	 * 发送方联系人
+	 */
+	private String senderContacts;
+
+	/*     COM+    */
+	/**
+	 * 发送方联系电话
+	 */
+	private String senderTel;
+
+	/*     COM+    */
+	/**
+	 * 发送方联系邮件
+	 */
+	private String senderEmail;
+	/**
+	 * 货代代码
+	 */
+	private String forwarderCode;
+	/**
+	 * edi cfg 货代称呼
+	 */
+	private String forwarderName;
+	/**
+	 * bill 货代称呼
+	 */
+	private String hForwarderName;
 	/**
 	 * 日期  (日期(yymmdd):时间(hhmm))
 	 */
@@ -127,13 +165,23 @@ public class InttraSoDto {
 
 	/*   LOC+57+   */
 	/**
-	 * 付款地代码
+	 * HBL 付款地代码
+	 */
+	private String hPayPlaceCode;
+	/**
+	 * HBL 付款地
+	 */
+	private String hPayPlaceName;
+
+	/*   LOC+57+   */
+	/**
+	 * MBL 付款地代码
 	 */
-	private String paymentLocationCode;
+	private String mPayPlaceCode;
 	/**
-	 * 付款地
+	 * MBL 付款地
 	 */
-	private String paymentLand;
+	private String mPayPlaceName;
 
 	/*   LOC+73+   */
 	/**
@@ -163,6 +211,9 @@ public class InttraSoDto {
 	 */
 	private String mblNo;
 
+	// 分单主单号
+	private String masterMblNo;
+
 	/**
 	 * 分单号
 	 */
@@ -190,23 +241,17 @@ public class InttraSoDto {
 	 */
 	private String mainPinyin;
 
-	/*   RFF+ON:   */
-	/**
-	 * 订单号
-	 */
-	private String orderNo;
-
-	/*   RFF+FF:   */
+	/*   CPI+4++   */
 	/**
-	 * 货代工作编号
+	 * HBL 付款方式代码
 	 */
-	private String jobId;
+	private String hPayMode;
 
 	/*   CPI+4++   */
 	/**
-	 * 付款方式代码
+	 * MBL 付款方式代码
 	 */
-	private String paymentType;
+	private String mPayMode;
 
 	/*   TDT+20+   */
 	/**
@@ -234,6 +279,10 @@ public class InttraSoDto {
 	 */
 	private Long lineId;
 	/**
+	 * 航线代码
+	 */
+	private String lineCode;
+	/**
 	 * 航线英文名称
 	 */
 	private String lineEnName;
@@ -400,15 +449,15 @@ public class InttraSoDto {
 
 	/*     CTA+NT+:  */
 	/**
-	 * 联系人
+	 * INTTRA UCA 联系人
 	 */
-	private String contacts;
+	private String inttraUCAContacts;
 
 	/*    COM+  */
 	/**
-	 * 联系邮箱
+	 * INTTRA UCA 邮箱
 	 */
-	private String attnEmail;
+	private String inttraUCAEmail;
 
 	/**
 	 * 场站 id
@@ -470,44 +519,6 @@ public class InttraSoDto {
 	 */
 	private String inttraDoorToTel;
 
-	/*     NAD+FW+     */
-	/**
-	 * 货代代码
-	 */
-	private String freightForwarderCode;
-	/**
-	 * 货代称呼
-	 */
-	private String freightForwarderName;
-
-	/*     NAD+FW+     */
-	/**
-	 * 发送方代码
-	 */
-	private String senderCode;
-	/**
-	 * 发送方称呼
-	 */
-	private String senderName;
-
-	/*   CTA+IC+:  */
-	/**
-	 * 发送方联系人
-	 */
-	private String senderContacts;
-
-	/*     COM+    */
-	/**
-	 * 发送方联系电话
-	 */
-	private String senderTel;
-
-	/*     COM+    */
-	/**
-	 * 发送方联系邮件
-	 */
-	private String senderEmail;
-
 	/*     DOC+    */
 	/**
 	 * 提单类型
@@ -523,9 +534,13 @@ public class InttraSoDto {
 	 */
 	private String paymentStatus;
 	/**
-	 * 提单份数
+	 * 正本提单份数
 	 */
 	private int billLadingNumber;
+	/**
+	 * 副本提单份数
+	 */
+	private int billLadingNumberOfCopy;
 
 	/**
 	 * 包装代码
@@ -599,7 +614,7 @@ public class InttraSoDto {
 	/**
 	 * 包装组别
 	 */
-	private String packingGroup;
+	private String dgPackingLevel;
 	/**
 	 * 应急措施号
 	 */
@@ -694,12 +709,6 @@ public class InttraSoDto {
 	 */
 	private String informationNoEnd;
 
-	/*     UNZ+1+   */
-	/**
-	 * 文件交换编号
-	 */
-	private String fileExchangeNumberEnd;
-
 	/**
 	 * edi发送地址
 	 */
@@ -712,6 +721,15 @@ public class InttraSoDto {
 	 */
 	private Boolean isMasterBill;
 
+	private Boolean mixedCargo;
+
+	private Boolean hasMixedCargo;
+
+	/**
+	 * 是否已经发送过 EDI
+	 */
+	private Boolean alreadySend;
+
 	/**
 	 * 是否 DOOR TO 服务方式
 	 */

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/edi/service/IEDISenderService.java

@@ -127,4 +127,8 @@ public interface IEDISenderService {
 	 * @return
 	 */
 	FilesCenter sendingHmmSI(InttraSoDto pilSoDto, JsonNode ediParamCarrier);
+
+	FilesCenter sendingSmlBooking(InttraSoDto smlSoDto, JsonNode ediParamCarrier);
+
+	FilesCenter sendingEslBooking(InttraSoDto eslSoDto, JsonNode ediParamCarrier);
 }

File diff suppressed because it is too large
+ 371 - 271
blade-service/blade-los/src/main/java/org/springblade/los/edi/service/impl/EDISenderServiceImpl.java


+ 165 - 42
blade-service/blade-los/src/main/java/org/springblade/los/edi/service/impl/EdiTypesServiceImpl.java

@@ -188,7 +188,13 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 	 * @return
 	 */
 	public Boolean fill(InttraSoDto inttraSoDto, Bills details, String ediCodeName, JsonNode ediParamCarrier, Boolean mixedCargo){
-		inttraSoDto.setBillType(details.getBillType());
+		String bltype = details.getBillType();
+		inttraSoDto.setBillType(bltype);
+		List<Bills> hblBills = billsService.list(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.eq(Bills::getMasterId, details.getId()));
+
 		inttraSoDto.setTransportTermCode(details.getServiceTerms());
 		inttraSoDto.setLclType("2");
 		inttraSoDto.setLoadType(details.getLoadType());
@@ -199,6 +205,18 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		inttraSoDto.setPackagesNumber(details.getQuantity());
 		inttraSoDto.setVolumeOfGoods(details.getMeasurement());
 
+		if (ObjectUtils.isNotNull(details.getHpayplace())) {
+			BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
+				.eq(BPorts::getTenantId, AuthUtil.getTenantId())
+				.eq(BPorts::getIsDeleted, 0)
+				.eq(BPorts::getEnName, details.getHpayplace()));
+			if (bPorts != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
+				inttraSoDto.setHPayPlaceCode(ediCode);
+				inttraSoDto.setHPayPlaceName(bPorts.getEnName());
+			}
+		}
+
 		if (ObjectUtils.isNotNull(details.getMpayplace())) {
 			BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
 				.eq(BPorts::getTenantId, AuthUtil.getTenantId())
@@ -206,10 +224,11 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				.eq(BPorts::getEnName, details.getMpayplace()));
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
-				inttraSoDto.setPaymentLocationCode(ediCode);
-				inttraSoDto.setPaymentLand(bPorts.getEnName());
+				inttraSoDto.setMPayPlaceCode(ediCode);
+				inttraSoDto.setMPayPlaceName(bPorts.getEnName());
 			}
 		}
+
 		if (ObjectUtils.isNotNull(details.getIssueAtId())) {
 			BPorts bPorts = bPortsService.getById(details.getIssueAtId());
 			if (bPorts != null) {
@@ -225,16 +244,41 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		}
 		inttraSoDto.setBookingNo(details.getBookingNo());
 		inttraSoDto.setMblNo(details.getMblno());
+		if("DD".equals(bltype) || "MM".equals(bltype)){
+			inttraSoDto.setMasterMblNo(details.getMblno());
+		}else{
+			Bills masterBill = billsService.getOne(new LambdaQueryWrapper<Bills>()
+				.eq(Bills::getTenantId, AuthUtil.getTenantId())
+				.eq(Bills::getIsDeleted, 0)
+				.eq(Bills::getBusinessType, details.getBusinessType())
+				.eq(Bills::getId, details.getMasterId()));
+			if(masterBill != null){
+				inttraSoDto.setMasterMblNo(masterBill.getMblno());
+			}
+		}
+
 		inttraSoDto.setHblNo(details.getHblno());
 		inttraSoDto.setCorpArgreementNo(details.getCorpArgreementNo());
 		inttraSoDto.setCarrierArgreementNo(details.getCarrierArgreementNo());
-		inttraSoDto.setLineId(details.getLineId());
-		inttraSoDto.setLineEnName(details.getLineEnName());
+		inttraSoDto.setLineId(0L);
+		inttraSoDto.setLineCode("");
+		inttraSoDto.setLineEnName("");
+		if(ObjectUtils.isNotNull(details.getLineId())) {
+			inttraSoDto.setLineId(details.getLineId());
+			BLines bLines = bLinesService.getOne(new LambdaQueryWrapper<BLines>()
+				.eq(BLines::getTenantId, AuthUtil.getTenantId())
+				.eq(BLines::getIsDeleted, 0)
+				.eq(BLines::getId, details.getLineId()));
+			if (bLines != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bLines.getExtendedData());
+				inttraSoDto.setLineCode(ediCode.isEmpty() ? bLines.getCode() : ediCode);
+				inttraSoDto.setHPayPlaceName(bLines.getEnName());
+			}
+		}
 		inttraSoDto.setPilHBL(details.getPilHbl());
 		inttraSoDto.setMainPinyin("");
-		inttraSoDto.setOrderNo(details.getBookingNo());
-		inttraSoDto.setJobId(details.getBookingNo());
-		inttraSoDto.setPaymentType(details.getMpaymode());
+		inttraSoDto.setHPayMode(details.getHpaymode());
+		inttraSoDto.setMPayMode(details.getMpaymode());
 		inttraSoDto.setVesselId(details.getVesselId());
 		inttraSoDto.setVesselName(details.getVesselEnName());
 		inttraSoDto.setVesselCode("");
@@ -261,70 +305,78 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			inttraSoDto.setEta(sdf3.format(details.getEta()));
 		}
 
-		inttraSoDto.setPolName(details.getPolEnName());
+		inttraSoDto.setPolCode("");
+		inttraSoDto.setPolName(RegularUtils.forceEmpty(details.getPolEnName()));
 		if (ObjectUtils.isNotNull(details.getPolId())) {
 			BPorts bPorts = bPortsService.getById(details.getPolId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPolCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPolName())) {
-					inttraSoDto.setPolName(bPorts.getEnName());
+					inttraSoDto.setPolName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
 
-		inttraSoDto.setPlaceReceiptName(details.getPlaceReceiptName());
+		inttraSoDto.setPlaceReceiptCode("");
+		inttraSoDto.setPlaceReceiptName(RegularUtils.forceEmpty(details.getPlaceReceiptName()));
 		if (ObjectUtils.isNotNull(details.getPlaceReceiptId())) {
 			BPorts bPorts = bPortsService.getById(details.getPlaceReceiptId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPlaceReceiptCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPlaceReceiptName())) {
-					inttraSoDto.setPlaceReceiptName(bPorts.getEnName());
+					inttraSoDto.setPlaceReceiptName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
-		inttraSoDto.setPodName(details.getPodEnName());
+		inttraSoDto.setPodCode("");
+		inttraSoDto.setPodName(RegularUtils.forceEmpty(details.getPodEnName()));
 		if (ObjectUtils.isNotNull(details.getPodId())) {
 			BPorts bPorts = bPortsService.getById(details.getPodId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPodCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPodName())) {
-					inttraSoDto.setPodName(bPorts.getEnName());
+					inttraSoDto.setPodName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
-		inttraSoDto.setPotName(details.getPotEnName());
+		inttraSoDto.setPotCode("");
+		inttraSoDto.setPotName(RegularUtils.forceEmpty(details.getPotEnName()));
 		if (ObjectUtils.isNotNull(details.getPotId())) {
 			BPorts bPorts = bPortsService.getById(details.getPotId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPotCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPotName())) {
-					inttraSoDto.setPotName(bPorts.getEnName());
+					inttraSoDto.setPotName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
-		inttraSoDto.setPlaceDeliveryName(details.getPlaceDeliveryName());
+
+		inttraSoDto.setPlaceDeliveryCode("");
+		inttraSoDto.setPlaceDeliveryName(RegularUtils.forceEmpty(details.getPlaceDeliveryName()));
 		if (ObjectUtils.isNotNull(details.getPlaceDeliveryId())) {
 			BPorts bPorts = bPortsService.getById(details.getPlaceDeliveryId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPlaceDeliveryCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPlaceDeliveryName())) {
-					inttraSoDto.setPlaceDeliveryName(bPorts.getEnName());
+					inttraSoDto.setPlaceDeliveryName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
-		inttraSoDto.setPlaceDestinationName(details.getDestinationName());
+
+		inttraSoDto.setPlaceDestinationCode("");
+		inttraSoDto.setPlaceDestinationName(RegularUtils.forceEmpty(details.getDestinationName()));
 		if (ObjectUtils.isNotNull(details.getDestinationId())) {
 			BPorts bPorts = bPortsService.getById(details.getDestinationId());
 			if (bPorts != null) {
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
 				inttraSoDto.setPlaceDestinationCode(ediCode);
 				if (ObjectUtils.isNull(inttraSoDto.getPlaceDestinationName())) {
-					inttraSoDto.setPlaceDestinationName(bPorts.getEnName());
+					inttraSoDto.setPlaceDestinationName(RegularUtils.forceEmpty(bPorts.getEnName()));
 				}
 			}
 		}
@@ -366,15 +418,6 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		inttraSoDto.setInttraDoorToAddr(details.getInttraDoorToCorpAddr());
 		inttraSoDto.setInttraDoorToContacts(details.getInttraDoorToCorpContacts());
 		inttraSoDto.setInttraDoorToTel(details.getInttraDoorToCorpTel());
-		String defaultForwardCode = "JET MARINE";
-		inttraSoDto.setFreightForwarderCode(readEdiParamStringValue(ediParamCarrier, "forwarderCode", defaultForwardCode));
-		inttraSoDto.setFreightForwarderName(details.getForwarding());
-		String defaultSenderCode = "JMSLOGQINGDAO";
-		inttraSoDto.setSenderCode(readEdiParamStringValue(ediParamCarrier, "senderCode", defaultSenderCode));
-		inttraSoDto.setSenderName(readEdiParamStringValue(ediParamCarrier, "senderName", "JMS"));
-		inttraSoDto.setSenderContacts(readEdiParamStringValue(ediParamCarrier, "senderContacts", "Yuki Cai"));
-		inttraSoDto.setSenderTel(readEdiParamStringValue(ediParamCarrier, "senderTel", ""));
-		inttraSoDto.setSenderEmail(readEdiParamStringValue(ediParamCarrier, "senderEmail", "cma-seataocn@jms-logistics.com"));
 		inttraSoDto.setIssueType(details.getIssueType());
 		if ("EXP".equals(details.getIssueType())) {
 			// SEA WAY BILL
@@ -384,11 +427,16 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			inttraSoDto.setBillLadingType("706");
 		}
 		if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
-			inttraSoDto.setPaymentStatus("27");
+			// inttraSoDto.setPaymentStatus("27");
+			// 26 Document not freighted
+			// 27 Document freighted
+			// default 26
+			inttraSoDto.setPaymentStatus("26");
 		} else {
 			inttraSoDto.setPaymentStatus("26");
 		}
 		inttraSoDto.setBillLadingNumber(RegularUtils.englishToNumber(details.getNumberOfObl()));
+		inttraSoDto.setBillLadingNumberOfCopy(RegularUtils.englishToNumber(details.getNumberOfCopy()));
 		inttraSoDto.setPackagesNumber(details.getQuantity());
 		if (ObjectUtils.isNotNull(details.getPackingUnit())) {
 			BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
@@ -412,7 +460,7 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			inttraSoDto.setDgUnCode(details.getDgUnCode());
 			inttraSoDto.setDgFlashPoint(details.getDgFlashPoint().toString());
 			inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
-			inttraSoDto.setPackingGroup(details.getDgPackingLevel());//包装组别
+			inttraSoDto.setDgPackingLevel(details.getDgPackingLevel());//包装组别
 			inttraSoDto.setEmergencyMeasureNo("");//应急措施号
 			inttraSoDto.setDgRemarks(details.getDgRemarks());
 			inttraSoDto.setDgContacts(details.getDgContacts());
@@ -466,9 +514,11 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		}
 		inttraSoDto.setTotalPreCntrQty(totalPreCntrQty);
 		inttraSoDto.setPreCntrs(preCntrs);
+		inttraSoDto.setMixedCargo(mixedCargo);
 
 		// 已配箱
 		// 配箱数据
+		int mixedCargoCount = 0;
 		List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
 			.eq(Containers::getTenantId, AuthUtil.getTenantId())
 			.eq(Containers::getIsDeleted, 0)
@@ -491,6 +541,7 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 						.eq(ContainersCommodity::getPid, item.getId())
 						.eq(ContainersCommodity::getPpId, item.getPid()))
 					);
+					mixedCargoCount += ObjectUtils.isNotNull(item.getContainersCommodityList()) ? item.getContainersCommodityList().size() : 0;
 				}
 
 				String ediCode = RegularUtils.getEdiCode(ediCodeName, bCntrTypes.getExtendedData());
@@ -548,6 +599,7 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			}
 		}
 		inttraSoDto.setLoadedCntrs(cntrs);
+		inttraSoDto.setHasMixedCargo(mixedCargoCount>0);
 
 		inttraSoDto.setAMSProp("");
 		inttraSoDto.setACIProp("");
@@ -562,7 +614,6 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 
 		inttraSoDto.setRecordRows(new BigDecimal("10"));
 		inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
-		inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
 
 		return true;
 	}
@@ -597,6 +648,7 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			// 统一设置数据,单独生成 EDI
 			InttraSoDto inttraSoDto = new InttraSoDto();
 			inttraSoDto.setEdiTypes(ediTypes);
+			inttraSoDto.setAlreadySend(false);
 
 			String carrierCode = "";
 
@@ -606,8 +658,8 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				if (bCorps != null) {
 					inttraSoDto.setCarrierCode(bCorps.getInttraCode());
 					inttraSoDto.setContactInformation(bCorps.getInttraIcua());
-					inttraSoDto.setContacts(bCorps.getInttraIcuaAttn());
-					inttraSoDto.setAttnEmail(bCorps.getInttraIcuaEmail());
+					inttraSoDto.setInttraUCAContacts(bCorps.getInttraIcuaAttn());
+					inttraSoDto.setInttraUCAEmail(bCorps.getInttraIcuaEmail());
 					carrierCode = bCorps.getInttraCode();
 				}
 			}
@@ -626,12 +678,29 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			String EDI_CODE_NAME = readEdiParamStringValue(ediParamCarrier, "ediCode", "INTTRA");
 			Boolean INCLUDING_HBL = readEdiParamBooleanValue(ediParamCarrier, "includingHBL", false);
 
+			Boolean CHECK_ALREADY_SEND = readEdiParamBooleanValue(ediParamCarrier, "checkAlreadySend", false);
+
 			String billType = details.getBillType();
 			Boolean isMasterBill = "DD".equals(billType) || "MM".equals(billType);
 			// 检测是否允许发送分单
 			if(!isMasterBill && !readEdiParamBooleanValue(ediParamCarrier, "allowHBL", true)){
 				return R.fail("该 EDI 不允许发送分单,请发送主单!");
 			}
+			if(CHECK_ALREADY_SEND){
+				FilesCenter fc = filesCenterService.getOne(new LambdaQueryWrapper<FilesCenter>()
+					.eq(FilesCenter::getTenantId, AuthUtil.getTenantId())
+					.eq(FilesCenter::getBranchId, details.getBranchId())
+					.eq(FilesCenter::getPid, details.getId())
+					.eq(FilesCenter::getBusinessType, details.getBusinessType())
+					.eq(FilesCenter::getClassifyCode, "edi")
+					.eq(FilesCenter::getGroupCode, ediTypes.getCode())
+					.eq(FilesCenter::getSendStatus, 1)
+					.eq(FilesCenter::getIsDeleted, 0)
+				);
+				if(fc!=null){
+					inttraSoDto.setAlreadySend(true);
+				}
+			}
 
 			// List<Bills> allBillsList = Arrays.asList(details);
 			List<Bills> hblBillsList = new ArrayList<>();
@@ -646,8 +715,20 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			}
 
 			// 默认发送方
-			String defaultSenderIdentifying = "JMSLOGQDSO";
-			inttraSoDto.setSenderIdentifying(readEdiParamStringValue(ediParamCarrier, "senderId", defaultSenderIdentifying));
+			String defaultSenderId = "JMSLOGQDSO";
+			inttraSoDto.setSenderId(readEdiParamStringValue(ediParamCarrier, "senderId", defaultSenderId));
+
+			String defaultSenderCode = "JMSLOGQINGDAO";
+			inttraSoDto.setSenderCode(readEdiParamStringValue(ediParamCarrier, "senderCode", defaultSenderCode));
+			inttraSoDto.setSenderName(readEdiParamStringValue(ediParamCarrier, "senderName", "JMS"));
+			inttraSoDto.setSenderContacts(readEdiParamStringValue(ediParamCarrier, "senderContacts", "Yuki Cai"));
+			inttraSoDto.setSenderTel(readEdiParamStringValue(ediParamCarrier, "senderTel", ""));
+			inttraSoDto.setSenderEmail(readEdiParamStringValue(ediParamCarrier, "senderEmail", "cma-seataocn@jms-logistics.com"));
+
+			String defaultForwardCode = "JET MARINE";
+			inttraSoDto.setForwarderCode(readEdiParamStringValue(ediParamCarrier, "forwarderCode", defaultForwardCode));
+			inttraSoDto.setForwarderName(readEdiParamStringValue(ediParamCarrier, "forwarderName", "QINGDAO JET MERINE LOGISTICS CO.,+LTD."));
+			inttraSoDto.setHForwarderName(details.getForwarding());
 
 			SimpleDateFormat sdf = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "messageDate-format", "yyMMdd:HHmm"));
 			inttraSoDto.setMessageDate(sdf.format(date));
@@ -655,11 +736,21 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			String corpId = details.getCorpId().toString();
 			inttraSoDto.setFileExchangeNumber(sdf1.format(date) + corpId.substring(corpId.length() - 4));
 			inttraSoDto.setInformationNo(inttraSoDto.getFileExchangeNumber());
-			if (ObjectUtils.isNotNull(details.getMblno())){
-				inttraSoDto.setIdentificationCode(details.getMblno());
+
+			String mblNo = ObjectUtils.isNotNull(details.getMblno()) ? details.getMblno() : "";
+			String bookingNo = ObjectUtils.isNotNull(details.getBookingNo()) ? details.getBookingNo() : "";
+			if("CMDU".equals(carrierCode)){
+				inttraSoDto.setIdentificationCode((mblNo.isEmpty() ? bookingNo : mblNo) + "FB");
+			}else
+			if("HLCU".equals(carrierCode)){
+				inttraSoDto.setIdentificationCode(bookingNo + "SO");
+			}else
+			if("MAEU".equals(carrierCode)){
+				inttraSoDto.setIdentificationCode(mblNo + "FB");
 			}else{
-				inttraSoDto.setIdentificationCode(details.getBookingNo());
+				inttraSoDto.setIdentificationCode((mblNo.isEmpty() ? bookingNo : mblNo) + "FB");
 			}
+
 			if (ObjectUtils.isNotNull(details.getEdiStatus()) && Integer.parseInt(details.getEdiStatus()) > 0) {
 				// 默认 9
 				inttraSoDto.setFilesFunction("9");
@@ -678,6 +769,9 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				for (Bills bill : hblBillsList) {
 					InttraSoDto dto = new InttraSoDto();
 					fill(dto, bill, EDI_CODE_NAME, ediParamCarrier, mixedCargo);
+					if(!inttraSoDto.getHasMixedCargo()){
+						inttraSoDto.setHasMixedCargo(dto.getHasMixedCargo());
+					}
 					hbls.add(dto);
 				}
 				inttraSoDto.setHblBillsList(hbls);
@@ -835,6 +929,26 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 						return R.fail(e.getMessage());
 					}
 				}
+			}else
+			if(inttraSoDto.ediTypeIsHYCK_SML_BOOKING()) {
+				status = Regular_SML.notNullEDIData_Booking(inttraSoDto, "SO");
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingSmlBooking(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
+				}
+			}else
+			if(inttraSoDto.ediTypeIsHYCK_ESL_BOOKING()) {
+				status = Regular_ESL.notNullEDIData_Booking(inttraSoDto, "SO");
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingEslBooking(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
+				}
 			}else{
 				return R.fail("EDI 未实现!");
 			}
@@ -844,6 +958,7 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				status.replace("data", status.get("data") + "\r\n,文件未生成!");
 			}
 
+			// 200 or 400?
 			if ("200".equals(status.get("code").toString())) {
 				//发送edi记录
 				EdiLog ediLog = new EdiLog();
@@ -864,9 +979,6 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				ediLogService.save(ediLog);
 
 				//发送edi文件
-				filesCenter.setMblno(details.getMblno());
-				filesCenter.setHblno(details.getHblno());
-				filesCenter.setBillNo(details.getBillNo());
 				filesCenter.setBranchId(details.getBranchId());
 				filesCenter.setCreateDept(details.getCreateDept());
 				filesCenter.setCreateTime(details.getCreateTime());
@@ -875,12 +987,23 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 				filesCenter.setCreateUserName(details.getCreateUserName());
 				filesCenter.setPid(details.getId());
 				filesCenter.setItemId(ediLog.getId());
+				filesCenter.setMblno(details.getMblno());
+				filesCenter.setHblno(details.getHblno());
+				filesCenter.setBillNo(details.getBillNo());
 				filesCenter.setBusinessType(details.getBusinessType());
 				filesCenter.setClassifyCode("edi");
 				filesCenter.setGroupCode(ediTypes.getCode());
 				filesCenter.setSerialNo(1);
 				filesCenter.setSort(1);
 				filesCenter.setReceivedData(new Date());
+
+				filesCenter.setSendStatus(1);
+				filesCenter.setSendType(status.getOrDefault("sendType", "").toString());
+				filesCenter.setSendTime(new Date());
+				filesCenter.setSendCount(1);
+				filesCenter.setReceiverName(status.getOrDefault("receiverName", "").toString());
+				filesCenter.setReceiverAddress(status.getOrDefault("receiverAddress", "").toString());
+
 				filesCenter.setIsImage(0);
 				filesCenter.setTenantId(AuthUtil.getTenantId());
 				filesCenterList.add(filesCenter);

Some files were not shown because too many files changed in this diff