Explorar o código

Merge branch 'master' of http://139.155.15.221:3000/zoulei/XdCxRhDW

zoulei hai 1 ano
pai
achega
272acfab8a

+ 17 - 28
XdCxRhDW.App/CorTools/XlCalculateForm.cs

@@ -63,24 +63,22 @@ namespace XdCxRhDW.App.CorTools
 
         private async void btnCalculate_Click(object sender, EventArgs e)
         {
-            //HttpClient httpClient = new HttpClient();
-            //HttpResponseMessage response = await httpClient.GetAsync(string.Format("http://192.168.254.249:8091/Api/Xl/Calc?tleStr={0}&dt={1}",txtTle.Text,txtStartTime.EditValue));
-            //string responseBody = await response.Content.ReadAsStringAsync();
+           
             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))
-            {
-                var startTime = Convert.ToDateTime(txtStartTime.EditValue);
-                var endTime = Convert.ToDateTime(txtEndTime.EditValue);
+            {              
                 if (endTime < startTime)
                 {
                     DxHelper.MsgBoxHelper.ShowInfo("结束时间不能大于开始时间");
                     return;
                 }
-                if ((endTime-startTime).TotalHours > 24)
+                if ((endTime - startTime).TotalHours > 24)
                 {
                     DxHelper.MsgBoxHelper.ShowInfo("开始时间和结束时间不能相差超过24小时");
                     return;
@@ -96,32 +94,23 @@ namespace XdCxRhDW.App.CorTools
             {
                 try
                 {
-                   
-                    string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                    
                     if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
                     {
-                        url += string.Format("Xl/CalcMult?tleStr={0}&start={1}&end={2}&spanSeconds={3}", txtTle.Text, txtStartTime.EditValue, txtEndTime.EditValue, txtSpanSeconds.EditValue);
-                        var response = await client.GetAsync(url);
-                        if (response.IsSuccessStatusCode) // 处理成功响应
-                        {
-                            var content = await response.Content.ReadAsStringAsync();
-                            var ajaxResult = JsonConvert.DeserializeObject<AjaxResult<List<SatEphDto>>>(content);
-                            list.AddRange(ajaxResult.data);
-                            gridView.RefreshData();
-                        }
+                        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 content = new StringContent(JsonConvert.SerializeObject(XlCalcMultDto), System.Text.Encoding.UTF8, "application/json");
+                        var ephRes = HttpHelper.PostRequest<List<SatEphDto>>(url, content);
+                        list.AddRange(ephRes);
+                        gridView.RefreshData();
                     }
                     else
                     {
-                        url += string.Format("Xl/Calc?tleStr={0}&dt={1}", txtTle.Text, txtStartTime.EditValue);
-                        var response = await client.GetAsync(url);
-                        if (response.IsSuccessStatusCode) // 处理成功响应
-                        {
-                            var content = await response.Content.ReadAsStringAsync();
-                            var ajaxResult = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content);
-                            list.Add(ajaxResult.data);
-                            gridView.RefreshData();
-                        }
+                        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 content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                        var ephRes = HttpHelper.PostRequest<SatEphDto>(url, content);
+                        list.Add(ephRes);
+                        gridView.RefreshData();
                     }
                 }
                 catch (Exception ex)

+ 30 - 0
XdCxRhDW.App/ExtensionsDev/BaseEditExtension.cs

@@ -1,4 +1,5 @@
 using DevExpress.XtraEditors;
+using DevExpress.XtraEditors.DXErrorProvider;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
@@ -20,5 +21,34 @@ namespace ExtensionsDev
             var ctrl= (BaseEdit)sender;
             ctrl.SelectAll();
         }
+        public static (bool,string) CheckLonLat(this TextEdit @this, string msg)
+        {
+            if (string.IsNullOrWhiteSpace(@this.Text.Trim()))
+            {
+               
+                return (false, $"{msg}经纬度不能为空!");
+            }
+            var context = @this.Text.Split(',');
+            if (context.Length != 2)
+            {
+              
+                return (false,$"{msg}经度纬度之间用英文逗号隔开!");
+            }
+            double lon;
+            bool isDoubleLon = Double.TryParse(context[0], out lon);
+            if (!isDoubleLon || lon > 180 || lon < -180)
+            {
+                return (false, $"{msg}经度范围[180,-180]!");
+            }
+            double lat;
+            bool isDoubleLat = Double.TryParse(context[1], out lat);
+            if (!isDoubleLat || lat > 90 || lat < -90)
+            {
+                return (false, $"{msg}纬度范围[90,-90]!");
+            }
+            return (true,"");
+
+        }
+
     }
 }

