zoulei 1 year ago
parent
commit
f5e3171a7c

BIN
XdCxRhDW.Api/AddIns/定位/DLL_GZDW.dll


+ 38 - 0
XdCxRhDW.Api/AddIns/定位/DLL_GZDW示例和说明.cpp

@@ -0,0 +1,38 @@
+
+void testThreeStar_DW()
+{
+	double ref_llh[3] = { 112.9043, 9.55549, 0 };
+
+	double main_sat[3] = { -41627130.333,  6291290.744, -2672292.823 };
+	double neigh_sat1[3] = { -24196959 , 34540119, -37186 };
+	//double neigh_sat2[3] = { 4738483,  41885781,  17606 };
+	double neigh_sat2[3] = { 109.4082,	18.3878,	0 };//如果是2星1地,这里输入CDB站址坐标(经纬高)
+
+
+	double Ref_Station_LLH[3] = { 112.9043, 9.55549,	0 };//ckz坐标
+
+
+
+	//double target_dto1 = -0.015951469492725;
+	//double target_dto2 = -0.003776303087869;
+
+	//double ref_dto1 = -0.010094828958135;
+	//double ref_dto2 = -0.003418405196386;
+
+	double target_dto1 = -0.012351141858723;
+	double target_dto2 = -0.250032322626937;
+
+	double ref_dto1 = -0.018988008565341;
+	double ref_dto2 = -0.264358558464538;//**如果是2星1的,这里输入的是样本主x参估结果
+
+	double target_llh[3];
+	vec_copy(Ref_Station_LLH, target_llh, 3);
+	bool flag = 1;//8***如果是3x定位,这个为0;如果是2x1d,为1.
+
+	DW_Analysis(main_sat, neigh_sat1, neigh_sat2, Ref_Station_LLH, target_dto1, target_dto2, ref_dto1, ref_dto2, target_llh, flag);
+
+	for (int idx = 0; idx < 3; ++idx)
+	{
+		std::cout << target_llh[idx] << std::endl;
+	}
+}

+ 55 - 21
XdCxRhDW.Api/AddIns/定位/PosApi.cs

@@ -22,12 +22,20 @@ namespace XdCxRhDW.Api
 
         #region cpp dll Interop 
 
+        //两星一地和三星解析定位算法(精度差、速度快,适用于置信度等统计时的多次调用)
+        private const string gzPos = @"AddIns\定位\DLL_GZDW.dll";
+
         //一星一地测向带参定位
         private const string XDCX = @"AddIns\定位\DLL_DTO_DOA_DW.dll";
 
         //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线、一星两地
         private const string OtherPos = @"AddIns\定位\Position-New.dll";//DLL_11J_DW
 
+
+        [DllImport(gzPos, EntryPoint = "DW_Analysis", CallingConvention = CallingConvention.Cdecl)]//两星一地和三星的解析定位算法(精度差、速度快)
+        private extern static void DW_Analysis(double[] mainSatXYZ, double[] adja1XYZ, double[] adja2XYZ, double[] refStation, double tarDto1, double tarDto2, double refDto1, double refDto2, double[] posRes, int flag);
+
+
         [DllImport(XDCX, EntryPoint = "XD_CX_DW", CallingConvention = CallingConvention.Cdecl)]//一星一地测向带参
         private extern static void X1D1_Pos20240305_Core(double[] mainSat, double[] satStation, double[] cdbStation, double[] cxStation, double[] refStation, double[] zone, double theta, double tarDto, double refDto, double[] res);
 
@@ -59,6 +67,9 @@ namespace XdCxRhDW.Api
 
         #endregion
 
+
+
+
         /// <summary>
         /// 一星一地带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
@@ -112,6 +123,33 @@ namespace XdCxRhDW.Api
             return posRes;
         }
 
+
+        /// <summary>
+        /// 两星一地解析定位(精度差速度快,主要用于置信度分析等需要多次调用的情况)
+        /// </summary>
+        /// <param name="cgRes"></param>
+        /// <param name="sRes"></param>
+        /// <returns></returns>
+        public static double[] X2D1_GzPos(CgRes cgRes, StationRes sRes)
+        {
+            if (cgRes.Dto1.Value == 0 || cgRes.DtoCdb.Value == 0)
+            {
+                return new double[7] { 999, 999, 0, 999, 999, 0, 100 };
+            }
+            double[] mainSat = new double[3] { cgRes.MainX.Value, cgRes.MainY.Value, cgRes.MainZ.Value };
+            double[] adjaSat = new double[3] { cgRes.Adja1X.Value, cgRes.Adja1Y.Value, cgRes.Adja1Z.Value };
+            double[] cdbStation = new double[3] { sRes.CdbTxLon.Value, sRes.CdbTxLat.Value, 0 };
+            double[] refStation = new double[3] { sRes.RefLon.Value, sRes.RefLat.Value, 0 };
+            double dto1 = cgRes.Dto1.Value / 1e6;
+            double dtoCdb = cgRes.DtoCdb.Value / 1e6;
+            double ybDto1 = cgRes.YbMainDto.Value / 1e6;
+            double ybDto2 = cgRes.YbAdja1Dto.Value / 1e6;
+            double ybDto = ybDto1 - ybDto2;
+            double[] posRes = new double[3];
+            DW_Analysis(mainSat, adjaSat, cdbStation, refStation, dto1, -dtoCdb, ybDto, -ybDto1, posRes, 1);
+            return posRes;
+        }
+
         /// <summary>
         /// 两星一地带参,返回经度、纬度、高度、镜像点、置信度,数组长度为7
         /// </summary>
