zoulei 1 年之前
父节点
当前提交
b9276c0aef
共有 71 个文件被更改,包括 677 次插入450 次删除
  1. 二进制
      Database.db
  2. 1 2
      XdCxRhDW.App/Basic/PhysicsHelper.cs
  3. 23 4
      XdCxRhDW.App/CorTools/DetectToolForm.cs
  4. 91 48
      XdCxRhDW.App/CorTools/DetectToolForm.designer.cs
  5. 11 12
      XdCxRhDW.App/EditForms/X2D1PosParamEditor.cs
  6. 12 1
      XdCxRhDW.App/ExtensionsDev/ChooseFileExtension.cs
  7. 32 9
      XdCxRhDW.App/ExtensionsDev/GridControlEx.cs
  8. 1 0
      XdCxRhDW.App/MainForm.Designer.cs
  9. 102 65
      XdCxRhDW.App/MainForm.cs
  10. 2 0
      XdCxRhDW.App/PopupControl/ShowCgCtrl.cs
  11. 1 0
      XdCxRhDW.App/Program.cs
  12. 11 10
      XdCxRhDW.App/Properties/licenses.licx
  13. 0 69
      XdCxRhDW.App/TcpServer.cs
  14. 33 44
      XdCxRhDW.App/UserControl/CtrlHome.cs
  15. 27 82
      XdCxRhDW.App/UserControl/CtrlXl.cs
  16. 1 1
      XdCxRhDW.App/UserControl/X1D1GDOPParam.cs
  17. 2 2
      XdCxRhDW.App/UserControl/X2D1GDOPParam.cs
  18. 8 5
      XdCxRhDW.App/UserControl/X2DFGDOPParam.cs
  19. 8 5
      XdCxRhDW.App/UserControl/X3DFGDOPParam .cs
  20. 3 3
      XdCxRhDW.App/UserControl/X3GDOPParam.cs
  21. 4 2
      XdCxRhDW.App/XdCxRhDW.App.csproj
  22. 二进制
      XdCxRhDW.App/xcorr/ReSample.exe
  23. 1 0
      XdCxRhDW.App/xcorr/ReSample.txt
  24. 二进制
      XdCxRhDW.App/xcorr/XcorrCpu.exe
  25. 8 0
      XdCxRhDW.App/xcorr/XcorrCpu.txt
  26. 0 0
      XdCxRhDW.App/xcorr/enc.txt
  27. 73 0
      XdCxRhDW.Core/Api/变采样/ReSampleHelper.cs
  28. 21 7
      XdCxRhDW.Core/Api/检测Cpu参估/XcorrUtils.cs
  29. 17 2
      XdCxRhDW.Core/HttpHelper.cs
  30. 1 0
      XdCxRhDW.Core/XdCxRhDW.Core.csproj
  31. 9 15
      XdCxRhDW.Repostory/EFContext/RHDWContext.cs
  32. 5 1
      XdCxRhDW.Repostory/Model/XlInfo.cs
  33. 9 25
      XdCxRhDW.Repostory/XlCache.cs
  34. 2 0
      XdCxRhDW.WebApi/Controllers/DetectCgController.cs
  35. 1 0
      XdCxRhDW.WebApi/Controllers/FileController.cs
  36. 1 1
      XdCxRhDW.WebApi/Controllers/PosController.cs
  37. 76 2
      XdCxRhDW.WebApi/Controllers/XlController.cs
  38. 1 1
      XdCxRhDw.Dto/CpuCgDto.cs
  39. 1 1
      XdCxRhDw.Dto/CpuCgResDto.cs
  40. 1 1
      XdCxRhDw.Dto/DetectDto.cs
  41. 1 1
      XdCxRhDw.Dto/DetectResDto.cs
  42. 1 1
      XdCxRhDw.Dto/EphResDto.cs
  43. 1 1
      XdCxRhDw.Dto/FileDownloadDto.cs
  44. 1 1
      XdCxRhDw.Dto/FileUploadResDto.cs
  45. 1 1
      XdCxRhDw.Dto/PosDto/RHNoParPosDto.cs
  46. 1 1
      XdCxRhDw.Dto/PosDto/RHNoXlNoParPosDto.cs
  47. 1 1
      XdCxRhDw.Dto/PosDto/RHNoXlPosDto.cs
  48. 1 1
      XdCxRhDw.Dto/PosDto/RHPosDto.cs
  49. 1 1
      XdCxRhDw.Dto/PosDto/StationResDto.cs
  50. 1 1
      XdCxRhDw.Dto/PosDto/X1D1NoParPosDto.cs
  51. 1 1
      XdCxRhDw.Dto/PosDto/X1D1NoXlNoParPosDto.cs
  52. 1 1
      XdCxRhDw.Dto/PosDto/X1D1NoXlPosDto.cs
  53. 1 1
      XdCxRhDw.Dto/PosDto/X1D1PosDto.cs
  54. 1 1
      XdCxRhDw.Dto/PosDto/X2D1NoParPosDto.cs
  55. 1 1
      XdCxRhDw.Dto/PosDto/X2D1NoXlNoParlPosDto.cs
  56. 1 1
      XdCxRhDw.Dto/PosDto/X2D1NoXlPosDto.cs
  57. 1 1
      XdCxRhDw.Dto/PosDto/X2D1PosDto.cs
  58. 1 1
      XdCxRhDw.Dto/PosDto/X2DtoDfoNoXlPosDto.cs
  59. 1 1
      XdCxRhDw.Dto/PosDto/X2DtoDfoPosDto.cs
  60. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDfoNoXlPosDto.cs
  61. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDfoPosDto.cs
  62. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoParPosDto.cs
  63. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlNoParPosDto.cs
  64. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlPosDto.cs
  65. 1 1
      XdCxRhDw.Dto/PosDto/X3TwoDtoPosDto.cs
  66. 1 1
      XdCxRhDw.Dto/PosResDto.cs
  67. 13 2
      XdCxRhDw.Dto/PosResQueryDto.cs
  68. 35 0
      XdCxRhDw.Dto/RecordCount.cs
  69. 1 0
      XdCxRhDw.Dto/XdCxRhDw.Dto.csproj
  70. 1 1
      XdCxRhDw.Dto/XlCalcDto/XlCalcDto.cs
  71. 1 1
      XdCxRhDw.Dto/XlCalcDto/XlCalcMultDto.cs

二进制
Database.db


+ 1 - 2
XdCxRhDW.App/Basic/PhysicsHelper.cs

@@ -1,5 +1,4 @@
-using PosResAnalysis;
-using System;
+using System;
 using System.IO;
 using System.Security.Cryptography;
 using static System.Math;

+ 23 - 4
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -104,8 +104,26 @@ namespace XdCxRhDW.App.CorTools
                     gridSource.Clear();
                     gridView1.RefreshData();
                 }).DataSource = gridSource;
-            this.btnFile1.UseChooseFile();
-            this.btnFile2.UseChooseFile();
+            this.btnFile1.UseChooseFile(file =>
+            {
+                //从wav文件中自动读取采样率
+                FileInfo info = new FileInfo(file);
+                if (info.Extension.ToLower() == ".wav")
+                {
+                    using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
+                    {
+                        fs.Position = 24;
+                        byte[] data = new byte[4];
+                        fs.Read(data, 0, 4);
+                        var fsMHz = BitConverter.ToInt32(data, 0) / 1e6;
+                        if (fsMHz > 0)
+                            tefs.Text = fsMHz.ToString();
+
+                    };
+                }
+
+            }).UseDoubleClickToSelectAll();
+            this.btnFile2.UseChooseFile().UseDoubleClickToSelectAll();
             btnCheck.Enabled = !ckKY.Checked && !ckIBS.Checked && !chkDama.Checked ? false : true;
             ReadIni();
             using (RHDWContext db = new RHDWContext())
@@ -193,18 +211,19 @@ namespace XdCxRhDW.App.CorTools
             {
                 xItem.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
                 xItem.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl + "File/UploadFileAsync");
-                xItem.smpCount = int.Parse(teCount.Text);
+                xItem.smpCount = long.Parse(teCount.Text);
                 xItem.samplingRate = Convert.ToInt32(double.Parse(tefs.Text) * 1e6);
                 xItem.dtCenter = int.Parse(teCenter.Text);
                 xItem.dtRange = int.Parse(teRange.Text);
                 xItem.dfRange = int.Parse(teDfRange.Text);
-                xItem.smpStart = int.Parse(tePos.Text);
+                xItem.smpStart = long.Parse(tePos.Text);
                 xItem.snrThreshold = int.Parse(teSnr.Text);
 
 
             }
             catch (Exception ex)
             {
+                layoutControl1.Enabled = true;
                 Serilog.Log.Error(ex, "CPU文件参估参数错误");
                 DxHelper.MsgBoxHelper.ShowError($"CPU文件参估参数错误");
                 return;

+ 91 - 48
XdCxRhDW.App/CorTools/DetectToolForm.designer.cs

@@ -53,6 +53,11 @@
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject18 = new DevExpress.Utils.SerializableAppearanceObject();
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject19 = new DevExpress.Utils.SerializableAppearanceObject();
             DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject20 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions6 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject21 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject22 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject23 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject24 = new DevExpress.Utils.SerializableAppearanceObject();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
             this.txtFileTime = new DevExpress.XtraEditors.DateEdit();
             this.btnCalc = new DevExpress.XtraEditors.SimpleButton();
@@ -60,12 +65,13 @@
             this.btnCheck = new DevExpress.XtraEditors.SimpleButton();
             this.gcCheckCgRes = new DevExpress.XtraGrid.GridControl();
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.UserName = new DevExpress.XtraGrid.Columns.GridColumn();
             this.dt = new DevExpress.XtraGrid.Columns.GridColumn();
             this.df = new DevExpress.XtraGrid.Columns.GridColumn();
             this.snr = new DevExpress.XtraGrid.Columns.GridColumn();
             this.smpstart = new DevExpress.XtraGrid.Columns.GridColumn();
             this.smplen = new DevExpress.XtraGrid.Columns.GridColumn();
-            this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.sigTime = new DevExpress.XtraGrid.Columns.GridColumn();
             this.tm = new DevExpress.XtraGrid.Columns.GridColumn();
             this.file1 = new DevExpress.XtraGrid.Columns.GridColumn();
             this.file2 = new DevExpress.XtraGrid.Columns.GridColumn();
@@ -100,7 +106,8 @@
             this.layoutControlItem11 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutItemDrawImage = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem13 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.UserName = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.layoutControlItem14 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.txtBand = new DevExpress.XtraEditors.ComboBoxEdit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtFileTime.Properties)).BeginInit();
@@ -137,6 +144,8 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem11)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutItemDrawImage)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtBand.Properties)).BeginInit();
             this.SuspendLayout();
             // 
             // layoutControl1
@@ -158,6 +167,7 @@
             this.layoutControl1.Controls.Add(this.teRange);
             this.layoutControl1.Controls.Add(this.teDfRange);
             this.layoutControl1.Controls.Add(this.teSnr);
