zoulei 1 жил өмнө
parent
commit
e0b9765a05
34 өөрчлөгдсөн 606 нэмэгдсэн , 263 устгасан
  1. BIN
      XdCxRhDW.Api/AddIns/GDOP误差椭圆/GDOP_Draw_11.dll
  2. BIN
      XdCxRhDW.Api/AddIns/GDOP误差椭圆/Tle2XYZ.dll
  3. 49 0
      XdCxRhDW.Api/AddIns/GDOP误差椭圆/Tle2XYZ.h
  4. BIN
      XdCxRhDW.Api/AddIns/信号测量/SignalProc.dll
  5. BIN
      XdCxRhDW.Api/AddIns/时差线/Positioning.dll
  6. BIN
      XdCxRhDW.Api/AddIns/星历推算/Tle2XYZ.dll
  7. 49 0
      XdCxRhDW.Api/AddIns/星历推算/Tle2XYZ.h
  8. BIN
      XdCxRhDW.Api/AddIns/检测Cpu参估/XcorrCpu.exe
  9. BIN
      XdCxRhDW.Api/AddIns/频差线/Positioning.dll
  10. 49 0
      XdCxRhDW.Api/AddIns/频差线/Positioning.h
  11. 6 0
      XdCxRhDW.Api/XdCxRhDW.Api.csproj
  12. 7 0
      XdCxRhDW.App/App.config
  13. 13 0
      XdCxRhDW.App/AppConst.cs
  14. 7 1
      XdCxRhDW.App/Controllers/PosController.cs
  15. 58 0
      XdCxRhDW.App/Controllers/TaskController.cs
  16. 10 6
      XdCxRhDW.App/EditForms/TaskEditor.cs
  17. 32 16
      XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.Designer.cs
  18. 12 4
      XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.cs
  19. 3 0
      XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.resx
  20. 33 9
      XdCxRhDW.App/ExtensionsDev/MapControlEx.cs
  21. 2 2
      XdCxRhDW.App/Model/ModelPosRes.cs
  22. 9 3
      XdCxRhDW.App/Program.cs
  23. 40 13
      XdCxRhDW.App/UserControl/CtrlHome.cs
  24. 64 103
      XdCxRhDW.App/UserControl/CtrlSysSettings.Designer.cs
  25. 13 60
      XdCxRhDW.App/UserControl/CtrlSysSettings.cs
  26. 2 0
      XdCxRhDW.App/XdCxRhDW.App.csproj
  27. 28 9
      XdCxRhDW.Entity/EntityEnum.cs
  28. 8 0
      XdCxRhDW.Entity/PosRes.cs
  29. 7 12
      XdCxRhDW.Entity/SysSetings.cs
  30. 6 6
      XdCxRhDW.Framework/HttpHelper.cs
  31. 1 5
      XdCxRhDW.X2D1TaskServer/Controllers/HistoryTaskProcessingController.cs
  32. 89 12
      XdCxRhDW.X2D1TaskServer/Service/HistoryTaskService.cs
  33. 2 2
      XdCxRhDW.X2D1TaskServer54/Service/HistoryTaskService.cs
  34. 7 0
      XdCxRhDw.Dto/TaskHandleDto/TaskStopHandleDto.cs

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


BIN
XdCxRhDW.Api/AddIns/GDOP误差椭圆/Tle2XYZ.dll


+ 49 - 0
XdCxRhDW.Api/AddIns/GDOP误差椭圆/Tle2XYZ.h

@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef _WIN32
+# if defined(Tle2XYZ_LIB)
+#  define Tle2XYZ_EXPORT __declspec(dllexport)
+# else
+#  define Tle2XYZ_EXPORT __declspec(dllimport)
+# endif
+#else
+#  define Tle2XYZ_EXPORT
+#endif
+
+extern "C"
+{
+	///
+	/// line1: 双行第一列
+	/// line2: 双行第二列
+	/// st:	   开始时间
+	/// period:周期
+	/// count: 次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT void GenerateXYZByPeriod(char *line1, char *line2, long long st, int period, int count, double *retbuf);
+	///
+	/// line1: 双行第一列
+	/// line2: 双行第二列
+	/// sts:	   开始时间
+	/// count: 次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT void GenerateXYZByTimes(char *line1, char *line2, long long *sts, int count, double *retbuf);
+
+
+	///
+	/// ct: 轨道六根数时间
+	/// orbita: semi-major axis 长半轴
+	/// orbite:	偏心率      Eccentricity
+	/// orbiti: 轨道倾角    inclination
+	/// orbitom: 近地点辐角 Argument of periapsis
+	/// orbitRAAN: 升交点经度 RAAN
+	/// orbitta: 真近点角
+	/// rt:		输出时间起点  rt < ct 函数返回false
+	/// period: 周期
+	/// count:  次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT bool GenerateXYZByPeriodWithOrbit(long long ct, double orbita, double orbite, double orbiti, double orbitom, double orbitRAAN, double orbitta
+		, long long st, int period, int count, double *retbuf);
+};

BIN
XdCxRhDW.Api/AddIns/信号测量/SignalProc.dll


BIN
XdCxRhDW.Api/AddIns/时差线/Positioning.dll


BIN
XdCxRhDW.Api/AddIns/星历推算/Tle2XYZ.dll


+ 49 - 0
XdCxRhDW.Api/AddIns/星历推算/Tle2XYZ.h

@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef _WIN32
+# if defined(Tle2XYZ_LIB)
+#  define Tle2XYZ_EXPORT __declspec(dllexport)
+# else
+#  define Tle2XYZ_EXPORT __declspec(dllimport)
+# endif
+#else
+#  define Tle2XYZ_EXPORT
+#endif
+
+extern "C"
+{
+	///
+	/// line1: 双行第一列
+	/// line2: 双行第二列
+	/// st:	   开始时间
+	/// period:周期
+	/// count: 次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT void GenerateXYZByPeriod(char *line1, char *line2, long long st, int period, int count, double *retbuf);
+	///
+	/// line1: 双行第一列
+	/// line2: 双行第二列
+	/// sts:	   开始时间
+	/// count: 次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT void GenerateXYZByTimes(char *line1, char *line2, long long *sts, int count, double *retbuf);
+
+
+	///
+	/// ct: 轨道六根数时间
+	/// orbita: semi-major axis 长半轴
+	/// orbite:	偏心率      Eccentricity
+	/// orbiti: 轨道倾角    inclination
+	/// orbitom: 近地点辐角 Argument of periapsis
+	/// orbitRAAN: 升交点经度 RAAN
+	/// orbitta: 真近点角
+	/// rt:		输出时间起点  rt < ct 函数返回false
+	/// period: 周期
+	/// count:  次数
+	/// retbuf: 存储结果 长度为 count * 6
+	///
+	Tle2XYZ_EXPORT bool GenerateXYZByPeriodWithOrbit(long long ct, double orbita, double orbite, double orbiti, double orbitom, double orbitRAAN, double orbitta
+		, long long st, int period, int count, double *retbuf);
+};

BIN
XdCxRhDW.Api/AddIns/检测Cpu参估/XcorrCpu.exe


BIN
XdCxRhDW.Api/AddIns/频差线/Positioning.dll


+ 49 - 0
XdCxRhDW.Api/AddIns/频差线/Positioning.h

@@ -0,0 +1,49 @@
+#pragma once
+
+#ifdef _WIN32
+# if defined(Positioning_LIB)
+#  define Positioning_EXPORT __declspec(dllexport)
+# else
+#  define Positioning_EXPORT __declspec(dllimport)
+# endif
+#else
+#  define Positioning_EXPORT
+#endif
+
+extern "C"
+{
+	/*
+	双星时差线
+	LOP_Value 返回值 结构参考DTO_Plot
+	LOP_Len*3为LOP_Value的长度
+	*/
+	Positioning_EXPORT void CurveByTwoTDOA(double *main_sat_pos, double *neigh_sat_pos, double *rec_pos1, double *rec_pos2, double *ref_pos,
+		double *Zone, double target_dto, double ref_dto, double **LOP_Value, int *LOP_Len);
+
+	/*
+	双星时差线-无参
+	LOP_Value 返回值 结构参考DTO_Plot
+	LOP_Len*3为LOP_Value的长度
+	*/
+	Positioning_EXPORT void CurveByTwoTDOAWithNoRef(double *main_sat_pos, double *neigh_sat_pos, double *rec_pos1, double *rec_pos2,
+		double *Zone, double target_dto, double **LOP_Value, int *LOP_Len);
+
+	/*
+	三星定位
+	target_llh,长度固定为6  经度、纬度、高;(镜像)经度、纬度、高
+	*/
+	Positioning_EXPORT void HyperbolicPositioning(double *main_sat, double *neigh_sat1, double *neigh_sat2, double *Sat_Station_LLH1, double *Sat_Station_LLH2, double *Sat_Station_LLH3,
+		double *Ref_Station_LLH, double *Zone, double target_dto1, double target_dto2, double ref_dto1, double ref_dto2, double *target_llh);
+
+	/*
+	三星定位
+	target_llh,长度固定为6	经度、纬度、高;(镜像)经度、纬度、高
+	*/
+	Positioning_EXPORT void HyperbolicPositioningWithNoRef(double *main_sat, double *neigh_sat1, double *neigh_sat2, double *Sat_Station_LLH1, double *Sat_Station_LLH2, double *Sat_Station_LLH3,
+		double *Zone, double target_dto1, double target_dto2, double *target_llh);
+
+	/*
+	用于释放时差线缓存
+	*/
+	Positioning_EXPORT void Destory(void *buf);
+};

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

