修改能效接口

This commit is contained in:
xukanghao 2024-06-05 09:25:18 +08:00
parent 2bcd7112ee
commit ca306e8088
24 changed files with 632 additions and 39 deletions

Binary file not shown.

View File

@ -113,7 +113,7 @@ namespace JinanCementFactoryAPI.Controllers.api
num2+= Convert.ToDecimal(zlist1.XValue);
}
}
model.ClinkerValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((num1-num2) * Convert.ToDecimal(0.5703) + (anum-bnum) * Convert.ToDecimal(0.02610)),3));
model.ClinkerValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((num1-num2) * Convert.ToDecimal(0.5568) + (anum-bnum) * Convert.ToDecimal(0.02610)),3));
alist.Add(model);
}
}
@ -200,7 +200,7 @@ namespace JinanCementFactoryAPI.Controllers.api
num2 += Convert.ToDecimal(zlist1.XValue);
}
}
model.ClinkerValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((num1 - num2) * Convert.ToDecimal(0.5703) + (anum - bnum) * Convert.ToDecimal(0.02610)),3));
model.ClinkerValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((num1 - num2) * Convert.ToDecimal(0.5568) + (anum - bnum) * Convert.ToDecimal(0.02610)),3));
alist.Add(model);
}
}

View File

@ -71,7 +71,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b += Convert.ToDecimal(item.XValue);
}
model1.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a - b) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model1.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a - b) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model1);
var model2 = new firm_boundaryData();
model2.DoundaryName = "破碎";
@ -89,7 +89,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b1 += Convert.ToDecimal(item.XValue);
}
model2.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a1 - b1) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model2.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a1 - b1) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model2);
var model3 = new firm_boundaryData();
model3.DoundaryName = "熟料";
@ -107,7 +107,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b2 += Convert.ToDecimal(item.XValue);
}
model3.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a2 - b2) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model3.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a2 - b2) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model3);
var model4 = new firm_boundaryData();
model4.DoundaryName = "粉磨";
@ -121,7 +121,7 @@ namespace JinanCementFactoryAPI.Controllers.api
a3 += Convert.ToDecimal(item.XValue);
}
var flist2 = bll_gw.GetModelListsDate(fslist, ytime).Where(x => x.XTimeStamp == Convert.ToDateTime(ydate)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
model4.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a3 - b3) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model4.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a3 - b3) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model4);
var model5 = new firm_boundaryData();
model5.DoundaryName = "辅助生产系统";
@ -139,7 +139,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b4 += Convert.ToDecimal(item.XValue);
}
model5.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a4 - b4) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model5.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a4 - b4) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model5);
var model6 = new firm_boundaryData();
model6.DoundaryName = "办公生活";
@ -158,7 +158,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b5 += Convert.ToDecimal(item.XValue);
}
model6.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a5 - b5) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model6.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a5 - b5) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model6);
res.code = 200;
res.msg = "成功";
@ -197,7 +197,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b += Convert.ToDecimal(item.XValue);
}
model1.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a - b) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model1.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a - b) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model1);
var model2 = new firm_boundaryData();
model2.DoundaryName = "破碎";
@ -215,7 +215,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b1 += Convert.ToDecimal(item.XValue);
}
model2.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a1 - b1) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model2.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a1 - b1) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model2);
var model3 = new firm_boundaryData();
model3.DoundaryName = "熟料";
@ -233,7 +233,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b2 += Convert.ToDecimal(item.XValue);
}
model3.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a2 - b2) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model3.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a2 - b2) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model3);
var model4 = new firm_boundaryData();
model4.DoundaryName = "粉磨";
@ -247,7 +247,7 @@ namespace JinanCementFactoryAPI.Controllers.api
a3 += Convert.ToDecimal(item.XValue);
}
var flist2=bll_gw.GetModelListsDate(fslist,stime).Where(x=>x.XTimeStamp==Convert.ToDateTime(mdate)).GroupBy(x=>x.XTagName).Select(g=>g.OrderByDescending(x=>x.XTimeStamp).FirstOrDefault()).ToList();
model4.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a3 - b3) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model4.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a3 - b3) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model4);
var model5 = new firm_boundaryData();
model5.DoundaryName = "辅助生产系统";
@ -265,7 +265,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b4 += Convert.ToDecimal(item.XValue);
}
model5.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a4 - b4) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model5.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a4 - b4) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model5);
var model6 = new firm_boundaryData();
model6.DoundaryName = "办公生活";
@ -284,7 +284,7 @@ namespace JinanCementFactoryAPI.Controllers.api
{
b5 += Convert.ToDecimal(item.XValue);
}
model6.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a5 - b5) * Convert.ToDecimal(0.5703) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
model6.DoundaryValue =Convert.ToDecimal(Math.Round(Convert.ToDouble((a5 - b5) * Convert.ToDecimal(0.5568) + (num1 - num2) * Convert.ToDecimal(0.02610)),3));
alist.Add(model6);
res.code = 200;
res.msg = "成功";

