| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 | 
							- using DevExpress.XtraEditors;
 
- using DevExpress.XtraTreeList.Data;
 
- using ExtensionsDev;
 
- using Newtonsoft.Json;
 
- using PosResAnalysis;
 
- using System;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.ComponentModel;
 
- using System.Data;
 
- using System.Data.Entity;
 
- using System.Drawing;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Net.Http;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Controls;
 
- using System.Windows.Documents;
 
- using System.Windows.Forms;
 
- using XdCxRhDw.Dto;
 
- using XdCxRhDW.Core;
 
- using XdCxRhDW.Core.Api;
 
- using XdCxRhDW.Repostory.EFContext;
 
- using XdCxRhDW.Repostory.Model;
 
- namespace XdCxRhDW.App.CorTools
 
- {
 
-     public partial class XlCalculateForm : DevExpress.XtraEditors.XtraForm
 
-     {
 
-         List<string> resXl = new List<string>();
 
-         List<SatEphDto> listEph = new List<SatEphDto>();
 
-         IEnumerable<XlInfo> listXl;
 
-         public XlCalculateForm()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         public XlCalculateForm(IEnumerable<XlInfo> listXl)
 
-             : this()
 
-         {
 
-             this.listXl = listXl;
 
-         }
 
-         private void XlCalculateForm_Load(object sender, EventArgs e)
 
-         {
 
-             gridControl.Init<SatEphDto>().UseSort().UseFilter().UseMultiSelect().UseRowNumber();
 
-             gridControl.DataSource = listEph;
 
-             txtTle.UseDoubleClickToSelectAll();
 
-             txtTle.UseDefault().SetStringData(listXl.Select(p=>p.TwoLine));
 
-         }
 
-       
 
-         private async void btnCalculate_Click(object sender, EventArgs e)
 
-         {
 
-             if (!string.IsNullOrEmpty(txtEndTime.Text) && string.IsNullOrEmpty(txtSpanSeconds.Text))
 
-             {
 
-                 DxHelper.MsgBoxHelper.ShowInfo("请填写推算间隔");
 
-                 return;
 
-             }
 
-             var startTime = Convert.ToDateTime(txtStartTime.EditValue);
 
-             var endTime = Convert.ToDateTime(txtEndTime.EditValue);
 
-             if (!string.IsNullOrEmpty(txtStartTime.Text) && !string.IsNullOrEmpty(txtEndTime.Text))
 
-             {
 
-                 if (endTime < startTime)
 
-                 {
 
-                     DxHelper.MsgBoxHelper.ShowInfo("结束时间不能大于开始时间");
 
-                     return;
 
-                 }
 
-                 if ((endTime - startTime).TotalHours > 24)
 
-                 {
 
-                     DxHelper.MsgBoxHelper.ShowInfo("开始时间和结束时间不能相差超过24小时");
 
-                     return;
 
-                 }
 
-             }
 
-             listEph.Clear();
 
-             var settings = new SysSetings();
 
-             using (RHDWContext db = new RHDWContext())
 
-             {
 
-                 settings = await db.SysSetings.FirstOrDefaultAsync();
 
-             }
 
-             using (var client = new HttpClient())
 
-             {
 
-                 try
 
-                 {
 
-                     if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
 
-                     {
 
-                         string url = string.Format("http://{0}:{1}/Api/Xl/CalcMult", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                         var XlCalcMultDto = new XlCalcMultDto() { tleStr = txtTle.Text, start = startTime, end = endTime, spanSeconds = (int)txtSpanSeconds.EditValue };
 
-                         var ephRes = await HttpHelper.PostRequestAsync<List<SatEphDto>>(url, XlCalcMultDto);
 
-                         if (ephRes.code == 200)
 
-                         {
 
-                             listEph.AddRange(ephRes.data);
 
-                             gridView.RefreshData();
 
-                         }
 
-                     }
 
-                     else
 
-                     {
 
-                         string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                         var XlCalcDto = new XlCalcDto() { tleStr = txtTle.Text, dt = Convert.ToDateTime(txtStartTime.EditValue) };
 
-                         var ephRes = await HttpHelper.PostRequestAsync<SatEphDto>(url, XlCalcDto);
 
-                         if (ephRes.code == 200)
 
-                         {
 
-                             listEph.Add(ephRes.data);
 
-                             gridView.RefreshData();
 
-                         }
 
-                     }
 
-                 }
 
-                 catch (Exception ex)
 
-                 {
 
-                     Serilog.Log.Error(ex, "请求星历推算Api出错");
 
-                     DxHelper.MsgBoxHelper.ShowError("星历推算错误");
 
-                 }
 
-             }
 
-             Console.ReadLine();
 
-         }
 
-     }
 
- }
 
 
  |