Browse Source

Merge remote-tracking branch 'origin/dev' into dev

纪新园 1 year ago
parent
commit
89c8d09292

+ 181 - 430
blade-service/blade-los/src/main/java/org/springblade/los/Util/RegularUtils.java

@@ -1854,561 +1854,305 @@ public class RegularUtils {
 
 		return RSO;
 	}
-	public static Map<String, Object> notNullInttraSiBillDto(InttraSiBillDto inttraSoDto) {
+
+
+	public static Map<String, Object> notNullOneBookingDto(InttraSoDto oneSoDto, String type) {
 		Map<String, Object> map = new HashMap<>();
 		int code = 200;
 		String msg = "";
 		String character = "";
 		String textLength = "";
 		String special = "";
-		if (ObjectUtils.isNull(inttraSoDto)) {
+		if (ObjectUtils.isNull(oneSoDto)) {
 			code = 500;
 			map.put("code", code);
 			map.put("msg", "数据不能为空!");
 			return map;
 		}
-		//发送方标识
-		if (ObjectUtils.isNull(inttraSoDto.getIdentifying())) {
-			msg += "发送方标识,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getIdentifying(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setIdentifying(mapString.get("susscess"));
-			} else {
-				character += "发送方标识,";
-			}
-		}
-		//日期
-		if (ObjectUtils.isNull(inttraSoDto.getDate())) {
-			msg += "日期,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getDate(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setDate(mapString.get("susscess"));
-			} else {
-				character += "日期,";
-			}
-		}
-		//文件交换编号
-		if (ObjectUtils.isNull(inttraSoDto.getFileExchangeNumber())) {
-			msg += "文件交换编号,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getFileExchangeNumber(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 14)) {
-					textLength += "文件交换编号,";
-				} else {
-					inttraSoDto.setFileExchangeNumber(mapString.get("susscess"));
-				}
-			} else {
-				character += "文件交换编号,";
-			}
-		}
-		//信息编号
-		if (ObjectUtils.isNull(inttraSoDto.getInformationNo())) {
-			msg += "信息编号,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getInformationNo(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 14)) {
-					textLength += "信息编号,";
-				} else {
-					inttraSoDto.setInformationNo(mapString.get("susscess"));
-				}
-			} else {
-				character += "信息编号,";
-			}
-		}
-		//提单辨识码
-		if (ObjectUtils.isNull(inttraSoDto.getIdentificationCode())) {
-			msg += "提单辨识码,";
+
+		/*	主单号、约号 服务合同号必须存在 */
+		//主单号
+		if (ObjectUtils.isNull(oneSoDto.getMblNo())) {
+			msg += "主单号,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getIdentificationCode(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getMblNo(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 35)) {
-					textLength += "提单辨识码,";
-				} else {
-					inttraSoDto.setIdentificationCode(mapString.get("susscess"));
-				}
+				oneSoDto.setMblNo(mapString.get("susscess"));
 			} else {
-				character += "提单辨识码,";
+				character += "主单号,";
 			}
 		}
-		//修订号
-		if (ObjectUtils.isNotNull(inttraSoDto.getRevisionNumber())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getRevisionNumber(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 6)) {
-					textLength += "修订号,";
-				} else {
-					inttraSoDto.setRevisionNumber(mapString.get("susscess"));
-				}
-			} else {
-				character += "修订号,";
-			}
-		}
-		//文件功能
-		if (ObjectUtils.isNull(inttraSoDto.getFilesFunction())) {
-			msg += "文件功能,";
+		//约号
+		if (ObjectUtils.isNull(oneSoDto.getCorpArgreementNo())) {
+			msg += "约号,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getFilesFunction(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getCorpArgreementNo(),true);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setFilesFunction(mapString.get("susscess"));
+				oneSoDto.setCorpArgreementNo(mapString.get("susscess"));
 			} else {
-				character += "文件功能,";
+				character += "约号,";
 			}
 		}
-		//文件建立时间
-		if (ObjectUtils.isNull(inttraSoDto.getFilesDate())) {
-			msg += "文件建立时间,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getFilesDate(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setFilesDate(mapString.get("susscess"));
-			} else {
-				character += "文件建立时间,";
-			}
+		String issueType = "正本".equals(oneSoDto.getIssueType()) ? "ORI" : ("SEA WAY BILL".equals(oneSoDto.getIssueType()) ? "EXP" : "");
+		if(issueType.isEmpty()){
+			msg += "签单类型不支持,";
 		}
+
 		//运输条款代码
-		if (ObjectUtils.isNull(inttraSoDto.getTransportTermCode())) {
+		if (ObjectUtils.isNull(oneSoDto.getTransportTermCode())) {
 			msg += "运输条款代码,";
 		} else {
-			String serviceCode = serviceTermToInttraCode(inttraSoDto.getTransportTermCode());
-			inttraSoDto.setTransportTermCode(serviceCode);
-			inttraSoDto.setTransportTermName(serviceTermFromInttraCode(serviceCode));
+			String serviceCode = serviceTermToInttraCode(oneSoDto.getTransportTermCode());
+			oneSoDto.setTransportTermCode(serviceCode);
+			oneSoDto.setTransportTermName(serviceTermFromInttraCode(serviceCode));
 		}
-		//拼箱类型
-		if (ObjectUtils.isNull(inttraSoDto.getLclType())) {
-			msg += "拼箱类型,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getLclType(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setLclType(mapString.get("susscess"));
-			} else {
-				character += "拼箱类型,";
+
+		//运输条款代码
+		if (ObjectUtils.isNotNull(oneSoDto.getVesselId())) {
+			if (ObjectUtils.isNull(oneSoDto.getVesselCode())) {
+				msg += "ONE 船名 " + oneSoDto.getVesselName() + " 代码,";
 			}
 		}
-		//货币代码
-		if (ObjectUtils.isNotNull(inttraSoDto.getCurCode())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getCurCode(),true);
+
+		//船名
+		if (ObjectUtils.isNull(oneSoDto.getVesselName())) {
+			msg += "船名,";
+		} else {
+			Map<String, String> mapString = regularEn(oneSoDto.getVesselName(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 3)) {
-					textLength += "货币代码,";
+				if (regularLength(mapString.get("susscess"), 30)) {
+					textLength += "船名,";
 				} else {
-					inttraSoDto.setCurCode(mapString.get("susscess"));
+					oneSoDto.setVesselName(mapString.get("susscess"));
 				}
 			} else {
-				character += "货币代码,";
-			}
-		}
-		//费用值
-		if (ObjectUtils.isNotNull(inttraSoDto.getFeeAmount())) {
-			if (regularLength(inttraSoDto.getFeeAmount().toString(), 35)) {
-				textLength += "费用值,";
+				character += "船名,";
 			}
 		}
-		//Si备注
-		if (ObjectUtils.isNull(inttraSoDto.getRemarksCode())) {
-			msg += "Si备注,";
+		//装货港代码
+		if (ObjectUtils.isNull(oneSoDto.getPolCode())) {
+			msg += "装货港代码,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getRemarksCode(),false);
+			Map<String, String> mapString = regularEn(oneSoDto.getPolCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setRemarksCode(mapString.get("susscess"));
+				oneSoDto.setPolCode(mapString.get("susscess"));
 			} else {
-				character += "Si备注,";
+				character += "装货港代码,";
 			}
 		}
-		//总数的类型
-		if (ObjectUtils.isNull(inttraSoDto.getSumType())) {
-			msg += "总数的类型,";
-		}
-		//总数的值
-		if (ObjectUtils.isNull(inttraSoDto.getSumValue())) {
-			msg += "总数的值,";
-		}
-		//总数的单位
-		if (ObjectUtils.isNull(inttraSoDto.getSumUnit())) {
-			msg += "总数的单位,";
-		}
-		//地点类型
-		if (ObjectUtils.isNull(inttraSoDto.getLocationType())) {
-			msg += "地点类型,";
-		}
-		//详细地点
-		if (ObjectUtils.isNotNull(inttraSoDto.getLocation())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getLocation(),true);
+		//装货港
+		if (ObjectUtils.isNull(oneSoDto.getPolName())) {
+			msg += "装货港,";
+		} else {
+			Map<String, String> mapString = regularEn(oneSoDto.getPolName(),true);
 			if ("200".equals(mapString.get("code"))) {
 				if (regularLength(mapString.get("susscess"), 256)) {
-					textLength += "详细地点,";
-				} else {
-					inttraSoDto.setLocation(mapString.get("susscess"));
-				}
-			} else {
-				character += "详细地点,";
-			}
-		}
-		//地点国家代码
-		if (ObjectUtils.isNotNull(inttraSoDto.getCountryCode())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getCountryCode(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 25)) {
-					textLength += "地点国家代码,";
+					textLength += "装货港,";
 				} else {
-					inttraSoDto.setCountryCode(mapString.get("susscess"));
+					oneSoDto.setPolName(mapString.get("susscess"));
 				}
 			} else {
-				character += "地点国家代码,";
+				character += "装货港,";
 			}
 		}
-		//编号类型
-		if (ObjectUtils.isNull(inttraSoDto.getBillNoType())) {
-			msg += "编号类型,";
-		}
-		//编号值
-		if (ObjectUtils.isNull(inttraSoDto.getBillNoValue())) {
-			msg += "编号值,";
+		//收货地代码
+		if (ObjectUtils.isNull(oneSoDto.getPlaceReceiptCode())) {
+			msg += "收货地代码,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getBillNoValue(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 30)) {
-					textLength += "编号值,";
-				} else {
-					inttraSoDto.setBillNoValue(mapString.get("susscess"));
-				}
-			} else {
-				character += "编号值,";
-			}
-		}
-		//日期类型
-		if (ObjectUtils.isNull(inttraSoDto.getValidityPeriodType())) {
-			msg += "日期类型,";
-		}
-		//款项类型
-		if (ObjectUtils.isNull(inttraSoDto.getPaymentType())) {
-			msg += "款项类型,";
-		}
-		//付款方式代码
-		if (ObjectUtils.isNull(inttraSoDto.getPaymentTypeCode())) {
-			msg += "付款方式代码,";
-		}
-		//提单号
-		if (ObjectUtils.isNotNull(inttraSoDto.getBillNo())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getBillNo(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceReceiptCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 30)) {
-					textLength += "提单号,";
-				} else {
-					inttraSoDto.setBillNo(mapString.get("susscess"));
-				}
+				oneSoDto.setPlaceReceiptCode(mapString.get("susscess"));
 			} else {
-				character += "提单号,";
+				character += "收货地代码,";
 			}
 		}
-		//航次
-		if (ObjectUtils.isNull(inttraSoDto.getVoyageNo())) {
-			msg += "航次,";
+		//收货地
+		if (ObjectUtils.isNull(oneSoDto.getPlaceReceiptName())) {
+			msg += "收货地,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getVoyageNo(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceReceiptName(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 17)) {
-					textLength += "航次,";
-				} else {
-					if (mapString.get("susscess").contains("V.")) {
-						special += "航次不能有“V.”,";
-					} else {
-						inttraSoDto.setVoyageNo(mapString.get("susscess"));
-					}
-				}
-			} else {
-				character += "航次,";
-			}
-		}
-		//船名代码
-		if (ObjectUtils.isNotNull(inttraSoDto.getVesselCode())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getVesselCode(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 9)) {
-					textLength += "船名代码,";
+				if (regularLength(mapString.get("susscess"), 256)) {
+					textLength += "收货地,";
 				} else {
-					inttraSoDto.setVesselCode(mapString.get("susscess"));
+					oneSoDto.setPlaceReceiptName(mapString.get("susscess"));
 				}
 			} else {
-				character += "船名代码,";
+				character += "收货地,";
 			}
 		}
-		//船名
-		if (ObjectUtils.isNull(inttraSoDto.getVesselName())) {
-			msg += "船名,";
+		//卸货港代码
+		if (ObjectUtils.isNull(oneSoDto.getPodCode())) {
+			msg += "卸货港代码,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getVesselName(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPodCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 35)) {
-					textLength += "船名,";
-				} else {
-					inttraSoDto.setVesselName(mapString.get("susscess"));
-				}
+				oneSoDto.setPodCode(mapString.get("susscess"));
 			} else {
-				character += "船名,";
+				character += "卸货港代码,";
 			}
 		}
-		//Loc地点类型
-		if (ObjectUtils.isNull(inttraSoDto.getAddressType())) {
-			msg += "Loc地点类型,";
-		}
-		//Loc地点描述
-		if (ObjectUtils.isNotNull(inttraSoDto.getAddressDescribe())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getAddressDescribe(),true);
+		//卸货港
+		if (ObjectUtils.isNull(oneSoDto.getPodName())) {
+			msg += "卸货港,";
+		} else {
+			Map<String, String> mapString = regularEn(oneSoDto.getPodName(),true);
 			if ("200".equals(mapString.get("code"))) {
 				if (regularLength(mapString.get("susscess"), 256)) {
-					textLength += "Loc地点描述,";
-				} else {
-					inttraSoDto.setAddressDescribe(mapString.get("susscess"));
-				}
-			} else {
-				character += "Loc地点描述,";
-			}
-		}
-		//Loc国家代码
-		if (ObjectUtils.isNotNull(inttraSoDto.getAddressCountryCode())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getAddressCountryCode(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 25)) {
-					textLength += "Loc国家代码,";
+					textLength += "卸货港,";
 				} else {
-					inttraSoDto.setAddressCountryCode(mapString.get("susscess"));
+					oneSoDto.setPodName(mapString.get("susscess"));
 				}
 			} else {
-				character += "Loc国家代码,";
-			}
-		}
-		//公司类型
-		if (ObjectUtils.isNull(inttraSoDto.getCompanyType())) {
-			msg += "公司类型,";
-		}
-		//提单份数
-		if (ObjectUtils.isNotNull(inttraSoDto.getBillLadingNumber())) {
-			if (regularLength(inttraSoDto.getBillLadingNumber().toString(), 2)) {
-				textLength += "提单份数,";
-			}
-		}
-		//包装件数
-		if (ObjectUtils.isNull(inttraSoDto.getPackagesNumbers())) {
-			msg += "包装件数,";
-		} else {
-			if (regularLength(inttraSoDto.getPackagesNumbers().toString(), 8)) {
-				textLength += "包装件数,";
+				character += "卸货港,";
 			}
 		}
-		//包装代码
-		if (ObjectUtils.isNull(inttraSoDto.getPackagesCode())) {
-			msg += "包装代码,";
+		//交货地代码
+		if (ObjectUtils.isNull(oneSoDto.getPlaceDeliveryCode())) {
+			msg += "交货地代码,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getPackagesCode(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setPackagesCode(mapString.get("susscess"));
-			} else {
-				character += "包装代码,";
-			}
-		}
-		//包装描述
-		if (ObjectUtils.isNotNull(inttraSoDto.getPackagesDescribe())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getPackagesDescribe(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceDeliveryCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 35)) {
-					textLength += "包装描述,";
-				} else {
-					inttraSoDto.setPackagesDescribe(mapString.get("susscess"));
-				}
+				oneSoDto.setPlaceDeliveryCode(mapString.get("susscess"));
 			} else {
-				character += "包装描述,";
-			}
-		}
-		//HS 编码
-		if (ObjectUtils.isNotNull(inttraSoDto.getHsCode())) {
-			if (regularLength(inttraSoDto.getHsCode().toString(), 10)) {
-				textLength += "HS 编码,";
+				character += "交货地代码,";
 			}
 		}
-		//麦头
-		if (ObjectUtils.isNull(inttraSoDto.getMarks())) {
-			msg += "麦头,";
+		//交货地
+		if (ObjectUtils.isNull(oneSoDto.getPlaceDeliveryName())) {
+			msg += "交货地,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getMarks(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceDeliveryName(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 1750)) {
-					textLength += "麦头,";
-				} else {
-					inttraSoDto.setMarks(mapString.get("susscess"));
-				}
-			} else {
-				character += "麦头,";
-			}
-		}
-		//页号
-		if (ObjectUtils.isNotNull(inttraSoDto.getPageNumber())) {
-			if (regularLength(inttraSoDto.getPageNumber().toString(), 7)) {
-				textLength += "页号,";
-			}
-		}
-		//闪点
-		if (ObjectUtils.isNotNull(inttraSoDto.getDgFlashPoint())) {
-			if (regularLength(inttraSoDto.getDgFlashPoint().toString(), 3)) {
-				textLength += "闪点,";
-			}
-		}
-		//应急措施号
-		if (ObjectUtils.isNotNull(inttraSoDto.getEmergencyMeasureNo())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getEmergencyMeasureNo(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 6)) {
-					textLength += "应急措施号,";
+				if (regularLength(mapString.get("susscess"), 256)) {
+					textLength += "交货地,";
 				} else {
-					inttraSoDto.setEmergencyMeasureNo(mapString.get("susscess"));
+					oneSoDto.setPlaceDeliveryName(mapString.get("susscess"));
 				}
 			} else {
-				character += "应急措施号,";
+				character += "交货地,";
 			}
 		}
-		//危险品备注
-		if (ObjectUtils.isNotNull(inttraSoDto.getDgRemarks())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getDgRemarks(),false);
+		//目的地代码
+		if (ObjectUtils.isNull(oneSoDto.getPlaceDestinationCode())) {
+			msg += "目的地代码,";
+		} else {
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceDestinationCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 30)) {
-					textLength += "危险品备注,";
-				} else {
-					inttraSoDto.setDgRemarks(mapString.get("susscess"));
-				}
+				oneSoDto.setPlaceDestinationCode(mapString.get("susscess"));
 			} else {
-				character += "危险品备注,";
+				character += "目的地代码,";
 			}
 		}
-		//危险品联系人
-		if (ObjectUtils.isNotNull(inttraSoDto.getDgContacts())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getDgContacts(),true);
+		//目的地
+		if (ObjectUtils.isNull(oneSoDto.getPlaceDestinationName())) {
+			msg += "目的地,";
+		} else {
+			Map<String, String> mapString = regularEn(oneSoDto.getPlaceDestinationName(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 35)) {
-					textLength += "危险品联系人,";
+				if (regularLength(mapString.get("susscess"), 256)) {
+					textLength += "目的地,";
 				} else {
-					inttraSoDto.setDgContacts(mapString.get("susscess"));
+					oneSoDto.setPlaceDestinationName(mapString.get("susscess"));
 				}
 			} else {
-				character += "危险品联系人,";
+				character += "目的地,";
 			}
 		}
