public ActionResult Orders_Read3(string[] sdatepic, string[] edatepic, string[] datazl) { 数据库处理 sjkcl = new 数据库处理(); List <资料种类> dataLists = dataLists = sjkcl.获取数据库表信息(); List <SKViewModel> result = new List <SKViewModel>(); if (datazl == null || datazl.Length == 0) { result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0])); } else { bool bs = false; foreach (string item in datazl) { if (item.ToLower() == "all") { bs = true; } } if (bs) { result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0])); } else { string filter = ""; foreach (string item in datazl) { filter += $"\'{item}\',"; } filter = filter.Substring(0, filter.Length - 1); result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0]), filter); } } for (int i = 0; i < result.Count; i++) { 资料种类 item = dataLists.First(y => y.数据库表名称 == result[i].称); if (item != null) { result[i].称 = item.表名称; } } return(Json(result)); }
public ActionResult 当前小时分钟数据() { string[] datazl = "SK_Other_Minute,SK_Pre_Minute,SK_RHU_Minute,SK_PRS_Minute,SK_Tem_Minute,SK_Wind_Minute".Split(','); 数据库处理 sjkcl = new 数据库处理(); List <资料种类> dataLists = sjkcl.获取数据库表信息(); List <SKViewModel> result = new List <SKViewModel>(); string filter = ""; foreach (string item in datazl) { filter += $"\'{item}\',"; } filter = filter.Substring(0, filter.Length - 1); result = sjkcl.获取指定时间统计信息(DateTime.Now.Date.AddHours(DateTime.Now.Hour), DateTime.Now, filter); List <DateTime> dateTimes = new List <DateTime>(); foreach (var item in result) { if (!dateTimes.Exists(y => y == item.时间)) { dateTimes.Add(Convert.ToDateTime(item.时间)); } } foreach (string item in datazl) { foreach (DateTime mydt in dateTimes) { if (!result.Exists(y => y.时间 == mydt && y.称 == item)) { result.Add(new SKViewModel { 时间 = mydt, 称 = item, 统计个数 = 0 }); } } } for (int i = 0; i < result.Count; i++) { 资料种类 item = dataLists.First(y => y.数据库表名称 == result[i].称); if (item != null) { result[i].称 = item.表名称; } } return(Json(result)); }
public ActionResult 备用(string[] sdatepic, string[] edatepic, string[] datazl, [DataSourceRequest] DataSourceRequest request) { 数据库处理 sjkcl = new 数据库处理(); List <资料种类> dataLists = dataLists = sjkcl.获取数据库表信息(); List <SKViewModel> result = new List <SKViewModel>(); if (datazl == null || datazl.Length == 0) { result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0])); } else { bool bs = false; foreach (string item in datazl) { if (item.ToLower() == "all") { bs = true; } } if (bs) { result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0])); } else { string filter = ""; foreach (string item in datazl) { filter += $"\'{item}\',"; } filter = filter.Substring(0, filter.Length - 1); result = sjkcl.获取指定时间统计信息(Convert.ToDateTime(sdatepic[0]), Convert.ToDateTime(edatepic[0]), filter); } } for (int i = 0; i < result.Count; i++) { 资料种类 item = dataLists.First(y => y.数据库表名称 == result[i].称); if (item != null) { result[i].称 = item.表名称; if (result[i].称.Contains("分钟")) { result[i].种类 = "分钟"; } else if (result[i].称.Contains("小时")) { result[i].种类 = "小时"; } else { result[i].种类 = "其他"; } } } List <SKViewModel> result2 = new List <SKViewModel>(); foreach (var item in result) { string name = item.称.Replace("小时", "").Replace("分钟", ""); if (!result2.Exists(y => y.称 == name && y.时间 == item.时间)) { result2.Add(new SKViewModel() { 称 = name, 时间 = item.时间 });; } if (item.种类 == "分钟") { result2.First(y => y.称 == name && y.时间 == item.时间).分钟个数 = item.统计个数; } else { result2.First(y => y.称 == name && y.时间 == item.时间).小时个数 = item.统计个数; } } //result = result.Where(y => y.名称.Contains("小时")).ToList(); return(Json(result2)); }