zoulei 1 year ago
parent
commit
7d1a8ba41a

+ 1 - 0
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -43,6 +43,7 @@ namespace XdCxRhDW.App.CorTools
 
         private async void MainForm_Load(object sender, EventArgs e)
         {
+            layoutControl1.BestFit();
             this.gcCheckCgRes.Init<CafResult>().UseExportXlsx().UseRowNumber().UseFilter()
                 .UseExportCsv()
                 .AddMenu("时隙参估", SvgHelper.CreateSlotCg(), async () =>

+ 9 - 5
XdCxRhDW.App/ExtensionsDev/MapControlEx.cs

@@ -1308,16 +1308,20 @@ public static class MapControlEx
     public static void DrawDtoPonit(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines)
     {
         string identify = "DrawPoint_";
-        if (lines == null || !lines.Any()) return;
+        if (lines == null ) return;
+        lines = lines.Where(p => p.lon >= -180 && p.lon <= 180);
+        if (!lines.Any()) return;
         var innerData = ctrl.Tag as InnerData;
-
+        int size = 4;
+        if (lines.Count() < 10)
+            size *= 4;
+        else if(lines.Count() < 20) 
+            size *= 2;
         List<MapDot> list = new List<MapDot>();
         var color = ColorHelper.GetColor(title);
         for (int i = 0; i < lines.Count(); i++)
         {
             var p = lines.ElementAt(i);
-            if (p.lon < -180 || p.lon > 180) continue;
-            if (p.lon == 0 && p.lon == 0) continue;
             var mapItem = new MapDot()
             {
                 EnableHighlighting = DefaultBoolean.True,
@@ -1326,7 +1330,7 @@ public static class MapControlEx
                 Visible = true,
                 IsHitTestVisible = true,
                 Fill = color,
-                Size = 4,
+                Size = size,
                 Tag = $"{identify}{title}{lines.ElementAt(i).lon}",
                 Location = new GeoPoint(p.lat, p.lon),
                 ToolTipPattern = $"{title}",

+ 71 - 32
XdCxRhDW.App/UserControl/CtrlHome.Designer.cs

@@ -60,6 +60,7 @@ namespace XdCxRhDW.App.UserControl
             this.btnGDOP = new DevExpress.XtraBars.BarButtonItem();
             this.btnShowCgRes = new DevExpress.XtraBars.BarButtonItem();
             this.btnShowCxRes = new DevExpress.XtraBars.BarButtonItem();
+            this.btnPos = new DevExpress.XtraBars.BarButtonItem();
             this.btnSearch = new DevExpress.XtraEditors.SimpleButton();
             this.txtEndTime = new DevExpress.XtraEditors.DateEdit();
             this.txtStartTime = new DevExpress.XtraEditors.DateEdit();
@@ -70,6 +71,7 @@ namespace XdCxRhDW.App.UserControl
             this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
             this.repositoryItemImageEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemImageEdit();
             this.toolTipController1 = new DevExpress.Utils.ToolTipController(this.components);
+            this.btnIncludeInvalidate = new DevExpress.XtraEditors.CheckEdit();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
@@ -81,6 +83,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItemStartTime = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItemEndTime = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
             this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.splitterItem1 = new DevExpress.XtraLayout.SplitterItem();
             this.splitterItem2 = new DevExpress.XtraLayout.SplitterItem();
@@ -89,7 +92,6 @@ namespace XdCxRhDW.App.UserControl
             this.htmlTemplateCollection1 = new DevExpress.Utils.Html.HtmlTemplateCollection();
             this.htmlTemplate1 = new DevExpress.Utils.Html.HtmlTemplate();
             this.popupMenu2 = new DevExpress.XtraBars.PopupMenu(this.components);
-            this.btnPos = new DevExpress.XtraBars.BarButtonItem();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtTimeCho.Properties)).BeginInit();
@@ -104,6 +106,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.gridHomeTask)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.repositoryItemImageEdit1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.btnIncludeInvalidate.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
@@ -115,6 +118,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemStartTime)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemEndTime)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem2)).BeginInit();
@@ -132,6 +136,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControl1.Controls.Add(this.mapControl1);
             this.layoutControl1.Controls.Add(this.gridHomePosRes);
             this.layoutControl1.Controls.Add(this.gridHomeTask);
+            this.layoutControl1.Controls.Add(this.btnIncludeInvalidate);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.layoutControl1.Location = new System.Drawing.Point(0, 0);
             this.layoutControl1.Name = "layoutControl1";
@@ -144,7 +149,7 @@ namespace XdCxRhDW.App.UserControl
             // txtTimeCho
             // 
             this.txtTimeCho.EditValue = 1;
-            this.txtTimeCho.Location = new System.Drawing.Point(245, 212);
+            this.txtTimeCho.Location = new System.Drawing.Point(220, 212);
             this.txtTimeCho.MenuManager = this.barManager1;
             this.txtTimeCho.Name = "txtTimeCho";
             this.txtTimeCho.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -278,9 +283,16 @@ namespace XdCxRhDW.App.UserControl
             this.btnShowCxRes.Name = "btnShowCxRes";
             this.btnShowCxRes.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnShowCxRes_ItemClick);
             // 
+            // btnPos
+            // 
+            this.btnPos.Caption = "手动定位";
+            this.btnPos.Id = 14;
+            this.btnPos.Name = "btnPos";
+            this.btnPos.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnPos_ItemClick);
+            // 
             // btnSearch
             // 
-            this.btnSearch.Location = new System.Drawing.Point(770, 212);
+            this.btnSearch.Location = new System.Drawing.Point(836, 212);
             this.btnSearch.Name = "btnSearch";
             this.btnSearch.Size = new System.Drawing.Size(84, 21);
             this.btnSearch.StyleController = this.layoutControl1;
@@ -291,7 +303,7 @@ namespace XdCxRhDW.App.UserControl
             // txtEndTime
             // 
             this.txtEndTime.EditValue = null;
-            this.txtEndTime.Location = new System.Drawing.Point(615, 212);
+            this.txtEndTime.Location = new System.Drawing.Point(590, 212);
             this.txtEndTime.MenuManager = this.barManager1;
             this.txtEndTime.Name = "txtEndTime";
             this.txtEndTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -305,7 +317,7 @@ namespace XdCxRhDW.App.UserControl
             // txtStartTime
             // 
             this.txtStartTime.EditValue = null;
-            this.txtStartTime.Location = new System.Drawing.Point(405, 212);
+            this.txtStartTime.Location = new System.Drawing.Point(380, 212);
             this.txtStartTime.MenuManager = this.barManager1;
             this.txtStartTime.Name = "txtStartTime";
             this.txtStartTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -318,17 +330,17 @@ namespace XdCxRhDW.App.UserControl
             // 
             // mapControl1
             // 
-            this.mapControl1.Location = new System.Drawing.Point(185, 2);
+            this.mapControl1.Location = new System.Drawing.Point(160, 2);
             this.mapControl1.Name = "mapControl1";
-            this.mapControl1.Size = new System.Drawing.Size(850, 170);
+            this.mapControl1.Size = new System.Drawing.Size(875, 170);
             this.mapControl1.TabIndex = 6;
             // 
             // gridHomePosRes
             // 
-            this.gridHomePosRes.Location = new System.Drawing.Point(186, 236);
+            this.gridHomePosRes.Location = new System.Drawing.Point(161, 236);
             this.gridHomePosRes.MainView = this.gridView2;
             this.gridHomePosRes.Name = "gridHomePosRes";
-            this.gridHomePosRes.Size = new System.Drawing.Size(848, 284);
+            this.gridHomePosRes.Size = new System.Drawing.Size(873, 284);
             this.gridHomePosRes.TabIndex = 5;
             this.gridHomePosRes.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView2});
@@ -347,7 +359,7 @@ namespace XdCxRhDW.App.UserControl
             this.gridHomeTask.Name = "gridHomeTask";
             this.gridHomeTask.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.repositoryItemImageEdit1});
-            this.gridHomeTask.Size = new System.Drawing.Size(167, 494);
+            this.gridHomeTask.Size = new System.Drawing.Size(142, 494);
             this.gridHomeTask.TabIndex = 4;
             this.gridHomeTask.ToolTipController = this.toolTipController1;
             this.gridHomeTask.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -371,6 +383,17 @@ namespace XdCxRhDW.App.UserControl
             // 
             this.toolTipController1.GetActiveObjectInfo += new DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventHandler(this.toolTipController1_GetActiveObjectInfo);
             // 
+            // btnIncludeInvalidate
+            // 
+            this.btnIncludeInvalidate.EditValue = true;
+            this.btnIncludeInvalidate.Location = new System.Drawing.Point(747, 212);
+            this.btnIncludeInvalidate.Name = "btnIncludeInvalidate";
+            this.btnIncludeInvalidate.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
+            this.btnIncludeInvalidate.Properties.Caption = "包含无效点";
+            this.btnIncludeInvalidate.Size = new System.Drawing.Size(83, 20);
+            this.btnIncludeInvalidate.StyleController = this.layoutControl1;
+            this.btnIncludeInvalidate.TabIndex = 11;
+            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
@@ -389,9 +412,9 @@ namespace XdCxRhDW.App.UserControl
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.mapControl1;
-            this.layoutControlItem3.Location = new System.Drawing.Point(183, 0);
+            this.layoutControlItem3.Location = new System.Drawing.Point(158, 0);
             this.layoutControlItem3.Name = "layoutControlItem3";