@@ -218,5 +218,11 @@
     </None>
     <None Include="AddIns\信号测量\SignalProc.h" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="AddIns\GDOP误差椭圆\Tle2XYZ.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="AddIns\频差线\Positioning.h" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 7 - 0
XdCxRhDW.App/App.config

@@ -11,6 +11,13 @@
 		<add key="Company" value="" />
 		<!--本机IP,没有则由程序自动获取-->
 		<add key="LocalIP" value="" />
+
+		<!--自采集地图源URL-->
+		<add key="ZCJ_URL" value="http://192.168.0.1:12338/static/source/assets/textures"/>
+
+		<!--数据中心地图源URL-->
+		<add key="SJZX_URL" value="http://192.168.1.2:5889/MapServer"/>
+
 	</appSettings>
 	<startup>
 		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />

+ 13 - 0
XdCxRhDW.App/AppConst.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.App
+{
+    static class AppConst
+    {
+        public static bool Debug = false;
+    }
+}

+ 7 - 1
XdCxRhDW.App/Controllers/PosController.cs

@@ -2170,8 +2170,12 @@ namespace XdCxRhDW.App.Controllers
                         {
                             itemPos.TargetInfo = targets?.FirstOrDefault(p => p.ID == itemPos.TargetInfoID);
                             if (itemPos.TargetInfo != null && !string.IsNullOrWhiteSpace(itemPos.TargetInfo.TargeColor))
+                            {
                                 itemPos.ColorKey = itemPos.TargetInfo.TargeColor;
+                            }
+                            itemPos.BaseTargetName = itemPos.TargetInfo?.TargetName;
                             itemPos.CheckRes = await db.CheckRes.FirstOrDefaultAsync(p => p.ID == itemPos.CheckResID);
+                            itemPos.BaseCheckType = itemPos.CheckRes?.PosCheckType?.GetEnumDisplayName();
                         }
                         posList.AddRange(posRes);
                         return Success(posList);
@@ -2267,7 +2271,7 @@ namespace XdCxRhDW.App.Controllers
                 PosLat = res.PosLat,
                 MirrLon = res.MirrLon,
                 MirrLat = res.MirrLat,
-                CheckType = res.CheckRes?.PosCheckType == null ? "" : res.CheckRes?.PosCheckType.GetEnumDisplayName(),
+                CheckType = res.CheckRes?.PosCheckType == null ? "" : res.CheckRes?.PosCheckType?.GetEnumDisplayName(),
                 TargetState = (EnumTargetStateDto)res.TargetState,
                 PosResType = (EnumPosResTypeDto)res.PosResType
             };
@@ -2298,6 +2302,8 @@ namespace XdCxRhDW.App.Controllers
                 TargetInfo = res.TargetInfo,
                 TargetInfoID = res.TargetInfoID,
                 UpdateTime = res.UpdateTime,
+                BaseTargetName = res.TargetInfo?.TargetName,
+                BaseCheckType = res.CheckRes?.PosCheckType?.GetEnumDisplayName(),
             };
         }
 

+ 58 - 0
XdCxRhDW.App/Controllers/TaskController.cs

@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Data.Entity;
+using System.Data.Entity.Migrations;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.Http;
+using XdCxRhDW.Dto;
+using XdCxRhDW.Api;
+using XdCxRhDW.Entity;
+using XdCxRhDW.Repostory;
+using XdCxRhDW.WebApi;
+
+namespace XdCxRhDW.App.Controllers
+{
+    /// <summary>
+    /// 任务相关接口
+    /// </summary>
+    public class TaskController : BaseController
+    {
+        /// <summary>
+        /// 停止任务
+        /// </summary>
+        /// <param name="dto">任务停止参数</param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<AjaxResult> StopTask(TaskStopHandleDto dto)
+        {
+            try
+            {
+                using (RHDWContext db = new RHDWContext())
+                {
+                    var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == dto.ID);
+                    if (item == null)
+                    {
+                        return Error($"任务停止失败,找不到ID={dto.ID}的任务");
+                    }
+                    item.TaskState = EnumTaskState.Stopped;
+                    await db.SaveChangesAsync();
+                }
+                Messenger.Defalut.Pub("任务状态改变", dto.ID);
+                Serilog.Log.Information($"任务停止完成,ID={dto.ID}.停止原因:{dto.StopReason}");
+                return Success();
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, $"任务停止异常.ID={dto.ID}");
+                return Error(ex.Message);
+
+            }
+        }
+
+    }
+}

+ 10 - 6
XdCxRhDW.App/EditForms/TaskEditor.cs

@@ -115,6 +115,7 @@ namespace XdCxRhDW.App.EditForms
             try
             {
                 dxErrorProvider.ClearErrors();
+                var posType = (EnumPosType)txtPosType.Properties.Items[txtPosType.SelectedIndex].Value;
                 if (txtTaskName.EditValue == null)
                 {
                     dxErrorProvider.SetError(txtTaskName, "请填写任务名");
@@ -127,12 +128,21 @@ namespace XdCxRhDW.App.EditForms
                 }
                 if ((EnumSigType)txtSignalType.EditValue == EnumSigType.SX)
                 {
+
                     if (string.IsNullOrWhiteSpace(txtDetectionWay.Text))
                     {
                         dxErrorProvider.SetError(txtDetectionWay, "请选择检测方式");
                         return;
                     }
                 }
+                else
+                {
+                    if (posType == EnumPosType.RH || posType == EnumPosType.X2D1 || posType == EnumPosType.X1D1CX)
+                    {
+                        dxErrorProvider.SetError(txtSignalType, posType.GetEnumDisplayName() + "不支持常规信号");
+                        return;
+                    }
+                }
                 if (this.Text == "添加任务")
                 {
                     using (RHDWContext db = new RHDWContext())
@@ -155,7 +165,6 @@ namespace XdCxRhDW.App.EditForms
                         }
                     }
                 }
-                var posType = (EnumPosType)txtPosType.Properties.Items[txtPosType.SelectedIndex].Value;
                 if (posType == EnumPosType.X1D1CX)
                 {
                     if (txtMainSat.EditValue == null)
@@ -211,11 +220,6 @@ namespace XdCxRhDW.App.EditForms
                         dxErrorProvider.SetError(txtCapDir, "请填写采集文件目录");
                         return;
                     }
