فهرست منبع

添加重新定位

wyq 1 سال پیش
والد
کامیت
05006897a8

+ 85 - 2
XdCxRhDW.App/Controllers/PosController.cs

@@ -2157,7 +2157,8 @@ namespace XdCxRhDW.App.Controllers
                 var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
                 if (!Directory.Exists(dir)) return Success(posList);
                 List<string> list = new List<string>();
-                while (end >= start)
+                DateTime tempStart = new DateTime(start.Year, start.Month, start.Day);
+                while (end >= tempStart)
                 {
                     list.Add(end.ToString("yyyy") + "\\" + end.ToString("MMdd") + ".db");
                     end = end.AddDays(-1);
@@ -2192,7 +2193,7 @@ namespace XdCxRhDW.App.Controllers
                             itemPos.BaseCheckType = itemPos.CheckRes?.PosCheckType?.GetEnumDisplayName();
                         }
                         posList.AddRange(posRes);
-                        return Success(posList);
+                        //return Success(posList);
                     }
                 }
                 return Success(posList);
@@ -2204,7 +2205,89 @@ namespace XdCxRhDW.App.Controllers
                 return Error<List<PosRes>>("定位结果时间范围查询异常");
             }
         }
+        /// <summary>
+        /// 根据时间范围查询定位结果(此方法内部调用)
+        /// </summary>
+        /// <param name="dto"><see cref="PosRequestByTimeRangeDto"/>查询参数</param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        [HttpPost]
+        [Obsolete]
+        public async Task<AjaxResult<List<RePosRes>>> GetPosCgResByTimeRangeObsolete(PosRequestByTimeRangeDto dto)
+        {
+            List<RePosRes> posList = new List<RePosRes>();
+            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>();
+                DateTime tempStart = new DateTime(start.Year, start.Month, start.Day);
+                while (end >= tempStart)
+                {
+                    list.Add(end.ToString("yyyy") + "\\" + end.ToString("MMdd") + ".db");
+                    end = end.AddDays(-1);
+                }
+                end = dto.EndTime;
+                List<TargetInfo> targets;
+                using (RHDWContext dbBasic = new RHDWContext())
+                {
+                    targets = await dbBasic.TargetInfos.ToListAsync();
+                }
+                foreach (var item in list)
+                {
+                    var dayFile = Path.Combine(dir, item);
+                    using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile))
+                    {
+                        var query = db.PosRes.Where(p => p.SigTime >= start && p.SigTime <= end && p.TaskInfoID == dto.TaskInfoID);
+                        if (!dto.IncludeInvalidate)
+                            query = query.Where(p => p.PosLon != 999);
+                        if (dto.TarFrequpHz != null)
+                            query = query.Where(p => p.FreqUpHz == dto.TarFrequpHz.Value);
+                        var posRes = await query.OrderByDescending(p => p.SigTime).ToListAsync();
 
+                        foreach (var itemPos in posRes)
+                        {
+                            var repos = new RePosRes();
+                            repos.SigTime = itemPos.SigTime;
+                            repos.PosLon = itemPos.PosLon;
+                            repos.PosLat = itemPos.PosLat;
+                            repos.MirrLon= itemPos.MirrLon;
+                            repos.MirrLat = itemPos.MirrLat;
+                            repos.TaskInfoID = itemPos.TaskInfoID;
+                            repos.FreqUpHz = itemPos.FreqUpHz;
+                            repos.StationResID = itemPos.StationResID;
+                            repos.CxResID = itemPos.CxResID;
+                            repos.CgResID = itemPos.CgResID;
+                            repos.CheckResID = itemPos.CheckResID;
+                            repos.PosResType = itemPos.PosResType;
+                            repos.TargetState = itemPos.TargetState;
+
+                            repos.TargetInfo = targets?.FirstOrDefault(p => p.ID == itemPos.TargetInfoID);
+                            if (itemPos.TargetInfo != null && !string.IsNullOrWhiteSpace(itemPos.TargetInfo.TargeColor))
+                            {
+                                repos.ColorKey = itemPos.TargetInfo.TargeColor;
+                            }
+                            repos.BaseTargetName = itemPos.TargetInfo?.TargetName;
+                            repos.CheckRes = await db.CheckRes.FirstOrDefaultAsync(p => p.ID == itemPos.CheckResID);
+                            repos.BaseCheckType = itemPos.CheckRes?.PosCheckType?.GetEnumDisplayName();
+                            repos.CgRes = await db.CgRes.FirstOrDefaultAsync(p => p.ID == itemPos.CgResID);
+                            repos.CxRes = await db.CxRes.FirstOrDefaultAsync(p => p.ID == itemPos.CxResID);
+                            repos.StationRes = await db.StationRes.FirstOrDefaultAsync(p => p.ID == itemPos.StationResID);
+                            posList.Add(repos);
+                        }
+                    }
+                }
+                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<RePosRes>>("定位结果时间范围查询异常");
+            }
+        }
         /// <summary>
         /// 查询最后X小时的的定位结果(此方法内部调用)
         /// </summary>

