| | |
| | | using IStation.ChEr.DAL; |
| | | using IStation.ChEr.Model; |
| | | using IStation.Service; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using Yw; |
| | | using static IStation.Service.SSAPredictHelper; |
| | |
| | | [HttpGet] |
| | | public string LogInfo() |
| | | { |
| | | IStation.LogHelper.Info("info from debug api"); |
| | | |
| | | /* List<WaterPredictRecord> waterPredictRecord = new List<WaterPredictRecord>(); |
| | | ConnectHelper connectHelper = new ConnectHelper(); |
| | | var list = ConnectHelper.ReadPumpAllDayAccOutWater(new DateTime(2023, 1, 1), new DateTime(2023, 11, 14)); |
| | | foreach (var item in list) |
| | | { |
| | | foreach (var item2 in item.pumpOutWater) |
| | | { |
| | | int dayHour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item2.DateTime.Month, item2.DateTime.Day, item2.DateTime.Hour)); |
| | | ConnectHelper connectHelper = new ConnectHelper(); |
| | | var list = ConnectHelper.ReadPumpAllDayAccOutWater(new DateTime(2023, 1, 1), new DateTime(2023, 11, 14)); |
| | | foreach (var item in list) |
| | | { |
| | | foreach (var item2 in item.pumpOutWater) |
| | | { |
| | | int dayHour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item2.DateTime.Month, item2.DateTime.Day, item2.DateTime.Hour)); |
| | | |
| | | waterPredictRecord.Add(new WaterPredictRecord { DayHour = dayHour, RealValue = item2.Total }); |
| | | } |
| | | } |
| | | bll.Inserts(waterPredictRecord);*/ |
| | | //var alllist = bll.GetEnd2Days(300); |
| | | waterPredictRecord.Add(new WaterPredictRecord { DayHour = dayHour, RealValue = item2.Total }); |
| | | } |
| | | } |
| | | bll.Inserts(waterPredictRecord);*/ |
| | | /* List<SSAData> sSADatas = new List<SSAData>(); |
| | | var path = "C:\\Users\\ZKC\\Desktop\\工作簿now.csv"; |
| | | int totalLines = File.ReadLines(path, Encoding.GetEncoding("gb2312")).Count();//总行数 |
| | | System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Open); |
| | | System.IO.StreamReader sr = new System.IO.StreamReader(fs, Encoding.GetEncoding("gb2312")); |
| | | string tempText; |
| | | // int line = 0; |
| | | double total = 0; |
| | | for (int i = 0; i < totalLines; i++) |
| | | { |
| | | tempText = sr.ReadLine(); |
| | | string[] arr = tempText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); |
| | | if (Convert.ToDateTime(arr[0]).Minute == 0) |
| | | { |
| | | sSADatas.Add(new SSAData { DateTime = Convert.ToDateTime(arr[0]), Total = Convert.ToDouble(arr[1]) }); |
| | | } |
| | | } |
| | | var nee = new List<WaterPredictRecord>(); |
| | | double lastValue = 1; |
| | | foreach (var item in sSADatas) |
| | | { |
| | | if (item.DateTime.Minute == 0) |
| | | { |
| | | if (lastValue != 1) |
| | | { |
| | | int historyhour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item.DateTime.Month, item.DateTime.Day, item.DateTime.Hour)); |
| | | nee.Add(new WaterPredictRecord() { DayHour = historyhour, RealValue = item.Total, RealDifferenceValue = item.Total - lastValue }); |
| | | lastValue = item.Total; |
| | | } |
| | | else |
| | | { |
| | | int historyhour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item.DateTime.Month, item.DateTime.Day, item.DateTime.Hour)); |
| | | nee.Add(new WaterPredictRecord() { DayHour = historyhour, RealValue = item.Total, RealDifferenceValue = 0 }); |
| | | lastValue = item.Total; |
| | | } |
| | | } |
| | | } |
| | | bll.Inserts(nee);*/ |
| | | double lastValue = 1; |
| | | var historylist = new List<WaterPredictRecord>(); |
| | | var historydata = ConnectHelper.GetByPumpOneDayWaterData(DateTime.Today.AddDays(-15), DateTime.Today); |
| | | foreach (var item in historydata) |
| | | { |
| | | if (item.DateTime.Minute == 0) |
| | | if (lastValue != 1) |
| | | { |
| | | int historyhour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item.DateTime.Month, item.DateTime.Day, item.DateTime.Hour)); |
| | | historylist.Add(new WaterPredictRecord() { DayHour = historyhour, RealValue = item.Total }); |
| | | historylist.Add(new WaterPredictRecord() { DayHour = historyhour, RealValue = item.Total, RealDifferenceValue = item.Total - lastValue }); |
| | | lastValue = item.Total; |
| | | } |
| | | else |
| | | { |
| | | int historyhour = int.Parse(string.Format("{0:00}{1:00}{2:00}", item.DateTime.Month, item.DateTime.Day, item.DateTime.Hour)); |
| | | historylist.Add(new WaterPredictRecord() { DayHour = historyhour, RealValue = item.Total, RealDifferenceValue = 0 }); |
| | | lastValue = item.Total; |
| | | } |
| | | } |
| | | |
| | | bll.Inserts(historylist); |
| | | // int a = 0; |
| | | /* for (DateTime i = DateTime.Today.AddDays(-12); i < DateTime.Today; i = i.AddDays(1)) |
| | |
| | | for (int i = 0; i < currentdata.Count; i++) |
| | | { |
| | | currentdata[i].RealValue = todayData[i].Total; |
| | | if (i >= 1) |
| | | { |
| | | currentdata[i].RealDifferenceValue = todayData[i].Total - todayData[i - 1].Total; |
| | | } |
| | | else |
| | | { |
| | | // currentdata[i].RealDifferenceValue = todayData[i].Total-bll.GetEnd2Days(24).Last().RealValue; |
| | | } |
| | | } |
| | | bll.UpdatesRealValue(currentdata); |
| | | return "ok"; |