gongqiuhong 1 år sedan
förälder
incheckning
a1e62f51f4

+ 9 - 9
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -90,10 +90,10 @@ namespace XdCxRhDW.App.CorTools
                     dto.file1 = HttpHelper.UploadFile(btnFile1.Text, baseUrl + "File/UploadFileAsync");
                     dto.fsHz = double.Parse(tefs.Text) * 1e6;
                     var dmcResult = HttpHelper.PostRequest<IEnumerable<DetectResDto>>(baseUrl + "DetectCg/DetectCalc", dto);
-                    if (dmcResult != null)
+                    if (dmcResult.code == 200)
                     {
                         gridSource.Clear();
-                        foreach (var dmcItem in dmcResult)
+                        foreach (var dmcItem in dmcResult.data)
                         {
                             gridSource.Add(new CafResult()
                             {
@@ -165,18 +165,18 @@ namespace XdCxRhDW.App.CorTools
                     try
                     {
                         var result = HttpHelper.PostRequest<CpuCgResDto>(baseUrl + "DetectCg/CpuCgCalc", xcitem);
-                        if (result != null)
+                        if (result.code==200)
                         {
                             gridSource.Add(new CafResult()
                             {
                                 file1 = btnFile1.Text,
                                 file2 = btnFile2.Text,
-                                smpstart = result.Smpstart,
-                                smplen = result.Smplen,
-                                dt = result.Dt,
-                                df = result.Df,
-                                snr = result.Snr,
-                                tm = result.TimeMs,
+                                smpstart = result.data.Smpstart,
+                                smplen = result.data.Smplen,
+                                dt = result.data.Dt,
+                                df = result.data.Df,
+                                snr = result.data.Snr,
+                                tm = result.data.TimeMs,
                             });
                             gridView1.FocusedRowHandle = gridSource.Count - 1;
                         }

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

@@ -99,16 +99,23 @@ namespace XdCxRhDW.App.CorTools
                         string url = string.Format("http://{0}:{1}/Api/Xl/CalcMult", IpHelper.GetLocalIp(), settings.HttpPort);
                         var XlCalcMultDto = new XlCalcMultDto() { tleStr = txtTle.Text, start = startTime, end = endTime, spanSeconds = (int)txtSpanSeconds.EditValue };
                         var ephRes = HttpHelper.PostRequest<List<SatEphDto>>(url, XlCalcMultDto);
-                        list.AddRange(ephRes);
-                        gridView.RefreshData();
+                        if (ephRes.code == 200)
+                        {
+                            list.AddRange(ephRes.data);
+                            gridView.RefreshData();
+                        }
                     }
                     else
                     {
                         string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
                         var XlCalcDto = new XlCalcDto() { tleStr = txtTle.Text, dt = Convert.ToDateTime(txtStartTime.EditValue) };
                         var ephRes = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
-                        list.Add(ephRes);
-                        gridView.RefreshData();
+                        if (ephRes.code == 200)
+                        {
+                            list.Add(ephRes.data);
+                            gridView.RefreshData();
+                        }
+                      
                     }
                 }
                 catch (Exception ex)

+ 2 - 10
XdCxRhDW.Core/HttpHelper.cs

@@ -8,7 +8,6 @@ using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
 using XdCxRhDw.Dto;
-using XdCxRhDW.Repostory.EFContext;
 
 namespace XdCxRhDW.Core
 {
@@ -21,7 +20,7 @@ namespace XdCxRhDW.Core
         /// <param name="url"></param>
         /// <param name="dto">dto对象</param>
         /// <returns></returns>
-        public static T PostRequest<T>(string url, object dto)
+        public static AjaxResult<T> PostRequest<T>(string url, object dto)
         {
             var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
             var handler = new HttpClientHandler() { UseCookies = false };
@@ -34,14 +33,7 @@ namespace XdCxRhDW.Core
             response.EnsureSuccessStatusCode();
             var result = response.Content.ReadAsStringAsync().Result;
             var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<T>>(result);
-            if (AjaxResult.code == 200)
-            {
-                return AjaxResult.data;
-            }
-            else
-            {
-                throw new Exception(AjaxResult.msg);
-            }
+            return AjaxResult;
         }
 
 

+ 107 - 37
XdCxRhDW.Sender/Form1.cs

@@ -14,6 +14,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using XdCxRhDw.Dto;
+using XdCxRhDW.Core;
 using XdCxRhDW.Dto;
 using XdCxRhDW.Sender.Properties;
 
@@ -64,7 +65,7 @@ namespace XdCxRhDW.Sender
                                     X1D1PosDto dto = new X1D1PosDto()
                                     {
                                         SigTime = DateTime.Now,
-                                        MainCode= 23467,
+                                        MainCode = 23467,
                                         XdDto = Convert.ToDouble(items[1]) * 1e6,
                                         MainYbDto = Convert.ToDouble(items[2]) * 1e6,
                                         CxRes = Convert.ToDouble(items[4]),
@@ -80,8 +81,14 @@ namespace XdCxRhDW.Sender
                                         RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
                                         RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
                                     };
-                                    var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    //var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
+                                    //var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, dto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                 }
                             }
@@ -105,6 +112,7 @@ namespace XdCxRhDW.Sender
                                     X2D1PosDto X2D1PosDto = new X2D1PosDto();
                                     X2D1PosDto.SigTime = DateTime.Now;
                                     X2D1PosDto.MainCode = 23467;
+                                    X2D1PosDto.AdjaCode = 39206;
                                     X2D1PosDto.SxDto = Convert.ToDouble(items[0]) * 1e6;
                                     X2D1PosDto.XdDto = Convert.ToDouble(items[1]) * 1e6;
                                     X2D1PosDto.MainYbDto = Convert.ToDouble(items[2]) * 1e6;
@@ -121,8 +129,14 @@ namespace XdCxRhDW.Sender
                                     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");
-                                    var content = new StringContent(JsonConvert.SerializeObject(X2D1PosDto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    //var content = new StringContent(JsonConvert.SerializeObject(X2D1PosDto), System.Text.Encoding.UTF8, "application/json");
+                                    //var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, X2D1PosDto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                 }
                             }
@@ -130,8 +144,12 @@ namespace XdCxRhDW.Sender
                             {
                                 url += "PosX2D1NoParAsync";
                                 var res = X2D1NoPar();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送两星一地无参定位仿真结果");
                             }
                             if (tskType == "RH")//融合定位
@@ -168,8 +186,12 @@ namespace XdCxRhDW.Sender
                                     RHPosDto.CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat");
                                     RHPosDto.RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon");
                                     RHPosDto.RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat");
-                                    var content = new StringContent(JsonConvert.SerializeObject(RHPosDto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, RHPosDto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                 }
                             }
@@ -177,32 +199,48 @@ namespace XdCxRhDW.Sender
                             {
                                 url += "PosX3TwoDtoAsync";
                                 var res = X3TwoDto();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
                             }
                             if (tskType == "X3TwoDtoNoPar")//三星双时差无参定位
                             {
                                 url += "PosX3TwoDtoNoParAsync";
                                 var res = X3TwoDtoNoPar();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
                             }
                             if (tskType == "X3TwoDfo")//三星双频差定位
                             {
                                 url += "PosX3TwoDfoAsync";
                                 var res = X3TwoDfo();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双频差定位仿真结果");
                             }
                             if (tskType == "X2Dfo")//双星时频差定位
                             {
                                 url += "PosX2DtoDfoAsync";
                                 var res = X2Dfo();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送双星时频差定位仿真结果");
                             }
 
@@ -237,8 +275,12 @@ namespace XdCxRhDW.Sender
                                         RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
                                         RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
                                     };
-                                    var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, dto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                 }
                             }
@@ -267,8 +309,12 @@ namespace XdCxRhDW.Sender
                                     X2D1NoXlPosDto.CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat");
                                     X2D1NoXlPosDto.RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon");
                                     X2D1NoXlPosDto.RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat");
-                                    var content = new StringContent(JsonConvert.SerializeObject(X2D1NoXlPosDto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, X2D1NoXlPosDto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                     Thread.Sleep(1000);
                                 }
@@ -277,8 +323,12 @@ namespace XdCxRhDW.Sender
                             {
                                 url += "PosX2D1NoXlNoParAsync";
                                 var res = X2D1NoParNoXL();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送两星一地无参定位仿真结果");
                             }
                             if (tskType == "RHNoXL")//融合定位无星厉
@@ -309,8 +359,12 @@ namespace XdCxRhDW.Sender
                                     RHNoXlPosDto.CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat");
                                     RHNoXlPosDto.RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon");
                                     RHNoXlPosDto.RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat");
-                                    var content = new StringContent(JsonConvert.SerializeObject(RHNoXlPosDto), System.Text.Encoding.UTF8, "application/json");
-                                    var response = await client.PostAsync(url, content);
+                                    var result = HttpHelper.PostRequest<PosResDto>(url, RHNoXlPosDto);
+                                    if (result.code != 200)
+                                    {
+                                        Log($"{result.msg}");
+                                        return;
+                                    }
                                     Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
                                 }
                             }