-		//危险品电话号码
-		if (ObjectUtils.isNotNull(inttraSoDto.getDgTel())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getDgTel(),true);
-			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 512)) {
-					textLength += "危险品电话号码,";
-				} else {
-					inttraSoDto.setDgTel(mapString.get("susscess"));
+
+		String text = "";
+		if (ObjectUtils.isNotNull(oneSoDto.getBookingRemarks())) {
+			String bookingRemarks = oneSoDto.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 = escapeEDILine(line);
+						} else {
+							text += ":" + escapeEDILine(line);
+						}
+					}
+					if(i == 4){
+						break;
+					}
 				}
-			} else {
-				character += "危险品电话号码,";
 			}
 		}
-		//箱型代码
-		if (ObjectUtils.isNull(inttraSoDto.getBoxCode())) {
-			msg += "箱型代码,";
+		oneSoDto.setBookingRemarks(text);
+
+		//发货人
+		if (ObjectUtils.isNull(oneSoDto.getHShipper())) {
+			msg += "发货人,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getBoxCode(),true);
-			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setBoxCode(mapString.get("susscess"));
-			} else {
-				character += "箱型代码,";
-			}
-		}
-		//温度
-		if (ObjectUtils.isNotNull(inttraSoDto.getTemperature())) {
-			if (regularLength(inttraSoDto.getTemperature().toString(), 3)) {
-				textLength += "温度,";
-			}
-		}
-		//温度单位
-		if (ObjectUtils.isNotNull(inttraSoDto.getTemperatureUnit())) {
-			Map<String, String> mapString = regularEn(inttraSoDto.getTemperatureUnit(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getHShipper(), false);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setTemperatureUnit(mapString.get("susscess"));
+				oneSoDto.setHShipper(mapString.get("susscess"));
 			} else {
-				character += "温度单位,";
-			}
-		}
-		//单箱货物件数
-		if (ObjectUtils.isNull(inttraSoDto.getBoxGoodNumber())) {
-			msg += "单箱货物件数,";
-		}
-		//记录行数
-		if (ObjectUtils.isNull(inttraSoDto.getRecordRows())) {
-			msg += "记录行数,";
-		} else {
-			if (regularLength(inttraSoDto.getRecordRows().toString(), 6)) {
-				textLength += "记录行数,";
+				character += "发货人,";
 			}
 		}
-		//箱号
-		if (ObjectUtils.isNull(inttraSoDto.getBoxNo())) {
-			msg += "箱号,";
+		//收货人
+		if (ObjectUtils.isNull(oneSoDto.getHConsignee())) {
+			msg += "收货人,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getBoxNo(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getHConsignee(),false);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setBoxNo(mapString.get("susscess"));
+				oneSoDto.setHConsignee(mapString.get("susscess"));
 			} else {
-				character += "箱号,";
+				character += "收货人,";
 			}
 		}
-		//封号
-		if (ObjectUtils.isNull(inttraSoDto.getSeal())) {
-			msg += "封号,";
+		//通知人
+		if (ObjectUtils.isNull(oneSoDto.getHNotify())) {
+			msg += "通知人,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getSeal(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getHNotify(),false);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setSeal(mapString.get("susscess"));
+				oneSoDto.setHNotify(mapString.get("susscess"));
 			} else {
-				character += "封号,";
+				character += "通知人,";
 			}
 		}
-		//封箱单位
-		if (ObjectUtils.isNull(inttraSoDto.getSealUnit())) {
-			msg += "封箱单位,";
-		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getSealUnit(),true);
+
+		if (ObjectUtils.isNotNull(oneSoDto.getHNotify2())) {
+			Map<String, String> mapString = regularEn(oneSoDto.getHNotify2(),false);
 			if ("200".equals(mapString.get("code"))) {
-				inttraSoDto.setSealUnit(mapString.get("susscess"));
+				oneSoDto.setHNotify2(mapString.get("susscess"));
 			} else {
-				character += "封箱单位,";
+				character += "第二通知人,";
 			}
 		}
-		//信息编号
-		if (ObjectUtils.isNull(inttraSoDto.getInformationNoEnd())) {
-			msg += "信息编号,";
+
+		//包装代码
+		if (ObjectUtils.isNull(oneSoDto.getPackagesCode())) {
+			msg += "包装代码,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getInformationNoEnd(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPackagesCode(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 14)) {
-					textLength += "信息编号,";
-				} else {
-					inttraSoDto.setInformationNoEnd(mapString.get("susscess"));
-				}
+				oneSoDto.setPackagesCode(mapString.get("susscess"));
 			} else {
-				character += "信息编号,";
+				character += "包装代码,";
 			}
 		}