+ 4 - 3
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -173,11 +173,12 @@ namespace XdCxRhDW.App.UserControl
                 {
                     switch (p.PosResType)
                     {
-                        case EnumPosResType.X1D1CX:
+
                         case EnumPosResType.X3TwoDfo:
                         case EnumPosResType.RH:
                         default:
                             return false;
+                        case EnumPosResType.X1D1CX:
                         case EnumPosResType.X2D1:
                         case EnumPosResType.X2D1NoRef:
                         case EnumPosResType.X3:
@@ -362,8 +363,8 @@ namespace XdCxRhDW.App.UserControl
             {
                 case EnumPosResType.X1D1CX:
                     //一星一地 测向线 GDOP
-                    btnDrawDto.Visibility = btnDrawDfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
-                    btnGDOP.Visibility = btnDrawCX.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+                    btnDrawDfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+                    btnDrawDto.Visibility = btnGDOP.Visibility = btnDrawCX.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                     break;
                 case EnumPosResType.X2D1:
                 case EnumPosResType.X2D1NoRef:

+ 55 - 13
XdCxRhDW.App/UserControl/X1D1GDOPParam.cs

@@ -7,6 +7,7 @@ using System.Collections.Generic;
 using XdCxRhDW.Repostory.Model;
 using XdCxRhDW.Repostory.EFContext;
 using XdCxRhDW.Core.Api;
+using System.Runtime.ConstrainedExecution;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class X1D1GDOPParam : DevExpress.XtraEditors.XtraUserControl
@@ -24,7 +25,7 @@ namespace XdCxRhDW.App.UserControl
             RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
             DtousErr = Convert.ToDouble(txtDtousErr1.Text),
             SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
-            CXErr= Convert.ToDouble(txtCxErr.Text),
+            CXErr = Convert.ToDouble(txtCxErr.Text),
         };
         public X1D1GDOPParam(PosRes item)
         {
@@ -51,7 +52,7 @@ namespace XdCxRhDW.App.UserControl
                 {
                     this.txtStationLocation1.Text = $"{station.CdbTxLon},{station.CdbTxLat}";
                     this.txtRefLocation1.Text = $"{station.RefLon},{station.RefLat}";
-                    this.txtCXStation.Text= $"{station.CxLon},{station.CxLat}";
+                    this.txtCXStation.Text = $"{station.CxLon},{station.CxLat}";
                 }
                 var xlList = db.XlInfos.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
@@ -72,25 +73,66 @@ namespace XdCxRhDW.App.UserControl
 
         }
 
-
+        private (bool, string) ParamValidate()
+        {
+            if (string.IsNullOrWhiteSpace(txtTleMain.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (txtCapTime.DateTime==DateTime.MinValue)
+            {
+                return (false, "采集时刻不能为空!");
+            }
+            var txtstat = txtStationLocation1.CheckLonLat("超短波");
+            if (!txtstat.Item1)
+            {
+                return txtstat;
+            }
+            var cxsta = txtCXStation.CheckLonLat("测向站");
+            if (!cxsta.Item1)
+            {
+                return cxsta;
+            }
+            var refsta = txtRefLocation1.CheckLonLat("参考站");
+            if (!refsta.Item1)
+            {
+                return refsta;
+            }
+            return (true, "");
+        }
 
         private void btnOK_Click(object sender, EventArgs e)
         {
-            mapControl1.ClearMap();
-            var cdb = new double[] { Model.StationLon, Model.StationLat, 0 };
-            var cx = new double[] { Model.StationLon, Model.StationLat, 0 };
-            var refstation = new double[] { Model.RefLon, Model.RefLat, 0 };
-            var (listSat, data) = GdopHelper.Gdop1Sat1D(Model.TleMain, Model.CapTime, cdb, cx,
-                             Model.DtousErr,Model.CXErr, Model.SatLocErr, refstation);
-            if (data == null)
+            var pv = ParamValidate();
+            if (!pv.Item1)
             {
+                DxHelper.MsgBoxHelper.ShowWarning($"{pv.Item2}");
                 return;
             }
-            foreach (var errLins in data)//画GDOP
+            try
+            {
+                mapControl1.ClearMap();
+                var cdb = new double[] { Model.StationLon, Model.StationLat, 0 };
+                var cx = new double[] { Model.StationLon, Model.StationLat, 0 };
+                var refstation = new double[] { Model.RefLon, Model.RefLat, 0 };
+                var (listSat, data) = GdopHelper.Gdop1Sat1D(Model.TleMain, Model.CapTime, cdb, cx,
+                                 Model.DtousErr, Model.CXErr, Model.SatLocErr, refstation);
+                if (data == null)
+                {
+                    return;
+                }
+                foreach (var errLins in data)//画GDOP
+                {
+                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                }
+
+            }
+            catch (Exception ex)
             {
-                var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                DxHelper.MsgBoxHelper.ShowError($"绘制GDOP失败,{ex.Message}");
             }
+
         }
         private void btnClose_Click(object sender, EventArgs e)
         {

+ 53 - 8
XdCxRhDW.App/UserControl/X2D1GDOPParam.cs

@@ -7,6 +7,7 @@ using System.Collections.Generic;
 using XdCxRhDW.Repostory.Model;
 using XdCxRhDW.Repostory.EFContext;
 using XdCxRhDW.Core.Api;
+using DxHelper;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class X2D1GDOPParam : DevExpress.XtraEditors.XtraUserControl
@@ -88,20 +89,64 @@ namespace XdCxRhDW.App.UserControl
         }
 
 
+        private (bool, string) ParamValidate()
+        {
+            if (string.IsNullOrWhiteSpace(txtTleMain.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleAdja.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (txtTleMain.Text.Trim() == txtTleAdja.Text.Trim())
+            {
+                return (false, "主邻星历不能相同!");
+            }
+            if (txtCapTime.DateTime == DateTime.MinValue)
+            {
+                return (false, "采集时刻不能为空!");
+            }
+            var txtstat = txtStationLocation1.CheckLonLat("超短波");
+            if (!txtstat.Item1)
+            {
+                return txtstat;
+            }
 
+            var refsta = txtRefLocation1.CheckLonLat("参考站");
+            if (PosResType == EnumPosResType.X2D1 && !refsta.Item1)
+            {
+                return refsta;
+            }
+            return (true, "");
+        }
         private void btnOK_Click(object sender, EventArgs e)
         {
-            mapControl1.ClearMap();
+            var pv = ParamValidate();
+            if (!pv.Item1)
+            {
+                DxHelper.MsgBoxHelper.ShowWarning($"{pv.Item2}");
+                return;
+            }
+            try
+            {
+
+                mapControl1.ClearMap();
 
-            var cdb = new double[] { Model.StationLon, Model.StationLat, 0 };
-            var refstation = new double[] { Model.RefLon, Model.RefLat, 0 };
+                var cdb = new double[] { Model.StationLon, Model.StationLat, 0 };
+                var refstation = new double[] { Model.RefLon, Model.RefLat, 0 };
 
-            var (listSat, data) = GdopHelper.Gdop2Sat1D(Model.TleMain, Model.TleAdja, Model.CapTime, cdb
-                     , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X2D1NoRef ? null : refstation);
-            foreach (var errLins in data)//画GDOP
+                var (listSat, data) = GdopHelper.Gdop2Sat1D(Model.TleMain, Model.TleAdja, Model.CapTime, cdb
+                         , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X2D1NoRef ? null : refstation);
+                foreach (var errLins in data)//画GDOP
+                {
+                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                }
+            }
+            catch (Exception ex)
             {
-                var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                DxHelper.MsgBoxHelper.ShowError($"绘制{PosResType.GetEnumDisplayName()}GDOP失败,{ex.Message}");
             }
         }
         private void btnClose_Click(object sender, EventArgs e)

+ 49 - 10
XdCxRhDW.App/UserControl/X2DFGDOPParam.cs

@@ -82,23 +82,62 @@ namespace XdCxRhDW.App.UserControl
             txtTleLeo2.UseDefault().SetStringData(xlall).Text = adjaTle1;
         }
 
-
+        private (bool, string) ParamValidate()
+        {
+            if (string.IsNullOrWhiteSpace(txtTleLeo1.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleLeo2.Text.Trim()))
+            {
+                return (false, "邻星星历不能为空!");
+            }
+            if (txtTleLeo1.Text.Trim() == txtTleLeo2.Text.Trim())
+            {
+                return (false, "主邻星历不能相同!");
+            }
+            if (txtCapTime.DateTime == DateTime.MinValue)
+            {
+                return (false, "采集时刻不能为空!");
+            }
+            var refsta = txtRefLocation1.CheckLonLat("参考站");
+            if ( !refsta.Item1)
+            {
+                return refsta;
+            }
+            return (true, "");
+        }
         private void btnOK_Click(object sender, EventArgs e)
         {
-            mapControl1.ClearMap();
-            var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
-            var (listSat, data) = GdopHelper.Gdop2SatDRef(Model.TleLeo1, Model.TleLeo2,
-                Model.CapTime, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, refs);
-
-            if (data == null)
+            var pv = ParamValidate();
+            if (!pv.Item1)
             {
+                DxHelper.MsgBoxHelper.ShowWarning($"{pv.Item2}");
                 return;
             }
+            try
+            {
 
-            foreach (var errLins in data)//画GDOP
+
+                mapControl1.ClearMap();
+                var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
+                var (listSat, data) = GdopHelper.Gdop2SatDRef(Model.TleLeo1, Model.TleLeo2,
+                    Model.CapTime, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, refs);
+
+                if (data == null)
+                {
+                    return;
+                }
+
+                foreach (var errLins in data)//画GDOP
+                {
+                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                }
+            }
+            catch (Exception ex)
             {
-                var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                DxHelper.MsgBoxHelper.ShowError($"绘制GDOP失败,{ex.Message}");
             }
         }
 

+ 52 - 11
XdCxRhDW.App/UserControl/X3DFGDOPParam .cs

@@ -93,23 +93,64 @@ namespace XdCxRhDW.App.UserControl
             txtTleLeo3.UseDefault().SetStringData(xlall).Text = adjaTle2;
         }
 
-
+        private (bool, string) ParamValidate()
+        {
+            if (string.IsNullOrWhiteSpace(txtTleLeo1.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleLeo2.Text.Trim()))
+            {
+                return (false, "邻星1星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleLeo3.Text.Trim()))
+            {
+                return (false, "邻星2星历不能为空!");
+            }
+            if (txtTleLeo1.Text.Trim() == txtTleLeo2.Text.Trim() || txtTleLeo1.Text.Trim() == txtTleLeo3.Text.Trim() || txtTleLeo2.Text.Trim() == txtTleLeo3.Text.Trim())
+            {
+                return (false, "主邻星历不能相同!");
+            }
+            if (txtCapTime.DateTime == DateTime.MinValue)
+            {
+                return (false, "采集时刻不能为空!");
+            }
+            var refsta = txtRefLocation1.CheckLonLat("参考站");
+            if (!refsta.Item1)
+            {
+                return refsta;
+            }
+            return (true, "");
+        }
         private void btnOK_Click(object sender, EventArgs e)
         {
-            mapControl1.ClearMap();
-            var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
-            var (listSat, data) = GdopHelper.Gdop3SatDF(Model.TleLeo1, Model.TleLeo2, Model.TleLeo3,
-                Model.CapTime, Model.fu1, Model.fu2, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, refs);
-
-            if (data == null)
+            var pv = ParamValidate();
+            if (!pv.Item1)
             {
+                DxHelper.MsgBoxHelper.ShowWarning($"{pv.Item2}");
                 return;
             }
-           
-            foreach (var errLins in data)//画GDOP
+            try
+            {
+                mapControl1.ClearMap();
+                var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
+                var (listSat, data) = GdopHelper.Gdop3SatDF(Model.TleLeo1, Model.TleLeo2, Model.TleLeo3,
+                    Model.CapTime, Model.fu1, Model.fu2, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, refs);
+
+                if (data == null)
+                {
+                    return;
+                }
+
+                foreach (var errLins in data)//画GDOP
+                {
+                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                }
+            }
+            catch (Exception ex)
             {
-                var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
+                DxHelper.MsgBoxHelper.ShowError($"绘制GDOP失败,{ex.Message}");
             }
         }
 

+ 51 - 8
XdCxRhDW.App/UserControl/X3GDOPParam.cs

@@ -7,6 +7,7 @@ using System.Collections.Generic;
 using XdCxRhDW.Repostory.Model;
 using XdCxRhDW.Repostory.EFContext;
 using XdCxRhDW.Core.Api;
+using DxHelper;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class X3GDOPParam : DevExpress.XtraEditors.XtraUserControl
@@ -92,20 +93,62 @@ namespace XdCxRhDW.App.UserControl
         {
             DxHelper.PopupHelper.HidePopup(this);
         }
+        private (bool, string) ParamValidate()
+        {
+            if (string.IsNullOrWhiteSpace(txtTleMain.Text.Trim()))
+            {
+                return (false, "主星星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleAdja1.Text.Trim()))
+            {
+                return (false, "邻星1星历不能为空!");
+            }
+            if (string.IsNullOrWhiteSpace(txtTleAdja2.Text.Trim()))
+            {
+                return (false, "邻星2星历不能为空!");
+            }
+            if (txtTleMain.Text.Trim() == txtTleAdja1.Text.Trim() || txtTleMain.Text.Trim() == txtTleAdja2.Text.Trim() || txtTleAdja1.Text.Trim() == txtTleAdja2.Text.Trim())
+            {
+                return (false, "主邻星历不能相同!");
+            }
+            if (txtCapTime.DateTime == DateTime.MinValue)
+            {
+                return (false, "采集时刻不能为空!");
+            }
+            var refsta = txtRefLocation1.CheckLonLat("参考站");
+            if (PosResType == EnumPosResType.X3 && !refsta.Item1)
+            {
+                return refsta;
+            }
+            return (true, "");
+        }
         private void btnX1D2_Click(object sender, EventArgs e)
         {
-            mapControl1.ClearMap();
-            var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
-            var (listSat, data) = GdopHelper.Gdop3Sat(Model.TleMain, Model.TleAdja1, Model.TleAdja2, Model.CapTime
-                              , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X3NoRef ? null : refs);
-            if (data == null)
+            var pv = ParamValidate();
+            if (!pv.Item1)
             {
+                DxHelper.MsgBoxHelper.ShowWarning($"{pv.Item2}");
                 return;
             }
-            foreach (var errLins in data)//画GDOP
+            try
+            {
+                mapControl1.ClearMap();
+                var refs = new double[] { Model.RefLon, Model.RefLat, 0 };
+                var (listSat, data) = GdopHelper.Gdop3Sat(Model.TleMain, Model.TleAdja1, Model.TleAdja2, Model.CapTime
+                                  , Model.DtousErr, Model.SatLocErr, PosResType == EnumPosResType.X3NoRef ? null : refs);
+                if (data == null)
+                {
+                    return;
+                }
+                foreach (var errLins in data)//画GDOP
+                {
+                    var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
+                    mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                }
+            }
+            catch (Exception ex)
             {
-                var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
-                mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
+                DxHelper.MsgBoxHelper.ShowError($"绘制{PosResType.GetEnumDisplayName()}GDOP失败,{ex.Message}");
             }
         }
     }

BIN=BIN
XdCxRhDW.Core/Api/GDOP误差椭圆/GDOP/GDOP_Draw_11.dll


+ 19 - 19
XdCxRhDW.Sender/Form1.Designer.cs

@@ -72,17 +72,17 @@
             this.layoutControl1.Controls.Add(this.localPort1);
             this.layoutControl1.Controls.Add(this.txtAddr1);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.layoutControl1.Location = new System.Drawing.Point(101, 12);
+            this.layoutControl1.Location = new System.Drawing.Point(77, 12);
             this.layoutControl1.Name = "layoutControl1";
             this.layoutControl1.Root = this.Root;
             this.tablePanel1.SetRow(this.layoutControl1, 0);
-            this.layoutControl1.Size = new System.Drawing.Size(438, 50);
+            this.layoutControl1.Size = new System.Drawing.Size(537, 50);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
             // txtTskType
             // 
-            this.txtTskType.Location = new System.Drawing.Point(334, 20);
+            this.txtTskType.Location = new System.Drawing.Point(328, 20);
             this.txtTskType.MenuManager = this.barManager1;
             this.txtTskType.Name = "txtTskType";
             this.txtTskType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -104,7 +104,7 @@
             new DevExpress.XtraEditors.Controls.ImageComboBoxItem("三星双时差无参定位无星厉", "X3TwoDtoNoParNoXL", -1),
             new DevExpress.XtraEditors.Controls.ImageComboBoxItem("三星双频差定位无星厉", "X3TwoDfoNoXL", -1),
             new DevExpress.XtraEditors.Controls.ImageComboBoxItem("双星时频差定位无星厉", "X2DfoNoXL", -1)});
-            this.txtTskType.Size = new System.Drawing.Size(102, 22);
+            this.txtTskType.Size = new System.Drawing.Size(207, 22);
             this.txtTskType.StyleController = this.layoutControl1;
             this.txtTskType.TabIndex = 6;
             // 
@@ -170,21 +170,21 @@
             // 
             // localPort1
             // 
-            this.localPort1.Location = new System.Drawing.Point(221, 20);
+            this.localPort1.Location = new System.Drawing.Point(210, 20);
             this.localPort1.MenuManager = this.barManager1;
             this.localPort1.Name = "localPort1";
             this.localPort1.Properties.NullValuePrompt = "空值表示随机端口";
-            this.localPort1.Size = new System.Drawing.Size(109, 22);
+            this.localPort1.Size = new System.Drawing.Size(114, 22);
             this.localPort1.StyleController = this.layoutControl1;
             this.localPort1.TabIndex = 5;
             // 
             // txtAddr1
             // 
-            this.txtAddr1.EditValue = "127.0.0.1:8092";
+            this.txtAddr1.EditValue = "127.0.0.1:8091";
             this.txtAddr1.Location = new System.Drawing.Point(2, 20);
             this.txtAddr1.Name = "txtAddr1";
             this.txtAddr1.Properties.NullValuePrompt = "127.0.0.1:16010";
-            this.txtAddr1.Size = new System.Drawing.Size(215, 22);
+            this.txtAddr1.Size = new System.Drawing.Size(204, 22);
             this.txtAddr1.StyleController = this.layoutControl1;
             this.txtAddr1.TabIndex = 4;
             // 
@@ -198,7 +198,7 @@
             this.layoutControlItem2});
             this.Root.Name = "Root";
             this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.Root.Size = new System.Drawing.Size(438, 50);
+            this.Root.Size = new System.Drawing.Size(537, 50);
             this.Root.Text = "星地时频差";
             this.Root.TextVisible = false;
             // 
@@ -208,7 +208,7 @@
             this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlItem1.MinSize = new System.Drawing.Size(112, 41);
             this.layoutControlItem1.Name = "layoutControlItem1";
-            this.layoutControlItem1.Size = new System.Drawing.Size(219, 50);
+            this.layoutControlItem1.Size = new System.Drawing.Size(208, 50);
             this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem1.Text = "推送地址";
             this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top;
@@ -217,10 +217,10 @@
             // layoutControlItem7
             // 
             this.layoutControlItem7.Control = this.localPort1;
-            this.layoutControlItem7.Location = new System.Drawing.Point(219, 0);
+            this.layoutControlItem7.Location = new System.Drawing.Point(208, 0);
             this.layoutControlItem7.MinSize = new System.Drawing.Size(54, 44);
             this.layoutControlItem7.Name = "layoutControlItem7";
-            this.layoutControlItem7.Size = new System.Drawing.Size(113, 50);
+            this.layoutControlItem7.Size = new System.Drawing.Size(118, 50);
             this.layoutControlItem7.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem7.Text = "本地端口";
             this.layoutControlItem7.TextLocation = DevExpress.Utils.Locations.Top;
@@ -229,9 +229,9 @@
             // layoutControlItem2
             // 
             this.layoutControlItem2.Control = this.txtTskType;
-            this.layoutControlItem2.Location = new System.Drawing.Point(332, 0);
+            this.layoutControlItem2.Location = new System.Drawing.Point(326, 0);
             this.layoutControlItem2.Name = "layoutControlItem2";
-            this.layoutControlItem2.Size = new System.Drawing.Size(106, 50);
+            this.layoutControlItem2.Size = new System.Drawing.Size(211, 50);
             this.layoutControlItem2.Text = "定位类型";
             this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top;
             this.layoutControlItem2.TextSize = new System.Drawing.Size(48, 14);
@@ -239,10 +239,10 @@
             // tablePanel1
             // 
             this.tablePanel1.Columns.AddRange(new DevExpress.Utils.Layout.TablePanelColumn[] {
-            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F),
-            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 5F),
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 0.67F),
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 5.7F),
             new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.AutoSize, 1F),
