Browse Source

修改报告相关代码

liyang 6 months ago
parent
commit
73faaddbcd

+ 14 - 6
SimulationServer/Component/SJAllTotalTaskPerformance.cs

@@ -30,6 +30,8 @@ public class SJAllTotalTaskPerformanceComponent
         double 人员存活率 = 0;
         double 任务是否成功 = 0;
         float 识别成功率 = 0f;
+        double 平均救助时间 = 0;
+        float 人员数量 = 0;
 
 
         double aircreftCount = 0;
@@ -49,9 +51,11 @@ public class SJAllTotalTaskPerformanceComponent
             foreach (var item in mhRescueMission.aircraftSJDatas)
             {
                 识别成功率 += float.Parse(item.Value["识别成功率"][sIndex]);
+                人员数量 += float.Parse(item.Value["人员数量"][sIndex]);
                 if (任务准备时间 < float.Parse(item.Value["任务准备时间"][sIndex]))
                     任务准备时间 = float.Parse(item.Value["任务准备时间"][sIndex]);
                 平均搜索时间 += float.Parse(item.Value["平均搜索时间"][sIndex]);
+                平均救助时间 += float.Parse(item.Value["平均救助时间"][sIndex]);
                 总飞行时间 += float.Parse(item.Value["总飞行时间"][sIndex]);
                 人员存活率 += float.Parse(item.Value["人员存活率"][sIndex]);
                 aircreftCount++;
@@ -60,14 +64,14 @@ public class SJAllTotalTaskPerformanceComponent
         }
         if (人员存活率 != 0)
             任务是否成功 = 1;
-        SSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / aircreftCount).ToString();
+        SSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / 人员数量).ToString();
         SSJAllTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
         SSJAllTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / aircreftCount).ToString("f4");
-        SSJAllTotalTaskPerformance.平均救助时间 = 5.ToString();
+        SSJAllTotalTaskPerformance.平均救助时间 = (平均救助时间 / aircreftCount).ToString("f4");
         SSJAllTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString("f4");
         SSJAllTotalTaskPerformance.海情覆盖率 = "0.6".ToString();//"60%"
         SSJAllTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
-        SSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / aircreftCount).ToString();
+        SSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / 人员数量).ToString();
         sIndex++;
     }
 
@@ -79,6 +83,8 @@ public class SJAllTotalTaskPerformanceComponent
         double 人员存活率 = 0;
         double 任务是否成功 = 0;
         float 识别成功率 = 0f;
+        double 平均救助时间 = 0;
+        float 人员数量 = 0;
 
 
         double aircreftCount = 0;
@@ -98,9 +104,11 @@ public class SJAllTotalTaskPerformanceComponent
             foreach (var item in mhRescueMission.aircraftSJDatas)
             {
                 识别成功率 += float.Parse(item.Value["识别成功率"][lIndex]);
+                人员数量 += float.Parse(item.Value["人员数量"][sIndex]);
                 if (任务准备时间 < float.Parse(item.Value["任务准备时间"][lIndex]))
                     任务准备时间 = float.Parse(item.Value["任务准备时间"][lIndex]);
                 平均搜索时间 += float.Parse(item.Value["平均搜索时间"][lIndex]);
+                平均救助时间 += float.Parse(item.Value["平均救助时间"][sIndex]);
                 总飞行时间 += float.Parse(item.Value["总飞行时间"][lIndex]);
                 人员存活率 += float.Parse(item.Value["人员存活率"][lIndex]);
                 aircreftCount++;
@@ -109,14 +117,14 @@ public class SJAllTotalTaskPerformanceComponent
         }
         if (人员存活率 != 0)
             任务是否成功 = 1;
-        LSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / aircreftCount).ToString();
+        LSJAllTotalTaskPerformance.识别成功率 = (识别成功率 / 人员数量).ToString();
         LSJAllTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
         LSJAllTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / aircreftCount).ToString("f4");
-        LSJAllTotalTaskPerformance.平均救助时间 = 5.ToString();
+        LSJAllTotalTaskPerformance.平均救助时间 = (平均救助时间 / aircreftCount).ToString();
         LSJAllTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString("f4");
         LSJAllTotalTaskPerformance.环境覆盖率 = "0.6".ToString();//"60%"
         LSJAllTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
