gongqiuhong преди 1 година
родител
ревизия
fbb359266c

+ 3 - 0
Service/X2D1NoRefTaskServer/App.config

@@ -16,6 +16,9 @@
 
 		<!--定位时差系数-->
 		<add key="PosDtoFactor" value="1"/>
+
+		<!--实时任务采集时长(秒)-->
+		<add key="CapSeconds" value="6"/>
 	
 	</appSettings>
 	<startup>

+ 112 - 82
Service/X2D1NoRefTaskServer/Service/TaskService.cs

@@ -15,6 +15,7 @@ namespace X2D1NoRefTaskServer.Service
     public class TaskService
     {
         private readonly string baseUrl;
+        int capSeconds;
         Dictionary<int, CancellationTokenSource> dicCts = new Dictionary<int, CancellationTokenSource>();
         public TaskService()
         {
@@ -23,6 +24,11 @@ namespace X2D1NoRefTaskServer.Service
                 this.baseUrl = posPlatformAddr + "api/";
             else
                 this.baseUrl = posPlatformAddr + "/api/";
+            var val = ConfigurationManager.AppSettings["CapSeconds"].Trim();
+            if (!int.TryParse(val, out capSeconds))
+            {
+                capSeconds = 60;
+            }
         }
 
         /// <summary>
@@ -156,9 +162,9 @@ namespace X2D1NoRefTaskServer.Service
                                     if (delay2 == null) delay2 = 0;
                                     LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],主星[{minfo.SatId}],转发时延{delay1}us");
                                     LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],邻星[{ninfo.SatId}],转发时延{delay2}us");
-                                    string mainFile = await HttpHelper.UploadFileAsync(minfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//主星文件
-                                    string adjaFile = await HttpHelper.UploadFileAsync(ninfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//邻星文件
-                                    string cdbFile = await HttpHelper.UploadFileAsync(dinfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//超短文件
+                                    string mainFile = await HttpHelper.UploadFileAsync(minfo.FilePath, baseUrl, token: cts.Token);//主星文件
+                                    string adjaFile = await HttpHelper.UploadFileAsync(ninfo.FilePath, baseUrl, token: cts.Token);//邻星文件
+                                    string cdbFile = await HttpHelper.UploadFileAsync(dinfo.FilePath, baseUrl, token: cts.Token);//超短文件
 
                                     DetectDto detectDto = new DetectDto()
                                     {
@@ -189,7 +195,7 @@ namespace X2D1NoRefTaskServer.Service
                                         file2 = mainFile,
                                         samplingRate = minfo.FsHz,
                                         smpPositions = smps,
-                                        snrThreshold = 15,
+                                        snrThreshold = taskSig.Snr,
                                     };
                                     var result1 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
                                     if (result1.code != 200)
@@ -206,7 +212,7 @@ namespace X2D1NoRefTaskServer.Service
                                         file2 = adjaFile,
                                         samplingRate = minfo.FsHz,
                                         smpPositions = smps,
-                                        snrThreshold = 15,
+                                        snrThreshold = taskSig.Snr,
                                     };
                                     var result2 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
                                     if (result2.code != 200)
@@ -215,6 +221,7 @@ namespace X2D1NoRefTaskServer.Service
                                         continue;
                                     }
                                     LogHelper.Info($"【任务{dto.ID}】信号{taskSig.FreqUp / 1e6:f3},{capTime:yyyyMMddHHmmss}时刻邻星超短CPU参估完成");
+                                    await HttpHelper.DeleteFileAsync(new string[] { mainFile, adjaFile, cdbFile }, baseUrl);
                                     var data1 = result1.data;
                                     var data2 = result2.data;
                                     if (data1.Count != data2.Count || data1.Count != deteResp.data.Count)
@@ -288,7 +295,7 @@ namespace X2D1NoRefTaskServer.Service
 
                         }
                         ResetTime(formatFlag, ref preTime);
-                        LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]中的数据处理完成");
+                        LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]本次扫描处理完成");
                     }
                     catch (Exception ex)
                     {
@@ -331,7 +338,7 @@ namespace X2D1NoRefTaskServer.Service
                 LogHelper.Info($"【任务{dto.ID}】定位时差系数={posDtoFactor}");
 
                 bool canConnected = CanGetSatIdFromMySql();
-                DateTime preTime = DateTime.Now;
+                DateTime preTime = DateTime.Now.AddSeconds(-capSeconds);
                 int formatFlag;
                 if (string.IsNullOrWhiteSpace(dto.DateDirFormat))
                 {
@@ -366,15 +373,15 @@ namespace X2D1NoRefTaskServer.Service
                         bool doNextHour = false;
                         while (!Directory.Exists(filesDir))
                         {
+                            if (cts.IsCancellationRequested) return;
                             LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]不存在,等待5秒...");
-                            Thread.Sleep(5000);
+                            await Task.Delay(5000, cts.Token);
                             if (DateTime.Now.Hour != preTime.Hour)
                             {
-                                preTime = DateTime.Now;
+                                ResetTime(formatFlag, ref preTime);
                                 doNextHour = true;
                                 break;
                             }
-                            if (cts.IsCancellationRequested) break;
                         }
                         if (cts.IsCancellationRequested) return;
                         if (doNextHour)
@@ -382,36 +389,51 @@ namespace X2D1NoRefTaskServer.Service
                             continue;
                         }
                         LogHelper.Info($"【任务{dto.ID}】正在处理[{filesDir}]目录中的数据...");
-                        var files = Directory.EnumerateFiles(filesDir, "*.dat");
-                        if (!files.Any())
+                        IEnumerable<string> files = null;
+                        while (true)
                         {
-                            LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]中没有文件,跳过此目录");
-                            ResetTime(formatFlag, ref preTime);
-                            await Task.Delay(1000);
-                            continue;
+                            if (cts.IsCancellationRequested) return;
+                            files = Directory.EnumerateFiles(filesDir, "*.dat");
+                            if (!files.Any())
+                            {
+                                LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]中没有文件,等待5秒...");
+                                if (DateTime.Now.Hour != preTime.Hour)
+                                {
+                                    ResetTime(formatFlag, ref preTime);
+                                    doNextHour = true;
+                                    break;
+                                }
+                                await Task.Delay(5000);
+                                continue;
+                            }
+                            break;
                         }