+            this.layoutControl1.Controls.Add(this.txtBand);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.layoutControl1.Location = new System.Drawing.Point(0, 0);
             this.layoutControl1.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
@@ -178,7 +188,7 @@
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
             this.txtFileTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.txtFileTime.Size = new System.Drawing.Size(80, 23);
+            this.txtFileTime.Size = new System.Drawing.Size(50, 23);
             this.txtFileTime.StyleController = this.layoutControl1;
             this.txtFileTime.TabIndex = 20;
             // 
@@ -238,7 +248,7 @@
             this.snr,
             this.smpstart,
             this.smplen,
-            this.gridColumn1,
+            this.sigTime,
             this.tm,
             this.file1,
             this.file2,
@@ -260,6 +270,14 @@
             this.gridView1.RowHeight = 0;
             this.gridView1.ViewCaptionHeight = 0;
             // 
+            // UserName
+            // 
+            this.UserName.Caption = "用户";
+            this.UserName.FieldName = "UserName";
+            this.UserName.Name = "UserName";
+            this.UserName.Visible = true;
+            this.UserName.VisibleIndex = 0;
+            // 
             // dt
             // 
             this.dt.Caption = "时差(us)";
@@ -310,13 +328,13 @@
             this.smplen.VisibleIndex = 4;
             this.smplen.Width = 90;
             // 
-            // gridColumn1
+            // sigTime
             // 
-            this.gridColumn1.Caption = "信号时间";
-            this.gridColumn1.FieldName = "SigTime";
-            this.gridColumn1.Name = "gridColumn1";
-            this.gridColumn1.Visible = true;
-            this.gridColumn1.VisibleIndex = 6;
+            this.sigTime.Caption = "信号时间";
+            this.sigTime.FieldName = "SigTime";
+            this.sigTime.Name = "sigTime";
+            this.sigTime.Visible = true;
+            this.sigTime.VisibleIndex = 6;
             // 
             // tm
             // 
@@ -359,20 +377,20 @@
             // tePos
             // 
             this.tePos.EditValue = "0";
-            this.tePos.Location = new System.Drawing.Point(882, 57);
+            this.tePos.Location = new System.Drawing.Point(892, 57);
             this.tePos.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.tePos.Name = "tePos";
-            this.tePos.Size = new System.Drawing.Size(76, 20);
+            this.tePos.Size = new System.Drawing.Size(50, 20);
             this.tePos.StyleController = this.layoutControl1;
             this.tePos.TabIndex = 10;
             // 
             // teCount
             // 
             this.teCount.EditValue = "0";
-            this.teCount.Location = new System.Drawing.Point(1019, 57);
+            this.teCount.Location = new System.Drawing.Point(1003, 57);
             this.teCount.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.teCount.Name = "teCount";
-            this.teCount.Size = new System.Drawing.Size(76, 20);
+            this.teCount.Size = new System.Drawing.Size(92, 20);
             this.teCount.StyleController = this.layoutControl1;
             this.teCount.TabIndex = 9;
             this.teCount.ToolTip = "0表示文件末尾";
@@ -438,60 +456,60 @@
             // tefs
             // 
             this.tefs.EditValue = "0.096";
-            this.tefs.Location = new System.Drawing.Point(187, 57);
+            this.tefs.Location = new System.Drawing.Point(157, 57);
             this.tefs.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.tefs.Name = "tefs";
             this.tefs.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "MHz", -1, false, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
-            this.tefs.Size = new System.Drawing.Size(88, 23);
+            this.tefs.Size = new System.Drawing.Size(60, 23);
             this.tefs.StyleController = this.layoutControl1;
             this.tefs.TabIndex = 6;
             // 
             // teCenter
             // 
             this.teCenter.EditValue = "0";
-            this.teCenter.Location = new System.Drawing.Point(336, 57);
+            this.teCenter.Location = new System.Drawing.Point(389, 57);
             this.teCenter.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.teCenter.Name = "teCenter";
             this.teCenter.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "us", -1, false, true, false, editorButtonImageOptions2, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject5, serializableAppearanceObject6, serializableAppearanceObject7, serializableAppearanceObject8, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
-            this.teCenter.Size = new System.Drawing.Size(76, 23);
+            this.teCenter.Size = new System.Drawing.Size(50, 23);
             this.teCenter.StyleController = this.layoutControl1;
             this.teCenter.TabIndex = 7;
             // 
             // teRange
             // 
             this.teRange.EditValue = "40000";
-            this.teRange.Location = new System.Drawing.Point(495, 57);
+            this.teRange.Location = new System.Drawing.Point(522, 57);
             this.teRange.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.teRange.Name = "teRange";
             this.teRange.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "us", -1, false, true, false, editorButtonImageOptions3, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject9, serializableAppearanceObject10, serializableAppearanceObject11, serializableAppearanceObject12, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
-            this.teRange.Size = new System.Drawing.Size(54, 23);
+            this.teRange.Size = new System.Drawing.Size(50, 23);
             this.teRange.StyleController = this.layoutControl1;
             this.teRange.TabIndex = 8;
             // 
             // teDfRange
             // 
             this.teDfRange.EditValue = "16384";
-            this.teDfRange.Location = new System.Drawing.Point(633, 57);
+            this.teDfRange.Location = new System.Drawing.Point(656, 57);
             this.teDfRange.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.teDfRange.Name = "teDfRange";
             this.teDfRange.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "Hz", -1, false, true, false, editorButtonImageOptions4, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject13, serializableAppearanceObject14, serializableAppearanceObject15, serializableAppearanceObject16, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
-            this.teDfRange.Size = new System.Drawing.Size(52, 23);
+            this.teDfRange.Size = new System.Drawing.Size(51, 23);
             this.teDfRange.StyleController = this.layoutControl1;
             this.teDfRange.TabIndex = 11;
             // 
             // teSnr
             // 
             this.teSnr.EditValue = "14";
-            this.teSnr.Location = new System.Drawing.Point(758, 57);
+            this.teSnr.Location = new System.Drawing.Point(780, 57);
             this.teSnr.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.teSnr.Name = "teSnr";
             this.teSnr.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "dB", -1, false, true, false, editorButtonImageOptions5, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject17, serializableAppearanceObject18, serializableAppearanceObject19, serializableAppearanceObject20, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
-            this.teSnr.Size = new System.Drawing.Size(64, 23);
+            this.teSnr.Size = new System.Drawing.Size(52, 23);
             this.teSnr.StyleController = this.layoutControl1;
             this.teSnr.TabIndex = 14;
             // 
@@ -516,7 +534,8 @@
             this.layoutControlItem7,
             this.layoutControlItem11,
             this.layoutItemDrawImage,
-            this.layoutControlItem13});
+            this.layoutControlItem13,
+            this.layoutControlItem14});
             this.Root.Name = "Root";
             this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(3, 3, 3, 3);
             this.Root.Size = new System.Drawing.Size(1100, 488);
@@ -536,9 +555,9 @@
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.tefs;
-            this.layoutControlItem3.Location = new System.Drawing.Point(137, 52);
+            this.layoutControlItem3.Location = new System.Drawing.Point(107, 52);
             this.layoutControlItem3.Name = "layoutControlItem3";
-            this.layoutControlItem3.Size = new System.Drawing.Size(137, 27);
+            this.layoutControlItem3.Size = new System.Drawing.Size(109, 27);
             this.layoutControlItem3.Text = "采样率:";
             this.layoutControlItem3.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem3.TextSize = new System.Drawing.Size(40, 14);
@@ -567,9 +586,9 @@
             // layoutControlItem4
             // 
             this.layoutControlItem4.Control = this.teCenter;
-            this.layoutControlItem4.Location = new System.Drawing.Point(274, 52);
+            this.layoutControlItem4.Location = new System.Drawing.Point(327, 52);
             this.layoutControlItem4.Name = "layoutControlItem4";
-            this.layoutControlItem4.Size = new System.Drawing.Size(137, 27);
+            this.layoutControlItem4.Size = new System.Drawing.Size(111, 27);
             this.layoutControlItem4.Text = "时差中心:";
             this.layoutControlItem4.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem4.TextSize = new System.Drawing.Size(52, 14);
@@ -578,9 +597,9 @@
             // layoutControlItem5
             // 
             this.layoutControlItem5.Control = this.teRange;
-            this.layoutControlItem5.Location = new System.Drawing.Point(411, 52);
+            this.layoutControlItem5.Location = new System.Drawing.Point(438, 52);
             this.layoutControlItem5.Name = "layoutControlItem5";
-            this.layoutControlItem5.Size = new System.Drawing.Size(137, 27);
+            this.layoutControlItem5.Size = new System.Drawing.Size(133, 27);
             this.layoutControlItem5.Text = "时差范围(us):";
             this.layoutControlItem5.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem5.TextSize = new System.Drawing.Size(74, 14);
@@ -589,9 +608,9 @@
             // layoutControlItem10
             // 
             this.layoutControlItem10.Control = this.teSnr;
-            this.layoutControlItem10.Location = new System.Drawing.Point(684, 52);
+            this.layoutControlItem10.Location = new System.Drawing.Point(706, 52);
             this.layoutControlItem10.Name = "layoutControlItem10";
-            this.layoutControlItem10.Size = new System.Drawing.Size(137, 27);
+            this.layoutControlItem10.Size = new System.Drawing.Size(125, 27);
             this.layoutControlItem10.Text = "信噪比门限:";
             this.layoutControlItem10.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem10.TextSize = new System.Drawing.Size(64, 14);
@@ -600,9 +619,9 @@
             // layoutControlItem8
             // 
             this.layoutControlItem8.Control = this.teDfRange;
-            this.layoutControlItem8.Location = new System.Drawing.Point(548, 52);
+            this.layoutControlItem8.Location = new System.Drawing.Point(571, 52);
             this.layoutControlItem8.Name = "layoutControlItem8";
-            this.layoutControlItem8.Size = new System.Drawing.Size(136, 27);
+            this.layoutControlItem8.Size = new System.Drawing.Size(135, 27);
             this.layoutControlItem8.Text = "频差范围(Hz):";
             this.layoutControlItem8.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem8.TextSize = new System.Drawing.Size(75, 14);
@@ -611,9 +630,9 @@
             // lciStartPos
             // 
             this.lciStartPos.Control = this.tePos;
-            this.lciStartPos.Location = new System.Drawing.Point(821, 52);
+            this.lciStartPos.Location = new System.Drawing.Point(831, 52);
             this.lciStartPos.Name = "lciStartPos";
-            this.lciStartPos.Size = new System.Drawing.Size(136, 27);
+            this.lciStartPos.Size = new System.Drawing.Size(110, 27);
             this.lciStartPos.Text = "起始样点:";
             this.lciStartPos.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.lciStartPos.TextSize = new System.Drawing.Size(52, 14);
@@ -622,9 +641,9 @@
             // lciSampleLength
             // 
             this.lciSampleLength.Control = this.teCount;
-            this.lciSampleLength.Location = new System.Drawing.Point(957, 52);
+            this.lciSampleLength.Location = new System.Drawing.Point(941, 52);
             this.lciSampleLength.Name = "lciSampleLength";