@@ -138,34 +176,30 @@ namespace XdCxRhDW.Api
             double[] res = new double[6];
             X2D1_Pos20240305_Core(mainSat, adjaSat, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, dto1, dtoCdb, ybDto1, ybDto2, res);
             ConvertToGeoPoint(res);
-            var posRes = ConvertToGeoPoint(res);
-            if (CalcConfidence && IsGeoPoint2(posRes))
+            var posRes = ConvertToGeoPoint(res);//精确搜索值
+
+            var posResGz = X2D1_GzPos(cgRes, sRes);
+            if (IsGeoPoint2(posRes) && IsGeoPoint2(posResGz))
             {
                 int succeedCount = 0;
+                var cgResNew = cgRes.Clone();
                 for (int i = 0; i < confidenceCount; i++)
                 {
-                    var mainSatNew = new double[3]
-                    {
-                        cgRes.MainX.Value+RandomHelper.Normal(0,200),
-                        cgRes.MainY.Value+RandomHelper.Normal(0,200),
-                        cgRes.MainZ.Value+RandomHelper.Normal(0,200)
-
-                    };
-                    var adjaSatNew = new double[3]
-                    {
-                        cgRes.Adja1X.Value+RandomHelper.Normal(0,200),
-                        cgRes.Adja1Y.Value+RandomHelper.Normal(0,200),
-                        cgRes.Adja1Z.Value+RandomHelper.Normal(0,200)
-                    };
-                    var dto1New = (dto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
-                    var dtoCdbNew = (dtoCdb * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
-                    var ybDto1New = (ybDto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
-                    var ybDto2New = (ybDto2 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
-                    X2D1_Pos20240305_Core(mainSatNew, adjaSatNew, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, dto1New, dtoCdbNew, ybDto1New, ybDto2New, res);
+                    cgResNew.MainX = cgRes.MainX + RandomHelper.Normal(0, 200);
+                    cgResNew.MainY = cgRes.MainY + RandomHelper.Normal(0, 200);
+                    cgResNew.MainZ = cgRes.MainZ + RandomHelper.Normal(0, 200);
+                    cgResNew.Adja1X = cgRes.Adja1X + RandomHelper.Normal(0, 200);
+                    cgResNew.Adja1Y = cgRes.Adja1Y + RandomHelper.Normal(0, 200);
+                    cgResNew.Adja1Z = cgRes.Adja1Z + RandomHelper.Normal(0, 200);
+                    cgResNew.Dto1 = (cgRes.Dto1 * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    cgResNew.DtoCdb = (cgRes.DtoCdb * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    cgResNew.YbMainDto = (cgRes.YbMainDto * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    cgResNew.YbAdja1Dto = (cgRes.YbAdja1Dto * 1e6 + RandomHelper.Normal(0, 1)) / 1e6;
+                    res = X2D1_GzPos(cgResNew, sRes);
                     var posResNew = ConvertToGeoPoint(res);
                     if (IsGeoPoint2(posResNew))
                     {
-                        var distance = PhysicsHelper.DistanceGeo((posRes[0], posRes[1], 0), (posResNew[0], posResNew[1], 0));
+                        var distance = PhysicsHelper.DistanceGeo((posResGz[0], posResGz[1], 0), (posResNew[0], posResNew[1], 0));
                         if (distance <= confidenceDistance)
                         {
                             succeedCount++;

+ 4 - 0
XdCxRhDW.Api/XdCxRhDW.Api.csproj

@@ -162,6 +162,10 @@
     <None Include="AddIns\GDOP误差椭圆\DLL_GDOP_Analysis0415.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="AddIns\定位\DLL_GZDW.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="AddIns\定位\DLL_GZDW示例和说明.cpp" />
     <Content Include="AddIns\频差线\Positioning.h" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

+ 18 - 26
XdCxRhDW.App/Controllers/PosController.cs

@@ -166,8 +166,7 @@ namespace XdCxRhDW.App.Controllers
             }
             Serilog.Log.Information($"卫星{dto.MainCode}使用发布时刻为{xl1.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
@@ -410,16 +409,15 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.AdjaCode}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.AdjaCode}使用发布时刻为{xl2.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");
@@ -657,16 +655,15 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.AdjaCode}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.AdjaCode}使用发布时刻为{xl2.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");
@@ -910,16 +907,15 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.AdjaCode}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.AdjaCode}使用发布时刻为{xl2.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");
@@ -1184,23 +1180,22 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.Adja2Code}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.Adja2Code}使用发布时刻为{xl3.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja1.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja1Code}的ECEF星历出错.{ephAdja1.msg}");
                 return Error<PosResDto>($"推算卫星{dto.Adja1Code}的ECEF星历出错");
             }
             var XlCalcDto3 = new XlCalcDto() { tleStr = xl3.TwoLine, SigTime = dto.SigTime };
-            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto3);
+            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto3);
             if (ephAdja2.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
@@ -1457,23 +1452,22 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.Adja2Code}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.Adja2Code}使用发布时刻为{xl3.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja1.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja1Code}的ECEF星历出错.{ephAdja1.msg}");
                 return Error<PosResDto>($"推算卫星{dto.Adja1Code}的ECEF星历出错");
             }
             var XlCalcDto3 = new XlCalcDto() { tleStr = xl3.TwoLine, SigTime = dto.SigTime };
-            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto3);
+            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto3);
             if (ephAdja2.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
@@ -1735,23 +1729,22 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.Adja2Code}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.Adja2Code}使用发布时刻为{xl3.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja1 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja1.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja1Code}的ECEF星历出错.{ephAdja1.msg}");
                 return Error<PosResDto>($"推算卫星{dto.Adja1Code}的ECEF星历出错");
             }
             var XlCalcDto3 = new XlCalcDto() { tleStr = xl3.TwoLine, SigTime = dto.SigTime };