@@ -318,32 +372,48 @@ namespace XdCxRhDW.Sender
                             {
                                 url += "PosX3TwoDtoNoXlAsync";
                                 var res = X3TwoDtoNoXL();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
                             }
                             if (tskType == "X3TwoDtoNoParNoXL")//三星双时差无参定位无星厉
                             {
                                 url += "PosX3TwoDtoNoXlNoParAsync";
                                 var res = X3TwoDtoNoParNoXL();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
                             }
                             if (tskType == "X3TwoDfoNoXL")//三星双频差定位无星厉
                             {
                                 url += "PosX3TwoDfoNoXlAsync";
                                 var res = X3TwoDfoNoXL();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送三星双频差定位仿真结果");
                             }
                             if (tskType == "X2DfoNoXL")//双星时频差定位无星厉
                             {
                                 url += "PosX2DtoDfoNoXlAsync";
                                 var res = X2DfoNoXL();
-                                var content = new StringContent(JsonConvert.SerializeObject(res), System.Text.Encoding.UTF8, "application/json");
-                                var response = await client.PostAsync(url, content);
+                                var result = HttpHelper.PostRequest<PosResDto>(url, res);
+                                if (result.code != 200)
+                                {
+                                    Log($"{result.msg}");
+                                    return;
+                                }
                                 Log($"已向[{txtAddr1.Text}]发送双星时频差定位仿真结果");
                             }
 