-
+                        if (cts.IsCancellationRequested) return;
                         IOrderedEnumerable<IGrouping<DateTime, HistoryFile>> groups = null;
                         groups = files.Select(f => FileToHistoryFile(dto, f, canConnected)).GroupBy(m => m.CapTime).OrderBy(m => m.Key);
-                        TimeSpan span = abs(groups.First().Key - preTime);
-                        var closesData = groups.First();
-                        foreach (var item in groups.Skip(1))
+                        bool hasFile = false;
+                        foreach (var sameTimeFiles in groups)
                         {
-                            if (abs(preTime - item.Key) < span)
+                            if (cts.IsCancellationRequested) return;
+                            var capTime = sameTimeFiles.First().CapTime;
+                            if (capTime <= preTime) continue;
+                            if ((DateTime.Now - capTime).TotalMinutes > 10)
                             {
-                                span = abs(preTime - item.Key);
-                                closesData = item;
+                                preTime = capTime;
+                                LogHelper.Warning("处理速度过慢,丢弃数据");
+                                continue;
                             }
-                        }
-                        //if (cts.IsCancellationRequested) break;
-                        var xdgbInfos = closesData.GroupBy(m => m.XdIndex);
-                        foreach (var xdInfos in xdgbInfos)
-                        {
-                            var finfos = xdInfos.ToList();
-                            var capTime = finfos.First().CapTime;
-                            //if (capTime < dto.StartTime) continue;
-                            //if (capTime > dto.EndTime) break;
-                            if (finfos.Count < 3)
+                            if (!await WaitFileEnd(dto.ID, sameTimeFiles.First(), capSeconds, cts))//采集完成,仍然不能某个文件,做下一个信号
+                            {
+                                continue;
+                            }
+                            hasFile = true;
+                            var xdgbInfos = sameTimeFiles.GroupBy(m => m.XdIndex);
+                            foreach (var xdInfos in xdgbInfos)
+                            {
+                                if (cts.IsCancellationRequested) return;
+                                var finfos = xdInfos.ToList();
+                                if (finfos.Count < 3)
                                 {
                                     LogHelper.Warning($"【任务{dto.ID}】{capTime:yyyyMMddHHmmss}时刻文件数量只有{finfos.Count}个,跳过此组数据");
                                     continue;
@@ -448,30 +470,13 @@ namespace X2D1NoRefTaskServer.Service
                                     var delay2 = taskSig.SigDelay.FirstOrDefault(p => p.SatInfoSatCode == ninfo.SatId)?.Delay;
                                     if (delay1 == null) delay1 = 0;
                                     if (delay2 == null) delay2 = 0;
-                                LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],主星[{minfo.SatId}],转发时延{delay1}us");
-                                LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],邻星[{ninfo.SatId}],转发时延{delay2}us");
-
-                                while (true)
-                                {
-                                    if (!IsFileInUse(minfo.FilePath))
-                                        break;
-                                }
-                                string mainFile = await HttpHelper.UploadFileAsync(minfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//主星文件
-                                while (true)
-                                {
-                                    if (!IsFileInUse(ninfo.FilePath))
-                                        break;
-                                }
-                                string adjaFile = await HttpHelper.UploadFileAsync(ninfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//邻星文件
-                                while (true)
-                                {
-                                    if (!IsFileInUse(dinfo.FilePath))
-                                        break;
-                                }
-                                string cdbFile = await HttpHelper.UploadFileAsync(dinfo.FilePath, baseUrl + "File/UploadFileAsync", token: cts.Token);//超短文件
-
-                                DetectDto detectDto = new DetectDto()
-                                {
+                                    LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],主星[{minfo.SatId}],转发时延{delay1}us");
+                                    LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],邻星[{ninfo.SatId}],转发时延{delay2}us");
+                                    string mainFile = await HttpHelper.UploadFileAsync(minfo.FilePath, baseUrl, token: cts.Token);//主星文件
+                                    string adjaFile = await HttpHelper.UploadFileAsync(ninfo.FilePath, baseUrl, token: cts.Token);//邻星文件
+                                    string cdbFile = await HttpHelper.UploadFileAsync(dinfo.FilePath, baseUrl, token: cts.Token);//超短文件
+                                    DetectDto detectDto = new DetectDto()
+                                    {
                                         file1 = cdbFile,//11局使用上行泄露信号进行检测
                                         dmcType = taskSig.SigType,//上行信号检测目前的算法只能使用基于能量的KY或IBS检测
                                         fsHz = minfo.FsHz,
@@ -498,7 +503,7 @@ namespace X2D1NoRefTaskServer.Service
                                         file2 = mainFile,
                                         samplingRate = minfo.FsHz,
                                         smpPositions = smps,
-                                        snrThreshold = 15,
+                                        snrThreshold = taskSig.Snr,
                                     };
                                     var result1 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
                                     if (result1.code != 200)
@@ -515,7 +520,7 @@ namespace X2D1NoRefTaskServer.Service
                                         file2 = adjaFile,
                                         samplingRate = minfo.FsHz,
                                         smpPositions = smps,
-                                        snrThreshold = 15,
+                                        snrThreshold = taskSig.Snr,
                                     };
                                     var result2 = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(baseUrl + "DetectCg/CpuCgMultiCalc", cgDto, token: cts.Token);
                                     if (result2.code != 200)
@@ -524,6 +529,7 @@ namespace X2D1NoRefTaskServer.Service
                                         continue;
                                     }
                                     LogHelper.Info($"【任务{dto.ID}】信号{taskSig.FreqUp / 1e6:f3},{capTime:yyyyMMddHHmmss}时刻邻星超短CPU参估完成");
