TaskComponent.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. using KYFramework;
  2. using Model;
  3. using OpenQA.Selenium.Remote;
  4. using SimulationCommon;
  5. using SimulationServer.Utils;
  6. namespace SimulationServer;
  7. public class TaskComponent : Component
  8. {
  9. public static Weather Weather;
  10. public static int Speed = 100;
  11. // 救援任务列表
  12. public List<MHRescueMission> MHRescueMissions;
  13. public List<XHRescueMission> XHRescueMissions;
  14. public List<ZCRescueMission> ZCRescueMissions;
  15. public List<SeaSJRescueMission> SeaSJRescueMissions;
  16. public List<LandSJRescueMission> LandSJRescueMissions;
  17. public List<KZDYMission> KZDYMissions;
  18. public List<KTKSMission> KTKSMissions;
  19. public List<ZSJYMission> ZSJYMissions;
  20. public List<JJJYMission> JJJYMissions;
  21. public List<SHJMission> SHJMissions;
  22. public List<XCJJMission> XCJJMissions;
  23. public List<YLZYMission> YLZYMissions;
  24. public List<YLWPYSMission> YLWPYSMissions;
  25. public List<JCDZZYMission> JCDZZYMissions;
  26. public SJAllTotalTaskPerformanceComponent SSJAllTotalTaskPerformance = new SJAllTotalTaskPerformanceComponent();
  27. public Dictionary<string, Dictionary<string, List<string>>> alltotalReportSea = new();
  28. public Dictionary<string, Dictionary<string, List<string>>> alltotalReportLand = new();
  29. // <sheet,<指标名,值列表>>
  30. public Dictionary<string, Dictionary<string, List<string>>> totalReportSea = new();
  31. public Dictionary<string, Dictionary<string, List<string>>> totalReportLand = new();
  32. private int currentSeaExecuteCount = 1;
  33. private int currentLandExecuteCount = 1;
  34. public int ExecutionContext = 0;
  35. public int seaSuccessCount = 0;
  36. public int landSuccessCount = 0;
  37. public bool isSea;
  38. public bool isLand;
  39. public string date;
  40. public int missionCount;
  41. public void Start()
  42. {
  43. MHRescueMissions?.ForEach(r => r.Reset());
  44. XHRescueMissions?.ForEach(r => r.Reset());
  45. MHRescueMissions?.ForEach(r => r.Start());
  46. XHRescueMissions?.ForEach(r => r.Start());
  47. ZCRescueMissions?.ForEach(r => r.Start());
  48. SeaSJRescueMissions?.ForEach(r => r.Start());
  49. LandSJRescueMissions?.ForEach(r => r.Start());
  50. KZDYMissions?.ForEach(r => r.Start());
  51. KTKSMissions?.ForEach(r => r.Start());
  52. ZSJYMissions?.ForEach(r => r.Start());
  53. JJJYMissions?.ForEach(r => r.Start());
  54. SHJMissions?.ForEach(r => r.Start());
  55. XCJJMissions?.ForEach(r => r.Start());
  56. YLZYMissions?.ForEach(r => r.Start());
  57. YLWPYSMissions?.ForEach(r => r.Start());
  58. JCDZZYMissions?.ForEach(r => r.Start());
  59. }
  60. public void SaveSeaSJ(Dictionary<string, Dictionary<string, string>> totalReport)
  61. {
  62. //把totalReport保存到alltotalReport
  63. foreach (var kv in totalReport)
  64. {
  65. if (!alltotalReportSea.ContainsKey(kv.Key)) alltotalReportSea[kv.Key] = new Dictionary<string, List<string>>();
  66. foreach (var kv2 in kv.Value)
  67. {
  68. if (!alltotalReportSea[kv.Key].ContainsKey(kv2.Key)) alltotalReportSea[kv.Key][kv2.Key] = new List<string>();
  69. alltotalReportSea[kv.Key][kv2.Key].Add(kv2.Value);
  70. }
  71. }
  72. if (currentSeaExecuteCount == ExecutionContext)
  73. {
  74. // 求一个平均值放到最后一位
  75. foreach (var kv in alltotalReportSea)
  76. {
  77. foreach (var kv2 in kv.Value)
  78. {
  79. var sum = 0f;
  80. foreach (var value in kv2.Value)
  81. {
  82. bool isfloat = float.TryParse(value, out float f);
  83. if (isfloat)
  84. sum += float.Parse(value);
  85. else
  86. sum = -1f;
  87. }
  88. if (sum != -1f)
  89. kv2.Value.Add((sum / kv2.Value.Count).ToString());
  90. else
  91. kv2.Value.Add("");
  92. }
  93. }
  94. }
  95. currentSeaExecuteCount++;
  96. }
  97. public void SaveLandSJ(Dictionary<string, Dictionary<string, string>> totalReport)
  98. {
  99. //把totalReport保存到alltotalReport
  100. foreach (var kv in totalReport)
  101. {
  102. if (!alltotalReportLand.ContainsKey(kv.Key)) alltotalReportLand[kv.Key] = new Dictionary<string, List<string>>();
  103. foreach (var kv2 in kv.Value)
  104. {
  105. if (!alltotalReportLand[kv.Key].ContainsKey(kv2.Key)) alltotalReportLand[kv.Key][kv2.Key] = new List<string>();
  106. alltotalReportLand[kv.Key][kv2.Key].Add(kv2.Value);
  107. }
  108. }
  109. if (currentLandExecuteCount == ExecutionContext)
  110. {
  111. // 求一个平均值放到最后一位
  112. foreach (var kv in alltotalReportLand)
  113. {
  114. foreach (var kv2 in kv.Value)
  115. {
  116. var sum = 0f;
  117. foreach (var value in kv2.Value)
  118. {
  119. bool isfloat = float.TryParse(value, out float f);
  120. if (isfloat)
  121. sum += float.Parse(value);
  122. else
  123. sum = -1f;
  124. }
  125. if (sum != -1f)
  126. kv2.Value.Add((sum / kv2.Value.Count).ToString());
  127. else
  128. kv2.Value.Add("");
  129. }
  130. }
  131. }
  132. currentLandExecuteCount++;
  133. }
  134. public void ReportAllSJSea()
  135. {
  136. //string data = DateTime.Now.ToString("yyyy-MM-dd");
  137. string path = $"Reports/{date}";
  138. if (!Directory.Exists(path)) Directory.CreateDirectory(path);
  139. string totalPath = "";
  140. if (isSea)
  141. totalPath = $"{path}/{"海上搜救任务总体指标报告"}.xls";
  142. if (isLand)
  143. totalPath = $"{path}/{"陆上搜救任务总体指标报告"}.xls";
  144. DataTableExtensions.SaveToExcel(totalPath, alltotalReportSea, true, true, (seaSuccessCount * 1f / ExecutionContext).ToString());
  145. //string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
  146. //DataTableExtensions.SaveToExcel(totalPath1, totalReportSea);
  147. }
  148. public void ReportAllSJLand()
  149. {
  150. string data = DateTime.Now.ToString("yyyy-MM-dd");
  151. string path = $"Reports/{date}";
  152. if (!Directory.Exists(path)) Directory.CreateDirectory(path);
  153. string totalPath = $"{path}/{"陆上搜寻任务总体指标报告"}.xls";
  154. DataTableExtensions.SaveToExcel(totalPath, alltotalReportLand, true, true, (landSuccessCount * 1f / ExecutionContext).ToString());
  155. //string totalPath1 = $"{path}/{"搜救任务总体指标报告"}.xls";
  156. //DataTableExtensions.SaveToExcel(totalPath1, totalReportLand);
  157. }
  158. public void SaveTotalMHSea()
  159. {
  160. if (!totalReportSea.ContainsKey("总任务表现")) totalReportSea["总任务表现"] = new Dictionary<string, List<string>>();
  161. if (!totalReportSea["总任务表现"].ContainsKey("任务成功率")) totalReportSea["总任务表现"]["任务成功率"] = new List<string>();
  162. totalReportSea["总任务表现"]["任务成功率"].Add((seaSuccessCount * 1f / ExecutionContext).ToString());
  163. }
  164. public void SaveTotalMHLand()
  165. {
  166. if (!totalReportLand.ContainsKey("总任务表现")) totalReportLand["总任务表现"] = new Dictionary<string, List<string>>();
  167. if (!totalReportLand["总任务表现"].ContainsKey("任务成功率")) totalReportLand["总任务表现"]["任务成功率"] = new List<string>();
  168. totalReportLand["总任务表现"]["任务成功率"].Add((landSuccessCount * 1f / ExecutionContext).ToString());
  169. }
  170. }
  171. [ObjectSystem]
  172. public class TaskComponentAwakeSystem : AwakeSystem<TaskComponent>
  173. {
  174. public override void Awake(TaskComponent self)
  175. {
  176. self.MHRescueMissions = new List<MHRescueMission>();
  177. self.ZCRescueMissions = new List<ZCRescueMission>();
  178. self.XHRescueMissions = new List<XHRescueMission>();
  179. self.SeaSJRescueMissions = new List<SeaSJRescueMission>();
  180. self.LandSJRescueMissions = new List<LandSJRescueMission>();
  181. self.KZDYMissions = new List<KZDYMission>();
  182. self.KTKSMissions = new List<KTKSMission>();
  183. self.ZSJYMissions = new List<ZSJYMission>();
  184. self.JJJYMissions = new List<JJJYMission>();
  185. self.SHJMissions = new List<SHJMission>();
  186. self.XCJJMissions = new List<XCJJMission>();
  187. self.YLZYMissions = new List<YLZYMission>();
  188. self.YLWPYSMissions = new List<YLWPYSMission>();
  189. self.JCDZZYMissions = new List<JCDZZYMission>();
  190. }
  191. }
  192. [ObjectSystem]
  193. public class TaskComponentUpdateSystem : UpdateSystem<TaskComponent>
  194. {
  195. double 任务准备时间 = 0;
  196. double 平均搜索时间 = 0;
  197. double 总飞行时间 = 0;
  198. double 人员存活率 = 0;
  199. double 任务是否成功 = 0;
  200. float 识别成功率 = 0f;
  201. double 平均救助时间 = 0;
  202. float 人员数量 = 0;
  203. float 识别数量 = 0;
  204. double 环境搜索覆盖面积 = 0;
  205. double 海上搜索覆盖面积 = 0;
  206. double aircreftCount = 0;
  207. double searchCount = 0;
  208. double jzCount = 0;
  209. public bool isSeaSJRescueMissionsOver = false;
  210. public bool isLandSJRescueMissionsOver = false;
  211. public bool isKZDYMissionsOver = false;
  212. public bool isKTKSMissionsOver = false;
  213. public bool isZSJYMissionsOver = false;
  214. public bool isJJJYMissionsOver = false;
  215. public bool isSHJMissionsOver = false;
  216. public bool isXCJJMissionsOver = false;
  217. public bool isYLZYMissionsOver = false;
  218. public bool isYLWPYSMissionsOver = false;
  219. public bool isJCDZZYMissionsOver = false;
  220. public bool isReport;
  221. public override void Update(TaskComponent self)
  222. {
  223. if (self.SeaSJRescueMissions.Count > 0)
  224. {
  225. if (self.SeaSJRescueMissions.All(m => m.IsOver) && !isSeaSJRescueMissionsOver)
  226. {
  227. self.missionCount -= self.SeaSJRescueMissions.Count;
  228. isSeaSJRescueMissionsOver = true;
  229. //for (int i = 0; i < self.ExecutionContext; i++)
  230. //{
  231. // self.SSJAllTotalTaskPerformance.FillData(self.SeaSJRescueMissions);
  232. // var report = self.SSJAllTotalTaskPerformance.GetReport();
  233. // if (report["总任务表现"]["任务是否成功"] == "1")
  234. // self.seaSuccessCount++;
  235. // self.SaveSeaSJ(report);
  236. //}
  237. ////self.SaveTotalMHSea();
  238. //self.ReportAllSJSea();
  239. //self.SeaSJRescueMissions.Clear();
  240. }
  241. }
  242. if (self.LandSJRescueMissions.Count > 0)
  243. {
  244. if (self.LandSJRescueMissions.All(m => m.IsOver) && !isLandSJRescueMissionsOver)
  245. {
  246. self.missionCount -= self.LandSJRescueMissions.Count;
  247. isLandSJRescueMissionsOver = true;
  248. //for (int i = 0; i < self.ExecutionContext; i++)
  249. //{
  250. // self.SSJAllTotalTaskPerformance.FillData1(self.LandSJRescueMissions);
  251. // var report = self.SSJAllTotalTaskPerformance.GetReport1();
  252. // if (report["总任务表现"]["任务是否成功"] == "1")
  253. // self.landSuccessCount++;
  254. // self.SaveLandSJ(report);
  255. //}
  256. ////self.SaveTotalMHLand();
  257. //self.ReportAllSJLand();
  258. //self.LandSJRescueMissions.Clear();
  259. }
  260. }
  261. if (self.KZDYMissions.Count > 0)
  262. {
  263. if (self.KZDYMissions.All(m => m.IsOver) && !isKZDYMissionsOver)
  264. {
  265. self.missionCount -= self.KZDYMissions.Count;
  266. isKZDYMissionsOver = true;
  267. }
  268. }
  269. if (self.KTKSMissions.Count > 0)
  270. {
  271. if (self.KTKSMissions.All(m => m.IsOver) && !isKTKSMissionsOver)
  272. {
  273. self.missionCount -= self.KTKSMissions.Count;
  274. isKTKSMissionsOver = true;
  275. }
  276. }
  277. if (self.ZSJYMissions.Count > 0)
  278. {
  279. if (self.ZSJYMissions.All(m => m.IsOver) && !isZSJYMissionsOver)
  280. {
  281. self.missionCount -= self.ZSJYMissions.Count;
  282. isZSJYMissionsOver = true;
  283. }
  284. }
  285. if (self.JJJYMissions.Count > 0)
  286. {
  287. if (self.JJJYMissions.All(m => m.IsOver) && !isJJJYMissionsOver)
  288. {
  289. self.missionCount -= self.JJJYMissions.Count;
  290. isJJJYMissionsOver = true;
  291. }
  292. }
  293. if (self.SHJMissions.Count > 0)
  294. {
  295. if (self.SHJMissions.All(m => m.IsOver) && !isSHJMissionsOver)
  296. {
  297. self.missionCount -= self.SHJMissions.Count;
  298. isSHJMissionsOver = true;
  299. }
  300. }
  301. if (self.XCJJMissions.Count > 0)
  302. {
  303. if (self.XCJJMissions.All(m => m.IsOver) && !isXCJJMissionsOver)
  304. {
  305. self.missionCount -= self.XCJJMissions.Count;
  306. isXCJJMissionsOver = true;
  307. }
  308. }
  309. if (self.YLZYMissions.Count > 0)
  310. {
  311. if (self.YLZYMissions.All(m => m.IsOver) && !isYLZYMissionsOver)
  312. {
  313. self.missionCount -= self.YLZYMissions.Count;
  314. isYLZYMissionsOver = true;
  315. }
  316. }
  317. if (self.YLWPYSMissions.Count > 0)
  318. {
  319. if (self.YLWPYSMissions.All(m => m.IsOver) && !isYLWPYSMissionsOver)
  320. {
  321. self.missionCount -= self.YLWPYSMissions.Count;
  322. isYLWPYSMissionsOver = true;
  323. }
  324. }
  325. if (self.JCDZZYMissions.Count > 0)
  326. {
  327. if (self.JCDZZYMissions.All(m => m.IsOver) && !isJCDZZYMissionsOver)
  328. {
  329. self.missionCount -= self.JCDZZYMissions.Count;
  330. isJCDZZYMissionsOver = true;
  331. }
  332. }
  333. //Console.WriteLine("self.missionCount:" + self.missionCount);
  334. if (self.missionCount == 0 && !isReport)
  335. {
  336. for (int i = 0; i < self.ExecutionContext; i++)
  337. {
  338. 任务准备时间 = 0;
  339. 平均搜索时间 = 0;
  340. 总飞行时间 = 0;
  341. 人员存活率 = 0;
  342. 任务是否成功 = 0;
  343. 识别成功率 = 0f;
  344. 平均救助时间 = 0;
  345. 人员数量 = 0;
  346. 识别数量 = 0;
  347. 环境搜索覆盖面积 = 0;
  348. 海上搜索覆盖面积 = 0;
  349. aircreftCount = 0;
  350. searchCount = 0;
  351. jzCount = 0;
  352. foreach (var item in self.SeaSJRescueMissions)
  353. {
  354. foreach (var item1 in item.aircraftSJDatas)
  355. {
  356. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  357. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  358. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  359. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  360. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  361. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  362. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  363. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  364. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  365. 海上搜索覆盖面积 += float.Parse(item1.Value["海上搜索覆盖面积"][i]);
  366. aircreftCount++;
  367. if (item1.Value["平均搜索时间"][i] != "0")
  368. searchCount++;
  369. if (item1.Value["平均救助时间"][i] != "0")
  370. jzCount++;
  371. Console.WriteLine("海上搜救" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  372. Console.WriteLine("海上搜救" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  373. Console.WriteLine("海上搜救" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  374. Console.WriteLine("海上搜救" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  375. Console.WriteLine("海上搜救" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  376. Console.WriteLine("海上搜救" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  377. Console.WriteLine("海上搜救" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  378. Console.WriteLine("海上搜救" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  379. Console.WriteLine("海上搜救" + item1.Key + "海上搜索覆盖面积:" + item1.Value["海上搜索覆盖面积"][i]);
  380. Console.WriteLine("===============================================================");
  381. }
  382. }
  383. foreach (var item in self.LandSJRescueMissions)
  384. {
  385. foreach (var item1 in item.aircraftSJDatas)
  386. {
  387. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  388. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  389. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  390. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  391. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  392. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  393. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  394. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  395. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  396. 环境搜索覆盖面积 += float.Parse(item1.Value["环境搜索覆盖面积"][i]);
  397. aircreftCount++;
  398. if (item1.Value["平均搜索时间"][i] != "0")
  399. searchCount++;
  400. if (item1.Value["平均救助时间"][i] != "0")
  401. jzCount++;
  402. Console.WriteLine("路上搜寻" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  403. Console.WriteLine("路上搜寻" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  404. Console.WriteLine("路上搜寻" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  405. Console.WriteLine("路上搜寻" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  406. Console.WriteLine("路上搜寻" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  407. Console.WriteLine("路上搜寻" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  408. Console.WriteLine("路上搜寻" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  409. Console.WriteLine("路上搜寻" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  410. Console.WriteLine("路上搜寻" + item1.Key + "环境搜索覆盖面积:" + item1.Value["环境搜索覆盖面积"][i]);
  411. Console.WriteLine("===============================================================");
  412. }
  413. }
  414. foreach (var item in self.KZDYMissions)
  415. {
  416. foreach (var item1 in item.aircraftSJDatas)
  417. {
  418. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  419. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  420. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  421. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  422. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  423. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  424. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  425. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  426. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  427. aircreftCount++;
  428. if (item1.Value["平均搜索时间"][i] != "0")
  429. searchCount++;
  430. if (item1.Value["平均救助时间"][i] != "0")
  431. jzCount++;
  432. Console.WriteLine("空中吊运" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  433. Console.WriteLine("空中吊运" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  434. Console.WriteLine("空中吊运" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  435. Console.WriteLine("空中吊运" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  436. Console.WriteLine("空中吊运" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  437. Console.WriteLine("空中吊运" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  438. Console.WriteLine("空中吊运" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  439. Console.WriteLine("空中吊运" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  440. Console.WriteLine("===============================================================");
  441. }
  442. }
  443. foreach (var item in self.KTKSMissions)
  444. {
  445. foreach (var item1 in item.aircraftSJDatas)
  446. {
  447. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  448. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  449. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  450. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  451. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  452. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  453. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  454. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  455. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  456. aircreftCount++;
  457. if (item1.Value["平均搜索时间"][i] != "0")
  458. searchCount++;
  459. if (item1.Value["平均救助时间"][i] != "0")
  460. jzCount++;
  461. Console.WriteLine("空投空送" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  462. Console.WriteLine("空投空送" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  463. Console.WriteLine("空投空送" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  464. Console.WriteLine("空投空送" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  465. Console.WriteLine("空投空送" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  466. Console.WriteLine("空投空送" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  467. Console.WriteLine("空投空送" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  468. Console.WriteLine("空投空送" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  469. Console.WriteLine("===============================================================");
  470. }
  471. }
  472. foreach (var item in self.ZSJYMissions)
  473. {
  474. foreach (var item1 in item.aircraftSJDatas)
  475. {
  476. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  477. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  478. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  479. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  480. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  481. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  482. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  483. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  484. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  485. aircreftCount++;
  486. if (item1.Value["平均搜索时间"][i] != "0")
  487. searchCount++;
  488. if (item1.Value["平均救助时间"][i] != "0")
  489. jzCount++;
  490. Console.WriteLine("着水救援" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  491. Console.WriteLine("着水救援" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  492. Console.WriteLine("着水救援" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  493. Console.WriteLine("着水救援" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  494. Console.WriteLine("着水救援" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  495. Console.WriteLine("着水救援" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  496. Console.WriteLine("着水救援" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  497. Console.WriteLine("着水救援" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  498. Console.WriteLine("===============================================================");
  499. }
  500. }
  501. foreach (var item in self.JJJYMissions)
  502. {
  503. foreach (var item1 in item.aircraftSJDatas)
  504. {
  505. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  506. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  507. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  508. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  509. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  510. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  511. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  512. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  513. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  514. aircreftCount++;
  515. if (item1.Value["平均搜索时间"][i] != "0")
  516. searchCount++;
  517. if (item1.Value["平均救助时间"][i] != "0")
  518. jzCount++;
  519. Console.WriteLine("机降救援" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  520. Console.WriteLine("机降救援" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  521. Console.WriteLine("机降救援" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  522. Console.WriteLine("机降救援" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  523. Console.WriteLine("机降救援" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  524. Console.WriteLine("机降救援" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  525. Console.WriteLine("机降救援" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  526. Console.WriteLine("机降救援" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  527. Console.WriteLine("===============================================================");
  528. }
  529. }
  530. foreach (var item in self.SHJMissions)
  531. {
  532. foreach (var item1 in item.aircraftSJDatas)
  533. {
  534. 识别成功率 += float.Parse(item1.Value["识别成功率"][i]);
  535. 人员数量 += float.Parse(item1.Value["人员数量"][i]);
  536. 识别数量 += float.Parse(item1.Value["识别数量"][i]);
  537. if (任务准备时间 < float.Parse(item1.Value["任务准备时间"][i]))
  538. 任务准备时间 = float.Parse(item1.Value["任务准备时间"][i]);
  539. 平均搜索时间 += float.Parse(item1.Value["平均搜索时间"][i]);
  540. 平均救助时间 += float.Parse(item1.Value["平均救助时间"][i]);
  541. 总飞行时间 += float.Parse(item1.Value["总飞行时间"][i]);
  542. 人员存活率 += float.Parse(item1.Value["人员存活率"][i]);
  543. aircreftCount++;
  544. if (item1.Value["平均搜索时间"][i] != "0")
  545. searchCount++;
  546. if (item1.Value["平均救助时间"][i] != "0")
  547. jzCount++;
  548. Console.WriteLine("索滑降" + item1.Key + "识别成功数:" + item1.Value["识别成功率"][i]);
  549. Console.WriteLine("索滑降" + item1.Key + "识别数量:" + item1.Value["识别数量"][i]);
  550. Console.WriteLine("索滑降" + item1.Key + "任务准备时间:" + item1.Value["任务准备时间"][i]);
  551. Console.WriteLine("索滑降" + item1.Key + "平均搜索时间:" + item1.Value["平均搜索时间"][i]);
  552. Console.WriteLine("索滑降" + item1.Key + "平均救助时间:" + item1.Value["平均救助时间"][i]);
  553. Console.WriteLine("索滑降" + item1.Key + "总飞行时间:" + item1.Value["总飞行时间"][i]);
  554. Console.WriteLine("索滑降" + item1.Key + "存活人数:" + item1.Value["人员存活率"][i]);
  555. Console.WriteLine("索滑降" + item1.Key + "人员数量:" + item1.Value["人员数量"][i]);
  556. Console.WriteLine("===============================================================");
  557. }
  558. }
  559. SJAllTotalTaskPerformance allTotalTaskPerformance = new SJAllTotalTaskPerformance();
  560. if (人员存活率 != 0)
  561. 任务是否成功 = 1;
  562. if (任务是否成功 == 1)
  563. self.seaSuccessCount++;
  564. if (识别数量 != 0)
  565. allTotalTaskPerformance.识别成功率 = (识别成功率 / 识别数量).ToString();
  566. else
  567. allTotalTaskPerformance.识别成功率 = "0";
  568. allTotalTaskPerformance.任务准备时间 = 任务准备时间.ToString();
  569. if (searchCount != 0)
  570. allTotalTaskPerformance.平均搜索时间 = (平均搜索时间 / searchCount).ToString("f4"); // aircreftCount
  571. else
  572. allTotalTaskPerformance.平均搜索时间 = "0";
  573. if (jzCount != 0)
  574. allTotalTaskPerformance.平均救助时间 = (平均救助时间 / jzCount).ToString("f4"); // aircreftCount
  575. else
  576. allTotalTaskPerformance.平均救助时间 = "0";
  577. allTotalTaskPerformance.总飞行时间 = 总飞行时间.ToString("f4");
  578. allTotalTaskPerformance.海上搜索覆盖面积 = 海上搜索覆盖面积.ToString();//"0.6".ToString();//"60%"
  579. allTotalTaskPerformance.环境搜索覆盖面积 = 环境搜索覆盖面积.ToString();//"0.6".ToString();
  580. allTotalTaskPerformance.任务是否成功 = 任务是否成功.ToString();
  581. if (人员数量 != 0)
  582. allTotalTaskPerformance.人员存活率 = (人员存活率 / 人员数量).ToString();
  583. else
  584. allTotalTaskPerformance.人员存活率 = "0";
  585. Console.WriteLine("单轮次总体指标识别成功率:" + allTotalTaskPerformance.识别成功率);
  586. Console.WriteLine("单轮次总体指标任务准备时间:" + allTotalTaskPerformance.任务准备时间);
  587. Console.WriteLine("单轮次总体指标平均搜索时间:" + allTotalTaskPerformance.平均搜索时间);
  588. Console.WriteLine("单轮次总体指标平均救助时间:" + allTotalTaskPerformance.平均救助时间);
  589. Console.WriteLine("单轮次总体指标总飞行时间:" + allTotalTaskPerformance.总飞行时间);
  590. Console.WriteLine("单轮次总体指标海上搜索覆盖面积:" + allTotalTaskPerformance.海上搜索覆盖面积);
  591. Console.WriteLine("单轮次总体指标环境搜索覆盖面积:" + allTotalTaskPerformance.环境搜索覆盖面积);
  592. Console.WriteLine("单轮次总体指标任务是否成功:" + allTotalTaskPerformance.任务是否成功);
  593. Console.WriteLine("单轮次总体指标人员存活率:" + allTotalTaskPerformance.人员存活率);
  594. Console.WriteLine("===============================================================");
  595. Dictionary<string, Dictionary<string, string>> report = new Dictionary<string, Dictionary<string, string>>();
  596. if (self.isSea)
  597. {
  598. report["总任务表现"] = new Dictionary<string, string>
  599. {
  600. { "识别成功率", allTotalTaskPerformance.识别成功率.ToString() },
  601. { "任务准备时间", allTotalTaskPerformance.任务准备时间.ToString() },
  602. { "平均搜索时间", allTotalTaskPerformance.平均搜索时间.ToString() },
  603. { "平均救助时间", allTotalTaskPerformance.平均救助时间.ToString() },
  604. { "总飞行时间", allTotalTaskPerformance.总飞行时间.ToString() },
  605. { "海上搜索覆盖面积", allTotalTaskPerformance.海上搜索覆盖面积.ToString() },
  606. { "任务是否成功", allTotalTaskPerformance.任务是否成功.ToString() },
  607. { "人员存活率", allTotalTaskPerformance.人员存活率.ToString() }
  608. };
  609. }
  610. else if (self.isLand)
  611. {
  612. report["总任务表现"] = new Dictionary<string, string>
  613. {
  614. { "识别成功率", allTotalTaskPerformance.识别成功率.ToString() },
  615. { "任务准备时间", allTotalTaskPerformance.任务准备时间.ToString() },
  616. { "平均搜索时间", allTotalTaskPerformance.平均搜索时间.ToString() },
  617. { "平均救助时间", allTotalTaskPerformance.平均救助时间.ToString() },
  618. { "总飞行时间", allTotalTaskPerformance.总飞行时间.ToString() },
  619. { "环境搜索覆盖面积", allTotalTaskPerformance.环境搜索覆盖面积.ToString() },
  620. { "任务是否成功", allTotalTaskPerformance.任务是否成功.ToString() },
  621. { "人员存活率", allTotalTaskPerformance.人员存活率.ToString() }
  622. };
  623. }
  624. self.SaveSeaSJ(report);
  625. }
  626. self.ReportAllSJSea();
  627. isReport = true;
  628. Console.WriteLine("所有任务执行完成");
  629. }
  630. }
  631. }