diff --git a/Framework/YLErp.Core/ConsGlobal.cs b/Framework/YLErp.Core/ConsGlobal.cs
index 5cb686b3..9e1e3f79 100644
--- a/Framework/YLErp.Core/ConsGlobal.cs
+++ b/Framework/YLErp.Core/ConsGlobal.cs
@@ -356,6 +356,22 @@ namespace YLErp
}
}
+ ///
+ /// 是否债券指数资产类型(永续,无到期日)。
+ /// 注:ConvertCalcType 将其映射为 CommodityFutures 以复用计算路径,
+ /// 但保存校验不应据此强制要求到期日。
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsBondIndex(string instType)
+ => BondIndex.Equals(instType, StringComparison.OrdinalIgnoreCase);
+
+ ///
+ /// 是否利率收益率曲线资产类型(无到期日)。
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool IsRateYield(string instType)
+ => RateYield.Equals(instType, StringComparison.OrdinalIgnoreCase);
+
//------------CalcType-----------------------
///
diff --git a/Framework/YLErp.Core/DBModels/underlying_manager.cs b/Framework/YLErp.Core/DBModels/underlying_manager.cs
index 38138af3..2808b5f5 100644
--- a/Framework/YLErp.Core/DBModels/underlying_manager.cs
+++ b/Framework/YLErp.Core/DBModels/underlying_manager.cs
@@ -488,6 +488,19 @@ namespace YLErp.DBModels
return ConsGlobal.InstrumentType.CalcTypeIsFutures(UnderlyingInstrumentType);
}
+ ///
+ /// 标的是否需要在保存时填写到期日。
+ /// 仅真正的期货合约需要;BondIndex(债券指数)/ RateYield(利率曲线)虽被
+ /// ConvertCalcType 映射为 CommodityFutures 以复用计算路径,但二者永续无到期日,
+ /// 不应强制要求。集中此处作为唯一判定,避免 IsFutures() 判断在多处被重复收窄。
+ ///
+ public bool RequiresMaturityDate()
+ {
+ return ConsGlobal.InstrumentType.CalcTypeIsFutures(UnderlyingInstrumentType)
+ && !ConsGlobal.InstrumentType.IsBondIndex(UnderlyingInstrumentType)
+ && !ConsGlobal.InstrumentType.IsRateYield(UnderlyingInstrumentType);
+ }
+
///
/// 标的是否债券类型
///
diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
index 3d308d0e..26a57cee 100644
--- a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
@@ -943,7 +943,7 @@ namespace YLErp.Modules.SwapModule
throw new ServiceException("标的信息不存在:" + req.UnderlyingCode);
}
- if (_underlying.IsFutures() && _underlying.MaturityDate == null)
+ if (_underlying.RequiresMaturityDate() && _underlying.MaturityDate == null)
{
throw new ServiceException("标的到期日不存在:" + req.UnderlyingCode);
}
@@ -952,7 +952,7 @@ namespace YLErp.Modules.SwapModule
req.VarietyId = _underlying.UnderlyingTypeId;
req.UnderlyingAssetClass = _underlying.UnderlyingType;
req.UnderlyingAssetName = _underlying.UnderlyingName;
- req.MaturityDate = _underlying.IsFutures() ? _underlying.MaturityDate : null;
+ req.MaturityDate = _underlying.RequiresMaturityDate() ? _underlying.MaturityDate : null;
req.UnderlyingInstrumentType = _underlying.GetMainType();
req.CountRatio = _underlying.CountRatio;