From b266e82b9a377fa35a766f7a3a2f5aa95f3c9125 Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期五, 28 三月 2025 17:57:03 +0800
Subject: [PATCH] 修改首页场所列表

---
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/00-core/HydroMonitorExtensions.cs |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/00-core/HydroMonitorExtensions.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/00-core/HydroMonitorExtensions.cs
new file mode 100644
index 0000000..ce9b6d1
--- /dev/null
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/00-core/HydroMonitorExtensions.cs
@@ -0,0 +1,92 @@
+锘縩amespace Yw.WinFrmUI
+{
+    /// <summary>
+    /// 鐩戞祴鐐规嫇灞�
+    /// </summary>
+    public static class HydroMonitorExtensions
+    {
+        /// <summary>
+        /// 鍖归厤
+        /// </summary>
+        public static HydroMonitorVmo Matching(this List<HydroMonitorVmo> allMonitorList, string propName, List<string> flags)
+        {
+            if (allMonitorList == null || allMonitorList.Count < 1)
+            {
+                return default;
+            }
+            var monitorList = allMonitorList.Where(x => x.PropName == propName).ToList();
+            monitorList = monitorList.OrderBy(x => x.Flags.Distinct().Count()).ToList();
+            return monitorList.Find(x => x.Flags.ContainsC(flags));
+        }
+
+        /// <summary>
+        /// 鑾峰彇灞炴�у��
+        /// </summary>
+        public static double GetPropValue(this HydroMonitorVmo monitor, double propValue)
+        {
+            if (monitor == null)
+            {
+                return default;
+            }
+            double pv = 0;
+            switch (monitor.PropName)
+            {
+                case Yw.Hydro.MonitorProp.CalcuQ:
+                    {
+                        pv = Math.Round(propValue, 1);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuP:
+                    {
+                        pv = Math.Round(propValue, 1);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuE:
+                    {
+                        pv = Math.Round(propValue, 1);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuPr:
+                    {
+                        pv = Math.Round(propValue, 2);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuO:
+                    {
+                        pv = Math.Round(propValue, 0);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuO1:
+                    {
+                        pv = Math.Round(propValue, 0);
+                    }
+                    break;
+                case Yw.Hydro.MonitorProp.CalcuO2:
+                    {
+                        pv = Math.Round(propValue, 0);
+                    }
+                    break;
+                default: pv = Math.Round(propValue, 2); break;
+            }
+            return pv;
+        }
+
+        /// <summary>
+        /// 鑾峰彇灞炴�у��
+        /// </summary>
+        public static double? GetPropValue(this HydroMonitorVmo monitor, double? propValue)
+        {
+            if (monitor == null)
+            {
+                return default;
+            }
+            if (propValue == null)
+            {
+                return default;
+            }
+            return monitor.GetPropValue(propValue.Value);
+        }
+
+
+    }
+}

--
Gitblit v1.9.3