@@ -404,9 +474,9 @@ namespace XdCxRhDW.Sender
         /// <summary>
         /// 两星一地定位无参
         /// </summary>
-        private X2D1PosDto X2D1NoPar()
+        private X2D1NoParPosDto X2D1NoPar()
         {
-            X2D1PosDto X2D1PosDto = new X2D1PosDto();
+            X2D1NoParPosDto X2D1PosDto = new X2D1NoParPosDto();
             X2D1PosDto.SigTime = DateTime.Now;
             X2D1PosDto.MainCode = 23467;
             X2D1PosDto.AdjaCode = 39206;
@@ -537,8 +607,8 @@ namespace XdCxRhDW.Sender
             X2DtoDfoPosDto.AdjaCode = 39206;
             X2DtoDfoPosDto.Dto = -3.587980198938979e-06 * 1e6;
             X2DtoDfoPosDto.Dfo = -17.601977254734404;
-            X2DtoDfoPosDto.YbMainDto = 0;
-            X2DtoDfoPosDto.YbAdjaDto = 6.352805492137770e-05 * 1e6;
+            X2DtoDfoPosDto.YbMainDto = 0.26 * 1e6;
+            X2DtoDfoPosDto.YbAdjaDto = 0.25993647195 * 1e6;
             X2DtoDfoPosDto.YbMainDfo = 0;
             X2DtoDfoPosDto.YbAdjaDfo = 17.453698229247941;
             X2DtoDfoPosDto.TarFreqUp = 3808 * 1e6 + 2225 * 1e6;

+ 3 - 0
XdCxRhDW.Sender/XdCxRhDW.Sender.csproj

@@ -83,6 +83,9 @@
     <Compile Include="..\XdCxRhDW.App\DxHelper\MsgBoxHelper.cs">
       <Link>MsgBoxHelper.cs</Link>
     </Compile>
+    <Compile Include="..\XdCxRhDW.Core\HttpHelper.cs">
+      <Link>HttpHelper.cs</Link>
+    </Compile>
     <Compile Include="ColorRGB.cs" />
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>

+ 159 - 70
XdCxRhDW.WebApi/Controllers/PosController.cs

@@ -132,6 +132,11 @@ namespace XdCxRhDW.App.WebAPI
                 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 ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -154,9 +159,9 @@ namespace XdCxRhDW.App.WebAPI
                     YbMainDto = dto.MainYbDto,
                     StationResID = StationRes.ID,
                     MainCode = dto.MainCode,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
                 });
 
                 var cxRes = db.CxRes.Add(new CxRes()
@@ -301,9 +306,19 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };               
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -329,12 +344,12 @@ namespace XdCxRhDW.App.WebAPI
                     StationResID = StationRes.ID,
                     MainCode = dto.MainCode,
                     Adja1Code = dto.AdjaCode,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    Adja1X = ephAdja.X,