+ 231 - 0
XdCxRhDW.App/EditForms/PosTimeEditor.Designer.cs

@@ -0,0 +1,231 @@
+namespace XdCxRhDW.App.EditForms
+{
+    partial class PosTimeEditor
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
+            this.btnOk = new DevExpress.XtraEditors.SimpleButton();
+            this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
+            this.txtStartTime = new DevExpress.XtraEditors.DateEdit();
+            this.txtEndTime = new DevExpress.XtraEditors.DateEdit();
+            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(this.components);
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
+            this.layoutControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties.CalendarTimeProperties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtEndTime.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtEndTime.Properties.CalendarTimeProperties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider1)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // layoutControl1
+            // 
+            this.layoutControl1.Controls.Add(this.btnOk);
+            this.layoutControl1.Controls.Add(this.btnCancel);
+            this.layoutControl1.Controls.Add(this.txtStartTime);
+            this.layoutControl1.Controls.Add(this.txtEndTime);
+            this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.layoutControl1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControl1.Name = "layoutControl1";
+            this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(831, 101, 650, 400);
+            this.layoutControl1.Root = this.Root;
+            this.layoutControl1.Size = new System.Drawing.Size(255, 156);
+            this.layoutControl1.TabIndex = 0;
+            this.layoutControl1.Text = "layoutControl1";
+            // 
+            // btnOk
+            // 
+            this.btnOk.Location = new System.Drawing.Point(140, 118);
+            this.btnOk.Name = "btnOk";
+            this.btnOk.Size = new System.Drawing.Size(103, 23);
+            this.btnOk.StyleController = this.layoutControl1;
+            this.btnOk.TabIndex = 8;
+            this.btnOk.Text = "确定";
+            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
+            // 
+            // btnCancel
+            // 
+            this.btnCancel.Location = new System.Drawing.Point(17, 118);
+            this.btnCancel.Name = "btnCancel";
+            this.btnCancel.Size = new System.Drawing.Size(103, 23);
+            this.btnCancel.StyleController = this.layoutControl1;
+            this.btnCancel.TabIndex = 7;
+            this.btnCancel.Text = "取消";
+            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+            // 
+            // txtStartTime
+            // 
+            this.txtStartTime.EditValue = null;
+            this.txtStartTime.Location = new System.Drawing.Point(17, 29);
+            this.txtStartTime.Name = "txtStartTime";
+            this.txtStartTime.Properties.AutoHeight = false;
+            this.txtStartTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtStartTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtStartTime.Size = new System.Drawing.Size(226, 22);
+            this.txtStartTime.StyleController = this.layoutControl1;
+            this.txtStartTime.TabIndex = 9;
+            // 
+            // txtEndTime
+            // 
+            this.txtEndTime.EditValue = null;
+            this.txtEndTime.Location = new System.Drawing.Point(17, 82);
+            this.txtEndTime.Name = "txtEndTime";
+            this.txtEndTime.Properties.AutoHeight = false;
+            this.txtEndTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtEndTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtEndTime.Size = new System.Drawing.Size(226, 22);
+            this.txtEndTime.StyleController = this.layoutControl1;
+            this.txtEndTime.TabIndex = 10;
+            // 
+            // Root
+            // 
+            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
+            this.Root.GroupBordersVisible = false;
+            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.layoutControlItem4,
+            this.layoutControlItem5,
+            this.layoutControlItem2,
+            this.layoutControlItem1});
+            this.Root.Name = "Root";
+            this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(15, 10, 10, 10);
+            this.Root.Size = new System.Drawing.Size(255, 156);
+            this.Root.TextVisible = false;
+            // 
+            // layoutControlItem4
+            // 
+            this.layoutControlItem4.Control = this.btnCancel;
+            this.layoutControlItem4.Location = new System.Drawing.Point(0, 96);
+            this.layoutControlItem4.MaxSize = new System.Drawing.Size(0, 37);
+            this.layoutControlItem4.MinSize = new System.Drawing.Size(43, 37);
+            this.layoutControlItem4.Name = "layoutControlItem4";
+            this.layoutControlItem4.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 10, 12, 2);
+            this.layoutControlItem4.Size = new System.Drawing.Size(115, 40);
+            this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem4.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem4.TextVisible = false;
+            // 
+            // layoutControlItem5
+            // 
+            this.layoutControlItem5.Control = this.btnOk;
+            this.layoutControlItem5.Location = new System.Drawing.Point(115, 96);
+            this.layoutControlItem5.MaxSize = new System.Drawing.Size(0, 37);
+            this.layoutControlItem5.MinSize = new System.Drawing.Size(43, 37);
+            this.layoutControlItem5.Name = "layoutControlItem5";
+            this.layoutControlItem5.Padding = new DevExpress.XtraLayout.Utils.Padding(10, 2, 12, 2);
+            this.layoutControlItem5.Size = new System.Drawing.Size(115, 40);
+            this.layoutControlItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem5.TextVisible = false;
+            // 
+            // layoutControlItem2
+            // 
+            this.layoutControlItem2.Control = this.txtStartTime;
+            this.layoutControlItem2.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlItem2.MaxSize = new System.Drawing.Size(0, 43);
+            this.layoutControlItem2.MinSize = new System.Drawing.Size(54, 43);
+            this.layoutControlItem2.Name = "layoutControlItem2";
+            this.layoutControlItem2.Size = new System.Drawing.Size(230, 43);
+            this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem2.Text = "开始时间(北京)";
+            this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem2.TextSize = new System.Drawing.Size(82, 14);
+            // 
+            // layoutControlItem1
+            // 
+            this.layoutControlItem1.Control = this.txtEndTime;
+            this.layoutControlItem1.Location = new System.Drawing.Point(0, 43);
+            this.layoutControlItem1.MaxSize = new System.Drawing.Size(0, 53);
+            this.layoutControlItem1.MinSize = new System.Drawing.Size(54, 53);
+            this.layoutControlItem1.Name = "layoutControlItem1";
+            this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
+            this.layoutControlItem1.Size = new System.Drawing.Size(230, 53);
+            this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem1.Text = "结束时间(北京)";
+            this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem1.TextSize = new System.Drawing.Size(82, 14);
+            // 
+            // dxErrorProvider1
+            // 
+            this.dxErrorProvider1.ContainerControl = this;
+            // 
+            // PosTimeEditor
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(255, 156);
+            this.Controls.Add(this.layoutControl1);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+            this.Name = "PosTimeEditor";
+            this.Text = "重新定位参数";
+            this.Load += new System.EventHandler(this.SatEditor_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
+            this.layoutControl1.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties.CalendarTimeProperties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtStartTime.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtEndTime.Properties.CalendarTimeProperties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtEndTime.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider1)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private DevExpress.XtraLayout.LayoutControl layoutControl1;
+        private DevExpress.XtraLayout.LayoutControlGroup Root;
+        private DevExpress.XtraEditors.SimpleButton btnOk;
+        private DevExpress.XtraEditors.SimpleButton btnCancel;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
+        private DevExpress.XtraEditors.DateEdit txtStartTime;
+        private DevExpress.XtraEditors.DateEdit txtEndTime;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
+        private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1;
+    }
+}