-            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F)});
+            new DevExpress.Utils.Layout.TablePanelColumn(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 0.63F)});
             this.tablePanel1.Controls.Add(this.btn1);
             this.tablePanel1.Controls.Add(this.listBoxControl1);
             this.tablePanel1.Controls.Add(this.layoutControl1);
@@ -259,11 +259,11 @@
             // btn1
             // 
             this.tablePanel1.SetColumn(this.btn1, 2);
-            this.btn1.Location = new System.Drawing.Point(545, 36);
+            this.btn1.Location = new System.Drawing.Point(619, 36);
             this.btn1.Margin = new System.Windows.Forms.Padding(3, 22, 3, 3);
             this.btn1.Name = "btn1";
             this.tablePanel1.SetRow(this.btn1, 0);
-            this.btn1.Size = new System.Drawing.Size(96, 21);
+            this.btn1.Size = new System.Drawing.Size(50, 21);
             this.btn1.TabIndex = 4;
             this.btn1.Text = "推送";
             this.btn1.Click += new System.EventHandler(this.btn1_Click);

+ 87 - 196
XdCxRhDW.WebApi/Controllers/PosController.cs

@@ -100,7 +100,7 @@ namespace XdCxRhDW.App.WebAPI
                 return Success(Map(posRes));
             }
         }