-                    if (string.IsNullOrWhiteSpace(txtCapDirFormat.Text))
-                    {
-                        dxErrorProvider.SetError(txtCapDirFormat, "请填写目录日期格式");
-                        return;
-                    }
                     if (string.IsNullOrWhiteSpace(txtDoFreqUp.Text))
                     {
                         dxErrorProvider.SetError(txtDoFreqUp, "请填写要处理的频点");

+ 32 - 16
XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.Designer.cs

@@ -28,6 +28,7 @@
         /// </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();
@@ -38,6 +39,7 @@
             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();
@@ -49,6 +51,7 @@
             ((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
@@ -62,15 +65,15 @@
             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(271, 171);
+            this.layoutControl1.Size = new System.Drawing.Size(239, 156);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
             // btnOk
             // 
-            this.btnOk.Location = new System.Drawing.Point(145, 118);
+            this.btnOk.Location = new System.Drawing.Point(132, 118);
             this.btnOk.Name = "btnOk";
-            this.btnOk.Size = new System.Drawing.Size(114, 22);
+            this.btnOk.Size = new System.Drawing.Size(95, 23);
             this.btnOk.StyleController = this.layoutControl1;
             this.btnOk.TabIndex = 8;
             this.btnOk.Text = "确定";
@@ -78,9 +81,9 @@
             // 
             // btnCancel
             // 
-            this.btnCancel.Location = new System.Drawing.Point(12, 118);
+            this.btnCancel.Location = new System.Drawing.Point(17, 118);
             this.btnCancel.Name = "btnCancel";
-            this.btnCancel.Size = new System.Drawing.Size(113, 22);
+            this.btnCancel.Size = new System.Drawing.Size(95, 23);
             this.btnCancel.StyleController = this.layoutControl1;
             this.btnCancel.TabIndex = 7;
             this.btnCancel.Text = "取消";
@@ -89,28 +92,28 @@
             // txtStartTime
             // 
             this.txtStartTime.EditValue = null;
-            this.txtStartTime.Location = new System.Drawing.Point(12, 29);
+            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(247, 22);
+            this.txtStartTime.Size = new System.Drawing.Size(210, 22);
             this.txtStartTime.StyleController = this.layoutControl1;
             this.txtStartTime.TabIndex = 9;
             // 
             // txtEndTime
             // 
             this.txtEndTime.EditValue = null;
-            this.txtEndTime.Location = new System.Drawing.Point(12, 82);
+            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(247, 22);
+            this.txtEndTime.Size = new System.Drawing.Size(210, 22);
             this.txtEndTime.StyleController = this.layoutControl1;
             this.txtEndTime.TabIndex = 10;
             // 
@@ -124,26 +127,33 @@
             this.layoutControlItem2,
             this.layoutControlItem1});
             this.Root.Name = "Root";
-            this.Root.Size = new System.Drawing.Size(271, 171);
+            this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(15, 10, 10, 10);
+            this.Root.Size = new System.Drawing.Size(239, 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(125, 55);
+            this.layoutControlItem4.Size = new System.Drawing.Size(107, 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(125, 96);
+            this.layoutControlItem5.Location = new System.Drawing.Point(107, 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(126, 55);
+            this.layoutControlItem5.Size = new System.Drawing.Size(107, 40);
+            this.layoutControlItem5.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem5.TextVisible = false;
             // 
@@ -154,7 +164,7 @@
             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(251, 43);
+            this.layoutControlItem2.Size = new System.Drawing.Size(214, 43);
             this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem2.Text = "开始时间";
             this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top;
@@ -168,17 +178,21 @@
             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(251, 53);
+            this.layoutControlItem1.Size = new System.Drawing.Size(214, 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(48, 14);
             // 
+            // dxErrorProvider1
+            // 
+            this.dxErrorProvider1.ContainerControl = this;
+            // 
             // TaskHistoryTimeEditor
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(271, 171);
+            this.ClientSize = new System.Drawing.Size(239, 156);
             this.Controls.Add(this.layoutControl1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
             this.Name = "TaskHistoryTimeEditor";
@@ -195,6 +209,7 @@
             ((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);
 
         }
@@ -211,5 +226,6 @@
         private DevExpress.XtraEditors.DateEdit txtEndTime;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
+        private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1;
     }
 }

+ 12 - 4
XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.cs

@@ -18,7 +18,7 @@ namespace XdCxRhDW.App.EditForms
 {
     public partial class TaskHistoryTimeEditor : DevExpress.XtraEditors.XtraForm
     {
-        Dictionary<int, (DateTime, DateTime)> cache = new Dictionary<int, (DateTime, DateTime)>();
+        static Dictionary<int, (DateTime, DateTime)> cache = new Dictionary<int, (DateTime, DateTime)>();
         public DateTime start;
         public DateTime end;
         TaskInfo tsk;
@@ -55,11 +55,19 @@ namespace XdCxRhDW.App.EditForms
         }
         private void btnOk_Click(object sender, EventArgs e)
         {
-            start = txtStartTime.DateTime;
-            end = txtEndTime.DateTime;
+            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);
-            cache.Add(tsk.ID, (start, end));
+            if (cache.ContainsKey(tsk.ID))
+                cache[tsk.ID] = (start, end);
+            else
+                cache.Add(tsk.ID, (start, end));
             this.DialogResult = DialogResult.OK;
         }
     }

+ 3 - 0
XdCxRhDW.App/EditForms/TaskHistoryTimeEditor.resx

@@ -117,4 +117,7 @@
   <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>

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

@@ -29,6 +29,7 @@ using System.Security.Policy;
 using System.Text;
 using System.Threading;
 using System.Windows.Forms;
+using XdCxRhDW.App;
 using XdCxRhDW.Entity;
 using XdCxRhDW.Repostory;
 
@@ -134,7 +135,7 @@ public static class MapControlEx
         {
             if (e.SelectedObject == null) return;
             SuperToolTip superToolTip = new SuperToolTip();
-            if (innerData.posMenu.Visible||innerData.mapMenu.Visible||innerData.rectMenu.Visible)
+            if (innerData.posMenu.Visible || innerData.mapMenu.Visible || innerData.rectMenu.Visible)
             {
                 e.SuperTip = null;
                 e.ToolTip = null;
@@ -848,14 +849,16 @@ public static class MapControlEx
     /// </summary>
     /// <param name="ctrl"></param>
     /// <param name="url">such as http://192.168.100.63:58089</param>
-    /// <param name="layerName"></param>
+    /// <param name="source"></param>
+    /// <param name="layerType"></param>
     /// <returns></returns>
-    public static MapControl UseWMTS(this MapControl ctrl, string url, string layerName)
+    public static MapControl UseWMTS(this MapControl ctrl, string url, EnumWmtsSource source, EnumMapLayerType layerType)
     {
         var provider = new HttpMapDataProvider();
         var tileSource = provider.TileSource as HttpTileSource;
         tileSource.HttpServerAddr = url;
-        tileSource.layerName = layerName;
+        tileSource.WmtsSource = source;
+        tileSource.LayerType = layerType;
         ctrl.GetImageLayer().DataProvider = provider;
         ctrl.MinZoomLevel = 3;
         ctrl.MaxZoomLevel = 20;
@@ -2560,8 +2563,8 @@ public static class MapControlEx
         public const int maxZoomLevel = 14;
 
         public string HttpServerAddr { get; set; }
-        public EnumWmsType WmsType { get; set; }
-        public string layerName { get; set; }
+        public EnumWmtsSource WmtsSource { get; set; }
+        public EnumMapLayerType LayerType { get; set; }
         public GoogleMapType MapType { get; set; } = GoogleMapType.Normal;
 
         internal static double CalculateTotalImageSize(double zoomLevel)
@@ -2585,10 +2588,31 @@ public static class MapControlEx
                 {
                     string imgUrl = string.Empty;
                     // imgUrl = $"{HttpServerAddr}/{(int)MapType}/{zoomLevel}/{tilePositionX}/{tilePositionY}";
-                    if (WmsType == EnumWmsType.SJZX)
-                        imgUrl = $"{HttpServerAddr}/MapServer?lyr={layerName}&x={tilePositionX}&y={tilePositionY}&z={zoomLevel}";
+                    string layerName;
+                    if (WmtsSource == EnumWmtsSource.SJZX)
+                    {
+                        if (LayerType == EnumMapLayerType.SatMap)
+                            layerName = "satellite";
+                        else
+                            layerName = "electron";
+                        imgUrl = $"{HttpServerAddr}?lyr={layerName}&x={tilePositionX}&y={tilePositionY}&z={zoomLevel}";
+                    }
                     else
-                        imgUrl = $"{HttpServerAddr}/static/Source/Assets/Textures/overlay-final/{zoomLevel}/{tilePositionX}/{-tilePositionY}.png";
+                    {
+                        if (LayerType == EnumMapLayerType.SatMap)
+                            layerName = "NaturalEarthII";
+                        else if (LayerType == EnumMapLayerType.RoadMap)
+                            layerName = "roadmap-final";
+                        else
+                            layerName = "overlay-final";
+                        imgUrl = $"{HttpServerAddr}/{layerName}/{zoomLevel}/{tilePositionX}/{tilePositionY}.png";
+
+
+                    }
+                    if (AppConst.Debug)
+                    {
+                        Serilog.Log.Information(imgUrl);
+                    }
                     //string imgUrl = string.Format("http://192.168.0.214:58089/{0}/{1}/{2}/{3}", (int)GoogleMapType.Normal, zoomLevel, tilePositionX, tilePositionY);
                     Uri u = new Uri(imgUrl);
                     return u;

+ 2 - 2
XdCxRhDW.App/Model/ModelPosRes.cs

@@ -18,10 +18,10 @@ namespace XdCxRhDW.App.Model
         }
         [Display(Name = "目标名称")]
         [ToolTip]
-        public string TargetName => TargetInfo?.TargetName;
+        public string TargetName => BaseTargetName;
 
         [Display(Name = "检测方式")]
         [ToolTip]
-        public EnumPosCheckType? CheckType => CheckRes?.PosCheckType;
+        public string CheckType => BaseCheckType;
     }
 }

+ 9 - 3
XdCxRhDW.App/Program.cs

@@ -13,6 +13,7 @@ using System.Security.Principal;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using XdCxRhDW.App;
 using XdCxRhDW.Dto;
 
 namespace XdCxRhDW
@@ -68,10 +69,11 @@ namespace XdCxRhDW
             }
             return result;
         }
-        static void RestartAsAdmin()
+        static void RestartAsAdmin(string[] args)
         {
             var startInfo = new ProcessStartInfo();
             startInfo.FileName = Application.ExecutablePath;
+            startInfo.Arguments =string.Join(" ",args);
             startInfo.Verb = "runas"; // 以管理员身份运行
             try
             {
@@ -89,8 +91,12 @@ namespace XdCxRhDW
         /// 应用程序的主入口点。
         /// </summary>
         [STAThread]
-        static void Main()
+        static void Main(string[] args)
         {
+            if (args.Length > 0 && args[0].Trim().ToLower()=="debug")
+            {
+                AppConst.Debug = true;
+            }
             string outputTemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}  {Exception}";
             Serilog.Log.Logger = new Serilog.LoggerConfiguration()
                 .WriteTo.Console(outputTemplate: outputTemplate)
@@ -132,7 +138,7 @@ namespace XdCxRhDW
             }
             else
             {
-                RestartAsAdmin();
+                RestartAsAdmin(args);
             }
         }
     }

+ 40 - 13
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -41,6 +41,8 @@ using DevExpress.Utils.Filtering;
 using DevExpress.Data.Svg;
 using DevExpress.Utils.About;
 using XdCxRhDW.App.App.Properties;
+using System.Windows.Documents;
+using System.Configuration;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -60,6 +62,24 @@ namespace XdCxRhDW.App.UserControl
         {
             Messenger.Defalut.Sub<ModelPosRes>("新增定位点", OnPosAdd);
             Messenger.Defalut.Sub<SysSetings>("系统配置改变", OnSysSetingsChanged);
+            Messenger.Defalut.Sub<int>("任务状态改变",async id =>
+            {
+              
+                var find = list.FirstOrDefault(p => p.ID == id);
+                if (find == null) return;
+                using (RHDWContext db = new RHDWContext())
+                {
+                    var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == id);
+                    if (item == null) return;
+                    for (int i = 0; i < 5; i++)
+                    {
+                        if (find.TaskState != item.TaskState) break;
+                        await Task.Delay(500);
+                    }
+                    find.TaskState = item.TaskState;
+                }
+                this.gridView1.RefreshData();
+            });
 
             gridHomeTask.UseDefault(list).UseEmptyText("点击+创建任务");
             gridHomePosRes.UseDefault(new List<ModelPosRes>()).UseMultiSelect().UseRowNumber().UseNullValueText()
@@ -98,6 +118,7 @@ namespace XdCxRhDW.App.UserControl
                 settings = await db.SysSetings.FirstOrDefaultAsync();
                 if (settings == null)
                 {
+                    mapControl1.UseLocalDb();
                     DxHelper.MsgBoxHelper.ShowWarning($"请在系统设置中配置IP端口信息");
                     return;
                 }
@@ -131,12 +152,12 @@ namespace XdCxRhDW.App.UserControl
             {
                 try
                 {
-                    if (settings.WMSType == EnumWmsType.ZKXT)
-                        mapControl1.UseWMS(settings.ZKXT_Url, settings.ZKXT_LayerName);
-                    else if (settings.WMSType == EnumWmsType.SJZX)
-                        mapControl1.UseWMTS(settings.SJZX_Url, settings.SJZX_LayerName);
-                    else
-                        mapControl1.UseWMTS(settings.LW_Url, settings.LW_LayerName);
+                    //if (settings.WMSType == EnumWmtsType.ZKXT)
+                    //    mapControl1.UseWMS(settings.ZKXT_Url, settings.ZKXT_LayerName);
+                    //else if (settings.WMSType == EnumWmtsType.SJZX)
+                    //    mapControl1.UseWMTS(settings.SJZX_Url, settings.SJZX_LayerName);
+                    //else
+                    //    mapControl1.UseWMTS(settings.LW_Url, settings.LW_LayerName);
                 }
                 catch (Exception ex)
                 {
@@ -194,12 +215,18 @@ namespace XdCxRhDW.App.UserControl
                 mapControl1.UseLocalDb();
             else
             {
-                if (settings.WMSType == EnumWmsType.ZKXT)
-                    mapControl1.UseWMS(settings.ZKXT_Url, settings.ZKXT_LayerName);
-                else if (settings.WMSType == EnumWmsType.SJZX)
-                    mapControl1.UseWMTS(settings.SJZX_Url, settings.SJZX_LayerName);
+                string url;
+                if (settings.WmtsSource == EnumWmtsSource.ZCJ)
+                {
+                    url = ConfigurationManager.AppSettings["ZCJ_URL"].Trim();
+                }
                 else
-                    mapControl1.UseWMTS(settings.LW_Url, settings.LW_LayerName);
+                {
+                    url = ConfigurationManager.AppSettings["SJZX_URL"].Trim();
+                }
+                if (url.EndsWith("/"))
+                    url=url.Substring(0,url.Length - 1);
+                mapControl1.UseWMTS(url,settings.WmtsSource,settings.MapLayerType);
             }
         }
         private void OnPosAdd(ModelPosRes posRes)
@@ -694,7 +721,7 @@ namespace XdCxRhDW.App.UserControl
                         IncludeInvalidate = btnIncludeInvalidate.Checked
 
                     };
-                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByTimeRangeObsolete", dto, ct);
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByTimeRangeObsolete", dto, token: ct);
                     if (res.code == 200)
                     {
                         if (res.msg.Length > 10)
@@ -721,7 +748,7 @@ namespace XdCxRhDW.App.UserControl
                     {
                         dto.TarFrequpHz = Convert.ToInt64(txtFrequpMHz.EditValue);
                     }
-                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByLastHoursObsolete", dto, ct);
+                    var res = await HttpHelper.PostRequestAsync<List<ModelPosRes>>(baseUrl + "Pos/GetPosResByLastHoursObsolete", dto, token:ct);
                     if (res.code == 200)
                     {
                         if (res.msg.Length > 10)

+ 64 - 103
XdCxRhDW.App/UserControl/CtrlSysSettings.Designer.cs

@@ -29,11 +29,11 @@ namespace XdCxRhDW.App.UserControl
         /// </summary>
         private void InitializeComponent()
         {
-            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions2 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject5 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject6 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject7 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject8 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject();
             this.tablePanel1 = new DevExpress.Utils.Layout.TablePanel();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
             this.txtMapType = new DevExpress.XtraEditors.RadioGroup();
@@ -41,9 +41,8 @@ namespace XdCxRhDW.App.UserControl
             this.txtHttpPort = new DevExpress.XtraEditors.TextEdit();
             this.txtXLDirectory = new DevExpress.XtraEditors.TextEdit();
             this.txtYDPZThreshold = new DevExpress.XtraEditors.ButtonEdit();
-            this.txtLayer = new DevExpress.XtraEditors.TextEdit();
-            this.txtWMSType = new DevExpress.XtraEditors.ImageComboBoxEdit();
-            this.txtUrl = new DevExpress.XtraEditors.TextEdit();
+            this.txtLayer = new DevExpress.XtraEditors.RadioGroup();
+            this.txtWmtsSource = new DevExpress.XtraEditors.RadioGroup();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -53,8 +52,7 @@ namespace XdCxRhDW.App.UserControl
             this.itemMapLayer = new DevExpress.XtraLayout.LayoutControlItem();
             this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
-            this.itemMapSource = new DevExpress.XtraLayout.LayoutControlItem();
-            this.itemMapUrl = new DevExpress.XtraLayout.LayoutControlItem();
+            this.itemWmtsSource = new DevExpress.XtraLayout.LayoutControlItem();
             ((System.ComponentModel.ISupportInitialize)(this.tablePanel1)).BeginInit();
             this.tablePanel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
@@ -64,8 +62,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtYDPZThreshold.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtWMSType.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtUrl.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWmtsSource.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
@@ -75,8 +72,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.itemMapLayer)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.itemMapSource)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.itemMapUrl)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.itemWmtsSource)).BeginInit();
             this.SuspendLayout();
             // 
             // tablePanel1