+ 84 - 0
XdCxRhDW.App/EditForms/PosTimeEditor.cs

@@ -0,0 +1,84 @@
+using DevExpress.XtraEditors;
+using ExtensionsDev;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Entity;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using XdCxRhDW.Entity;
+using XdCxRhDW.Repostory;
+
+namespace XdCxRhDW.App.EditForms
+{
+    public partial class PosTimeEditor : DevExpress.XtraEditors.XtraForm
+    {
+        static Dictionary<int, (DateTime, DateTime)> cache = new Dictionary<int, (DateTime, DateTime)>();
+        public DateTime start;
+        public DateTime end;
+        TaskInfo tsk;
+        public PosTimeEditor()
+        {
+            InitializeComponent();
+            this.layoutControl1.UseDefault();
+            this.txtStartTime.UseDefault().UseDoubleClickToSelectAll();
+            this.txtEndTime.UseDefault().UseDoubleClickToSelectAll();
+            this.StartPosition = FormStartPosition.CenterParent;
+        }
+        public PosTimeEditor(TaskInfo tsk)
+            : this()
+        {
+            this.tsk = tsk;
+        }
+        private void SatEditor_Load(object sender, EventArgs e)
+        {
+            if (cache.ContainsKey(tsk.ID))
+            {
+                txtStartTime.DateTime = cache[tsk.ID].Item1;
+                txtEndTime.DateTime = cache[tsk.ID].Item2;
+            }
+            else
+            {
+                txtStartTime.DateTime = DateTime.Now;
+                txtEndTime.DateTime = DateTime.Today.AddDays(7);
+            }
+        }
+
+        private void btnCancel_Click(object sender, EventArgs e)
+        {
+            this.DialogResult = DialogResult.Cancel;
+        }
+        private void btnOk_Click(object sender, EventArgs e)
+        {
+            if (this.txtStartTime.DateTime == DateTime.MinValue)
+            {
+                DxHelper.MsgBoxHelper.ShowWarning("开始时间不能为空!");
+                return;
+            }
+            if (this.txtEndTime.DateTime == DateTime.MinValue)
+            {
+                DxHelper.MsgBoxHelper.ShowWarning("结束时间不能为空!");
+                return;
+            }
+            start = DateTime.Parse(txtStartTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));//通过转换移除掉毫秒部分
+            end = DateTime.Parse(txtEndTime.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));//通过转换移除掉毫秒部分
+            if (start > end)
+            {
+                dxErrorProvider1.SetError(txtEndTime, "结束时间不能小于开始时间");
+                return;
+            }
+            if (cache.Count >= 50)
+                cache.Remove(cache.First().Key);
+            if (cache.ContainsKey(tsk.ID))
+                cache[tsk.ID] = (start, end);
+            else
+                cache.Add(tsk.ID, (start, end));
+            this.DialogResult = DialogResult.OK;
+        }
+    }
+}