-            this.layoutControlItem3.Size = new System.Drawing.Size(854, 174);
+            this.layoutControlItem3.Size = new System.Drawing.Size(879, 174);
             this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem3.TextVisible = false;
             // 
@@ -419,7 +442,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlGroup1.Name = "layoutControlGroup1";
             this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup1.Size = new System.Drawing.Size(173, 523);
+            this.layoutControlGroup1.Size = new System.Drawing.Size(148, 523);
             this.layoutControlGroup1.Text = "任务管理";
             this.layoutControlGroup1.CustomButtonClick += new DevExpress.XtraBars.Docking2010.BaseButtonEventHandler(this.layoutControlGroup1_CustomButtonClick);
             // 
@@ -429,7 +452,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlItem1.Name = "layoutControlItem1";
             this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlItem1.Size = new System.Drawing.Size(167, 494);
+            this.layoutControlItem1.Size = new System.Drawing.Size(142, 494);
             this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem1.TextVisible = false;
             // 
@@ -440,10 +463,10 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItemSearch,
             this.layoutControlGroup3,
             this.emptySpaceItem1});
-            this.layoutControlGroup2.Location = new System.Drawing.Point(183, 184);
+            this.layoutControlGroup2.Location = new System.Drawing.Point(158, 184);
             this.layoutControlGroup2.Name = "layoutControlGroup2";
             this.layoutControlGroup2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup2.Size = new System.Drawing.Size(854, 339);
+            this.layoutControlGroup2.Size = new System.Drawing.Size(879, 339);
             this.layoutControlGroup2.Text = "定位结果";
             // 
             // layoutControlItem2
@@ -452,14 +475,14 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem2.Location = new System.Drawing.Point(0, 28);
             this.layoutControlItem2.Name = "layoutControlItem2";
             this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlItem2.Size = new System.Drawing.Size(848, 284);
+            this.layoutControlItem2.Size = new System.Drawing.Size(873, 284);
             this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem2.TextVisible = false;
             // 
             // layoutControlItemSearch
             // 
             this.layoutControlItemSearch.Control = this.btnSearch;
-            this.layoutControlItemSearch.Location = new System.Drawing.Point(580, 0);
+            this.layoutControlItemSearch.Location = new System.Drawing.Point(671, 0);
             this.layoutControlItemSearch.MaxSize = new System.Drawing.Size(90, 26);
             this.layoutControlItemSearch.MinSize = new System.Drawing.Size(90, 26);
             this.layoutControlItemSearch.Name = "layoutControlItemSearch";
@@ -476,10 +499,11 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlGroup3.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
             this.layoutControlItem8,
             this.layoutControlItemStartTime,
-            this.layoutControlItemEndTime});
+            this.layoutControlItemEndTime,
+            this.layoutControlItem4});
             this.layoutControlGroup3.Location = new System.Drawing.Point(0, 0);
             this.layoutControlGroup3.Name = "layoutControlGroup3";
-            this.layoutControlGroup3.Size = new System.Drawing.Size(580, 28);
+            this.layoutControlGroup3.Size = new System.Drawing.Size(671, 28);
             // 
             // layoutControlItem8
             // 
@@ -528,27 +552,45 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItemEndTime.TextToControlDistance = 5;
             this.layoutControlItemEndTime.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             // 
+            // layoutControlItem4
+            // 
+            this.layoutControlItem4.Control = this.btnIncludeInvalidate;
+            this.layoutControlItem4.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem4.CustomizationFormText = "时间选择";
+            this.layoutControlItem4.Location = new System.Drawing.Point(580, 0);
+            this.layoutControlItem4.MaxSize = new System.Drawing.Size(91, 28);
+            this.layoutControlItem4.MinSize = new System.Drawing.Size(91, 28);
+            this.layoutControlItem4.Name = "layoutControlItem4";
+            this.layoutControlItem4.Size = new System.Drawing.Size(91, 28);
+            this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem4.Spacing = new DevExpress.XtraLayout.Utils.Padding(4, 0, 2, 0);
+            this.layoutControlItem4.Text = "时间选择";
+            this.layoutControlItem4.TextAlignMode = DevExpress.XtraLayout.TextAlignModeItem.AutoSize;
+            this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem4.TextToControlDistance = 0;
+            this.layoutControlItem4.TextVisible = false;
+            // 
             // emptySpaceItem1
             // 
             this.emptySpaceItem1.AllowHotTrack = false;
-            this.emptySpaceItem1.Location = new System.Drawing.Point(670, 0);
+            this.emptySpaceItem1.Location = new System.Drawing.Point(761, 0);
             this.emptySpaceItem1.Name = "emptySpaceItem1";
-            this.emptySpaceItem1.Size = new System.Drawing.Size(178, 28);
+            this.emptySpaceItem1.Size = new System.Drawing.Size(112, 28);
             this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
             // 
             // splitterItem1
             // 
             this.splitterItem1.AllowHotTrack = true;
-            this.splitterItem1.Location = new System.Drawing.Point(173, 0);
+            this.splitterItem1.Location = new System.Drawing.Point(148, 0);
             this.splitterItem1.Name = "splitterItem1";
             this.splitterItem1.Size = new System.Drawing.Size(10, 523);
             // 
             // splitterItem2
             // 
             this.splitterItem2.AllowHotTrack = true;
-            this.splitterItem2.Location = new System.Drawing.Point(183, 174);
+            this.splitterItem2.Location = new System.Drawing.Point(158, 174);
             this.splitterItem2.Name = "splitterItem2";
-            this.splitterItem2.Size = new System.Drawing.Size(854, 10);
+            this.splitterItem2.Size = new System.Drawing.Size(879, 10);
             // 
             // svgImageCollection1
             // 
@@ -586,13 +628,6 @@ namespace XdCxRhDW.App.UserControl
             this.popupMenu2.Manager = this.barManager1;
             this.popupMenu2.Name = "popupMenu2";
             // 
-            // btnPos
-            // 
-            this.btnPos.Caption = "手动定位";
-            this.btnPos.Id = 14;
-            this.btnPos.Name = "btnPos";
-            this.btnPos.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btnPos_ItemClick);
-            // 
             // CtrlHome
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -619,6 +654,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.gridHomeTask)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.repositoryItemImageEdit1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.btnIncludeInvalidate.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
@@ -630,6 +666,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemStartTime)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItemEndTime)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.splitterItem2)).EndInit();
@@ -688,5 +725,7 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.XtraBars.BarButtonItem btnShowCgRes;
         private DevExpress.XtraBars.BarButtonItem btnShowCxRes;
         private DevExpress.XtraBars.BarButtonItem btnPos;
+        private CheckEdit btnIncludeInvalidate;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
     }
 }

+ 169 - 134
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -30,6 +30,9 @@ using System.Threading.Tasks;
 using System.IO;
 using XdCxRhDW.App.PopupControl;
 using System.Windows.Controls;
+using XdCxRhDW.Core;
+using XdCxRhDw.Dto;
+using System.Web.UI.WebControls;
 namespace XdCxRhDW.App.UserControl
 {
     public partial class CtrlHome : DevExpress.XtraEditors.XtraUserControl
@@ -66,12 +69,12 @@ namespace XdCxRhDW.App.UserControl
                         }
                         gridView2.DeleteSelectedRows();
                     }
-                    catch (Exception ex) 
+                    catch (Exception ex)
                     {
                         Serilog.Log.Error(ex, "表格中删除定位点异常!");
                         DxHelper.MsgBoxHelper.ShowError("删除定位点异常!");
                     }
-                },popupMenu2);
+                }, popupMenu2);
             layoutControl1.UseDefault();
             txtStartTime.UseDefault();
             txtEndTime.UseDefault();
@@ -79,35 +82,6 @@ namespace XdCxRhDW.App.UserControl
             btnDrawDfo.ImageOptions.SvgImage = SvgHelper.LoadFromFile("Image\\DfoLine.svg");
             btnGDOP.ImageOptions.SvgImage = SvgHelper.LoadFromFile("Image\\GDOP.svg");
             btnPos.ImageOptions.SvgImage = SvgHelper.LoadFromFile("Image\\Pos.svg");
