| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | public class WetarHeaterJinmaoHistoryPage : FrameLayout |
| | | { |
| | | WetarHeaterJinmaoHistoryPage bodyView; |
| | | Function device; |
| | | Function function; |
| | | FrameLayout infoView1; |
| | | EchartsOption_Histogram tempEchartOption; |
| | | 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; |
| | | |
| | | /// <summary> |
| | | /// echart容器 |
| | | /// </summary> |
| | | MyEchartsViewOn tempEchartsView; |
| | | |
| | | public WetarHeaterJinmaoHistoryPage(Function function) |
| | | 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; |
| | | |
| | | |
| | | public WetarHeaterJinmaoHistoryPage(Function deviceFunction) |
| | | { |
| | | bodyView = this; |
| | | device = function; |
| | | function = deviceFunction; |
| | | this.BackgroundColor = CSS_Color.BackgroundColor; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | var topView = new TopViewDiv(bodyView, device.name); |
| | | var topView = new TopViewDiv(bodyView, function.name); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | #region 温度值 |
| | | var infoView1 = new FrameLayout() |
| | | infoView1 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(382), |
| | |
| | | }; |
| | | infoView1.AddChidren(infoView1_DateView); |
| | | |
| | | var infoView1_Date_Day = new Button() |
| | | infoView1_Date_Day = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(103), |
| | | Height = Application.GetRealWidth(26), |
| | |
| | | }; |
| | | 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), |
| | |
| | | }; |
| | | 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), |
| | |
| | | }; |
| | | 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), |
| | |
| | | }; |
| | | infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextIconButton); |
| | | |
| | | var infoView1_DateInfo_NextClickButton = new Button() |
| | | infoView1_DateInfo_NextClickButton = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(32 + 6), |
| | | }; |
| | |
| | | #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>() |
| | | tempEchartOption = new EchartsOption_Histogram(); |
| | | tempEchartOption.xTitle = "时间"; |
| | | tempEchartOption.yTitle = "温度(℃)"; |
| | | tempEchartOption.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>() { |
| | | tempEchartOption.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 = "23", fieldValue= "11" }, |
| | | new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" }, |
| | | }); |
| | | var ddd = echartOption.InitOption(); |
| | | var ddd = tempEchartOption.InitOption(); |
| | | infoView1_EchartsView.ShowWithOption(ddd); |
| | | |
| | | infoView1.AddChidren(new Button() |
| | |
| | | }); |
| | | |
| | | #region 用水量 |
| | | var infoView2 = new FrameLayout() |
| | | |
| | | infoView2 = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(382), |
| | |
| | | }; |
| | | infoView2.AddChidren(infoView2_DateView); |
| | | |
| | | var infoView2_Date_Day = new Button() |
| | | infoView2_Date_Day = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(103), |
| | | Height = Application.GetRealWidth(26), |
| | |
| | | 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), |
| | |
| | | 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), |
| | |
| | | }; |
| | | 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), |
| | |
| | | }; |
| | | infoView2_DateInfoView.AddChidren(infoView2_DateInfo_DateTextButton); |
| | | |
| | | |
| | | var infoView2_DateInfo_NextIconButton = new Button() |
| | | { |
| | | X = Application.GetRealWidth(343 - 18 - 6), |
| | |
| | | }; |
| | | infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextIconButton); |
| | | |
| | | var infoView2_DateInfo_NextClickButton = new Button() |
| | | infoView2_DateInfo_NextClickButton = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(32 + 6), |
| | | }; |
| | |
| | | #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.yTitle = "用水量(t)"; |
| | | echartOption2.InitXdataText(new List<string>() |
| | | { |
| | | "21","22","23","24","25","26","26","27","28","29", |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 读取温度值历史数据 |
| | | /// </summary> |
| | | private void getTempHistory(string queryType) |
| | | { |
| | | var loadPage = new Loading() |
| | | { |
| | | LodingBackgroundColor = 0x88888888, |
| | | }; |
| | | infoView1.AddChidren(loadPage); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loadPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | |
| | | var revertObj = new HttpServerRequest().GetSensorHistory(queryType, function.deviceId, WaterHeaterJinmao_AttrEnum.temp.ToString()); |
| | | 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); |
| | | } |
| | | tempEchartOption.InitXdataText(vs); |
| | | tempEchartOption.InitYdataText(revertData); |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | infoView1_EchartsView.ShowWithOption(tempEchartOption.InitOption()); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"history error : {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loadPage.Hide(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取用水量历史记录 |
| | | /// </summary> |
| | | /// <param name="queryType"></param> |
| | | private void getWaterHistory(string queryType) |
| | | { |
| | | var loadPage = new Loading() |
| | | { |
| | | LodingBackgroundColor = 0x88888888, |
| | | }; |
| | | infoView2.AddChidren(loadPage); |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loadPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | }); |
| | | |
| | | var revertObj = new HttpServerRequest().GetSensorHistory(queryType, function.deviceId, WaterHeaterJinmao_AttrEnum.volume.ToString()); |
| | | 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(() => |
| | | { |
| | | 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_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; |
| | | //getTempHistory("day") |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |