wxr
2024-09-27 acc8caee31c4be90bd38d1af18136b0e84f6fe94
HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -10,18 +11,48 @@
    public class InverterJinmaoHistroyPage : FrameLayout
    {
        InverterJinmaoHistroyPage bodyView;
        Function device;
        Function function;
        FrameLayout infoView1;
        EchartsOption_Histogram echartOption1;
        MyEchartsViewOn infoView1_EchartsView;
        Button infoView1_Date_Day;
        Button infoView1_Date_Month;
        Button infoView1_Date_Year;
        Button infoView1_DateInfo_PreClickButton;
        Button infoView1_DateInfo_DateTextButton;
        Button infoView1_DateInfo_NextClickButton;
        Button infoView1_DateInfo_NextIconButton;
        Button infoView1_DateInfo_PreIconButton;
        QueryType queryType1 = QueryType.day_hour;
        int queryTime_Day1 = DateTime.Now.Day;
        int queryTime_Month1 = DateTime.Now.Month;
        int queryTime_Year1 = DateTime.Now.Year;
        string queryTimeString1 = DateTime.Now.ToString("yyyy/MM/dd");
        /// <summary>
        /// echart容器
        /// </summary>
        MyEchartsViewOn tempEchartsView;
        FrameLayout infoView2;
        MyEchartsViewOn infoView2_EchartsView;
        EchartsOption_Histogram echartOption2;
        Button infoView2_Date_Day;
        Button infoView2_Date_Month;
        Button infoView2_Date_Year;
        Button infoView2_DateInfo_PreClickButton;
        Button infoView2_DateInfo_DateTextButton;
        Button infoView2_DateInfo_NextClickButton;
        Button infoView2_DateInfo_NextIconButton;
        Button infoView2_DateInfo_PreIconButton;
        QueryType queryType2 = QueryType.day_hour;
        int queryTime_Day2 = DateTime.Now.Day;
        int queryTime_Month2 = DateTime.Now.Month;
        int queryTime_Year2 = DateTime.Now.Year;
        string queryTimeString2 = DateTime.Now.ToString("yyyy/MM/dd");
        public InverterJinmaoHistroyPage(Function function)
        public InverterJinmaoHistroyPage(Function deviceFunction)
        {
            bodyView = this;
            device = function;
            function = deviceFunction;
            BackgroundColor = CSS_Color.BackgroundColor;
        }
        public void LoadPage()
@@ -38,7 +69,7 @@
            bodyView.AddChidren(contentView);
            #region 发电量
            var infoView1 = new FrameLayout()
            infoView1 = new FrameLayout()
            {
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(382),
@@ -65,7 +96,7 @@
            };
            infoView1.AddChidren(infoView1_DateView);
            var infoView1_Date_Day = new Button()
            infoView1_Date_Day = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -84,7 +115,7 @@
            infoView1_DateView.AddChidren(infoView1_Date_Day);
            var infoView1_Date_Month = new Button()
            infoView1_Date_Month = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -103,7 +134,7 @@
            infoView1_DateView.AddChidren(infoView1_Date_Month);
            var infoView1_Date_Year = new Button()
            infoView1_Date_Year = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -128,7 +159,7 @@
            };
            infoView1.AddChidren(infoView1_DateInfoView);
            var infoView1_DateInfo_PreIconButton = new Button()
            infoView1_DateInfo_PreIconButton = new Button()
            {
                X = Application.GetRealWidth(18),
                Gravity = Gravity.CenterVertical,
@@ -138,18 +169,18 @@
            };
            infoView1_DateInfoView.AddChidren(infoView1_DateInfo_PreIconButton);
            var infoView1_DateInfo_PreClickButton = new Button()
            infoView1_DateInfo_PreClickButton = new Button()
            {
                Width = Application.GetRealWidth(32 + 6),
            };
            infoView1_DateInfoView.AddChidren(infoView1_DateInfo_PreClickButton);
            var infoView1_DateInfo_DateTextButton = new Button()
            infoView1_DateInfo_DateTextButton = new Button()
            {
                Gravity = Gravity.Center,
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.Center,
                Text = "2024-8-12",
                Text = DateTime.Now.ToString("yyyy-MM-dd"),
                TextColor = CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextSize = 16,
@@ -157,7 +188,7 @@
            infoView1_DateInfoView.AddChidren(infoView1_DateInfo_DateTextButton);
            var infoView1_DateInfo_NextIconButton = new Button()
            infoView1_DateInfo_NextIconButton = new Button()
            {
                X = Application.GetRealWidth(343 - 18 - 6),
                Gravity = Gravity.CenterVertical,
@@ -167,8 +198,9 @@
            };
            infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextIconButton);
            var infoView1_DateInfo_NextClickButton = new Button()
            infoView1_DateInfo_NextClickButton = new Button()
            {
                X = Application.GetRealWidth(343 - 18 - 6 - 32),
                Width = Application.GetRealWidth(32 + 6),
            };
            infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextClickButton);