-            var mapService = string.Empty;//http://ows.mundialis.de/services/service
-            using (RHDWContext db = new RHDWContext())
-            {
-                mapService = db.SysSetings.FirstOrDefault()?.MapService;
-            }
-            mapControl1.UseDefalutOptions()
-            //.UseCluster()//定位点使用内置聚合
-            .UseClearAll()
-            .UseDistanceLine()
-            .UseMarkDot()
-            .UseExportImg()
-            .UseExportXlsx()
-            .UseExportCsv()
-            .SetMapLayerType(mapService)
-            //.SetMapLayerType("")
-            //.UseHJ(item =>
-            //{
-            //    (double Lon, double Lat) = item;
-            //    PosRes pos = new PosRes();
-            //    pos.PosLon = Lon;
-            //    pos.PosLat = Lat;
-            //    pos.SigTime = DateTime.Now;
-            //    mapControl1.AddHJPosItem(pos);
-            //})
-            .UseDrawRect(rect =>
-            {
-                (double startLon, double startLat, double centerLon, double centerLat, double endLon, double endLat, double lonRange, double latRange) = rect;
-            });
-
             PosObServer.Instance.Sub(PosSubEvent);
         }
 
@@ -128,8 +102,64 @@ namespace XdCxRhDW.App.UserControl
 
         private async void CtrlHome_Load(object sender, EventArgs e)
         {
+            using (RHDWContext db = new RHDWContext())
+            {
+                var settings = await db.SysSetings.FirstOrDefaultAsync();
+                if (settings == null)
+                {
+                    DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP端口信息");
+                    return;
+                }
+                try
+                {
+                    StartOptions options = new StartOptions();
+                    options.Urls.Add($"http://+:{settings.HttpPort}");
+                    WebApp.Start<Startup>(options);
+                }
+                catch (System.Reflection.TargetInvocationException ex)
+                {
+                    Serilog.Log.Error(ex, $"启动Http服务失败!");
+                    if (ex.InnerException is HttpListenerException)
+                    {
+                        DxHelper.MsgBoxHelper.ShowWarning($"{ex.InnerException.Message}");
+                    }
+                    else
+                    {
+                        DxHelper.MsgBoxHelper.ShowWarning($"启动Http服务失败!");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Serilog.Log.Error(ex, $"启动Http服务失败!");
+                    DxHelper.MsgBoxHelper.ShowWarning($"启动Http服务失败!");
+                }
+            }
+            var mapService = string.Empty;//http://ows.mundialis.de/services/service
+            using (RHDWContext db = new RHDWContext())
+            {
+                mapService = db.SysSetings.FirstOrDefault()?.MapService;
+            }
+            mapControl1.UseDefalutOptions()
+           //.UseCluster()//定位点使用内置聚合
+           .UseClearAll()
+           .UseDistanceLine()
+           .UseMarkDot()
+           .UseExportImg()
+           .UseExportXlsx()
+           .UseExportCsv()
+           .SetMapLayerType(mapService)
+           .UseDrawRect(rect =>
+           {
+               (double startLon, double startLat, double centerLon, double centerLat, double endLon, double endLat, double lonRange, double latRange) = rect;
+           });
             gridView1.FocusedRowObjectChanged += GridView1_FocusedRowObjectChanged;
             gridView2.FocusedRowObjectChanged += GridView2_FocusedRowObjectChanged;
+            btnIncludeInvalidate.CheckedChanged += BtnIncludeInvalidate_CheckedChanged;
+            if (mapControl1.Tag == null)
+            {
+                MsgBoxHelper.ShowWarning("null");
+                return;
+            }
             try
             {
                 List<TxInfo> txList = new List<TxInfo>();
@@ -289,41 +319,8 @@ namespace XdCxRhDW.App.UserControl
             gridView1.CustomDrawCell += GridView1_CustomDrawCell;
             gridView1.CustomColumnDisplayText += GridView1_CustomColumnDisplayText;
             gridView1.RowClick += GridView1_RowClick;
-            using (RHDWContext db = new RHDWContext())
-            {
-                var settings = await db.SysSetings.FirstOrDefaultAsync();
-                if (settings == null)
-                {
-                    DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP端口信息");
-                    return;
-                }
-                try
-                {
-                    StartOptions options = new StartOptions();
-                    options.Urls.Add($"http://+:{settings.HttpPort}");
-                    httpServer = WebApp.Start<Startup>(options);
-                }
-                catch (System.Reflection.TargetInvocationException ex)
-                {
-                    httpServer = null;
-                    Serilog.Log.Error(ex, $"启动Http服务失败!");
-                    if (ex.InnerException is HttpListenerException)
-                    {
-                        DxHelper.MsgBoxHelper.ShowWarning($"{ex.InnerException.Message}");
-                    }
-                    else
-                    {
-                        DxHelper.MsgBoxHelper.ShowWarning($"启动Http服务失败!");
-                    }
-                }
-                catch (Exception ex)
-                {
-                    httpServer = null;
-                    Serilog.Log.Error(ex, $"启动Http服务失败!");
-                    DxHelper.MsgBoxHelper.ShowWarning($"启动Http服务失败!");
-                }
-            }
-            txtTimeCho_SelectedIndexChanged(null,null);
+          
+            txtTimeCho_SelectedIndexChanged(null, null);
 
             WaitHelper.CloseForm();
         }
@@ -457,8 +454,19 @@ namespace XdCxRhDW.App.UserControl
             var btnEdit = (layoutControlGroup1.CustomHeaderButtons[1] as GroupBoxButton);
             var btnDel = (layoutControlGroup1.CustomHeaderButtons[2] as GroupBoxButton);
             btnDel.Enabled = btnEdit.Enabled = tsk.TaskState != EnumTaskState.Running;
-            List<PosRes> listPos = await searchPos(cts.Token);
-            this.gridHomePosRes.DataSource = listPos;
+            List<PosRes> listPos = null;
+            if (txtTimeCho.Text == "自定义" && (txtStartTime.EditValue == null || txtEndTime.EditValue == null || txtStartTime.DateTime > txtEndTime.DateTime))
+            {
+                listPos = new List<PosRes>();
+                this.gridHomePosRes.DataSource = listPos;
+                mapControl1.SetPosDataSource(listPos);
+            }
+            else
+            {
+                listPos = await searchPos(cts.Token);
+                this.gridHomePosRes.DataSource = listPos;
+                mapControl1.SetPosDataSource(listPos);
+            }
 
             using (RHDWContext db = new RHDWContext())
             {
@@ -472,7 +480,6 @@ namespace XdCxRhDW.App.UserControl
                 if (sat3 != null && sat3.SatLon != null)
                     mapControl1.DrawFixedImg("Sat", 0, sat3.SatLon.Value, DxHelper.SvgHelper.CreateSat(), $"邻2星\r\n{sat3.Sat}");
             }
-            mapControl1.SetPosDataSource(listPos);
 
         }
         private void GridView2_FocusedRowObjectChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e)
@@ -567,7 +574,7 @@ namespace XdCxRhDW.App.UserControl
                     //一星一地 测向线 GDOP
                     btnDrawDfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                     btnDrawDto.Visibility = btnGDOP.Visibility = btnDrawCX.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
-                   btnPos.Visibility= btnShowCxRes.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+                    btnPos.Visibility = btnShowCxRes.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                     break;
                 case EnumPosResType.X2D1:
                 case EnumPosResType.X2D1NoRef:
@@ -710,7 +717,6 @@ namespace XdCxRhDW.App.UserControl
                 }
             }
         }
-        IDisposable httpServer;
         private async void btn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             var tsk = gridView1.GetFocusedRow() as TaskInfo;
@@ -733,20 +739,6 @@ namespace XdCxRhDW.App.UserControl
                             DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP端口信息");
                             return;
                         }
-                        if (httpServer == null)
-                        {
-                            try
-                            {
-                                StartOptions options = new StartOptions();
-                                options.Urls.Add($"http://+:{settings.HttpPort}");
-                                httpServer = WebApp.Start<Startup>(options);
-                            }
-                            catch (Exception ex)
-                            {
-                                Serilog.Log.Error(ex, "启动任务异常,Http定位接口服务启动失败");
-                                DxHelper.MsgBoxHelper.ShowError($"启动任务异常,Http定位接口服务启动失败");
-                            }
-                        }
                         var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);
                         item.TaskState = EnumTaskState.Running;
                         await db.SaveChangesAsync();
@@ -809,7 +801,7 @@ namespace XdCxRhDW.App.UserControl
         {
             var p = gridView2.GetFocusedRow() as PosRes;
             p.Selected = true;
-            mapControl1.UpdatePosItem(p,true);
+            mapControl1.UpdatePosItem(p, true);
         }
 
 
@@ -1146,6 +1138,22 @@ namespace XdCxRhDW.App.UserControl
             }
 
         }
+        private async void BtnIncludeInvalidate_CheckedChanged(object sender, EventArgs e)
+        {
+            if (txtTimeCho.Text != "自定义")
+            {
+                listCts.ForEach(t => t.Cancel());
+                listCts.Clear();
+                this.gridHomePosRes.DataSource = new List<PosRes>();//先设为空,数据相同时便于观察结果有没有变化
+                if (tsk == null)
+                {
+                    return;
+                }
+                var cts = new CancellationTokenSource();
+                listCts.Add(cts);
+                this.gridHomePosRes.DataSource = await searchPos(cts.Token);
+            }
+        }
         private async void btnSearch_Click(object sender, EventArgs e)
         {
             if (txtStartTime.EditValue == null)
@@ -1163,11 +1171,6 @@ namespace XdCxRhDW.App.UserControl
                 DxHelper.MsgBoxHelper.ShowError($"开始时间不能大于结束时间!");
                 return;
             }
