From adf8dc1c7cae1b12f486dcdb3d7daf4a5a59ec52 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 06 十一月 2024 17:00:41 +0800 Subject: [PATCH] 调度修改 --- 02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/00-helper/GlobalHelper.cs | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 167 insertions(+), 5 deletions(-) diff --git a/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/00-helper/GlobalHelper.cs b/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/00-helper/GlobalHelper.cs index e41bb0d..53cde27 100644 --- a/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/00-helper/GlobalHelper.cs +++ b/02-desktop/WinFrmUI/IStation.WinFrmUI.Monitor/03-WorkingConditionAnalysis/00-helper/GlobalHelper.cs @@ -1,4 +1,5 @@ 锘縰sing System.Collections.Generic; +using System.IO; using System.Linq; namespace IStation @@ -85,7 +86,7 @@ /// <returns></returns> public static bool IsStation2(IEnumerable<int> flags) { - if (flags==null|| !flags.Any()) + if (flags == null || !flags.Any()) { return false; } @@ -433,7 +434,7 @@ {Flag26, 浜岃緭26娉礯娉典簳娑蹭綅}, {Flag27, 浜岃緭27娉礯娉典簳娑蹭綅} }; - + /// <summary> /// 娉垫爣蹇楀嚭鍙e帇鍔涙槧灏勫瓧鍏� 1杈撴按 /// </summary> @@ -473,7 +474,7 @@ {Flag26, 浜岃緭26娉礯鐬椂娴侀噺}, {Flag27, 浜岃緭27娉礯鐬椂娴侀噺} }; - + /// <summary> /// 娉垫爣蹇楄浆閫熸槧灏勫瓧鍏� 1杈撴按 /// </summary> @@ -544,6 +545,69 @@ #endregion #region 妯″瀷鏄犲皠 + + + /// <summary> + /// 鎬荤娴侀噺鐐规槧灏勫瓧鍏� + /// </summary> + public readonly static List<string> Pipe1FlowIdList = new List<string>{ + "SFJD1" , + "SFJD2" , + "SFJD3" + }; + + /// <summary> + /// 鎬荤娴侀噺鐐规槧灏勫瓧鍏� + /// </summary> + public readonly static List<string> Pipe2FlowIdList = new List<string>{ + "SFDN2400", + "SFDN2700", + }; + + public static List<string> GetPipeFlowIdList(int station_index) + { + var list = new List<string>(); + if (station_index == 1) + { + list = Pipe1FlowIdList; + } + else + { + list = Pipe2FlowIdList; + } + return list; + } + + /// <summary> + /// 鎬荤鍘嬪姏鐐规槧灏勫瓧鍏� + /// </summary> + public readonly static List<string> Pipe1PressureIdList = new List<string>{ + "SPJD1" , + "SPJD2" , + "SPJD3" + }; + + + /// <summary> + /// 鎬荤鍘嬪姏鐐规槧灏勫瓧鍏� + /// </summary> + public readonly static List<string> Pipe2PressureIdList = new List<string>{ + "SPDN2400" , + "SPDN2700" , + }; + public static List<string> GetPipePressureIdList(int station_index) + { + var list = new List<string>(); + if (station_index == 1) + { + list = Pipe1PressureIdList; + } + else + { + list = Pipe2PressureIdList; + } + return list; + } /// <summary> /// 妯″瀷娴侀噺鐐规槧灏勫瓧鍏� @@ -761,8 +825,106 @@ } #endregion - - + + + /// <summary> + /// 鑾峰彇娉佃繘鍙f按浣嶅瓧鍏� + /// </summary> + public static Dictionary<int, double> GetFlagInletWaterLevelDict(int station_index, Dictionary<string, double> record_dict) + { + if (station_index == 1) + { + var flagInletWaterLevelMappingDict1 = new Dictionary<int, string>() + { + {Flag11, "R3"}, + {Flag12, "R3"}, + {Flag13, "R3"}, + {Flag14, "R2"}, + {Flag15, "R2"}, + {Flag16, "R1"}, + {Flag17, "R1"}, + {Flag18, "R1"} + }; + var station1_flag_inlet_water_level_dict = new Dictionary<int, double>(); + foreach (var mapping in flagInletWaterLevelMappingDict1) + { + var flag = mapping.Key; + var code = mapping.Value; + var water_level = 0d; + + water_level = record_dict[code]; + station1_flag_inlet_water_level_dict.Add(flag, water_level); + } + return station1_flag_inlet_water_level_dict; + } + else + { + var flagInletWaterLevelMappingDict2 = new Dictionary<int, string>() + { + {Flag21, "RPump21"}, + {Flag22, "RPump22"}, + {Flag23, "RPump23"}, + {Flag24, "RPump24"}, + {Flag25, "RPump25"}, + {Flag26, "RPump26"}, + {Flag27, "RPump27"} + }; + + var station2_flag_inlet_water_level_dict = new Dictionary<int, double>(); + foreach (var mapping in flagInletWaterLevelMappingDict2) + { + var flag = mapping.Key; + var code = mapping.Value; + var water_level = 0d; + + water_level = record_dict[code]; + station2_flag_inlet_water_level_dict.Add(flag, water_level); + } + return station2_flag_inlet_water_level_dict; + } + + } + + + private class ChScheduleConfig + { + /// <summary> + /// 涓�杈撴按 + /// </summary> + public Dto.ScheduleConfig Station1 { get; set; } + + + /// <summary> + /// 浜岃緭姘� + /// </summary> + public Dto.ScheduleConfig Station2 { get; set; } + } + + private static ChScheduleConfig _config = null; + /// <summary> + /// 鑾峰彇娉佃繘鍙f按浣嶅瓧鍏� + /// </summary> + public static Dto.ScheduleConfig GetScheduleConfig(int station_index) + { + if (_config == null) + { + var filePath = $"{DAL.FileHelper.GetDataFolder()}\\ScheduleConfig.json"; + if (!File.Exists(filePath)) + return default; + var json = File.ReadAllText(filePath); + _config = JsonHelper.Json2Object<ChScheduleConfig>(json); + } + + if (station_index == 1) + { + return _config.Station1; + } + else + { + return _config.Station2; + } + } + } } -- Gitblit v1.9.3