-                    Adja1Y = ephAdja.Y,
-                    Adja1Z = ephAdja.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    Adja1X = ephAdja.data.X,
+                    Adja1Y = ephAdja.data.Y,
+                    Adja1Z = ephAdja.data.Z,
                 });
 
                 var res = PosApi.X2D1_Pos(cgRes, StationRes);
@@ -468,9 +483,19 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.AdjaCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.AdjaCode}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -492,12 +517,12 @@ namespace XdCxRhDW.App.WebAPI
                     StationResID = StationRes.ID,
                     MainCode = dto.MainCode,
                     Adja1Code = dto.AdjaCode,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    Adja1X = ephAdja.X,
-                    Adja1Y = ephAdja.Y,
-                    Adja1Z = ephAdja.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    Adja1X = ephAdja.data.X,
+                    Adja1Y = ephAdja.data.Y,
+                    Adja1Z = ephAdja.data.Z,
                 });
 
                 var res = PosApi.X2D1_PosNoRef(cgRes, StationRes);
@@ -646,9 +671,19 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.AdjaCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.AdjaCode}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -676,12 +711,12 @@ namespace XdCxRhDW.App.WebAPI
                     StationResID = StationRes.ID,
                     MainCode = dto.MainCode,
                     Adja1Code = dto.AdjaCode,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    Adja1X = ephAdja.X,
-                    Adja1Y = ephAdja.Y,
-                    Adja1Z = ephAdja.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    Adja1X = ephAdja.data.X,
+                    Adja1Y = ephAdja.data.Y,
+                    Adja1Z = ephAdja.data.Z,
                 });
 
                 var cxRes = db.CxRes.Add(new CxRes()
@@ -839,12 +874,27 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja1.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja1Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja1Code}]的星历出错");
+                }
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
                 var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
+                if (ephAdja2.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja2Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja2Code}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -870,15 +920,15 @@ namespace XdCxRhDW.App.WebAPI
                     MainCode = dto.MainCode,
                     Adja1Code = dto.Adja1Code,
                     Adja2Code = dto.Adja2Code,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    Adja1X = ephAdja1.X,
-                    Adja1Y = ephAdja1.Y,
-                    Adja1Z = ephAdja1.Z,
-                    Adja2X = ephAdja2.X,
-                    Adja2Y = ephAdja2.Y,
-                    Adja2Z = ephAdja2.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    Adja1X = ephAdja1.data.X,
+                    Adja1Y = ephAdja1.data.Y,
+                    Adja1Z = ephAdja1.data.Z,
+                    Adja2X = ephAdja2.data.X,
+                    Adja2Y = ephAdja2.data.Y,
+                    Adja2Z = ephAdja2.data.Z,
                 });
 
                 var res = PosApi.X3_Pos(cgRes, StationRes);
@@ -1022,12 +1072,27 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja1.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja1Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja1Code}]的星历出错");
+                }
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
                 var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
+                if (ephAdja2.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja2Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja2Code}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1048,15 +1113,15 @@ namespace XdCxRhDW.App.WebAPI
                     MainCode = dto.MainCode,
                     Adja1Code = dto.Adja1Code,
                     Adja2Code = dto.Adja2Code,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    Adja1X = ephAdja1.X,