@@ -176,50 +208,50 @@
            #endregion
            #region 数据图表
            MyEchartsViewOn infoView1_EchartsView = new MyEchartsViewOn()
            infoView1_EchartsView = new MyEchartsViewOn()
            {
                Y = Application.GetRealWidth(101),
                Height = Application.GetRealWidth(246),
            };
            infoView1.AddChidren(infoView1_EchartsView);
            var echartOption = new EchartsOption_Histogram();
            echartOption.xTitle = "时间";
            echartOption.yTitle = "温度(℃)";
            echartOption.InitXdataText(new List<string>()
            {
                "21","22","23","24","25","26","26","27","28","29",
                "21","22","23","24","25","26","26","27","28","29",
                "21","22","23","24"
            });
            echartOption.InitYdataText(new List<EnvironmentalSensorHistor>() {
                new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22"  },
                new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31"  },
                new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24"  },
                new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32"  },
                new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22"  },
                new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31"  },
                new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21"  },
            });
            var ddd = echartOption.InitOption();
            infoView1_EchartsView.ShowWithOption(ddd);
            echartOption1 = new EchartsOption_Histogram();
            echartOption1.xTitle = "时间";
            echartOption1.yTitle = "电量(kwh)";
            //echartOption.InitXdataText(new List<string>()
            //{
            //    "21","22","23","24","25","26","26","27","28","29",
            //    "21","22","23","24","25","26","26","27","28","29",
            //    "21","22","23","24"
            //});
            //echartOption.InitYdataText(new List<EnvironmentalSensorHistor>() {
            //    new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22"  },
            //    new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31"  },
            //    new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24"  },
            //    new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32"  },
            //    new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22"  },
            //    new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31"  },
            //    new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21"  },
            //});
            //var ddd = echartOption.InitOption();
            //infoView1_EchartsView.ShowWithOption(ddd);
            infoView1.AddChidren(new Button()
            {
@@ -241,7 +273,7 @@
            });
            #region 用电量
            var infoView2 = new FrameLayout()
            infoView2 = new FrameLayout()
            {
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(382),
@@ -269,7 +301,7 @@
            };
            infoView2.AddChidren(infoView2_DateView);
            var infoView2_Date_Day = new Button()
            infoView2_Date_Day = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -288,7 +320,7 @@
            infoView2_DateView.AddChidren(infoView2_Date_Day);
            var infoView2_Date_Month = new Button()
            infoView2_Date_Month = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -307,7 +339,7 @@
            infoView2_DateView.AddChidren(infoView2_Date_Month);
            var infoView2_Date_Year = new Button()
            infoView2_Date_Year = new Button()
            {
                Width = Application.GetRealWidth(103),
                Height = Application.GetRealWidth(26),
@@ -332,7 +364,7 @@
            };
            infoView2.AddChidren(infoView2_DateInfoView);
            var infoView2_DateInfo_PreIconButton = new Button()
            infoView2_DateInfo_PreIconButton = new Button()
            {
                X = Application.GetRealWidth(18),
                Gravity = Gravity.CenterVertical,
@@ -342,18 +374,18 @@
            };
            infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreIconButton);
            var infoView2_DateInfo_PreClickButton = new Button()
            infoView2_DateInfo_PreClickButton = new Button()
            {
                Width = Application.GetRealWidth(32 + 6),
            };
            infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreClickButton);
            var infoView2_DateInfo_DateTextButton = new Button()
            infoView2_DateInfo_DateTextButton = new Button()
            {
                Gravity = Gravity.Center,
                Width = Application.GetRealWidth(200),
                TextAlignment = TextAlignment.Center,
                Text = "2024-8-12",
                Text = DateTime.Now.ToString("yyyy-MM-dd"),
                TextColor = CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextSize = 16,
@@ -361,7 +393,7 @@
            infoView2_DateInfoView.AddChidren(infoView2_DateInfo_DateTextButton);
            var infoView2_DateInfo_NextIconButton = new Button()
            infoView2_DateInfo_NextIconButton = new Button()
            {
                X = Application.GetRealWidth(343 - 18 - 6),
                Gravity = Gravity.CenterVertical,
@@ -371,8 +403,9 @@
            };
            infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextIconButton);
            var infoView2_DateInfo_NextClickButton = new Button()
            infoView2_DateInfo_NextClickButton = new Button()
            {
                X = Application.GetRealWidth(343 - 18 - 6 - 32),
                Width = Application.GetRealWidth(32 + 6),
            };
            infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton);