-		//文件交换编号
-		if (ObjectUtils.isNull(inttraSoDto.getFileExchangeNumberEnd())) {
-			msg += "文件交换编号,";
+		//包装描述
+		if (ObjectUtils.isNull(oneSoDto.getPackagesDescribe())) {
+			msg += "包装描述,";
 		} else {
-			Map<String, String> mapString = regularEn(inttraSoDto.getFileExchangeNumberEnd(),true);
+			Map<String, String> mapString = regularEn(oneSoDto.getPackagesDescribe(),true);
 			if ("200".equals(mapString.get("code"))) {
-				if (regularLength(mapString.get("susscess"), 14)) {
-					textLength += "文件交换编号,";
+				if (regularLength(mapString.get("susscess"), 35)) {
+					textLength += "包装描述,";
 				} else {
-					inttraSoDto.setFileExchangeNumberEnd(mapString.get("susscess"));
+					oneSoDto.setPackagesDescribe(mapString.get("susscess"));
 				}
 			} else {
-				character += "文件交换编号,";
+				character += "包装描述,";
 			}
 		}
+
 		String data = "";
 		if (ObjectUtils.isNotNull(msg)) {
 			code = 500;
@@ -2430,10 +2174,17 @@ public class RegularUtils {
 		map.put("data", data);
 		return map;
 	}
+	public static Map<String, Object> notNullOneSIDto(InttraSoDto aplSiDto) {
+		Map<String, Object> RSO = notNullOneBookingDto(aplSiDto, "SI");
+		if (200 != Integer.parseInt(RSO.get("code").toString())) {
+			// 发生错误时,直接返回
+		}
 
-
+		return RSO;
 	}
 
+}
+
 	/*Class<?> inttraSoDtoClass = inttraSoDto.getClass();
 
 		Field[] fileds = inttraSoDtoClass.getDeclaredFields();

+ 28 - 0
blade-service/blade-los/src/main/java/org/springblade/los/edi/dto/InttraSoDto.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.hibernate.validator.constraints.Length;
 import org.springblade.los.Util.LosNotNull;
+import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.edi.entity.EdiTypes;
 
 import javax.validation.constraints.NotNull;
@@ -421,6 +422,11 @@ public class InttraSoDto {
 	 * 提单类型
 	 */
 	private String billLadingType;
+
+	/**
+	 * 签单类型
+	 */
+	private String issueType;
 	/**
 	 * 付款状态
 	 */
@@ -558,6 +564,13 @@ public class InttraSoDto {
 	 */
 	private EdiTypes ediTypes;
 
+	private List<InttraSoDto> hblBillsList;
+
+	/**
+	 * 是否主单, DD 和 MM 均返回 true
+	 */
+	private Boolean isMasterBill;
+
 	/**
 	 * 是否 DOOR TO 服务方式
 	 */
@@ -600,4 +613,19 @@ public class InttraSoDto {
 			return ("HYCK".equals(this.ediTypes.getType()) && "APL-SI".equals(ediTypes.getCode()));
 		}
 	}
+
+	public Boolean ediTypeIsHYCK_ONE_Booking (){
+		if(ObjectUtils.isNull(this.ediTypes)){
+			return false;
+		}else {
+			return ("HYCK".equals(this.ediTypes.getType()) && "ONE-BOOKING".equals(ediTypes.getCode()));
+		}
+	}
+	public Boolean ediTypeIsHYCK_ONE_SI (){
+		if(ObjectUtils.isNull(this.ediTypes)){
+			return false;
+		}else {
+			return ("HYCK".equals(this.ediTypes.getType()) && "ONE-SI".equals(ediTypes.getCode()));
+		}
+	}
 }

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

@@ -48,5 +48,21 @@ public interface IEDISenderService {
 	 */
 	FilesCenter sendingAplSi(InttraSoDto aplSoDto, JsonNode ediParamCarrier);
 
+	/**
+	 * apl so
+	 * @param aplSoDto
+	 * @param ediParamCarrier
+	 * @return
+	 */
+	FilesCenter sendingOneBooking(InttraSoDto oneSoDto, JsonNode ediParamCarrier);
+
+	/**
+	 * apl si
+	 * @param aplSoDto
+	 * @param ediParamCarrier
+	 * @return
+	 */
+	FilesCenter sendingOneSI(InttraSoDto oneSiDto, JsonNode ediParamCarrier);
+
 
 }

+ 765 - 3
blade-service/blade-los/src/main/java/org/springblade/los/edi/service/impl/EDISenderServiceImpl.java

@@ -579,8 +579,8 @@ public class EDISenderServiceImpl implements IEDISenderService {
 					writer.newLine();
 					count += 1;
 				}
-				/* =================1530=================  */
 //				INTTRA 不录入
+				/* =================1530=================  */
 //				if (ObjectUtils.isNotNull(inttraSoDto.getDgRemarks())) {
 //					writer.write("FTX+AAC+++" + inttraSoDto.getDgRemarks() + "'");
 //					writer.newLine();
@@ -1313,7 +1313,7 @@ public class EDISenderServiceImpl implements IEDISenderService {
 			count++;
 
 			// 12	PORTS 地点信息
-			writer.write("11");
+			writer.write("12");
 			// 收货地代码 + 收货地代名称
 			writer.write(":" + aplSoDto.getPlaceReceiptCode() + ":" + aplSoDto.getPlaceReceiptName() );
 			// 装货港代码 + 装货港
@@ -1411,7 +1411,7 @@ public class EDISenderServiceImpl implements IEDISenderService {
 			// 2) CARGO ID (货物标识)的填法: S=普通,  R=冷冻,   D=危险 ,  O=非标
 			// 41:1::S:8378:CT:CARTONS:20559:138.8::::::20559'
 			// 记录类型标识 + 货物序号 + 货类代码 + 货物标识
-			writer.write("40:1::" + ("danger".equals(cargoType) ? "D" : ("reefer".equals(cargoType) ? "R" : "S")));
+			writer.write("41:1::" + ("danger".equals(cargoType) ? "D" : ("reefer".equals(cargoType) ? "R" : "S")));
 			// 第一层包装件数 + 第一层包装类型 + 第一层包装说明
 			writer.write(":" + aplSoDto.getPackagesNumber() + ":" + aplSoDto.getPackagesCode() + ":" + aplSoDto.getPackagesDescribe());
 			// 第一层包装皮重 + 第一层包装尺码
@@ -1519,6 +1519,230 @@ public class EDISenderServiceImpl implements IEDISenderService {
 			String cargoType = aplSiDto.getCargoType();
 
 			// 向文件写入数据
+			// 00 HEAD RECORD
+			// 2=增加  3=删除 4=变更  9=原始
+			writer.write("00:IFTMIN:BOOKING:9:" + aplSiDto.getSenderCode() + ":APLMBF:" + aplSiDto.getFileDate() + "'");
+			writer.newLine();
+			count++;
+
+			// 02 BOOKING 订舱信息
+			// 记录类型标识
+			writer.write("02");
+			// 运编号
+			writer.write(":" + (ObjectUtils.isNotNull(aplSiDto.getBookingNo()) ? aplSiDto.getBookingNo() : (ObjectUtils.isNotNull(aplSiDto.getMblNo()) ? aplSiDto.getMblNo() : "")));
+			// 提单号
+			writer.write(":" + (ObjectUtils.isNotNull(aplSiDto.getMblNo()) ? aplSiDto.getMblNo() : ""));
+			// 交货条款 CY-CY(pier-pier/port):30
+			//CY-CFS(pier/port-door): 29
+			//CFS-CY(door-pier/port): 28
+			//CFS-CFS(door-door): 27
+			writer.write(":" + aplSiDto.getTransportTermName());
+			// 货代方企业名称
+			writer.write(":" + aplSiDto.getSenderCode());
+			// 即接受订舱的人的代码 + 签单人说明 + 询价单位 + 国外订舱单位 + 转船标识 + 分批 + 装期 + 效期 + 运费协议号 + 费率本代码 + 服务合同号 + BOND NO + 舱位互用标识
+			writer.write(":APLMBF::::::::" + aplSiDto.getCorpArgreementNo() + "::::'");
+			writer.newLine();
+			count++;
+
+			// 03 提单信息,不填
+
+			// 11 VESSEL 船舶信息
+			// 记录类型标识 + 船舶呼号 +  船名 + 航次 + 船舶经营人
+			writer.write("11:" + aplSiDto.getVesselCode() + ":" + aplSiDto.getVesselName() + ":" + aplSiDto.getVoyageNo() + ":APL'" );
+			writer.newLine();
+			count++;
+
+			// 12	PORTS 地点信息
+			writer.write("12");
+			// 收货地代码 + 收货地代名称
+			writer.write(":" + aplSiDto.getPlaceReceiptCode() + ":" + aplSiDto.getPlaceReceiptName() );
+			// 装货港代码 + 装货港
+			writer.write(":" + aplSiDto.getPolCode() + ":" + aplSiDto.getPolName() );
+			// 卸货港代码 + 卸货港代
+			writer.write(":" + aplSiDto.getPodCode() + ":" + aplSiDto.getPodName() );
+			// 中转港代码 + 中转港 不填
+			writer.write("::");
+			// 交货地代码  + 交货地
+			writer.write(":" + aplSiDto.getPlaceDeliveryCode() + ":" + aplSiDto.getPlaceDeliveryName() );
+			// 目的地代码  + 目的地
+			writer.write(":" + aplSiDto.getPlaceDestinationCode() + ":" + aplSiDto.getPlaceDestinationName() );
+			// 堆场代码
+			// if(V_Depotid=142,'L&S',if(V_Depotid=167,'ITC',if(V_Depotid=341,'COS',if(V_Depotid=342,'MIN','QCT'))))
+			String depotCode = "";
+			writer.write(":" + depotCode + "'");
+			writer.newLine();
+			count++;
+
+			// 14 FREIGHT CLAUSE             运费条款
+			String pm = aplSiDto.getPaymentType();
+			writer.write("14:" + ("PP".equals(pm) ? "P" : ("CC".equals(pm) ? "C" : "OTH")) + ":" + ("PP".equals(pm) ? "FREIGHT PREPAID" : ("CC".equals(pm) ? "FREIGHT COLLECT" : "OTHER")) + "'");
+			writer.newLine();
+			count++;
+
+			// 17 REMARKS 订舱备注 其他信息
+			writer.write("17:" + aplSiDto.getBookingRemarks() + "'");
+			writer.newLine();
+			count++;
+
+
+			// 20	SHIPPER 发货人
+			// 处理收发通之前,先处理货描,因为收发通多余的部分要追加到货描
+			List<String> goodsDesc = RegularUtils.reformatEDIText(aplSiDto.getGoodsDesc(), 70, true);
+			List<String> goodsDescAddtion = new ArrayList<>();
+			// 发货人
+			List<String> hShipper = RegularUtils.reformatEDIText(aplSiDto.getHShipper(), 35, true);
+			writer.write("20:"); // 发货人代码为空
+			for (int l = 0; l < hShipper.size(); l++) {
+				if (l < 5) {
+					writer.write(":" + hShipper.get(l));
+				} else {
+					goodsDescAddtion.add("*" + hShipper.get(l));
+				}
+			}
+			writer.write("'");
+			writer.newLine();
+			count += 1;
+
+			// 21	CONSIGNEE 收货人
+			List<String> hConsignee = RegularUtils.reformatEDIText(aplSiDto.getHConsignee(), 35, true);
+			writer.write("21:"); // 收货人代码为空
+			for (int l = 0; l < hConsignee.size(); l++) {
+				if (l < 5) {
+					writer.write(":" + hConsignee.get(l));
+				} else {
+					goodsDescAddtion.add("**" + hConsignee.get(l));
+				}
+			}
+			writer.write("'");
+			writer.newLine();
+			count += 1;
+
+			// 22	NOTIFY PARTY 通知人
+			List<String> hNotify = RegularUtils.reformatEDIText(aplSiDto.getHNotify(), 35, true);
+			writer.write("22:"); // 通知人代码为空
+			for (int l = 0; l < hNotify.size(); l++) {
+				if (l < 5) {
+					writer.write(":" + hNotify.get(l));
+				} else {
+					goodsDescAddtion.add("***" + hNotify.get(l));
+				}
+			}
+			writer.write("'");
+			writer.newLine();
+			count += 1;
+
+			// 23	NOTIFY PARTY 第二通知人
+			if(ObjectUtils.isNotNull(aplSiDto.getHNotify2())) {
+				List<String> hNotify2 = RegularUtils.reformatEDIText(aplSiDto.getHNotify2(), 35, true);
+				writer.write("23:"); // 通知人代码为空
+				for (int l = 0; l < hNotify2.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hNotify2.get(l));
+						// 多余抛弃
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+			}
+
+			// 41 CARGO OF BOOKING  订舱货物
+			// 注:1)货物有两种包装,如是大包装(如托盘),则必须同时填小包装件数和包装类型;
+			// 2) CARGO ID (货物标识)的填法: S=普通,  R=冷冻,   D=危险 ,  O=非标
+			// 41:1::S:8378:CT:CARTONS:20559:138.8::::::20559'
+			// 记录类型标识 + 货物序号 + 货类代码 + 货物标识
+			writer.write("41:1::" + ("danger".equals(cargoType) ? "D" : ("reefer".equals(cargoType) ? "R" : "S")));
+			// 第一层包装件数 + 第一层包装类型 + 第一层包装说明
+			writer.write(":" + aplSiDto.getPackagesNumber() + ":" + aplSiDto.getPackagesCode() + ":" + aplSiDto.getPackagesDescribe());
+			// 第一层包装皮重 + 第一层包装尺码
+			writer.write(":" + aplSiDto.getGrossWeight() + ":" + aplSiDto.getVolumeOfGoods() + ":" + aplSiDto.getPackagesDescribe());
+			// 第二层包装件数 + 第二层包装类型 + 第二层包装说明 + 第二层包装皮重 + 第二层包装尺码 + 货毛重
+			writer.write("::::::" + aplSiDto.getGrossWeight() + "'");
+			writer.newLine();
+			count += 1;
+
+			// 43 DANGEROUS, REEFER & OOG 危险品,冷藏和超标信息
+			// 温度中,除正(+)负(-)号及小数点外,最多只能三位数字。
+			if (ObjectUtils.isNotNull(aplSiDto.getPreCntrs())) {
+				List<Map<String, Object>> mapList = aplSiDto.getPreCntrs();
+				if(mapList.size()>0){
+					Map<String, Object> map = mapList.get(0);
+					if(ObjectUtils.isNotNull(map.get("temperature")) && ObjectUtils.isNotNull(map.get("ventilation"))){
+						// '43::::::::::'+fieldbyName('Draught').asString+':C:'+FieldbyName('Temperature').asString+':::'
+						writer.write("43::::::::::" + map.get("ventilation") + ":C:" + map.get("temperature") + ":::'");
+						writer.newLine();
+						count += 1;
+					}
+				}
+			}
+
+			// 44	MARKS & NOS. 唛头 1-10 行
+			List<String> goodsMarks = RegularUtils.reformatEDIText(aplSiDto.getMarks(), 35, true);
+			writer.write("44");
+			if(goodsMarks.size()>0) {
+				for (String line : goodsMarks) {
+					writer.write(":" + line);
+				}
+			}else{
+				writer.write(":");
+			}
+			writer.write("'");
+			writer.newLine();
+			count += 1;
+
+			// 47 CARGO DESCRIPTION 货物描述 5行一组
+			Integer lineSpecCount = 0;
+			String dl = "";
+			for(String line : goodsDesc){
+				if(lineSpecCount<=4){
+					dl += ":" + line;
+				}
+				if(lineSpecCount==4){
+					writer.write("47" + dl + "'");
+					writer.newLine();
+					count += 1;
+
+					lineSpecCount = 0;
+					dl = "";
+				}
+			}
+			for(String line : goodsDescAddtion) {
+				writer.write("47:" + line + "'");
+				writer.newLine();
+				count += 1;
+			}
+
+			// 48 CONTAINER OF BOOKING 订舱预配箱
+			if (ObjectUtils.isNotNull(aplSiDto.getPreCntrs())) {
+				List<Map<String, Object>> mapList = aplSiDto.getPreCntrs();
+				for (Map<String, Object> map1 : mapList) {
+					// 记录类型标识 + 集装箱尺寸类 + 集装箱箱数
+					writer.write("48:" + map1.get("sizeType") + ":" + map1.get("cntrQty") );
+					// 集装箱状态 + 主拼号 + 装箱方式 自选/内装/自派车队等
+					writer.write(":" + ("FCL".equals(aplSiDto.getLoadType()) ? "F" : "L") + "::" );
+					//  装箱地点代码 + 装箱地点说明 + 货主箱标志
+					writer.write(":" + aplSiDto.getCyCode() + "::N'" );
+					writer.newLine();
+					count += 1;
+				}
+			}
+
+			// 51 CONTAINER DETAIL 已知箱号的集装箱细
+			if (ObjectUtils.isNotNull(aplSiDto.getLoadedCntrs())) {
+				List<Map<String, Object>> mapList = aplSiDto.getLoadedCntrs();
+				for (Map<String, Object> cntr : mapList) {
+					// 记录类型标识 + 箱号 +  铅封号
+					writer.write("51:" + cntr.get("cntrNo") + ":" + cntr.get("sealNo"));
+					// 箱内货物件数 + 箱内货重 + 箱皮重 + 箱内货物尺码 + 箱内货物品名
+					writer.write(":" + cntr.get("quantity") + ":" + cntr.get("grossWeight") + ":" + cntr.get("volume") + ":'");
+					writer.newLine();
+					count += 1;
+				}
+			}
+
+			// 99 TRAILER RECORD              尾记录
+			// RECORD TOTAL OF FILE   记录总数	9(6)	包括:头、尾记录
+			writer.write("99:" + (++count) + "'");
 
 			writer.close();
 
@@ -1527,5 +1751,543 @@ public class EDISenderServiceImpl implements IEDISenderService {
 			throw new SecurityException("生成edi文件失败");
 		}
 	}
+
+	@Override
+	public FilesCenter sendingOneBooking(@Validated InttraSoDto oneSoDto, JsonNode ediParamCarrier) {
+		try {
+			List<InttraSoDto> billsList = new ArrayList<>();
+			billsList.add(oneSoDto);
+			oneSoDto.setIsMasterBill(true);
+			if(ObjectUtils.isNotNull(oneSoDto.getHblBillsList())){
+				for(InttraSoDto bill : oneSoDto.getHblBillsList()){
+					Map<String, Object> status = RegularUtils.notNullOneBookingDto(bill, "SO");;
+					if ("200".equals(status.get("code").toString())) {
+						bill.setIsMasterBill(false);
+						billsList.add(bill);
+					}else{
+						throw new SecurityException(status.get("data").toString());
+					}
+				}
+			}
+
+			String localFolder = genEdiLocalFolder(oneSoDto, ediParamCarrier);
+			String localFileName = genEdiLocalFileName(oneSoDto, ediParamCarrier);
+			File file = new File(localFolder, localFileName);
+			file.createNewFile();
+			// 打开文件输出流进行写入操作
+			BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+			int count = 0;
+			String carrierCode = oneSoDto.getCarrierCode();
+			String cargoType = oneSoDto.getCargoType();
+
+			// 向文件写入数据
+			// 00 HEAD RECORD
+			// 2=增加  3=删除 4=变更  9=原始
+			writer.write("00:IFTMBF:BOOKING:9:" + oneSoDto.getSenderCode() + ":APLMBF:" + oneSoDto.getFileDate() + "'");
+			writer.newLine();
+			count++;
+
+			for(InttraSoDto bill : billsList) {
+				// 02 BOOKING 订舱信息
+				// 记录类型标识
+				writer.write("02");
+				// 运编号
+				writer.write(":" + (ObjectUtils.isNotNull(bill.getBookingNo()) ? bill.getBookingNo() : (ObjectUtils.isNotNull(bill.getMblNo()) ? bill.getMblNo() : "")));
+				// 提单号
+				writer.write(":" + (ObjectUtils.isNotNull(bill.getMblNo()) ? bill.getMblNo() : ""));
+				// 交货条款 CY-CY(pier-pier/port):30
+				//CY-CFS(pier/port-door): 29
+				//CFS-CY(door-pier/port): 28
+				//CFS-CFS(door-door): 27
+				writer.write(":" + bill.getTransportTermName());
+				// 货代方企业名称
+				writer.write(":" + bill.getSenderName());
+				// 即接受订舱的人的代码 + 签单人说明 + 询价单位 + 国外订舱单位 + 转船标识 + 分批 + 装期 + 效期 + 运费协议号 + 费率本代码 + 服务合同号 + BOND NO + 舱位互用标识 + Email
+				// ONE 业务缺少服务合同号
+				writer.write(":ONEY::::::::" + bill.getCorpArgreementNo() + ":::::"+bill.getSenderEmail()+"'");
+				writer.newLine();
+				count++;
+
+				// 03 提单信息
+				// 提单类型(ORI: BILL OF LADING EXP: WAYBILL) + 提单签发地代码 + 提单签发地 + 签发日期 + 正本提单份数 + 预付地点 + 到付地点
+				String issueType = "正本".equals(bill.getIssueType()) ? "ORI" : ("SEA WAY BILL".equals(bill.getIssueType()) ? "EXP" : "");
+				writer.write("03:" + issueType + "::" + bill.getIssuanceLand() + ":" + bill.getIssueDate() + ":3:"
+					+ ("PP".equals(bill.getPaymentType()) ? bill.getPaymentLand() : "")
+					+ ("CC".equals(bill.getPaymentType()) ? bill.getPaymentLand() : "") + "'");
+				writer.newLine();
+				count++;
+
+				// 11 VESSEL 船舶信息
+				// 记录类型标识 + 船舶呼号 +  船名 + 航次 + 船舶经营人
+				writer.write("11:" + bill.getVesselCode() + ":" + bill.getVesselName() + ":" + bill.getVoyageNo() + ":APL'");
+				writer.newLine();
+				count++;
+
+				// 12	PORTS 地点信息
+				writer.write("12");
+				// 收货地代码 + 收货地代名称
+				writer.write(":" + bill.getPlaceReceiptCode() + ":" + bill.getPlaceReceiptName());
+				// 装货港代码 + 装货港
+				writer.write(":" + bill.getPolCode() + ":" + bill.getPolName());
+				// 卸货港代码 + 卸货港代
+				writer.write(":" + bill.getPodCode() + ":" + bill.getPodName());
+				// 中转港代码 + 中转港 不填
+				writer.write("::");
+				// 交货地代码  + 交货地
+				writer.write(":" + bill.getPlaceDeliveryCode() + ":" + bill.getPlaceDeliveryName());
+				// 目的地代码  + 目的地
+				writer.write(":" + bill.getPlaceDestinationCode() + ":" + bill.getPlaceDestinationName());
+				// 堆场代码
+				// if(V_Depotid=142,'L&S',if(V_Depotid=167,'ITC',if(V_Depotid=341,'COS',if(V_Depotid=342,'MIN','QCT'))))
+				String depotCode = "";
+				writer.write(":" + depotCode + "'");
+				writer.newLine();
+				count++;
+
+				// 14 FREIGHT CLAUSE             运费条款
+				String pm = bill.getPaymentType();
+				writer.write("14:" + ("PP".equals(pm) ? "P" : ("CC".equals(pm) ? "C" : "OTH")) + ":" + ("PP".equals(pm) ? "FREIGHT PREPAID" : ("CC".equals(pm) ? "FREIGHT COLLECT" : "OTHER")) + "'");
+				writer.newLine();
+				count++;
+
+				//15  FREIGHT & CHARGES DETAILS 运费及费用细目
+				writer.write("15::NONE:" +  ("PP".equals(pm) ? "P" : ("CC".equals(pm) ? "C" : "OTH")) + "'");
+				writer.newLine();
+				count++;
+
+				// 17 REMARKS 订舱备注 其他信息
+				writer.write("17:" + bill.getBookingRemarks() + "'");
+				writer.newLine();
+				count++;
+
+				// 20	SHIPPER 发货人
+				// 处理收发通之前,先处理货描,因为收发通多余的部分要追加到货描
+				List<String> goodsDesc = RegularUtils.reformatEDIText(bill.getGoodsDesc(), 70, true);
+				List<String> goodsDescAddtion = new ArrayList<>();
+				// 发货人
+				List<String> hShipper = RegularUtils.reformatEDIText(bill.getHShipper(), 35, true);
+				writer.write("20:"); // 发货人代码为空
+				for (int l = 0; l < hShipper.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hShipper.get(l));
+					} else {
+						goodsDescAddtion.add("*" + hShipper.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 21	CONSIGNEE 收货人
+				List<String> hConsignee = RegularUtils.reformatEDIText(bill.getHConsignee(), 35, true);
+				writer.write("21:"); // 收货人代码为空
+				for (int l = 0; l < hConsignee.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hConsignee.get(l));
+					} else {
+						goodsDescAddtion.add("**" + hConsignee.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 22	NOTIFY PARTY 通知人
+				List<String> hNotify = RegularUtils.reformatEDIText(bill.getHNotify(), 35, true);
+				writer.write("22:"); // 通知人代码为空
+				for (int l = 0; l < hNotify.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hNotify.get(l));
+					} else {
+						goodsDescAddtion.add("***" + hNotify.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 23	NOTIFY PARTY 第二通知人
+				if (ObjectUtils.isNotNull(bill.getHNotify2())) {
+					List<String> hNotify2 = RegularUtils.reformatEDIText(bill.getHNotify2(), 35, true);
+					writer.write("23:"); // 通知人代码为空
+					for (int l = 0; l < hNotify2.size(); l++) {
+						if (l < 5) {
+							writer.write(":" + hNotify2.get(l));
+							// 多余抛弃
+						}
+					}
+					writer.write("'");
+					writer.newLine();
+					count += 1;
+				}
+
+				// 41 CARGO OF BOOKING  订舱货物
+				// 注:1)货物有两种包装,如是大包装(如托盘),则必须同时填小包装件数和包装类型;
+				// 2) CARGO ID (货物标识)的填法: S=普通,  R=冷冻,   D=危险 ,  O=非标
+				// 41:1::S:8378:CT:CARTONS:20559:138.8::::::20559'
+				// 记录类型标识 + 货物序号 + 货类代码 + 货物标识
+				writer.write("41:1::" + ("danger".equals(cargoType) ? "D" : ("reefer".equals(cargoType) ? "R" : "S")));
+				// 第一层包装件数 + 第一层包装类型 + 第一层包装说明
+				writer.write(":" + bill.getPackagesNumber() + ":" + bill.getPackagesCode() + ":" + bill.getPackagesDescribe());
+				// 第一层包装皮重 + 第一层包装尺码
+				writer.write(":" + bill.getGrossWeight() + ":" + bill.getVolumeOfGoods() + ":" + bill.getPackagesDescribe());
+				// 第二层包装件数 + 第二层包装类型 + 第二层包装说明 + 第二层包装皮重 + 第二层包装尺码 + 货毛重
+				writer.write("::::::" + bill.getGrossWeight() + "'");
+				writer.newLine();
+				count += 1;
+
+				// 43 DANGEROUS, REEFER & OOG 危险品,冷藏和超标信息
+				// 温度中,除正(+)负(-)号及小数点外,最多只能三位数字。
+				if (ObjectUtils.isNotNull(bill.getPreCntrs())) {
+					List<Map<String, Object>> mapList = bill.getPreCntrs();
+					if (mapList.size() > 0) {
+						Map<String, Object> map = mapList.get(0);
+						if (ObjectUtils.isNotNull(map.get("temperature")) && ObjectUtils.isNotNull(map.get("ventilation"))) {
+							// '43::::::::::'+fieldbyName('Draught').asString+':C:'+FieldbyName('Temperature').asString+':::'
+							writer.write("43::::::::::" + map.get("ventilation") + ":C:" + map.get("temperature") + ":::'");
+							writer.newLine();
+							count += 1;
+						}
+					}
+				}
+
+				// 44	MARKS & NOS. 唛头 1-10 行
+				List<String> goodsMarks = RegularUtils.reformatEDIText(bill.getMarks(), 35, true);
+				writer.write("44");
+				if (goodsMarks.size() > 0) {
+					for (String line : goodsMarks) {
+						writer.write(":" + line);
+					}
+				} else {
+					writer.write(":");
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 47 CARGO DESCRIPTION 货物描述 5行一组
+				Integer lineSpecCount = 0;
+				String dl = "";
+				for (String line : goodsDesc) {
+					if (lineSpecCount <= 4) {
+						dl += ":" + line;
+					}
+					if (lineSpecCount == 4) {
+						writer.write("47" + dl + "'");
+						writer.newLine();
+						count += 1;
+
+						lineSpecCount = 0;
+						dl = "";
+					}
+				}
+				for (String line : goodsDescAddtion) {
+					writer.write("47:" + line + "'");
+					writer.newLine();
+					count += 1;
+				}
+
+				// 48 CONTAINER OF BOOKING 订舱预配箱
+				if (ObjectUtils.isNotNull(bill.getPreCntrs())) {
+					List<Map<String, Object>> mapList = bill.getPreCntrs();
+					for (Map<String, Object> map1 : mapList) {
+						// 记录类型标识 + 集装箱尺寸类 + 集装箱箱数
+						writer.write("48:" + map1.get("sizeType") + ":" + map1.get("cntrQty"));
+						// 集装箱状态 + 主拼号 + 装箱方式 自选/内装/自派车队等
+						writer.write(":" + ("FCL".equals(bill.getLoadType()) ? "F" : "L") + "::");
+						//  装箱地点代码 + 装箱地点说明 + 货主箱标志
+						writer.write(":" + bill.getCyCode() + "::N'");
+						writer.newLine();
+						count += 1;
+					}
+				}
+			}
+
+			// 99 TRAILER RECORD              尾记录
+			// RECORD TOTAL OF FILE   记录总数	9(6)	包括:头、尾记录
+			writer.write("99:" + (++count) + "'");
+
+			writer.close();
+
+			return createEDIFilesCenter(oneSoDto, file);
+		} catch (IOException e) {
+			throw new SecurityException("生成edi文件失败");
+		}
+	}
+	@Override
+	public FilesCenter sendingOneSI(@Validated InttraSoDto oneSiDto, JsonNode ediParamCarrier) {
+		try {
+			List<InttraSoDto> billsList = new ArrayList<>();
+			billsList.add(oneSiDto);
+			oneSiDto.setIsMasterBill(true);
+			if(ObjectUtils.isNotNull(oneSiDto.getHblBillsList())){
+				for(InttraSoDto bill : oneSiDto.getHblBillsList()){
+					Map<String, Object> status = RegularUtils.notNullOneBookingDto(bill, "SO");;
+					if ("200".equals(status.get("code").toString())) {
+						bill.setIsMasterBill(false);
+						billsList.add(bill);
+					}else{
+						throw new SecurityException(status.get("data").toString());
+					}
+				}
+			}
+
+			String localFolder = genEdiLocalFolder(oneSiDto, ediParamCarrier);
+			String localFileName = genEdiLocalFileName(oneSiDto, ediParamCarrier);
+			File file = new File(localFolder, localFileName);
+			file.createNewFile();
+			// 打开文件输出流进行写入操作
+			BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+			int count = 0;
+			String carrierCode = oneSiDto.getCarrierCode();
+			String cargoType = oneSiDto.getCargoType();
+
+			// 向文件写入数据
+			// 00 HEAD RECORD
+			// 2=增加  3=删除 4=变更  9=原始
+			writer.write("00:IFTMBF:BOOKING:9:" + oneSiDto.getSenderCode() + ":APLMBF:" + oneSiDto.getFileDate() + "'");
+			writer.newLine();
+			count++;
+
+			for(InttraSoDto bill : billsList) {
+				// 02 BOOKING 订舱信息
+				// 记录类型标识
+				writer.write("02");
+				// 运编号
+				writer.write(":" + (ObjectUtils.isNotNull(bill.getBookingNo()) ? bill.getBookingNo() : (ObjectUtils.isNotNull(bill.getMblNo()) ? bill.getMblNo() : "")));
+				// 提单号
+				writer.write(":" + (ObjectUtils.isNotNull(bill.getMblNo()) ? bill.getMblNo() : ""));
+				// 交货条款 CY-CY(pier-pier/port):30
+				//CY-CFS(pier/port-door): 29
+				//CFS-CY(door-pier/port): 28
+				//CFS-CFS(door-door): 27
+				writer.write(":" + bill.getTransportTermName());
+				// 货代方企业名称
+				writer.write(":" + bill.getSenderName());
+				// 即接受订舱的人的代码 + 签单人说明 + 询价单位 + 国外订舱单位 + 转船标识 + 分批 + 装期 + 效期 + 运费协议号 + 费率本代码 + 服务合同号 + BOND NO + 舱位互用标识 + Email
+				// ONE 业务缺少服务合同号
+				writer.write(":ONEY::::::::" + bill.getCorpArgreementNo() + ":::::"+bill.getSenderEmail()+"'");
+				writer.newLine();
+				count++;
+
+				// 03 提单信息
+				// 提单类型(ORI: BILL OF LADING EXP: WAYBILL) + 提单签发地代码 + 提单签发地 + 签发日期 + 正本提单份数 + 预付地点 + 到付地点
+				String issueType = "正本".equals(bill.getIssueType()) ? "ORI" : ("SEA WAY BILL".equals(bill.getIssueType()) ? "EXP" : "");
+				writer.write("03:" + issueType + "::" + bill.getIssuanceLand() + ":" + bill.getIssueDate() + ":3:"
+					+ ("PP".equals(bill.getPaymentType()) ? bill.getPaymentLand() : "")
+					+ ("CC".equals(bill.getPaymentType()) ? bill.getPaymentLand() : "") + "'");
+				writer.newLine();
+				count++;
+
+				// 11 VESSEL 船舶信息
+				// 记录类型标识 + 船舶呼号 +  船名 + 航次 + 船舶经营人
+				writer.write("11:" + bill.getVesselCode() + ":" + bill.getVesselName() + ":" + bill.getVoyageNo() + ":APL'");
+				writer.newLine();
+				count++;
+
+				// 12	PORTS 地点信息
+				writer.write("12");
+				// 收货地代码 + 收货地代名称
+				writer.write(":" + bill.getPlaceReceiptCode() + ":" + bill.getPlaceReceiptName());
+				// 装货港代码 + 装货港
+				writer.write(":" + bill.getPolCode() + ":" + bill.getPolName());
+				// 卸货港代码 + 卸货港代
+				writer.write(":" + bill.getPodCode() + ":" + bill.getPodName());
+				// 中转港代码 + 中转港 不填
+				writer.write("::");
+				// 交货地代码  + 交货地
+				writer.write(":" + bill.getPlaceDeliveryCode() + ":" + bill.getPlaceDeliveryName());
+				// 目的地代码  + 目的地
+				writer.write(":" + bill.getPlaceDestinationCode() + ":" + bill.getPlaceDestinationName());
+				// 堆场代码
+				// if(V_Depotid=142,'L&S',if(V_Depotid=167,'ITC',if(V_Depotid=341,'COS',if(V_Depotid=342,'MIN','QCT'))))
+				String depotCode = "";
+				writer.write(":" + depotCode + "'");
+				writer.newLine();
+				count++;
+
+				// 14 FREIGHT CLAUSE             运费条款
+				String pm = bill.getPaymentType();
+				writer.write("14:" + ("PP".equals(pm) ? "P" : ("CC".equals(pm) ? "C" : "OTH")) + ":" + ("PP".equals(pm) ? "FREIGHT PREPAID" : ("CC".equals(pm) ? "FREIGHT COLLECT" : "OTHER")) + "'");
+				writer.newLine();
+				count++;
+
+				//15  FREIGHT & CHARGES DETAILS 运费及费用细目
+				writer.write("15::NONE:" +  ("PP".equals(pm) ? "P" : ("CC".equals(pm) ? "C" : "OTH")) + "'");
+				writer.newLine();
+				count++;
+
+				// 17 REMARKS 订舱备注 其他信息
+				writer.write("17:" + bill.getBookingRemarks() + "'");
+				writer.newLine();
+				count++;
+
+				// 20	SHIPPER 发货人
+				// 处理收发通之前,先处理货描,因为收发通多余的部分要追加到货描
+				List<String> goodsDesc = RegularUtils.reformatEDIText(bill.getGoodsDesc(), 70, true);
+				List<String> goodsDescAddtion = new ArrayList<>();
+				// 发货人
+				List<String> hShipper = RegularUtils.reformatEDIText(bill.getHShipper(), 35, true);
+				writer.write("20:"); // 发货人代码为空
+				for (int l = 0; l < hShipper.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hShipper.get(l));
+					} else {
+						goodsDescAddtion.add("*" + hShipper.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 21	CONSIGNEE 收货人
+				List<String> hConsignee = RegularUtils.reformatEDIText(bill.getHConsignee(), 35, true);
+				writer.write("21:"); // 收货人代码为空
+				for (int l = 0; l < hConsignee.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hConsignee.get(l));
+					} else {
+						goodsDescAddtion.add("**" + hConsignee.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 22	NOTIFY PARTY 通知人
+				List<String> hNotify = RegularUtils.reformatEDIText(bill.getHNotify(), 35, true);
+				writer.write("22:"); // 通知人代码为空
+				for (int l = 0; l < hNotify.size(); l++) {
+					if (l < 5) {
+						writer.write(":" + hNotify.get(l));
+					} else {
+						goodsDescAddtion.add("***" + hNotify.get(l));
+					}
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 23	NOTIFY PARTY 第二通知人
+				if (ObjectUtils.isNotNull(bill.getHNotify2())) {
+					List<String> hNotify2 = RegularUtils.reformatEDIText(bill.getHNotify2(), 35, true);
+					writer.write("23:"); // 通知人代码为空
+					for (int l = 0; l < hNotify2.size(); l++) {
+						if (l < 5) {
+							writer.write(":" + hNotify2.get(l));
+							// 多余抛弃
+						}
+					}
+					writer.write("'");
+					writer.newLine();
+					count += 1;
+				}
+
+				// 41 CARGO OF BOOKING  订舱货物
+				// 注:1)货物有两种包装,如是大包装(如托盘),则必须同时填小包装件数和包装类型;
+				// 2) CARGO ID (货物标识)的填法: S=普通,  R=冷冻,   D=危险 ,  O=非标
+				// 41:1::S:8378:CT:CARTONS:20559:138.8::::::20559'
+				// 记录类型标识 + 货物序号 + 货类代码 + 货物标识
+				writer.write("41:1::" + ("danger".equals(cargoType) ? "D" : ("reefer".equals(cargoType) ? "R" : "S")));
+				// 第一层包装件数 + 第一层包装类型 + 第一层包装说明
+				writer.write(":" + bill.getPackagesNumber() + ":" + bill.getPackagesCode() + ":" + bill.getPackagesDescribe());
+				// 第一层包装皮重 + 第一层包装尺码
+				writer.write(":" + bill.getGrossWeight() + ":" + bill.getVolumeOfGoods() + ":" + bill.getPackagesDescribe());
+				// 第二层包装件数 + 第二层包装类型 + 第二层包装说明 + 第二层包装皮重 + 第二层包装尺码 + 货毛重
+				writer.write("::::::" + bill.getGrossWeight() + "'");
+				writer.newLine();
+				count += 1;
+
+				// 43 DANGEROUS, REEFER & OOG 危险品,冷藏和超标信息
+				// 温度中,除正(+)负(-)号及小数点外,最多只能三位数字。
+				if (ObjectUtils.isNotNull(bill.getPreCntrs())) {
+					List<Map<String, Object>> mapList = bill.getPreCntrs();
+					if (mapList.size() > 0) {
+						Map<String, Object> map = mapList.get(0);
+						if (ObjectUtils.isNotNull(map.get("temperature")) && ObjectUtils.isNotNull(map.get("ventilation"))) {
+							// '43::::::::::'+fieldbyName('Draught').asString+':C:'+FieldbyName('Temperature').asString+':::'
+							writer.write("43::::::::::" + map.get("ventilation") + ":C:" + map.get("temperature") + ":::'");
+							writer.newLine();
+							count += 1;
+						}
+					}
+				}
+
+				// 44	MARKS & NOS. 唛头 1-10 行
+				List<String> goodsMarks = RegularUtils.reformatEDIText(bill.getMarks(), 35, true);
+				writer.write("44");
+				if (goodsMarks.size() > 0) {
+					for (String line : goodsMarks) {
+						writer.write(":" + line);
+					}
+				} else {
+					writer.write(":");
+				}
+				writer.write("'");
+				writer.newLine();
+				count += 1;
+
+				// 47 CARGO DESCRIPTION 货物描述 5行一组
+				Integer lineSpecCount = 0;
+				String dl = "";
+				for (String line : goodsDesc) {
+					if (lineSpecCount <= 4) {
+						dl += ":" + line;
+					}
+					if (lineSpecCount == 4) {
+						writer.write("47" + dl + "'");
+						writer.newLine();
+						count += 1;
+
+						lineSpecCount = 0;
+						dl = "";
+					}
+				}
+				for (String line : goodsDescAddtion) {
+					writer.write("47:" + line + "'");
+					writer.newLine();
+					count += 1;
+				}
+
+				// 48 CONTAINER OF BOOKING 订舱预配箱
+				if (ObjectUtils.isNotNull(bill.getPreCntrs())) {
+					List<Map<String, Object>> mapList = bill.getPreCntrs();
+					for (Map<String, Object> map1 : mapList) {
+						// 记录类型标识 + 集装箱尺寸类 + 集装箱箱数
+						writer.write("48:" + map1.get("sizeType") + ":" + map1.get("cntrQty"));
+						// 集装箱状态 + 主拼号 + 装箱方式 自选/内装/自派车队等
+						writer.write(":" + ("FCL".equals(bill.getLoadType()) ? "F" : "L") + "::");
+						//  装箱地点代码 + 装箱地点说明 + 货主箱标志
+						writer.write(":" + bill.getCyCode() + "::N'");
+						writer.newLine();
+						count += 1;
+					}
+				}
+
+				// 51 CONTAINER DETAIL 已知箱号的集装箱细
+				if (ObjectUtils.isNotNull(bill.getLoadedCntrs())) {
+					List<Map<String, Object>> mapList = bill.getLoadedCntrs();
+					for (Map<String, Object> cntr : mapList) {
+						// 记录类型标识 + 箱号 +  铅封号
+						writer.write("51:" + cntr.get("cntrNo") + ":" + cntr.get("sealNo"));
+						// 箱内货物件数 + 箱内货重 + 箱皮重 + 箱内货物尺码 + 箱内货物品名
+						writer.write(":" + cntr.get("quantity") + ":" + cntr.get("grossWeight") + ":" + cntr.get("volume") + ":'");
+						writer.newLine();
+						count += 1;
+					}
+				}
+			}
+
+			// 99 TRAILER RECORD              尾记录
+			// RECORD TOTAL OF FILE   记录总数	9(6)	包括:头、尾记录
+			writer.write("99:" + (++count) + "'");
+
+			writer.close();
+
+			return createEDIFilesCenter(oneSiDto, file);
+		} catch (IOException e) {
+			throw new SecurityException("生成edi文件失败");
+		}
+	}
 }
 

+ 390 - 1190
blade-service/blade-los/src/main/java/org/springblade/los/edi/service/impl/EdiTypesServiceImpl.java

@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.org.apache.xpath.internal.operations.Bool;
+import com.zaxxer.hikari.util.FastList;
 import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -66,6 +68,8 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
@@ -176,6 +180,308 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		return res;
 	}
 
+	/**
+	 * 统一赋值函数
+	 * @param inttraSoDto
+	 * @param details
+	 * @param ediCodeName
+	 * @return
+	 */
+	public Boolean fill(InttraSoDto inttraSoDto, Bills details, String ediCodeName, JsonNode ediParamCarrier, Boolean mixedCargo){
+		inttraSoDto.setTransportTermCode(details.getServiceTerms());
+		inttraSoDto.setLclType("2");
+		inttraSoDto.setLoadType(details.getLoadType());
+		inttraSoDto.setBookingRemarks(details.getBookingRemarks());
+		inttraSoDto.setSiRemarks(details.getSiRemarks());
+		inttraSoDto.setCarrySingleRemarks(details.getRemarks());
+		inttraSoDto.setWeightOfGoods(details.getGrossWeight().toString());
+		inttraSoDto.setPackagesNumber(details.getQuantity());
+		inttraSoDto.setVolumeOfGoods(details.getMeasurement());
+
+		if (ObjectUtils.isNotNull(details.getMpayplace())) {
+			BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
+				.eq(BPorts::getTenantId, AuthUtil.getTenantId())
+				.eq(BPorts::getIsDeleted, 0)
+				.eq(BPorts::getEnName, details.getMpayplace()));
+			if (bPorts != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
+				inttraSoDto.setPaymentLocationCode(ediCode);
+				inttraSoDto.setPaymentLand(bPorts.getEnName());
+			}
+		}
+		if (ObjectUtils.isNotNull(details.getIssueAtId())) {
+			BPorts bPorts = bPortsService.getById(details.getIssueAtId());
+			if (bPorts != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPorts.getExtendedData());
+				inttraSoDto.setIssuanceLandCode(ediCode);
+				inttraSoDto.setIssuanceLand(bPorts.getEnName());
+			}
+		}
+
+		SimpleDateFormat sdf2 = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "issueDate-format", "yyyyMMdd"));
+		if (ObjectUtils.isNotNull(details.getIssueDate())) {
+			inttraSoDto.setIssueDate(sdf2.format(details.getIssueDate()));
+		}
+		inttraSoDto.setBookingNo(details.getBookingNo());
+		inttraSoDto.setMblNo(details.getMblno());
+		inttraSoDto.setHblNo(details.getHblno());
+		inttraSoDto.setCorpArgreementNo(details.getCorpArgreementNo());
+		inttraSoDto.setMainPinyin("");
+		inttraSoDto.setOrderNo(details.getBookingNo());
+		inttraSoDto.setJobId(details.getBookingNo());
+		inttraSoDto.setPaymentType(details.getMpaymode());
+		inttraSoDto.setVesselId(details.getVesselId());
+		inttraSoDto.setVesselName(details.getVesselEnName());
+		inttraSoDto.setVesselCode("");
+		inttraSoDto.setVoyageNo(details.getVoyageNo());
+
+		if (ObjectUtils.isNotNull(details.getVesselId())) {
+			BVessels bVessels = bVesselsService.getById(details.getVesselId());
+			if (bVessels != null) {
+					// 要获取船名代码
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bVessels.getExtendedData());
+				inttraSoDto.setVesselCode(ediCode);
+
+				BCorps bCorps = bCorpsService.getById(bVessels.getCarrierId());
+				if (bCorps != null) {
+					inttraSoDto.setVesselCarrierCode(bCorps.getInttraCode());
+				}
+			}
+		}
+		SimpleDateFormat sdf3 = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "etd-format", "yyyyMMdd"));
+		if (ObjectUtils.isNotNull(details.getEtd())) {
+			inttraSoDto.setEtd(sdf3.format(details.getEtd()));
+		}
+
+		inttraSoDto.setPolName(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.setPlaceReceiptName(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.setPodName(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.setPlaceDeliveryName(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.setPlaceDestinationName(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.setHShipper(details.getHshipperDetails());
+		inttraSoDto.setHConsignee(details.getHconsigneeDetails());
+		inttraSoDto.setHNotify(details.getHnotifyDetails());
+		inttraSoDto.setHNotify2(details.getHnotify2Details());
+
+		inttraSoDto.setCyId(details.getCyId());
+		inttraSoDto.setCyCode(details.getCyCode());
+		inttraSoDto.setCyCnName(details.getCyCnName());
+		inttraSoDto.setCyEnName(details.getCyEnName());
+		// 场站代码就是3字码
+//			if (ObjectUtils.isNotNull(details.getCyId())) {
+//				BCorps bCorps = bCorpsService.getById(details.getCyId());
+//				if (bCorps != null) {
+//					inttraSoDto.setCyCode(bCorps.getInttraCode());
+//				}
+//			}
+
+		inttraSoDto.setInttraToDoorName(details.getInttraToDoorCorpName());
+		inttraSoDto.setInttraToDoorAddr(details.getInttraToDoorCorpAddr());
+		inttraSoDto.setInttraToDoorContacts(details.getInttraToDoorCorpContacts());
+		inttraSoDto.setInttraToDoorTel(details.getInttraToDoorCorpTel());
+		inttraSoDto.setInttraDoorToName(details.getInttraDoorToCorpName());
+		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 ("SEA WAY BILL".equals(details.getIssueType())) {
+			inttraSoDto.setBillLadingType("710");
+		} else {
+			inttraSoDto.setBillLadingType("706");
+		}
+		if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
+			inttraSoDto.setPaymentStatus("27");
+		} else {
+			inttraSoDto.setPaymentStatus("26");
+		}
+		inttraSoDto.setBillLadingNumber(RegularUtils.englishToNumber(details.getNumberOfObl()));
+		inttraSoDto.setPackagesNumber(details.getQuantity());
+		if (ObjectUtils.isNotNull(details.getPackingUnit())) {
+			BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
+				.eq(BPackages::getCode, details.getPackingUnit()));
+			if (bPackages != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bPackages.getExtendedData());
+				inttraSoDto.setPackagesCode(ediCode);
+			}
+		}
+		inttraSoDto.setPackagesDescribe(details.getPackingUnit());//包装描述
+		inttraSoDto.setGoodsDesc(details.getCommodityDescr());
+		inttraSoDto.setGrossWeight(details.getGrossWeight());
+		inttraSoDto.setMeasurement(details.getMeasurement());
+		inttraSoDto.setMarks(details.getMarks());
+		inttraSoDto.setHsCode(details.getHscode());
+		inttraSoDto.setCargoType(details.getCargoType());
+		if ("danger".equals(details.getCargoType())) {
+			inttraSoDto.setDgImdgCode(details.getDgImdgCode());
+			inttraSoDto.setPageNumber("");
+			inttraSoDto.setDgUnCode(details.getDgUnCode());
+			inttraSoDto.setDgFlashPoint(details.getDgFlashPoint().toString());
+			inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
+			inttraSoDto.setPackingGroup(details.getDgPackingLevel());//包装组别
+			inttraSoDto.setEmergencyMeasureNo("");//应急措施号
+			inttraSoDto.setDgRemarks(details.getDgRemarks());
+			inttraSoDto.setDgContacts(details.getDgContacts());
+			inttraSoDto.setDgTel(details.getDgTel());
+		}
+
+		// 预配箱
+		List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
+			.eq(PreContainers::getPid, details.getId())
+			.eq(PreContainers::getIsDeleted, 0));
+		String boxType = preContainersList.stream().map(PreContainers::getCntrTypeCode).collect(Collectors.joining(","));
+		List<BCntrTypes> bPreCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
+			.apply("find_in_set(cntr_type,'" + boxType + "')")
+			.eq(BCntrTypes::getIsDeleted, 0));
+		List<Map<String, Object>> preCntrs = new ArrayList<>();
+		int totalPreCntrQty = 0;
+		for (PreContainers item : preContainersList) {
+			totalPreCntrQty+=item.getQuantity();
+			BCntrTypes bCntrTypes = bPreCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
+			if (bCntrTypes != null) {
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bCntrTypes.getExtendedData());
+				Map<String, Object> map = new HashMap<>();
+				map.put("sizeType", ediCode);
+				map.put("cntrQty", item.getQuantity());
+				map.put("isSoc", item.getIsSoc());
+				map.put("temperature", RegularUtils.formatTempNumber(item.getTemperature(), 3));
+				map.put("temperatureUnit", item.getTemperatureUnit());
+				map.put("ventilation", RegularUtils.formatTempNumber(item.getVentilation(), 3));
+				map.put("humidity", RegularUtils.formatTempNumber(item.getHumidity(), 3));
+				preCntrs.add(map);
+			} else {
+				throw new RuntimeException("箱型数据错误");
+			}
+		}
+		inttraSoDto.setTotalPreCntrQty(totalPreCntrQty);
+		inttraSoDto.setPreCntrs(preCntrs);
+
+		// 已配箱
+		// 配箱数据
+		List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
+			.eq(Containers::getTenantId, AuthUtil.getTenantId())
+			.eq(Containers::getIsDeleted, 0)
+			.eq(Containers::getPid, details.getId()));
+
+		boxType = containersList.stream().map(Containers::getCntrTypeCode).collect(Collectors.joining(","));
+		List<BCntrTypes> bCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
+			.apply("find_in_set(cntr_type,'" + boxType + "')")
+			.eq(BCntrTypes::getIsDeleted, 0));
+		List<Map<String, Object>> cntrs = new ArrayList<>();
+		for (Containers item : containersList) {
+			BCntrTypes bCntrTypes = bCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
+			if (bCntrTypes != null) {
+				// 赫伯罗特需要装箱货物
+				// if("HLCU".equals(carrierCode)) {
+				if(mixedCargo){
+					item.setContainersCommodityList(containersCommodityService.list(new LambdaQueryWrapper<ContainersCommodity>()
+						.eq(ContainersCommodity::getIsDeleted, 0)
+						.eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
+						.eq(ContainersCommodity::getPid, item.getId())
+						.eq(ContainersCommodity::getPpId, item.getPid()))
+					);
+				}
+
+				String ediCode = RegularUtils.getEdiCode(ediCodeName, bCntrTypes.getExtendedData());
+				Map<String, Object> map = new HashMap<>();
+				map.put("quantity", item.getQuantity());
+				map.put("grossWeight", item.getGrossWeight());
+				map.put("volume", item.getMeasurement());
+				map.put("sizeType", ediCode);
+				map.put("cntrTypeName", bCntrTypes.getEnName());
+				map.put("cntrNo", item.getCntrNo());
+				map.put("sealNo", item.getSealNo());
+				map.put("sealUnit", "");
+				map.put("isSoc", item.getIsSoc());
+				PreContainers preContainers = preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).findFirst().orElse(null);
+				if (preContainers != null) {
+					map.put("temperature", RegularUtils.formatTempNumber(preContainers.getTemperature(), 3));
+					map.put("temperatureUnit", preContainers.getTemperatureUnit());
+					map.put("ventilation", RegularUtils.formatTempNumber(preContainers.getVentilation(), 3));
+					map.put("humidity", RegularUtils.formatTempNumber(preContainers.getHumidity(), 3));
+				}else{
+					map.put("temperature", "");
+					map.put("temperatureUnit", "");
+					map.put("ventilation", "");
+					map.put("humidity", "");
+				}
+
+				// 货物信息
+				map.put("commodityList", item.getContainersCommodityList());
+
+				cntrs.add(map);
+			} else {
+				throw new RuntimeException("箱型数据错误");
+			}
+		}
+		inttraSoDto.setLoadedCntrs(cntrs);
+
+		inttraSoDto.setRecordRows(new BigDecimal("10"));
+		inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
+		inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
+
+		return true;
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
@@ -201,12 +507,6 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			.eq(Bills::getIsDeleted, 0)
 			.apply("find_in_set(id,'" + ediTypes.getBillId() + "')"));
 