-            if ((txtEndTime.DateTime - txtStartTime.DateTime).TotalDays > 10)
-            {
-                MsgBoxHelper.ShowWarning("时间跨度不能超过10天!");
-                return;
-            }
             listCts.ForEach(t => t.Cancel());
             listCts.Clear();
             var cts = new CancellationTokenSource();
@@ -1179,65 +1182,68 @@ namespace XdCxRhDW.App.UserControl
         }
         private async Task<List<PosRes>> searchPos(CancellationToken ct = default)
         {
+            gridView2.ClearSorting();
+            gridView2.ClearFindFilter();
+            gridView2.ClearColumnsFilter();
+            string baseUrl = null;
+            using (RHDWContext db = new RHDWContext())
+            {
+                var res = await db.SysSetings.FirstOrDefaultAsync();
+                if (res != null)
+                {
+                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{res.HttpPort}/api/";
+                }
+            }
             try
             {
-                var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
-                if (!Directory.Exists(dir)) return new List<PosRes>();
-                DateTime end = DateTime.MinValue;
-                DateTime start = DateTime.MinValue;
+                List<PosRes> list = null;
                 if (txtTimeCho.Text == "自定义")
                 {
-                    start = txtStartTime.DateTime;
-                    end = txtEndTime.DateTime;
+                    var dto = new PosRequestByTimeRangeDto()
+                    {
+                        BeginTime = txtStartTime.DateTime,
+                        EndTime = txtEndTime.DateTime,
+                        TaskInfoID = tsk.ID,
+                        IncludeInvalidate = btnIncludeInvalidate.Checked
+                    };
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByTimeRangeObsolete", dto, ct);
+                    if (res.code == 200)
+                    {
+                        if (res.msg.Length > 10)
+                        {
+                            MsgBoxHelper.ShowWarning(res.msg);
+                        }
+                        list = res.data.Select(p => Map(p)).ToList();
+                    }
+                    else
+                    {
+                        MsgBoxHelper.ShowError(res.msg);
+                    }
                 }
                 else
                 {
 
-                    var yearDirs = Directory.EnumerateDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart")).OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name));//年目录,倒叙排列
-                    foreach (var yearDir in yearDirs)
+                    var dto = new PosRequestByLastRangeDto()
                     {
-                        //每一天的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)
+                        TaskInfoID = tsk.ID,
+                        Hours = Convert.ToInt32(txtTimeCho.EditValue),
+                        IncludeInvalidate = btnIncludeInvalidate.Checked
+                    };
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByLastHoursObsolete", dto, ct);
+                    if (res.code == 200)
+                    {
+                        if (res.msg.Length > 10)
                         {
-                            using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile))
-                            {
-                                if (db.PosRes.Any(p => p.TaskInfoID == tsk.ID))
-                                    end = await db.PosRes.Where(p => p.TaskInfoID == tsk.ID).MaxAsync(p => p.SigTime);
-                            }
-                            if (end != DateTime.MinValue)
-                            {
-                                start = end.AddHours(-(int)txtTimeCho.EditValue);
-                                goto skip;
-                            }
+                            MsgBoxHelper.ShowWarning(res.msg);
                         }
+                        list = res.data.Select(p => Map(p)).ToList();
                     }
-                }
-            skip:
-                if (end == DateTime.MinValue)
-                {
-                    return new List<PosRes>();//没有数据不查询
-                }
-
-                DateTime endDay = new DateTime(end.Year, end.Month, end.Day);
-                DateTime startDay = new DateTime(start.Year, start.Month, start.Day);
-                List<PosRes> list = new List<PosRes>();
-                while (endDay >= startDay)
-                {
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(endDay))
+                    else
                     {
-                        var posRes = await db.PosRes
-                            .Where(w => w.SigTime >= start && w.SigTime <= end && w.TaskInfoID == tsk.ID)
-                            .OrderByDescending(o => o.SigTime).ToListAsync(ct);
-                        list.AddRange(posRes);
+                        MsgBoxHelper.ShowError(res.msg);
                     }
-                    endDay = endDay.AddDays(-1);
                 }
-                gridView2.ClearSorting();
-                gridView2.ClearFindFilter();
-                gridView2.ClearColumnsFilter();
                 return list;
-
             }
             catch (TaskCanceledException) { }//屏蔽掉取消查询的异常
             catch (Exception ex)
@@ -1254,6 +1260,35 @@ namespace XdCxRhDW.App.UserControl
             if (info == null) return;
             Pos(info);
         }
+
+        private PosRes Map(ModelPosRes res)
+        {
+            return new PosRes()
+            {
+                ID = res.ID,
+                CgResID = res.CgResID,
+                ClusterCount = res.ClusterCount,
+                ClusterKey = res.ClusterKey,
+                ColorKey = res.ColorKey,
+                CreateTime = res.CreateTime,
+                CxResID = res.CxResID,
+                Selected = res.Selected,
+                StationResID = res.StationResID,
+                TargetID = res.TargetID,
+                TargetState = res.TargetState,
+                TsName = res.TsName,
+                UpdateTime = res.UpdateTime,
+                Visible = res.Visible,
+                SigTime = res.SigTime,
+                TaskInfoID = res.TaskInfoID,
+                TarName = string.IsNullOrWhiteSpace(res.TarName) ? "未知目标" : res.TarName,
+                PosLon = res.PosLon,
+                PosLat = res.PosLat,
+                MirrLon = res.MirrLon,
+                MirrLat = res.MirrLat,
+                PosResType = (EnumPosResType)((int)res.PosResType)
+            };
+        }
     }
 }
 

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


+ 9 - 9
XdCxRhDW.Core/Api/理论时频差/TheoryDtoDfoApi.cs → XdCxRhDW.Core/Api/GDOP误差椭圆/TheoryDtoDfoApi.cs

@@ -7,16 +7,16 @@ using System.Threading.Tasks;
 using XdCxRhDW.Repostory.EFContext;
 using XdCxRhDW.Repostory.Model;
 
