gongqiuhong 1 gadu atpakaļ
vecāks
revīzija
53308d8ec2

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

@@ -16,6 +16,7 @@ using XdCxRhDw.Dto;
 using XdCxRhDW.WebApi;
 using DPP_YH_Core.Extensions;
 using XdCxRhDW.App.Model;
+using System.Diagnostics;
 
 namespace XdCxRhDW.App.Controllers
 {
@@ -56,9 +57,9 @@ namespace XdCxRhDW.App.Controllers
                     }
                 }
             }
+            
             using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime))
             {
-
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
                     SatTxLon = dto.SatTxLon,
@@ -104,7 +105,6 @@ namespace XdCxRhDW.App.Controllers
                     SigTime = dto.SigTime,
                     Fx = dto.CxRes,
                 });
-
                 var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes);
 
                 PosRes posRes = new PosRes()
@@ -123,9 +123,7 @@ namespace XdCxRhDW.App.Controllers
                 };
                 posRes = db.PosRes.Add(posRes);
                 await db.SaveChangesAsync();
-                var a = MapModel(posRes);
                 Messenger.Defalut.Pub("新增定位点", MapModel(posRes));
-                var b = MapDto(posRes);
                 return Success(MapDto(posRes));
             }
         }
@@ -228,7 +226,6 @@ namespace XdCxRhDW.App.Controllers
                     SigTime = dto.SigTime,
                     Fx = dto.CxRes,
                 });
-
                 var res = PosApi.X1D1_Pos(cgRes, StationRes, cxRes);
 
                 PosRes posRes = new PosRes()

+ 28 - 6
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -37,6 +37,8 @@ using DevExpress.Office.Crypto;
 using XdCxRhDW.App.Model;
 using DPP_YH_Core.Extensions;
 using static DevExpress.Utils.Drawing.Helpers.NativeMethods;
+using DevExpress.Utils.Filtering;
+using DevExpress.Data.Svg;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -358,7 +360,14 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 if (items.Count == 0) return 0;
-                var targetID = items.Where(p => p.TargetInfoID > 0).FirstOrDefault()?.TargetInfoID;
+                
+                long? targetID = 0;
+                using (RHDWPartContext db = RHDWPartContext.GetContext(items.First().SigTime))
+                {
+                    var idRes = items.First().ID;
+                    var target = await db.PosRes.Where(p => p.ID == idRes).FirstOrDefaultAsync() as PosRes;
+                    targetID = target.TargetInfoID;
+                }
                 TargetInfo info = null;
                 if (targetID > 0)
                 {
@@ -372,6 +381,7 @@ namespace XdCxRhDW.App.UserControl
                 var tar = frm.info;
                 var groupData = items.GroupBy(p => p.SigTime.ToString("yyyyMMdd"));
 
+                List<long> posResIdList = new List<long>();
                 foreach (var groupItems in groupData)
                 {
                     var ids = groupItems.Select(p => p.ID);
@@ -381,18 +391,21 @@ namespace XdCxRhDW.App.UserControl
                         tarItems.ForEach(t =>
                         {
                             t.TargetInfoID = tar.ID;
-                            //t.TargetName = tar.TargetName;
                             t.ColorKey = tar.TargeColor;
                         });
-                        //groupItems.ForEach(t =>
-                        //{
-                        //    t.ColorKey = tar.TargeColor;
-                        //});
+                        posResIdList.AddRange(tarItems.Select(s => s.ID));
                         mapControl1.UpdatePosItem(tarItems);
                         db.PosRes.AddOrUpdate(tarItems);
                         await db.SaveChangesAsync();
                     }
                 }
+                var ds = this.gridHomePosRes.DataSource as List<ModelPosRes>;
+                ds.Where(w => posResIdList.Contains(w.ID)).ForEach(p =>
+                {
+                    p.TargetInfoID = tar.ID;
+                    p.TargetInfo = tar;
+                });
+                gridView2.RefreshData();
                 return items.Count;
 
             }
@@ -898,6 +911,15 @@ namespace XdCxRhDW.App.UserControl
             {
                 try
                 {
+                    var svtItem = TaskSvr.GetTaskSvt();
+                    if (tsk.TaskType == EnumTaskType.History)
+                    {
+                        var res = await HttpHelper.PostRequestAsync<AjaxResult>(svtItem.modelSvrs.BaseHttpAddr + "/api/HistoryTaskProcessing/Stop", tsk.ID);
+                        if (res.code != 200)
+                        {
+                            DxHelper.MsgBoxHelper.ShowWarning($"停止历史任务的服务失败{res.msg}");
+                        }
+                    }
                     using (RHDWContext db = new RHDWContext())
                     {
                         var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);

+ 12 - 12
XdCxRhDW.Sender/Form1.cs

@@ -64,17 +64,17 @@ namespace XdCxRhDW.Sender
                                             if (cts1.IsCancellationRequested) break;
                                             if (string.IsNullOrWhiteSpace(line)) continue;
                                             var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
-                                            //CheckResDto checkResDto = new CheckResDto()
-                                            //{
-                                            //    UserName = "UserName",
-                                            //    FileName = "FileName",
-                                            //    SmpStart = 1,
-                                            //    SmpCount = 2,
-                                            //    ModType = "ModType",
-                                            //    PosCheckType = EnumPosCheckTypeDto.Ky5758,
-                                            //    ModRate=null
-                                            //};
-                                            X1D1PosDto dto = new X1D1PosDto()
+                                        CheckResDto checkResDto = new CheckResDto()
+                                        {
+                                            UserName = "UserName",
+                                            FileName = "FileName",
+                                            SmpStart = 1,
+                                            SmpCount = 2,
+                                            ModType = "ModType",
+                                            PosCheckType = EnumPosCheckTypeDto.Ky5758,
+                                            ModRate = null
+                                        };
+                                        X1D1PosDto dto = new X1D1PosDto()
                                             {
                                                 SigTime = DateTime.Now,
                                                 MainCode = 23467,
@@ -96,7 +96,7 @@ namespace XdCxRhDW.Sender
                                                 CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
                                                 RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
                                                 RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
-                                                //CheckRes= checkResDto
+                                                CheckRes= checkResDto
                                             };
                                             var result = await HttpHelper.PostRequestAsync<PosResDto>(url, dto);
                                             if (result.code != 200)