-                    Adja1Y = ephAdja1.Y,
-                    Adja1Z = ephAdja1.Z,
-                    Adja2X = ephAdja2.X,
-                    Adja2Y = ephAdja2.Y,
-                    Adja2Z = ephAdja2.Z,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    Adja1X = ephAdja1.data.X,
+                    Adja1Y = ephAdja1.data.Y,
+                    Adja1Z = ephAdja1.data.Z,
+                    Adja2X = ephAdja2.data.X,
+                    Adja2Y = ephAdja2.data.Y,
+                    Adja2Z = ephAdja2.data.Z,
                 });
 
                 var res = PosApi.X3_PosNoRef(cgRes, StationRes);
@@ -1220,13 +1285,27 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja1.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja1Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja1Code}]的星历出错");
+                }
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
                 var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
-
+                if (ephAdja2.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.Adja2Code}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.Adja2Code}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1256,24 +1335,24 @@ namespace XdCxRhDW.App.WebAPI
                     MainCode = dto.MainCode,
                     Adja1Code = dto.Adja1Code,
                     Adja2Code = dto.Adja2Code,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    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,
-                    Adja2X = ephAdja2.X,
-                    Adja2Y = ephAdja2.Y,
-                    Adja2Z = ephAdja2.Z,
-                    Adja2Vx = ephAdja2.VX,
-                    Adja2Vy = ephAdja2.VY,
-                    Adja2Vz = ephAdja2.VZ,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    MainVx = ephMain.data.VX,
+                    MainVy = ephMain.data.VY,
+                    MainVz = ephMain.data.VZ,
+                    Adja1X = ephAdja1.data.X,
+                    Adja1Y = ephAdja1.data.Y,
+                    Adja1Z = ephAdja1.data.Z,
+                    Adja1Vx = ephAdja1.data.VX,
+                    Adja1Vy = ephAdja1.data.VY,
+                    Adja1Vz = ephAdja1.data.VZ,
+                    Adja2X = ephAdja2.data.X,
+                    Adja2Y = ephAdja2.data.Y,
+                    Adja2Z = ephAdja2.data.Z,
+                    Adja2Vx = ephAdja2.data.VX,
+                    Adja2Vy = ephAdja2.data.VY,
+                    Adja2Vz = ephAdja2.data.VZ,
                 });
 
                 var res = PosApi.X3_PosTwoDfo(cgRes, StationRes);
@@ -1419,9 +1498,19 @@ namespace XdCxRhDW.App.WebAPI
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
+                if (ephMain.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.MainCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.MainCode}]的星历出错");
+                }
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
                 var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
+                if (ephAdja.code != 200)
+                {
+                    Serilog.Log.Error($"推算[{dto.AdjaCode}]的星历出错");
+                    return Error<PosResDto>($"推算[{dto.AdjaCode}]的星历出错");
+                }
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1448,18 +1537,18 @@ namespace XdCxRhDW.App.WebAPI
                     StationResID = StationRes.ID,
                     MainCode = dto.MainCode,
                     Adja1Code = dto.AdjaCode,
-                    MainX = ephMain.X,
-                    MainY = ephMain.Y,
-                    MainZ = ephMain.Z,
-                    MainVx = ephMain.VX,
-                    MainVy = ephMain.VY,
-                    MainVz = ephMain.VZ,
-                    Adja1X = ephAdja.X,
-                    Adja1Y = ephAdja.Y,
-                    Adja1Z = ephAdja.Z,
-                    Adja1Vx = ephAdja.VX,
-                    Adja1Vy = ephAdja.VY,
-                    Adja1Vz = ephAdja.VZ,
+                    MainX = ephMain.data.X,
+                    MainY = ephMain.data.Y,
+                    MainZ = ephMain.data.Z,
+                    MainVx = ephMain.data.VX,
+                    MainVy = ephMain.data.VY,
+                    MainVz = ephMain.data.VZ,
+                    Adja1X = ephAdja.data.X,
+                    Adja1Y = ephAdja.data.Y,
+                    Adja1Z = ephAdja.data.Z,
+                    Adja1Vx = ephAdja.data.VX,
+                    Adja1Vy = ephAdja.data.VY,
+                    Adja1Vz = ephAdja.data.VZ,
                 });
 
                 var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);