+                                    await HttpHelper.DeleteFileAsync(new string[] { mainFile, adjaFile, cdbFile }, baseUrl);
                                     var data1 = result1.data;
                                     var data2 = result2.data;
                                     if (data1.Count != data2.Count || data1.Count != deteResp.data.Count)
@@ -535,7 +541,7 @@ namespace X2D1NoRefTaskServer.Service
                                     {
                                         try
                                         {
-                                            if (cts.IsCancellationRequested) break;
+                                            if (cts.IsCancellationRequested) return;
                                             X2D1NoXlNoParlPosDto x2D1 = new X2D1NoXlNoParlPosDto()
                                             {
                                                 TaskID = dto.ID,
@@ -581,6 +587,7 @@ namespace X2D1NoRefTaskServer.Service
                                         }
                                     }
                                     LogHelper.Info($"【任务{dto.ID}】信号{taskSig.FreqUp / 1e6:f3},{capTime:yyyyMMddHHmmss}时刻定位完成");
+                                    LogHelper.Info($"-----------------------------------------------------------------");
 
                                 }
                                 catch (Exception ex)
@@ -590,8 +597,17 @@ namespace X2D1NoRefTaskServer.Service
                                 }
 
                             }
-                        ResetTime(formatFlag, ref preTime);
-                        LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]中的数据处理完成");
+                            ResetTime(formatFlag, ref preTime);
+                            preTime = capTime;
+                            LogHelper.Info($"【任务{dto.ID}】目录[{filesDir}]中的数据处理完成");
+
+                        }
+                        if (!hasFile)
+                        {
+                            LogHelper.Info($"【任务{dto.ID}】缺少最新的采集文件,等待5秒...");
+                            preTime = DateTime.Now;
+                            await Task.Delay(5000, cts.Token);
+                        }
                     }
                     catch (Exception ex)
                     {
@@ -602,28 +618,39 @@ namespace X2D1NoRefTaskServer.Service
                 StopTask(dto.ID, EnumTaskStopType.Properly, "数据处理完成,任务结束");
             }, cts.Token);
         }
-        TimeSpan abs(TimeSpan t)
-        {
-            return (t.TotalSeconds >= 0) ? t : -t;
-        }
-        private bool IsFileInUse(string fileName)
+
+        private async Task<bool> WaitFileEnd(int taskID, HistoryFile file, int capSeconds, CancellationTokenSource cts)
         {
-            bool inUse = true;
-            FileStream fs = null;
-            try
+            while (true)
             {
-                fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None);
-                inUse = false;
+                FileInfo s = new FileInfo(file.FilePath);
+                var len = (int)(DateTime.Now - s.CreationTime).TotalSeconds;
+                if (len < capSeconds + 2)
+                {
+                    LogHelper.Info($"【任务{taskID}】等待[{file.CapTime:yyyyMMddHHmmss}]时刻文件采集完成...");
+                    var sleepTime = (capSeconds - len) / 2 * 1000;
+                    if (sleepTime < 2000)
+                        sleepTime = 2000;
+                    await Task.Delay(sleepTime, cts.Token);
+                    continue;
+                }
+                break;
             }
-            catch
+
+            try
             {
+                using (var fs = new FileStream(file.FilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                {
+                }
             }
-            finally
+            catch (Exception ex)
             {
-                if (fs != null)
-                    fs.Close();
+                LogHelper.Error($"【任务{taskID}】文件[{file.FilePath}]尝试打开失败", ex);
+                return false;
             }
-            return inUse;//true表示正在使用,false没有使用  
+            LogHelper.Info($"【任务{taskID}】[{file.CapTime:yyyyMMddHHmmss}]时刻文件采集完成");
+            return true;
+
         }
         private void ResetTime(int formatFlag, ref DateTime time)
         {
@@ -688,19 +715,21 @@ namespace X2D1NoRefTaskServer.Service
             {
                 if (ch == 2)
                 {
-                    historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
+                    if (canConnected)
+                        historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
                     if (historyFile.SatId == 0)
                     {
-                        LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.MainSatCode}]");
+                        //LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.MainSatCode}]");
                         historyFile.SatId = dto.MainSatCode;
                     }
                 }
                 else if (ch == 3)
                 {
-                    historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
+                    if (canConnected)
+                        historyFile.SatId = GetSatId(historyFile.FreqHz / 1e6);
                     if (historyFile.SatId == 0)
                     {
-                        LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.AdjaSatCode}]");
+                        //LogHelper.Warning($"【任务{dto.ID}】频点{historyFile.FreqHz / 1e6:f3}无法通过MySql查询到卫星编号,使用任务中的卫星[{dto.AdjaSatCode}]");
                         historyFile.SatId = dto.AdjaSatCode;
                     }
                 }
@@ -719,7 +748,7 @@ namespace X2D1NoRefTaskServer.Service
                 var res = MySqlTools.ExecuteScalar(System.Data.CommandType.Text, sql);
                 if (res == null || res == DBNull.Value)
                 {
-                    LogHelper.Warning($"下行频点{freqdownMHz}未能从MySql中找到对应的卫星编号.SQL={sql}");
+                    //LogHelper.Warning($"下行频点{freqdownMHz}未能从MySql中找到对应的卫星编号.SQL={sql}");
                 }
                 else
                 {
@@ -746,6 +775,7 @@ namespace X2D1NoRefTaskServer.Service
             }
             catch
             {
+                LogHelper.Warning($"无法连接到MySql,将使用任务中的卫星编号.SQL={sql}");
                 return false;
             }
         }

+ 3 - 3
Service/X2D1TaskServer54/Service/HistoryTaskService.cs

@@ -161,9 +161,9 @@ namespace X3TaskServer54.Service
                                     continue;
                                 }
 