-        LSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / aircreftCount).ToString();
+        LSJAllTotalTaskPerformance.人员存活率 = (人员存活率 / 人员数量).ToString();
         lIndex++;
     }
 

+ 15 - 11
SimulationServer/Component/TaskComponent.cs

@@ -1,4 +1,5 @@
 using KYFramework;
+using OpenQA.Selenium.Remote;
 using SimulationServer.Utils;
 
 namespace SimulationServer;
@@ -7,6 +8,7 @@ public class TaskComponent : Component
 {
     public static Weather Weather;
     public static int Speed = 100;
+
     // 救援任务列表
     public List<MHRescueMission> MHRescueMissions;
     public List<XHRescueMission> XHRescueMissions;
@@ -36,6 +38,8 @@ public class TaskComponent : Component
     public bool isSea;
     public bool isLand;
 
+    public string date;
+
     public void Start()
     {
         MHRescueMissions?.ForEach(r => r.Reset());
@@ -141,30 +145,30 @@ public class TaskComponent : Component
 
     public void ReportAllSJSea()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/SSJ/{data}";
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
 
         string totalPath = $"{path}/{"海上搜救任务总体指标报告"}.xls";
-        DataTableExtensions.SaveToExcel(totalPath, alltotalReportSea, true);
+        DataTableExtensions.SaveToExcel(totalPath, alltotalReportSea, true, true, (seaSuccessCount * 1f / ExecutionContext).ToString());
 
 
-        string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
-        DataTableExtensions.SaveToExcel(totalPath1, totalReportSea);
+        //string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
+        //DataTableExtensions.SaveToExcel(totalPath1, totalReportSea);
     }
 
     public void ReportAllSJLand()
     {
         string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/LSX/{data}";
+        string path = $"Reports/{date}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
 
         string totalPath = $"{path}/{"陆上搜寻任务总体指标报告"}.xls";
-        DataTableExtensions.SaveToExcel(totalPath, alltotalReportLand, true);
+        DataTableExtensions.SaveToExcel(totalPath, alltotalReportLand, true, true, (landSuccessCount * 1f / ExecutionContext).ToString());
 
 
-        string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
-        DataTableExtensions.SaveToExcel(totalPath1, totalReportLand);
+        //string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
+        //DataTableExtensions.SaveToExcel(totalPath1, totalReportLand);
     }
 
     public void SaveTotalMHSea()
@@ -217,7 +221,7 @@ public class TaskComponentUpdateSystem : UpdateSystem<TaskComponent>
                         self.seaSuccessCount++;
                     self.SaveSeaSJ(report);
                 }
-                self.SaveTotalMHSea();
+                //self.SaveTotalMHSea();
                 self.ReportAllSJSea();
                 self.SeaSJRescueMissions.Clear();
             }
@@ -236,7 +240,7 @@ public class TaskComponentUpdateSystem : UpdateSystem<TaskComponent>
                         self.landSuccessCount++;
                     self.SaveLandSJ(report);
                 }
-                self.SaveTotalMHLand();
+                //self.SaveTotalMHLand();
                 self.ReportAllSJLand();
                 self.LandSJRescueMissions.Clear();
             }

+ 0 - 2
SimulationServer/Entity/AircraftEntity.cs

@@ -33,8 +33,6 @@ public class AircraftEntity : Entity
 
     public List<TurningPoint> TurningPoints = new List<TurningPoint>(); // 航路点
 
-    public bool isSea;
-    public bool isLand;
     public void Awake()
     {
         Db = Util.GetAircraftDefine(FlightPlanEditor.aircraftparameter.AircraftType, FlightPlanEditor.aircraftparameter.AircraftSubType, FlightPlanEditor.aircraftparameter.AircraftID);

+ 15 - 3
SimulationServer/Entity/AircraftLandSJ.cs

@@ -30,6 +30,10 @@ public class AircraftLandSJ : AircraftEntity
 
     int Days;
     int Hour;
+
+    public bool isEndWhile;
+
+    public int targetCount;
     public override void Reset()
     {
         base.Reset();
@@ -38,10 +42,15 @@ public class AircraftLandSJ : AircraftEntity
         Success = false;
         SearchTime = 0;
         TotalTime = 0;
+        isEndWhile = false;
+        resulttime = 0;
+        targetCount = 0;
     }
 
     public override void Start()
     {
+        targetCount = FlightPlanEditor.targetpoint[0].TargetType.Count;
+
         int Year = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[0]);
         int Month = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[0]);
         int Day = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[1].Split("日")[0]);