View File

@ -2,6 +2,7 @@
using Microsoft.Ajax.Utilities;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@ -16,29 +17,620 @@ namespace JinanCementFactoryAPI.Controllers.api
/// </summary>
public class GetMultiRateController : ApiController
{
DataServer.BLL.multi_rate bll = new DataServer.BLL.multi_rate();
//DataServer.BLL.multi_rate bll = new DataServer.BLL.multi_rate();
DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment();
DataServer.BLL.gw_data bll_gw = new DataServer.BLL.gw_data();
// GET api/<controller>
public HttpResponseMessage Get()
{
var res = new get_multi_rate();
try
{
var list = bll.GetModelList("");
var list = bll.GetModelList(" EquipmentName='总降电力室'").Select(x=>x.EH).ToList();
var slist=string.Join(",", list);
var data = new List<multi_rateData>();
var now = DateTime.Now;
for(var i = 0; i < 6; i++)
{
var sdate = now.AddMonths(-i).ToString("yyyy-MM-01 00:00:00");
var sdate = now.AddMonths(-i).ToString("yyyy-MM-dd 00:00:00");
if (Convert.ToInt32(Convert.ToDateTime(sdate).Month) != now.Month)
{
sdate = now.AddMonths(-i).ToString("yyyy-MM-01 00:00:00");
}
var edate = now.AddMonths(-i + 1).ToString("yyyy-MM-01 00:00:00");
var alist = list.Where(x => x.CreateTime >= Convert.ToDateTime(sdate) && x.CreateTime < Convert.ToDateTime(edate)).DistinctBy(x=>x.CreateTime).FirstOrDefault();
var model = new multi_rateData();
model.time=Convert.ToDateTime(sdate).ToString("MM");
model.needle = alist.Needle;
model.peak = alist.Peak;
model.flat= alist.Flat;
model.grain= alist.Grain;
model.deep= alist.Deep;
data.Add(model);
var month = Convert.ToInt32(Convert.ToDateTime(sdate).Month);
if (month == 3 || month == 4 || month == 5)
{
//春季
//谷
var grainstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var grainstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 11:00:00");
var grainstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 14:00:00");
var grainstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var grainetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var grainetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 11:00:00");
var grainetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 14:00:00");
var grainetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
//平
var flatstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var flatstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var flatstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 17:00:00");
var flatstime5 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 22:00:00");
var flatstime6 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
var flatetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var flatetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
var flatetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 17:00:00");
var flatetime5 =Convert.ToDateTime(Convert.ToDateTime(edate).ToString("yyyy-MM-dd 22:00:00"));
var flatetime6 =Convert.ToDateTime(Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00"));
//尖
var needlestime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 17:00:00");
var needlestime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 20:00:00");
var needlestime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 22:00:00");
var needleetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 17:00:00");
var needleetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 20:00:00");
var needleetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 22:00:00");
var stime = Convert.ToDateTime(sdate).ToString("yyyy_M");
var etime = Convert.ToDateTime(edate).ToString("yyyy_M");
//谷
var grainslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime1) && x.XTimeStamp < Convert.ToDateTime(grainstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var grainelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime1) && x.XTimeStamp < Convert.ToDateTime(grainetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//深
var deepslist= bll_gw.GetModelListsDate(slist,stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime2) && x.XTimeStamp < Convert.ToDateTime(grainstime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var deepelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime2) && x.XTimeStamp < Convert.ToDateTime(grainetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//尖
var needleslist= bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime1) && x.XTimeStamp < Convert.ToDateTime(needlestime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var needleelist= bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime1) && x.XTimeStamp < Convert.ToDateTime(needleetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//峰
var peakslist= bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime2) && x.XTimeStamp < Convert.ToDateTime(needlestime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var peakelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime2) && x.XTimeStamp < Convert.ToDateTime(needleetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//平
var flatslist1= bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime1) && x.XTimeStamp < Convert.ToDateTime(flatstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist2 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime3) && x.XTimeStamp < Convert.ToDateTime(flatstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist3 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime5) && x.XTimeStamp < Convert.ToDateTime(flatstime6)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist1 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime1) && x.XTimeStamp < Convert.ToDateTime(flatetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist2 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime3) && x.XTimeStamp < Convert.ToDateTime(flatetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist3 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= flatetime5 && x.XTimeStamp < flatetime6).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//谷
decimal? grain1 = 0;
decimal? grain2 = 0;
//深
decimal? deep1 = 0;
decimal? deep2 = 0;
//尖
decimal? needle1 = 0;
decimal? needle2 = 0;
//峰
decimal? peak1 = 0;
decimal? peak2 = 0;
//平
decimal? flat1 = 0;
decimal? flat2 = 0;
//谷
foreach (var item in grainslist)
{
grain1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in grainelist)
{
grain2 += Convert.ToDecimal(item.XValue);
}
//深
foreach (var item in deepslist)
{
deep1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in deepelist)
{
deep2 += Convert.ToDecimal(item.XValue);
}
//尖
foreach (var item in needleslist)
{
needle1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in needleelist)
{
needle2 += Convert.ToDecimal(item.XValue);
}
//峰
foreach (var item in peakslist)
{
peak1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in peakelist)
{
peak2 += Convert.ToDecimal(item.XValue);
}
//平
foreach (var item in flatslist1)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist2)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist3)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist1)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist2)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist3)
{
flat2 += Convert.ToDecimal(item.XValue);
}
var model = new multi_rateData();
model.time = Convert.ToDateTime(sdate).ToString("MM");
model.needle = needle1 - needle2;
model.peak = peak1-peak2;
model.flat = flat1-flat2;
model.grain = grain1- grain2;
model.deep = deep1-deep2;
data.Add(model);
}
else if (month == 6 || month == 7 || month == 8)
{
//夏季
//谷
var grainstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var grainstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 06:00:00");
var grainetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
var grainetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 06:00:00");
//平
var flatstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 06:00:00");
var flatstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var flatstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 22:00:00");
var flatstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 06:00:00");
var flatetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var flatetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 22:00:00");
var flatetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
//尖
var needlestime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var needlestime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 17:00:00");
var needlestime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 22:00:00");
var needleetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var needleetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 17:00:00");
var needleetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 22:00:00");
var stime = Convert.ToDateTime(sdate).ToString("yyyy_M");
var etime = Convert.ToDateTime(edate).ToString("yyyy_M");
//谷
var grainslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime1) && x.XTimeStamp < Convert.ToDateTime(grainstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var grainelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime1) && x.XTimeStamp < Convert.ToDateTime(grainetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//深
//var deepslist = bll_gw.GetModelListDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime1) && x.XTimeStamp < Convert.ToDateTime(grainstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//var deepelist = bll_gw.GetModelListDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime2) && x.XTimeStamp < Convert.ToDateTime(grainetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//尖
var needleslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime1) && x.XTimeStamp < Convert.ToDateTime(needlestime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var needleelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime1) && x.XTimeStamp < Convert.ToDateTime(needleetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//峰
var peakslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime2) && x.XTimeStamp < Convert.ToDateTime(needlestime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var peakelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime2) && x.XTimeStamp < Convert.ToDateTime(needleetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//平
var flatslist1 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime1) && x.XTimeStamp < Convert.ToDateTime(flatstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist2 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime3) && x.XTimeStamp < Convert.ToDateTime(flatstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist1 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime1) && x.XTimeStamp < Convert.ToDateTime(flatetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist2 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime3) && x.XTimeStamp < Convert.ToDateTime(flatetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//谷
decimal? grain1 = 0;
decimal? grain2 = 0;
//深
decimal? deep1 = 0;
decimal? deep2 = 0;
//尖
decimal? needle1 = 0;
decimal? needle2 = 0;
//峰
decimal? peak1 = 0;
decimal? peak2 = 0;
//平
decimal? flat1 = 0;
decimal? flat2 = 0;
//谷
foreach (var item in grainslist)
{
grain1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in grainelist)
{
grain2 += Convert.ToDecimal(item.XValue);
}
#region
//深
//foreach (var item in deepslist)
//{
// deep1 += Convert.ToDecimal(item.XValue);
//}
//foreach (var item in deepelist)
//{
// deep2 += Convert.ToDecimal(item.XValue);
//}
#endregion
//尖
foreach (var item in needleslist)
{
needle1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in needleelist)
{
needle2 += Convert.ToDecimal(item.XValue);
}
//峰
foreach (var item in peakslist)
{
peak1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in peakelist)
{
peak2 += Convert.ToDecimal(item.XValue);
}
//平
foreach (var item in flatslist1)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist2)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist1)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist2)
{
flat2 += Convert.ToDecimal(item.XValue);
}
var model = new multi_rateData();
model.time = Convert.ToDateTime(sdate).ToString("MM");
model.needle = needle1 - needle2;
model.peak = peak1 - peak2;
model.flat = flat1 - flat2;
model.grain = grain1 - grain2;
model.deep = deep1 - deep2;
data.Add(model);
}
else if (month == 9 || month == 10 || month == 11)
{
//秋季
//谷
var grainstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var grainstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 11:00:00");
var grainstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 14:00:00");
var grainstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var grainetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var grainetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 11:00:00");
var grainetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 14:00:00");
var grainetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
//平
var flatstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var flatstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var flatstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var flatstime5 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 21:00:00");
var flatstime6 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
var flatetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var flatetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
var flatetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var flatetime5 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 21:00:00");
var flatetime6 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
//尖
var needlestime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var needlestime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 17:00:00");
var needlestime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 19:00:00");
var needlestime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 21:00:00");
var needleetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var needleetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 17:00:00");
var needleetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 19:00:00");
var needleetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 21:00:00");
var stime = Convert.ToDateTime(sdate).ToString("yyyy_M");
if (month == 10||month==11)
{
stime= Convert.ToDateTime(sdate).ToString("yyyy_MM");
}
var etime = Convert.ToDateTime(edate).ToString("yyyy_M");
if(month== 10 || month == 11)
{
etime = Convert.ToDateTime(edate).ToString("yyyy_MM");
}
//谷
var grainslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime1) && x.XTimeStamp < Convert.ToDateTime(grainstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var grainelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime1) && x.XTimeStamp < Convert.ToDateTime(grainetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//深
var deepslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime2) && x.XTimeStamp < Convert.ToDateTime(grainstime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var deepelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime2) && x.XTimeStamp < Convert.ToDateTime(grainetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//尖
var needleslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime2) && x.XTimeStamp < Convert.ToDateTime(needlestime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var needleelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime2) && x.XTimeStamp < Convert.ToDateTime(needleetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//峰
var peakslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime1) && x.XTimeStamp < Convert.ToDateTime(needlestime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var peakelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime1) && x.XTimeStamp < Convert.ToDateTime(needleetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//平
var flatslist1 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime1) && x.XTimeStamp < Convert.ToDateTime(flatstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist2 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime3) && x.XTimeStamp < Convert.ToDateTime(flatstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist3 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime5) && x.XTimeStamp < Convert.ToDateTime(flatstime6)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist1 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime1) && x.XTimeStamp < Convert.ToDateTime(flatetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist2 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime3) && x.XTimeStamp < Convert.ToDateTime(flatetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist3 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime5) && x.XTimeStamp < Convert.ToDateTime(flatetime6)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//谷
decimal? grain1 = 0;
decimal? grain2 = 0;
//深
decimal? deep1 = 0;
decimal? deep2 = 0;
//尖
decimal? needle1 = 0;
decimal? needle2 = 0;
//峰
decimal? peak1 = 0;
decimal? peak2 = 0;
//平
decimal? flat1 = 0;
decimal? flat2 = 0;
//谷
foreach (var item in grainslist)
{
grain1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in grainelist)
{
grain2 += Convert.ToDecimal(item.XValue);
}
//深
foreach (var item in deepslist)
{
deep1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in deepelist)
{
deep2 += Convert.ToDecimal(item.XValue);
}
//尖
foreach (var item in needleslist)
{
needle1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in needleelist)
{
needle2 += Convert.ToDecimal(item.XValue);
}
//峰
foreach (var item in peakslist)
{
peak1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in peakelist)
{
peak2 += Convert.ToDecimal(item.XValue);
}
//平
foreach (var item in flatslist1)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist2)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist3)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist1)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist2)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist3)
{
flat2 += Convert.ToDecimal(item.XValue);
}
var model = new multi_rateData();
model.time = Convert.ToDateTime(sdate).ToString("MM");
model.needle = needle1 - needle2;
model.peak = peak1 - peak2;
model.flat = flat1 - flat2;
model.grain = grain1 - grain2;
model.deep = deep1 - deep2;
data.Add(model);
}
else if (month == 12 || month == 1 || month == 2)
{
//冬季
//谷
var grainstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var grainstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 11:00:00");
var grainstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 14:00:00");
var grainstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var grainetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var grainetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 11:00:00");
var grainetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 14:00:00");
var grainetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
//平
var flatstime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatstime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 10:00:00");
var flatstime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 15:00:00");
var flatstime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var flatstime5 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 21:00:00");
var flatstime6 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 00:00:00");
var flatetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
var flatetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 10:00:00");
var flatetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 15:00:00");
var flatetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var flatetime5 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 21:00:00");
var flatetime6 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 00:00:00");
//尖
var needlestime1 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var needlestime2 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 16:00:00");
var needlestime3 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 19:00:00");
var needlestime4 = Convert.ToDateTime(sdate).ToString("yyyy-MM-dd 21:00:00");
var needleetime1 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var needleetime2 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 16:00:00");
var needleetime3 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 19:00:00");
var needleetime4 = Convert.ToDateTime(edate).ToString("yyyy-MM-dd 21:00:00");
var stime = Convert.ToDateTime(sdate).ToString("yyyy_M");
if (month == 12)
{
stime = Convert.ToDateTime(sdate).ToString("yyyy_MM");
}
var etime = Convert.ToDateTime(edate).ToString("yyyy_M");
//谷
var grainslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime1) && x.XTimeStamp < Convert.ToDateTime(grainstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var grainelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime1) && x.XTimeStamp < Convert.ToDateTime(grainetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//深
var deepslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainstime2) && x.XTimeStamp < Convert.ToDateTime(grainstime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var deepelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(grainetime2) && x.XTimeStamp < Convert.ToDateTime(grainetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//尖
var needleslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime2) && x.XTimeStamp < Convert.ToDateTime(needlestime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var needleelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime2) && x.XTimeStamp < Convert.ToDateTime(needleetime3)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//峰
var peakslist = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needlestime1) && x.XTimeStamp < Convert.ToDateTime(needlestime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var peakelist = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(needleetime1) && x.XTimeStamp < Convert.ToDateTime(needleetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//平
var flatslist1 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime1) && x.XTimeStamp < Convert.ToDateTime(flatstime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist2 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime3) && x.XTimeStamp < Convert.ToDateTime(flatstime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatslist3 = bll_gw.GetModelListsDate(slist, stime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatstime5) && x.XTimeStamp < Convert.ToDateTime(flatstime6)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist1 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime1) && x.XTimeStamp < Convert.ToDateTime(flatetime2)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist2 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime3) && x.XTimeStamp < Convert.ToDateTime(flatetime4)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
var flatelist3 = bll_gw.GetModelListsDate(slist, etime).Where(x => x.XTimeStamp >= Convert.ToDateTime(flatetime5) && x.XTimeStamp < Convert.ToDateTime(flatetime6)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
//谷
decimal? grain1 = 0;
decimal? grain2 = 0;
//深
decimal? deep1 = 0;
decimal? deep2 = 0;
//尖
decimal? needle1 = 0;
decimal? needle2 = 0;
//峰
decimal? peak1 = 0;
decimal? peak2 = 0;
//平
decimal? flat1 = 0;
decimal? flat2 = 0;
//谷
foreach (var item in grainslist)
{
grain1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in grainelist)
{
grain2 += Convert.ToDecimal(item.XValue);
}
//深
foreach (var item in deepslist)
{
deep1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in deepelist)
{
deep2 += Convert.ToDecimal(item.XValue);
}
//尖
foreach (var item in needleslist)
{
needle1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in needleelist)
{
needle2 += Convert.ToDecimal(item.XValue);
}
//峰
foreach (var item in peakslist)
{
peak1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in peakelist)
{
peak2 += Convert.ToDecimal(item.XValue);
}
//平
foreach (var item in flatslist1)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist2)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatslist3)
{
flat1 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist1)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist2)
{
flat2 += Convert.ToDecimal(item.XValue);
}
foreach (var item in flatelist3)
{
flat2 += Convert.ToDecimal(item.XValue);
}
var model = new multi_rateData();
model.time = Convert.ToDateTime(sdate).ToString("MM");
model.needle = needle1 - needle2;
model.peak = peak1 - peak2;
model.flat = flat1 - flat2;
model.grain = grain1 - grain2;
model.deep = deep1 - deep2;
data.Add(model);
}
}
res.code = 200;
res.msg = "成功";

