|
@@ -47,7 +47,7 @@ namespace XdCxRhDW.Repostory
|
|
|
{
|
|
|
using (RHDWContext db = new RHDWContext())
|
|
|
{
|
|
|
- var res= await db.XlInfos.SqlQuery(sql).FirstOrDefaultAsync();
|
|
|
+ var res = await db.XlInfos.SqlQuery(sql).FirstOrDefaultAsync();
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
@@ -57,5 +57,29 @@ namespace XdCxRhDW.Repostory
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取某个星某个时刻最近的双行根(可能返回null)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="satCode">卫星编号</param>
|
|
|
+ /// <param name="sigTime">时刻</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<XlInfo> GetLatest2Async(int satCode, DateTime sigTime)
|
|
|
+ {
|
|
|
+ var sql = $"SELECT min(abs(JULIANDAY(TimeUTC)-JULIANDAY('{sigTime:yyyy-MM-dd HH:mm:ss}')))" +
|
|
|
+ $" as NearDaySpan,* FROM XlInfo where satcode={satCode}";
|
|
|
+ try
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var res = await db.XlInfos.SqlQuery(sql).FirstOrDefaultAsync();
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ throw new Exception($"获取双行根数出错.Sql={sql}");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|