-            this.lciSampleLength.Size = new System.Drawing.Size(137, 27);
+            this.lciSampleLength.Size = new System.Drawing.Size(153, 27);
             this.lciSampleLength.Text = "样点长度:";
             this.lciSampleLength.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.lciSampleLength.TextSize = new System.Drawing.Size(52, 14);
@@ -716,19 +735,39 @@
             this.layoutControlItem13.Control = this.txtFileTime;
             this.layoutControlItem13.Location = new System.Drawing.Point(0, 52);
             this.layoutControlItem13.Name = "layoutControlItem13";
-            this.layoutControlItem13.Size = new System.Drawing.Size(137, 27);
+            this.layoutControlItem13.Size = new System.Drawing.Size(107, 27);
             this.layoutControlItem13.Text = "文件时间";
             this.layoutControlItem13.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
             this.layoutControlItem13.TextSize = new System.Drawing.Size(48, 14);
             this.layoutControlItem13.TextToControlDistance = 5;
             // 
-            // UserName
-            // 
-            this.UserName.Caption = "用户";
-            this.UserName.FieldName = "UserName";
-            this.UserName.Name = "UserName";
-            this.UserName.Visible = true;
-            this.UserName.VisibleIndex = 0;
+            // layoutControlItem14
+            // 
+            this.layoutControlItem14.Control = this.txtBand;
+            this.layoutControlItem14.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem14.CustomizationFormText = "采样率:";
+            this.layoutControlItem14.Location = new System.Drawing.Point(216, 52);
+            this.layoutControlItem14.Name = "layoutControlItem14";
+            this.layoutControlItem14.Size = new System.Drawing.Size(111, 27);
+            this.layoutControlItem14.Text = "信号带宽:";
+            this.layoutControlItem14.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
+            this.layoutControlItem14.TextSize = new System.Drawing.Size(52, 14);
+            this.layoutControlItem14.TextToControlDistance = 5;
+            // 
+            // txtBand
+            // 
+            this.txtBand.EditValue = "25";
+            this.txtBand.Location = new System.Drawing.Point(278, 57);
+            this.txtBand.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
+            this.txtBand.Name = "txtBand";
+            this.txtBand.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "K", -1, false, true, false, editorButtonImageOptions6, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject21, serializableAppearanceObject22, serializableAppearanceObject23, serializableAppearanceObject24, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            this.txtBand.Properties.Items.AddRange(new object[] {
+            "25",
+            "5"});
+            this.txtBand.Size = new System.Drawing.Size(50, 23);
+            this.txtBand.StyleController = this.layoutControl1;
+            this.txtBand.TabIndex = 6;
             // 
             // DetectToolForm
             // 
@@ -778,6 +817,8 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem11)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutItemDrawImage)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtBand.Properties)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -830,8 +871,10 @@
         private DevExpress.XtraEditors.ButtonEdit teSnr;
         private DevExpress.XtraEditors.DateEdit txtFileTime;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem13;
-        private DevExpress.XtraGrid.Columns.GridColumn gridColumn1;
+        private DevExpress.XtraGrid.Columns.GridColumn sigTime;
         private DevExpress.XtraGrid.Columns.GridColumn sigType;
         private DevExpress.XtraGrid.Columns.GridColumn UserName;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem14;
+        private DevExpress.XtraEditors.ComboBoxEdit txtBand;
     }
 }

+ 11 - 12
XdCxRhDW.App/EditForms/X2D1PosParamEditor.cs

@@ -34,7 +34,6 @@ namespace XdCxRhDW.App.EditForms
 {
     public partial class X2D1PosParamEditor : DevExpress.XtraEditors.XtraUserControl
     {
-
         private List<SatInfo> listSat;
         private PosRes info;
         private CgRes cg;
@@ -110,17 +109,17 @@ namespace XdCxRhDW.App.EditForms
                 txtRefLocation.Properties.ReadOnly = true;
                 this.txtRefLocation.Text = $"{0},{0}";
             }
-            //double tarLon = 46, tarLat = 24;
-            //double recLon = 45.9, recLat = 23.9;
-            //var tarEcef = PhysicsHelper.GeoToEcef((tarLon, tarLat, 0));
-            //var recEcef = PhysicsHelper.GeoToEcef((recLon, recLat, 0));
-            //var xl1Ecef = (cg.MainX.Value, cg.MainY.Value, cg.MainZ.Value);
-            //var xl2Ecef = (cg.Adja1X.Value, cg.Adja1Y.Value, cg.Adja1Z.Value);
-            //var dt1 = PhysicsHelper.Dto(tarEcef, xl1Ecef, recEcef);
-            //var dt2 = PhysicsHelper.Dto(tarEcef, xl2Ecef, recEcef);
-            //var dto1 = (dt1 - dt2) * 1e6;
-            //var dt3 = PhysicsHelper.Dto(tarEcef, recEcef);
-            //var dto2 = (dt1 - dt3) * 1e6;
+            double tarLon = 46, tarLat = 24;
+            double recLon = 45.9, recLat = 23.9;
+            var tarEcef = PhysicsHelper.GeoToEcef((tarLon, tarLat, 0));
+            var recEcef = PhysicsHelper.GeoToEcef((recLon, recLat, 0));
+            var xl1Ecef = (cg.MainX.Value, cg.MainY.Value, cg.MainZ.Value);
+            var xl2Ecef = (cg.Adja1X.Value, cg.Adja1Y.Value, cg.Adja1Z.Value);
+            var dt1 = PhysicsHelper.Dto(tarEcef, xl1Ecef, recEcef);
+            var dt2 = PhysicsHelper.Dto(tarEcef, xl2Ecef, recEcef);
+            var dto1 = (dt1 - dt2) * 1e6;
+            var dt3 = PhysicsHelper.Dto(tarEcef, recEcef);
+            var dto2 = (dt1 - dt3) * 1e6;
         }
 
         public bool CheckParam()

+ 12 - 1
XdCxRhDW.App/ExtensionsDev/ChooseFileExtension.cs