@@ -227,7 +236,8 @@ public class AircraftLandSJ : AircraftEntity
                     isseePerson = true;
                     this.isseePerson = true;
                     fireIndex = currentLocation.Currentsegnum; // 记录当前航路点位置
-                    IsOver = true;
+                    //IsOver = true;
+                    isEndWhile = true;
                     Success = true;
                     //resulttime = get_result_time_rope(30, FlightPlanEditor.targetpoint[0].TargetType.Count, windSpeed, visibility, 0.75, 1.38).time; //调运时间
                     //Console.WriteLine("resulttime:" + resulttime);
@@ -240,10 +250,11 @@ public class AircraftLandSJ : AircraftEntity
                 temptime += 10;
                 if (temptime >= taskContent.missionInformation.TaskEndConditions.TaskTime)
                 {
-                    IsOver = true;
+                    //IsOver = true;
+                    isEndWhile = true;
                     isseePerson = false;
                 }
-            } while (!isseePerson && IsOver == false);
+            } while (!isseePerson && isEndWhile == false);
 
             if (isseePerson)
             {
@@ -357,6 +368,7 @@ public class AircraftLandSJ : AircraftEntity
 
     public override void End()
     {
+        IsOver = true;
         for (int i = 0; i < TurningPoints.Count - 2; i++)
         {
             EffMisTime += TurningPoints[i].SegmentFlightTime;

+ 14 - 3
SimulationServer/Entity/AircraftSJ.cs

@@ -37,6 +37,10 @@ public class AircraftSJ : AircraftEntity
     int Days;
     int Hour;
 
+    public int targetCount;
+
+    public bool isEndWhile;
+
     public override void Reset()
     {
         base.Reset();
@@ -46,10 +50,14 @@ public class AircraftSJ : AircraftEntity
         SearchTime = 0;
         TotalTime = 0;
         resulttime = 0;
+        isEndWhile = false;
+        targetCount = 0;
     }
 
     public override void Start()
     {
+        targetCount = FlightPlanEditor.targetpoint[0].TargetType.Count;
+
         int Year = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[0]);
         int Month = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[0]);
         int Day = Convert.ToInt32(taskContent.missionInformation.StartDate.Split("年")[1].Split("月")[1].Split("日")[0]);
@@ -300,7 +308,8 @@ public class AircraftSJ : AircraftEntity
                     isseePerson = true;
                     this.isseePerson = true;
                     fireIndex = currentLocation.Currentsegnum; // 记录当前航路点位置
-                    IsOver = true;
+                    //IsOver = true;
+                    isEndWhile = true;
                 }
                 else
                 {
@@ -308,11 +317,12 @@ public class AircraftSJ : AircraftEntity
                 }
                 if (temptime >= taskContent.missionInformation.TaskEndConditions.TaskTime)
                 {
-                    IsOver = true;
+                    //IsOver = true;
+                    isEndWhile = true;
                     isseePerson = false;
                 }
                 temptime += 10;
-            } while (!isseePerson && IsOver == false);
+            } while (!isseePerson && isEndWhile == false); //IsOver == false
             if (isseePerson)
             {
 
@@ -415,6 +425,7 @@ public class AircraftSJ : AircraftEntity
 
     public override void End()
     {
+        IsOver = true;
         for (int i = 0; i < TurningPoints.Count - 2; i++)
         {
             EffMisTime += TurningPoints[i].SegmentFlightTime;

+ 3 - 2
SimulationServer/Entity/JJJYMission.cs

@@ -21,6 +21,8 @@ public class JJJYMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -148,8 +150,7 @@ public class JJJYMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/机降救援任务/{data}/{MissionId}"; //作为海上/陆上搜救子任务需生成实验报告,路径不确定,需判断跟随谁
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 5 - 2
SimulationServer/Entity/KTKSMission.cs

@@ -1,6 +1,7 @@
 using KYFramework;
 using NPOI.SS.Formula.PTG;
 using SimulationServer.Utils;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace SimulationServer;
 
@@ -21,6 +22,8 @@ public class KTKSMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -148,8 +151,8 @@ public class KTKSMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/空投空送任务/{data}/{MissionId}"; //作为海上/陆上搜救子任务需生成实验报告,路径不确定,需判断跟随谁
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 6 - 2
SimulationServer/Entity/KZDYMission.cs

@@ -1,6 +1,7 @@
 using KYFramework;
 using NPOI.SS.Formula.PTG;
 using SimulationServer.Utils;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace SimulationServer;
 
@@ -21,6 +22,9 @@ public class KZDYMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
+
     public void Start()
     {
         IsRunning = true;
@@ -148,8 +152,8 @@ public class KZDYMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/空中吊运救援任务/{data}/{MissionId}"; //作为海上/陆上搜救子任务需生成实验报告,路径不确定,需判断跟随谁
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 12 - 4
SimulationServer/Entity/LandSJRescueMission.cs

@@ -24,6 +24,8 @@ public class LandSJRescueMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -90,19 +92,25 @@ public class LandSJRescueMission : Entity
             }
             if (!aircraftSJDatas[key].ContainsKey("识别成功率"))
                 aircraftSJDatas[key]["识别成功率"] = new List<string>();
-            aircraftSJDatas[key]["识别成功率"].Add(aircraftEntity.isseePerson ? "1" : "0");
+            aircraftSJDatas[key]["识别成功率"].Add(aircraftEntity.isseePerson ? aircraftEntity.targetCount.ToString() : "0");
+            if (!aircraftSJDatas[key].ContainsKey("人员数量"))
+                aircraftSJDatas[key]["人员数量"] = new List<string>();
+            aircraftSJDatas[key]["人员数量"].Add(aircraftEntity.targetCount.ToString());
             if (!aircraftSJDatas[key].ContainsKey("任务准备时间"))
                 aircraftSJDatas[key]["任务准备时间"] = new List<string>();
             aircraftSJDatas[key]["任务准备时间"].Add(aircraftEntity.TaskReadyTime.ToString());
             if (!aircraftSJDatas[key].ContainsKey("平均搜索时间"))
                 aircraftSJDatas[key]["平均搜索时间"] = new List<string>();
             aircraftSJDatas[key]["平均搜索时间"].Add(aircraftEntity.SearchTime.ToString());
+            if (!aircraftSJDatas[key].ContainsKey("平均救助时间"))
+                aircraftSJDatas[key]["平均救助时间"] = new List<string>();
+            aircraftSJDatas[key]["平均救助时间"].Add(aircraftEntity.resulttime.ToString());
             if (!aircraftSJDatas[key].ContainsKey("总飞行时间"))
                 aircraftSJDatas[key]["总飞行时间"] = new List<string>();
             aircraftSJDatas[key]["总飞行时间"].Add(aircraftEntity.TotalTime.ToString());
             if (!aircraftSJDatas[key].ContainsKey("人员存活率"))
                 aircraftSJDatas[key]["人员存活率"] = new List<string>();
-            aircraftSJDatas[key]["人员存活率"].Add(aircraftEntity.Success ? "1" : "0");
+            aircraftSJDatas[key]["人员存活率"].Add(aircraftEntity.Success ? aircraftEntity.targetCount.ToString() : "0");
         }
     }
 
@@ -180,8 +188,8 @@ public class LandSJRescueMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/LSX/{data}/{MissionId}";
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 3 - 2
SimulationServer/Entity/SHJMission.cs

@@ -21,6 +21,8 @@ public class SHJMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -148,8 +150,7 @@ public class SHJMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/索滑降救援任务/{data}/{MissionId}"; //作为海上/陆上搜救子任务需生成实验报告,路径不确定,需判断跟随谁
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 12 - 4
SimulationServer/Entity/SeaSJRescueMission.cs

@@ -24,6 +24,8 @@ public class SeaSJRescueMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -90,19 +92,25 @@ public class SeaSJRescueMission : Entity
             }
             if (!aircraftSJDatas[key].ContainsKey("识别成功率"))
                 aircraftSJDatas[key]["识别成功率"] = new List<string>();