@@ -91,9 +87,9 @@ namespace XdCxRhDW.App.UserControl
             this.tablePanel1.Name = "tablePanel1";
             this.tablePanel1.Rows.AddRange(new DevExpress.Utils.Layout.TablePanelRow[] {
             new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F),
-            new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 420F),
+            new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute, 374F),
             new DevExpress.Utils.Layout.TablePanelRow(DevExpress.Utils.Layout.TablePanelEntityStyle.Relative, 1F)});
-            this.tablePanel1.Size = new System.Drawing.Size(779, 586);
+            this.tablePanel1.Size = new System.Drawing.Size(599, 466);
             this.tablePanel1.TabIndex = 0;
             this.tablePanel1.UseSkinIndents = true;
             // 
@@ -106,15 +102,14 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControl1.Controls.Add(this.txtXLDirectory);
             this.layoutControl1.Controls.Add(this.txtYDPZThreshold);
             this.layoutControl1.Controls.Add(this.txtLayer);
-            this.layoutControl1.Controls.Add(this.txtWMSType);
-            this.layoutControl1.Controls.Add(this.txtUrl);
+            this.layoutControl1.Controls.Add(this.txtWmtsSource);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.layoutControl1.Location = new System.Drawing.Point(192, 85);
+            this.layoutControl1.Location = new System.Drawing.Point(102, 48);
             this.layoutControl1.Name = "layoutControl1";
             this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(941, 140, 650, 400);
             this.layoutControl1.Root = this.Root;
             this.tablePanel1.SetRow(this.layoutControl1, 1);
