|
@@ -7,7 +7,6 @@ using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
using System.Data;
|
|
|
-using System.Data.Entity;
|
|
|
|
|
using System.Drawing;
|
|
using System.Drawing;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
@@ -17,11 +16,17 @@ using DW5S.DTO;
|
|
|
using DW5S.App.Model;
|
|
using DW5S.App.Model;
|
|
|
using DW5S.Entity;
|
|
using DW5S.Entity;
|
|
|
using DW5S.Repostory;
|
|
using DW5S.Repostory;
|
|
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
namespace DW5S.App.CorTools
|
|
namespace DW5S.App.CorTools
|
|
|
{
|
|
{
|
|
|
public partial class XlCalculateForm : DevExpress.XtraEditors.XtraForm
|
|
public partial class XlCalculateForm : DevExpress.XtraEditors.XtraForm
|
|
|
{
|
|
{
|
|
|
|
|
+ [Autowired]
|
|
|
|
|
+ private readonly ILogger logger;
|
|
|
|
|
+
|
|
|
|
|
+ [Autowired]
|
|
|
|
|
+ private readonly UnitOfWork unitOfWork;
|
|
|
List<ModelSatEphRes> listEph = new List<ModelSatEphRes>();
|
|
List<ModelSatEphRes> listEph = new List<ModelSatEphRes>();
|
|
|
|
|
|
|
|
//选择卫星执行星历推算
|
|
//选择卫星执行星历推算
|
|
@@ -29,13 +34,9 @@ namespace DW5S.App.CorTools
|
|
|
{
|
|
{
|
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
|
this.itemTle.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
|
this.itemTle.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
|
|
- List<SatInfo> list1 = new List<SatInfo>();//配置的卫星
|
|
|
|
|
- using (RHDWContext db = new RHDWContext())
|
|
|
|
|
- {
|
|
|
|
|
- list1 = db.SatInfos.OrderBy(p=>p.SatCode).ToList();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- var list2 = XlRepository.GetAllSat().Result;//所有卫星
|
|
|
|
|
|
|
+ var list1 = unitOfWork.Reps<SatInfo>().GetAllAsync(p => p.SatCode).Result;
|
|
|
|
|
+ var repsXl = unitOfWork.Reps<XlInfo>() as XlRepository;
|
|
|
|
|
+ var list2 = repsXl.GetAllSat().Result;//所有卫星
|
|
|
list2.RemoveAll(p => list1.Select(t => t.SatCode).Contains(p.SatCode));
|
|
list2.RemoveAll(p => list1.Select(t => t.SatCode).Contains(p.SatCode));
|
|
|
list2.InsertRange(0, list1);
|
|
list2.InsertRange(0, list1);
|
|
|
this.txtSat.UseDefault().SetData(list2, nameof(SatInfo.Sat)).UseDoubleClickToSelectAll();
|
|
this.txtSat.UseDefault().SetData(list2, nameof(SatInfo.Sat)).UseDoubleClickToSelectAll();
|
|
@@ -112,6 +113,7 @@ namespace DW5S.App.CorTools
|
|
|
listEph.Clear();
|
|
listEph.Clear();
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
|
|
+ var repsXl = unitOfWork.Reps<XlInfo>() as XlRepository;
|
|
|
if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
|
|
if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
|
|
|
{
|
|
{
|
|
|
var XlCalcMultDto = new XlCalcMultDto()
|
|
var XlCalcMultDto = new XlCalcMultDto()
|
|
@@ -127,7 +129,7 @@ namespace DW5S.App.CorTools
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
var sat = txtSat.EditValue as SatInfo;
|
|
var sat = txtSat.EditValue as SatInfo;
|
|
|
- var xlInfo = await XlRepository.GetLatestAsync(sat.SatCode, startTime);
|
|
|
|
|
|
|
+ var xlInfo = await repsXl.GetLatestAsync(sat.SatCode, startTime);
|
|
|
XlCalcMultDto.tleStr = xlInfo.TwoLine;
|
|
XlCalcMultDto.tleStr = xlInfo.TwoLine;
|
|
|
}
|
|
}
|
|
|
var ephRes = await HttpHelper.PostRequestAsync<List<ModelSatEphRes>>(SysConfig.GetUrl("Xl/CalcMult"), XlCalcMultDto);
|
|
var ephRes = await HttpHelper.PostRequestAsync<List<ModelSatEphRes>>(SysConfig.GetUrl("Xl/CalcMult"), XlCalcMultDto);
|
|
@@ -154,7 +156,7 @@ namespace DW5S.App.CorTools
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
var sat = txtSat.EditValue as SatInfo;
|
|
var sat = txtSat.EditValue as SatInfo;
|
|
|
- var xlInfo = await XlRepository.GetLatestAsync(sat.SatCode, XlCalcDto.SigTime);
|
|
|
|
|
|
|
+ var xlInfo = await repsXl.GetLatestAsync(sat.SatCode, XlCalcDto.SigTime);
|
|
|
XlCalcDto.tleStr = xlInfo.TwoLine;
|
|
XlCalcDto.tleStr = xlInfo.TwoLine;
|
|
|
}
|
|
}
|
|
|
var ephRes = await HttpHelper.PostRequestAsync<ModelSatEphRes>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
|
|
var ephRes = await HttpHelper.PostRequestAsync<ModelSatEphRes>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
|
|
@@ -171,12 +173,14 @@ namespace DW5S.App.CorTools
|
|
|
}
|
|
}
|
|
|
catch (TaskCanceledException)
|
|
catch (TaskCanceledException)
|
|
|
{
|
|
{
|
|
|
- DW5S.Framework.LogHelper.Warning("星历推算Http接口调用超时");
|
|
|
|
|
- DxHelper.MsgBoxHelper.ShowInfo("星历推算Http接口调用超时");
|
|
|
|
|
|
|
+ string msg = "星历推算Http接口调用超时";
|
|
|
|
|
+ logger.LogWarning(msg);
|
|
|
|
|
+ DxHelper.MsgBoxHelper.ShowWarning("星历推算Http接口调用超时");
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- DW5S.Framework.LogHelper.Error("星历推算异常", ex);
|
|
|
|
|
|
|
+ string msg = "星历推算异常";
|
|
|
|
|
+ logger.LogError(ex,msg);
|
|
|
DxHelper.MsgBoxHelper.ShowError("星历推算异常");
|
|
DxHelper.MsgBoxHelper.ShowError("星历推算异常");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|