-            aircraftSJDatas[key]["识别成功率"].Add(aircraftEntity.isseePerson ? "1" : "0");
+            aircraftSJDatas[key]["识别成功率"].Add(aircraftEntity.isseePerson ? aircraftEntity.targetCount.ToString() : "0");
+            if (!aircraftSJDatas[key].ContainsKey("人员数量"))
+                aircraftSJDatas[key]["人员数量"] = new List<string>();
+            aircraftSJDatas[key]["人员数量"].Add(aircraftEntity.targetCount.ToString());
             if (!aircraftSJDatas[key].ContainsKey("任务准备时间"))
                 aircraftSJDatas[key]["任务准备时间"] = new List<string>();
             aircraftSJDatas[key]["任务准备时间"].Add(aircraftEntity.TaskReadyTime.ToString());
             if (!aircraftSJDatas[key].ContainsKey("平均搜索时间"))
                 aircraftSJDatas[key]["平均搜索时间"] = new List<string>();
             aircraftSJDatas[key]["平均搜索时间"].Add(aircraftEntity.SearchTime.ToString("f4"));
+            if (!aircraftSJDatas[key].ContainsKey("平均救助时间"))
+                aircraftSJDatas[key]["平均救助时间"] = new List<string>();
+            aircraftSJDatas[key]["平均救助时间"].Add(aircraftEntity.resulttime.ToString());
             if (!aircraftSJDatas[key].ContainsKey("总飞行时间"))
                 aircraftSJDatas[key]["总飞行时间"] = new List<string>();
             aircraftSJDatas[key]["总飞行时间"].Add(aircraftEntity.TotalTime.ToString("f4"));
             if (!aircraftSJDatas[key].ContainsKey("人员存活率"))
                 aircraftSJDatas[key]["人员存活率"] = new List<string>();