-     
+
         /// <summary>
         /// 一星一地测向带参定位(无星历)
         /// </summary>
@@ -126,21 +126,10 @@ namespace XdCxRhDW.App.WebAPI
                 }
                 Serilog.Log.Information($"卫星{dto.MainCode}使用{xlInfo1.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                url += string.Format("Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
-
-                //string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
-                //var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
-                //var dmcResult = HttpHelper.PostRequest<IEnumerable<DetectResDto>>(uploadUri, content);
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -303,27 +292,16 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.MainCode}使用{xlInfo1.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.AdjaCode}使用{xlInfo2.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.AdjaCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.AdjaCode}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
+
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };               
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -414,8 +392,8 @@ namespace XdCxRhDW.App.WebAPI
                     DfoCdb = dto.XdDfo,
                     SnrCdb = dto.XdSnr,
                     StationResID = StationRes.ID,
-                    MainCode= dto.MainCode,
-                    Adja1Code= dto.AdjaCode,
+                    MainCode = dto.MainCode,
+                    Adja1Code = dto.AdjaCode,
                     MainX = dto.MainX,
                     MainY = dto.MainY,
                     MainZ = dto.MainZ,
@@ -481,27 +459,16 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.MainCode}使用{xlInfo1.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.AdjaCode}使用{xlInfo2.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.AdjaCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.AdjaCode}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
+
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -521,8 +488,8 @@ namespace XdCxRhDW.App.WebAPI
                     DfoCdb = dto.XdDfo,
                     SnrCdb = dto.XdSnr,
                     StationResID = StationRes.ID,