-namespace XdCxRhDW.Core.Api.理论时频差
+namespace XdCxRhDW.Core.Api
 {
     /// <summary>
-    /// 理论时频差API(罗博士给的Dll,目前有点问题,Depends中找不到入口函数)
+    /// 理论时频差API
     /// </summary>
     public static class TheoryDtoDfoApi
     {
         #region cpp dll Interop 
         //一星一地测向带参定位
-        private const string dll = @"Api\理论时频差\DLL_DFO.dll";
+        private const string dll = @"Api\GDOP误差椭圆\GDOP\GDOP_Draw_11.dll";
 
         //主接收站位置[3],
         //邻接收站位置[3]
@@ -24,8 +24,8 @@ namespace XdCxRhDW.Core.Api.理论时频差
         //邻星历[6](x,y,z,Vx,Vy,Vz)
         //上行频(单位,Hz)
         //下行频(单位,Hz)
-        [DllImport(dll, EntryPoint = "DFO_Est", CallingConvention = CallingConvention.Cdecl)]//三星双时差带参
-        private extern static double DFO_Est(double[] target_llh, double[] rec_llh1, double[] rec_llh2, double[] main_sat, double[] neigh_sat, double fu, double fd);
+        [DllImport(dll, EntryPoint = "theoryDfo", CallingConvention = CallingConvention.Cdecl)]//双星理论频差
+        private extern static double TheoryDfo(double[] target_llh, double[] rec_llh1, double[] rec_llh2, double[] main_sat, double[] neigh_sat, double fu, double fd);
         #endregion
 
 
@@ -43,7 +43,7 @@ namespace XdCxRhDW.Core.Api.理论时频差
             {
                 if (cRes.Dfo1 == null) return EnumTargetState.Unknown;
                 var xlAdja1 = new double[6] { cRes.Adja1X.Value, cRes.Adja1Y.Value, cRes.Adja1Z.Value, cRes.Adja1Vx.Value, cRes.Adja1Vy.Value, cRes.Adja1Vz.Value };
-                double res = DFO_Est(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
+                double res = TheoryDfo(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
                 var val = Math.Abs(res - cRes.Dfo1.Value);
                 if (val < YDPZThreshold)
                     return EnumTargetState.Stationary;
@@ -54,7 +54,7 @@ namespace XdCxRhDW.Core.Api.理论时频差
             {
                 if (cRes.Dfo1 == null) return EnumTargetState.Unknown;
                 var xlAdja1 = new double[6] { cRes.Adja1X.Value, cRes.Adja1Y.Value, cRes.Adja1Z.Value, cRes.Adja1Vx.Value, cRes.Adja1Vy.Value, cRes.Adja1Vz.Value };
-                double res = DFO_Est(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
+                double res = TheoryDfo(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
                 var val = Math.Abs(res - cRes.Dfo1.Value);
                 if (val < YDPZThreshold)
                     return EnumTargetState.Stationary;
@@ -72,7 +72,7 @@ namespace XdCxRhDW.Core.Api.理论时频差
                 if (cRes.Dfo1 != null)
                 {
                     var xlAdja1 = new double[6] { cRes.Adja1X.Value, cRes.Adja1Y.Value, cRes.Adja1Z.Value, cRes.Adja1Vx.Value, cRes.Adja1Vy.Value, cRes.Adja1Vz.Value };
-                    double res = DFO_Est(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
+                    double res = TheoryDfo(target, rec, rec, xlMain, xlAdja1, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
                     var val = Math.Abs(res - cRes.Dfo1.Value);
                     if (val >= YDPZThreshold)
                         return EnumTargetState.Movement;
@@ -80,7 +80,7 @@ namespace XdCxRhDW.Core.Api.理论时频差
                 if (cRes.Dfo2 != null)
                 {
                     var xlAdja2 = new double[6] { cRes.Adja2X.Value, cRes.Adja2Y.Value, cRes.Adja2Z.Value, cRes.Adja2Vx.Value, cRes.Adja2Vy.Value, cRes.Adja2Vz.Value };
-                    double res = DFO_Est(target, rec, rec, xlMain, xlAdja2, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
+                    double res = TheoryDfo(target, rec, rec, xlMain, xlAdja2, cRes.TarFreqUp.Value, cRes.TarFreqDown.Value);
                     var val = Math.Abs(res - cRes.Dfo2.Value);
                     if (val >= YDPZThreshold)
                         return EnumTargetState.Movement;

+ 3 - 6
XdCxRhDW.Core/Api/PosApi.cs

@@ -18,16 +18,13 @@ namespace XdCxRhDW.Core.Api
         //一星一地测向带参定位
         private const string XDCX = @"AddIns\DLL_DTO_DOA_DW.dll";
 
-        //两星一地带参定位
-        private const string X2D1 = @"AddIns\DLL_SC_2X1D_DW.dll";
-
-        //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线
-        private const string OtherPos = @"AddIns\DLL_11J_DW.dll";
+        //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线、一星两地
+        private const string OtherPos = @"AddIns\Position-New.dll";//DLL_11J_DW
 
         [DllImport(XDCX, EntryPoint = "XD_CX_DW", CallingConvention = CallingConvention.Cdecl)]//一星一地测向带参
         private extern static void X1D1_Pos20240305_Core(double[] mainSat, double[] satStation, double[] cdbStation, double[] cxStation, double[] refStation, double[] zone, double theta, double tarDto, double refDto, double[] res);
 
-        [DllImport(X2D1, EntryPoint = "SC_2X1D_DW", CallingConvention = CallingConvention.Cdecl)]//两星一地带参
+        [DllImport(OtherPos, EntryPoint = "SC_2X1D_DW", CallingConvention = CallingConvention.Cdecl)]//两星一地带参
         private extern static void X2D1_Pos20240305_Core(double[] mainSat, double[] adjaSat, double[] cdbStation, double[] satStation1, double[] satStation2, double[] satStation3, double[] satStation4,
              double[] satStation5, double[] refStation, double[] zone, double tarSxDto, double tarXdDto, double samp_main_dto, double samp_neigh_dto, double[] res);
 

+ 5 - 5
XdCxRhDW.Core/Api/时差线/DrawDtoLineHelper.cs

@@ -15,7 +15,7 @@ namespace XdCxRhDW.Core.Api
         private const string XdtsDll = @"Api\时差线\Positioning.dll";
 
         //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线
-        private const string xddtodll = @"AddIns\DLL_11J_DW.dll";
+        private const string xddtodll = @"AddIns\Position-New.dll";
 
         [DllImport(xddtodll, EntryPoint = "XingDi_SCX_NoRef", CallingConvention = CallingConvention.Cdecl)]//高轨双星有参时差线
         public extern static void XingDi_SCX_NoRef(double[] main_sat_pos, double[] mbwx_rec_pos, double[] cdb_rec_pos,
@@ -41,7 +41,7 @@ namespace XdCxRhDW.Core.Api
         public static extern void Destory(IntPtr val);
 
         private const string exeName = "XingDiSCX.exe";//星地时差线
-        private static double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
+       // private static double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
 
 
         private const string locexeName = "locow.exe";
@@ -133,7 +133,7 @@ namespace XdCxRhDW.Core.Api
             int LOP_Len = 0;
 
             XingDi_SCX_NoRef(opt.MsEph, opt.MsAnt, opt.CDBAnt,
-            zone, opt.xdDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
+            new double[] { -85, 85, -180, 180 }, opt.xdDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
             double[] LOP_Value = new double[LOP_Len * 3];
             if (LOP_Len > 0)
             {
@@ -164,7 +164,7 @@ namespace XdCxRhDW.Core.Api
                  opt.MsAnt,
                  opt.NsAnt,
                 opt.RefGeod,
-                 zone,
+                 new double[] { -85, 85, -180, 180 },
                 opt.TargetDto * 1e-6,
                 opt.RefDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
 
@@ -192,7 +192,7 @@ namespace XdCxRhDW.Core.Api
                  opt.NsEph,
                  opt.MsAnt,
                  opt.NsAnt,
-                 zone,
+                 new double[] { -85, 85, -180, 180 },
                 opt.TargetDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
 
             double[] LOP_Value = new double[LOP_Len * 3];

+ 3 - 2
XdCxRhDW.Core/Api/检测Cpu参估/XcorrUtils.cs

@@ -54,6 +54,7 @@ namespace XdCxRhDW.Core.Api
                 if (xs.smpStart == 0)
                 {
                     flag = 2;//文件参估,避免滑动时溢出
+                    cafp.StartInfo.Arguments = $"{flag} \"{xs.file1}\" \"{xs.file2}\" {(Int64)(xs.samplingRate)} {xs.dtCenter} {xs.dtRange} {xs.dfRange} {xs.smpCount} {xs.snrThreshold}";
                 }
                 else
                 {
@@ -62,10 +63,10 @@ namespace XdCxRhDW.Core.Api
                     {
                         xs.smpStart = (long)minStart;
                     }
+                    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.FileName = Path.Combine(cafp.StartInfo.WorkingDirectory, "xcorr\\XcorrCpu.exe");
-                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;
@@ -143,7 +144,7 @@ namespace XdCxRhDW.Core.Api
             return list;
         }
 
-        public async Task<IEnumerable<DmcResult>> DmcCheckAsync(string fileName, double fsHz, DmcType dmcType, double? bandKHz=null)
+        public async Task<IEnumerable<DmcResult>> DmcCheckAsync(string fileName, double fsHz, DmcType dmcType, double? bandKHz = null)
         {
             if (bandKHz == null || bandKHz.Value <= 0) bandKHz = 25;
             string dmcCmd = "all";

BIN
XdCxRhDW.Core/Api/理论时频差/DLL_DFO.dll


BIN
XdCxRhDW.Core/DLL_11J_DW.dll


BIN
XdCxRhDW.Core/DLL_SC_2X1D_DW.dll


+ 15 - 0
XdCxRhDW.Core/HttpHelper.cs

@@ -6,6 +6,7 @@ using System.Linq;
 using System.Net.Http;
 using System.Security.Policy;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using XdCxRhDw.Dto;
 
@@ -28,7 +29,21 @@ namespace XdCxRhDW.Core
             var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<T>>(result);
             return AjaxResult;
         }
+        public static async Task<AjaxResult<T>> PostRequestAsync<T>(string url, object dto,CancellationToken ct, 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(timeoutSeconds);
+            var message = new HttpRequestMessage(HttpMethod.Post, url);
+            message.Content = content;
 
+            var response = await client.SendAsync(message,ct);
+            response.EnsureSuccessStatusCode();
+            var result = await response.Content.ReadAsStringAsync();
+            var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<T>>(result);
+            return AjaxResult;
+        }
         public static async Task<bool> DownloadFileAsync(string baseUrl,string remoteFileName, string localFile, int timeoutSeconds = 30)
         {
             if (!baseUrl.EndsWith("/"))

BIN
XdCxRhDW.Core/Position-New.dll


+ 2 - 12
XdCxRhDW.Core/XdCxRhDW.Core.csproj

@@ -68,7 +68,7 @@
     <Compile Include="Api\时差线\DrawDtoLineHelper.cs" />
     <Compile Include="Api\时差线\DtoLineModel.cs" />
     <Compile Include="Api\时差线\OutputHelper.cs" />
-    <Compile Include="Api\理论时频差\TheoryDtoDfoApi.cs" />
+    <Compile Include="Api\GDOP误差椭圆\TheoryDtoDfoApi.cs" />
     <Compile Include="Api\频差线\DfoLineModel.cs" />
     <Compile Include="Api\频差线\DrawDfoLineHelper.cs" />
     <Compile Include="ColorRGB.cs" />
@@ -149,21 +149,11 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="DLL_11J_DW.dll">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-  </ItemGroup>
   <ItemGroup>
     <None Include="DLL_DTO_DOA_DW.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
-  <ItemGroup>
-    <None Include="DLL_SC_2X1D_DW.dll">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-  </ItemGroup>
   <ItemGroup>
     <Content Include="Api\GDOP误差椭圆\GDOP\mfc100u.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -171,7 +161,7 @@
     <Content Include="Api\GDOP误差椭圆\GDOP\msvcr100.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <None Include="Api\理论时频差\DLL_DFO.dll">
+    <None Include="Position-New.dll">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="Tle2XYZ.dll">

+ 73 - 0
XdCxRhDW.Repostory/ModelPosRes.cs

@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.Repostory.Model
+{
+    /// <summary>
+    /// 定位结果UI绑定对象
+    /// </summary>
+    public class ModelPosRes : PosData
+    {
+        [Display(Name = "任务编号")]
+        public int TaskInfoID { get; set; }
+
+        [Display(Name = "站点ID")]
+        public long StationResID { get; set; }
+
+        [Display(Name = "测向编号")]
+        public long? CxResID { get; set; }
+
+        [Display(Name = "参估编号")]
+        public long CgResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+        public int? TargetID { get; set; }
+
+        [Display(Name = "目标名称")]
+        public string TarName { get; set; } = "未识别";
+
+        [Display(Name = "时隙标识")]
+        public string TsName { get; set; } = "未知";
+
+
+        [Display(Name = "定位点")]
+        public string LonLat
+        {
+            get
+            {
+                if (PosLon == 0 && PosLat == 0)
+                    return "无";
+                else if (PosLon > 180 || PosLon < -180)
+                    return "无";
+                else
+                    return $"{PosLon:f4},{PosLat:f4}";
+            }
+        }
+
+
+        [Display(Name = "镜像点")]
+        public string MirrLonLat
+        {
+            get
+            {
+                if (MirrLon == 0 && MirrLat == 0)
+                    return "无";
+                else if (MirrLon > 180 || MirrLon < -180)
+                    return "无";
+                else
+                    return $"{MirrLon:f4},{MirrLat:f4}";
+            }
+        }
+
+        [Display(Name = "定位类型")]
+        public EnumPosResType PosResType { get; set; }
+
+        [Display(Name = "目标状态")]
+        public EnumTargetState TargetState { get; set; }
+    }
+}

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

@@ -95,6 +95,7 @@
     <Compile Include="Model\TxInfo.cs" />
     <Compile Include="Model\XlInfo.cs" />
     <Compile Include="PosData.cs" />
+    <Compile Include="ModelPosRes.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="XlCache.cs" />
   </ItemGroup>

+ 223 - 69
XdCxRhDW.WebApi/Controllers/PosController.cs

@@ -24,7 +24,6 @@ using System.ComponentModel.DataAnnotations;
 using System.Web.Caching;
 using XdCxRhDW.Repostory;
 using System.IO;
-using XdCxRhDW.Core.Api.理论时频差;
 
 namespace XdCxRhDW.App.WebAPI
 {
@@ -104,11 +103,10 @@ namespace XdCxRhDW.App.WebAPI
                     MirrLat = res[4],
                     PosResType = EnumPosResType.X1D1CX,
                 };
-                //posRes.TargetState = TheoryDtoDfoApi.TheoryDfo(cgRes, StationRes, posRes);
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -206,11 +204,10 @@ namespace XdCxRhDW.App.WebAPI
                     MirrLat = res[4],
                     PosResType = EnumPosResType.X1D1CX,
                 };
-                //posRes.TargetState = TheoryDtoDfoApi.TheoryDfo(cgRes, StationRes, posRes);
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
@@ -267,6 +264,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = dto.AdjaX,
                     Adja1Y = dto.AdjaY,
                     Adja1Z = dto.AdjaZ,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X2D1_Pos(cgRes, StationRes);
@@ -284,11 +283,11 @@ namespace XdCxRhDW.App.WebAPI
                     MirrLat = res[4],
                     PosResType = EnumPosResType.X2D1,
                 };
-                //posRes.TargetState = TheoryDtoDfoApi.TheoryDfo(cgRes, StationRes, posRes);
+                posRes.TargetState = TheoryDtoDfoApi.TheoryDfo(cgRes, StationRes, posRes, 10);
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -394,6 +393,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = ephAdja.data.X,
                     Adja1Y = ephAdja.data.Y,
                     Adja1Z = ephAdja.data.Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X2D1_Pos(cgRes, StationRes);
@@ -415,7 +416,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -465,6 +466,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = dto.AdjaX,
                     Adja1Y = dto.AdjaY,
                     Adja1Z = dto.AdjaZ,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
                 var res = PosApi.X2D1_PosNoRef(cgRes, StationRes);
                 PosRes posRes = new PosRes()
@@ -484,7 +487,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -587,6 +590,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = ephAdja.data.X,
                     Adja1Y = ephAdja.data.Y,
                     Adja1Z = ephAdja.data.Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X2D1_PosNoRef(cgRes, StationRes);
@@ -608,7 +613,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
@@ -667,6 +672,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = dto.AdjaX,
                     Adja1Y = dto.AdjaY,
                     Adja1Z = dto.AdjaZ,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var cxRes = db.CxRes.Add(new CxRes()
@@ -695,7 +702,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -798,6 +805,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja1X = ephAdja.data.X,
                     Adja1Y = ephAdja.data.Y,
                     Adja1Z = ephAdja.data.Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
                 var cxRes = db.CxRes.Add(new CxRes()
                 {
@@ -823,7 +832,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
@@ -883,6 +892,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja2X = dto.Adja2X,
                     Adja2Y = dto.Adja2Y,
                     Adja2Z = dto.Adja2Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X3_Pos(cgRes, StationRes);
@@ -904,7 +915,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -1036,6 +1047,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja2X = ephAdja2.data.X,
                     Adja2Y = ephAdja2.data.Y,
                     Adja2Z = ephAdja2.data.Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X3_Pos(cgRes, StationRes);
@@ -1057,7 +1070,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -1110,6 +1123,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja2X = dto.Adja2X,
                     Adja2Y = dto.Adja2Y,
                     Adja2Z = dto.Adja2Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X3_PosNoRef(cgRes, StationRes);
@@ -1131,7 +1146,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -1258,6 +1273,8 @@ namespace XdCxRhDW.App.WebAPI
                     Adja2X = ephAdja2.data.X,
                     Adja2Y = ephAdja2.data.Y,
                     Adja2Z = ephAdja2.data.Z,
+                    TarFreqUp = dto.FreqUp,
+                    TarFreqDown = dto.FreqDown,
                 });
 
                 var res = PosApi.X3_PosNoRef(cgRes, StationRes);
@@ -1279,7 +1296,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
@@ -1373,7 +1390,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -1539,7 +1556,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
@@ -1624,7 +1641,7 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
 
@@ -1758,96 +1775,233 @@ namespace XdCxRhDW.App.WebAPI
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
                 PosObServer.Instance.Pub(posRes);
-                return Success(Map(posRes));
+                return Success(MapDto(posRes));
             }
         }
         #endregion
 
-        private PosResDto Map(PosRes res)
+        #region 定位结果查询接口
+        /// <summary>
+        /// 根据时间范围查询定位结果
+        /// </summary>
+        /// <param name="dto"><see cref="PosRequestByTimeRangeDto"/>查询参数</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        [HttpPost]
+        public async Task<AjaxResult<List<PosResDto>>> GetPosResByTimeRange(PosRequestByTimeRangeDto dto)
         {
-            return new PosResDto()
+            var response = (await GetPosResByTimeRangeObsolete(dto));
+            if (response.code == 200)
             {
-                ID = res.ID,
-                SigTime = res.SigTime,
-                TaskInfoID = res.TaskInfoID,
-                TarName = string.IsNullOrWhiteSpace(res.TarName) ? "未知目标" : res.TarName,
-                PosLon = res.PosLon,
-                PosLat = res.PosLat,
-                MirrLon = res.MirrLon,
-                MirrLat = res.MirrLat,
-                PosResType = (EnumPosResTypeDto)((int)res.PosResType)
-            };
+                var listDto = response.data?.Select(p => MapDto(p)).ToList();
+                return Success(listDto);
+            }
+            else
+            {
+                return Error<List<PosResDto>>(response.msg);
+            }
+        }
+
+        /// <summary>
+        /// 查询最后X小时的的定位结果
+        /// </summary>
+        /// <param name="dto"><see cref="PosRequestByLastRangeDto"/>查询参数</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        [HttpPost]
+        public async Task<AjaxResult<List<PosResDto>>> GetPosResByLastHours(PosRequestByLastRangeDto dto)
+        {
+            var response = (await GetPosResByLastHoursObsolete(dto));
+            if (response.code == 200)
+            {
+                var listDto = response.data?.Select(p => MapDto(p)).ToList();
+                return Success(listDto);
+            }
+            else
+            {
+                return Error<List<PosResDto>>(response.msg);
+            }
         }
 
         /// <summary>
-        /// 查询定位结果
+        /// 根据时间范围查询定位结果(此方法内部调用)
         /// </summary>
-        /// <param name="dto"><see cref="PosResQueryDto"/>查询参数</param>
+        /// <param name="dto"><see cref="PosRequestByTimeRangeDto"/>查询参数</param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
         [HttpPost]
-        public async Task<AjaxResult<List<PosResDto>>> GetPosRes(PosResQueryDto dto)
+        [Obsolete]
+        public async Task<AjaxResult<List<ModelPosRes>>> GetPosResByTimeRangeObsolete(PosRequestByTimeRangeDto dto)
         {
-            List<PosResDto> posList = new List<PosResDto>();
+            List<ModelPosRes> posList = new List<ModelPosRes>();
             try
             {
                 DateTime start = dto.BeginTime;
                 DateTime end = dto.EndTime;
+                var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
+                if (!Directory.Exists(dir)) return Success(posList);
+                List<string> list = new List<string>();
+                while (end >= start)
+                {
+                    list.Add(end.ToString("yyyy") + "\\" + end.ToString("MMdd") + ".db");
+                    end = end.AddDays(-1);
+                }
+                end = dto.EndTime;
+                foreach (var item in list)
+                {
+                    var dayFile = Path.Combine(dir, item);
+                    using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile))
+                    {
+                        if (dto.IncludeInvalidate)
+                        {
+                            var posRes = await db.PosRes
+                                .Where(w => w.SigTime >= start && w.SigTime <= end && w.TaskInfoID == dto.TaskInfoID)
+                                .OrderByDescending(o => o.SigTime).ToListAsync();
+                            posList.AddRange(posRes.Select(p => MapModel(p)));
+                        }
+                        else
+                        {
+                            var posRes = await db.PosRes
+                               .Where(w => w.SigTime >= start && w.SigTime <= end && w.TaskInfoID == dto.TaskInfoID && w.PosLon != 999)
+                               .OrderByDescending(o => o.SigTime).ToListAsync();
+                            posList.AddRange(posRes.Select(p => MapModel(p)));
+                        }
+                        if (posList.Count > 5000)
+                        {
+                            return Success(posList.Take(5000).ToList(), "数据过多,只返回前5000条数据!");
+                        }
+                    }
+                }
+                return Success(posList);
+            }
+            catch (Exception ex)
+            {
+                string msg = $"定位结果时间范围查询异常.任务ID={dto.TaskInfoID},{dto.BeginTime:yyyyMMddHHmmss}-{dto.EndTime:yyyyMMddHHmmss}";
+                Serilog.Log.Error(ex, msg);
+                return Error<List<ModelPosRes>>("定位结果时间范围查询异常");
+            }
+        }
+
+        /// <summary>
+        /// 查询最后X小时的的定位结果(此方法内部调用)
+        /// </summary>
+        /// <param name="dto"><see cref="PosRequestByLastRangeDto"/>查询参数</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        [HttpPost]
+        [Obsolete]
+        public async Task<AjaxResult<List<ModelPosRes>>> GetPosResByLastHoursObsolete(PosRequestByLastRangeDto dto)
+        {
+            List<ModelPosRes> posList = new List<ModelPosRes>();
+            try
+            {
                 var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
                 if (!Directory.Exists(dir)) return Success(posList);
                 var yearDirs = Directory.EnumerateDirectories(dir).OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name));//年目录,倒叙排列
+                DateTime max = DateTime.MinValue;
                 foreach (var yearDir in yearDirs)
                 {
+                    if (max != DateTime.MinValue) break;
                     //每一天的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))
                         {
-                            if (db.PosRes.Any(p => p.TaskInfoID == dto.TaskInfoID))
-                                end = await db.PosRes.Where(p => p.TaskInfoID == dto.TaskInfoID).MaxAsync(p => p.SigTime);
+                            if (dto.IncludeInvalidate)
+                            {
+                                if (db.PosRes.Any(p => p.TaskInfoID == dto.TaskInfoID))
+                                    max = await db.PosRes.Where(p => p.TaskInfoID == dto.TaskInfoID).MaxAsync(p => p.SigTime);
+                            }
+                            else
+                            {
+                                if (db.PosRes.Any(p => p.TaskInfoID == dto.TaskInfoID && p.PosLon != 999))
+                                    max = await db.PosRes.Where(p => p.TaskInfoID == dto.TaskInfoID && p.PosLon != 999).MaxAsync(p => p.SigTime);
+                            }
                         }
-                        if (end != DateTime.MinValue)
+                        if (max != DateTime.MinValue)
                         {
-                            goto skip;
+                            break;
                         }
                     }
                 }
-
-            skip:
-                if (end == DateTime.MinValue)
-                {
-                    return Success(posList);//没有数据不查询
-                }
-                if (end >= dto.EndTime)
+                if (max == DateTime.MinValue) return Success(posList);
+                DateTime min = max.AddHours(-dto.Hours);
+                var res = await GetPosResByTimeRangeObsolete(new PosRequestByTimeRangeDto()
                 {
-                    end = dto.EndTime;
-                }
-                start = dto.BeginTime;
-                DateTime endDay = new DateTime(end.Year, end.Month, end.Day);
-                DateTime startDay = new DateTime(start.Year, start.Month, start.Day);
-                while (endDay >= startDay)
-                {
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(endDay))
-                    {
-                        var posRes = await db.PosRes
-                            .Where(w => w.SigTime >= start && w.SigTime <= end && w.TaskInfoID == dto.TaskInfoID)
-                            .OrderByDescending(o => o.SigTime).ToListAsync();
-                        posList.AddRange(posRes.Select(m => Map(m)));
-                    }
-                    endDay = endDay.AddDays(-1);
-                }
-                return Success(posList);
-
+                    TaskInfoID = dto.TaskInfoID,
+                    BeginTime = min,
+                    EndTime = max,
+                    IncludeInvalidate = dto.IncludeInvalidate
+                });
+                return res;
             }
-
             catch (Exception ex)
             {
-                string err = $"定位查询任务编号:{dto.TaskInfoID},{dto.BeginTime:yyyy-MM-dd HH:mm:ss}-{dto.EndTime:yyyy-MM-dd HH:mm:ss}异常:{ex.Message}";
-                Serilog.Log.Error(err);
-                return Error<List<PosResDto>>(err);
+                string msg = $"定位结果查询最新数据异常-任务编号:{dto.TaskInfoID},Hours:{dto.Hours}";
+                Serilog.Log.Error(ex, msg);
+                return Error<List<ModelPosRes>>("定位结果查询最新数据异常");
             }
         }
+        #endregion
 
+        private PosResDto MapDto(PosRes res)
+        {
+            return new PosResDto()
+            {
+                ID = res.ID,
+                SigTime = res.SigTime,
+                TaskInfoID = res.TaskInfoID,
+                TarName = string.IsNullOrWhiteSpace(res.TarName) ? "未知目标" : res.TarName,
+                PosLon = res.PosLon,
+                PosLat = res.PosLat,
+                MirrLon = res.MirrLon,
+                MirrLat = res.MirrLat,
+                PosResType = (EnumPosResTypeDto)((int)res.PosResType)
+            };
+        }
+        private PosResDto MapDto(ModelPosRes res)
+        {
+            return new PosResDto()
+            {
+                ID = res.ID,
+                SigTime = res.SigTime,
+                TaskInfoID = res.TaskInfoID,
+                TarName = string.IsNullOrWhiteSpace(res.TarName) ? "未知目标" : res.TarName,
+                PosLon = res.PosLon,
+                PosLat = res.PosLat,
+                MirrLon = res.MirrLon,
+                MirrLat = res.MirrLat,
+                PosResType = (EnumPosResTypeDto)((int)res.PosResType)
+            };
+        }
+        private ModelPosRes MapModel(PosRes res)
+        {
+            return new ModelPosRes()
+            {
+                ID = res.ID,
+                CgResID = res.CgResID,
+                ClusterCount = res.ClusterCount,
+                ClusterKey = res.ClusterKey,
+                ColorKey = res.ColorKey,
+                CreateTime = res.CreateTime,
+                CxResID = res.CxResID,
+                Selected = res.Selected,
+                StationResID = res.StationResID,
+                TargetID = res.TargetID,
+                TargetState = res.TargetState,
+                TsName = res.TsName,
+                UpdateTime = res.UpdateTime,
+                Visible = res.Visible,
+                SigTime = res.SigTime,
+                TaskInfoID = res.TaskInfoID,
+                TarName = string.IsNullOrWhiteSpace(res.TarName) ? "未知目标" : res.TarName,
+                PosLon = res.PosLon,
+                PosLat = res.PosLat,
+                MirrLon = res.MirrLon,
+                MirrLat = res.MirrLat,
+                PosResType = (EnumPosResType)((int)res.PosResType)
+            };
+        }
     }
 }

+ 10 - 1
XdCxRhDW.WebApi/Startup.cs

@@ -191,6 +191,15 @@ namespace XdCxRhDW.WebApi
             {
                 if (!actionContext.ModelState.IsValid)
                 {
+                    string msg = "";
+                    var err = actionContext.ModelState.Values?.Last()?.Errors?.Last();
+                    if (err != null)
+                    {
+                        if (!string.IsNullOrWhiteSpace(err.ErrorMessage))
+                            msg = err.ErrorMessage;
+                        else
+                            msg = err.Exception.Message;
+                    }
                     return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
                     {
                         Content = new StringContent(
@@ -199,7 +208,7 @@ namespace XdCxRhDW.WebApi
                         {
                             code = 0,
                             data = null,
-                            msg = actionContext.ModelState.Values?.Last()?.Errors?.Last()?.ErrorMessage
+                            msg = msg,
                         }), Encoding.UTF8, "application/json")
                     });
                 }

+ 4 - 4
XdCxRhDw.Dto/CpuCgDto.cs

@@ -32,14 +32,14 @@ namespace XdCxRhDw.Dto
         /// <summary>
         /// 开始样点
         /// </summary>
-        [RangeInt(0, IncludeMin = true)]
-        public int smpStart { get; set; }
+        [RangeLong(0, IncludeMin = true)]
+        public long smpStart { get; set; }
 
         /// <summary>
         /// 样点数(0表示文件末尾)
         /// </summary>
-        [RangeInt(0, IncludeMin = true)]
-        public int smpCount { get; set; }
+        [RangeLong(0, IncludeMin = true)]
+        public long smpCount { get; set; }
 
         /// <summary>
         /// 采样率(Hz)

+ 30 - 0
XdCxRhDw.Dto/PosDto/X2D1NoParPosDto.cs

@@ -112,6 +112,36 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public double AdjaZ { get; set; }
 
+        /// <summary>
+        ///  主星X方向速度(可空)
+        /// </summary>
+        public double? MainVX { get; set; }
+
+        /// <summary>
+        /// 主星Y方向速度(可空)
+        /// </summary>
+        public double? MainVY { get; set; }
+
+        /// <summary>
+        /// 主星Z方向速度(可空)
+        /// </summary>
+        public double? MainVZ { get; set; }
+
+        /// <summary>
+        ///  邻星X方向速度(可空)
+        /// </summary>
+        public double? AdjaVX { get; set; }
+
+        /// <summary>
+        /// 邻星Y方向速度(可空)
+        /// </summary>
+        public double? AdjaVY { get; set; }
+
+        /// <summary>
+        /// 邻星Z方向速度(可空)
+        /// </summary>
+        public double? AdjaVZ { get; set; }
+
         /// <summary>
         /// 卫星接收天线经度
         /// </summary>

+ 30 - 0
XdCxRhDw.Dto/PosDto/X2D1PosDto.cs

@@ -124,6 +124,36 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public double AdjaZ { get; set; }
 
+        /// <summary>
+        ///  主星X方向速度(可空)
+        /// </summary>
+        public double? MainVX { get; set; }
+
+        /// <summary>
+        /// 主星Y方向速度(可空)
+        /// </summary>
+        public double? MainVY { get; set; }
+
+        /// <summary>
+        /// 主星Z方向速度(可空)
+        /// </summary>
+        public double? MainVZ { get; set; }
+
+        /// <summary>
+        ///  邻星X方向速度(可空)
+        /// </summary>
+        public double? AdjaVX { get; set; }
+
+        /// <summary>
+        /// 邻星Y方向速度(可空)
+        /// </summary>
+        public double? AdjaVY { get; set; }
+
+        /// <summary>
+        /// 邻星Z方向速度(可空)
+        /// </summary>
+        public double? AdjaVZ { get; set; }
+
         /// <summary>
         /// 卫星接收天线经度
         /// </summary>

+ 45 - 0
XdCxRhDw.Dto/PosDto/X3TwoDtoNoParPosDto.cs

@@ -134,6 +134,51 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public double Adja2Z { get; set; }
 
+        /// <summary>
+        ///  主星X方向速度(可空)
+        /// </summary>
+        public double? MainVX { get; set; }
+
+        /// <summary>
+        /// 主星Y方向速度(可空)
+        /// </summary>
+        public double? MainVY { get; set; }
+
+        /// <summary>
+        /// 主星Z方向速度(可空)
+        /// </summary>
+        public double? MainVZ { get; set; }
+
+        /// <summary>
+        ///  邻星1X方向速度(可空)
+        /// </summary>
+        public double? Adja1VX { get; set; }
+
+        /// <summary>
+        /// 邻星1Y方向速度(可空)
+        /// </summary>
+        public double? Adja1VY { get; set; }
+
+        /// <summary>
+        /// 邻星1Z方向速度(可空)
+        /// </summary>
+        public double? Adja1VZ { get; set; }
+
+        /// <summary>
+        ///  邻星2-X方向速度(可空)
+        /// </summary>
+        public double? Adja2VX { get; set; }
+
+        /// <summary>
+        /// 邻星2-Y方向速度(可空)
+        /// </summary>
+        public double? Adja2VY { get; set; }
+
+        /// <summary>
+        /// 邻星2-Z方向速度(可空)
+        /// </summary>
+        public double? Adja2VZ { get; set; }
+
         /// <summary>
         /// 卫星接收天线经度
         /// </summary>

+ 51 - 6
XdCxRhDw.Dto/PosDto/X3TwoDtoPosDto.cs

@@ -123,35 +123,80 @@ namespace XdCxRhDw.Dto
         public double MainZ { get; set; }
 
         /// <summary>
-        ///  邻星X坐标
+        ///  邻星1-X坐标
         /// </summary>
         public double Adja1X { get; set; }
 
         /// <summary>
-        ///  邻星Y坐标
+        ///  邻星1-Y坐标
         /// </summary>
         public double Adja1Y { get; set; }
 
         /// <summary>
-        ///  邻星Z坐标
+        ///  邻星1-Z坐标
         /// </summary>
         public double Adja1Z { get; set; }
 
         /// <summary>
-        ///  邻星X坐标
+        ///  邻星2-X坐标
         /// </summary>
         public double Adja2X { get; set; }
 
         /// <summary>
-        ///  邻星Y坐标
+        ///  邻星2-Y坐标
         /// </summary>
         public double Adja2Y { get; set; }
 
         /// <summary>
-        ///  邻星Z坐标
+        ///  邻星2-Z坐标
         /// </summary>
         public double Adja2Z { get; set; }
 
+        /// <summary>
+        ///  主星X方向速度(可空)
+        /// </summary>
+        public double? MainVX { get; set; }
+
+        /// <summary>
+        /// 主星Y方向速度(可空)
+        /// </summary>
+        public double? MainVY { get; set; }
+
+        /// <summary>
+        /// 主星Z方向速度(可空)
+        /// </summary>
+        public double? MainVZ { get; set; }
+
+        /// <summary>
+        ///  邻星1-X方向速度(可空)
+        /// </summary>
+        public double? Adja1VX { get; set; }
+
+        /// <summary>
+        /// 邻星1-Y方向速度(可空)
+        /// </summary>
+        public double? Adja1VY { get; set; }
+
+        /// <summary>
+        /// 邻星1-Z方向速度(可空)
+        /// </summary>
+        public double? Adja1VZ { get; set; }
+
+        /// <summary>
+        ///  邻星2-X方向速度(可空)
+        /// </summary>
+        public double? Adja2VX { get; set; }
+
+        /// <summary>
+        /// 邻星2-Y方向速度(可空)
+        /// </summary>
+        public double? Adja2VY { get; set; }
+
+        /// <summary>
+        /// 邻星2-Z方向速度(可空)
+        /// </summary>
+        public double? Adja2VZ { get; set; }
+
         /// <summary>
         /// 卫星接收天线经度
         /// </summary>

+ 33 - 4
XdCxRhDw.Dto/PosResQueryDto.cs

@@ -8,9 +8,9 @@ using System.Threading.Tasks;
 namespace XdCxRhDw.Dto
 {
     /// <summary>
-    /// 定位结果查询参数模型
+    /// 定位结果时间范围查询参数模型
     /// </summary>
-    public class PosResQueryDto:IValidatableObject
+    public class PosRequestByTimeRangeDto : IValidatableObject
     {
         /// <summary>
         /// 任务编号
@@ -28,6 +28,12 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public DateTime EndTime { get; set; }
 
+
+        /// <summary>
+        /// 是否包含无效点
+        /// </summary>
+        public bool IncludeInvalidate { get; set; } = true;
+
         /// <summary>
         /// 
         /// </summary>
@@ -35,8 +41,31 @@ namespace XdCxRhDw.Dto
         /// <returns></returns>
         public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
         {
-            if ((EndTime - BeginTime).TotalDays > 10)
-                yield return new ValidationResult("时间跨度不能超过10天!", new[] { nameof(BeginTime),nameof(EndTime) });
+            if (BeginTime > EndTime)
+                yield return new ValidationResult("开始时间不能大于结束时间!", new[] { nameof(BeginTime), nameof(EndTime) });
         }
     }
+
+    /// <summary>
+    /// 定位结果最新数据查询参数模型
+    /// </summary>
+    public class PosRequestByLastRangeDto
+    {
+        /// <summary>
+        /// 任务编号
+        /// </summary>
+        [RangeInt(0)]
+        public int TaskInfoID { get; set; }
+
+        /// <summary>
+        /// 查询最后X小时的数据
+        /// </summary>
+        public int Hours { get; set; }
+
+        /// <summary>
+        /// 是否包含无效点
+        /// </summary>
+        public bool IncludeInvalidate { get; set; } = true;
+
+    }
 }