@@ -1,6 +1,7 @@
 using DevExpress.XtraEditors;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -10,12 +11,20 @@ namespace ExtensionsDev
 {
     public static class ChooseFileExtension
     {
-        public static ButtonEdit UseChooseFile(this ButtonEdit ctrl)
+        public static ButtonEdit UseChooseFile(this ButtonEdit ctrl,Action<string> onFileChanged=null)
         {
             ctrl.AllowDrop = true;
             ctrl.DragEnter += ctrl_DragEnter;
             ctrl.DragDrop += ctrl_DragDrop;
             ctrl.ButtonClick += Ctrl_ButtonClick;
+            ctrl.TextChanged += (sender, e) =>
+            {
+                string file = (sender as Control).Text;
+                if (File.Exists(file))
+                {
+                    onFileChanged?.Invoke(file);
+                }
+            };
             return ctrl;
         }
 
@@ -24,8 +33,10 @@ namespace ExtensionsDev
             var ctrl = sender as Control;
             XtraOpenFileDialog xtraOpenFileDialog1 = new XtraOpenFileDialog();
             xtraOpenFileDialog1.Multiselect = false;
+            var currentDir = Environment.CurrentDirectory;
             if (xtraOpenFileDialog1.ShowDialog() == DialogResult.OK)
             {
+                Environment.CurrentDirectory = currentDir;
                 ctrl.Text = xtraOpenFileDialog1.FileName;
             }
         }

+ 32 - 9
XdCxRhDW.App/ExtensionsDev/GridControlEx.cs

@@ -210,7 +210,7 @@ public static class GridControlEx
 
     private static void View_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
     {
-        if (e.Column.ColumnType == typeof(DateTime)|| e.Column.ColumnType == typeof(DateTime?))
+        if (e.Column.ColumnType == typeof(DateTime) || e.Column.ColumnType == typeof(DateTime?))
         {
             if (e.Value == null) return;
             if (e.Column.FieldName == "SigTime")
@@ -274,7 +274,6 @@ public static class GridControlEx
     {
         var view = grid.MainView as GridView;
         view.OptionsView.ShowIndicator = true;
-        view.IndicatorWidth = 30;
         view.CustomDrawRowIndicator += (s, e) =>
         {
             if (!e.Info.IsRowIndicator) return;
@@ -282,14 +281,28 @@ public static class GridControlEx
             e.Handled = true;
             string txt = (e.RowHandle + 1).ToString();
             var txtSize = e.Graphics.MeasureString(txt, e.Appearance.Font);
+            if (view.IndicatorWidth < txtSize.Width + 20)
+            {
+                view.IndicatorWidth++;
+            }
             var loc = new PointF(e.Bounds.X + e.Bounds.Width / 2f - txtSize.Width / 2f + 2,
                 e.Bounds.Y + e.Bounds.Height / 2f - txtSize.Height / 2f);
+
             e.Cache.FillRectangle(new SolidBrush(e.Appearance.BackColor), e.Bounds);
             e.Cache.DrawString(txt, e.Appearance.Font, new SolidBrush(e.Appearance.ForeColor), loc);
         };
+        view.RowCountChanged += (sender, e) =>
+        {
+            if (view.RowCount == 0)
+                view.IndicatorWidth = -1;
+            else
+                view.IndicatorWidth = view.RowCount.ToString().Length * 6 + 20;
+        };
         return grid;
 
     }
+
+
     public static GridControl HideColumn(this GridControl grid, params string[] colField)
     {
 
@@ -322,19 +335,29 @@ public static class GridControlEx
         tag?.PopupMenu?.ShowPopup(p);
     }
 
-    public static GridControl AddMenu(this GridControl grid, string menuText, SvgImage meunImage, Action onClick)
+    public static GridControl AddMenu(this GridControl grid, string menuText, SvgImage meunImage, Action onClick, PopupMenu existMenu = null)
     {
         GridTag tag = grid.Tag as GridTag;
-        if (tag.BarM == null)
+        PopupMenu popupMenu;
+        if (existMenu == null)
         {
-            tag.BarM = new BarManager();
-            tag.BarM.Form = grid;
+            if (tag.BarM == null)
+            {
+                tag.BarM = new BarManager();
+                tag.BarM.Form = grid;
+            }
+            if (tag.PopupMenu == null)
+            {
+                tag.PopupMenu = new PopupMenu();
+            }
+            popupMenu = tag.PopupMenu;
         }
-        if (tag.PopupMenu == null)
+        else
         {
-            tag.PopupMenu = new PopupMenu();
+            popupMenu = existMenu;
+            tag.PopupMenu = existMenu;
+            tag.BarM = existMenu.Manager;
         }
-        PopupMenu popupMenu = tag.PopupMenu;
         BarButtonItem item = new BarButtonItem();
         item.ItemClick += (sender, e) =>
         {

+ 1 - 0
XdCxRhDW.App/MainForm.Designer.cs

@@ -264,6 +264,7 @@
             this.Ribbon = this.ribbon;
             this.Text = "多模式融合定位平台";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+            this.Load += new System.EventHandler(this.MainForm_Load);
             ((System.ComponentModel.ISupportInitialize)(this.ribbon)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.documentManager1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.tabbedView1)).EndInit();

+ 102 - 65
XdCxRhDW.App/MainForm.cs

@@ -22,6 +22,8 @@ using System.IO;
 using XdCxRhDW.Repostory.Model;
 using XdCxRhDW.Core;
 using System.Data.Entity.Migrations;
+using DevExpress.XtraPrinting.Native.Properties;
+using XdCxRhDW.Core.Api;
 
 namespace XdCxRhDW
 {
@@ -44,94 +46,127 @@ namespace XdCxRhDW
             ctrlTypes.Add("检测参估工具(CPU)", typeof(DetectToolForm));
             ctrlTypes.Add("星历推算", typeof(XlCalculateForm));
             btn_ItemClick(null, null);
-            XlScan();
 
         }
+        private async void MainForm_Load(object sender, EventArgs e)
+        {
+            _ = XlScan();
+            _= XlClear();
+            await XlLonCalc();
+        }
 
-        private async void XlScan()
+        //自动导入Tle
+        private async Task XlScan()
         {
-            await Task.Run(async () =>
+            while (true)
             {
+                await Task.Delay(10000);
+                SysSetings settings = null;
+                using (RHDWContext db = new RHDWContext())
+                {
+                    settings = await db.SysSetings.FirstOrDefaultAsync();
+                    if (settings == null || settings.XLDirectory == null || !Directory.Exists(settings.XLDirectory))
+                        continue;
+                }
+                if (!Directory.Exists(settings.XLDirectory))
+                {
+                    continue;
+                }
+                var baseUrl = $"http://{IpHelper.GetLocalIp()}:{settings.HttpPort}/api/";
 
-                while (true)
+                DirectoryInfo dir = new DirectoryInfo(settings.XLDirectory);
+                var backUpDir = dir.Parent.FullName;
+                var files = Directory.EnumerateFiles(settings.XLDirectory, "*", SearchOption.AllDirectories);
+                foreach (string file in files)
+                {
+                    var fileName = await HttpHelper.UploadFileAsync(file, baseUrl + "File/UploadFileAsync");
+                    await HttpHelper.PostRequestAsync<int>(baseUrl + "Xl/ImportTleAsync", fileName);
+
+                    //导入完成的文件放在备份目录
+                    var baseDirectory = Path.Combine(backUpDir, "TleBackUp");
+                    Directory.CreateDirectory(baseDirectory);
+                    File.Move(file, Path.Combine(baseDirectory, Path.GetFileName(file)));
+                }
+
+            }
+        }
+
+        //清理180天之前的星历
+        private async Task XlClear()
+        {
+            while (true)
+            {
+                try
                 {
-                    await Task.Delay(10000);
-                    SysSetings settings = null;
                     using (RHDWContext db = new RHDWContext())
                     {
-                        settings = await db.SysSetings.FirstOrDefaultAsync();
-                        if (settings == null || settings.XLDirectory == null || !Directory.Exists(settings.XLDirectory))
-                            continue;
-                    }
-                    if (!Directory.Exists(settings.XLDirectory))
-                    {
-                        continue;
-                    }
-                    DirectoryInfo dir = new DirectoryInfo(settings.XLDirectory);
-                    var backUpDir = dir.Parent.FullName;
-                    var files = Directory.EnumerateFiles(settings.XLDirectory, "*", SearchOption.AllDirectories);
-                    foreach (string file in files)
-                    {
-                        var lines = File.ReadAllLines(file).ToList();
-                        lines.RemoveAll(p => string.IsNullOrWhiteSpace(p));
-                        List<XlInfo> tmp = new List<XlInfo>();
-                        for (int i = 0; i < lines.Count; i += 3)
+                        DateTime dt = DateTime.Now.AddDays(-180);
+                        var clearData = await db.XlInfos.Where(p => p.TimeBJ < dt).ToListAsync();
+                        if (clearData.Any())
                         {
-                            var satName = lines[i].Trim();
-                            if (satName.StartsWith("0 "))
-                                satName = satName.Substring(2).Trim();
-                            if (satName.StartsWith("TBA"))//待发布的卫星 
-                                continue;
-                            XlInfo xl = new XlInfo()
-                            {
-                                SatName = satName,
-                                Line1 = lines[i + 1],
-                                Line2 = lines[i + 2],
-                                SatCode = Convert.ToInt32(lines[i + 1].Substring(2, 5))
-                            };
-                            var timeStr = lines[i + 1].Substring(18, 14).Replace(" ", "");//https://www.space-track.org/documentation#tle星历接口中说这里面可以接受空格
-                            var yearStr = timeStr.Substring(0, 2);
-                            var dayStr = timeStr.Substring(2, timeStr.Length - 2);
-                            var day = Convert.ToDouble(dayStr);
-                            var year = 2000 + Convert.ToInt32(yearStr);
-                            DateTime dt = new DateTime(year, 1, 1, 0, 0, 0);
-                            dt = dt.AddDays(day);
-                            xl.TimeBJ = dt.AddHours(8);
-                            tmp.Add(xl);
+                            db.XlInfos.RemoveRange(clearData);
+                            await db.SaveChangesAsync();
                         }
-                        var groupData = tmp.GroupBy(p => p.TimeBJ.ToString("yyyyMMdd"));
-                        foreach (var items in groupData)
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Serilog.Log.Error(ex, "清理过期星历异常");
+                }
+                await Task.Delay(3600 * 1000);
+            }
+        }
+
+        //计算星历的轨道经度
+        private async Task XlLonCalc()
+        {
+            while (true)
+            {
+                try
+                {
+                    using (RHDWContext db = new RHDWContext())
+                    {
+                        var calcItems = await db.XlInfos.Where(p => p.Lon==null).ToArrayAsync();
+                        if (calcItems.Any())
                         {
-                            using (RHDWPartContext db = RHDWPartContext.GetContext(items.First().TimeBJ))
+                            foreach (var item in calcItems)
                             {
-                                foreach (var item in items)
+                                await Task.Run(async () =>
                                 {
-                                    var findItem = await db.XlInfos.FirstOrDefaultAsync(p => p.SatCode == item.SatCode && p.TimeBJ == item.TimeBJ);
-                                    if (findItem != null)
+                                    try
                                     {
-                                        findItem.Line1 = item.Line1;
-                                        findItem.Line2 = item.Line2;
-                                        findItem.UpdateTime = item.UpdateTime;
-                                        db.XlInfos.AddOrUpdate(findItem);
+                                        var eph = EphHelper.Calc(item.TwoLine, item.TimeBJ);
+                                        item.Lon = Math.Round(PhysicsHelper.EcefToGeo((eph.X, eph.Y, eph.Z)).lon, 1);
+                                      
                                     }
-                                    else
+                                    catch (Exception ex)
                                     {
-                                        db.XlInfos.Add(item);
+                                        item.Lon = -999;
+                                        Serilog.Log.Error(ex, $"[{item.TwoLine}]推算XYZ星历出错!");
                                     }
-                                }
-                                await db.SaveChangesAsync();
-                            }
+                                    try
+                                    {
+                                        db.XlInfos.AddOrUpdate(item);
+                                        await db.SaveChangesAsync();
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        Serilog.Log.Error(ex,"修改星历表卫星经度出错");
 
+                                    }
+                                });
+                            }
                         }
-
-                        //导入完成的文件放在备份目录
-                        var baseDirectory = Path.Combine(backUpDir, "TleBackUp");
-                        Directory.CreateDirectory(baseDirectory);
-                        File.Move(file, Path.Combine(baseDirectory, Path.GetFileName(file)));
                     }
                 }
-            });
+                catch (Exception ex)
+                {
+                    Serilog.Log.Error(ex, "清理过期星历异常");
+                }
+                await Task.Delay(60 * 1000);
+            }
         }
+
         private void btn_ItemClick(object sender, ItemClickEventArgs e)
         {
             var btnTxt = e?.Item?.Caption ?? "任务管理";
@@ -195,5 +230,7 @@ namespace XdCxRhDW
                 }
             }
         }
+
+
     }
 }

+ 2 - 0
XdCxRhDW.App/PopupControl/ShowCgCtrl.cs

@@ -1,4 +1,5 @@
 using DevExpress.XtraEditors;
+using ExtensionsDev;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -23,6 +24,7 @@ namespace XdCxRhDW.App.PopupControl
         public ShowCgCtrl()
         {
             InitializeComponent();
+            this.layoutControl1.UseDefault();
             gridShowCg.Init<ModelCg>().DataSource = listCg;
             gridCgXgf.Init<ModelCgXgf>().UseRowNumber().DataSource = listXgf;
         }

+ 1 - 0
XdCxRhDW.App/Program.cs