View File

@ -68,10 +68,11 @@ namespace JinanCementFactoryAPI.Controllers.api
var snnum = num1 - num3;
var slnum = num2 - num4;
var model = new unit_consumptionData();
model.CementConsumption = snnum;
model.CementitiousElectricity = snnum;
model.ClinkerConsumption = slnum;
model.ClinkerElectricity = slnum;
var c =Convert.ToDecimal(0.1229);
model.CementConsumption =snnum*c;
model.CementitiousElectricity = snnum*c;
model.ClinkerConsumption = slnum*c;
model.ClinkerElectricity = slnum*c;
model.ClinkerCoal=Convert.ToDecimal(Math.Round( Convert.ToDouble(slnum * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12),3));
data.Add(model);
res.code = 200;

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>E:\林谷项目\济南水泥厂项目\发布文件</_PublishTargetUrl>
<History>True|2024-03-25T06:39:12.9012874Z;True|2024-03-20T16:31:47.7470952+08:00;True|2024-03-20T10:27:05.7350315+08:00;True|2024-03-19T10:03:42.8595949+08:00;True|2024-03-18T15:23:16.2391769+08:00;True|2024-01-30T17:18:04.1029630+08:00;True|2024-01-30T10:52:43.5964468+08:00;True|2024-01-29T13:55:44.0819864+08:00;True|2024-01-15T15:09:05.3782932+08:00;True|2024-01-03T14:38:44.4826705+08:00;True|2023-12-15T09:15:49.5317563+08:00;</History>
<History>True|2024-05-29T05:06:31.1558444Z;True|2024-05-20T09:53:04.2405375+08:00;True|2024-03-25T14:39:12.9012874+08:00;True|2024-03-20T16:31:47.7470952+08:00;True|2024-03-20T10:27:05.7350315+08:00;True|2024-03-19T10:03:42.8595949+08:00;True|2024-03-18T15:23:16.2391769+08:00;True|2024-01-30T17:18:04.1029630+08:00;True|2024-01-30T10:52:43.5964468+08:00;True|2024-01-29T13:55:44.0819864+08:00;True|2024-01-15T15:09:05.3782932+08:00;True|2024-01-03T14:38:44.4826705+08:00;True|2023-12-15T09:15:49.5317563+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
@ -88,10 +88,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>03/20/2024 16:31:46</publishTime>
</File>
<File Include="bin/JinanCementFactoryAPI.dll">
<publishTime>03/25/2024 14:39:12</publishTime>
<publishTime>05/29/2024 13:06:30</publishTime>
</File>
<File Include="bin/JinanCementFactoryAPI.pdb">
<publishTime>03/25/2024 14:39:12</publishTime>
<publishTime>05/29/2024 13:06:30</publishTime>
</File>
<File Include="bin/Maticsoft.Common.dll">
<publishTime>12/13/2023 14:16:06</publishTime>
@ -418,7 +418,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>03/18/2024 16:49:03</publishTime>
</File>
<File Include="Controllers/api/GetClinkerBoundaryController.cs">
<publishTime>03/25/2024 14:32:38</publishTime>
<publishTime>05/28/2024 15:07:45</publishTime>
</File>
<File Include="Controllers/api/GetCoalMonitoringController.cs">
<publishTime>03/18/2024 16:49:03</publishTime>
@ -478,7 +478,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>03/25/2024 11:11:59</publishTime>
</File>
<File Include="Controllers/api/GetFirmBoundaryController.cs">
<publishTime>03/25/2024 11:11:53</publishTime>
<publishTime>05/28/2024 15:07:45</publishTime>
</File>
<File Include="Controllers/api/GetFlexibleAdjustableLoadController.cs">
<publishTime>03/25/2024 11:16:54</publishTime>
@ -547,7 +547,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>03/25/2024 14:14:06</publishTime>
</File>
<File Include="Controllers/api/GetMultiRateController.cs">
<publishTime>03/25/2024 14:14:06</publishTime>
<publishTime>05/29/2024 11:03:51</publishTime>
</File>
<File Include="Controllers/api/GetOneContrastController.cs">
<publishTime>03/25/2024 14:14:06</publishTime>
@ -676,7 +676,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>03/25/2024 14:36:53</publishTime>
</File>
<File Include="Controllers/api/GetUnitConsumptionController.cs">
<publishTime>03/25/2024 14:36:53</publishTime>
<publishTime>05/20/2024 10:44:25</publishTime>
</File>
<File Include="Controllers/api/GetUnitExceptionController.cs">
<publishTime>03/25/2024 14:36:53</publishTime>
@ -763,7 +763,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>12/13/2023 15:43:02</publishTime>
</File>
<File Include="Views/Shared/_Layout.cshtml">
<publishTime>03/07/2024 16:53:42</publishTime>
<publishTime>03/29/2024 14:09:58</publishTime>
</File>
<File Include="Views/Web.config">
<publishTime>12/13/2023 15:43:02</publishTime>

View File

@ -17,7 +17,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@https://localhost:44352/
<a href="https://localhost:44352/" class="navbar-brand">应用程序名称</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">