-                                string mainFile = await HttpHelper.UploadFileAsync(ch0File.File, baseUrl + "File/UploadFileAsync", token: cts.Token);//主星文件
-                                string adja1File = await HttpHelper.UploadFileAsync(ch1File.File, baseUrl + "File/UploadFileAsync", token: cts.Token);//邻1星文件
-                                string adja2File = await HttpHelper.UploadFileAsync(ch2File.File, baseUrl + "File/UploadFileAsync", token: cts.Token);//邻2星文件
+                                string mainFile = await HttpHelper.UploadFileAsync(ch0File.File, baseUrl, token: cts.Token);//主星文件
+                                string adja1File = await HttpHelper.UploadFileAsync(ch1File.File, baseUrl, token: cts.Token);//邻1星文件
+                                string adja2File = await HttpHelper.UploadFileAsync(ch2File.File, baseUrl, token: cts.Token);//邻2星文件
 
 
                                 var sig = sigs.FirstOrDefault(p => p.FreqDownHz == (int)(group.Key * 1e6));

+ 18 - 18
XdCxRhDW.App/Controllers/DetectCgController.cs

@@ -27,9 +27,9 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<CpuCgResDto>> CpuCgCalc(CpuCgDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CpuCgSvr);
-            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<CpuCgResDto>(svr.BaseHttpAddr + "/api/CpuCg/Calc", dto,dto.TimeoutSeconds);
+            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<CpuCgResDto>(svr.BaseHttpAddr + "CpuCg/Calc", dto,dto.TimeoutSeconds);
             return res;
         }
 
@@ -42,9 +42,9 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<List<CpuCgResDto>>> CpuCgMultiCalc(CpuCgMultiDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CpuCgSvr);
-            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr + "/api/File/UploadFileAsync",dto.TimeoutSeconds);
-            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr + "/api/File/UploadFileAsync",dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(svr.BaseHttpAddr + "/api/CpuCg/MultiCalc", dto,dto.TimeoutSeconds);
+            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr,dto.TimeoutSeconds);
+            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr,dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<List<CpuCgResDto>>(svr.BaseHttpAddr + "CpuCg/MultiCalc", dto,dto.TimeoutSeconds);
             return res;
         }
 
@@ -56,9 +56,9 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<List<ImageResultDto>>> DrawImage(CpuCgDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CpuCgSvr);
-            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<List<ImageResultDto>>(svr.BaseHttpAddr + "/api/CpuCg/DrawImage", dto, dto.TimeoutSeconds);
+            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<List<ImageResultDto>>(svr.BaseHttpAddr + "CpuCg/DrawImage", dto, dto.TimeoutSeconds);
             return res;
         }
         /// <summary>
@@ -70,9 +70,9 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<List<GpuCgResponseDto>>> GpuCgCalc(GpuCgRequestDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.GpuCgSvr);
-            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr + "/api/File/UploadFileAsync",dto.TimeoutSeconds);
-            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<List<GpuCgResponseDto>>(svr.BaseHttpAddr + "/api/GpuCg/Calc", dto,dto.TimeoutSeconds);
+            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr,dto.TimeoutSeconds);
+            dto.file2 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file2), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<List<GpuCgResponseDto>>(svr.BaseHttpAddr + "GpuCg/Calc", dto,dto.TimeoutSeconds);
             return res;
         }
 
@@ -85,8 +85,8 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<List<DetectResDto>>> DetectCalc(DetectDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CheckSvr);
-            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<List<DetectResDto>>(svr.BaseHttpAddr + "/api/Check/Calc", dto,dto.TimeoutSeconds);
+            dto.file1 = await HttpHelper.UploadFileAsync(GetLocalFile(dto.file1), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<List<DetectResDto>>(svr.BaseHttpAddr + "Check/Calc", dto,dto.TimeoutSeconds);
             return res;
         }
 
@@ -99,8 +99,8 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<List<SignalProcResDto>>> SignalProc(SignalProcDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CheckSvr);
-            dto.File = await HttpHelper.UploadFileAsync(GetLocalFile(dto.File), svr.BaseHttpAddr + "/api/File/UploadFileAsync");
-            var res = await HttpHelper.PostRequestAsync<List<SignalProcResDto>>(svr.BaseHttpAddr + "/api/Check/SignalProc", dto);
+            dto.File = await HttpHelper.UploadFileAsync(GetLocalFile(dto.File), svr.BaseHttpAddr);
+            var res = await HttpHelper.PostRequestAsync<List<SignalProcResDto>>(svr.BaseHttpAddr + "Check/SignalProc", dto);
             return res;
         }
 
@@ -112,8 +112,8 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<ResampleResponseDto>> Resample(ResampleRequestDto dto)
         {
             var svr = ServerContext.Instance.GetRandomOne(EnumSvrType.CheckSvr);
-            dto.File = await HttpHelper.UploadFileAsync(GetLocalFile(dto.File), svr.BaseHttpAddr + "/api/File/UploadFileAsync", dto.TimeoutSeconds);
-            var res = await HttpHelper.PostRequestAsync<ResampleResponseDto>(svr.BaseHttpAddr + "/api/Check/Resample", dto,dto.TimeoutSeconds);
+            dto.File = await HttpHelper.UploadFileAsync(GetLocalFile(dto.File), svr.BaseHttpAddr, dto.TimeoutSeconds);
+            var res = await HttpHelper.PostRequestAsync<ResampleResponseDto>(svr.BaseHttpAddr + "Check/Resample", dto,dto.TimeoutSeconds);
             await HttpHelper.DownloadFileAsync(svr.BaseHttpAddr, res.data.File, GetLocalFile(res.data.File),dto.TimeoutSeconds);
             return res;
         }

+ 4 - 0
XdCxRhDW.App/Controllers/SvrReportController.cs

@@ -32,6 +32,10 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
+                if (dto.BaseHttpAddr.EndsWith("/"))
+                    dto.BaseHttpAddr = dto.BaseHttpAddr + "api/";
+                else
+                    dto.BaseHttpAddr = dto.BaseHttpAddr + "/api/";
                 Messenger.Defalut.Pub("服务状态改变", dto);
                 return Success();
             }

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