-		// 配箱数据
-		List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
-			.eq(Containers::getTenantId, AuthUtil.getTenantId())
-			.eq(Containers::getIsDeleted, 0)
-			.apply("find_in_set(pid,'" + ediTypes.getBillId() + "')"));
-
 		Date date = new Date();
 		for (Bills details : billsList) {
 			// 统一设置数据,单独生成 EDI
@@ -234,6 +534,28 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			Boolean mixedCargo = readEdiParamBooleanValue(ediParamCarrier, "mixedCargo", false);
 
 			String EDI_CODE_NAME = readEdiParamStringValue(ediParamCarrier, "ediCode", "INTTRA");
+			Boolean INCLUDING_HBL = readEdiParamBooleanValue(ediParamCarrier, "includingHBL", false);
+
+			String billType = details.getBillType();
+			Boolean isMasterBill = "DD".equals(billType) || "MM".equals(billType);
+			// 检测是否允许发送分单
+			if(!isMasterBill && !readEdiParamBooleanValue(ediParamCarrier, "allowHBL", true)){
+				return R.fail("该 EDI 不允许发送分单,请发送主单!");
+			}
+
+			// List<Bills> allBillsList = Arrays.asList(details);
+			List<Bills> hblBillsList = new ArrayList<>();
+			if(INCLUDING_HBL && "MM".equals(billType)){
+				List<Bills> hblBills = billsService.list(new LambdaQueryWrapper<Bills>()
+					.eq(Bills::getTenantId, AuthUtil.getTenantId())
+					.eq(Bills::getIsDeleted, 0)
+					.eq(Bills::getMasterId, details.getId()));
+				if(ObjectUtils.isNotNull(hblBills)){
+					hblBillsList.addAll(hblBills);
+				}
+			}
+
+			// inttraSoDto.setHblBillsList(hblBillsList);
 
 			// 默认发送方
 			String defaultSenderIdentifying = "JMSLOGQDSO";
@@ -260,323 +582,93 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 			}
 			SimpleDateFormat sdf4 = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "fileDate-format", "yyyyMMddHHmm"));
 			inttraSoDto.setFileDate(sdf4.format(date));