@@ -20,6 +20,7 @@ namespace XdCxRhDW
     {
         static Program()
         {
+            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
             AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", "AddIns;");
             string paths = Environment.GetEnvironmentVariable("PATH");
             string dllPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Api\GDOP误差椭圆\GDOP\");

+ 11 - 10
XdCxRhDW.App/Properties/licenses.licx

@@ -1,16 +1,17 @@
+DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.Repository.RepositoryItemPictureEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Docking2010.DocumentManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.Repository.RepositoryItemPictureEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraEditors.ImageComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraCharts.ChartControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.Docking2010.DocumentManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraCharts.ChartControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 0 - 69
XdCxRhDW.App/TcpServer.cs

@@ -1,69 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace XdCxRhDW.App
-{
-    class TcpServer
-    {
-        private TcpListener listener;
-        public event Action<byte[]> OnDataReceived;
-        public void Start(int port, string ip = null)
-        {
-            Task.Run(() =>
-            {
-                if (string.IsNullOrWhiteSpace(ip))
-                {
-                    listener = new TcpListener(IPAddress.Any, port);
-                }
-                else
-                {
-                    listener = new TcpListener(IPAddress.Parse(ip), port);
-                }
-                listener.Start();
-            L1:
-                TcpClient client = null;
-                try
-                {
-                     client = listener.AcceptTcpClient();
-                }
-                catch (Exception ex)
-                {
-                    return;
-                }
-                while (true)
-                {
-                    try
-                    {
-                        var stream = client.GetStream();
-                        byte[] lenData = new byte[4];
-                        int readLen = stream.Read(lenData, 0, 4);
-                        if (readLen == 0)
-                            goto L1;
-                        byte[] data = new byte[BitConverter.ToInt32(lenData, 0)];
-                        readLen = stream.Read(data, 0, data.Length);
-                        if (readLen == 0)
-                            goto L1;
-                        OnDataReceived?.Invoke(data);
-                    }
-                    catch (Exception ex)
-                    {
-                        goto L1;
-                    }
-                }
-            });
-        }
-
-
-        public void StopListening()
-        {
-            listener?.Stop();
-            listener = null;
-        }
-    }
-}

+ 33 - 44
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -29,6 +29,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.IO;
 using XdCxRhDW.App.PopupControl;
+using System.Windows.Controls;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class CtrlHome : DevExpress.XtraEditors.XtraUserControl
@@ -40,7 +41,37 @@ namespace XdCxRhDW.App.UserControl
         {
             InitializeComponent();
             gridHomeTask.Init<TaskInfo>().UseFilter();
-            gridHomePosRes.Init<PosRes>().UseMultiSelect().UseRowNumber().UseSort().UseFilter();
+            gridHomePosRes.Init<PosRes>().UseMultiSelect().UseRowNumber().UseSort().UseFilter()
+                .AddMenu("删除", SvgHelper.CreateClose(), async () =>
+                {
+                    if (!MsgBoxHelper.ShowConfirm("是否删除选中的记录!")) return;
+                    try
+                    {
+                        var rows = gridView2.GetSelectedRows();
+                        List<PosRes> list = new List<PosRes>();
+                        foreach (var item in rows)
+                        {
+                            list.Add(gridView2.GetRow(item) as PosRes);
+                        }
+                        var groupItems = list.GroupBy(p => p.SigTime.ToString("yyyyMMdd"));
+                        foreach (var groupItem in groupItems)
+                        {
+                            var ids = groupItem.Select(m => m.ID).ToList();
+                            using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                            {
+                                var array = await db.PosRes.Where(p => ids.Contains(p.ID)).ToArrayAsync();
+                                db.PosRes.RemoveRange(array);
+                                await db.SaveChangesAsync();
+                            }
+                        }
+                        gridView2.DeleteSelectedRows();
+                    }
+                    catch (Exception ex) 
+                    {
+                        Serilog.Log.Error(ex, "表格中删除定位点异常!");
+                        DxHelper.MsgBoxHelper.ShowError("删除定位点异常!");
+                    }
+                },popupMenu2);
             layoutControl1.UseDefault();
             txtStartTime.UseDefault();
             txtEndTime.UseDefault();
@@ -323,49 +354,6 @@ namespace XdCxRhDW.App.UserControl
                 MsgBoxHelper.ShowError("转到列表异常!");
             }
 
-        }
-        private async void EditTarget(List<PosRes> items)
-        {
-            if (items == null || items.Count() == 0)
-            {
-                DxHelper.MsgBoxHelper.ShowWarning($"请选择需要编辑目标的定位数据信息!");
-                return;
-            }
-            try
-            {
-                var firstItem = items.First();
-                EditorTar frm = new EditorTar(new TargetInfo() { ID = firstItem.TargetID.HasValue ? firstItem.TargetID.Value : 0, TargetName = firstItem.TarName });
-                if (frm.ShowDialog() != DialogResult.OK) return;
-                var tar = frm.info;
-                var groupItems = items.GroupBy(p => p.SigTime.ToString("yyyyMMdd"));
-                foreach (var groupItem in groupItems)
-                {
-                    var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
-                    {
-                        var array = await db.PosRes.Where(p => ids.Contains(p.ID)).ToArrayAsync();
-                        EditTarget(array, tar);
-                        await db.SaveChangesAsync();
-                    }
-                }
-                EditTarget(items, tar);
-                gridView2.RefreshData();
-            }
-            catch (Exception ex)
-            {
-                Serilog.Log.Error(ex, "编辑定位目标异常!");
-                MsgBoxHelper.ShowError("编辑定位目标异常!");
-            }
-
-        }
-        private void EditTarget(IEnumerable<PosRes> pos, TargetInfo tar)
-        {
-            foreach (var item in pos)
-            {
-                item.TargetID = tar.ID;
-                item.TarName = tar.TargetName;
-            }
-
         }
         private async void UseMirr(List<PosRes> items)
         {
@@ -518,6 +506,7 @@ namespace XdCxRhDW.App.UserControl
 
         private void GridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
         {
+            if (e.Value == null) return;
             if (e.Column.FieldName == nameof(TaskInfo.Freq))
             {
                 e.DisplayText = $"{(long)e.Value / 1e6}MHz";

+ 27 - 82
XdCxRhDW.App/UserControl/CtrlXl.cs

@@ -17,6 +17,10 @@ using System.Net.Http;
 using ExtensionsDev;
 using System.Windows.Documents;
 using XdCxRhDW.Repostory;
+using XdCxRhDW.Core;
+using DevExpress.XtraPrinting.Native.Properties;
+using XdCxRhDw.Dto;
+using DxHelper;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -45,88 +49,34 @@ namespace XdCxRhDW.App.UserControl
             }
             catch (Exception ex)
             {
-                Serilog.Log.Error(ex,"加载星历信息异常");
+                Serilog.Log.Error(ex, "加载星历信息异常");
                 DxHelper.MsgBoxHelper.ShowError("加载星历信息异常");
             }
         }
 
         private async void btnImp_Click(object sender, EventArgs e)
         {
-            //https://www.space-track.org/documentation#tle网站上有星历文件格式说明
-            string line = null;
-            try
+            this.layoutControl1.Enabled = false;
+            string baseUrl = null;
+            using (RHDWContext db = new RHDWContext())
             {
-                this.Enabled = false;
-                await Task.Run(async () =>
+                var res = await db.SysSetings.FirstOrDefaultAsync();
+                if (res != null)
                 {
-                    var lines = File.ReadAllLines(btnOpen.Text).ToList();
-                    lines.RemoveAll(p => string.IsNullOrWhiteSpace(p));
-                    List<XlInfo> tmp = new List<XlInfo>();
-                    for (int i = 0; i < lines.Count; i += 3)
-                    {
-                        line = lines[i];
-                        var satName = lines[i].Trim();
-                        if (satName.StartsWith("0 "))
-                            satName = satName.Substring(2).Trim();
-                        if (satName.StartsWith("TBA"))//待发布的卫星
-                            continue;
-                        XlInfo xl = new XlInfo()
-                        {
-                            SatName = satName,
-                            Line1 = lines[i + 1],
-                            Line2 = lines[i + 2],
-                            SatCode = Convert.ToInt32(lines[i + 1].Substring(2, 5))
-                        };
-                        var timeStr = lines[i + 1].Substring(18, 14).Replace(" ","");//https://www.space-track.org/documentation#tle星历接口中说这里面可以接受空格
-                        var yearStr = timeStr.Substring(0, 2);
-                        var dayStr = timeStr.Substring(2, timeStr.Length - 2);
-                        var day = Convert.ToDouble(dayStr);
-                        var year = 2000 + Convert.ToInt32(yearStr);
-                        DateTime dt = new DateTime(year, 1, 1, 0, 0, 0);
-                        dt = dt.AddDays(day);
-                        xl.TimeBJ = dt.AddHours(8);
-                        tmp.Add(xl);
-                    }
-                    var groupData = tmp.GroupBy(p => p.TimeBJ.ToString("yyyyMMdd"));
-                    foreach (var items in groupData)
-                    {
-                        using (RHDWPartContext db = RHDWPartContext.GetContext(items.First().TimeBJ))
-                        {
-                            foreach (var item in items)
-                            {
-                                var findItem = await db.XlInfos.FirstOrDefaultAsync(p => p.SatCode == item.SatCode && p.TimeBJ == item.TimeBJ);
-                                if (findItem != null)
-                                {
-                                    findItem.Line1 = item.Line1;
-                                    findItem.Line2 = item.Line2;
-                                    findItem.UpdateTime = item.UpdateTime;
-                                    db.XlInfos.AddOrUpdate(findItem);
-                                }
-                                else
-                                {
-                                    db.XlInfos.Add(item);
-                                }
-                            }
-                            await db.SaveChangesAsync();
-                        }
-
-                    }
-                   
-                   
-                });
-                await LoadData();
-                Serilog.Log.Information("星历导入成功");
-                DxHelper.MsgBoxHelper.ShowInfo("星历导入成功");
+                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{res.HttpPort}/api/";
+                }
             }
-            catch (Exception ex)
+            if (baseUrl == null)
             {
-                Serilog.Log.Error(ex, $"{line}星历导入异常");
-                DxHelper.MsgBoxHelper.ShowError("星历导入异常");
-            }
-            finally
-            {
-                this.Enabled = true;
+                MsgBoxHelper.ShowError("请在系统设置中配置Http端口");
+                this.layoutControl1.Enabled = true;
+                return;
             }
+            var file = await HttpHelper.UploadFileAsync(btnOpen.Text, baseUrl + "File/UploadFileAsync");
+            var result = await HttpHelper.PostRequestAsync<RecordRes>(baseUrl + "Xl/ImportTleAsync", file, 120);
+            DxHelper.MsgBoxHelper.ShowInfo($"星历导入成功.共导入{result.data.Count}条");
+            await LoadData();
+            this.layoutControl1.Enabled = true;
 
         }
 
@@ -148,19 +98,14 @@ namespace XdCxRhDW.App.UserControl
                         var item = gridView1.GetRow(idx) as XlInfo;
                         list.Add(item);
                     }
-                    var groupData=list.GroupBy(p => p.TimeBJ.ToString("yyyyMMdd"));
-                    foreach (var item in groupData)
+                    var dayIds = list.Select(p => p.ID).ToList();
+                    using (RHDWContext db = new RHDWContext())
                     {
-                        var dayIds = item.Select(p=>p.ID).ToList();
-                        using (RHDWPartContext db = RHDWPartContext.GetContext(item.First().TimeBJ))
-                        {
-                            var delItems = await db.XlInfos.Where(p => dayIds.Contains(p.ID)).ToListAsync();
-                            db.XlInfos.RemoveRange(delItems);
-                            await db.SaveChangesAsync();
-                        }
-
+                        var delItems = await db.XlInfos.Where(p => dayIds.Contains(p.ID)).ToListAsync();
+                        db.XlInfos.RemoveRange(delItems);
+                        await db.SaveChangesAsync();
                     }
-                   
+
                 });
                 gridView1.DeleteSelectedRows();
 

+ 1 - 1
XdCxRhDW.App/UserControl/X1D1GDOPParam.cs

@@ -57,7 +57,7 @@ namespace XdCxRhDW.App.UserControl
                 var xlList = XlCache.GetAllAsync().Result.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
                 if (xlall.Count() == 0) return;