-            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto3);
+            var ephAdja2 = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto3);
             if (ephAdja2.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
@@ -2006,16 +1999,15 @@ namespace XdCxRhDW.App.Controllers
                 return Error<PosResDto>($"系统缺少编号{dto.AdjaCode}卫星的星历!");
             }
             Serilog.Log.Information($"卫星{dto.AdjaCode}使用发布时刻为{xl2.TimeUTC:yyyyMMddHHmmss}的星历进行推算");
-            string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
             var XlCalcDto = new XlCalcDto() { tleStr = xl1.TwoLine, SigTime = dto.SigTime };
-            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+            var ephMain = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
             if (ephMain.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
             var XlCalcDto2 = new XlCalcDto() { tleStr = xl2.TwoLine, SigTime = dto.SigTime };
-            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto2);
+            var ephAdja = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto2);
             if (ephAdja.code != 200)
             {
                 Serilog.Log.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");

+ 13 - 18
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -21,7 +21,6 @@ namespace XdCxRhDW.App.CorTools
     public partial class DetectToolForm : DevExpress.XtraEditors.XtraForm
     {
         static readonly string inifile = Path.Combine(Application.StartupPath, "par.ini");
-        private string baseUrl;
         List<CafResultDto> gridSource = new List<CafResultDto>();
 
         public DetectToolForm()
@@ -53,7 +52,7 @@ namespace XdCxRhDW.App.CorTools
                     string file1 = null, file2 = null;
                     try
                     {
-                        file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                        file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
                     }
                     catch (Exception ex)
                     {
@@ -64,7 +63,7 @@ namespace XdCxRhDW.App.CorTools
                     }
                     try
                     {
-                        file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
+                        file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, SysConfig.GetBaseUrl());
                     }
                     catch (Exception ex)
                     {
@@ -102,7 +101,7 @@ namespace XdCxRhDW.App.CorTools
                     }
                     try
                     {
-                        var result = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", dto, dto.TimeoutSeconds);
+                        var result = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(SysConfig.GetUrl("DetectCg/CpuCgMultiCalc"), dto, dto.TimeoutSeconds);
                         if (result.code == 200)
                         {
                             for (int i = 0; i < result.data.Count; i++)
@@ -147,7 +146,7 @@ namespace XdCxRhDW.App.CorTools
                             t.snr = null;
                         });
                         gridView1.RefreshData();
-                        var file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                        var file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
                         var smps = data.Select(p => new SmpPosition()
                         {
                             smpStart = p.smpstart,
@@ -159,7 +158,7 @@ namespace XdCxRhDW.App.CorTools
                             Fs = (long)(Convert.ToDouble(tefs.Text) * 1e6),
                             Smps = smps,
                         };
-                        var result = await HttpHelper.PostRequestAsync<List<SignalProcResDto>>(baseUrl + "DetectCg/SignalProc", dto);
+                        var result = await HttpHelper.PostRequestAsync<List<SignalProcResDto>>(SysConfig.GetUrl("DetectCg/SignalProc"), dto);
                         if (result.code == 200)
                         {
                             var resData = result.data;
@@ -195,10 +194,6 @@ namespace XdCxRhDW.App.CorTools
             this.btnFile2.UseChooseFile().UseDoubleClickToSelectAll();
             btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
             ReadIni();
-            if (SysConfig.Config != null)
-            {
-                this.baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-            }
         }
 
         private async void btnCheck_Click(object sender, EventArgs e)
@@ -240,7 +235,7 @@ namespace XdCxRhDW.App.CorTools
             {
                 try
                 {
-                    dto.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                    dto.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
                 }
                 catch (Exception ex)
                 {
@@ -251,7 +246,7 @@ namespace XdCxRhDW.App.CorTools
                 dto.fsHz = double.Parse(tefs.Text) * 1e6;
                 dto.band = double.Parse(txtBand.Text);
                 dto.TimeoutSeconds = int.Parse(txtTimeout.Text);
-                var dmcResult = await HttpHelper.PostRequestAsync<IEnumerable<DetectResDto>>(baseUrl + "DetectCg/DetectCalc", dto, dto.TimeoutSeconds);
+                var dmcResult = await HttpHelper.PostRequestAsync<IEnumerable<DetectResDto>>(SysConfig.GetUrl("DetectCg/DetectCalc"), dto, dto.TimeoutSeconds);
                 if (dmcResult.code == 200)
                 {
                     foreach (var dmcItem in dmcResult.data)
@@ -305,8 +300,8 @@ namespace XdCxRhDW.App.CorTools
             layoutControl1.Enabled = false;
             try
             {
-                xItem.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
-                xItem.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
+                xItem.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
+                xItem.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, SysConfig.GetBaseUrl());
             }
             catch (Exception ex)
             {
@@ -339,7 +334,7 @@ namespace XdCxRhDW.App.CorTools
 
             try
             {
-                var result = await HttpHelper.PostRequestAsync<CpuCgResDto>(baseUrl + "DetectCg/CpuCgCalc", xItem, xItem.TimeoutSeconds);
+                var result = await HttpHelper.PostRequestAsync<CpuCgResDto>(SysConfig.GetUrl("DetectCg/CpuCgCalc"), xItem, xItem.TimeoutSeconds);
                 if (result.code == 200)
                 {
                     DateTime? sigTime = null;
@@ -398,10 +393,10 @@ namespace XdCxRhDW.App.CorTools
                     snrThreshold = int.Parse(teSnr.Text),
                     TimeoutSeconds = int.Parse(txtTimeout.Text)
                 };
-                par.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
-                par.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
+                par.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
+                par.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, SysConfig.GetBaseUrl());
 
-                var resp = await HttpHelper.PostRequestAsync<List<ImageResultDto>>(baseUrl + "DetectCg/DrawImage", par, par.TimeoutSeconds);
+                var resp = await HttpHelper.PostRequestAsync<List<ImageResultDto>>(SysConfig.GetUrl("DetectCg/DrawImage"), par, par.TimeoutSeconds);
                 if (resp.code != 200)
                 {
                     Serilog.Log.Error(resp.msg);

+ 4 - 9
XdCxRhDW.App/CorTools/GpuCalcForm.cs

@@ -27,7 +27,6 @@ namespace XdCxRhDW.App.CorTools
     public partial class GpuCalcForm : DevExpress.XtraEditors.XtraForm
     {
         static readonly string inifile = Path.Combine(Application.StartupPath, "parGpu.ini");
-        private string baseUrl;
         List<GpuCafResult> gridSource = new List<GpuCafResult>();
 
         public GpuCalcForm()
@@ -49,10 +48,6 @@ namespace XdCxRhDW.App.CorTools
             }).UseDoubleClickToSelectAll();
             this.btnFile2.UseChooseFile().UseDoubleClickToSelectAll();
             ReadIni();
-            if (SysConfig.Config != null)
-            {
-                this.baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-            }
         }
 
         private async void btnCalc_Click(object sender, EventArgs e)
@@ -60,11 +55,11 @@ namespace XdCxRhDW.App.CorTools
             if (!ValidateFiles(btnFile1.Text, btnFile2.Text)) return;
             if (!ValidateParams()) return;
             layoutControl1.Enabled = false;
-            string file1,file2;
+            string file1, file2;
             try
             {
-                file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
-                file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
+                file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, SysConfig.GetBaseUrl());
+                file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, SysConfig.GetBaseUrl());
             }
             catch (Exception ex)
             {
@@ -98,7 +93,7 @@ namespace XdCxRhDW.App.CorTools
 
             try
             {
-                var result = await HttpHelper.PostRequestAsync<List<GpuCgResponseDto>>(baseUrl + "DetectCg/GpuCgCalc", dto, dto.TimeoutSeconds);
+                var result = await HttpHelper.PostRequestAsync<List<GpuCgResponseDto>>(SysConfig.GetUrl("DetectCg/GpuCgCalc"), dto, dto.TimeoutSeconds);
                 if (result.code == 200)
                 {
                     foreach (var item in result.data)

+ 4 - 9
XdCxRhDW.App/CorTools/ResampleForm.cs

@@ -81,12 +81,7 @@ namespace XdCxRhDW.App.CorTools
             {
 
                 layoutControl1.Enabled = false;
-                string baseUrl = null;
-                if (SysConfig.Config != null)
-                {
-                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api";
-                }
-                if (baseUrl == null)
+                if (SysConfig.Config== null)
                 {
                     layoutControl1.Enabled = true;
                     DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置基础信息");
@@ -95,7 +90,7 @@ namespace XdCxRhDW.App.CorTools
                 string file = null;
                 try
                 {
-                    file = await HttpHelper.UploadFileAsync(txtFile.Text, baseUrl);
+                    file = await HttpHelper.UploadFileAsync(txtFile.Text, SysConfig.GetBaseUrl());
                 }
                 catch (Exception ex)
                 {
@@ -113,11 +108,11 @@ namespace XdCxRhDW.App.CorTools
                     OutFsHz = (int)outFsHz,
                     TimeoutSeconds = (int)timeout,
                 };
-                var response = await HttpHelper.PostRequestAsync<ResampleResponseDto>(baseUrl + "Api/DetectCg/Resample", dto, dto.TimeoutSeconds);
+                var response = await HttpHelper.PostRequestAsync<ResampleResponseDto>(SysConfig.GetUrl("DetectCg/Resample"), dto, dto.TimeoutSeconds);
                 if (response.code == 200)
                 {
                     string outFile = Path.Combine(txtOutDir.Text, Path.GetFileNameWithoutExtension(txtFile.Text) + $"_Resample{txtOutFs.Text}K.dat");
-                    if (await HttpHelper.DownloadFileAsync(baseUrl, response.data.File, outFile))
+                    if (await HttpHelper.DownloadFileAsync(SysConfig.GetBaseUrl(), response.data.File, outFile))
                         this.txtOutFile.Text = outFile;
                     else
                     {

+ 2 - 4
XdCxRhDW.App/CorTools/XlCalculateForm.cs

@@ -80,7 +80,6 @@ namespace XdCxRhDW.App.CorTools
             {
                 if (!string.IsNullOrEmpty(txtEndTime.Text) && !string.IsNullOrEmpty(txtSpanSeconds.Text))
                 {
-                    string url = string.Format("http://{0}:{1}/Api/Xl/CalcMult", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
                     var XlCalcMultDto = new XlCalcMultDto()
                     {
                         tleStr = txtTle.Text,
@@ -89,7 +88,7 @@ namespace XdCxRhDW.App.CorTools
                         spanSeconds = spanSeconds,
                         TimeoutSeconds = timeout
                     };
-                    var ephRes = await HttpHelper.PostRequestAsync<List<ModelSatEphRes>>(url, XlCalcMultDto, timeout);
+                    var ephRes = await HttpHelper.PostRequestAsync<List<ModelSatEphRes>>(SysConfig.GetUrl("Xl/CalcMult"), XlCalcMultDto, timeout);
                     if (ephRes.code == 200)
                     {
                         listEph.AddRange(ephRes.data);
@@ -102,14 +101,13 @@ namespace XdCxRhDW.App.CorTools
                 }
                 else
                 {
-                    string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
                     var XlCalcDto = new XlCalcDto()
                     {
                         tleStr = txtTle.Text,
                         SigTime = txtStartTime.DateTime,
                         TimeoutSeconds = timeout
                     };
-                    var ephRes = await HttpHelper.PostRequestAsync<ModelSatEphRes>(url, XlCalcDto, timeout);
+                    var ephRes = await HttpHelper.PostRequestAsync<ModelSatEphRes>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto, timeout);
                     if (ephRes.code == 200)
                     {
                         listEph.Add(ephRes.data);

+ 1 - 1
XdCxRhDW.App/EditForms/TaskEditor.Designer.cs

@@ -114,7 +114,7 @@
             this.btnFreq.Size = new System.Drawing.Size(96, 23);
             this.btnFreq.StyleController = this.layoutControl1;
             this.btnFreq.TabIndex = 14;
-            this.btnFreq.Text = "编辑频点";
+            this.btnFreq.Text = "选择信号";
             this.btnFreq.Click += new System.EventHandler(this.btnFreq_Click);
             // 
             // btnSave

+ 2 - 4
XdCxRhDW.App/EditForms/X2DTOParamEditor.cs

@@ -378,9 +378,7 @@ namespace XdCxRhDW.App.EditForms
                 }
 
                 var XlCalcDto = new XlCalcDto() { tleStr = mainxlInfo.TwoLine, SigTime = sigTime };
-
-                string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), SysConfig.Config.HttpPort);
-                var maineph = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+                var maineph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
                 ucEphXYZMain.SetParam("主星", cg.MainCode.Value, (maineph.data.X, maineph.data.Y, maineph.data.Z, maineph.data.VX, maineph.data.VY, maineph.data.VZ), Color.Red);
 
 
@@ -392,7 +390,7 @@ namespace XdCxRhDW.App.EditForms
                     return;
                 }
                 XlCalcDto.tleStr = adjaxlInfo.TwoLine;
-                var adjaeph = await HttpHelper.PostRequestAsync<SatEphResDto>(url, XlCalcDto);
+                var adjaeph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
                 ucEphXYZAdja.SetParam("邻星", cg.Adja1Code.Value, (adjaeph.data.X, adjaeph.data.Y, adjaeph.data.Z, adjaeph.data.VX, adjaeph.data.VY, adjaeph.data.VZ), Color.Red);
             }
             catch (Exception ex)

+ 2 - 4
XdCxRhDW.App/MainForm.cs

@@ -127,8 +127,6 @@ namespace XdCxRhDW
                 {
                     continue;
                 }
-                var baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-
                 DirectoryInfo dir = new DirectoryInfo(SysConfig.Config.XLDirectory);
                 var backUpDir = dir.Parent.FullName;
                 var files = Directory.EnumerateFiles(SysConfig.Config.XLDirectory, "*", SearchOption.AllDirectories);
@@ -136,9 +134,9 @@ namespace XdCxRhDW
                 {
                     try
                     {
-                        var fileName = await HttpHelper.UploadFileAsync(file, baseUrl);
+                        var fileName = await HttpHelper.UploadFileAsync(file, SysConfig.GetBaseUrl());
                         XlImportDto dto = new XlImportDto() { File = fileName };
-                        var res = await HttpHelper.PostRequestAsync<RecordRes>(baseUrl + "Xl/ImportTleAsync", dto);
+                        var res = await HttpHelper.PostRequestAsync<RecordRes>(SysConfig.GetUrl("Xl/ImportTleAsync"), dto);
                         if (res.code == 200)
                         {
                             Serilog.Log.Information($"星历文件[{file}]自动导入成功!");

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

@@ -739,12 +739,6 @@ namespace XdCxRhDW.App.UserControl
             gridView2.ClearSorting();
             gridView2.ClearFindFilter();
             gridView2.ClearColumnsFilter();
-            string baseUrl = null;
-
-            if (SysConfig.Config != null)
-            {
-                baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-            }
             try
             {
                 List<ModelPosRes> list = new List<ModelPosRes>();
@@ -759,7 +753,7 @@ namespace XdCxRhDW.App.UserControl
                         IncludeInvalidate = btnIncludeInvalidate.Checked
 
                     };
-                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByTimeRangeObsolete", dto, token: ct);
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(SysConfig.GetUrl("Pos/GetPosResByTimeRangeObsolete"), dto, token: ct);
                     if (res.code == 200)
                     {
                         if (res.msg.Length > 10)
@@ -786,7 +780,7 @@ namespace XdCxRhDW.App.UserControl
                     {
                         dto.TarFrequpHz = Convert.ToInt64(txtFrequpMHz.EditValue);
                     }
-                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByLastHoursObsolete", dto, token: ct);
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(SysConfig.GetUrl("Pos/GetPosResByLastHoursObsolete"), dto, token: ct);
                     if (res.code == 200)
                     {
                         if (res.msg.Length > 10)
@@ -1214,15 +1208,10 @@ namespace XdCxRhDW.App.UserControl
                 EndTime = frm.end,
                 TaskInfoID = tsk.ID
             };
-            string baseUrl = null;
-            if (SysConfig.Config != null)
-            {
-                baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-            }
             try
             {
                 var ct = new CancellationTokenSource();
-                var res = await HttpHelper.PostRequestAsync<List<RePosRes>>(baseUrl + "Pos/GetPosCgResByTimeRangeObsolete", dto, token: ct.Token);
+                var res = await HttpHelper.PostRequestAsync<List<RePosRes>>(SysConfig.GetUrl("Pos/GetPosCgResByTimeRangeObsolete"), dto, token: ct.Token);
                 if (res.code == 200)
                 {
                     RePosition(res.data, dto);

+ 2 - 13
XdCxRhDW.App/UserControl/CtrlXl.cs

@@ -51,17 +51,6 @@ namespace XdCxRhDW.App.UserControl
         private async void btnImp_Click(object sender, EventArgs e)
         {
             this.layoutControl1.Enabled = false;
-            string baseUrl = null;
-            if (SysConfig.Config != null)
-            {
-                baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api/";
-            }
-            if (baseUrl == null)
-            {
-                MsgBoxHelper.ShowError("请在系统设置中配置基础信息");
-                this.layoutControl1.Enabled = true;
-                return;
-            }
             if (string.IsNullOrEmpty(btnOpen.Text))
             {
                 Serilog.Log.Warning($"请选择星历文件");
@@ -72,7 +61,7 @@ namespace XdCxRhDW.App.UserControl
             string file;
             try
             {
-                file = await HttpHelper.UploadFileAsync(btnOpen.Text, baseUrl);
+                file = await HttpHelper.UploadFileAsync(btnOpen.Text, SysConfig.GetBaseUrl());
             }
             catch (Exception ex)
             {
@@ -84,7 +73,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 XlImportDto dto = new XlImportDto() { File = file };
-                var result = await HttpHelper.PostRequestAsync<RecordRes>(baseUrl + "Xl/ImportTleAsync", dto, 120);
+                var result = await HttpHelper.PostRequestAsync<RecordRes>(SysConfig.GetUrl("Xl/ImportTleAsync"), dto, 120);
                 if (result.code == 200)
                 {
                     DxHelper.MsgBoxHelper.ShowInfo($"星历导入成功.共导入{result.data.Count}条");

+ 4 - 2
XdCxRhDW.App/UserControl/X1D1GDOPParam.cs

@@ -10,6 +10,7 @@ using XdCxRhDW.Api;
 using System.Drawing;
 using DevExpress.XtraCharts.Design;
 using System.Runtime.ConstrainedExecution;
+using XdCxRhDW.Dto;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -144,9 +145,10 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowWarning($"卫星:{mainCode}未找到对应的星历信息,请导入星历");
                     return;
                 }
-                var maineph = EphHelper.Calc(mainxlInfo.TwoLine, sigTime.ToUtc());
+                var XlCalcDto = new XlCalcDto() { tleStr = mainxlInfo.TwoLine, SigTime = sigTime };
+                var maineph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
 
-                ucEphXYZMain.SetParam("主星", mainCode, (maineph.X, maineph.Y, maineph.Z, maineph.VX, maineph.VY, maineph.VZ), Color.Red);
+                ucEphXYZMain.SetParam("主星", mainCode, (maineph.data.X, maineph.data.Y, maineph.data.Z, maineph.data.VX, maineph.data.VY, maineph.data.VZ), Color.Red);
 
             }
             catch (Exception ex)

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

@@ -11,6 +11,7 @@ using XdCxRhDW.Api;
 using System.Drawing;
 using DevExpress.Utils.About;
 using DevExpress.XtraEditors.DXErrorProvider;
+using XdCxRhDW.Dto;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -84,7 +85,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 return false;
             }
-            if (PosResType == EnumPosResType.X2D1&&!txtRefLocation1.CheckLonLat(dxErrorProvider, "参考站"))
+            if (PosResType == EnumPosResType.X2D1 && !txtRefLocation1.CheckLonLat(dxErrorProvider, "参考站"))
             {
                 return false;
             }
@@ -147,9 +148,9 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowWarning($"卫星:{mainCode}未找到对应的星历信息,请导入星历");
                     return;
                 }
-                var maineph = EphHelper.Calc(mainxlInfo.TwoLine, sigTime.ToUtc());
-
-                ucEphXYZMain.SetParam("主星", mainCode, (maineph.X, maineph.Y, maineph.Z, maineph.VX, maineph.VY, maineph.VZ), Color.Red);
+                var XlCalcDto = new XlCalcDto() { tleStr = mainxlInfo.TwoLine, SigTime = sigTime.ToUtc() };
+                var maineph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
+                ucEphXYZMain.SetParam("主星", mainCode, (maineph.data.X, maineph.data.Y, maineph.data.Z, maineph.data.VX, maineph.data.VY, maineph.data.VZ), Color.Red);
 
 
 
@@ -159,17 +160,15 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowWarning($"卫星:{adjaCode}未找到对应的星历信息,请导入星历");
                     return;
                 }
-                var adjaeph = EphHelper.Calc(adjaxlInfo.TwoLine, sigTime.ToUtc());
-
-                ucEphXYZAdja.SetParam("邻星", adjaCode, (adjaeph.X, adjaeph.Y, adjaeph.Z, adjaeph.VX, adjaeph.VY, adjaeph.VZ), Color.Red);
+                XlCalcDto = new XlCalcDto() { tleStr = adjaxlInfo.TwoLine, SigTime = sigTime.ToUtc() };
+                var adjaeph = await HttpHelper.PostRequestAsync<SatEphResDto>(SysConfig.GetUrl("Xl/Calc"), XlCalcDto);
+                ucEphXYZAdja.SetParam("邻星", adjaCode, (adjaeph.data.X, adjaeph.data.Y, adjaeph.data.Z, adjaeph.data.VX, adjaeph.data.VY, adjaeph.data.VZ), Color.Red);
             }
             catch (Exception ex)
             {
                 Serilog.Log.Error(ex, $"手动推算{PosResType.GetEnumDisplayName()}星历失败,SigTime={sigTime}");
                 DxHelper.MsgBoxHelper.ShowError($"手动推算{PosResType.GetEnumDisplayName()}星历失败,{ex.Message}");
             }
-
-
         }
     }
     public class GDOP星地两星一地接口

+ 61 - 0
XdCxRhDW.Entity/CgRes.cs

@@ -313,5 +313,66 @@ namespace XdCxRhDW.Entity
         /// </summary>
         [Display(Name = "邻星2速度Vz(m/s)")]
         public double? Adja2Vz { get; set; }
+
+        public CgRes Clone()
+        {
+            return new CgRes()
+            {
+                Adja1Code = Adja1Code,
+                Adja1Vx = Adja1Vx,
+                Adja1Vy = Adja1Vy,
+                Adja1Vz = Adja1Vz,
+                Adja1X = Adja1X,
+                Adja1XlTime = Adja1XlTime,
+                Adja1Y = Adja1Y,
+                Adja1Z = Adja1Z,
+                Adja2Code = Adja2Code,
+                Adja2Vx = Adja2Vx,
+                Adja2Vy = Adja2Vy,
+                Adja2Vz = Adja2Vz,
+                Adja2X = Adja2X,
+                Adja2XlTime = Adja2XlTime,
+                Adja2Y = Adja2Y,
+                Adja2Z = Adja2Z,
+                CreateTime = CreateTime,
+                Dfo1 = Dfo1,
+                Dfo2 = Dfo2,
+                DfoCdb = DfoCdb,
+                Dto1 = Dto1,
+                Dto2 = Dto2,
+                DtoCdb = DtoCdb,
+                ID = ID,
+                MainCode = MainCode,
+                MainVx = MainVx,
+                MainVy = MainVy,
+                MainVz = MainVz,
+                MainX = MainX,
+                MainY = MainY,
+                MainXlTime = MainXlTime,
+                MainZ = MainZ,
+                RefFreqDown = RefFreqDown,
+                RefFreqUp = RefFreqUp,
+                SigTime = SigTime,
+                Snr1 = Snr1,
+                Snr2 = Snr2,
+                SnrCdb = SnrCdb,
+                StationRes = StationRes,
+                StationResID = StationResID,
+                TarFreqDown = TarFreqDown,
+                TarFreqUp = TarFreqUp,
+                TaskID = TaskID,
+                UpdateTime = UpdateTime,
+                YbAdja1Dfo = YbAdja1Dfo,
+                YbAdja1Dto = YbAdja1Dto,
+                YbAdja1Snr = YbAdja1Snr,
+                YbAdja2Dfo = YbAdja2Dfo,
+                YbAdja2Dto = YbAdja2Dto,
+                YbAdja2Snr = YbAdja2Snr,
+                YbMainDfo = YbMainDfo,
+                YbMainDto = YbMainDto,
+                YbMainSnr = YbMainSnr,
+            };
+        }
+
     }
 }

+ 8 - 1
XdCxRhDW.Repostory/SysConfig.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Data.Entity;
 using System.IO;
 using System.Linq;
+using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
 using XdCxRhDW.Entity;
@@ -17,7 +18,13 @@ namespace XdCxRhDW.Repostory
         {
             return time.AddHours(-Config.ZoneHours);
         }
-        public static string GetFullUrl(string url)
+
+        public static string GetBaseUrl()
+        {
+            if (Config == null) return null;
+            return $"http://{IpHelper.GetLocalIp()}:{Config.HttpPort}/api/";
+        }
+        public static string GetUrl(string url)
         {
             if (Config == null) return null;
             if (url.StartsWith("/"))

+ 26 - 54
XdCxRhDW.Sender/Form1.cs

@@ -493,34 +493,6 @@ namespace XdCxRhDW.Sender
             }
         }
 
-        /// <summary>
-        /// 两星一地定位
-        /// </summary>
-        /// <returns></returns>
-        private X2D1PosDto X2D1()
-        {
-            X2D1PosDto X2D1PosDto = new X2D1PosDto();
-            X2D1PosDto.SigTime = DateTime.Now;
-            X2D1PosDto.MainCode = 23467;
-            X2D1PosDto.AdjaCode = 39206;
-            X2D1PosDto.SxDto = 5507.5653;
-            X2D1PosDto.XdDto = 240292.558;
-            X2D1PosDto.MainYbDto = 0;
-            X2D1PosDto.AdjaYbDto = 0;
-            X2D1PosDto.MainX = 0;
-            X2D1PosDto.MainY = 0;
-            X2D1PosDto.MainZ = 0;
-            X2D1PosDto.AdjaX = 0;
-            X2D1PosDto.AdjaY = 0;
-            X2D1PosDto.AdjaZ = 0;
-            X2D1PosDto.SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon");
-            X2D1PosDto.SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat");
-            X2D1PosDto.CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon");
-            X2D1PosDto.CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat");
-            X2D1PosDto.RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon");
-            X2D1PosDto.RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat");
-            return X2D1PosDto;
-        }
 
         /// <summary>
         /// 两星一地定位无参
@@ -563,6 +535,32 @@ namespace XdCxRhDW.Sender
             return X2D1PosDto;
         }
 
+        /// <summary>
+        /// 两星一地定位无参无星历
+        /// </summary>
+        private X2D1NoXlNoParlPosDto X2D1NoParNoXL()
+        {
+            X2D1NoXlNoParlPosDto X2D1NoXlNoParlPosDto = new X2D1NoXlNoParlPosDto()
+            {
+                SigTime = DateTime.Now,
+                MainCode = 25630,
+                AdjaCode = 33276,
+                SxDto = -0.002198485309353 * 1e6,
+                XdDto = 0.245961726007262 * 1e6,
+                SatTxLon = 118.8833,
+                SatTxLat = 32.0667,
+                CdbTxLon = 109.4082,
+                CdbTxLat = 18.3878,
+                FreqDown = 252.325e6,//For Api Test
+                FreqUp = 310.85e6,//For Api Test
+                XdDfo = 1529,//For Api Test
+                XdSnr = 25,//For Api Test
+                SxDfo = 1024,//For Api Test
+                SxSnr = 25,//For Api Test
+            };
+            return X2D1NoXlNoParlPosDto;
+        }
+
         /// <summary>
         /// 三星双时差定位
         /// </summary>
@@ -741,32 +739,6 @@ namespace XdCxRhDW.Sender
         }
 
 
-        /// <summary>
-        /// 两星一地定位无参无星历
-        /// </summary>
-        private X2D1NoXlNoParlPosDto X2D1NoParNoXL()
-        {
-            X2D1NoXlNoParlPosDto X2D1NoXlNoParlPosDto = new X2D1NoXlNoParlPosDto()
-            {
-                SigTime = DateTime.Now,
-                MainCode = 25630,
-                AdjaCode = 33276,
-                SxDto = -0.002198485309353 * 1e6,
-                XdDto = 0.245961726007262 * 1e6,
-                SatTxLon = 118.8833,
-                SatTxLat = 32.0667,
-                CdbTxLon = 109.4082,
-                CdbTxLat = 18.3878,
-                FreqDown = 252.325e6,//For Api Test
-                FreqUp = 310.85e6,//For Api Test
-                XdDfo = 1529,//For Api Test
-                XdSnr = 25,//For Api Test
-                SxDfo = 1024,//For Api Test
-                SxSnr = 25,//For Api Test
-            };
-            return X2D1NoXlNoParlPosDto;
-        }
-
         /// <summary>
         /// 三星双时差定位无星历
         /// </summary>