-			inttraSoDto.setTransportTermCode(details.getServiceTerms());
-			inttraSoDto.setLclType("2");
-			inttraSoDto.setLoadType(details.getLoadType());
-			inttraSoDto.setBookingRemarks(details.getBookingRemarks());
-			inttraSoDto.setSiRemarks(details.getSiRemarks());
-			inttraSoDto.setCarrySingleRemarks(details.getRemarks());
-			inttraSoDto.setWeightOfGoods(details.getGrossWeight().toString());
-			inttraSoDto.setPackagesNumber(details.getQuantity());
-			inttraSoDto.setVolumeOfGoods(details.getMeasurement());
-			if (ObjectUtils.isNotNull(details.getMpayplace())) {
-				BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
-					.eq(BPorts::getTenantId, AuthUtil.getTenantId())
-					.eq(BPorts::getIsDeleted, 0)
-					.eq(BPorts::getEnName, details.getMpayplace()));
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPaymentLocationCode(ediCode);
-					inttraSoDto.setPaymentLand(bPorts.getEnName());
-				}
-			}
-			if (ObjectUtils.isNotNull(details.getIssueAtId())) {
-				BPorts bPorts = bPortsService.getById(details.getIssueAtId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setIssuanceLandCode(ediCode);
-					inttraSoDto.setIssuanceLand(bPorts.getEnName());
-				}
-			}
-			SimpleDateFormat sdf2 = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "issueDate-format", "yyyyMMdd"));
-			if (ObjectUtils.isNotNull(details.getIssueDate())) {
-				inttraSoDto.setIssueDate(sdf2.format(details.getIssueDate()));
-			}
-			inttraSoDto.setBookingNo(details.getBookingNo());
-			inttraSoDto.setMblNo(details.getMblno());
-			inttraSoDto.setHblNo(details.getHblno());
-			inttraSoDto.setCorpArgreementNo(details.getCorpArgreementNo());
-			inttraSoDto.setMainPinyin("");
-			inttraSoDto.setOrderNo(details.getBookingNo());
-			inttraSoDto.setJobId(details.getBookingNo());
-			inttraSoDto.setPaymentType(details.getMpaymode());
-			inttraSoDto.setVesselId(details.getVesselId());
-			inttraSoDto.setVesselName(details.getVesselEnName());
-			inttraSoDto.setVesselCode("");
-			inttraSoDto.setVoyageNo(details.getVoyageNo());
-			if (ObjectUtils.isNotNull(details.getVesselId())) {
-				BVessels bVessels = bVesselsService.getById(details.getVesselId());
-				if (bVessels != null) {
-					if("APL".equals(carrierCode)){
-						// APL 要获取船名代码
-						String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bVessels.getExtendedData());
-						inttraSoDto.setVesselCode(ediCode);
-					}
-					BCorps bCorps = bCorpsService.getById(bVessels.getCarrierId());
-					if (bCorps != null) {
-						inttraSoDto.setVesselCarrierCode(bCorps.getInttraCode());
-					}
-				}
-			}
-			SimpleDateFormat sdf3 = new SimpleDateFormat(readEdiParamStringValue(ediParamCarrier, "etd-format", "yyyyMMdd"));
-			if (ObjectUtils.isNotNull(details.getEtd())) {
-				inttraSoDto.setEtd(sdf3.format(details.getEtd()));
-			}
 
-			inttraSoDto.setPolName(details.getPolEnName());
-			if (ObjectUtils.isNotNull(details.getPolId())) {
-				BPorts bPorts = bPortsService.getById(details.getPolId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPolCode(ediCode);
-					if (ObjectUtils.isNull(inttraSoDto.getPolName())) {
-						inttraSoDto.setPolName(bPorts.getEnName());
-					}
-				}
-			}
+			fill(inttraSoDto, details, EDI_CODE_NAME, ediParamCarrier, mixedCargo);
 
-			inttraSoDto.setPlaceReceiptName(details.getPlaceReceiptName());
-			if (ObjectUtils.isNotNull(details.getPlaceReceiptId())) {
-				BPorts bPorts = bPortsService.getById(details.getPlaceReceiptId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPlaceReceiptCode(ediCode);
-					if (ObjectUtils.isNull(inttraSoDto.getPlaceReceiptName())) {
-						inttraSoDto.setPlaceReceiptName(bPorts.getEnName());
-					}
-				}
-			}
-			inttraSoDto.setPodName(details.getPodEnName());
-			if (ObjectUtils.isNotNull(details.getPodId())) {
-				BPorts bPorts = bPortsService.getById(details.getPodId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPodCode(ediCode);
-					if (ObjectUtils.isNull(inttraSoDto.getPodName())) {
-						inttraSoDto.setPodName(bPorts.getEnName());
-					}
-				}
-			}
-			inttraSoDto.setPlaceDeliveryName(details.getPlaceDeliveryName());
-			if (ObjectUtils.isNotNull(details.getPlaceDeliveryId())) {
-				BPorts bPorts = bPortsService.getById(details.getPlaceDeliveryId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPlaceDeliveryCode(ediCode);
-					if (ObjectUtils.isNull(inttraSoDto.getPlaceDeliveryName())) {
-						inttraSoDto.setPlaceDeliveryName(bPorts.getEnName());
-					}
-				}
-			}
-			inttraSoDto.setPlaceDestinationName(details.getDestinationName());
-			if (ObjectUtils.isNotNull(details.getDestinationId())) {
-				BPorts bPorts = bPortsService.getById(details.getDestinationId());
-				if (bPorts != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPorts.getExtendedData());
-					inttraSoDto.setPlaceDestinationCode(ediCode);
-					if (ObjectUtils.isNull(inttraSoDto.getPlaceDestinationName())) {
-						inttraSoDto.setPlaceDestinationName(bPorts.getEnName());
-					}
+			if(hblBillsList.size()>0) {
+				List<InttraSoDto> hbls = new ArrayList<>();
+				for (Bills bill : hblBillsList) {
+					InttraSoDto dto = new InttraSoDto();
+					fill(dto, bill, EDI_CODE_NAME, ediParamCarrier, mixedCargo);
+					hbls.add(dto);
 				}
+				inttraSoDto.setHblBillsList(hbls);
 			}
-			inttraSoDto.setHShipper(details.getHshipperDetails());
-			inttraSoDto.setHConsignee(details.getHconsigneeDetails());
-			inttraSoDto.setHNotify(details.getHnotifyDetails());
-			inttraSoDto.setHNotify2(details.getHnotify2Details());
-
-			inttraSoDto.setCyId(details.getCyId());
-			inttraSoDto.setCyCode(details.getCyCode());
-			inttraSoDto.setCyCnName(details.getCyCnName());
-			inttraSoDto.setCyEnName(details.getCyEnName());
-			// 场站代码就是3字码
-//			if (ObjectUtils.isNotNull(details.getCyId())) {
-//				BCorps bCorps = bCorpsService.getById(details.getCyId());
-//				if (bCorps != null) {
-//					inttraSoDto.setCyCode(bCorps.getInttraCode());
-//				}
-//			}
-
-			inttraSoDto.setInttraToDoorName(details.getInttraToDoorCorpName());
-			inttraSoDto.setInttraToDoorAddr(details.getInttraToDoorCorpAddr());
-			inttraSoDto.setInttraToDoorContacts(details.getInttraToDoorCorpContacts());
-			inttraSoDto.setInttraToDoorTel(details.getInttraToDoorCorpTel());
-			inttraSoDto.setInttraDoorToName(details.getInttraDoorToCorpName());
-			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"));
-			if ("SEA WAY BILL".equals(details.getIssueType())) {
-				inttraSoDto.setBillLadingType("710");
-			} else {
-				inttraSoDto.setBillLadingType("706");
-			}
-			if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
-				inttraSoDto.setPaymentStatus("27");
-			} else {
-				inttraSoDto.setPaymentStatus("26");
-			}
-			inttraSoDto.setBillLadingNumber(RegularUtils.englishToNumber(details.getNumberOfObl()));
-			inttraSoDto.setPackagesNumber(details.getQuantity());
-			if (ObjectUtils.isNotNull(details.getPackingUnit())) {
-				BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
-					.eq(BPackages::getCode, details.getPackingUnit()));
-				if (bPackages != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bPackages.getExtendedData());
-					inttraSoDto.setPackagesCode(ediCode);
-				}
-			}
-			inttraSoDto.setPackagesDescribe(details.getPackingUnit());//包装描述
-			inttraSoDto.setGoodsDesc(details.getCommodityDescr());
-			inttraSoDto.setGrossWeight(details.getGrossWeight());
-			inttraSoDto.setMeasurement(details.getMeasurement());
-			inttraSoDto.setMarks(details.getMarks());
-			inttraSoDto.setHsCode(details.getHscode());
-			inttraSoDto.setCargoType(details.getCargoType());
-			if ("danger".equals(details.getCargoType())) {
-				inttraSoDto.setDgImdgCode(details.getDgImdgCode());
-				inttraSoDto.setPageNumber("");
-				inttraSoDto.setDgUnCode(details.getDgUnCode());
-				inttraSoDto.setDgFlashPoint(details.getDgFlashPoint().toString());
-				inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
-				inttraSoDto.setPackingGroup(details.getDgPackingLevel());//包装组别
-				inttraSoDto.setEmergencyMeasureNo("");//应急措施号
-				inttraSoDto.setDgRemarks(details.getDgRemarks());
-				inttraSoDto.setDgContacts(details.getDgContacts());
-				inttraSoDto.setDgTel(details.getDgTel());
-			}
-
-			// 预配箱
-			List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
-				.eq(PreContainers::getPid, details.getId())
-				.eq(PreContainers::getIsDeleted, 0));
-			String boxType = preContainersList.stream().map(PreContainers::getCntrTypeCode).collect(Collectors.joining(","));
-			List<BCntrTypes> bPreCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
-				.apply("find_in_set(cntr_type,'" + boxType + "')")
-				.eq(BCntrTypes::getIsDeleted, 0));
-			List<Map<String, Object>> preCntrs = new ArrayList<>();
-			int totalPreCntrQty = 0;
-			for (PreContainers item : preContainersList) {
-				totalPreCntrQty+=item.getQuantity();
-				BCntrTypes bCntrTypes = bPreCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-				if (bCntrTypes != null) {
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bCntrTypes.getExtendedData());
-					Map<String, Object> map = new HashMap<>();
-					map.put("sizeType", ediCode);
-					map.put("cntrQty", item.getQuantity());
-					map.put("isSoc", item.getIsSoc());
-					map.put("temperature", RegularUtils.formatTempNumber(item.getTemperature(), 3));
-					map.put("temperatureUnit", item.getTemperatureUnit());
-					map.put("ventilation", RegularUtils.formatTempNumber(item.getVentilation(), 3));
-					map.put("humidity", RegularUtils.formatTempNumber(item.getHumidity(), 3));
-					preCntrs.add(map);
-				} else {
-					throw new RuntimeException("箱型数据错误");
-				}
-			}
-			inttraSoDto.setTotalPreCntrQty(totalPreCntrQty);
-			inttraSoDto.setPreCntrs(preCntrs);
-
-			// 已配箱
-			boxType = containersList.stream().map(Containers::getCntrTypeCode).collect(Collectors.joining(","));
-			List<BCntrTypes> bCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
-				.apply("find_in_set(cntr_type,'" + boxType + "')")
-				.eq(BCntrTypes::getIsDeleted, 0));
-			List<Map<String, Object>> cntrs = new ArrayList<>();
-			for (Containers item : containersList) {
-				BCntrTypes bCntrTypes = bCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-				if (bCntrTypes != null) {
-					// 赫伯罗特需要装箱货物
-					// if("HLCU".equals(carrierCode)) {
-					if(mixedCargo){
-						item.setContainersCommodityList(containersCommodityService.list(new LambdaQueryWrapper<ContainersCommodity>()
-							.eq(ContainersCommodity::getIsDeleted, 0)
-							.eq(ContainersCommodity::getTenantId, AuthUtil.getTenantId())
-							.eq(ContainersCommodity::getPid, item.getId())
-							.eq(ContainersCommodity::getPpId, item.getPid()))
-						);
-					}
-
-					String ediCode = RegularUtils.getEdiCode(EDI_CODE_NAME, bCntrTypes.getExtendedData());
-					Map<String, Object> map = new HashMap<>();
-					map.put("quantity", item.getQuantity());
-					map.put("grossWeight", item.getGrossWeight());
-					map.put("volume", item.getMeasurement());
-					map.put("sizeType", ediCode);
-					map.put("cntrTypeName", bCntrTypes.getEnName());
-					map.put("cntrNo", item.getCntrNo());
-					map.put("sealNo", item.getSealNo());
-					map.put("sealUnit", "");
-					map.put("isSoc", item.getIsSoc());
-					PreContainers preContainers = preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-					if (preContainers != null) {
-						map.put("temperature", RegularUtils.formatTempNumber(preContainers.getTemperature(), 3));
-						map.put("temperatureUnit", preContainers.getTemperatureUnit());
-						map.put("ventilation", RegularUtils.formatTempNumber(preContainers.getVentilation(), 3));
-						map.put("humidity", RegularUtils.formatTempNumber(preContainers.getHumidity(), 3));
-					}else{
-						map.put("temperature", "");
-						map.put("temperatureUnit", "");
-						map.put("ventilation", "");
-						map.put("humidity", "");
-					}
-
-					// 货物信息
-					map.put("commodityList", item.getContainersCommodityList());
-
-					cntrs.add(map);
-				} else {
-					throw new RuntimeException("箱型数据错误");
-				}
-			}
-			inttraSoDto.setLoadedCntrs(cntrs);
-
-			inttraSoDto.setRecordRows(new BigDecimal("10"));
-			inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
-			inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
 
 			FilesCenter filesCenter = null;