@@ -53,7 +53,7 @@ namespace XdCxRhDW.App.CorTools
                     string file1 = null, file2 = null;
                     try
                     {
-                        file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
+                        file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
                     }
                     catch (Exception ex)
                     {
@@ -64,7 +64,7 @@ namespace XdCxRhDW.App.CorTools
                     }
                     try
                     {
-                        file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl + "File/UploadFileAsync");
+                        file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
                     }
                     catch (Exception ex)
                     {
@@ -147,7 +147,7 @@ namespace XdCxRhDW.App.CorTools
                             t.snr = null;
                         });
                         gridView1.RefreshData();
-                        var file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
+                        var file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
                         var smps = data.Select(p => new SmpPosition()
                         {
                             smpStart = p.smpstart,
@@ -240,7 +240,7 @@ namespace XdCxRhDW.App.CorTools
             {
                 try
                 {
-                    dto.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
+                    dto.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
                 }
                 catch (Exception ex)
                 {
@@ -305,8 +305,8 @@ namespace XdCxRhDW.App.CorTools
             layoutControl1.Enabled = false;
             try
             {
-                xItem.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
-                xItem.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl + "File/UploadFileAsync");
+                xItem.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                xItem.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
             }
             catch (Exception ex)
             {
@@ -398,8 +398,8 @@ namespace XdCxRhDW.App.CorTools
                     snrThreshold = int.Parse(teSnr.Text),
                     TimeoutSeconds = int.Parse(txtTimeout.Text)
                 };
-                par.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
-                par.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl + "File/UploadFileAsync");
+                par.file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                par.file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
 
                 var resp = await HttpHelper.PostRequestAsync<List<ImageResultDto>>(baseUrl + "DetectCg/DrawImage", par, par.TimeoutSeconds);
                 if (resp.code != 200)

+ 2 - 2
XdCxRhDW.App/CorTools/GpuCalcForm.cs

@@ -63,8 +63,8 @@ namespace XdCxRhDW.App.CorTools
             string file1,file2;
             try
             {
-                file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl + "File/UploadFileAsync");
-                file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl + "File/UploadFileAsync");
+                file1 = await HttpHelper.UploadFileAsync(btnFile1.Text, baseUrl);
+                file2 = await HttpHelper.UploadFileAsync(btnFile2.Text, baseUrl);
             }
             catch (Exception ex)
             {

+ 2 - 2
XdCxRhDW.App/CorTools/ResampleForm.cs

@@ -84,7 +84,7 @@ namespace XdCxRhDW.App.CorTools
                 string baseUrl = null;
                 if (SysConfig.Config != null)
                 {
-                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/";
+                    baseUrl = $"http://{IpHelper.GetLocalIp()}:{SysConfig.Config.HttpPort}/api";
                 }
                 if (baseUrl == null)
                 {
@@ -95,7 +95,7 @@ namespace XdCxRhDW.App.CorTools
                 string file = null;
                 try
                 {
-                    file = await HttpHelper.UploadFileAsync(txtFile.Text, baseUrl + "Api/File/UploadFileAsync");
+                    file = await HttpHelper.UploadFileAsync(txtFile.Text, baseUrl);
                 }
                 catch (Exception ex)
                 {

+ 1 - 1
XdCxRhDW.App/MainForm.cs

@@ -136,7 +136,7 @@ namespace XdCxRhDW
                 {
                     try
                     {
-                        var fileName = await HttpHelper.UploadFileAsync(file, baseUrl + "File/UploadFileAsync");
+                        var fileName = await HttpHelper.UploadFileAsync(file, baseUrl);
                         XlImportDto dto = new XlImportDto() { File = fileName };
                         var res = await HttpHelper.PostRequestAsync<RecordRes>(baseUrl + "Xl/ImportTleAsync", dto);
                         if (res.code == 200)

+ 29 - 29
XdCxRhDW.App/UserControl/CtrlHome.Designer.cs

@@ -138,14 +138,14 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControl1.Name = "layoutControl1";
             this.layoutControl1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(1088, 144, 650, 400);
             this.layoutControl1.Root = this.Root;
-            this.layoutControl1.Size = new System.Drawing.Size(883, 523);
+            this.layoutControl1.Size = new System.Drawing.Size(1096, 523);
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
             // txtTimeCho
             // 
             this.txtTimeCho.EditValue = 1;
-            this.txtTimeCho.Location = new System.Drawing.Point(338, 206);
+            this.txtTimeCho.Location = new System.Drawing.Point(342, 212);
             this.txtTimeCho.MenuManager = this.barManager1;
             this.txtTimeCho.Name = "txtTimeCho";
             this.txtTimeCho.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -181,7 +181,7 @@ namespace XdCxRhDW.App.UserControl
             this.barDockControlTop.Location = new System.Drawing.Point(0, 0);
             this.barDockControlTop.Manager = this.barManager1;
             this.barDockControlTop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.barDockControlTop.Size = new System.Drawing.Size(883, 0);
+            this.barDockControlTop.Size = new System.Drawing.Size(1096, 0);
             // 
             // barDockControlBottom
             // 
@@ -190,7 +190,7 @@ namespace XdCxRhDW.App.UserControl
             this.barDockControlBottom.Location = new System.Drawing.Point(0, 523);
             this.barDockControlBottom.Manager = this.barManager1;
             this.barDockControlBottom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.barDockControlBottom.Size = new System.Drawing.Size(883, 0);
+            this.barDockControlBottom.Size = new System.Drawing.Size(1096, 0);
             // 
             // barDockControlLeft
             // 
@@ -205,7 +205,7 @@ namespace XdCxRhDW.App.UserControl
             // 
             this.barDockControlRight.CausesValidation = false;
             this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
-            this.barDockControlRight.Location = new System.Drawing.Point(883, 0);
+            this.barDockControlRight.Location = new System.Drawing.Point(1096, 0);
             this.barDockControlRight.Manager = this.barManager1;
             this.barDockControlRight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.barDockControlRight.Size = new System.Drawing.Size(0, 523);
@@ -228,7 +228,7 @@ namespace XdCxRhDW.App.UserControl
             // 
             // btnSearch
             // 
-            this.btnSearch.Location = new System.Drawing.Point(954, 206);
+            this.btnSearch.Location = new System.Drawing.Point(958, 212);
             this.btnSearch.Name = "btnSearch";
             this.btnSearch.Size = new System.Drawing.Size(84, 21);
             this.btnSearch.StyleController = this.layoutControl1;
@@ -239,7 +239,7 @@ namespace XdCxRhDW.App.UserControl
             // txtEndTime
             // 
             this.txtEndTime.EditValue = null;
-            this.txtEndTime.Location = new System.Drawing.Point(708, 206);
+            this.txtEndTime.Location = new System.Drawing.Point(712, 212);
             this.txtEndTime.MenuManager = this.barManager1;
             this.txtEndTime.Name = "txtEndTime";
             this.txtEndTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -253,7 +253,7 @@ namespace XdCxRhDW.App.UserControl
             // txtStartTime
             // 
             this.txtStartTime.EditValue = null;
-            this.txtStartTime.Location = new System.Drawing.Point(498, 206);
+            this.txtStartTime.Location = new System.Drawing.Point(502, 212);
             this.txtStartTime.MenuManager = this.barManager1;
             this.txtStartTime.Name = "txtStartTime";
             this.txtStartTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
@@ -266,17 +266,17 @@ namespace XdCxRhDW.App.UserControl
             // 
             // mapControl1
             // 
-            this.mapControl1.Location = new System.Drawing.Point(118, 2);
+            this.mapControl1.Location = new System.Drawing.Point(122, 2);
             this.mapControl1.Name = "mapControl1";
-            this.mapControl1.Size = new System.Drawing.Size(933, 164);
+            this.mapControl1.Size = new System.Drawing.Size(972, 170);
             this.mapControl1.TabIndex = 6;
             // 
             // gridHomePosRes
             // 
-            this.gridHomePosRes.Location = new System.Drawing.Point(119, 230);
+            this.gridHomePosRes.Location = new System.Drawing.Point(123, 236);
             this.gridHomePosRes.MainView = this.gridView2;
             this.gridHomePosRes.Name = "gridHomePosRes";
-            this.gridHomePosRes.Size = new System.Drawing.Size(931, 273);
+            this.gridHomePosRes.Size = new System.Drawing.Size(970, 284);
             this.gridHomePosRes.TabIndex = 5;
             this.gridHomePosRes.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView2});
@@ -294,7 +294,7 @@ namespace XdCxRhDW.App.UserControl
             this.gridHomeTask.Name = "gridHomeTask";
             this.gridHomeTask.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
             this.repositoryItemImageEdit1});
-            this.gridHomeTask.Size = new System.Drawing.Size(100, 477);
+            this.gridHomeTask.Size = new System.Drawing.Size(104, 494);
             this.gridHomeTask.TabIndex = 4;
             this.gridHomeTask.ToolTipController = this.toolTipController1;
             this.gridHomeTask.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -320,7 +320,7 @@ namespace XdCxRhDW.App.UserControl
             // btnIncludeInvalidate
             // 
             this.btnIncludeInvalidate.EditValue = true;
-            this.btnIncludeInvalidate.Location = new System.Drawing.Point(865, 206);
+            this.btnIncludeInvalidate.Location = new System.Drawing.Point(869, 212);
             this.btnIncludeInvalidate.Name = "btnIncludeInvalidate";
             this.btnIncludeInvalidate.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
             this.btnIncludeInvalidate.Properties.Caption = "包含无效点";
@@ -331,7 +331,7 @@ namespace XdCxRhDW.App.UserControl
             // txtFrequpMHz
             // 
             this.txtFrequpMHz.EditValue = 1;
-            this.txtFrequpMHz.Location = new System.Drawing.Point(178, 206);
+            this.txtFrequpMHz.Location = new System.Drawing.Point(182, 212);
             this.txtFrequpMHz.Name = "txtFrequpMHz";
             this.txtFrequpMHz.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
             new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
@@ -352,15 +352,15 @@ namespace XdCxRhDW.App.UserControl
             this.splitterItem2});
             this.Root.Name = "Root";
             this.Root.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.Root.Size = new System.Drawing.Size(1053, 506);