-                    MainCode=dto.MainCode,
-                    Adja1Code=dto.AdjaCode,
+                    MainCode = dto.MainCode,
+                    Adja1Code = dto.AdjaCode,
                     MainX = ephMain.X,
                     MainY = ephMain.Y,
                     MainZ = ephMain.Z,
@@ -670,27 +637,16 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.MainCode}使用{xlInfo1.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.AdjaCode}使用{xlInfo2.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.AdjaCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.AdjaCode}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
+
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -795,9 +751,9 @@ namespace XdCxRhDW.App.WebAPI
                     YbAdja1Dto = dto.YbAdja1Dto,
                     YbAdja2Dto = dto.YbAdja2Dto,
                     StationResID = StationRes.ID,
-                    MainCode=dto.MainCode,
-                    Adja1Code=dto.Adja1Code,
-                    Adja2Code=dto.Adja2Code,
+                    MainCode = dto.MainCode,
+                    Adja1Code = dto.Adja1Code,
+                    Adja2Code = dto.Adja2Code,
                     MainX = dto.MainX,
                     MainY = dto.MainY,
                     MainZ = dto.MainZ,
@@ -874,38 +830,20 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.Adja1Code}使用{xlInfo2.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.Adja2Code}使用{xlInfo3.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
 
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja1Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja1Code}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
 
