|
@@ -323,48 +323,62 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
historyFile.FreqHz = (long)((decimal)freqMHz * 1000000);
|
|
|
historyFile.Ch = ch;
|
|
|
historyFile.FsHz = fsHz;
|
|
|
- if (canConnected)
|
|
|
- historyFile.SatId = GetSatId(historyFile.FreqHz);
|
|
|
- if (ch == 2)
|
|
|
+ if (!canConnected)
|
|
|
{
|
|
|
- if (historyFile.SatId == 0)
|
|
|
- {
|
|
|
- LogHelper.Warning($"【任务{dto.ID}】主星无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.MainSatCode}]");
|
|
|
+ if (ch == 2)
|
|
|
historyFile.SatId = dto.MainSatCode;
|
|
|
- }
|
|
|
+ else if (ch == 3)
|
|
|
+ historyFile.SatId = dto.AdjaSatCode;
|
|
|
}
|
|
|
- else if (ch == 3)
|
|
|
+ else
|
|
|
{
|
|
|
- if (historyFile.SatId == 0)
|
|
|
+ if (ch == 2)
|
|
|
{
|
|
|
- LogHelper.Warning($"【任务{dto.ID}】邻星无法通过MySql查询到卫星编号,邻星使用任务中的卫星[{dto.AdjaSatCode}]");
|
|
|
- historyFile.SatId = dto.AdjaSatCode;
|
|
|
+ historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
|
|
|
+ if (historyFile.SatId == 0)
|
|
|
+ {
|
|
|
+ LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.MainSatCode}]");
|
|
|
+ historyFile.SatId = dto.MainSatCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (ch == 3)
|
|
|
+ {
|
|
|
+ historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
|
|
|
+ if (historyFile.SatId == 0)
|
|
|
+ {
|
|
|
+ LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.AdjaSatCode}]");
|
|
|
+ historyFile.SatId = dto.AdjaSatCode;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
return historyFile;
|
|
|
}
|
|
|
|
|
|
- int GetSatId(double freqdown)
|
|
|
+ int GetSatId(double freqdownMHz)
|
|
|
{
|
|
|
int satId = 0;
|
|
|
- string sql = $"select 卫星ID from freguencysatid where 下行 = '{freqdown}'and 洋区 = 'I' LIMIT 1";
|
|
|
+ string sql = $"select 卫星ID from freguencysatid where 下行 = '{freqdownMHz}'and 洋区 = 'I' LIMIT 1";
|
|
|
try
|
|
|
{
|
|
|
var res = MySqlTools.ExecuteScalar(System.Data.CommandType.Text, sql);
|
|
|
if (res == null || res == DBNull.Value)
|
|
|
{
|
|
|
- LogHelper.Error($"下行频点{freqdown * 1e-6}未能从MySql中找到对应的卫星编号.SQL={sql}");
|
|
|
+ LogHelper.Error($"下行频点{freqdownMHz}未能从MySql中找到对应的卫星编号.SQL={sql}");
|
|
|
}
|
|
|
- bool isInt = int.TryParse($"{res}", out satId);
|
|
|
- if (!isInt)
|
|
|
+ else
|
|
|
{
|
|
|
- //System.Configuration.ConfigurationManager.ConnectionStrings["MySql"].ConnectionString
|
|
|
- LogHelper.Error($"卫星编号转换失败,obj={res}");
|
|
|
+ bool isInt = int.TryParse($"{res}", out satId);
|
|
|
+ if (!isInt)
|
|
|
+ {
|
|
|
+ LogHelper.Error($"卫星编号转换失败,obj={res}");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- LogHelper.Error($"下行频点{freqdown * 1e-6}MySql查询卫星编号异常.ConnectionString={System.Configuration.ConfigurationManager.ConnectionStrings["MySql"].ConnectionString}", ex);
|
|
|
+ LogHelper.Error($"下行频点{freqdownMHz}MySql查询卫星编号异常.ConnectionString={System.Configuration.ConfigurationManager.ConnectionStrings["MySql"].ConnectionString}", ex);
|
|
|
}
|
|
|
return satId;
|
|
|
}
|