-            this.layoutControl1.Size = new System.Drawing.Size(396, 416);
+            this.layoutControl1.Size = new System.Drawing.Size(396, 370);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
@@ -125,7 +120,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtMapType.Name = "txtMapType";
             this.txtMapType.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
             new DevExpress.XtraEditors.Controls.RadioGroupItem(0, "本地地图"),
-            new DevExpress.XtraEditors.Controls.RadioGroupItem(1, "WMS")});
+            new DevExpress.XtraEditors.Controls.RadioGroupItem(1, "WMTS")});
             this.txtMapType.Size = new System.Drawing.Size(372, 25);
             this.txtMapType.StyleController = this.layoutControl1;
             this.txtMapType.TabIndex = 9;
@@ -133,7 +128,7 @@ namespace XdCxRhDW.App.UserControl
             // 
             // btnSave
             // 
-            this.btnSave.Location = new System.Drawing.Point(137, 372);
+            this.btnSave.Location = new System.Drawing.Point(137, 331);
             this.btnSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnSave.MaximumSize = new System.Drawing.Size(0, 22);
             this.btnSave.MinimumSize = new System.Drawing.Size(0, 22);
@@ -170,7 +165,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtYDPZThreshold.Name = "txtYDPZThreshold";
             this.txtYDPZThreshold.Properties.AutoHeight = false;
             this.txtYDPZThreshold.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "Hz", -1, false, true, false, editorButtonImageOptions2, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject5, serializableAppearanceObject6, serializableAppearanceObject7, serializableAppearanceObject8, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "Hz", -1, false, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
             this.txtYDPZThreshold.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
             this.txtYDPZThreshold.Properties.MaskSettings.Set("MaskManagerSignature", "allowNull=False");
             this.txtYDPZThreshold.Properties.MaskSettings.Set("mask", "f0");
@@ -180,34 +175,22 @@ namespace XdCxRhDW.App.UserControl
             // 
             // txtLayer
             // 
-            this.txtLayer.Location = new System.Drawing.Point(12, 338);
+            this.txtLayer.EditValue = 0;
+            this.txtLayer.Location = new System.Drawing.Point(12, 294);
             this.txtLayer.Name = "txtLayer";
-            this.txtLayer.Properties.AutoHeight = false;
-            this.txtLayer.Size = new System.Drawing.Size(372, 22);
+            this.txtLayer.Properties.Columns = 3;
+            this.txtLayer.Size = new System.Drawing.Size(372, 25);
             this.txtLayer.StyleController = this.layoutControl1;
             this.txtLayer.TabIndex = 10;
             // 
-            // txtWMSType
+            // txtWmtsSource
             // 
-            this.txtWMSType.Location = new System.Drawing.Point(12, 238);
-            this.txtWMSType.Name = "txtWMSType";
-            this.txtWMSType.Properties.AutoHeight = false;
-            this.txtWMSType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.txtWMSType.Size = new System.Drawing.Size(372, 22);
-            this.txtWMSType.StyleController = this.layoutControl1;
-            this.txtWMSType.TabIndex = 7;
-            this.txtWMSType.ToolTip = "支持瓦片数据和wms";
-            this.txtWMSType.SelectedIndexChanged += new System.EventHandler(this.txtWMSType_SelectedIndexChanged);
-            // 
-            // txtUrl
-            // 
-            this.txtUrl.Location = new System.Drawing.Point(12, 288);
-            this.txtUrl.Name = "txtUrl";
-            this.txtUrl.Properties.AutoHeight = false;
-            this.txtUrl.Size = new System.Drawing.Size(372, 22);
-            this.txtUrl.StyleController = this.layoutControl1;
-            this.txtUrl.TabIndex = 10;
+            this.txtWmtsSource.EditValue = 0;
+            this.txtWmtsSource.Location = new System.Drawing.Point(12, 238);
+            this.txtWmtsSource.Name = "txtWmtsSource";
+            this.txtWmtsSource.Size = new System.Drawing.Size(372, 25);
+            this.txtWmtsSource.StyleController = this.layoutControl1;
+            this.txtWmtsSource.TabIndex = 7;
             // 
             // Root
             // 
@@ -222,20 +205,19 @@ namespace XdCxRhDW.App.UserControl
             this.itemMapLayer,
             this.emptySpaceItem1,
             this.emptySpaceItem2,
-            this.itemMapSource,
-            this.itemMapUrl});
+            this.itemWmtsSource});
             this.Root.Name = "Root";
-            this.Root.Size = new System.Drawing.Size(396, 416);
+            this.Root.Size = new System.Drawing.Size(396, 370);
             this.Root.TextVisible = false;
             // 
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.btnSave;
-            this.layoutControlItem3.Location = new System.Drawing.Point(125, 352);
-            this.layoutControlItem3.MinSize = new System.Drawing.Size(36, 26);
+            this.layoutControlItem3.Location = new System.Drawing.Point(125, 311);
+            this.layoutControlItem3.MinSize = new System.Drawing.Size(36, 27);
             this.layoutControlItem3.Name = "layoutControlItem3";
             this.layoutControlItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 10, 2);
-            this.layoutControlItem3.Size = new System.Drawing.Size(125, 44);
+            this.layoutControlItem3.Size = new System.Drawing.Size(125, 39);
             this.layoutControlItem3.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem3.TextVisible = false;
@@ -303,14 +285,14 @@ namespace XdCxRhDW.App.UserControl
             // itemMapLayer
             // 
             this.itemMapLayer.Control = this.txtLayer;
-            this.itemMapLayer.Location = new System.Drawing.Point(0, 302);
-            this.itemMapLayer.MaxSize = new System.Drawing.Size(0, 50);
-            this.itemMapLayer.MinSize = new System.Drawing.Size(100, 50);
+            this.itemMapLayer.Location = new System.Drawing.Point(0, 255);
+            this.itemMapLayer.MaxSize = new System.Drawing.Size(0, 56);
+            this.itemMapLayer.MinSize = new System.Drawing.Size(50, 56);
             this.itemMapLayer.Name = "itemMapLayer";
-            this.itemMapLayer.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 9, 2);
-            this.itemMapLayer.Size = new System.Drawing.Size(376, 50);
+            this.itemMapLayer.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
+            this.itemMapLayer.Size = new System.Drawing.Size(376, 56);
             this.itemMapLayer.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.itemMapLayer.Text = "图层名称";
+            this.itemMapLayer.Text = "图层类型";
             this.itemMapLayer.TextLocation = DevExpress.Utils.Locations.Top;
             this.itemMapLayer.TextSize = new System.Drawing.Size(96, 14);
             this.itemMapLayer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