+ 123 - 0
XdCxRhDW.App/EditForms/PosTimeEditor.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="dxErrorProvider1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 71 - 0
XdCxRhDW.App/Model/RePosRes.cs

@@ -0,0 +1,71 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XdCxRhDW.Entity;
+
+namespace XdCxRhDW.App.Model
+{
+    public class RePosRes : PosData
+    {
+        [Display(Name = "任务编号")]
+        public int TaskInfoID { get; set; }
+
+        [Display(Name = "上行频点")]
+        public long FreqUpHz { get; set; }
+
+        [Display(Name = "站点ID")]
+        public long StationResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+       
+        public virtual StationRes StationRes { get; set; }
+
+        [Display(Name = "测向编号")]
+        public long? CxResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+       
+        public virtual CxRes CxRes { get; set; }
+
+        [NotMapped]
+        [Display(AutoGenerateField = false)]
+        public string BaseCheckType { get; set; }
+
+        [Display(Name = "参估编号")]
+        public long CgResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+     
+        public virtual CgRes CgRes { get; set; }
+
+        [Display(AutoGenerateField = false)]
+        public int? TargetInfoID { get; set; }
+        public TargetInfo TargetInfo;
+
+        [NotMapped]
+        [Display(AutoGenerateField = false)]
+        public string BaseTargetName { get; set; }
+
+        [Display(Name = "检测编号")]
+        public long? CheckResID { get; set; }
+
+        [Display(AutoGenerateField = false)]
+       
+        public virtual CheckRes CheckRes { get; set; }
+
+        [Display(Name = "定位类型")]
+        [ToolTip]
+        public EnumPosResType PosResType { get; set; }
+
+        [Display(Name = "目标状态")]
+        [ToolTip]
+        public EnumTargetState TargetState { get; set; }
+
+
+    }
+}

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