-                if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
+                if (cg != null && cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
                 {
                     mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
                 }

+ 2 - 2
XdCxRhDW.App/UserControl/X2D1GDOPParam.cs

@@ -67,7 +67,7 @@ namespace XdCxRhDW.App.UserControl
                 var xlList = XlCache.GetAllAsync().Result;
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
                 if (xlall.Count == 0) return;
-                if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
+                if (cg != null && cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
                 {
                     mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
                 }
@@ -76,7 +76,7 @@ namespace XdCxRhDW.App.UserControl
                     mainTle = xlList.First().TwoLine;
                 }
 
-                if (cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
+                if (cg != null && cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
                 {
                     adjaTle = xlList.First(m => m.SatCode == cg.Adja1Code.Value).TwoLine;
                 }

+ 8 - 5
XdCxRhDW.App/UserControl/X2DFGDOPParam.cs

@@ -55,13 +55,16 @@ namespace XdCxRhDW.App.UserControl
                 {
                     this.txtRefLocation1.Text = $"{station.RefLon},{station.RefLat}";
                 }
-                this.txtFu1.EditValue = cg.TarFreqUp.HasValue ? cg.TarFreqUp.Value * 1e-6 : 950;
-                this.txtFu2.EditValue = cg.RefFreqUp.HasValue ? cg.RefFreqUp.Value * 1e-6 : 950;
+                if (cg != null)
+                {
+                    this.txtFu1.EditValue = cg.TarFreqUp.HasValue ? cg.TarFreqUp.Value * 1e-6 : 950;
+                    this.txtFu2.EditValue = cg.RefFreqUp.HasValue ? cg.RefFreqUp.Value * 1e-6 : 950;
+                }
 
                 var xlList = XlCache.GetAllAsync().Result.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
                 if (xlall.Count() == 0) return;
-                if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
+                if (cg != null && cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
                 {
                     mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
                 }
@@ -70,7 +73,7 @@ namespace XdCxRhDW.App.UserControl
                     mainTle = xlList.First().TwoLine;
                 }
 
-                if (cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
+                if (cg != null && cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
                 {
                     adjaTle1 = xlList.First(m => m.SatCode == cg.Adja1Code.Value).TwoLine;
                 }
@@ -102,7 +105,7 @@ namespace XdCxRhDW.App.UserControl
                 return (false, "采集时刻不能为空!");
             }
             var refsta = txtRefLocation1.CheckLonLat("参考站");
-            if ( !refsta.Item1)
+            if (!refsta.Item1)
             {
                 return refsta;
             }

+ 8 - 5
XdCxRhDW.App/UserControl/X3DFGDOPParam .cs

@@ -57,13 +57,16 @@ namespace XdCxRhDW.App.UserControl
                 {
                     this.txtRefLocation1.Text = $"{station.RefLon},{station.RefLat}";
                 }
-                this.txtFu1.EditValue = cg.TarFreqUp.HasValue ? cg.TarFreqUp.Value * 1e-6 : 950;
-                this.txtFu2.EditValue = cg.RefFreqUp.HasValue ? cg.RefFreqUp.Value * 1e-6 : 950;
+                if (cg != null)
+                {
+                    this.txtFu1.EditValue = cg.TarFreqUp.HasValue ? cg.TarFreqUp.Value * 1e-6 : 950;
+                    this.txtFu2.EditValue = cg.RefFreqUp.HasValue ? cg.RefFreqUp.Value * 1e-6 : 950;
+                }
 
                 var xlList = XlCache.GetAllAsync().Result.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
                 if (xlall.Count() == 0) return;
-                if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
+                if (cg != null && cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
                 {
                     mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
                 }
@@ -72,7 +75,7 @@ namespace XdCxRhDW.App.UserControl
                     mainTle = xlList.First().TwoLine;
                 }
 
-                if (cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
+                if (cg != null && cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
                 {
                     adjaTle1 = xlList.First(m => m.SatCode == cg.Adja1Code.Value).TwoLine;
                 }
@@ -80,7 +83,7 @@ namespace XdCxRhDW.App.UserControl
                 {
                     adjaTle1 = xlList.First().TwoLine;
                 }
-                if (cg.Adja2Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja2Code.Value))
+                if (cg != null && cg.Adja2Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja2Code.Value))
                 {
                     adjaTle2 = xlList.First(m => m.SatCode == cg.Adja2Code.Value).TwoLine;
                 }

+ 3 - 3
XdCxRhDW.App/UserControl/X3GDOPParam.cs

@@ -59,7 +59,7 @@ namespace XdCxRhDW.App.UserControl
                 var xlList = XlCache.GetAllAsync().Result.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
                 xlall.AddRange(xlList.Select(m => m.TwoLine));
                 if (xlall.Count() == 0) return;
-                if (cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
+                if (cg != null && cg.MainCode.HasValue && xlList.Any(m => m.SatCode == cg.MainCode.Value))
                 {
                     mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
                 }
@@ -68,7 +68,7 @@ namespace XdCxRhDW.App.UserControl
                     mainTle = xlList.First().TwoLine;
                 }
 
-                if (cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
+                if (cg != null && cg.Adja1Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja1Code.Value))
                 {
                     adjaTle1 = xlList.First(m => m.SatCode == cg.Adja1Code.Value).TwoLine;
                 }
@@ -76,7 +76,7 @@ namespace XdCxRhDW.App.UserControl
                 {
                     adjaTle1 = xlList.First().TwoLine;
                 }
-                if (cg.Adja2Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja2Code.Value))
+                if (cg != null && cg.Adja2Code.HasValue && xlList.Any(m => m.SatCode == cg.Adja2Code.Value))
                 {
                     adjaTle2 = xlList.First(m => m.SatCode == cg.Adja2Code.Value).TwoLine;
                 }

+ 4 - 2
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -399,7 +399,6 @@
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="TcpServer.cs" />
     <Compile Include="UserControl\CtrlCgRes.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -649,7 +648,10 @@
     <Content Include="xcorr\enc.exe">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="xcorr\encreadme.txt" />
+    <None Include="xcorr\enc.txt" />
+    <None Include="xcorr\XcorrCpu.txt" />
+    <Content Include="xcorr\ReSample.exe" />
+    <None Include="xcorr\ReSample.txt" />
     <Content Include="xcorr\XcorrCpu.exe">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>

二进制
XdCxRhDW.App/xcorr/ReSample.exe


+ 1 - 0
XdCxRhDW.App/xcorr/ReSample.txt

@@ -0,0 +1 @@
+ReSample.exe [inFile] [outFile] [²åÈëÒò×Ó] [³éÈ¡Òò×Ó]

二进制
XdCxRhDW.App/xcorr/XcorrCpu.exe


+ 8 - 0
XdCxRhDW.App/xcorr/XcorrCpu.txt

@@ -0,0 +1,8 @@
+时隙参估(滑动)--起始样点太小会溢出,文件参估推荐使用最后一个
+	0 "Z:/xcorr-d1.dat" "Z:/xcorr-d2.dat" 1562500 1778 20 16384 0 1048576 14
+
+画图
+	1 "Z:/xcorr-d1.dat" "Z:/xcorr-d2.dat" 1562500 1778 20 16384 0 1048576 14 "Z:/res.txt"
+
+文件参估
+	2 "Z:/xcorr-d1.dat" "Z:/xcorr-d2.dat" 1562500 1778 20 16384 1048576 14

+ 0 - 0
XdCxRhDW.App/xcorr/encreadme.txt → XdCxRhDW.App/xcorr/enc.txt


+ 73 - 0
XdCxRhDW.Core/Api/变采样/ReSampleHelper.cs

@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Core.Api
+{
+    /// <summary>
+    /// 星历推算帮助类.该类调用了Tle2XYZ.exe进程
+    /// </summary>
+    public static class ReSampleHelper
+    {
+        private static readonly DateTime dtZero = new DateTime(1970, 1, 1, 0, 0, 0, 0);
+        private static string exePath = "xcorr";
+        private const string exeName = "ReSample.exe";
+        /// <summary>
+        /// 设置【ReSample.exe】文件所在路径,支持相对路径
+        /// </summary>
+        public static void SetExePath(string path)
+        {
+            if (string.IsNullOrWhiteSpace(path)) return;
+            if (path.StartsWith("\\"))//相对路径要么开头不带\,要么是 .\
+                path = path.Remove(0, 1);
+            exePath = path;
+        }
+        /// <summary>
+        /// 变采样
+        /// </summary>
+        /// <param name="inFile">输入文件</param>
+        /// <param name="outFile">输出文件</param>
+        /// <param name="insertFactor">插入因子</param>
+        /// <param name="extFactor">抽取因子</param>
+        /// <returns>成功后返回文件,失败后返回null</returns>
+        public static string Resample(string inFile,string outFile,int insertFactor,int extFactor)
+        {
+            if (string.IsNullOrWhiteSpace(exePath))
+                throw new Exception($"请先调用SetExePath指定{exeName}进程所在路径,支持相对路径");
+            if (!Directory.Exists(exePath))
+                throw new Exception($"路径[{exePath}]不存在");
+            var exeFile = Path.Combine(exePath, exeName);
+            if (!File.Exists(exeFile))
+                throw new Exception($"文件[{exeFile}]不存在");
+            Process p = new Process();
+            p.StartInfo.WorkingDirectory = exePath;
+            p.StartInfo.FileName = exeFile;
+            p.StartInfo.Arguments = $"'{inFile}' '{outFile}' {insertFactor} {extFactor}";
+            p.StartInfo.CreateNoWindow = true;
+            p.StartInfo.RedirectStandardError = true;
+            p.StartInfo.RedirectStandardOutput = true;
+            p.StartInfo.UseShellExecute = false;
+            p.Start();
+            var succeed = p.WaitForExit(10000);
+            if (!succeed)
+            {
+                throw new Exception($"进程[{exeName}]超时未完成!");
+            }
+            var res=p.StandardOutput.ReadToEnd();
+            if (res.StartsWith("1:"))
+            {
+                return outFile;
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+    }
+}

+ 21 - 7
XdCxRhDW.Core/Api/检测Cpu参估/XcorrUtils.cs

@@ -50,10 +50,22 @@ namespace XdCxRhDW.Core.Api
             cafp = new Process();
             await Task.Run(() =>
             {
-                if (xs.smpStart < 10)
-                    xs.smpStart = 10;//有BUG
+                int flag = 0;
+                if (xs.smpStart == 0)
+                {
+                    flag = 2;//文件参估,避免滑动时溢出
+                }
+                else
+                {
+                    var minStart = xs.dtRange / 2 / 1e6 * xs.samplingRate;
+                    if (xs.smpStart < minStart)//滑动计算起时值必须要大于等于此数
+                    {
+                        xs.smpStart = (long)minStart;
+                    }
+                }
+                
                 cafp.StartInfo.FileName = Path.Combine(cafp.StartInfo.WorkingDirectory, "xcorr\\XcorrCpu.exe");
-                cafp.StartInfo.Arguments = $"0 \"{xs.file1}\" \"{xs.file2}\" {(Int64)(xs.samplingRate)} {xs.dtCenter} {xs.dtRange} {xs.dfRange} {xs.smpStart} {xs.smpCount} {xs.snrThreshold}";
+                cafp.StartInfo.Arguments = $"{flag} \"{xs.file1}\" \"{xs.file2}\" {(Int64)(xs.samplingRate)} {xs.dtCenter} {xs.dtRange} {xs.dfRange} {xs.smpStart} {xs.smpCount} {xs.snrThreshold}";
                 cafp.StartInfo.CreateNoWindow = true;
                 cafp.StartInfo.RedirectStandardError = true;
                 cafp.StartInfo.RedirectStandardOutput = true;
@@ -141,7 +153,9 @@ namespace XdCxRhDW.Core.Api
             {
                 case DmcType.DAMA:
                     dmcCmd = "dm";
-                    pArguments = $"{dmcCmd} \"{fileName}\"";// -f {fs}" -c --dmfirst";
+                    if (fsHz != 96000)
+                        throw new Exception("DAMA只支持96K采样率");
+                    pArguments = $"{dmcCmd} \"{fileName}\" -c true";//-c包含ccow
                     break;
                 case DmcType.IBS:
                     dmcCmd = "nd";
@@ -171,11 +185,11 @@ namespace XdCxRhDW.Core.Api
                  stopWatch.Stop();
                  TimeSpan ts = stopWatch.Elapsed;
                  var str = dmp.StandardOutput.ReadToEnd();
-                 return ConvertDmcResult(dmcType,str, ts.TotalMilliseconds);
+                 return ConvertDmcResult(dmcType, str, ts.TotalMilliseconds);
              });
         }
 
-        private IEnumerable<DmcResult> ConvertDmcResult(DmcType type,string res, double tm)
+        private IEnumerable<DmcResult> ConvertDmcResult(DmcType type, string res, double tm)
         {
             var lines = res.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);
             foreach (var line in lines)
@@ -187,7 +201,7 @@ namespace XdCxRhDW.Core.Api
                 string userName = "";
                 if (items.Length >= 3)
                     userName = items[2];
-                var item= new DmcResult(start, length, userName, (int)tm);
+                var item = new DmcResult(start, length, userName, (int)tm);
                 if (type == DmcType.DAMA)
                     item.SigType = "BPSK";
                 else

+ 17 - 2
XdCxRhDW.Core/HttpHelper.cs

@@ -13,12 +13,12 @@ namespace XdCxRhDW.Core
 {
     public class HttpHelper
     {
-        public static async Task<AjaxResult<T>> PostRequestAsync<T>(string url, object dto)
+        public static async Task<AjaxResult<T>> PostRequestAsync<T>(string url, object dto,int timeoutSeconds=30)
         {
             var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
             var handler = new HttpClientHandler() { UseCookies = false };
             HttpClient client = new HttpClient(handler);
-            client.Timeout = TimeSpan.FromSeconds(20);
+            client.Timeout = TimeSpan.FromSeconds(timeoutSeconds);
             var message = new HttpRequestMessage(HttpMethod.Post, url);
             message.Content = content;
 
@@ -29,12 +29,27 @@ namespace XdCxRhDW.Core
             return AjaxResult;
         }
 
+        /// <summary>
+        /// 上传文件,wav文件会自动去掉44字节头
+        /// </summary>
+        /// <param name="localFile"></param>
+        /// <param name="uploadUrl"></param>
+        /// <param name="timeoutSeconds"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+
         public static async Task<string> UploadFileAsync(string localFile, string uploadUrl, int timeoutSeconds = 30)
         {
             try
             {
                 // 添加文件内容到 MultipartFormDataContent
+                FileInfo info = new FileInfo(localFile);
+                bool isWav = info.Extension.ToLower() == ".wav";
                 byte[] fileBytes = File.ReadAllBytes(localFile);
+                if (isWav)
+                {
+                    fileBytes = fileBytes.Skip(44).ToArray();//wav文件有44字节头
+                }
                 MultipartFormDataContent content = new MultipartFormDataContent();
                 ByteArrayContent fileContent = new ByteArrayContent(fileBytes);
                 content.Add(fileContent, "file", Path.GetFileName(localFile));

+ 1 - 0
XdCxRhDW.Core/XdCxRhDW.Core.csproj

@@ -48,6 +48,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Api\变采样\ReSampleHelper.cs" />
     <Compile Include="Api\检测Cpu参估\ImageResult.cs" />
     <Compile Include="Api\检测Cpu参估\CafResult.cs" />
     <Compile Include="Api\检测Cpu参估\CorResult.cs" />

+ 9 - 15
XdCxRhDW.Repostory/EFContext/RHDWContext.cs

@@ -24,13 +24,13 @@ namespace XdCxRhDW.Repostory.EFContext
     /// <summary>
     /// 基础表上下文(id为int)
     /// </summary>
-    public class RHDWContext: DbContext
+    public class RHDWContext : DbContext
     {
         public RHDWContext() : base("DbCon") //配置使用的连接名
         {
 
         }
-       
+
         protected override void OnModelCreating(DbModelBuilder modelBuilder)
         {
             this.Database.Log = msg =>
@@ -40,10 +40,11 @@ namespace XdCxRhDW.Repostory.EFContext
             modelBuilder.Configurations.AddFromAssembly(typeof(RHDWContext).Assembly);//自动加载SqliteConfiguration
 
             var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists<RHDWContext>(modelBuilder);
-            Database.SetInitializer(sqliteConnectionInitializer); 
+            Database.SetInitializer(sqliteConnectionInitializer);
             DbInterception.Add(new SqliteInterceptor());//拦截器
             base.OnModelCreating(modelBuilder);
         }
+        public DbSet<XlInfo> XlInfos { set; get; }
 
         public DbSet<TaskInfo> TaskInfos { set; get; }
 
@@ -53,15 +54,8 @@ namespace XdCxRhDW.Repostory.EFContext
 
         public DbSet<TargetInfo> TargetInfos { get; set; }
 
-        //public DbSet<StationRes> StationRes { get; set; }
-        //public DbSet<CxRes> CxRes { get; set; }
-        //public DbSet<CgRes> CgRes { get; set; }
-        //public DbSet<PosRes> PosRes { get; set; }
-
-
         public DbSet<SysSetings> SysSetings { get; set; }
 
-
     }
 
     /// <summary>
@@ -77,16 +71,16 @@ namespace XdCxRhDW.Repostory.EFContext
             return new RHDWPartContext(con);
         }
 
-        public static RHDWPartContext GetContext(DateTime partTime)
+        public static RHDWPartContext GetContext(DateTime partTime, string prefix = "")
         {
-            var connectionString = $@"Data Source=|DataDirectory|\DbPart\{partTime.Year}\{partTime:MMdd}.db";
+            var connectionString = $@"Data Source=|DataDirectory|\DbPart\{partTime.Year}\{prefix}{partTime:MMdd}.db";
             SQLiteConnection con = new SQLiteConnection(connectionString);
             return new RHDWPartContext(con);
         }
 
         private RHDWPartContext(DbConnection con)
-        :base(con,true)
-        { 
+        : base(con, true)
+        {
         }
 
 
@@ -104,7 +98,7 @@ namespace XdCxRhDW.Repostory.EFContext
             DbInterception.Add(new SqliteInterceptor());//拦截器
             base.OnModelCreating(modelBuilder);
         }
-        public DbSet<XlInfo> XlInfos { set; get; }
+
         public DbSet<StationRes> StationRes { get; set; }
         public DbSet<CxRes> CxRes { get; set; }
         public DbSet<CgRes> CgRes { get; set; }

+ 5 - 1
XdCxRhDW.Repostory/Model/XlInfo.cs

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDW.Repostory.Model
 {
     [Table("XlInfo")]
-    public class XlInfo : BaseModel<long>
+    public class XlInfo : BaseModel
     {
         [Display(Name = "卫星编号",AutoGenerateField = false)]
         public int SatCode { get; set; }
@@ -23,6 +23,9 @@ namespace XdCxRhDW.Repostory.Model
         [Display(Name = "发布时间(北京)")]
         public DateTime TimeBJ { get; set; }
 
+        [Display(Name = "轨道经度")]
+        public double? Lon { get; set; }
+
         [Display(Name = "双行根数1")]
         public string Line1 { get; set; }
 
@@ -30,6 +33,7 @@ namespace XdCxRhDW.Repostory.Model
         public string Line2 { get; set; }
         [Display(AutoGenerateField = false)]
 
+
         public string TwoLine => $"{Line1};{Line2}";
 
     }

+ 9 - 25
XdCxRhDW.Repostory/XlCache.cs

@@ -17,29 +17,15 @@ namespace XdCxRhDW.Repostory
         /// </summary>
         /// <param name="maxCount">最大条数.超过此条数时不再继续查询,为0则不限制条数</param>
         /// <returns></returns>
-        public static async Task<List<XlInfo>> GetAllAsync(int maxCount = 2000)
+        public static async Task<List<XlInfo>> GetAllAsync()
         {
             try
             {
-                List<XlInfo> list = new List<XlInfo>();
-                var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
-                if (!Directory.Exists(dir)) return list;
-                var yearDirs = Directory.EnumerateDirectories(dir).OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name));//年目录,倒叙排列
-                foreach (var yearDir in yearDirs)
+                using (RHDWContext db = new RHDWContext())
                 {
-                    //每一天的db文件,倒序排列
-                    var dayFiles = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, yearDir), "*.db").OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name.Substring(0, 4)));
-                    foreach (var dayFile in dayFiles)
-                    {
-                        using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile))
-                        {
-                            list.AddRange(await db.XlInfos.ToListAsync());
-                            if (maxCount > 0 && list.Count >= maxCount)
-                                return list;
-                        }
-                    }
+                    var res = await db.XlInfos.OrderByDescending(p => p.TimeBJ).OrderByDescending(p => p.Lon).ToListAsync();
+                    return res;
                 }
-                return list;
             }
             catch (Exception ex)
             {
@@ -59,13 +45,11 @@ namespace XdCxRhDW.Repostory
         {
             try
             {
-
-                var list = await GetAllAsync(0);
-                if (!list.Any()) return null;
-                var mainXl = list.Where(w => w.SatCode == satCode);
-                var minSec = mainXl.Min(p => Math.Abs((p.TimeBJ - timeBj).TotalSeconds));
-                var find = mainXl.FirstOrDefault(p => Math.Abs((p.TimeBJ - timeBj).TotalSeconds) == minSec);
-                return find;
+                using (RHDWContext db = new RHDWContext())
+                {
+                    var res= await db.XlInfos.Where(p => p.SatCode == satCode).OrderBy(p => (p.TimeBJ - timeBj).Duration()).FirstOrDefaultAsync();
+                    return res;
+                }
             }
             catch (Exception ex)
             {

+ 2 - 0
XdCxRhDW.WebApi/Controllers/DetectCgController.cs

@@ -143,5 +143,7 @@ namespace XdCxRhDW.WebApi.Controllers
             return Success<IEnumerable<DetectResDto>>(list);
 
         }
+
+        public async Task<AjaxResult<string>>
     }
 }

+ 1 - 0
XdCxRhDW.WebApi/Controllers/FileController.cs

@@ -74,5 +74,6 @@ namespace XdCxRhDW.WebApi.Controllers
             });
             return Success(fileDto);
         }