-                var url3 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo3.TwoLine, dto.SigTime);
-                var response3 = await client.GetAsync(url3);
-                if (!response3.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja2Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja2Code}]星厉推算失败");
-                }
-                var content3 = await response2.Content.ReadAsStringAsync();
-                var ephAdja2 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content3).data;
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+
+                var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
+                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1076,38 +1014,20 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.Adja1Code}使用{xlInfo2.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.Adja2Code}使用{xlInfo3.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
 
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja1Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja1Code}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
 
-                var url3 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo3.TwoLine, dto.SigTime);
-                var response3 = await client.GetAsync(url3);
-                if (!response3.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja2Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja2Code}]星厉推算失败");
-                }
-                var content3 = await response2.Content.ReadAsStringAsync();
-                var ephAdja2 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content3).data;
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+
+                var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
+                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1293,38 +1213,21 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.Adja1Code}使用{xlInfo2.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.Adja2Code}使用{xlInfo3.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
 
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja1Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja1Code}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+
+                var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
+                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
 
-                var url3 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo3.TwoLine, dto.SigTime);
-                var response3 = await client.GetAsync(url3);
-                if (!response3.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.Adja2Code}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.Adja2Code}]星厉推算失败");
-                }
-                var content3 = await response2.Content.ReadAsStringAsync();
-                var ephAdja2 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content3).data;
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1510,28 +1413,16 @@ namespace XdCxRhDW.App.WebAPI
                 Serilog.Log.Information($"卫星{dto.MainCode}使用{xlInfo1.TwoLine}进行星历推算");
                 Serilog.Log.Information($"卫星{dto.AdjaCode}使用{xlInfo2.TwoLine}进行星历推算");
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
-                var client = new HttpClient();
 