@@ -1122,10 +1122,142 @@ namespace XdCxRhDW.App.UserControl
                     break;
             }
         }
+
+        public void RePosition(List<RePosRes> items)
+        {
+            if (items.Count == 0) return;
+            Task.Run(async () =>
+            {
+                foreach (var item in items)
+                {
+                    switch (item.PosResType)
+                    {
+                        case EnumPosResType.X1D1CX:
+                            var StationRes = new StationRes()
+                            {
+                                SatTxLon = item.StationRes.SatTxLon,
+                                SatTxLat = item.StationRes.SatTxLat,
+                                CdbTxLon = item.StationRes.CdbTxLon,
+                                CdbTxLat = item.StationRes.CdbTxLat,
+                                CxLon = item.StationRes.CxLon,
+                                CxLat = item.StationRes.CxLat,
+                                RefLon = item.StationRes.RefLon,
+                                RefLat = item.StationRes.RefLat,
+                            };
+                            var mainxlInfo = await XlRepository.GetLatestAsync(item.CgRes.MainCode.Value, item.SigTime);
+                            if (mainxlInfo == null)
+                            {
+                                Serilog.Log.Error($"重新定位异常:卫星:{item.CgRes.MainCode.Value}未找到对应的星历信息,请导入星历");
+                                continue;
+                            }
+                            var maineph = EphHelper.Calc(mainxlInfo.TwoLine, item.SigTime);
+                            var cgRes = new CgRes()
+                            {
+                                SigTime = item.SigTime,
+                                DtoCdb = item.CgRes.DtoCdb,
+                                YbMainDto = item.CgRes.YbMainDto,
+                                MainX = maineph.X,
+                                MainY = maineph.Y,
+                                MainZ = maineph.Z,
+                            };
+                            var cxRes = new CxRes()
+                            {
+                                SigTime = item.SigTime,
+                                Fx = item.CxRes.Fx,
+                            };
+                            var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes);
+
+                            break;
+                        case EnumPosResType.X2D1:
+                        case EnumPosResType.X2D1NoRef:
+
+                            break;
+                        case EnumPosResType.X3:
+                        case EnumPosResType.X3NoRef:
+
+                            break;
+                        case EnumPosResType.X3TwoDfo:
+
+                            break;
+                        case EnumPosResType.X2Dfo:
+
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                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 tarItems = await db.PosRes.Where(p => ids.Contains(p.ID)).ToArrayAsync();
+                        tarItems.ForEach(t =>
+                        {
+                            var repos = items.First(p => p.ID == t.ID);
+                            t.PosLon = repos.PosLon;
+                            t.PosLat = repos.PosLat;
+                            t.MirrLon = repos.MirrLon;
+                            t.MirrLat = repos.MirrLat;
+                        });
+                        db.PosRes.AddOrUpdate(tarItems);
+                        await db.SaveChangesAsync();
+                    }
+                }
+
+
+            });
+        }
         //重新定位