+            this.Root.Size = new System.Drawing.Size(1096, 523);
             this.Root.TextVisible = false;
             // 
             // layoutControlItem3
             // 
             this.layoutControlItem3.Control = this.mapControl1;
-            this.layoutControlItem3.Location = new System.Drawing.Point(116, 0);
+            this.layoutControlItem3.Location = new System.Drawing.Point(120, 0);
             this.layoutControlItem3.Name = "layoutControlItem3";
-            this.layoutControlItem3.Size = new System.Drawing.Size(937, 168);
+            this.layoutControlItem3.Size = new System.Drawing.Size(976, 174);
             this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem3.TextVisible = false;
             // 
@@ -388,7 +388,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlGroup1.Name = "layoutControlGroup1";
             this.layoutControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup1.Size = new System.Drawing.Size(106, 506);
+            this.layoutControlGroup1.Size = new System.Drawing.Size(110, 523);
             this.layoutControlGroup1.Text = "任务管理";
             this.layoutControlGroup1.CustomButtonClick += new DevExpress.XtraBars.Docking2010.BaseButtonEventHandler(this.layoutControlGroup1_CustomButtonClick);
             // 
@@ -398,7 +398,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem1.Location = new System.Drawing.Point(0, 0);
             this.layoutControlItem1.Name = "layoutControlItem1";
             this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlItem1.Size = new System.Drawing.Size(100, 477);
+            this.layoutControlItem1.Size = new System.Drawing.Size(104, 494);
             this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem1.TextVisible = false;
             // 
@@ -409,10 +409,10 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItemSearch,
             this.layoutControlGroup3,
             this.emptySpaceItem1});