-			Map<String, Object> status = null;
-			Integer notNullCode = 0;
+			Map<String, Object> status;
+
 			if(inttraSoDto.ediTypeIsHYCK_INTTRA_SO()) {
 				status = RegularUtils.notNullInttraSoDto(inttraSoDto, "SO");
-				notNullCode = Integer.parseInt(status.get("code").toString());
-				if (200 == notNullCode) {
-					filesCenter = iediSenderService.sendingInttraSo(inttraSoDto, ediParamCarrier);
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingInttraSo(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
 				}
 			}else
 			if(inttraSoDto.ediTypeIsHYCK_INTTRA_SI()) {
 				status = RegularUtils.notNullInttraSiDto(inttraSoDto);
-				notNullCode = Integer.parseInt(status.get("code").toString());
-				if (200 == notNullCode) {
-					filesCenter = iediSenderService.sendingInttraSI(inttraSoDto, ediParamCarrier);
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingInttraSI(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
 				}
 			}else
 			if(inttraSoDto.ediTypeIsHYCK_APL_SO()) {
 				status = RegularUtils.notNullAPLSoDto(inttraSoDto, "SO");
-				notNullCode = Integer.parseInt(status.get("code").toString());
-				if (200 == notNullCode) {
-					filesCenter = iediSenderService.sendingAplSo(inttraSoDto, ediParamCarrier);
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingAplSo(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
 				}
 			}else
 			if(inttraSoDto.ediTypeIsHYCK_APL_SI()) {
 				status = RegularUtils.notNullAPLSiDto(inttraSoDto);
-				notNullCode = Integer.parseInt(status.get("code").toString());
-				if (200 == notNullCode) {
-					filesCenter = iediSenderService.sendingAplSi(inttraSoDto, ediParamCarrier);
+				if ("200".equals(status.get("code").toString())) {
+					try {
+					// filesCenter = iediSenderService.sendingAplSi(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
+				}
+				return R.fail("EDI 未实现!");
+			}else
+			if(inttraSoDto.ediTypeIsHYCK_ONE_Booking()) {
+				status = RegularUtils.notNullOneBookingDto(inttraSoDto, "SO");
+				if ("200".equals(status.get("code").toString())) {
+					try {
+						filesCenter = iediSenderService.sendingOneBooking(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
+				}
+			}else
+			if(inttraSoDto.ediTypeIsHYCK_ONE_SI()) {
+				status = RegularUtils.notNullOneSIDto(inttraSoDto);
+				if ("200".equals(status.get("code").toString())) {
+					try {
+					  filesCenter = iediSenderService.sendingOneSI(inttraSoDto, ediParamCarrier);
+					}catch (Exception e){
+						return R.fail(e.getMessage());
+					}
 				}
+				return R.fail("EDI 未实现!");
 			}else{
 				return R.fail("EDI 未实现!");
 			}
 
-			if (200 == notNullCode) {
+			if(ObjectUtils.isNull(filesCenter)){
+				status.replace("code", "500");
+				status.replace("data", "文件未生成!");
+			}
+
+			if ("200".equals(status.get("code").toString())) {
 				//发送edi记录
 				EdiLog ediLog = new EdiLog();
 				ediLog.setBillId(details.getId());
@@ -623,897 +715,5 @@ public class EdiTypesServiceImpl extends ServiceImpl<EdiTypesMapper, EdiTypes> i
 		billsService.updateBatchById(billsList);
 		filesCenterService.saveOrUpdateBatch(filesCenterList);
 		return R.data("发送成功");
-
-//		if ("HYCK".equals(ediTypes.getType()) && "INTTRA-SO".equals(ediTypes.getCode())) {
-//			for (Bills details : billsList) {
-//				InttraSoDto inttraSoDto = new InttraSoDto();
-//				inttraSoDto.setIdentifying("JMSLOGQDSO");
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd:hhmm");
-//				inttraSoDto.setDate(sdf.format(date));
-//				SimpleDateFormat sdf1 = new SimpleDateFormat("yyMMddhhmm");
-//				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());
-//				}else{
-//					inttraSoDto.setIdentificationCode(details.getBookingNo());
-//				}
-//				if (ObjectUtils.isNotNull(details.getEdiStatus()) && Integer.parseInt(details.getEdiStatus()) > 0) {
-//					// 默认 9
-//					inttraSoDto.setFilesFunction("9");
-//					details.setEdiStatus(Integer.parseInt(details.getEdiStatus()) + 1 + "");
-//				} else {
-//					inttraSoDto.setFilesFunction("9");
-//					details.setEdiStatus("1");
-//				}
-//				SimpleDateFormat sdf4 = new SimpleDateFormat("yyyyMMddhhmm");
-//				inttraSoDto.setFilesDate(sdf4.format(date));
-//				inttraSoDto.setTransportTermCode(details.getServiceTerms());
-//				inttraSoDto.setLclType("2");
-//				inttraSoDto.setBookingRemarks(details.getBookingRemarks());
-//				inttraSoDto.setCarrySingleRemarks(details.getRemarks());
-//				inttraSoDto.setWeightOfGoods(details.getGrossWeight().toString());
-//				inttraSoDto.setPackagesNumber(details.getQuantity());
-//				inttraSoDto.setVolumeOfGoods(details.getMeasurement());
-//				Integer sum = details.getQuantityV20() + details.getQuantityV40() + details.getQuantityV45()
-//					+ details.getQuantityV48() + details.getQuantityV40hc();
-//				inttraSoDto.setTotalBoxNumber(sum);
-//				if (ObjectUtils.isNotNull(details.getMpayplace())) {
-//					BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
-//						.eq(BPorts::getTenantId, AuthUtil.getTenantId())
-//						.eq(BPorts::getIsDeleted, 0)
-//						.eq(BPorts::getEnName, details.getMpayplace()));
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPaymentLocationCode(ediCode);
-//						inttraSoDto.setPaymentLand(bPorts.getEnName());
-//					}
-//				}
-//				if (ObjectUtils.isNotNull(details.getIssueAtId())) {
-//					BPorts bPorts = bPortsService.getById(details.getIssueAtId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setIssuanceLandCode(ediCode);
-//						inttraSoDto.setIssuanceLand(bPorts.getEnName());
-//					}
-//				}
-//				SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
-//				if (ObjectUtils.isNotNull(details.getIssueDate())) {
-//					inttraSoDto.setIssueDate(sdf2.format(details.getIssueDate()));
-//				}
-//				inttraSoDto.setBookingNo(details.getBookingNo());
-//				inttraSoDto.setBillNo(details.getMblno());
-//				inttraSoDto.setCorpArgreementNo(details.getCorpArgreementNo());
-//				inttraSoDto.setMainPinyin("");
-//				inttraSoDto.setOrderNo(details.getBookingNo());
-//				inttraSoDto.setJobId(details.getBookingNo());
-//				inttraSoDto.setPaymentType(details.getMpaymode());
-//				inttraSoDto.setVoyageNo(details.getVoyageNo());
-//				if (ObjectUtils.isNotNull(details.getVesselId())) {
-//					BVessels bVessels = bVesselsService.getById(details.getVesselId());
-//					if (bVessels != null) {
-//						BCorps bCorps = bCorpsService.getById(bVessels.getCarrierId());
-//						if (bCorps != null) {
-//							inttraSoDto.setVesselCarrierCode(bCorps.getInttraCode());
-//						}
-//					}
-//				}
-//				inttraSoDto.setVesselName(details.getVesselEnName());
-//				if (ObjectUtils.isNotNull(details.getPolId())) {
-//					BPorts bPorts = bPortsService.getById(details.getPolId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPolCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPolName(details.getPolEnName());
-//				SimpleDateFormat sdf3 = new SimpleDateFormat("yyyyMMdd");
-//				if (ObjectUtils.isNotNull(details.getEtd())) {
-//					inttraSoDto.setEtd(sdf3.format(details.getEtd()));
-//				}
-//				if (ObjectUtils.isNotNull(details.getPlaceReceiptId())) {
-//					BPorts bPorts = bPortsService.getById(details.getPlaceReceiptId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPlaceReceiptCode(ediCode);
-//						inttraSoDto.setPlaceReceiptName(bPorts.getEnName());
-//					}
-//				}
-//				if (ObjectUtils.isNotNull(details.getPodId())) {
-//					BPorts bPorts = bPortsService.getById(details.getPodId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPodCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPodName(details.getPodEnName());
-//				if (ObjectUtils.isNotNull(details.getPlaceDeliveryId())) {
-//					BPorts bPorts = bPortsService.getById(details.getPlaceDeliveryId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPlaceDeliveryCode(ediCode);
-//						inttraSoDto.setPlaceDeliveryName(bPorts.getEnName());
-//					}
-//				}
-//				inttraSoDto.setHShipper(details.getHshipperDetails());
-//				inttraSoDto.setHConsignee(details.getHconsigneeDetails());
-//				inttraSoDto.setHNotify(details.getHnotifyDetails());
-//				inttraSoDto.setCarrierName(details.getCarrierEnName());
-//				if (ObjectUtils.isNotNull(details.getCarrierId())) {
-//					BCorps bCorps = bCorpsService.getById(details.getCarrierId());
-//					if (bCorps != null) {
-//						inttraSoDto.setCarrierCode(bCorps.getInttraCode());
-//						inttraSoDto.setContactInformation(bCorps.getInttraIcua());
-//						inttraSoDto.setContacts(bCorps.getInttraIcuaAttn());
-//						inttraSoDto.setAttnEmail(bCorps.getInttraIcuaEmail());
-//					}
-//				}
-//				inttraSoDto.setInttraToDoorName(details.getInttraToDoorCorpName());
-//				inttraSoDto.setInttraToDoorAddr(details.getInttraToDoorCorpAddr());
-//				inttraSoDto.setInttraToDoorContacts(details.getInttraToDoorCorpContacts());
-//				inttraSoDto.setInttraToDoorTel(details.getInttraToDoorCorpTel());
-//				inttraSoDto.setInttraDoorToName(details.getInttraDoorToCorpName());
-//				inttraSoDto.setInttraDoorToAddr(details.getInttraDoorToCorpAddr());
-//				inttraSoDto.setInttraDoorToContacts(details.getInttraDoorToCorpContacts());
-//				inttraSoDto.setInttraDoorToTel(details.getInttraDoorToCorpTel());
-//				inttraSoDto.setFreightForwarderCode("JET MARINE");
-//				inttraSoDto.setFreightForwarderName(details.getForwarding());
-//				inttraSoDto.setSenderCodeS("JMSLOGQINGDAO");
-//				inttraSoDto.setSenderName("JMS");
-//				inttraSoDto.setSenderContacts("Yuki Cai");
-//				inttraSoDto.setSenderTel("");
-//				inttraSoDto.setSenderEmail("cma-seataocn@jms-logistics.com");
-//				if ("SEA WAY BILL".equals(details.getIssueType())) {
-//					inttraSoDto.setBillLadingType("710");
-//				} else {
-//					inttraSoDto.setBillLadingType("706");
-//				}
-//				if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
-//					inttraSoDto.setPaymentStatus("27");
-//				} else {
-//					inttraSoDto.setPaymentStatus("26");
-//				}
-//				inttraSoDto.setBillLadingNumber(RegularUtils.englishToNumber(details.getNumberOfObl()));
-//				inttraSoDto.setPackagesNumbers(details.getQuantity());
-//				if (ObjectUtils.isNotNull(details.getPackingUnit())) {
-//					BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
-//						.eq(BPackages::getCode, details.getPackingUnit()));
-//					if (bPackages != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPackages.getExtendedData());
-//						inttraSoDto.setPackagesCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPackagesDescribe(details.getPackingUnit());//包装描述
-//				inttraSoDto.setGoodsDesc(details.getCommodityDescr());
-//				inttraSoDto.setGrossWeight(details.getGrossWeight());
-//				inttraSoDto.setMeasurement(details.getMeasurement());
-//				inttraSoDto.setMarks(details.getMarks());
-//				inttraSoDto.setHsCode(details.getHscode());
-//				inttraSoDto.setCargoType(details.getCargoType());
-//				if ("danger".equals(details.getCargoType())) {
-//					inttraSoDto.setDgImdgCode(details.getDgImdgCode());
-//					inttraSoDto.setPageNumber("");
-//					inttraSoDto.setDgUnCode(details.getDgUnCode());
-//					inttraSoDto.setDgFlashPoint(details.getDgFlashPoint().toString());
-//					inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
-//					inttraSoDto.setPackingGroup(details.getDgPackingLevel());//包装组别
-//					inttraSoDto.setEmergencyMeasureNo("");//应急措施号
-//					inttraSoDto.setDgRemarks(details.getDgRemarks());
-//					inttraSoDto.setDgContacts(details.getDgContacts());
-//					inttraSoDto.setDgTel(details.getDgTel());
-//				}
-//				List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
-//					.eq(PreContainers::getPid, details.getId())
-//					.eq(PreContainers::getIsDeleted, 0));
-//				String boxType = preContainersList.stream().map(PreContainers::getCntrTypeCode).collect(Collectors.joining(","));
-//				List<BCntrTypes> bCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
-//					.apply("find_in_set(cntr_type,'" + boxType + "')")
-//					.eq(BCntrTypes::getIsDeleted, 0));
-//				List<Map<String, Object>> box = new ArrayList<>();
-//				int totalPreCntrQty = 0;
-//				for (PreContainers item : preContainersList) {
-//					totalPreCntrQty+=item.getQuantity();
-//					BCntrTypes bCntrTypes = bCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-//					if (bCntrTypes != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bCntrTypes.getExtendedData());
-//						Map<String, Object> map = new HashMap<>();
-//						map.put("boxCode", ediCode);
-//						map.put("boxNumber", item.getQuantity());
-//						map.put("isSoc", item.getIsSoc());
-//						map.put("temperature", RegularUtils.formatTempNumber(item.getTemperature(), 3));
-//						map.put("ventilation", RegularUtils.formatTempNumber(item.getVentilation(), 3));
-//						map.put("humidity", RegularUtils.formatTempNumber(item.getHumidity(), 3));
-//						map.put("temperatureUnit", item.getTemperatureUnit());
-//						box.add(map);
-//					} else {
-//						throw new RuntimeException("箱型数据错误");
-//					}
-//				}
-//				inttraSoDto.setTotalBoxNumber(totalPreCntrQty);
-//				inttraSoDto.setBox(box);
-//				inttraSoDto.setRecordRows(new BigDecimal("10"));
-//				inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
-//				inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
-//				inttraSoDto.setEdiTypes(ediTypes);
-//				Map<String, Object> status = RegularUtils.notNullInttraSoDto(inttraSoDto);
-//				if (200 == Integer.parseInt(status.get("code").toString())) {
-//					FilesCenter filesCenter = iediSenderService.sendingInttraSo(inttraSoDto);
-//					//发送edi记录
-//					EdiLog ediLog = new EdiLog();
-//					ediLog.setBillId(details.getId());
-//					ediLog.setBillNo(details.getBillNo());
-//					ediLog.setMblno(details.getMblno());
-//					ediLog.setHblno(details.getHblno());
-//					ediLog.setPid(ediTypes.getId());
-//					ediLog.setSenderDate(new Date());
-//					ediLog.setBranchId(details.getBranchId());
-//					ediLog.setCreateDept(details.getCreateDept());
-//					ediLog.setCreateTime(details.getCreateTime());
-//					ediLog.setCreateDeptName(details.getCreateDeptName());
-//					ediLog.setCreateUser(details.getCreateUser());
-//					ediLog.setCreateUserName(details.getCreateUserName());
-//					ediLog.setRemarks("发送成功");
-//					ediLog.setStatus(1);
-//					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());
-//					filesCenter.setCreateDeptName(details.getCreateDeptName());
-//					filesCenter.setCreateUser(details.getCreateUser());
-//					filesCenter.setCreateUserName(details.getCreateUserName());
-//					filesCenter.setPid(details.getId());
-//					filesCenter.setItemId(ediLog.getId());
-//					filesCenter.setBusinessType(details.getBusinessType());
-//					filesCenter.setClassifyCode("edi");
-//					filesCenter.setGroupCode("INTTRA-SO");
-//					filesCenter.setSerialNo(1);
-//					filesCenter.setSort(1);
-//					filesCenter.setReceivedData(new Date());
-//					filesCenter.setIsImage(0);
-//					filesCenter.setTenantId(AuthUtil.getTenantId());
-//					filesCenterList.add(filesCenter);
-//				} else {
-//					return R.success(status.get("data").toString());
-//				}
-//			}
-//			billsService.updateBatchById(billsList);
-//		} else if ("HYCK".equals(ediTypes.getType()) && "INTTRA-SI".equals(ediTypes.getCode())) {
-//			for (Bills details : billsList) {
-//				InttraSoDto inttraSoDto = new InttraSoDto();
-//				inttraSoDto.setIdentifying("JMSLOGQDSO");
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd:hhmm");
-//				inttraSoDto.setDate(sdf.format(date));
-//				SimpleDateFormat sdf1 = new SimpleDateFormat("yyMMddhhmm");
-//				String corpId = details.getCorpId().toString();
-//				inttraSoDto.setFileExchangeNumber(sdf1.format(date) + corpId.substring(corpId.length() - 4));
-//				inttraSoDto.setInformationNo(inttraSoDto.getFileExchangeNumber());
-//				inttraSoDto.setIdentificationCode(details.getMblno());
-//				if (ObjectUtils.isNotNull(details.getEdiStatus()) && Integer.parseInt(details.getEdiStatus()) > 0) {
-//					inttraSoDto.setFilesFunction("5");
-//					details.setEdiStatus(Integer.parseInt(details.getEdiStatus()) + 1 + "");
-//				} else {
-//					inttraSoDto.setFilesFunction("9");
-//					details.setEdiStatus("1");
-//				}
-//				inttraSoDto.setFilesDate(sdf1.format(date));
-//				inttraSoDto.setTransportTermCode(details.getServiceTerms());
-//				inttraSoDto.setLclType("2");
-//				// inttraSoDto.setRemarks(details.getRemarks());
-//				inttraSoDto.setCarrySingleRemarks(details.getBookingRemarks());
-//				inttraSoDto.setWeightOfGoods(details.getGrossWeight().toString());
-//				inttraSoDto.setPackagesNumber(details.getQuantity());
-//				inttraSoDto.setVolumeOfGoods(details.getMeasurement());
-//				Integer sum = details.getQuantityV20() + details.getQuantityV40() + details.getQuantityV45()
-//					+ details.getQuantityV48() + details.getQuantityV40hc();
-//				// inttraSoDto.setTotalBoxNumber(new BigDecimal(sum + ""));
-//				if (ObjectUtils.isNotNull(details.getMpayplace())) {
-//					BPorts bPorts = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
-//						.eq(BPorts::getTenantId, AuthUtil.getTenantId())
-//						.eq(BPorts::getIsDeleted, 0)
-//						.eq(BPorts::getEnName, details.getMpayplace()));
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPaymentLocationCode(ediCode);
-//						inttraSoDto.setPaymentLand(bPorts.getEnName());
-//					}
-//				}
-//				if (ObjectUtils.isNotNull(details.getIssueAtId())) {
-//					BPorts bPorts = bPortsService.getById(details.getIssueAtId());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setIssuanceLandCode(ediCode);
-//						inttraSoDto.setIssuanceLand(bPorts.getEnName());
-//
-//					}
-//				}
-//				SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
-//				if (ObjectUtils.isNotNull(details.getIssueDate())) {
-//					inttraSoDto.setIssueDate(sdf2.format(details.getIssueDate()));
-//				}
-//				inttraSoDto.setBookingNo(details.getBookingNo());
-//				inttraSoDto.setBillNo(details.getMblno());
-//				// inttraSoDto.setFreightProtocolNumber(details.getCorpArgreementNo());
-//				inttraSoDto.setMainPinyin("");
-//				inttraSoDto.setOrderNo(details.getBookingNo());
-//				inttraSoDto.setPaymentType(details.getMpaymode());
-//				inttraSoDto.setVoyageNo(details.getVoyageNo());
-//				if (ObjectUtils.isNotNull(details.getVesselId())) {
-//					BVessels bVessels = bVesselsService.getById(details.getVesselId());
-//					if (bVessels != null) {
-//						BCorps bCorps = bCorpsService.getById(bVessels.getCarrierId());
-//						if (bCorps != null) {
-//							inttraSoDto.setVesselCarrierCode(bCorps.getInttraCode());
-//						}
-//					}
-//				}
-//				inttraSoDto.setVesselName(details.getVesselEnName());
-//				if (ObjectUtils.isNotNull(details.getPolCode())) {
-//					BPorts bPorts = bPortsService.getById(details.getPolCode());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPolName(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPolName(details.getPolCnName());
-//				if (ObjectUtils.isNotNull(details.getPlaceReceiptCode())) {
-//					BPorts bPorts = bPortsService.getById(details.getPlaceReceiptCode());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPlaceReceiptCode(ediCode);
-//						inttraSoDto.setPlaceReceiptName(bPorts.getEnName());
-//					}
-//				}
-//				if (ObjectUtils.isNotNull(details.getPodCode())) {
-//					BPorts bPorts = bPortsService.getById(details.getPodCode());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPodCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPodName(details.getPodEnName());
-//				if (ObjectUtils.isNotNull(details.getPlaceDeliveryCode())) {
-//					BPorts bPorts = bPortsService.getById(details.getPlaceDeliveryCode());
-//					if (bPorts != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPorts.getExtendedData());
-//						inttraSoDto.setPlaceDeliveryCode(ediCode);
-//						inttraSoDto.setPlaceDeliveryName(bPorts.getEnName());
-//					}
-//				}
-//				// inttraSoDto.setHsHipperOne(details.getHshipperDetails());
-//				// inttraSoDto.setHConsigneeOne(details.getHconsigneeDetails());
-//				// inttraSoDto.setHNotifyOne(details.getHnotifyDetails());
-//				inttraSoDto.setCarrierName(details.getCarrierEnName());
-//				if (ObjectUtils.isNotNull(details.getCarrierId())) {
-//					BCorps bCorps = bCorpsService.getById(details.getCarrierId());
-//					if (bCorps != null) {
-//						inttraSoDto.setCarrierCode(bCorps.getInttraCode());
-//					}
-//				}
-//				inttraSoDto.setSenderCodeS("JMSLOGQINGDAO");
-//				inttraSoDto.setSenderName("JMS");
-//				inttraSoDto.setSenderContacts("JMS-contacts");
-//				inttraSoDto.setSenderTel("JMS-tel");
-//				inttraSoDto.setSenderEmail("JMS-email");
-//				inttraSoDto.setBillLadingType(details.getBillType());
-//				if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
-//					inttraSoDto.setPaymentStatus("27");
-//				} else {
-//					inttraSoDto.setPaymentStatus("26");
-//				}
-//				// inttraSoDto.setBillLadingNumber(new BigDecimal("0"));
-//				inttraSoDto.setPackagesNumbers(details.getQuantity());
-//				if (ObjectUtils.isNotNull(details.getPackingUnit())) {
-//					BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
-//						.eq(BPackages::getCode, details.getPackingUnit()));
-//					if (bPackages != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPackages.getExtendedData());
-//						inttraSoDto.setPackagesCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPackagesDescribe(details.getPackingUnit());//包装描述
-//				// inttraSoDto.setProductName(details.getCommodityDescr());
-//				inttraSoDto.setGrossWeight(details.getGrossWeight());
-//				inttraSoDto.setMeasurement(details.getMeasurement());
-//				inttraSoDto.setMarks(details.getMarks());
-//				List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
-//					.eq(PreContainers::getPid, details.getId())
-//					.eq(PreContainers::getIsDeleted, 0));
-//				String boxType = containersList.stream().map(Containers::getCntrTypeCode).collect(Collectors.joining(","));
-//				List<BCntrTypes> bCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
-//					.apply("find_in_set(cntr_type,'" + boxType + "')")
-//					.eq(BCntrTypes::getIsDeleted, 0));
-//				List<Map<String, Object>> box = new ArrayList<>();
-//				for (Containers item : containersList) {
-//					BCntrTypes bCntrTypes = bCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-//					if (bCntrTypes != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bCntrTypes.getExtendedData());
-//						Map<String, Object> map = new HashMap<>();
-//						map.put("boxGoodNumber", item.getQuantity());
-//						map.put("boxGoodWeight", item.getGrossWeight());
-//						map.put("boxGoodMeasurement", item.getMeasurement());
-//						map.put("boxCode", ediCode);
-//						map.put("boxNo", item.getCntrNo());
-//						map.put("sealNo", item.getSealNo());
-//						map.put("sealUnit", item.getPackingUnit());
-//						map.put("shipperBoxIdentification", item.getIsSoc());
-//						PreContainers preContainers = preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-//						if (preContainers != null) {
-//							map.put("temperature", preContainers.getTemperature());
-//							map.put("temperatureUnit", preContainers.getTemperatureUnit());
-//						}
-//						box.add(map);
-//					} else {
-//						throw new RuntimeException("箱型数据错误");
-//					}
-//				}
-//				inttraSoDto.setBox(box);
-//				/*BigDecimal boxGoodNumber = new BigDecimal("0.00");
-//				BigDecimal boxGoodWeight = new BigDecimal("0.00");
-//				BigDecimal boxGoodMeasurement = new BigDecimal("0.00");
-//				if (!containersList.isEmpty()) {
-//					inttraSoDto.setBoxGoodNumber(containersList.get(0).getQuantity());
-//					inttraSoDto.setBoxGoodWeight(containersList.get(0).getGrossWeight());
-//					inttraSoDto.setBoxGoodMeasurement(containersList.get(0).getMeasurement());
-//
-//					String boxNumber = containersList.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.joining("/"));
-//					inttraSoDto.setBoxNo(boxNumber);
-//					inttraSoDto.setShipperBoxIdentification("货主箱标识");
-//
-//				} else {
-//					inttraSoDto.setBoxGoodNumber(boxGoodNumber);
-//					inttraSoDto.setBoxGoodWeight(boxGoodWeight);
-//					inttraSoDto.setBoxGoodMeasurement(boxGoodMeasurement);
-//				}*/
-//				if ("danger".equals(details.getCargoType())) {
-//					inttraSoDto.setHsCode(details.getHscode());
-//					inttraSoDto.setDgImdgCode(details.getDgImdgCode());
-//					// inttraSoDto.setPageNumber(new BigDecimal("007"));
-//					// inttraSoDto.setDgUnCode(1);
-//					// inttraSoDto.setDgFlashPoint(1);
-//					inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
-//					inttraSoDto.setPackingGroup("");//包装组别
-//					inttraSoDto.setEmergencyMeasureNo("");//应急措施号
-//					inttraSoDto.setDgRemarks(""); // details.getDgRemarks() 不加
-//					inttraSoDto.setDgContacts(details.getDgContacts());
-//					inttraSoDto.setDgTel(details.getDgTel());
-//				}
-//				/*inttraSoDto.setBoxCode(details.getQuantityCntrDescr());
-//				inttraSoDto.setTemperature(1);
-//				inttraSoDto.setTemperatureUnit("温度单位");*/
-//				inttraSoDto.setRecordRows(new BigDecimal("10"));
-//				inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
-//				inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
-//				inttraSoDto.setEdiTypes(ediTypes);
-//				Map<String, Object> status = RegularUtils.notNullInttraSiDto(inttraSoDto);
-//				if (200 == Integer.parseInt(status.get("code").toString())) {
-//					FilesCenter filesCenter = iediSenderService.sendingInttraSI(inttraSoDto);
-//
-//					//发送edi记录
-//					EdiLog ediLog = new EdiLog();
-//					ediLog.setBillId(details.getId());
-//					ediLog.setBillNo(details.getBillNo());
-//					ediLog.setMblno(details.getMblno());
-//					ediLog.setHblno(details.getHblno());
-//					ediLog.setPid(ediTypes.getId());
-//					ediLog.setSenderDate(new Date());
-//					ediLog.setBranchId(details.getBranchId());
-//					ediLog.setCreateDept(details.getCreateDept());
-//					ediLog.setCreateTime(details.getCreateTime());
-//					ediLog.setCreateDeptName(details.getCreateDeptName());
-//					ediLog.setCreateUser(details.getCreateUser());
-//					ediLog.setCreateUserName(details.getCreateUserName());
-//					ediLog.setRemarks("发送成功");
-//					ediLog.setStatus(1);
-//					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());
-//					filesCenter.setCreateDeptName(details.getCreateDeptName());
-//					filesCenter.setCreateUser(details.getCreateUser());
-//					filesCenter.setCreateUserName(details.getCreateUserName());
-//					filesCenter.setPid(details.getId());
-//					filesCenter.setItemId(ediLog.getId());
-//					filesCenter.setBusinessType(details.getBusinessType());
-//					filesCenter.setClassifyCode("edi");
-//					filesCenter.setGroupCode("INTTRA-SI");
-//					filesCenter.setSerialNo(1);
-//					filesCenter.setSort(1);
-//					filesCenter.setReceivedData(new Date());
-//					filesCenter.setIsImage(0);
-//					filesCenter.setTenantId(AuthUtil.getTenantId());
-//					filesCenterList.add(filesCenter);
-//				} else {
-//					return R.success(status.get("data").toString());
-//				}
-//			}
-//			billsService.updateBatchById(billsList);
-//		} else if ("HYCK".equals(ediTypes.getType()) && "INTTRA-SI-bill".equals(ediTypes.getCode())) {
-//			for (Bills details : billsList) {
-//				InttraSiBillDto inttraSoDto = new InttraSiBillDto();
-//				inttraSoDto.setIdentifying("JMSLOGQDSO");
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd:hhmm");
-//				inttraSoDto.setDate(sdf.format(date));
-//				SimpleDateFormat sdf1 = new SimpleDateFormat("yyMMddhhmm");
-//				String corpId = details.getCorpId().toString();
-//				inttraSoDto.setFileExchangeNumber(sdf1.format(date) + corpId.substring(corpId.length() - 4));
-//				inttraSoDto.setInformationNo(inttraSoDto.getFileExchangeNumber());
-//				inttraSoDto.setIdentificationCode(details.getMblno());
-//				if (ObjectUtils.isNotNull(details.getEdiStatus()) && Integer.parseInt(details.getEdiStatus()) > 0) {
-//					inttraSoDto.setFilesFunction("5");
-//					details.setEdiStatus(Integer.parseInt(details.getEdiStatus()) + 1 + "");
-//				} else {
-//					inttraSoDto.setFilesFunction("9");
-//					details.setEdiStatus("1");
-//				}
-//				inttraSoDto.setFilesDate(sdf1.format(date));
-//				inttraSoDto.setTransportTermCode(details.getServiceTerms());
-//				inttraSoDto.setLclType("2");
-//				inttraSoDto.setRemarks(details.getRemarks());
-//				SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
-//				if (ObjectUtils.isNotNull(details.getIssueDate())) {
-//					inttraSoDto.setIssueDate(sdf2.format(details.getIssueDate()));
-//				}
-//				inttraSoDto.setBillNo(details.getMblno());
-//				inttraSoDto.setPaymentType(details.getMpaymode());
-//				inttraSoDto.setVoyageNo(details.getVoyageNo());
-//				if (ObjectUtils.isNotNull(details.getVesselId())) {
-//					BVessels bVessels = bVesselsService.getById(details.getVesselId());
-//					if (bVessels != null) {
-//						BCorps bCorps = bCorpsService.getById(bVessels.getCarrierId());
-//						if (bCorps != null) {
-//							inttraSoDto.setVesselCarrierCode(bCorps.getInttraCode());
-//						}
-//					}
-//				}
-//				inttraSoDto.setVesselName(details.getVesselEnName());
-//				inttraSoDto.setBillLadingType("提单类型");
-//				if (details.getStlCrStatus() >= 3 || details.getStlDrStatus() >= 3) {
-//					inttraSoDto.setPaymentStatus("27");
-//				} else {
-//					inttraSoDto.setPaymentStatus("26");
-//				}
-//				inttraSoDto.setBillLadingNumber(new BigDecimal("0"));
-//				inttraSoDto.setPackagesNumbers(details.getQuantity());
-//				if (ObjectUtils.isNotNull(details.getPackingUnit())) {
-//					BPackages bPackages = bPackagesService.getOne(new LambdaQueryWrapper<BPackages>()
-//						.eq(BPackages::getCode, details.getPackingUnit()));
-//					if (bPackages != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bPackages.getExtendedData());
-//						inttraSoDto.setPackagesCode(ediCode);
-//					}
-//				}
-//				inttraSoDto.setPackagesDescribe("");//包装描述
-//				inttraSoDto.setMarks(details.getMarks());
-//				List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
-//					.eq(PreContainers::getPid, details.getId())
-//					.eq(PreContainers::getIsDeleted, 0));
-//				String boxType = containersList.stream().map(Containers::getCntrTypeCode).collect(Collectors.joining(","));
-//				List<BCntrTypes> bCntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
-//					.apply("find_in_set(cntr_type,'" + boxType + "')")
-//					.eq(BCntrTypes::getIsDeleted, 0));
-//				List<Map<String, Object>> box = new ArrayList<>();
-//				for (Containers item : containersList) {
-//					BCntrTypes bCntrTypes = bCntrTypesList.stream().filter(e -> e.getCntrType().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-//					if (bCntrTypes != null) {
-//						String ediCode = RegularUtils.getEdiCode("INTTRA", bCntrTypes.getExtendedData());
-//						Map<String, Object> map = new HashMap<>();
-//						map.put("boxGoodNumber", item.getQuantity());
-////						map.put("boxGoodWeight", item.getGrossWeight());
-////						map.put("boxGoodMeasurement", item.getMeasurement());
-//						map.put("boxCode", ediCode);
-//						map.put("boxNo", item.getCntrNo());
-//						map.put("shipperBoxIdentification", item.getIsSoc());
-//						PreContainers preContainers = preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(item.getCntrTypeCode())).findFirst().orElse(null);
-//						if (preContainers != null) {
-//							map.put("temperature", preContainers.getTemperature());
-//							map.put("ventilation", preContainers.getVentilation());
-//							map.put("temperatureUnit", preContainers.getTemperatureUnit());
-//						}
-//						box.add(map);
-//					} else {
-//						throw new RuntimeException("箱型数据错误");
-//					}
-//				}
-//				inttraSoDto.setBox(box);
-//				/*BigDecimal boxGoodNumber = new BigDecimal("0.00");
-//				if (!containersList.isEmpty()) {
-//					inttraSoDto.setBoxGoodNumber(containersList.get(0).getQuantity());
-//					String boxNumber = containersList.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.joining("/"));
-//					inttraSoDto.setBoxNo(boxNumber);
-//					inttraSoDto.setShipperBoxIdentification("货主箱标识");
-//				} else {
-//					inttraSoDto.setBoxGoodNumber(boxGoodNumber);
-//				}*/
-//				if ("danger".equals(details.getCargoType())) {
-//					inttraSoDto.setHsCode(new BigDecimal(details.getHscode()));
-//					inttraSoDto.setDgImdgCode(details.getDgImdgCode());
-//					inttraSoDto.setPageNumber(new BigDecimal("007"));
-//					inttraSoDto.setDgUnCode(1);
-//					inttraSoDto.setDgFlashPoint(new BigDecimal("1"));
-//					inttraSoDto.setDgFlashPointUnit(details.getDgFlashPointUnit());
-//					inttraSoDto.setPackingGroup("");//包装组别
-//					inttraSoDto.setEmergencyMeasureNo("");//应急措施号
-//					inttraSoDto.setDgRemarks(details.getDgRemarks());
-//					inttraSoDto.setDgContacts(details.getDgContacts());
-//					inttraSoDto.setDgTel(details.getDgTel());
-//				}
-//				/*inttraSoDto.setBoxCode(details.getQuantityCntrDescr());
-//				inttraSoDto.setTemperature(1);
-//				inttraSoDto.setTemperatureUnit("温度单位");*/
-//				inttraSoDto.setRecordRows(new BigDecimal("10"));
-//				inttraSoDto.setInformationNoEnd(inttraSoDto.getInformationNo());
-//				inttraSoDto.setFileExchangeNumberEnd(inttraSoDto.getFileExchangeNumber());
-//				inttraSoDto.setEdiTypes(ediTypes);
-//
-//				Map<String, Object> status = RegularUtils.notNullInttraSiBillDto(inttraSoDto);
-//				if (200 == Integer.parseInt(status.get("code").toString())) {
-//					FilesCenter filesCenter = iediSenderService.sendingInttraSiBill(inttraSoDto);
-//
-//					//发送edi记录
-//					EdiLog ediLog = new EdiLog();
-//					ediLog.setBillId(details.getId());
-//					ediLog.setBillNo(details.getBillNo());
-//					ediLog.setMblno(details.getMblno());
-//					ediLog.setHblno(details.getHblno());
-//					ediLog.setPid(ediTypes.getId());
-//					ediLog.setSenderDate(new Date());
-//					ediLog.setBranchId(details.getBranchId());
-//					ediLog.setCreateDept(details.getCreateDept());
-//					ediLog.setCreateTime(details.getCreateTime());
-//					ediLog.setCreateDeptName(details.getCreateDeptName());
-//					ediLog.setCreateUser(details.getCreateUser());
-//					ediLog.setCreateUserName(details.getCreateUserName());
-//					ediLog.setRemarks("发送成功");
-//					ediLog.setStatus(1);
-//					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());
-//					filesCenter.setCreateDeptName(details.getCreateDeptName());
-//					filesCenter.setCreateUser(details.getCreateUser());
-//					filesCenter.setCreateUserName(details.getCreateUserName());
-//					filesCenter.setPid(details.getId());
-//					filesCenter.setItemId(ediLog.getId());
-//					filesCenter.setBusinessType(details.getBusinessType());
-//					filesCenter.setClassifyCode("edi");
-//					filesCenter.setGroupCode("INTTRA-SI-bill");
-//					filesCenter.setSerialNo(1);
-//					filesCenter.setSort(1);
-//					filesCenter.setReceivedData(new Date());
-//					filesCenter.setIsImage(0);
-//					filesCenter.setTenantId(AuthUtil.getTenantId());
-//					filesCenterList.add(filesCenter);
-//				} else {
-//					return R.success(status.get("data").toString());
-//				}
-//			}
-//			billsService.updateBatchById(billsList);
-//		} else if ("HYCK".equals(ediTypes.getType()) && "APL-SO".equals(ediTypes.getCode())) {
-//			for (Bills details : billsList) {
-//				APLSoDto aplSoDto = new APLSoDto();
-//				aplSoDto.setMessageType("IFTMBF");
-//				aplSoDto.setFileDescription("BOOKING");
-//				aplSoDto.setFileFunction("9");
-//				aplSoDto.setEdiTypes(ediTypes);
-//				aplSoDto.setSenderCode("发送方代码");
-//				aplSoDto.setReceiverCode("接收方代码");
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd:hhmm");
-//				aplSoDto.setFilesEstablishTime(sdf.format(date));
-//				aplSoDto.setOperationNumber(details.getBillNo());
-//				aplSoDto.setBillNo(details.getMblno());
-//				aplSoDto.setDeliveryTerms("交货条款");
-//				aplSoDto.setBookerExplain("订舱人说明");
-//				aplSoDto.setSignerCode("签单人代码");
-//				aplSoDto.setSignerExplain("签单人说明");
-//				aplSoDto.setInquiryParty("询价单位");
-//				aplSoDto.setAbroadBookingParty("国外订舱单位");
-//				aplSoDto.setTransshipmentIdentification("转船标识");
-//				aplSoDto.setInBatches("分批");
-//				aplSoDto.setInstallationPeriod(null);
-//				aplSoDto.setValidityPeriod(null);
-//				aplSoDto.setFreightAgreementNumber("运费协议号");
-//				aplSoDto.setRateBookCode("费率本代码");
-//				aplSoDto.setServiceContractNumber("服务合同号");
-//				aplSoDto.setBondNo("bondNo");
-//				aplSoDto.setCabinInteroperabilityIdentification("舱位互用标识");
-//				aplSoDto.setBillOfLadingType(details.getBillType());
-//				aplSoDto.setBillOfLadingIssuingPlaceCode("提单签发地代码");
-//				aplSoDto.setBillOfLadingIssuingPlace("提单签发地");
-//				SimpleDateFormat sdf1 = new SimpleDateFormat("CCyyMMdd");
-//				aplSoDto.setIssuanceDate(Integer.parseInt(sdf1.format(details.getIssueDate())));
-//				aplSoDto.setNumberOfOriginalBillsOfLading(details.getNumberOfOblDigit());
-//				aplSoDto.setPrepaidAt(details.getHpayplace());
-//				aplSoDto.setPayableAt(details.getMpayplace());
-//				aplSoDto.setVesselCallSign("船舶呼号");
-//				aplSoDto.setVesselName(details.getVesselCnName());
-//				aplSoDto.setVoyage(details.getVoyageNo());
-//				aplSoDto.setVesselOperatorCode("船舶经营人代码");
-//				aplSoDto.setVesselOperator("船舶经营人");
-//				aplSoDto.setBillCarryCode("提单承运人代码");
-//				aplSoDto.setBillCarry("提单承运人");
-//				aplSoDto.setIssuanceDate(Integer.parseInt(sdf1.format(details.getEtd())));
-//				aplSoDto.setTradeCode("航线代码");
-//				aplSoDto.setTrade("航线");
-//				aplSoDto.setPreVesselCode("前程运输船名代码");
-//				aplSoDto.setPreVessel("前程运输船名");
-//				aplSoDto.setPreVoyage("前程运输航次");
-//				aplSoDto.setPlaceCodeOfReceipt(details.getPlaceReceiptCode());
-//				aplSoDto.setPlaceOfReceipt(details.getPlaceReceiptName());
-//				aplSoDto.setLoadPortCode(details.getPolCode());
-//				aplSoDto.setLoadPort(details.getPolCnName());
-//				aplSoDto.setDischargePortCode(details.getPodCode());
-//				aplSoDto.setDischargePort(details.getPodCnName());
-//				aplSoDto.setTransFerportCode(details.getPotCode());
-//				aplSoDto.setTransFerport(details.getPotCnName());
-//				aplSoDto.setPlaceoFdeliveryCode(details.getPlaceDeliveryCode());
-//				aplSoDto.setPlaceoFdelivery(details.getPlaceDeliveryName());
-//				aplSoDto.setFinalDestinationCode(details.getDestinationCode());
-//				aplSoDto.setFinalDestination(details.getDestinationName());
-//				aplSoDto.setDepotCode("堆场代码");
-//				aplSoDto.setOptDischPortCode("可选卸货港代码");
-//				aplSoDto.setOptDischPort("可选卸货港");
-//				aplSoDto.setOptPlaceOfDeliveryCode("CODE可选交货地代码");
-//				aplSoDto.setOptPlaceOfDelivery("可选交货地");
-//				aplSoDto.setFrClauseCode("运费条款代码");
-//				aplSoDto.setFrEightClause("运费条款");
-//				aplSoDto.setFrChCode("运费及费用代码");
-//				aplSoDto.setFrChRemark("运费及费用说明");
-//				aplSoDto.setPrepaidOrCollect(details.getMpaymode());
-//				aplSoDto.setPayableAtE("第三地付款地点代码");
-//				aplSoDto.setPayeeCode("收款人代码");
-//				aplSoDto.setQuantity("数量");
-//				aplSoDto.setCurrency("币种");
-//				aplSoDto.setRateOfFrCh("费率");
-//				aplSoDto.setUnitOfQuantity("数量单位");
-//				aplSoDto.setAmount("金额");
-//				aplSoDto.setRemarks(details.getBookingRemarks());
-//				aplSoDto.setCargoAmount("货物金额");
-//				aplSoDto.setModeOfStuffing("装箱方式");
-//				aplSoDto.setShipperCode(details.getHshipperCode());
-//				aplSoDto.setShipper(details.getHshipperCnName());
-//				aplSoDto.setConsigneeCode(details.getHconsigneeCode());
-//				aplSoDto.setConsignee(details.getHconsigneeCnName());
-//				aplSoDto.setNotifyCode(details.getHnotifyCode());
-//				aplSoDto.setNotify(details.getHnotifyCnName());
-//				aplSoDto.setAlsoNotifyCode(details.getHnotify2Code());
-//				aplSoDto.setAlsoNotify(details.getHnotify2CnName());
-//				aplSoDto.setCargoSequenceNo(1);//货物序号
-//				aplSoDto.setCargoCode("货类代码");
-//				aplSoDto.setCargoId("货物标识");
-//				aplSoDto.setNumbersOfPkgs(1);//第一层包装件数
-//				aplSoDto.setCodeOfPkgs("第一层包装类型");
-//				aplSoDto.setPackagesDes("第一层包装说明");
-//				aplSoDto.setCargoGrossWt(new BigDecimal("0.00"));//第一层包装皮重
-//				aplSoDto.setCargoMeasurement(new BigDecimal("0.00"));//第一层包装尺码
-//				aplSoDto.setNumbersOfPackages(new BigDecimal("0.00"));//第二层包装件数
-//				aplSoDto.setCodeOfPkgs2("第二层包装类型");
-//				aplSoDto.setPackagesDes2("第二层包装说明");
-//				aplSoDto.setCargoGrossWt2(new BigDecimal("0.00"));//第二层包装皮重
-//				aplSoDto.setCargoMeasurement2(new BigDecimal("0.00"));//第二层包装尺码
-//				aplSoDto.setCargoGrossWeight(details.getGrossWeight());
-//				aplSoDto.setCargoNetWeight(details.getNetWeight());
-//				aplSoDto.setQuarantineCodingCode("检疫代码");
-//				aplSoDto.setQuarantineCoding("检疫名称");
-//				aplSoDto.setDgClass(details.getDgImdgCode());
-//				aplSoDto.setPage("危险品页号");
-//				aplSoDto.setUndgNo(1);
-//				aplSoDto.setLabel("危险品标签");
-//				aplSoDto.setFlashPoint(details.getDgFlashPointUnit());
-//				aplSoDto.setEmsNo("船运危险品应急措施号");
-//				aplSoDto.setMfagNo("医疗急救指南号");
-//				aplSoDto.setMptMarinePollutant("海运污染");
-//				aplSoDto.setEmergencyContact("应急联系");
-//				aplSoDto.setReeferVentilationFlux("冷藏通风量");
-//				aplSoDto.setTemperatureId("温度计量单位");
-//				aplSoDto.setTemperatureSetting("设置温度");
-//				aplSoDto.setMinTemperature("冷藏最低温度");
-//				aplSoDto.setMaxTemperature("冷藏最高温度");
-//				aplSoDto.setOverLengthFront(1);
-//				aplSoDto.setOverLengthBack(1);
-//				aplSoDto.setOverWidthLeft(1);
-//				aplSoDto.setOverWidthRight(1);
-//				aplSoDto.setOverHeight(1);
-//				aplSoDto.setMarks(details.getMarks());
-//				aplSoDto.setCargoDescription("货物描述");
-//				aplSoDto.setCtnSizeType("集装箱尺寸类型");
-//				aplSoDto.setCtnNumbers(1);
-//				aplSoDto.setCtnStatus("集装箱状态");
-//				aplSoDto.setMasterLclNo("主拼号");
-//				aplSoDto.setCntModeOfStuffing("装箱方式");
-//				aplSoDto.setVanningDepotCode("装箱地点代码");
-//				aplSoDto.setVanningDepot("装箱地点说明");
-//				aplSoDto.setContainerSoc("货主箱标志");
-//				aplSoDto.setCtnNo("箱号");
-//				aplSoDto.setCtnTypeSize("箱型尺寸");
-//				aplSoDto.setSealNo("铅封号");
-//				aplSoDto.setCtnNumbersOfPackages(details.getQuantity().intValue());
-//				aplSoDto.setCtnCargoNetWeight(details.getGrossWeight());
-//				aplSoDto.setCargoTareWeight(new BigDecimal("0.00"));
-//				aplSoDto.setRecordTotalOfFile(1);
-//				FilesCenter filesCenter = iediSenderService.sendingAplSo(aplSoDto);
-//
-//				//发送edi记录
-//				EdiLog ediLog = new EdiLog();
-//				ediLog.setBillId(details.getId());
-//				ediLog.setBillNo(details.getBillNo());
-//				ediLog.setMblno(details.getMblno());
-//				ediLog.setHblno(details.getHblno());
-//				ediLog.setPid(ediTypes.getId());
-//				ediLog.setSenderDate(new Date());
-//				ediLog.setBranchId(details.getBranchId());
-//				ediLog.setCreateDept(details.getCreateDept());
-//				ediLog.setCreateTime(details.getCreateTime());
-//				ediLog.setCreateDeptName(details.getCreateDeptName());
-//				ediLog.setCreateUser(details.getCreateUser());
-//				ediLog.setCreateUserName(details.getCreateUserName());
-//				ediLog.setRemarks("发送成功");
-//				ediLog.setStatus(1);
-//				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());
-//				filesCenter.setCreateDeptName(details.getCreateDeptName());
-//				filesCenter.setCreateUser(details.getCreateUser());
-//				filesCenter.setCreateUserName(details.getCreateUserName());
-//				filesCenter.setPid(details.getId());
-//				filesCenter.setItemId(ediLog.getId());
-//				filesCenter.setBusinessType(details.getBusinessType());
-//				filesCenter.setClassifyCode("edi");
-//				filesCenter.setGroupCode("APL-SO");
-//				filesCenter.setSerialNo(1);
-//				filesCenter.setSort(1);
-//				filesCenter.setReceivedData(new Date());
-//				filesCenter.setIsImage(0);
-//				filesCenter.setTenantId(AuthUtil.getTenantId());
-//				filesCenterList.add(filesCenter);
-//			}
-//			billsService.updateBatchById(billsList);
-//		} else if ("HYCK".equals(ediTypes.getType()) && "APL-SI".equals(ediTypes.getCode())) {
-//			for (Bills details : billsList) {
-//				//数据处理
-//			}
-//			billsService.updateBatchById(billsList);
-//		}
-//		filesCenterService.saveOrUpdateBatch(filesCenterList);
-//		return R.data("发送成功");
-	}
-
-	private InttraSoDto buildEDI_InttraSO(EdiTypes ediTypes, List<Bills> billsList, List<Containers> containersList){
-		return null;
-
-	}
-	private InttraSiDto buildEDI_InttraSI(){
-		return null;
-
-	}
-
-	private APLSoDto buildEDI_APLSO(){
-		return null;
-
-	}
-
-	private APLSoDto buildEDI_APLSI(){
-		return null;
 	}
 }