-        public void Repos(List<ModelPosRes> dataSource)
+        public async void Repos(List<ModelPosRes> dataSource)
         {
-            MsgBoxHelper.ShowWarning("该功能暂未实现");
+            if (tsk == null)
+            {
+                MsgBoxHelper.ShowWarning("请选择需要重新定位的任务");
+                return;
+            }
+            PosTimeEditor frm = new PosTimeEditor(tsk);
+            if (frm.ShowDialog() != DialogResult.OK) return;
+
+            var dto = new PosRequestByTimeRangeDto()
+            {
+                TarFrequpHz = (long?)txtFrequpMHz.EditValue,
+                BeginTime = frm.start,
+                EndTime = frm.end,
+                TaskInfoID = tsk.ID,
+                IncludeInvalidate = btnIncludeInvalidate.Checked
+
+            };
+            string baseUrl = null;
+            using (RHDWContext db = new RHDWContext())
+            {
+                var setings = await db.SysSetings.FirstOrDefaultAsync();
+                if (setings != null)
+                {
+                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{setings.HttpPort}/api/";
+                }
+            }
+            try
+            {
+                var ct = new CancellationTokenSource();
+                var res = await HttpHelper.PostRequestAsync<List<RePosRes>>(baseUrl + "Pos/GetPosCgResByTimeRangeObsolete", dto, token: ct.Token);
+                if (res.code == 200)
+                {
+                    RePosition(res.data);
+                }
+                else
+                {
+                    MsgBoxHelper.ShowError(res.msg);
+                }
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, "重新定位结果查询异常");
+                MsgBoxHelper.ShowError("重新定位结果查询异常");
+            }
+
+
         }
         #endregion
 
@@ -1160,7 +1292,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItems in groupData)
                 {
                     var ids = groupItems.Select(p => p.ID);
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(items.First().SigTime))
+                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItems.First().SigTime))
                     {
                         var tarItems = await db.PosRes.Where(p => ids.Contains(p.ID)).ToArrayAsync();
                         tarItems.ForEach(t =>

+ 10 - 0
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -185,6 +185,12 @@
     <Compile Include="DxHelper\PopupHelper.cs" />
     <Compile Include="DxHelper\SvgHelper.cs" />
     <Compile Include="DxHelper\WaitHelper.cs" />
+    <Compile Include="EditForms\PosTimeEditor.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="EditForms\PosTimeEditor.Designer.cs">
+      <DependentUpon>PosTimeEditor.cs</DependentUpon>
+    </Compile>
     <Compile Include="EditForms\TaskHistoryTimeEditor.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -298,6 +304,7 @@
     <Compile Include="Model\ModelSvrs.cs" />
     <Compile Include="Model\ModelCg.cs" />
     <Compile Include="Model\ModelCgXgf.cs" />
+    <Compile Include="Model\RePosRes.cs" />
     <Compile Include="PopupControl\ShowCgCtrl.cs">
       <SubType>UserControl</SubType>
     </Compile>
@@ -424,6 +431,9 @@
     <EmbeddedResource Include="CorTools\XlCalculateForm.resx">
       <DependentUpon>XlCalculateForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="EditForms\PosTimeEditor.resx">
+      <DependentUpon>PosTimeEditor.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="EditForms\TaskHistoryTimeEditor.resx">
       <DependentUpon>TaskHistoryTimeEditor.cs</DependentUpon>
     </EmbeddedResource>