-            this.layoutControlGroup2.Location = new System.Drawing.Point(116, 178);
+            this.layoutControlGroup2.Location = new System.Drawing.Point(120, 184);
             this.layoutControlGroup2.Name = "layoutControlGroup2";
             this.layoutControlGroup2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup2.Size = new System.Drawing.Size(937, 328);
+            this.layoutControlGroup2.Size = new System.Drawing.Size(976, 339);
             this.layoutControlGroup2.Text = "定位结果";
             // 
             // layoutControlItem2
@@ -421,7 +421,7 @@ namespace XdCxRhDW.App.UserControl
             this.layoutControlItem2.Location = new System.Drawing.Point(0, 28);
             this.layoutControlItem2.Name = "layoutControlItem2";
             this.layoutControlItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlItem2.Size = new System.Drawing.Size(931, 273);
+            this.layoutControlItem2.Size = new System.Drawing.Size(970, 284);
             this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem2.TextVisible = false;
             // 
@@ -539,22 +539,22 @@ namespace XdCxRhDW.App.UserControl
             this.emptySpaceItem1.AllowHotTrack = false;
             this.emptySpaceItem1.Location = new System.Drawing.Point(921, 0);
             this.emptySpaceItem1.Name = "emptySpaceItem1";
-            this.emptySpaceItem1.Size = new System.Drawing.Size(10, 28);
+            this.emptySpaceItem1.Size = new System.Drawing.Size(49, 28);
             this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
             // 
             // splitterItem1
             // 
             this.splitterItem1.AllowHotTrack = true;
-            this.splitterItem1.Location = new System.Drawing.Point(106, 0);
+            this.splitterItem1.Location = new System.Drawing.Point(110, 0);
             this.splitterItem1.Name = "splitterItem1";
-            this.splitterItem1.Size = new System.Drawing.Size(10, 506);
+            this.splitterItem1.Size = new System.Drawing.Size(10, 523);
             // 
             // splitterItem2
             // 
             this.splitterItem2.AllowHotTrack = true;
-            this.splitterItem2.Location = new System.Drawing.Point(116, 168);
+            this.splitterItem2.Location = new System.Drawing.Point(120, 174);
             this.splitterItem2.Name = "splitterItem2";
-            this.splitterItem2.Size = new System.Drawing.Size(937, 10);
+            this.splitterItem2.Size = new System.Drawing.Size(976, 10);
             // 
             // svgImageCollection1
             // 
@@ -589,7 +589,7 @@ namespace XdCxRhDW.App.UserControl
             this.Controls.Add(this.barDockControlBottom);
             this.Controls.Add(this.barDockControlTop);
             this.Name = "CtrlHome";
-            this.Size = new System.Drawing.Size(883, 523);
+            this.Size = new System.Drawing.Size(1096, 523);
             this.Load += new System.EventHandler(this.CtrlHome_Load);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);

+ 15 - 12
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -182,6 +182,10 @@ namespace XdCxRhDW.App.UserControl
             var currentTask = gridView1.GetFocusedRow() as TaskInfo;
             if (currentTask.ID == posRes.TaskInfoID)
             {
+                if (txtFrequpMHz.EditValue != null && posRes.FreqUpHz != (long)(Convert.ToDouble(txtFrequpMHz.EditValue) * 1e6))
+                    return;
+                if (posRes.PosLon == 999 && !btnIncludeInvalidate.Checked)
+                    return;
                 var ds = this.gridHomePosRes.DataSource as List<ModelPosRes>;
                 ds.Insert(0, posRes);
                 this.Invoke(new Action(() =>
@@ -539,7 +543,7 @@ namespace XdCxRhDW.App.UserControl
                                 dto.StartTime = startTime;
                                 dto.EndTime = endTime;
                             }
-                            var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "/api/X2D1NoRefTaskProcessing/Run", dto);
+                            var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "X2D1NoRefTaskProcessing/Run", dto);
                             if (res.code != 200)
                             {
                                 Serilog.Log.Error(res.msg);
@@ -574,7 +578,7 @@ namespace XdCxRhDW.App.UserControl
                                 CapLat = tx.Lat,
                                 Sigs = tskSigsDto.ToList()
                             };
-                            var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "/api/X2D1NoRefTaskProcessing/Run", dto);
+                            var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "X2D1NoRefTaskProcessing/Run", dto);
                             if (res.code != 200)
                             {
                                 Serilog.Log.Error(res.msg);
@@ -607,6 +611,13 @@ namespace XdCxRhDW.App.UserControl
             {
                 try
                 {
+                    using (RHDWContext db = new RHDWContext())
+                    {
+                        var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);
+                        item.TaskState = EnumTaskState.Stopped;
+                        await db.SaveChangesAsync();
+                    }
+                    tsk.TaskState = EnumTaskState.Stopped;
                     if (tsk.TaskType != EnumTaskType.Group)
                     {
                         ModelSvr svtItem = null;
@@ -616,27 +627,19 @@ namespace XdCxRhDW.App.UserControl
                             svtItem = ServerContext.Instance.GetRandomOne(EnumSvrType.X3NoRefHistoryTask);
                         if (svtItem == null)
                         {
-                            DxHelper.MsgBoxHelper.ShowWarning($"未找到注册的处理服务");
+                            //DxHelper.MsgBoxHelper.ShowWarning($"未找到注册的处理服务");
                             return;
                         }
                         TaskStopHandleDto dto = new TaskStopHandleDto();
                         dto.ID = tsk.ID;
-                        var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "/api/X2D1NoRefTaskProcessing/Stop", dto);
+                        var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.BaseHttpAddr + "X2D1NoRefTaskProcessing/Stop", dto);
                         if (res.code != 200)
                         {
                             Serilog.Log.Error(res.msg);
                             DxHelper.MsgBoxHelper.ShowWarning(res.msg);
                         }
                     }