+
     }
 }

+ 1 - 1
XdCxRhDW.WebApi/Controllers/PosController.cs

@@ -1782,7 +1782,7 @@ namespace XdCxRhDW.App.WebAPI
         /// <summary>
         /// 查询定位结果
         /// </summary>
-        /// <param name="dto"></param>
+        /// <param name="dto"><see cref="PosResQueryDto"/>查询参数</param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
         [HttpPost]

+ 76 - 2
XdCxRhDW.WebApi/Controllers/XlController.cs

@@ -2,7 +2,9 @@
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Data.Entity;
+using System.Data.Entity.Migrations;
 using System.Data.SqlClient;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -12,6 +14,8 @@ using XdCxRhDw.Dto;
 using XdCxRhDW.App.Api;
 using XdCxRhDW.Core.Api;
 using XdCxRhDW.Dto;
+using XdCxRhDW.Repostory.EFContext;
+using XdCxRhDW.Repostory.Model;
 
 namespace XdCxRhDW.WebApi.Controllers
 {
@@ -21,7 +25,77 @@ namespace XdCxRhDW.WebApi.Controllers
     public class XlController : BaseController
     {
         /// <summary>
-        /// 推算某个时间点星历
+        /// 导入Tle星历文件
+        /// </summary>
+        /// <param name="file">上传星历文件后返回的名称</param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<AjaxResult<RecordRes>> ImportTleAsync([FromBody] string file)
+        {
+            //https://www.space-track.org/documentation#tle网站上有星历文件格式说明
+            string line = null;
+            try
+            {
+                var count = await Task.Run(async () =>
+                 {
+                     var lines = File.ReadAllLines(GetLocalFile(file)).ToList();
+                     lines.RemoveAll(p => string.IsNullOrWhiteSpace(p));
+                     List<XlInfo> tmp = new List<XlInfo>();
+                     for (int i = 0; i < lines.Count; i += 3)
+                     {
+                         line = lines[i];
+                         var satName = lines[i].Trim();
+                         if (satName.StartsWith("0 "))
+                             satName = satName.Substring(2).Trim();
+                         if (satName.StartsWith("TBA"))//待发布的卫星
+                             continue;
+                         XlInfo xl = new XlInfo()
+                         {
+                             SatName = satName,
+                             Line1 = lines[i + 1],
+                             Line2 = lines[i + 2],
+                             SatCode = Convert.ToInt32(lines[i + 1].Substring(2, 5))
+                         };
+                         var timeStr = lines[i + 1].Substring(18, 14).Replace(" ", "");//https://www.space-track.org/documentation#tle星历接口中说这里面可以接受空格
+                         var yearStr = timeStr.Substring(0, 2);
+                         var dayStr = timeStr.Substring(2, timeStr.Length - 2);
+                         var day = Convert.ToDouble(dayStr);
+                         var year = 2000 + Convert.ToInt32(yearStr);
+                         DateTime dt = new DateTime(year, 1, 1, 0, 0, 0);
+                         dt = dt.AddDays(day);
+                         xl.TimeBJ = dt.AddHours(8);
+                         tmp.Add(xl);
+                     }
+                     using (RHDWContext db = new RHDWContext())
+                     {
+                         db.XlInfos.AddRange(tmp);
+                         await db.SaveChangesAsync();
+                     }
+                     return tmp.Count;
+                 });
+                Serilog.Log.Information($"星历导入成功,共{count}条");
+                return Success(new RecordRes(count));
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, $"{line}星历导入异常");
+                return Error<RecordRes>(ex.Message);
+
+            }
+            finally
+            {
+                try
+                {
+                    File.Delete(GetLocalFile(file));
+                }
+                catch
+                { }
+            }
+
+        }
+
+        /// <summary>
+        /// 推算某个时间点XYZ星历
         /// </summary>
         /// <param name="dto">推算参数</param>
         /// <returns></returns>
@@ -51,7 +125,7 @@ namespace XdCxRhDW.WebApi.Controllers
         }
 
         /// <summary>