-                string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
-                var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
-                var response = await client.GetAsync(url1);
-                if (!response.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.MainCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.MainCode}]星厉推算失败");
-                }
-                var content = await response.Content.ReadAsStringAsync();
-                var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
+                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
-                var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
-                var response2 = await client.GetAsync(url2);
-                if (!response2.IsSuccessStatusCode) // 处理响应失败
-                {
-                    Serilog.Log.Error($"[{dto.AdjaCode}]星厉推算失败");
-                    return Error<PosResDto>($"[{dto.AdjaCode}]星厉推算失败");
-                }
-                var content2 = await response2.Content.ReadAsStringAsync();
-                var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
+                var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
+                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+
+                var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
+                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1564,12 +1455,12 @@ namespace XdCxRhDW.App.WebAPI
                     MainVx = ephMain.VX,
                     MainVy = ephMain.VY,
                     MainVz = ephMain.VZ,
-                    Adja1X = ephAdja1.X,
-                    Adja1Y = ephAdja1.Y,
-                    Adja1Z = ephAdja1.Z,
-                    Adja1Vx = ephAdja1.VX,
-                    Adja1Vy = ephAdja1.VY,
-                    Adja1Vz = ephAdja1.VZ,
+                    Adja1X = ephAdja.X,
+                    Adja1Y = ephAdja.Y,
+                    Adja1Z = ephAdja.Z,
+                    Adja1Vx = ephAdja.VX,
+                    Adja1Vy = ephAdja.VY,
+                    Adja1Vz = ephAdja.VZ,
                 });
 
                 var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);