@@ -380,49 +413,49 @@
            #endregion
            #region 数据图表
            MyEchartsViewOn infoView2_EchartsView = new MyEchartsViewOn()
            infoView2_EchartsView = new MyEchartsViewOn()
            {
                Y = Application.GetRealWidth(101),
                Height = Application.GetRealWidth(246),
            };
            infoView2.AddChidren(infoView2_EchartsView);
            var echartOption2 = new EchartsOption_Histogram();
            echartOption2 = new EchartsOption_Histogram();
            echartOption2.xTitle = "时间";
            echartOption2.yTitle = "温度(℃)";
            echartOption2.InitXdataText(new List<string>()
            {
                "21","22","23","24","25","26","26","27","28","29",
                "21","22","23","24","25","26","26","27","28","29",
                "21","22","23","24"
            });
            echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() {
                new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22"  },
                new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31"  },
                new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24"  },
                new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32"  },
                new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22"  },
                new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21"  },
                new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41"  },
                new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31"  },
                new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23"  },
                new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11"  },
                new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21"  },
            });
            infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
            echartOption2.yTitle = "电量(kwh)";
            //echartOption2.InitXdataText(new List<string>()
            //{
            //    "21","22","23","24","25","26","26","27","28","29",
            //    "21","22","23","24","25","26","26","27","28","29",
            //    "21","22","23","24"
            //});
            //echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() {
            //    new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22"  },
            //    new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31"  },
            //    new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24"  },
            //    new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32"  },
            //    new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22"  },
            //    new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21"  },
            //    new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41"  },
            //    new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31"  },
            //    new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23"  },
            //    new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11"  },
            //    new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21"  },
            //});
            //infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
            infoView2.AddChidren(new Button()
            {
@@ -444,8 +477,1085 @@
            {
                Height = Application.GetRealWidth(26)
            });
            initQueryButton();
            getPvElectricityHistory();
            getLoadElectricityHistory();
        }
    }
}
        /// <summary>
        /// 读取发电量历史数据
        /// hour=近24小时、day_hour =某日24小时、week=近一周、month = 近一月、custom_month=某年某月 y/M、custom_year=某年 y
        /// </summary>
        private void getPvElectricityHistory()
        {
            if (MainPage.NoLoginMode)
            {
                return;
            }
            var loadPage = new Loading()
            {
                LodingBackgroundColor = 0x88888888,
                BackgroundColor = 0x00FFFFFF,
            };
            infoView1.AddChidren(loadPage);
            new System.Threading.Thread(() =>
            {
                try
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Start();
                    });
                    switch (queryType1)
                    {
                        case QueryType.day_hour:
                            queryTimeString1 = queryTime_Year1.ToString() + "/" + queryTime_Month1 + "/" + queryTime_Day1;
                            break;
                        case QueryType.custom_month:
                            queryTimeString1 = queryTime_Year1.ToString() + "/" + queryTime_Month1;
                            break;
                        case QueryType.custom_year:
                            queryTimeString1 = queryTime_Year1.ToString();
                            break;
                    }
                    var revertObj = new HttpServerRequest().GetSensorHistory(queryType1.ToString(), function.deviceId, InverterJinmao_AttrEnum.pv_electricity.ToString(), queryTimeString1);
                    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>();
                            foreach (var data in revertData)
                            {
                                vs.Add(data.fieldName);
                            }
                            echartOption1.InitXdataText(vs);
                            echartOption1.InitYdataText(revertData);
                            Application.RunOnMainThread(() =>
                            {
                                infoView1_EchartsView.ShowWithOption(echartOption1.InitOption());
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log($"history error : {ex.Message}");
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Hide();
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 获取用电量历史记录
        /// </summary>
        private void getLoadElectricityHistory()
        {
            if (MainPage.NoLoginMode)
            {
                return;
            }
            var loadPage = new Loading()
            {
                LodingBackgroundColor = 0x88888888,
                BackgroundColor = 0x00FFFFFF,
            };
            infoView2.AddChidren(loadPage);
            new System.Threading.Thread(() =>
            {
                try
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Start();
                    });
                    switch (queryType2)
                    {
                        case QueryType.day_hour:
                            queryTimeString2 = queryTime_Year2.ToString() + "/" + queryTime_Month2 + "/" + queryTime_Day2;
                            break;
                        case QueryType.custom_month:
                            queryTimeString2 = queryTime_Year2.ToString() + "/" + queryTime_Month2;
                            break;
                        case QueryType.custom_year:
                            queryTimeString2 = queryTime_Year2.ToString();
                            break;
                    }
                    var revertObj = new HttpServerRequest().GetSensorHistory(queryType2.ToString(), function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), queryTimeString2);
                    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>();
                            foreach (var data in revertData)
                            {
                                vs.Add(data.fieldName);
                            }
                            echartOption2.InitXdataText(vs);
                            echartOption2.InitYdataText(revertData);
                            Application.RunOnMainThread(() =>
                            {
                                var ddd = echartOption2.InitOption();
                                infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log($"history 2 error : {ex.Message}");
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loadPage.Hide();
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        private void initQueryButton()
        {
            infoView1_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) =>
            {
                SetTempQureyDateDialog();
            };
            infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) =>
            {
                var pvElecQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1);
                if (queryType1 == QueryType.day_hour)
                {
                    if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1 && pvElecQueryDate.Day == 1)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddDays(-1);
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM-dd");
                }
                else if (queryType1 == QueryType.custom_month)
                {
                    if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddMonths(-1);
                    queryTime_Day1 = pvElecQueryDate.Day;
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM");
                }
                else if (queryType1 == QueryType.custom_year)
                {
                    if (pvElecQueryDate.Year <= 2023)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddYears(-1);
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy");
                }
                queryTime_Year1 = pvElecQueryDate.Year;
                queryTime_Month1 = pvElecQueryDate.Month;
                queryTime_Day1 = pvElecQueryDate.Day;
                getPvElectricityHistory();
            };
            infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) =>
            {
                var pvElecQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1);
                if (queryType1 == QueryType.day_hour)
                {
                    if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month && pvElecQueryDate.Day == DateTime.Now.Day)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddDays(1);
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM-dd");
                }
                else if (queryType1 == QueryType.custom_month)
                {
                    if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddMonths(1);
                    queryTime_Day1 = pvElecQueryDate.Day;
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM");
                }
                else if (queryType1 == QueryType.custom_year)
                {
                    if (pvElecQueryDate.Year >= DateTime.Now.Year)
                    {
                        return;
                    }
                    pvElecQueryDate = pvElecQueryDate.AddYears(1);
                    infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy");
                }
                queryTime_Year1 = pvElecQueryDate.Year;
                queryTime_Month1 = pvElecQueryDate.Month;
                queryTime_Day1 = pvElecQueryDate.Day;
                getPvElectricityHistory();
            };
            infoView1_Date_Day.MouseUpEventHandler = (sender, e) =>
            {
                if (infoView1_Date_Day.IsSelected)
                {
                    return;
                }
                infoView1_Date_Day.IsSelected = true;
                infoView1_Date_Month.IsSelected = false;
                infoView1_Date_Year.IsSelected = false;
                queryType1 = QueryType.day_hour;
                if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1))
                {
                    queryTime_Year1 = DateTime.Now.Year;
                    queryTime_Month1 = DateTime.Now.Month;
                    queryTime_Day1 = DateTime.Now.Day;
                }
                infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd");
                getPvElectricityHistory();
            };
            infoView1_Date_Month.MouseUpEventHandler = (sender, e) =>
            {
                if (infoView1_Date_Month.IsSelected)
                {
                    return;
                }
                infoView1_Date_Day.IsSelected = false;
                infoView1_Date_Month.IsSelected = true;
                infoView1_Date_Year.IsSelected = false;
                queryType1 = QueryType.custom_month;
                if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1))
                {
                    queryTime_Year1 = DateTime.Now.Year;
                    queryTime_Month1 = DateTime.Now.Month;
                }
                infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM");
                getPvElectricityHistory();
            };
            infoView1_Date_Year.MouseUpEventHandler = (sender, e) =>
            {
                if (infoView1_Date_Year.IsSelected)
                {
                    return;
                }
                infoView1_Date_Day.IsSelected = false;
                infoView1_Date_Month.IsSelected = false;
                infoView1_Date_Year.IsSelected = true;
                queryType1 = QueryType.custom_year;
                infoView1_DateInfo_DateTextButton.Text = queryTime_Year1.ToString();
                getPvElectricityHistory();
            };
            //-----------用水
            infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) =>
            {
                SetWaterQureyDateDialog();
            };
            infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) =>
            {
                var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2);
                if (queryType2 == QueryType.day_hour)
                {
                    if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddDays(-1);
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
                }
                else if (queryType2 == QueryType.custom_month)
                {
                    if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddMonths(-1);
                    queryTime_Day2 = waterQueryDate.Day;
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM");
                }
                else if (queryType2 == QueryType.custom_year)
                {
                    if (waterQueryDate.Year <= 2023)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddYears(-1);
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy");
                }
                queryTime_Year2 = waterQueryDate.Year;
                queryTime_Month2 = waterQueryDate.Month;
                queryTime_Day2 = waterQueryDate.Day;
                getLoadElectricityHistory();
            };
            infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) =>
            {
                var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2);
                if (queryType2 == QueryType.day_hour)
                {
                    if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month && waterQueryDate.Day == DateTime.Now.Day)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddDays(1);
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
                }
                else if (queryType2 == QueryType.custom_month)
                {
                    if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddMonths(1);
                    queryTime_Day2 = waterQueryDate.Day;
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM");
                }
                else if (queryType2 == QueryType.custom_year)
                {
                    if (waterQueryDate.Year >= DateTime.Now.Year)
                    {
                        return;
                    }
                    waterQueryDate = waterQueryDate.AddYears(1);
                    infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy");
                }
                queryTime_Year2 = waterQueryDate.Year;
                queryTime_Month2 = waterQueryDate.Month;
                queryTime_Day2 = waterQueryDate.Day;
                getLoadElectricityHistory();
            };
            infoView2_Date_Day.MouseDownEventHandler = (sender, e) =>
            {
                if (infoView2_Date_Day.IsSelected)
                {
                    return;
                }
                infoView2_Date_Day.IsSelected = true;
                infoView2_Date_Month.IsSelected = false;
                infoView2_Date_Year.IsSelected = false;
                queryType2 = QueryType.day_hour;
                if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2))
                {
                    queryTime_Year2 = DateTime.Now.Year;
                    queryTime_Month2 = DateTime.Now.Month;
                    queryTime_Day2 = DateTime.Now.Day;
                }
                infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd");
                getLoadElectricityHistory();
            };
            infoView2_Date_Month.MouseDownEventHandler = (sender, e) =>
            {
                if (infoView2_Date_Month.IsSelected)
                {
                    return;
                }
                infoView2_Date_Day.IsSelected = false;
                infoView2_Date_Month.IsSelected = true;
                infoView2_Date_Year.IsSelected = false;
                queryType2 = QueryType.custom_month;
                if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2))
                {
                    queryTime_Year2 = DateTime.Now.Year;
                    queryTime_Month2 = DateTime.Now.Month;
                }
                infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM");
                getLoadElectricityHistory();
            };
            infoView2_Date_Year.MouseDownEventHandler = (sender, e) =>
            {
                if (infoView2_Date_Year.IsSelected)
                {
                    return;
                }
                infoView2_Date_Day.IsSelected = false;
                infoView2_Date_Month.IsSelected = false;
                infoView2_Date_Year.IsSelected = true;
                queryType2 = QueryType.custom_year;
                infoView2_DateInfo_DateTextButton.Text = queryTime_Year2.ToString();
                getLoadElectricityHistory();
            };
        }
        /// <summary>
        /// </summary>
        public void SetTempQureyDateDialog()
        {
            var pickerItems_Year = new List<string>();
            List<string> pickerItems_Month = null;
            List<string> pickerItems_Day = null;
            int item1 = queryTime_Year1;
            int item2 = queryTime_Month1;
            int item3 = queryTime_Day1;
            pickerItems_Year.Add("2023");
            while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
            {
                pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
            }
            if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour)
            {
                pickerItems_Month = new List<string>();
                if (queryTime_Year1 == DateTime.Now.Year)
                {
                    int addMonth = 0;
                    while (DateTime.Now.Month > addMonth)
                    {
                        addMonth++;
                        pickerItems_Month.Add(addMonth.ToString());
                    }
                }
                else
                {
                    for (var i = 1; i < 13; i++)
                    {
                        pickerItems_Month.Add(i.ToString());
                    }
                }
                if (queryType1 == QueryType.day_hour)
                {
                    pickerItems_Day = new List<string>();
                    if (queryTime_Month1 == DateTime.Now.Month)
                    {
                        int addDay = 0;
                        while (DateTime.Now.Day > addDay)
                        {
                            addDay++;
                            pickerItems_Day.Add(addDay.ToString());
                        }
                    }
                    else
                    {
                        for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year1, queryTime_Month1); i++)
                        {
                            pickerItems_Day.Add(i.ToString());
                        }
                    }
                }
            }
            Dialog dialog = new Dialog();
            var pView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(pView);
            var optionBaseView = new FrameLayout()
            {
                Y = Application.GetRealHeight(456 - 60),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(260),
                AnimateSpeed = 0.3f,
                Animate = Animate.DownToUp,
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
            };
            pView.AddChidren(optionBaseView);
            var topView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
            };
            optionBaseView.AddChidren(topView);
            topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
            var btnCancel = new Button()
            {
                X = Application.GetRealWidth(21),
                Width = Application.GetRealWidth(100),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.Cancel,
            };
            topView.AddChidren(btnCancel);
            var btnConfrim = new Button()
            {
                X = Application.GetRealWidth(160),
                Width = Application.GetRealWidth(160),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.Confirm,
            };
            topView.AddChidren(btnConfrim);
            var btnToday = new Button()
            {
                X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(),
                Width = Application.GetRealWidth(160),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
                Visible = false,
                Enable = false,
                Text = "今日",
            };
            topView.AddChidren(btnToday);
            UIPickerView uIPickerView = new UIPickerView()
            {
                Y = Application.GetRealHeight(40),
                Height = Application.GetRealHeight(210),
                Radius = (uint)Application.GetRealWidth(12),
            };
            optionBaseView.AddChidren(uIPickerView);
            uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
            uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year1.ToString()),
                pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month1.ToString()),
                pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day1.ToString()));
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
            {
                try
                {
                    if (int1 < 0)
                    {
                        int1 = 1;
                    }
                    if (pickerItems_Year[int1] != item1.ToString())
                    {
                        int.TryParse(pickerItems_Year[int1], out item1);
                        if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour)
                        {
                            pickerItems_Month = new List<string>();
                            if (item1 == DateTime.Now.Year)
                            {
                                int addMonth = 0;
                                while (DateTime.Now.Month > addMonth)
                                {
                                    addMonth++;
                                    pickerItems_Month.Add(addMonth.ToString());
                                }
                            }
                            else
                            {
                                for (var i = 1; i < 13; i++)
                                {
                                    pickerItems_Month.Add(i.ToString());
                                }
                            }
                            if (queryType1 == QueryType.day_hour)
                            {
                                pickerItems_Day = new List<string>();
                                if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
                                {
                                    int addDay = 0;
                                    while (DateTime.Now.Day > addDay)
                                    {
                                        addDay++;
                                        pickerItems_Day.Add(addDay.ToString());
                                    }
                                }
                                else
                                {
                                    for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
                                    {
                                        pickerItems_Day.Add(i.ToString());
                                    }
                                }
                            }
                        }
                        uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                        uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()),
                            pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()),
                            pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString()));
                    }
                    if (pickerItems_Month != null)
                    {
                        if (int2 >= pickerItems_Month.Count || int2 < 0)
                        {
                            int2 = 0;
                        }
                        if (pickerItems_Month[int2] != item2.ToString())
                        {
                            int.TryParse(pickerItems_Month[int2], out item2);
                            if (queryType1 == QueryType.day_hour)
                            {
                                pickerItems_Day = new List<string>();
                                if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
                                {
                                    int addDay = 0;
                                    while (DateTime.Now.Day > addDay)
                                    {
                                        addDay++;
                                        pickerItems_Day.Add(addDay.ToString());
                                    }
                                }
                                else
                                {
                                    for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
                                    {
                                        pickerItems_Day.Add(i.ToString());
                                    }
                                }
                            }
                            try
                            {
                                uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                                uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()),
                                    pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()),
                                    pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString()));
                            }
                            catch (Exception ex)
                            {
                                MainPage.Log("Error", $"金茂历史数据控件异常:{ex.Message}");
                            }
                        }
                    }
                    if (pickerItems_Day != null)
                    {
                        if (int3 >= pickerItems_Day.Count || int3 < 0)
                        {
                            int3 = 0;
                        }
                        if (pickerItems_Day[int3] != item3.ToString())
                        {
                            int.TryParse(pickerItems_Day[int3], out item3);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log("Error", $"金茂热水器日期选择异常:{ex.StackTrace}");
                }
            };
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                queryTime_Year1 = item1;
                infoView1_DateInfo_DateTextButton.Text = queryTime_Year1.ToString();
                if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour)
                {
                    if (item2 != queryTime_Month1)
                    {
                        queryTime_Month1 = item2;
                    }
                    infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, 1).ToString("yyyy-MM");
                    if (queryType1 == QueryType.day_hour)
                    {
                        if (item3 != queryTime_Day1)
                        {
                            queryTime_Day1 = item3;
                        }
                        infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd");
                    }
                }
                getPvElectricityHistory();
            };
            if (queryType1 == QueryType.day_hour)
            {
                try
                {
                    btnToday.Visible = btnToday.Enable = true;
                    btnToday.MouseUpEventHandler = (sender, e) =>
                    {
                        item3 = queryTime_Day1 = DateTime.Now.Day;
                        item2 = queryTime_Month1 = DateTime.Now.Month;
                        item1 = queryTime_Year1 = DateTime.Now.Year;
                        pickerItems_Year = new List<string>();
                        pickerItems_Year.Add("2023");
                        while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
                        {
                            pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
                        }
                        pickerItems_Month = new List<string>();
                        int addMonth = 0;
                        while (DateTime.Now.Month > addMonth)
                        {
                            addMonth++;
                            pickerItems_Month.Add(addMonth.ToString());
                        }
                        pickerItems_Day = new List<string>();
                        int addDay = 0;
                        while(DateTime.Now.Day > addDay)
                        {
                            addDay++;
                            pickerItems_Day.Add(addDay.ToString());
                        }
                        uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                        uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year1.ToString()),
                            pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month1.ToString()),
                            pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day1.ToString()));
                    };
                }
                catch { }
            }
        }
        public void SetWaterQureyDateDialog()
        {
            var pickerItems_Year = new List<string>();
            List<string> pickerItems_Month = null;
            List<string> pickerItems_Day = null;
            int item1 = queryTime_Year2;
            int item2 = queryTime_Month2;
            int item3 = queryTime_Day2;
            pickerItems_Year.Add("2023");
            while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
            {
                pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
            }
            if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour)
            {
                pickerItems_Month = new List<string>();
                if (queryTime_Year2 == DateTime.Now.Year)
                {
                    int addMonth = 0;
                    while (DateTime.Now.Month > addMonth)
                    {
                        addMonth++;
                        pickerItems_Month.Add(addMonth.ToString());
                    }
                }
                else
                {
                    for (var i = 1; i < 13; i++)
                    {
                        pickerItems_Month.Add(i.ToString());
                    }
                }
                if (queryType2 == QueryType.day_hour)
                {
                    pickerItems_Day = new List<string>();
                    if (queryTime_Month2 == DateTime.Now.Month)
                    {
                        int addDay = 0;
                        while (DateTime.Now.Day > addDay)
                        {
                            addDay++;
                            pickerItems_Day.Add(addDay.ToString());
                        }
                    }
                    else
                    {
                        for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year2, queryTime_Month2); i++)
                        {
                            pickerItems_Day.Add(i.ToString());
                        }
                    }
                }
            }
            Dialog dialog = new Dialog();
            var pView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.DialogTransparentColor1,
            };
            dialog.AddChidren(pView);
            var optionBaseView = new FrameLayout()
            {
                Y = Application.GetRealHeight(456 - 60),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(260),
                AnimateSpeed = 0.3f,
                Animate = Animate.DownToUp,
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
            };
            pView.AddChidren(optionBaseView);
            var topView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(40),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
            };
            optionBaseView.AddChidren(topView);
            topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
            var btnCancel = new Button()
            {
                X = Application.GetRealWidth(21),
                Width = Application.GetRealWidth(100),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.Cancel,
            };
            topView.AddChidren(btnCancel);
            var btnConfrim = new Button()
            {
                X = Application.GetRealWidth(160),
                Width = Application.GetRealWidth(160),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.Confirm,
            };
            topView.AddChidren(btnConfrim);
            UIPickerView uIPickerView = new UIPickerView()
            {
                Y = Application.GetRealHeight(40),
                Height = Application.GetRealHeight(210),
                Radius = (uint)Application.GetRealWidth(12),
            };
            optionBaseView.AddChidren(uIPickerView);
            uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
            uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year2.ToString()),
                pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month2.ToString()),
                pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day2.ToString()));
            dialog.Show();
            pView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            btnCancel.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
            {
                try
                {
                    if (int1 < 0)
                    {
                        int1 = 0;
                    }
                    if (pickerItems_Year[int1] != item1.ToString())
                    {
                        int.TryParse(pickerItems_Year[int1], out item1);
                        if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour)
                        {
                            pickerItems_Month = new List<string>();
                            if (item1 == DateTime.Now.Year)
                            {
                                int addMonth = 0;
                                while (DateTime.Now.Month > addMonth)
                                {
                                    addMonth++;
                                    pickerItems_Month.Add(addMonth.ToString());
                                }
                            }
                            else
                            {
                                for (var i = 1; i < 13; i++)
                                {
                                    pickerItems_Month.Add(i.ToString());
                                }
                            }
                            if (queryType2 == QueryType.day_hour)
                            {
                                pickerItems_Day = new List<string>();
                                if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
                                {
                                    int addDay = 0;
                                    while (DateTime.Now.Day > addDay)
                                    {
                                        addDay++;
                                        pickerItems_Day.Add(addDay.ToString());
                                    }
                                }
                                else
                                {
                                    for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
                                    {
                                        pickerItems_Day.Add(i.ToString());
                                    }
                                }
                            }
                        }
                        uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                        uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()),
                            pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()),
                            pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString()));
                    }
                    if (pickerItems_Month != null)
                    {
                        if (int2 > pickerItems_Month.Count || int2 < 0)
                        {
                            int2 = 0;
                        }
                        if (pickerItems_Month[int2] != item2.ToString())
                        {
                            int.TryParse(pickerItems_Month[int2], out item2);
                            if (queryType2 == QueryType.day_hour)
                            {
                                pickerItems_Day = new List<string>();
                                if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
                                {
                                    int addDay = 0;
                                    while (DateTime.Now.Day > addDay)
                                    {
                                        addDay++;
                                        pickerItems_Day.Add(addDay.ToString());
                                    }
                                }
                                else
                                {
                                    for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
                                    {
                                        pickerItems_Day.Add(i.ToString());
                                    }
                                }
                            }
                            uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                            uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()),
                                pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()),
                                pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString()));
                        }
                    }
                    if (pickerItems_Day != null)
                    {
                        if (int3 >= pickerItems_Day.Count || int3 < 0)
                        {
                            int3 = 0;
                        }
                        if (pickerItems_Day[int3] != item3.ToString())
                        {
                            int.TryParse(pickerItems_Day[int3], out item3);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log("Error", $"金茂光伏日期2选择异常:{ex.StackTrace}");
                }
            };
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
                queryTime_Year2 = item1;
                infoView2_DateInfo_DateTextButton.Text = queryTime_Year2.ToString();
                if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour)
                {
                    if (item2 != queryTime_Month2)
                    {
                        queryTime_Month2 = item2;
                    }
                    infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, 1).ToString("yyyy-MM");
                    if (queryType2 == QueryType.day_hour)
                    {
                        if (item3 != queryTime_Day2)
                        {
                            queryTime_Day2 = item3;
                        }
                        infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd");
                    }
                }
                getLoadElectricityHistory();
            };
            var btnToday = new Button()
            {
                X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(),
                Width = Application.GetRealWidth(160),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.TextFontSize,
                Visible = false,
                Enable = false,
                Text = "今日",
            };
            topView.AddChidren(btnToday);
            if (queryType2 == QueryType.day_hour)
            {
                try
                {
                    btnToday.Visible = btnToday.Enable = true;
                    btnToday.MouseUpEventHandler = (sender, e) =>
                    {
                        item3 = queryTime_Day2 = DateTime.Now.Day;
                        item2 = queryTime_Month2 = DateTime.Now.Month;
                        item1 = queryTime_Year2 = DateTime.Now.Year;
                        pickerItems_Year = new List<string>();
                        pickerItems_Year.Add("2023");
                        while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
                        {
                            pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
                        }
                        pickerItems_Month = new List<string>();
                        int addMonth = 0;
                        while (DateTime.Now.Month > addMonth)
                        {
                            addMonth++;
                            pickerItems_Month.Add(addMonth.ToString());
                        }
                        pickerItems_Day = new List<string>();
                        int addDay = 0;
                        while (DateTime.Now.Day > addDay)
                        {
                            addDay++;
                            pickerItems_Day.Add(addDay.ToString());
                        }
                        uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day);
                        uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year2.ToString()),
                            pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month2.ToString()),
                            pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day2.ToString()));
                    };
                }
                catch { }
            }
        }
    }
}