-        /// 推算某个时间段星星历
+        /// 推算某个时间段XYZ星星历
         /// </summary>
         /// <param name="dto">推算参数</param>
         /// <returns></returns>

+ 1 - 1
XdCxRhDw.Dto/CpuCgDto.cs

@@ -13,7 +13,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// CPU参估参数
+    /// CPU参估参数模型
     /// </summary>
     public class CpuCgDto : IValidatableObject//有复杂验证需要实现IValidatableObject接口,没有则不用
     {

+ 1 - 1
XdCxRhDw.Dto/CpuCgResDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// CPU参估结果DTO
+    /// CPU参估结果模型
     /// </summary>
     public class CpuCgResDto
     {

+ 1 - 1
XdCxRhDw.Dto/DetectDto.cs

@@ -10,7 +10,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 检测计算DTO
+    /// 检测计算模型
     /// </summary>
     public class DetectDto
     {

+ 1 - 1
XdCxRhDw.Dto/DetectResDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 检测结果Dto
+    /// 检测结果模型
     /// </summary>
     public class DetectResDto
     {

+ 1 - 1
XdCxRhDw.Dto/EphResDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 星历推算结果DTO
+    /// 星历推算结果模型
     /// </summary>
     public class EphResDto
     {

+ 1 - 1
XdCxRhDw.Dto/FileDownloadDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 文件下载参数DTO
+    /// 文件下载参数模型
     /// </summary>
     public class FileDownloadDto
     {

+ 1 - 1
XdCxRhDw.Dto/FileUploadResDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 文件上传结果DTO
+    /// 文件上传结果模型
     /// </summary>
     public class FileUploadResDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/RHNoParPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 融合无参定位参数DTO(含星历)
+    /// 融合无参定位参数模型(含星历)
     /// </summary>
     public class RHNoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/RHNoXlNoParPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 融合无参定位参数DTO(无星历)
+    /// 融合无参定位参数模型(无星历)
     /// </summary>
     public class RHNoXlNoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/RHNoXlPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 融合带参定位参数DTO(无星历)
+    /// 融合带参定位参数模型(无星历)
     /// </summary>
     public class RHNoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/RHPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 融合带参定位参数DTO(含星历)
+    /// 融合带参定位参数模型(含星历)
     /// </summary>
     public class RHPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/StationResDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 站点信息
+    /// 站点信息模型
     /// </summary>
     public class StationResDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X1D1NoParPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 一星一地无参定位参数DTO(含星历)
+    /// 一星一地无参定位参数模型(含星历)
     /// </summary>
     public class X1D1NoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X1D1NoXlNoParPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    ///一星一地无参定位参数DTO(无星历)
+    ///一星一地无参定位参数模型(无星历)
     /// </summary>
     public class X1D1NoXlNoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X1D1NoXlPosDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 一星一地带参定位参数DTO(无星历)
+    /// 一星一地带参定位参数模型(无星历)
     /// </summary>
     public class X1D1NoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X1D1PosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 一星一地带参定位参数DTO(含星历)
+    /// 一星一地带参定位参数模型(含星历)
     /// </summary>
     public class X1D1PosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2D1NoParPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 两星一地无参定位参数DTO(含星历)
+    /// 两星一地无参定位参数模型(含星历)
     /// </summary>
     public class X2D1NoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2D1NoXlNoParlPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 两星一地无参定位参数DTO(无星历)
+    /// 两星一地无参定位参数模型(无星历)
     /// </summary>
     public class X2D1NoXlNoParlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2D1NoXlPosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 两星一地定位参数DTO
+    /// 两星一地定位参数模型
     /// </summary>
     public class X2D1NoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2D1PosDto.cs

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 两星一地带参定位参数DTO(含星历)
+    /// 两星一地带参定位参数模型(含星历)
     /// </summary>
     public class X2D1PosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2DtoDfoNoXlPosDto.cs

@@ -9,7 +9,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 双星时频差带参定位参数DTO(无星历)
+    /// 双星时频差带参定位参数模型(无星历)
     /// </summary>
     public class X2DtoDfoNoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X2DtoDfoPosDto.cs

@@ -9,7 +9,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    ///  双星时频差带参定位参数DTO(无星历)
+    ///  双星时频差带参定位参数模型(无星历)
     /// </summary>
     public class X2DtoDfoPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDfoNoXlPosDto.cs

@@ -9,7 +9,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 三星双频差带参定位参数DTO(无星历)
+    /// 三星双频差带参定位参数模型(无星历)
     /// </summary>
     public class X3TwoDfoNoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDfoPosDto.cs

@@ -9,7 +9,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    ///  三星双频差带参定位参数DTO(含星历)
+    ///  三星双频差带参定位参数模型(含星历)
     /// </summary>
     public class X3TwoDfoPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDtoNoParPosDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 三星双时差无参定位参数DTO(含星历)
+    /// 三星双时差无参定位参数模型(含星历)
     /// </summary>
     public class X3TwoDtoNoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlNoParPosDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 三星双时差无参定位参数DTO(无星历)
+    /// 三星双时差无参定位参数模型(无星历)
     /// </summary>
     public class X3TwoDtoNoXlNoParPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDtoNoXlPosDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 三星双时差带参定位参数DTO(无星历)
+    /// 三星双时差带参定位参数模型(无星历)
     /// </summary>
     public class X3TwoDtoNoXlPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosDto/X3TwoDtoPosDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 三星双时差带参定位参数DTO(含星历)
+    /// 三星双时差带参定位参数模型(含星历)
     /// </summary>
     public class X3TwoDtoPosDto
     {

+ 1 - 1
XdCxRhDw.Dto/PosResDto.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 定位结果DTO
+    /// 定位结果模型
     /// </summary>
     public class PosResDto
     {

+ 13 - 2
XdCxRhDw.Dto/PosResQueryDto.cs

@@ -8,15 +8,16 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 定位结果查询参数DTO
+    /// 定位结果查询参数模型
     /// </summary>
-    public class PosResQueryDto
+    public class PosResQueryDto:IValidatableObject
     {
         /// <summary>
         /// 任务编号
         /// </summary>
         [RangeInt(0)]
         public int TaskInfoID { get; set; }
+
         /// <summary>
         /// 开始时间
         /// </summary>
@@ -27,5 +28,15 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public DateTime EndTime { get; set; }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="validationContext"></param>
+        /// <returns></returns>
+        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
+        {
+            if ((EndTime - BeginTime).TotalDays > 10)
+                yield return new ValidationResult("时间跨度不能超过10天!", new[] { nameof(BeginTime),nameof(EndTime) });
+        }
     }
 }

+ 35 - 0
XdCxRhDw.Dto/RecordCount.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto
+{
+    /// <summary>
+    /// 操作成功后返回的记录模型
+    /// </summary>
+    public class RecordRes
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public RecordRes()
+        { 
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="count"></param>
+        public RecordRes(int count)
+        {
+            Count = count;
+        }
+
+        /// <summary>
+        /// 成功条数
+        /// </summary>
+        public int Count { get; set; }
+    }
+}

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

@@ -78,6 +78,7 @@
     <Compile Include="PosResQueryDto.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="EphResDto.cs" />
+    <Compile Include="RecordCount.cs" />
     <Compile Include="SendDto.cs" />
     <Compile Include="PosResDto.cs" />
     <Compile Include="PosDto\RHPosDto.cs" />

+ 1 - 1
XdCxRhDw.Dto/XlCalcDto/XlCalcDto.cs

@@ -8,7 +8,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 星历推算参数(指定时刻)
+    /// 星历推算参数模型(指定时刻)
     /// </summary>
     public class XlCalcDto
     {

+ 1 - 1
XdCxRhDw.Dto/XlCalcDto/XlCalcMultDto.cs

@@ -8,7 +8,7 @@ using XdCxRhDw.Dto.Attribute;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 星历推算参数(一段时间)
+    /// 星历推算参数模型(指定时间段)
     /// </summary>
     public class XlCalcMultDto
     {