+ 6 - 6
XdCxRhDW.WebApi/Controllers/XlController.cs

@@ -25,10 +25,10 @@ namespace XdCxRhDW.WebApi.Controllers
         /// <param name="tleStr">双行根</param>
         /// <param name="dt">推算时刻(北京时刻)</param>
         /// <returns></returns>
-        [HttpGet]
-        public async Task<AjaxResult<SatEphDto>> Calc(string tleStr, DateTime dt)
+        [HttpPost]
+        public async Task<AjaxResult<SatEphDto>> Calc(XlCalcDto dto)
         {
-            var p = EphHelper.Calc(tleStr, dt);
+            var p = EphHelper.Calc(dto.tleStr, dto.dt);
             return Success(new SatEphDto()
             {
                 SatId = p.SatId,
@@ -51,10 +51,10 @@ namespace XdCxRhDW.WebApi.Controllers
         /// <param name="end">结束时刻(北京时刻)</param>
         /// <param name="spanSeconds">推算间隔(秒)</param>
         /// <returns></returns>
-        [HttpGet]
-        public async Task<AjaxResult<List<EphResDto>>> CalcMult(string tleStr, DateTime start, DateTime end, int spanSeconds)
+        [HttpPost]
+        public async Task<AjaxResult<List<EphResDto>>> CalcMult(XlCalcMultDto dto)
         {
-            var eph = EphHelper.CalcMult(tleStr, start, end, spanSeconds);
+            var eph = EphHelper.CalcMult(dto.tleStr, dto.start, dto.end, dto.spanSeconds);
             return Success(eph.Select(p => new EphResDto()
             {
                 SatId = p.SatId,

+ 2 - 0
XdCxRhDw.Dto/XdCxRhDw.Dto.csproj

@@ -81,6 +81,8 @@
     <Compile Include="PosDto\X2D1PosDto.cs" />
     <Compile Include="PosDto\X1D1PosDto.cs" />
     <Compile Include="PosDto\X2D1NoXlPosDto.cs" />
+    <Compile Include="XlCalcDto\XlCalcMultDto.cs" />
+    <Compile Include="XlCalcDto\XlCalcDto.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 21 - 0
XdCxRhDw.Dto/XlCalcDto/XlCalcDto.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto
+{
+    public class XlCalcDto
+    {
+        /// <summary>
+        /// 星厉字符串
+        /// </summary>
+        public string tleStr { get; set; }
+
+        /// <summary>
+        /// 信号时刻(北京时间)
+        /// </summary>
+        public DateTime dt { get; set; }
+    }
+}

+ 31 - 0
XdCxRhDw.Dto/XlCalcDto/XlCalcMultDto.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto
+{
+    public class XlCalcMultDto
+    {
+        /// <summary>
+        /// 星厉字符串
+        /// </summary>
+        public string tleStr { get; set; }
+
+        /// <summary>
+        /// 开始时刻(北京时间)
+        /// </summary>
+        public DateTime start { get; set; }
+
+        /// <summary>
+        /// 结束时刻(北京时间)
+        /// </summary>
+        public DateTime end { get; set; }
+
+        /// <summary>
+        /// 推算间隔(秒)
+        /// </summary>
+        public int spanSeconds { get; set; }
+    }
+}