@@ -318,50 +300,33 @@ namespace XdCxRhDW.App.UserControl
             // emptySpaceItem1
             // 
             this.emptySpaceItem1.AllowHotTrack = false;
-            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 352);
+            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 311);
             this.emptySpaceItem1.Name = "emptySpaceItem1";
-            this.emptySpaceItem1.Size = new System.Drawing.Size(125, 44);
+            this.emptySpaceItem1.Size = new System.Drawing.Size(125, 39);
             this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
             // 
             // emptySpaceItem2
             // 
             this.emptySpaceItem2.AllowHotTrack = false;
-            this.emptySpaceItem2.Location = new System.Drawing.Point(250, 352);
+            this.emptySpaceItem2.Location = new System.Drawing.Point(250, 311);
             this.emptySpaceItem2.Name = "emptySpaceItem2";
-            this.emptySpaceItem2.Size = new System.Drawing.Size(126, 44);
+            this.emptySpaceItem2.Size = new System.Drawing.Size(126, 39);
             this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
             // 
-            // itemMapSource
-            // 
-            this.itemMapSource.Control = this.txtWMSType;
-            this.itemMapSource.Location = new System.Drawing.Point(0, 199);
-            this.itemMapSource.MaxSize = new System.Drawing.Size(0, 53);
-            this.itemMapSource.MinSize = new System.Drawing.Size(50, 53);
-            this.itemMapSource.Name = "itemMapSource";
-            this.itemMapSource.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
-            this.itemMapSource.Size = new System.Drawing.Size(376, 53);
-            this.itemMapSource.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.itemMapSource.Text = "地图来源";
-            this.itemMapSource.TextLocation = DevExpress.Utils.Locations.Top;
-            this.itemMapSource.TextSize = new System.Drawing.Size(96, 14);
-            this.itemMapSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            // 
-            // itemMapUrl
-            // 
-            this.itemMapUrl.Control = this.txtUrl;
-            this.itemMapUrl.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
-            this.itemMapUrl.CustomizationFormText = "图层名称";
-            this.itemMapUrl.Location = new System.Drawing.Point(0, 252);
-            this.itemMapUrl.MaxSize = new System.Drawing.Size(0, 50);
-            this.itemMapUrl.MinSize = new System.Drawing.Size(100, 50);
-            this.itemMapUrl.Name = "itemMapUrl";
-            this.itemMapUrl.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 9, 2);
-            this.itemMapUrl.Size = new System.Drawing.Size(376, 50);
-            this.itemMapUrl.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.itemMapUrl.Text = "地图URL";
-            this.itemMapUrl.TextLocation = DevExpress.Utils.Locations.Top;
-            this.itemMapUrl.TextSize = new System.Drawing.Size(96, 14);
-            this.itemMapUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            // itemWmtsSource
+            // 
+            this.itemWmtsSource.Control = this.txtWmtsSource;
+            this.itemWmtsSource.Location = new System.Drawing.Point(0, 199);
+            this.itemWmtsSource.MaxSize = new System.Drawing.Size(0, 56);
+            this.itemWmtsSource.MinSize = new System.Drawing.Size(50, 56);
+            this.itemWmtsSource.Name = "itemWmtsSource";
+            this.itemWmtsSource.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
+            this.itemWmtsSource.Size = new System.Drawing.Size(376, 56);
+            this.itemWmtsSource.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.itemWmtsSource.Text = "地图来源";
+            this.itemWmtsSource.TextLocation = DevExpress.Utils.Locations.Top;
+            this.itemWmtsSource.TextSize = new System.Drawing.Size(96, 14);
+            this.itemWmtsSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             // 
             // CtrlSysSettings
             // 
@@ -369,7 +334,7 @@ namespace XdCxRhDW.App.UserControl
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.tablePanel1);
             this.Name = "CtrlSysSettings";
-            this.Size = new System.Drawing.Size(779, 586);
+            this.Size = new System.Drawing.Size(599, 466);
             this.Load += new System.EventHandler(this.CtrlSysSettings_Load);
             ((System.ComponentModel.ISupportInitialize)(this.tablePanel1)).EndInit();
             this.tablePanel1.ResumeLayout(false);
@@ -380,8 +345,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtYDPZThreshold.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtWMSType.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtUrl.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWmtsSource.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
@@ -391,8 +355,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.itemMapLayer)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.itemMapSource)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.itemMapUrl)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.itemWmtsSource)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -408,7 +371,7 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
         private DevExpress.XtraEditors.TextEdit txtXLDirectory;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
-        private DevExpress.XtraLayout.LayoutControlItem itemMapSource;
+        private DevExpress.XtraLayout.LayoutControlItem itemWmtsSource;
         private DevExpress.XtraEditors.ButtonEdit txtYDPZThreshold;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
         private DevExpress.XtraEditors.RadioGroup txtMapType;
@@ -416,9 +379,7 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.XtraLayout.LayoutControlItem itemMapLayer;
         private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
         private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2;
-        private DevExpress.XtraEditors.TextEdit txtLayer;
-        private DevExpress.XtraEditors.ImageComboBoxEdit txtWMSType;
-        private DevExpress.XtraEditors.TextEdit txtUrl;
-        private DevExpress.XtraLayout.LayoutControlItem itemMapUrl;
+        private DevExpress.XtraEditors.RadioGroup txtLayer;
+        private DevExpress.XtraEditors.RadioGroup txtWmtsSource;
     }
 }

+ 13 - 60
XdCxRhDW.App/UserControl/CtrlSysSettings.cs

@@ -38,7 +38,10 @@ namespace XdCxRhDW.App.UserControl
         {
             try
             {
-                txtWMSType.Properties.Items.AddEnum<EnumWmsType>();
+                txtWmtsSource.Properties.Items.AddEnum<EnumWmtsSource>();
+                txtLayer.Properties.Items.AddEnum<EnumMapLayerType>();
+                txtWmtsSource.SelectedIndex = 0;
+                txtLayer.SelectedIndex = 0;
                 using (RHDWContext db = new RHDWContext())
                 {
                     var res = await db.SysSetings.FirstOrDefaultAsync();
@@ -47,10 +50,10 @@ namespace XdCxRhDW.App.UserControl
                         this.txtHttpPort.Text = res.HttpPort.ToString();
                         if (!string.IsNullOrEmpty(res.XLDirectory))
                             this.txtXLDirectory.Text = res.XLDirectory.ToString();
-                        this.txtWMSType.EditValue = res.WMSType;
+                        this.txtWmtsSource.EditValue = res.WmtsSource;
+                        this.txtLayer.EditValue = res.MapLayerType;
                         if (res.YDPZThreshold > 0)
                             this.txtYDPZThreshold.Text = res.YDPZThreshold.ToString();
-                        //this.txtLayer.Text = res.LayerName;
                         if (this.txtMapType.SelectedIndex == res.MapType)
                         {
                             txtMapType_SelectedIndexChanged(null, null);
@@ -78,7 +81,7 @@ namespace XdCxRhDW.App.UserControl
                     DxHelper.MsgBoxHelper.ShowError("Http端口错误!");
                     return;
                 }
-                if (txtMapType.SelectedIndex != 0 && txtWMSType.EditValue == null)
+                if (txtMapType.SelectedIndex != 0 && txtWmtsSource.EditValue == null)
                 {
                     DxHelper.MsgBoxHelper.ShowError("请选择行政图类型!");
                     return;
@@ -98,34 +101,9 @@ namespace XdCxRhDW.App.UserControl
                     res.MapType = txtMapType.SelectedIndex;
                     if (txtMapType.SelectedIndex != 0)
                     {
-                        res.WMSType = (EnumWmsType)txtWMSType.EditValue;
-                        Uri url = null;
-
-                        try
-                        {
-                            url = new Uri(txtUrl.Text);
-                        }
-                        catch
-                        {
-                            DxHelper.MsgBoxHelper.ShowError("URL格式错误!");
-                            return;
-                        }
-                        if (res.WMSType == EnumWmsType.ZKXT)
-                        {
-                            res.ZKXT_Url = url.ToString();
-                            res.ZKXT_LayerName = txtLayer.Text;
-                        }
-                        else if (res.WMSType == EnumWmsType.SJZX)
-                        {
-
-                            res.SJZX_Url = url.ToString();
-                            res.SJZX_LayerName = txtLayer.Text;
-                        }
-                        else if (res.WMSType == EnumWmsType.LW)
-                        {
-                            res.LW_Url = url.ToString();
-                            res.LW_LayerName = txtLayer.Text;
-                        }
+                        res.WmtsSource = (EnumWmtsSource)txtWmtsSource.EditValue;
+                        res.MapLayerType = (EnumMapLayerType)txtLayer.EditValue;
+                       
                     }
                     db.SysSetings.AddOrUpdate(res);
                     needStartHttpSvr = true;
@@ -173,42 +151,17 @@ namespace XdCxRhDW.App.UserControl
         {
             if (txtMapType.SelectedIndex == 0)
             {
-                itemMapSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                itemWmtsSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                 itemMapLayer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-                itemMapUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             }
             else
             {
-                itemMapSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-                itemMapSource.Text = "WMS地址";
+                itemWmtsSource.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                 itemMapLayer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-                itemMapUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
             }
             layoutControl1.BestFit();
         }
 
-        private async void txtWMSType_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            using (RHDWContext db = new RHDWContext())
-            {
-                var res = await db.SysSetings.FirstOrDefaultAsync();
-                if (res == null) return;
-                if ((EnumWmsType)txtWMSType.EditValue == EnumWmsType.ZKXT)
-                {
-                    txtUrl.Text = res.ZKXT_Url;
-                    txtLayer.Text = res.ZKXT_LayerName;
-                }
-                if ((EnumWmsType)txtWMSType.EditValue == EnumWmsType.SJZX)
-                {
-                    txtUrl.Text = res.SJZX_Url;
-                    txtLayer.Text = res.SJZX_LayerName;
-                }
-                if ((EnumWmsType)txtWMSType.EditValue == EnumWmsType.LW)
-                {
-                    txtUrl.Text = res.LW_Url;
-                    txtLayer.Text = res.LW_LayerName;
-                }
-            }
-        }
+        
     }
 }

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

@@ -138,6 +138,7 @@
     <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AppConst.cs" />
     <Compile Include="Basic\BaseVm.cs" />
     <Compile Include="Basic\BindingData.cs" />
     <Compile Include="Basic\IOverlayFormService.cs" />
@@ -146,6 +147,7 @@
     <Compile Include="Controllers\PosController.cs" />
     <Compile Include="Controllers\SvrReportController.cs" />
     <Compile Include="Controllers\TxController.cs" />
+    <Compile Include="Controllers\TaskController.cs" />
     <Compile Include="Controllers\XlController.cs" />
     <Compile Include="CorTools\GpuCalcForm.cs">
       <SubType>Form</SubType>

+ 28 - 9
XdCxRhDW.Entity/EntityEnum.cs

@@ -119,24 +119,43 @@ namespace XdCxRhDW.Entity
         [Display(Name = "静止")]
         Stationary,
     }
