From 3b28930e3537853b595350d7fe9fc0d8edb026e6 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期日, 30 七月 2023 21:36:38 +0800
Subject: [PATCH] bf

---
 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs                                         |    8 +-
 HDL_ON/DAL/Server/HttpUtil.cs                                                     |    4 
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs |   89 +++++++++++++++++++++++++++++
 HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs              |   63 +++++++++++++++-----
 SiriIntents/Server/HttpUtil.cs                                                    |    4 
 5 files changed, 143 insertions(+), 25 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index f356d18..2ef648a 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
         const string APP_KEY = "HDL-HOME-APP-TEST";
         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
index c3ee794..2f1ba90 100644
--- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
+++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -37,10 +37,10 @@
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                         break;
                     case SPK.AirSwitchP3:
-                        //var airSwitchP3Page = new AirSwitchP3Page(function);
-                        //MainPage.BasePageView.AddChidren(airSwitchP3Page);
-                        //airSwitchP3Page.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
-                        //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        var airSwitchP3Page = new AirSwitchP3Page(function);
+                        MainPage.BasePageView.AddChidren(airSwitchP3Page);
+                        airSwitchP3Page.LoadPage(btnCollectionIcon, btnName, btnFromFloor);
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                         break;
                     case SPK.LightSwitch:
                         var relayView = new RelayPage(function);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
index a37e5be..bdbc4c5 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
@@ -217,12 +217,8 @@
             historyDataView.AddChidren(myEchartsView_Line);
 
             //EnergyRow(energy, energyListView, index);
-            new System.Threading.Thread(() =>
-                {
-                    Control.Ins.SendReadCommand(device);
-                })
-                { IsBackground = true }.Start();
 
+            LoadMothed_GetHistoryData();
 
         }
 
@@ -251,27 +247,60 @@
                     });
 
                     var sensorType = device.spk.Split(".")[1];
-                    var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, device.deviceId, "total_electricity");
+                    var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, device.deviceId, "power_a");
                     if (revertObj != null)
                     {
                         if (revertObj.Code == StateCode.SUCCESS)
                         {
                             var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString());
-
-                            List<string> vs = new List<string>();
-                            if (brokenLine.YvalueText == "")
-                            {
-                                foreach (var data in revertData)
+                            if (revertData == null || revertData.Count == 0) {
+#if DEBUG
+                                List<string> vs = new List<string>() {
+                                    "813","313","213","123",
+                                    "113","213","183","133",
+                                    "133","513","133","413",
+                                };
+                                    brokenLine.InitXdataText(vs);
+                                revertData = new List<EnvironmentalSensorHistor>()
                                 {
-                                    vs.Add(data.fieldName);
+                                    new EnvironmentalSensorHistor{ fieldValue = "100"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "200"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "300"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "500"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "100"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "200"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "300"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "500"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                };
+                                if (device.GetAttribute("ydata") == null)
+                                {
+                                    device.attributes.Add(new FunctionAttributes() { key = "ydata" });
                                 }
-                                brokenLine.InitXdataText(vs);
+                                device.SetAttrState("ydata", brokenLine.InitYdataText(device.name, revertData, "#5C62FE") + ", ");
+
+#endif
                             }
-                            if (device.GetAttribute("ydata") == null)
+                            else
                             {
-                                device.attributes.Add(new FunctionAttributes() { key = "ydata" });
+                                List<string> vs = new List<string>();
+                                if (brokenLine.YvalueText == "")
+                                {
+                                    foreach (var data in revertData)
+                                    {
+                                        vs.Add(data.fieldName);
+                                    }
+                                    brokenLine.InitXdataText(vs);
+                                }
+                                if (device.GetAttribute("ydata") == null)
+                                {
+                                    device.attributes.Add(new FunctionAttributes() { key = "ydata" });
+                                }
+                                device.SetAttrState("ydata", brokenLine.InitYdataText(device.name, revertData, "#5C62FE") + ", ");
                             }
-                            device.SetAttrState("ydata", brokenLine.InitYdataText(device.name, revertData, device.GetAttrState("color")) + ",");
                         }
                     }
                     brokenLine.yTitle = Language.StringByID(StringId.EnergyConsumption) + "(kW)";
@@ -280,7 +309,7 @@
                     {
                         brokenLine.xTitle = Language.StringByID(StringId.Date);
                     }
-                    var opString = brokenLine.InitOption();
+                    var opString = brokenLine.InitOption(30);
 
                     Application.RunOnMainThread(() =>
                     {
diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs
index 08d7db5..5ff7e8a 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs
@@ -43,6 +43,23 @@
         }
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="displayScale">鏄剧ず姣斾緥 0-100锛屾瘮濡傝缃簡30锛屽彧鏄剧ず30%锛屽彲浠ュ乏鍙虫嫋鍔ㄦ樉绀哄叾浠�</param>
+        /// <returns></returns>
+        public string InitOption(int displayScale)
+        {
+            //缁勮Value
+            var newstring = optionString2.Replace("{0}", XvalueText);
+            newstring = newstring.Replace("{1}", YvalueText);
+            newstring = newstring.Replace("{10}", xTitle);
+            newstring = newstring.Replace("{20}", yTitle);
+            newstring = newstring.Replace("{30}", displayScale.ToString());
+            newstring = newstring.Replace(",,", ",");
+            return newstring;
+        }
+
+        /// <summary>
         /// 缁勮x杞存枃鏈�
         /// </summary>
         /// <param name="xData"></param>
@@ -208,6 +225,78 @@
             }";
 #endif
 
+
+
+#if __IOS__
+        public string optionString2 = @"{
+                 tooltip: {
+                    trigger: 'axis'
+                    },
+                    grid: {
+                         top: '10%',
+                        left: '10%',
+                        right: '10%',
+                        bottom: '10%',
+                    },
+                    xAxis: {
+                        name: '{10}',
+                        type: 'category',
+                        boundaryGap: false,
+                        data: [{0}],
+                        axisLabel : {
+                            fontSize:30,
+                        },
+                    },
+                    yAxis: {
+                        name: '{20}',
+                        type: 'value',
+                        axisLabel : {
+                            fontSize:30,
+                        },
+                    },
+                    dataZoom: [{ 
+                        type: 'inside', 
+                        xAxisIndex: 0, 
+                        start: 0,
+                        end: {30} 
+                    }],
+                    series: [  
+                        {1}
+                    ]
+            }";
+#else
+        public string optionString2 = @"{
+                 tooltip: {
+                    trigger: 'axis'
+                    },
+                    grid: {
+                         top: '15%',
+                        left: '13%',
+                        right: '12%',
+                        bottom: '10%',
+                    },
+                    xAxis: {
+                        type: 'category',
+                        boundaryGap: false,
+                        data: [{0}],
+                        name: '{10}'
+                    },
+                    yAxis: {
+                        type: 'value',
+                        name: '{20}'
+                    },
+                    dataZoom: [{ 
+                        type: 'inside', 
+                        xAxisIndex: 0, 
+                        start: 0,
+                        end: {30} 
+                    }],
+                    series: [  
+                        {1}
+                    ]
+            }";
+#endif
+
         /// <summary>
         /// 棰滆壊鍒楄〃
         /// </summary>
diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs
index 8d4483c..dc7aca0 100644
--- a/SiriIntents/Server/HttpUtil.cs
+++ b/SiriIntents/Server/HttpUtil.cs
@@ -16,8 +16,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
         const string APP_KEY = "HDL-HOME-APP-TEST";
         const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
         //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm

--
Gitblit v1.8.0