108 lines
4.4 KiB
C#
108 lines
4.4 KiB
C#
using DataServer.api;
|
|
using Microsoft.Ajax.Utilities;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
|
|
namespace JinanCementFactoryAPI.Controllers.api
|
|
{
|
|
/// <summary>
|
|
/// 熟料边界总览
|
|
/// </summary>
|
|
public class GetClinkerBoundaryController : ApiController
|
|
{
|
|
DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment();
|
|
DataServer.BLL.coal_equipment bll_coal=new DataServer.BLL.coal_equipment();
|
|
// GET api/<controller>
|
|
public HttpResponseMessage Get(string date="")
|
|
{
|
|
var res = new get_clinker_boundary();
|
|
try
|
|
{
|
|
var list = bll.GetModelList("").Where(x=>x.EquipmentName.Contains("熟料")).ToList();
|
|
var clist = bll_coal.GetModelList("");
|
|
var alist = new List<clinker_boundaryData>();
|
|
if (date == "年")
|
|
{
|
|
decimal? num = 0;
|
|
foreach (var item in clist)
|
|
{
|
|
num += item.CoalValue;
|
|
}
|
|
foreach (var item in list.DistinctBy(x => x.EquipmentName))
|
|
{
|
|
var model = new clinker_boundaryData();
|
|
decimal? num1 = 0;
|
|
if (item.EquipmentName == "一号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "一号线熟料排放量";
|
|
}
|
|
if (item.EquipmentName == "二号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "二号线熟料排放量";
|
|
}
|
|
if (item.EquipmentName == "三号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "三号线熟料排放量";
|
|
}
|
|
var list1 = bll.GetModelList("").Where(x => x.EquipmentName == item.EquipmentName).ToList();
|
|
foreach (var aitem in list1)
|
|
{
|
|
num1 += item.EH;
|
|
}
|
|
model.ClinkerValue = num1 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610);
|
|
alist.Add(model);
|
|
}
|
|
}
|
|
if (date == "月")
|
|
{
|
|
decimal? num = 0;
|
|
foreach (var item in clist)
|
|
{
|
|
num += item.CoalValue;
|
|
}
|
|
foreach (var item in list.DistinctBy(x => x.EquipmentName))
|
|
{
|
|
var model = new clinker_boundaryData();
|
|
decimal? num1 = 0;
|
|
if (item.EquipmentName == "一号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "一号线熟料排放量";
|
|
}
|
|
if (item.EquipmentName == "二号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "二号线熟料排放量";
|
|
}
|
|
if (item.EquipmentName == "三号线熟料收尘")
|
|
{
|
|
model.ClinkerName = "三号线熟料排放量";
|
|
}
|
|
var list1 = bll.GetModelList("").Where(x => x.EquipmentName == item.EquipmentName).ToList();
|
|
foreach (var aitem in list1)
|
|
{
|
|
num1 += item.EH;
|
|
}
|
|
model.ClinkerValue = num1 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610);
|
|
alist.Add(model);
|
|
}
|
|
}
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = alist;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
} |