-
-    public enum EnumWmsType
+    /// <summary>
+    /// WMTS地图来源
+    /// </summary>
+    public enum EnumWmtsSource
     {
         /// <summary>
-        /// 中科星图
+        /// 自采集
         /// </summary>
-        [Display(Name = "中科星图")]
-        ZKXT,
+        [Display(Name = "自采集")]
+        ZCJ,
+
         /// <summary>
         /// 数据中心
         /// </summary>
         [Display(Name = "数据中心")]
-        SJZX,
+        SJZX
+    }
+    public enum EnumMapLayerType
+    {
         /// <summary>
-        /// 路网
+        /// 卫星图
         /// </summary>
-        [Display(Name = "路网")]
-        LW
+        [Display(Name = "卫星图")]
+        SatMap,
+
+        /// <summary>
+        /// 道路图
+        /// </summary>
+        [Display(Name = "道路图")]
+        RoadMap,
+
+        /// <summary>
+        /// 行政区划图
+        /// </summary>
+        [Display(Name = "行政区划图")]
+        XZQH_Map
+
     }
 
     public enum EnumSigType

+ 8 - 0
XdCxRhDW.Entity/PosRes.cs

@@ -35,6 +35,10 @@ namespace XdCxRhDW.Entity
         [JsonIgnore]
         public virtual CxRes CxRes { get; set; }
 
+        [NotMapped]
+        [Display(AutoGenerateField = false)]
+        public string BaseCheckType { get; set; }
+
         [Display(Name = "参估编号")]
         public long CgResID { get; set; }
 
@@ -46,6 +50,10 @@ namespace XdCxRhDW.Entity
         public int? TargetInfoID { get; set; }
         public TargetInfo TargetInfo;
 
+        [NotMapped]
+        [Display(AutoGenerateField = false)]
+        public string BaseTargetName { get; set; }
+
         [Display(Name = "检测编号")]
         public long? CheckResID { get; set; }
 

+ 7 - 12
XdCxRhDW.Entity/SysSetings.cs

@@ -17,25 +17,20 @@ namespace XdCxRhDW.Entity
         public int YDPZThreshold { get; set; }
 
         /// <summary>
-        /// 地图类型.本地地图=0,WMS=1
+        /// 地图类型.本地地图=0,WMTS=1
         /// </summary>
         public int MapType { get; set; }
         
         /// <summary>
-        /// 选中的WMS类型.(MapType=1时候有效)
+        /// WMTS来源.(MapType=1时候有效)(自采集、数据中心)
         /// </summary>
-        public EnumWmsType WMSType { get; set; }
+        public EnumWmtsSource WmtsSource { get; set; }
 
-        public string ZKXT_Url { get; set; }
-
-        public string ZKXT_LayerName { get; set; }
-
-        public string SJZX_Url { get; set; }
-
-        public string SJZX_LayerName { get; set; }
+        /// <summary>
+        /// 地图图层类型
+        /// </summary>
+        public EnumMapLayerType MapLayerType { get; set; }
 
-        public string LW_Url { get; set; }
 
-        public string LW_LayerName { get; set; }
     }
 }

+ 6 - 6
XdCxRhDW.Framework/HttpHelper.cs

@@ -45,10 +45,10 @@ public class HttpHelper
     /// <typeparam name="T"></typeparam>
     /// <param name="url"></param>
     /// <param name="dto"></param>
-    /// <param name="ct"></param>
+    /// <param name="token"></param>
     /// <param name="timeoutSeconds"></param>
     /// <returns></returns>
-    public static async Task<AjaxResult<T>> PostRequestAsync<T>(string url, object dto, CancellationToken ct, int timeoutSeconds = 30)
+    public static async Task<AjaxResult> PostRequestAsync(string url, object dto, int timeoutSeconds = 30, CancellationToken token = default)
     {
         var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
         var handler = new HttpClientHandler() { UseCookies = false };
@@ -57,10 +57,10 @@ public class HttpHelper
         var message = new HttpRequestMessage(HttpMethod.Post, url);
         message.Content = content;
 
-        var response = await client.SendAsync(message, ct);
+        var response = await client.SendAsync(message, token);
         response.EnsureSuccessStatusCode();
         var result = await response.Content.ReadAsStringAsync();
-        var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<T>>(result);
+        var AjaxResult = JsonConvert.DeserializeObject<AjaxResult>(result);
         return AjaxResult;
     }
 
@@ -115,7 +115,7 @@ public class HttpHelper
     /// <param name="timeoutSeconds"></param>
     /// <returns></returns>
     /// <exception cref="Exception"></exception>