-            aircraftSJDatas[key]["人员存活率"].Add(aircraftEntity.Success ? "1" : "0");
+            aircraftSJDatas[key]["人员存活率"].Add(aircraftEntity.Success ? aircraftEntity.targetCount.ToString() : "0");
         }
     }
 
@@ -180,8 +188,8 @@ public class SeaSJRescueMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/SSJ/{data}/{MissionId}";
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 4 - 2
SimulationServer/Entity/ZSJYMission.cs

@@ -21,6 +21,8 @@ public class ZSJYMission : Entity
 
     private int currentExecuteCount = 1;
     public int ExecutionContext = 0;
+
+    public string date;
     public void Start()
     {
         IsRunning = true;
@@ -148,8 +150,8 @@ public class ZSJYMission : Entity
 
     public void ReportSJ()
     {
-        string data = DateTime.Now.ToString("yyyy-MM-dd");
-        string path = $"Reports/着水救援任务/{data}/{MissionId}"; //作为海上/陆上搜救子任务需生成实验报告,路径不确定,需判断跟随谁
+        //string data = DateTime.Now.ToString("yyyy-MM-dd");
+        string path = $"Reports/{date}/{MissionId}";
         if (!Directory.Exists(path)) Directory.CreateDirectory(path);
         foreach (var kv in singleReport)
         {

+ 7 - 7
SimulationServer/EventHandler/CreateTaskEventHandler.cs

@@ -266,8 +266,8 @@ public class CreateSeaSJEventHandler : AEvent<CreateSeaSJTask>
     protected override UniTask Run(CreateSeaSJTask config)
     {
         var taskSys = Game.Scene.GetComponent<TaskComponent>();
-        taskSys.isSea = true;
         SeaSJRescueMission mission = ComponentFactory.Create<SeaSJRescueMission>();
+        mission.date = taskSys.date;
         taskSys.SeaSJRescueMissions.Add(mission);
         mission.MissionId = $"海上搜索救援任务 {config.SeaSJTask.missionInformation.MissionName}";
         mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -316,10 +316,8 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
     protected override UniTask Run(CreateLandSXTask config)
     {
         var taskSys = Game.Scene.GetComponent<TaskComponent>();
-        if (taskSys.isSea)
-            return UniTask.CompletedTask; ;
-        taskSys.isLand = true;
         LandSJRescueMission mission = ComponentFactory.Create<LandSJRescueMission>();
+        mission.date = taskSys.date;
         taskSys.LandSJRescueMissions.Add(mission);
         mission.MissionId = $"陆上搜寻救援任务 {config.LandSXTask.missionInformation.MissionName}";
         mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -374,6 +372,7 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
         {
             var taskSys = Game.Scene.GetComponent<TaskComponent>();
             KZDYMission mission = ComponentFactory.Create<KZDYMission>();
+            mission.date = taskSys.date;
             taskSys.KZDYMissions.Add(mission);
             mission.MissionId = $"空中吊运救援任务 {config.KZDYTask.missionInformation.MissionName}";
             mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -403,9 +402,6 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
                     MissionEndPointHeight = targetPoint.TargetPointHeight
                 };
 
-                aircraft.isSea = taskSys.isSea;
-                aircraft.isLand = taskSys.isLand;
-
                 foreach (var item in config.KZDYTask.KZDYParameters)
                 {
                     if (item.AircraftId == aircraft.AircraftId)
@@ -429,6 +425,7 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
         {
             var taskSys = Game.Scene.GetComponent<TaskComponent>();
             KTKSMission mission = ComponentFactory.Create<KTKSMission>();
+            mission.date = taskSys.date;
             taskSys.KTKSMissions.Add(mission);
             mission.MissionId = $"空投空送任务 {config.KTKSTask.missionInformation.MissionName}";
             mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -482,6 +479,7 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
         {
             var taskSys = Game.Scene.GetComponent<TaskComponent>();
             ZSJYMission mission = ComponentFactory.Create<ZSJYMission>();
+            mission.date = taskSys.date;
             taskSys.ZSJYMissions.Add(mission);
             mission.MissionId = $"着水救援任务 {config.ZSJYTask.missionInformation.MissionName}";
             mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -534,6 +532,7 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
         {
             var taskSys = Game.Scene.GetComponent<TaskComponent>();
             JJJYMission mission = ComponentFactory.Create<JJJYMission>();
+            mission.date = taskSys.date;
             taskSys.JJJYMissions.Add(mission);
             mission.MissionId = $"机降救援任务 {config.JJJYTask.missionInformation.MissionName}";
             mission.ExecutionContext = config.EditorConfig.runCounts;
@@ -588,6 +587,7 @@ public class CreateLandSJEventHandler : AEvent<CreateLandSXTask>
         {
             var taskSys = Game.Scene.GetComponent<TaskComponent>();
             SHJMission mission = ComponentFactory.Create<SHJMission>();
+            mission.date = taskSys.date;
             taskSys.SHJMissions.Add(mission);
             mission.MissionId = $"索滑降救援任务 {config.SHJTask.missionInformation.MissionName}";
             mission.ExecutionContext = config.EditorConfig.runCounts;

+ 39 - 21
SimulationServer/EventHandler/ServerStartEventHandler.cs

@@ -5,6 +5,7 @@ using Newtonsoft.Json;
 using SimulationServer.Utils;
 using SimulationSingleServer.Utils;
 using static Org.BouncyCastle.Math.EC.ECCurve;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 using Define = SimulationServer.Utils.Define;
 
 namespace SimulationServer;
@@ -16,6 +17,8 @@ public class ServerStartEventHandler : AEvent<ServerStart>
     {
         Log.Info("读取配置文件!");
         var taskSys = Game.Scene.GetComponent<TaskComponent>();
+        taskSys.date = DateTime.Now.ToString().Replace("/","-").Replace(":","-").Replace(" ","-");
+        //Console.WriteLine("date:" + taskSys.date);
         HttpInterface.serverIp = File.ReadAllText("dbIp.txt");
         SimulationCommon.Util.serverIp = HttpInterface.serverIp;
         // 读取任务配置文件
@@ -33,7 +36,6 @@ public class ServerStartEventHandler : AEvent<ServerStart>
             Log.Error("task_config.json文件不存在!");
             return UniTask.CompletedTask;
         }
-
         string ec_str = File.ReadAllText("Missions/editor_config.json");
         string tc_str = File.ReadAllText("Missions/task_config.json");
         //Console.WriteLine(ec_str);
@@ -67,6 +69,22 @@ public class ServerStartEventHandler : AEvent<ServerStart>
             Log.Error("配置文件解析失败!");
             return UniTask.CompletedTask;
         }
+
+
+        foreach (var item in editorConfig.targetPoints)
+        {
+            if (item.TargetType.Type == "遇险人员" || item.TargetType.Type == "车辆" || item.TargetType.Type == "航空器")
+            {
+                taskSys.isLand = true;
+            }
+            else if (item.TargetType.Type == "落水人员" || item.TargetType.Type == "救生筏" || item.TargetType.Type == "船舶" || item.TargetType.Type == "大规模落水人群")
+            {
+                taskSys.isSea = true;
+            }
+            //Console.WriteLine("taskSys.isLand:" + taskSys.isLand + "_" + "taskSys.isSea:" + taskSys.isSea);
+            break;
+        }
+
         //Weather weather = Util.GetWeather("内蒙古", "根河", DateTime.Now.ToString("2024-05-10"));
         TaskComponent.Weather = new Weather();
         var temp = TaskComponent.Weather.day_temp.Replace("°C", "");
@@ -97,18 +115,18 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         //}
         //Console.WriteLine("taskConfig.seaSouJiuTasks.Count:" + taskConfig.seaSouJiuTasks.Count);
         //创建搜救
-        //foreach (var seaSJTask in taskConfig.seaSouJiuTasks)
-        //{
-        //    //Console.WriteLine("seaSJTask.missionInformation.MissionName:" + seaSJTask.missionInformation.MissionName);
-        //    //Console.WriteLine("TargetPointId:" + seaSJTask.TargetPointId);
-        //    //Console.WriteLine("SearchPayload:" + seaSJTask.SearchPayload);
-        //    //Console.WriteLine("SearchMode:" + seaSJTask.SearchMode);
-        //    //Console.WriteLine("RadarTransmitterPower:" + seaSJTask.RadarTransmitterPower);
-        //    //Console.WriteLine("仿真次数:" + editorConfig.runCounts);
-        //    Game.EventSystem.Publish(new CreateSeaSJTask
-        //    { EditorConfig = editorConfig, SeaSJTask = seaSJTask });
-        //    //break;
-        //}
+        foreach (var seaSJTask in taskConfig.seaSouJiuTasks)
+        {
+            //Console.WriteLine("seaSJTask.missionInformation.MissionName:" + seaSJTask.missionInformation.MissionName);
+            //Console.WriteLine("TargetPointId:" + seaSJTask.TargetPointId);
+            //Console.WriteLine("SearchPayload:" + seaSJTask.SearchPayload);
+            //Console.WriteLine("SearchMode:" + seaSJTask.SearchMode);
+            //Console.WriteLine("RadarTransmitterPower:" + seaSJTask.RadarTransmitterPower);
+            //Console.WriteLine("仿真次数:" + editorConfig.runCounts);
+            Game.EventSystem.Publish(new CreateSeaSJTask
+            { EditorConfig = editorConfig, SeaSJTask = seaSJTask });
+            //break;
+        }
 
         //foreach (var landSXTask in taskConfig.LandSouXunTasks)
         //{
@@ -117,13 +135,13 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         //    //break;
         //}
 
-        //创建空中吊运救援任务
-        foreach (var KZDYTask in taskConfig.KZDYTasks)
-        {
-            Game.EventSystem.Publish(new CreateKZDYTask
-            { EditorConfig = editorConfig, KZDYTask = KZDYTask });
-            //break;
-        }
+        ////创建空中吊运救援任务
+        //foreach (var KZDYTask in taskConfig.KZDYTasks)
+        //{
+        //    Game.EventSystem.Publish(new CreateKZDYTask
+        //    { EditorConfig = editorConfig, KZDYTask = KZDYTask });
+        //    //break;
+        //}
 
         ////创建空投空送任务
         //foreach (var KTKSTask in taskConfig.KTKSTasks)
@@ -154,7 +172,7 @@ public class ServerStartEventHandler : AEvent<ServerStart>
         //{
         //    Game.EventSystem.Publish(new CreateSHJTask
         //    { EditorConfig = editorConfig, SHJTask = SHJTask });
-        //    break;
+        //    //break;
         //}
 
         taskSys.ExecutionContext = editorConfig.runCounts;

+ 37 - 22
SimulationServer/Utils/DataTableExtensions.cs

@@ -68,26 +68,26 @@ public static class DataTableExtensions
         return entities;
     }
 
-    public static void SaveToExcel(string path , Dictionary<string, Dictionary<string,List<string>>> report,bool withA = false)
+    public static void SaveToExcel(string path, Dictionary<string, Dictionary<string, List<string>>> report, bool withA = false, bool zt = false, string s = "")
     {
-        if(!File.Exists(path)) File.Create(path).Close();
+        if (!File.Exists(path)) File.Create(path).Close();
         // 创建一个新的Excel文件
         var workbook = new HSSFWorkbook();
 
-        foreach (KeyValuePair<string,Dictionary<string,List<string>>> kv in report)
+        foreach (KeyValuePair<string, Dictionary<string, List<string>>> kv in report)
         {
             // 创建一个新的工作表
             var sheet = workbook.CreateSheet(kv.Key);
-            
+
             // 创建标题行
             var headerRow = sheet.CreateRow(0);
-            
+
             var headerCell = headerRow.CreateCell(0);
             headerCell.SetCellValue("指标名");
-            
+
             // 遍历字典,将数据写入Excel
             int rowIndex = 1;
-            foreach (KeyValuePair<string,List<string>> kv1 in kv.Value)
+            foreach (KeyValuePair<string, List<string>> kv1 in kv.Value)
             {
                 var row = sheet.CreateRow(rowIndex);
                 row.CreateCell(0).SetCellValue(kv1.Key);
@@ -96,7 +96,7 @@ public static class DataTableExtensions
                     for (int i = 0; i < kv1.Value.Count - 1; i++)
                     {
                         var headerCell1 = headerRow.CreateCell(i + 1);
-                        headerCell1.SetCellValue($"数值{i+1}");
+                        headerCell1.SetCellValue($"仿真轮次{i + 1}");
                         row.CreateCell(i + 1).SetCellValue(kv1.Value[i]);
                     }
                     var headerCell1End = headerRow.CreateCell(kv1.Value.Count);
@@ -108,45 +108,60 @@ public static class DataTableExtensions
                     for (int i = 0; i < kv1.Value.Count; i++)
                     {
                         var headerCell1 = headerRow.CreateCell(i + 1);
-                        headerCell1.SetCellValue($"数值{i+1}");
+                        headerCell1.SetCellValue($"仿真轮次{i + 1}");
                         row.CreateCell(i + 1).SetCellValue(kv1.Value[i]);
                     }
                 }
-               
+
                 rowIndex++;
             }
         }
 
+        if (zt)
+        {
+            var sheet = workbook.CreateSheet("任务成功率");
+            var Row0 = sheet.CreateRow(0);
+            var Row0Cell0 = Row0.CreateCell(0);
+            Row0Cell0.SetCellValue("指标名");
+            var Row0Cell1 = Row0.CreateCell(1);
+            Row0Cell1.SetCellValue("数值");
+            var Row1 = sheet.CreateRow(1);
+            var Row1Cell0 = Row1.CreateCell(0);
+            Row1Cell0.SetCellValue("任务成功率");
+            var Row1Cell1 = Row1.CreateCell(1);
+            Row1Cell1.SetCellValue(s);
+        }
+
         // 保存Excel文件
         using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write))
         {
             workbook.Write(fs);
         }
     }
-    public static void SaveToExcel(string path , Dictionary<string, Dictionary<string,string>> report)
+    public static void SaveToExcel(string path, Dictionary<string, Dictionary<string, string>> report)
     {
-        
+
         // 创建一个新的Excel文件
         var workbook = new HSSFWorkbook();
 
-        foreach (KeyValuePair<string,Dictionary<string,string>> kv in report)
+        foreach (KeyValuePair<string, Dictionary<string, string>> kv in report)
         {
             // 创建一个新的工作表
             var sheet = workbook.CreateSheet(kv.Key);
-            
+
             // 创建标题行
             var headerRow = sheet.CreateRow(0);
             var headerCell = headerRow.CreateCell(0);
-            
+
             var headerRow1 = sheet.CreateRow(1);
             var headerCell1 = headerRow1.CreateCell(1);
-            
+
             headerCell.SetCellValue("指标名");
-            headerCell1.SetCellValue("数值");
-            
+            headerCell1.SetCellValue("仿真轮次");
+
             // 遍历字典,将数据写入Excel
             int rowIndex = 1;
-            foreach (KeyValuePair<string,string> kv1 in kv.Value)
+            foreach (KeyValuePair<string, string> kv1 in kv.Value)
             {
                 var row = sheet.CreateRow(rowIndex);
                 row.CreateCell(0).SetCellValue(kv1.Key);
@@ -160,8 +175,8 @@ public static class DataTableExtensions
         {
             workbook.Write(fs);
         }
-        
-        
-        
+
+
+
     }
 }

BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationCommon.pdb


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.exe


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.pdb