-                    using (RHDWContext db = new RHDWContext())
-                    {
-                        var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);
-                        item.TaskState = EnumTaskState.Stopped;
-                        await db.SaveChangesAsync();
-                    }
-                    tsk.TaskState = EnumTaskState.Stopped;
                     Serilog.Log.Warning($"用户停止了任务,ID={tsk.ID}");
-
                 }
                 catch (Exception ex)
                 {

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

@@ -72,7 +72,7 @@ namespace XdCxRhDW.App.UserControl
             string file;
             try
             {
-                file = await HttpHelper.UploadFileAsync(btnOpen.Text, baseUrl + "File/UploadFileAsync");
+                file = await HttpHelper.UploadFileAsync(btnOpen.Text, baseUrl);
             }
             catch (Exception ex)
             {

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

@@ -508,6 +508,7 @@
     <EmbeddedResource Include="PopupControl\ShowCxCtrl.resx">
       <DependentUpon>ShowCxCtrl.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 69 - 2
XdCxRhDW.Framework/HttpHelper.cs

@@ -14,6 +14,16 @@ using System.Threading.Tasks;
 /// </summary>
 public class HttpHelper
 {
+    /// <summary>
+    /// 文件删除模型
+    /// </summary>
+    class FileDeleteDto
+    {
+        /// <summary>
+        /// 要删除的服务器上的文件名称
+        /// </summary>
+        public List<string> Files { get; set; }
+    }
     /// <summary>
     /// 
     /// </summary>
@@ -110,12 +120,17 @@ public class HttpHelper
     /// 上传文件,wav文件会自动去掉44字节头
     /// </summary>
     /// <param name="localFile"></param>
-    /// <param name="uploadUrl"></param>
+    /// <param name="baseUrl"></param>
     /// <param name="timeoutSeconds"></param>
     /// <param name="token"></param>
     /// <returns></returns>
-    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 baseUrl, int timeoutSeconds = 30, CancellationToken token = default)
     {
+        string uploadUrl = baseUrl;
+        if (baseUrl.EndsWith("/"))
+            uploadUrl += "File/UploadFileAsync";
+        else
+            uploadUrl += "/File/UploadFileAsync";
         try
         {
             // 添加文件内容到 MultipartFormDataContent
@@ -158,6 +173,58 @@ public class HttpHelper
             throw new Exception($"上传文件{Path.GetFileName(localFile)}到{uploadUrl}失败!");
         }
     }
+
+
+    /// <summary>
+    /// 删除文件
+    /// </summary>
+    /// <param name="files">要删除的文件</param>
+    /// <param name="baseUrl">baseUrl</param>
+    /// <returns></returns>
+    public static async Task<int> DeleteFileAsync(List<string> files, string baseUrl)
+    {
+        FileDeleteDto dto = new FileDeleteDto()
+        {
+            Files = files
+        };
+        var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
+        var handler = new HttpClientHandler() { UseCookies = false };
+        HttpClient client = new HttpClient(handler);
+        client.Timeout = TimeSpan.FromSeconds(30);
+        var message = new HttpRequestMessage(HttpMethod.Post, baseUrl + "/File/DeleteFiles");
+        message.Content = content;
+
+        var response = await client.SendAsync(message);
+        response.EnsureSuccessStatusCode();
+        var result = await response.Content.ReadAsStringAsync();
+        var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<int>>(result);
+        return AjaxResult.data;
+    }
+    /// <summary>
+    /// 删除文件
+    /// </summary>
+    /// <param name="files">要删除的文件</param>
+    /// <param name="baseUrl">baseUrl</param>
+    /// <returns></returns>
+    public static async Task<int> DeleteFileAsync(string[] files, string baseUrl)
+    {
+        FileDeleteDto dto = new FileDeleteDto()
+        {
+            Files = files.ToList()
+        };
+        var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
+        var handler = new HttpClientHandler() { UseCookies = false };
+        HttpClient client = new HttpClient(handler);
+        client.Timeout = TimeSpan.FromSeconds(30);
+        var message = new HttpRequestMessage(HttpMethod.Post, baseUrl + "/File/DeleteFiles");
+        message.Content = content;
+
+        var response = await client.SendAsync(message);
+        response.EnsureSuccessStatusCode();
+        var result = await response.Content.ReadAsStringAsync();
+        var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<int>>(result);
+        return AjaxResult.data;
+    }
 }
 
 /// <summary>

+ 1 - 0
XdCxRhDW.WebApi/05.XdCxRhDW.WebApi.csproj

@@ -174,6 +174,7 @@
     <Compile Include="AutofacUtil.cs" />
     <Compile Include="BaseController.cs" />
     <Compile Include="FileController.cs" />
+    <Compile Include="FileDeleteDto.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Startup.cs" />
   </ItemGroup>

+ 8 - 4
XdCxRhDW.WebApi/FileController.cs

@@ -81,16 +81,20 @@ namespace XdCxRhDW.WebApi
         /// <param name="files">上传后返回的一个或多个文件集合</param>
         /// <returns>返回删除成功的文件个数</returns>
         [HttpPost]
-        public AjaxResult<int> DeleteFiles(List<string> files)
+        public AjaxResult<int> DeleteFiles(FileDeleteDto dto)
         {
+            if(dto.Files==null||dto.Files.Count==0)return Success(0);
             int count = 0;
-            foreach (var fileName in files)
+            foreach (var fileName in dto.Files)
             {
                 try
                 {
                     var file = Path.Combine(uploadFolder, fileName);
-                    File.Delete(file);
-                    count++;
+                    if (File.Exists(file))
+                    {
+                        File.Delete(file);
+                        count++;
+                    }
                 }
                 catch (Exception ex)
                 {

+ 19 - 0
XdCxRhDW.WebApi/FileDeleteDto.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDW.WebApi
+{
+    /// <summary>
+    /// 文件删除模型
+    /// </summary>
+    public class FileDeleteDto
+    {
+        /// <summary>
+        /// 要删除的服务器上的文件名称
+        /// </summary>
+        public List<string> Files { get; set; }
+    }
+}