-    public static async Task<string> UploadFileAsync(string localFile, string uploadUrl, int timeoutSeconds = 30,CancellationToken token=default)
+    public static async Task<string> UploadFileAsync(string localFile, string uploadUrl, int timeoutSeconds = 30, CancellationToken token = default)
     {
         try
         {
@@ -137,7 +137,7 @@ public class HttpHelper
             var message = new HttpRequestMessage(HttpMethod.Post, uploadUrl);
             message.Content = content;
 
-            var response = await client.SendAsync(message,token);
+            var response = await client.SendAsync(message, token);
             response.EnsureSuccessStatusCode();
             var result = await response.Content.ReadAsStringAsync();
             var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<string>>(result);

+ 1 - 5
XdCxRhDW.X2D1TaskServer/Controllers/HistoryTaskProcessingController.cs

@@ -38,11 +38,7 @@ namespace XdCxRhDW.X2D1TaskServer.Controllers
         {
             try
             {
-                if (!Directory.Exists(dto.CapDir))
-                {
-                    LogHelper.Error($"文件路径[{dto.CapDir}]不存在");
-                    return Error($"文件路径[{dto.CapDir}]不存在");
-                }
+              
                 _service.StartAsync(dto);
                 return Success();
             }

+ 89 - 12
XdCxRhDW.X2D1TaskServer/Service/HistoryTaskService.cs

@@ -28,7 +28,17 @@ namespace XdCxRhDW.X2D1TaskServer.Service
         public void StartAsync(X2D1HistoryTaskHandleDto dto)
         {
             cts = new CancellationTokenSource();
-            LogHelper.Info($"接收到开始执行任务[{dto.TaskName}],ID={dto.ID}");
+            if (!Directory.Exists(dto.CapDir))
+            {
+                StopTask(dto.ID, $"文件路径[{dto.CapDir}]不存在,任务结束");
+                return;
+            }
+            LogHelper.Info($"【任务{dto.ID}】开始执行...");
+            bool canConnected = CanGetSatIdFromMySql();
+            if (!canConnected)
+            {
+                LogHelper.Warning("无法连接MySql查询卫星编号,将使用任务中提供的卫星");
+            }
             //点击定位平台右上角查看接口可以在浏览器中查看平台提供的所有接口详细信息
             Task.Run(async () =>
             {
@@ -51,15 +61,19 @@ namespace XdCxRhDW.X2D1TaskServer.Service
                 }
                 else
                 {
-                    LogHelper.Error($"【任务{dto.ID}】执行异常,不支持的日期目录格式");
+                    StopTask(dto.ID, $"执行异常,不支持的日期目录格式");
                     return;
                 }
                 while (!cts.IsCancellationRequested && preTime <= dto.EndTime)
                 {
-                    string filesDir = null;
+                    string filesDir = dto.CapDir;
                     try
                     {
-                        filesDir = Path.Combine(dto.CapDir, $"{preTime.ToString(dto.DateDirFormat)}");//yyyyMMdd
+
+                        if (formatFlag != 0)
+                        {
+                            filesDir = Path.Combine(dto.CapDir, $"{preTime.ToString(dto.DateDirFormat)}");//yyyyMMdd
+                        }
                         LogHelper.Info($"【任务{dto.ID}】正在处理[{filesDir}]目录中的数据...");
                         IEnumerable<string> files;
                         if (!Directory.Exists(filesDir))
@@ -77,13 +91,14 @@ namespace XdCxRhDW.X2D1TaskServer.Service
                         }
 
                         IOrderedEnumerable<IGrouping<DateTime, HistoryFile>> groups = null;
-                        groups = files.Select(f => FileToHistoryFile(dto, f)).GroupBy(m => m.CapTime).OrderBy(m => m.Key);
+                        groups = files.Select(f => FileToHistoryFile(dto, f, canConnected)).GroupBy(m => m.CapTime).OrderBy(m => m.Key);
                         foreach (var item in groups)
                         {
                             if (cts.IsCancellationRequested) break;
                             var finfos = item.ToList();
                             var capTime = finfos.First().CapTime;
                             if (capTime < dto.StartTime) continue;
+                            if (capTime > dto.EndTime) break;
                             if (finfos.Count < 3)
                             {
                                 LogHelper.Warning($"【任务{dto.ID}】{capTime:yyyyMMddHHmmss}时刻文件数量只有{finfos.Count}个,跳过此组数据");
@@ -216,6 +231,8 @@ namespace XdCxRhDW.X2D1TaskServer.Service
                                         LogHelper.Error($"【任务{dto.ID}】{capTime:yyyyMMddHHmmss}时刻时隙位置{data1[i].Smpstart}定位异常", ex);
                                     }
                                 }
+                                LogHelper.Info($"【任务{dto.ID}】{capTime:yyyyMMddHHmmss}时刻定位完成");
+
                             }
                             catch (Exception ex)
                             {
@@ -233,8 +250,8 @@ namespace XdCxRhDW.X2D1TaskServer.Service
                         ResetTime(formatFlag, ref preTime);
                     }
                 }
-                LogHelper.Info($"【任务{dto.ID}】数据处理完成,任务结束");
-            });
+                StopTask(dto.ID, $"数据处理完成,任务结束");
+            }, cts.Token);
         }
         private void ResetTime(int formatFlag, ref DateTime time)
         {
@@ -251,7 +268,7 @@ namespace XdCxRhDW.X2D1TaskServer.Service
                 time = time.AddHours(1);
             }
         }
-        private HistoryFile FileToHistoryFile(X2D1HistoryTaskHandleDto dto, string filePath)
+        private HistoryFile FileToHistoryFile(X2D1HistoryTaskHandleDto dto, string filePath, bool canConnected)
         {  //读取采集文件
            //2024_01_31_10_01_51_000000000_ch11_-1__Nxx.xxxxxx_Exx.xxxxxx_xxxxx.xxxHz_xxx.xxxMHz_ch1_xd1.dat
             HistoryFile historyFile = new HistoryFile();
@@ -285,21 +302,81 @@ namespace XdCxRhDW.X2D1TaskServer.Service
             historyFile.FreqHz = freqMHz * 1e6;
             historyFile.Ch = ch;
             historyFile.FsHz = fsHz;
+            if (canConnected)
+                historyFile.SatId = GetSatId(historyFile.FreqHz);
             if (ch == 2)
             {
-                historyFile.SatId = dto.MainSatCode;
+                if (historyFile.SatId == 0)
+                {
+                    LogHelper.Warning($"【任务{dto.ID}】主星使用任务中的卫星[{dto.MainSatCode}]");
+                    historyFile.SatId = dto.MainSatCode;
+                }
             }
             else if (ch == 3)
             {
-                historyFile.SatId = dto.AdjaSatCode;
+                if (historyFile.SatId == 0)
+                {
+                    LogHelper.Warning($"【任务{dto.ID}】邻星使用任务中的卫星[{dto.AdjaSatCode}]");
+                    historyFile.SatId = dto.AdjaSatCode;
+                }
             }
             return historyFile;
         }
+        int GetSatId(double freqdown)
+        {
+            int satId = 0;
+            string sql = $"select 卫星ID from freguencysatid where 下行 = '{freqdown}'and 洋区 = 'I' LIMIT 1";
+            try
+            {
+                var res = MySqlTools.ExecuteScalar(System.Data.CommandType.Text, sql);
+                if (res == null || res == DBNull.Value)
+                {
+                    LogHelper.Error($"下行频点{freqdown * 1e-6}未能从MySql中找到对应的卫星编号.SQL={sql}");
+                }
+                bool isInt = int.TryParse($"{res}", out satId);
+                if (!isInt)
+                {
+                    //System.Configuration.ConfigurationManager.ConnectionStrings["MySql"].ConnectionString
+                    LogHelper.Error($"卫星编号转换失败,obj={res}");
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Error($"下行频点{freqdown * 1e-6}MySql查询卫星编号异常.ConnectionString={System.Configuration.ConfigurationManager.ConnectionStrings["MySql"].ConnectionString}", ex);
+            }
+            return satId;
+        }
+        bool CanGetSatIdFromMySql()
+        {
+            string sql = $"select 卫星ID from freguencysatid where 下行 = '{0}'and 洋区 = 'I' LIMIT 1";
+            try
+            {
+                var res = MySqlTools.ExecuteScalar(System.Data.CommandType.Text, sql);
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        void StopTask(int taskID, string stopReason)
+        {
+            TaskStopHandleDto stopDto = new TaskStopHandleDto() { ID = taskID, StopReason = stopReason };
+            if (string.IsNullOrWhiteSpace(stopReason))
+                LogHelper.Info($"【任务{taskID}】正常结束");
+            else
+                LogHelper.Error($"【任务{taskID}】{stopReason}");
 
-
+            var stopResp = HttpHelper.PostRequestAsync(baseUrl + "Task/StopTask", stopDto).Result;
+            if (stopResp.code != 200)
+            {
+                LogHelper.Error($"【任务{taskID}】停止异常.{stopResp.msg}");
+                return;
+            }
+        }
         public void Stop()
         {
-            cts.Cancel();
+            cts?.Cancel();
         }
     }
 }

+ 2 - 2
XdCxRhDW.X2D1TaskServer54/Service/HistoryTaskService.cs

@@ -79,11 +79,11 @@ namespace XdCxRhDW.X2D1TaskServer54.Service
                         LogHelper.Error("任务执行出错", ex);
                     }
                 }
-            });
+            },cts.Token);
         }
         public void Stop()
         {
-            cts.Cancel();
+            cts?.Cancel();
         }
     }
 }

+ 7 - 0
XdCxRhDw.Dto/TaskHandleDto/TaskStopHandleDto.cs

@@ -15,5 +15,12 @@ namespace XdCxRhDW.Dto
         /// 任务ID
         /// </summary>
         public int ID { get; set; }
+
+
+
+        /// <summary>
+        /// 停止原因(可空)
+        /// </summary>
+        public string StopReason { get; set; }
     }
 }