428 lines
23 KiB
C#
428 lines
23 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace BLL
|
||
{
|
||
public static class ChemicalReportItemService
|
||
{
|
||
public static decimal GetLatstTimeTotalEnergyConsumption()
|
||
{
|
||
var q1 = (from x in Funs.DB.Environmental_ChemicalReportItem where x.SortIndex == "01" select x);
|
||
decimal d1 = 0;
|
||
foreach (var item in q1)
|
||
{
|
||
d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||
}
|
||
var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "01" select x);
|
||
decimal d2 = 0;
|
||
foreach (var item in q2)
|
||
{
|
||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||
}
|
||
return d1 + d2;
|
||
}
|
||
public static decimal GetLatstTimeIncomeComprehensiveEnergyConsumption()
|
||
{
|
||
var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "15" select x);
|
||
decimal d2 = 0;
|
||
foreach (var item in q2)
|
||
{
|
||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||
}
|
||
return d2;
|
||
|
||
}
|
||
public static decimal GetLatstTimeNewWaterConsumption()
|
||
{
|
||
var q1 = (from x in Funs.DB.Environmental_ChemicalReportItem where x.SortIndex == "70" select x);
|
||
decimal d1 = 0;
|
||
foreach (var item in q1)
|
||
{
|
||
d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||
}
|
||
var q2 = (from x in Funs.DB.Environmental_ArchitectureReportItem where x.SortIndex == "38" select x);
|
||
decimal d2 = 0;
|
||
foreach (var item in q2)
|
||
{
|
||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||
}
|
||
return d1 + d2;
|
||
|
||
}
|
||
/// <summary>
|
||
/// 化工行业能源节约与生态环境保护汇总明细表
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>化工行业能源节约与生态环境保护汇总明细表</returns>
|
||
public static Model.Environmental_ChemicalReportItem GetChemicalReportItemByChemicalReportItemId(string ChemicalReportItemId)
|
||
{
|
||
return Funs.DB.Environmental_ChemicalReportItem.FirstOrDefault(e => e.ChemicalReportItemId == ChemicalReportItemId);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 化工行业能源节约与生态环境保护汇总明细表
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>化工行业能源节约与生态环境保护汇总明细表</returns>
|
||
public static Model.Environmental_ChemicalReportItem GetChemicalReportItemByChemicalReportIdAndTypeId(string ChemicalReportId)
|
||
{
|
||
return Funs.DB.Environmental_ChemicalReportItem.FirstOrDefault(e => e.ChemicalReportId == ChemicalReportId);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主表Id判断是否存在明细记录
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">企业安全数据统计月报表Id</param>
|
||
/// <returns>是否存在明细记录</returns>
|
||
public static bool IsExitItems(string ChemicalReportId)
|
||
{
|
||
return (from x in Funs.DB.Environmental_ChemicalReportItem where x.ChemicalReportId == ChemicalReportId select x).Count() > 0;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主表Id获取明细记录集合
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>明细记录集合</returns>
|
||
public static List<Model.Environmental_ChemicalReportItem> GetItems(string ChemicalReportId)
|
||
{
|
||
return (from x in Funs.DB.Environmental_ChemicalReportItem
|
||
where x.ChemicalReportId == ChemicalReportId
|
||
orderby x.SortIndex
|
||
select x).ToList();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主表Id获取明细记录集合
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>明细记录集合</returns>
|
||
public static List<Model.Environmental_ChemicalReportItem> GetYearSumItems(string unitId, int? year, int? month)
|
||
{
|
||
return (from x in Funs.DB.Environmental_ChemicalReportItem
|
||
join y in Funs.DB.Environmental_ChemicalReport
|
||
on x.ChemicalReportId equals y.ChemicalReportId
|
||
where y.UnitId == unitId && y.Year == year && y.Month == month
|
||
orderby x.SortIndex
|
||
select x).Distinct().ToList();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主表Id获取年度明细记录集合
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>年度明细记录集合</returns>
|
||
public static List<Model.Environmental_ChemicalReportItem> GetLastYearItems(int year)
|
||
{
|
||
return (from x in Funs.DB.Environmental_ChemicalReportItem
|
||
join y in Funs.DB.Environmental_ChemicalReport
|
||
on x.ChemicalReportId equals y.ChemicalReportId
|
||
where y.Year == year
|
||
select x).Distinct().ToList();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据主表Id获取明细记录集合(不包含本月合计行)
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId">化工行业能源节约与生态环境保护汇总明细表Id</param>
|
||
/// <returns>明细记录集合</returns>
|
||
public static List<Model.ChemicalReportItem> GetShowItems(string ChemicalReportId)
|
||
{
|
||
var q = (from x in Funs.DB.Environmental_ChemicalReportItem
|
||
where x.ChemicalReportId == ChemicalReportId
|
||
orderby x.SortIndex
|
||
select x).ToList();
|
||
List<Model.ChemicalReportItem> newItems = new List<Model.ChemicalReportItem>();
|
||
var indexNames = GetIndexNames();
|
||
var units = GetUnits();
|
||
foreach (var item in q)
|
||
{
|
||
Model.ChemicalReportItem newItem = new Model.ChemicalReportItem();
|
||
newItem.ChemicalReportItemId = item.ChemicalReportItemId;
|
||
newItem.IndexName = indexNames.First(x => x.Value == item.SortIndex).Text;
|
||
newItem.Unit = units.First(x => x.Value == item.SortIndex).Text;
|
||
newItem.SortIndex = item.SortIndex;
|
||
newItem.BaseNumber = item.BaseNumber;
|
||
newItem.LastYearValue = item.LastYearValue;
|
||
newItem.ThisYearValue = item.ThisYearValue;
|
||
newItem.Rate = item.Rate;
|
||
newItems.Add(newItem);
|
||
}
|
||
return newItems;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增加化工行业能源节约与生态环境保护汇总明细表
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItem">化工行业能源节约与生态环境保护汇总明细表实体</param>
|
||
public static void AddChemicalReportItem(Model.Environmental_ChemicalReportItem ChemicalReportItem)
|
||
{
|
||
Model.Environmental_ChemicalReportItem newChemicalReportItem = new Model.Environmental_ChemicalReportItem
|
||
{
|
||
ChemicalReportItemId = ChemicalReportItem.ChemicalReportItemId,
|
||
ChemicalReportId = ChemicalReportItem.ChemicalReportId,
|
||
SortIndex = ChemicalReportItem.SortIndex,
|
||
BaseNumber = ChemicalReportItem.BaseNumber,
|
||
LastYearValue = ChemicalReportItem.LastYearValue,
|
||
ThisYearValue = ChemicalReportItem.ThisYearValue,
|
||
Rate = ChemicalReportItem.Rate,
|
||
};
|
||
|
||
Funs.DB.Environmental_ChemicalReportItem.InsertOnSubmit(newChemicalReportItem);
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改化工行业能源节约与生态环境保护汇总明细表
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItem">化工行业能源节约与生态环境保护汇总明细表实体</param>
|
||
public static void UpdateChemicalReportItem(Model.Environmental_ChemicalReportItem ChemicalReportItem)
|
||
{
|
||
Model.Environmental_ChemicalReportItem newChemicalReportItem = Funs.DB.Environmental_ChemicalReportItem.FirstOrDefault(e => e.ChemicalReportItemId == ChemicalReportItem.ChemicalReportItemId);
|
||
newChemicalReportItem.SortIndex = ChemicalReportItem.SortIndex;
|
||
newChemicalReportItem.BaseNumber = ChemicalReportItem.BaseNumber;
|
||
newChemicalReportItem.LastYearValue = ChemicalReportItem.LastYearValue;
|
||
newChemicalReportItem.ThisYearValue = ChemicalReportItem.ThisYearValue;
|
||
newChemicalReportItem.Rate = ChemicalReportItem.Rate;
|
||
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据Id删除所有数据
|
||
/// </summary>
|
||
/// <param name="ChemicalReportItemId"></param>
|
||
public static void DeleteChemicalReportItemByChemicalReportId(string ChemicalReportId)
|
||
{
|
||
var q = from x in Funs.DB.Environmental_ChemicalReportItem where x.ChemicalReportId == ChemicalReportId select x;
|
||
if (q != null)
|
||
{
|
||
Funs.DB.Environmental_ChemicalReportItem.DeleteAllOnSubmit(q);
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取指标名称集合
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public static ListItem[] GetIndexNames()
|
||
{
|
||
ListItem[] list = new ListItem[99];
|
||
list[0] = new ListItem("1.能源消费量", "01");
|
||
list[1] = new ListItem("A含:综合能源消费量", "02");
|
||
list[2] = new ListItem("A其中:原煤(标准量)", "03");
|
||
list[3] = new ListItem("B原煤(实物量)", "04");
|
||
list[4] = new ListItem("C其中:发电用煤", "05");
|
||
list[5] = new ListItem("B焦炭", "06");
|
||
list[6] = new ListItem("B电力", "07");
|
||
list[7] = new ListItem("B原油", "08");
|
||
list[8] = new ListItem("B汽油", "09");
|
||
list[9] = new ListItem("B煤油", "10");
|
||
list[10] = new ListItem("B柴油", "11");
|
||
list[11] = new ListItem("B燃料油", "12");
|
||
list[12] = new ListItem("B天然气", "13");
|
||
list[13] = new ListItem("B热力", "14");
|
||
list[14] = new ListItem("B其他能源", "15");
|
||
list[15] = new ListItem("2.万元产值综合能耗(现价)", "16");
|
||
list[16] = new ListItem("A其中:工业总产值(现价)", "17");
|
||
list[17] = new ListItem("E万元产值综合能耗(可比价)", "18");
|
||
list[18] = new ListItem("A其中:工业总产值(可比价)", "19");
|
||
list[19] = new ListItem("3.万元增加值综合能耗(现价)", "20");
|
||
list[20] = new ListItem("A其中:增加值(现价)", "21");
|
||
list[21] = new ListItem("E万元增加值综合能耗(可比价)", "22");
|
||
list[22] = new ListItem("A其中:增加值(可比价)", "23");
|
||
list[23] = new ListItem("4.万元产值用新水量(可比价)", "24");
|
||
list[24] = new ListItem("A其中:用新水量", "25");
|
||
list[25] = new ListItem("E重复用水率", "26");
|
||
list[26] = new ListItem("A其中:重复用水量", "27");
|
||
list[27] = new ListItem("5.单位乙烯能耗", "28");
|
||
list[28] = new ListItem("A其中:乙烯装置能耗", "29");
|
||
list[29] = new ListItem("B乙烯装置合格乙烯产品产量", "30");
|
||
list[30] = new ListItem("6.合成氨单位产品综合能耗", "31");
|
||
list[31] = new ListItem("A其中:合成氨综合能耗", "32");
|
||
list[32] = new ListItem("B合成氨产量", "33");
|
||
list[33] = new ListItem("7.节能量", "34");
|
||
list[34] = new ListItem("8.电煤占煤炭消费比重", "35");
|
||
list[35] = new ListItem("9.余热余能回收利用率", "36");
|
||
list[36] = new ListItem("A其中:回收利用的余热余能", "37");
|
||
list[37] = new ListItem("10.自备电厂发电装机容量", "38");
|
||
list[38] = new ListItem("A其中:燃煤发电", "39");
|
||
list[39] = new ListItem("C其中:燃煤热电", "40");
|
||
list[40] = new ListItem("B清洁能源发电", "41");
|
||
list[41] = new ListItem("C其中:天然气发电", "42");
|
||
list[42] = new ListItem("D核能发电", "43");
|
||
list[43] = new ListItem("D水力发电", "44");
|
||
list[44] = new ListItem("D风力发电", "45");
|
||
list[45] = new ListItem("D太阳能发电", "46");
|
||
list[46] = new ListItem("D其他清洁能源发电", "47");
|
||
list[47] = new ListItem("B生物质发电", "48");
|
||
list[48] = new ListItem("B其他发电", "49");
|
||
list[49] = new ListItem("11.燃煤热电机组装机容量占燃煤发电装机容量比重", "50");
|
||
list[50] = new ListItem("12.自备电厂发电量", "51");
|
||
list[51] = new ListItem("13.排污许可证许可的二氧化硫排放量", "52");
|
||
list[52] = new ListItem("14.排污许可证许可的氮氧化物排放量", "53");
|
||
list[53] = new ListItem("15.排污许可证许可的化学需氧量排放量", "54");
|
||
list[54] = new ListItem("16.排污许可证许可的氨氮排放量", "55");
|
||
list[55] = new ListItem("17.排污许可证许可的烟(粉)尘排放量", "56");
|
||
list[56] = new ListItem("18.排污许可证许可的挥发性有机物排放量", "57");
|
||
list[57] = new ListItem("19.二氧化硫排放量", "58");
|
||
list[58] = new ListItem("20.氮氧化物排放量", "59");
|
||
list[59] = new ListItem("21.化学需氧量排放量", "60");
|
||
list[60] = new ListItem("A其中:排入外环境", "61");
|
||
list[61] = new ListItem("B排入市政管网或生活污水处理厂", "62");
|
||
list[62] = new ListItem("22.氨氮排放量", "63");
|
||
list[63] = new ListItem("A其中:排入外环境", "64");
|
||
list[64] = new ListItem("B排入市政管网或生活污水处理厂", "65");
|
||
list[65] = new ListItem("23.烟(粉)尘排放量", "66");
|
||
list[66] = new ListItem("24.挥发性有机物排放量", "67");
|
||
list[67] = new ListItem("25.废水排放量", "68");
|
||
list[68] = new ListItem("26.万元产值二氧化碳排放(可比价)", "69");
|
||
list[69] = new ListItem("A其中:二氧化碳排放量", "70");
|
||
list[70] = new ListItem("27.一般固体废物综合利用率", "71");
|
||
list[71] = new ListItem("A其中:一般固体废物综合利用量", "72");
|
||
list[72] = new ListItem("C其中:综合利用往年贮存量", "73");
|
||
list[73] = new ListItem("F一般固体废物产生量", "74");
|
||
list[74] = new ListItem("28.危险废物处置率", "75");
|
||
list[75] = new ListItem("A其中:危险废物处置量", "76");
|
||
list[76] = new ListItem("C其中:处置往年贮存量", "77");
|
||
list[77] = new ListItem("F危险废物产生量", "78");
|
||
list[78] = new ListItem("29.土壤污染治理率", "79");
|
||
list[79] = new ListItem("A其中:土壤污染治理面积", "80");
|
||
list[80] = new ListItem("B土壤污染需要治理面积", "81");
|
||
list[81] = new ListItem("30.矿山(或生态)修复治理率", "82");
|
||
list[82] = new ListItem("A其中:矿山(或生态)修复治理面积", "83");
|
||
list[83] = new ListItem("B矿山(或生态)需要修复治理面积", "84");
|
||
list[84] = new ListItem("31.烟气脱硫机组装机容量占燃煤发电机组的比例", "85");
|
||
list[85] = new ListItem("A其中:配备烟气脱硫装置的机组装机容量", "86");
|
||
list[86] = new ListItem("32.烟气脱硝机组装机容量占燃煤发电机组的比例", "87");
|
||
list[87] = new ListItem("A其中:配备烟气脱硝装置的机组装机容量", "88");
|
||
list[88] = new ListItem("33.超低排放限值的机组装机容量占燃煤发电机组的比例", "89");
|
||
list[89] = new ListItem("A其中:执行超低排放限值的机组装机容量", "90");
|
||
list[90] = new ListItem("34.废气治理设施数", "91");
|
||
list[91] = new ListItem("35.废气治理设施处理能力", "92");
|
||
list[92] = new ListItem("36.废水治理设施数", "93");
|
||
list[93] = new ListItem("37.废水治理设施处理能力", "94");
|
||
list[94] = new ListItem("38.生态环境污染源", "95");
|
||
list[95] = new ListItem("39.生态环境风险点", "96");
|
||
list[96] = new ListItem("40.节能环保投入占产值比重", "97");
|
||
list[97] = new ListItem("A其中:节能投入", "98");
|
||
list[98] = new ListItem("B环保投入", "99");
|
||
return list;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取计量单位集合
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public static ListItem[] GetUnits()
|
||
{
|
||
ListItem[] list = new ListItem[99];
|
||
list[0] = new ListItem("万吨标准煤", "01");
|
||
list[1] = new ListItem("万吨标准煤", "02");
|
||
list[2] = new ListItem("万吨标准煤", "03");
|
||
list[3] = new ListItem("万吨", "04");
|
||
list[4] = new ListItem("万吨", "05");
|
||
list[5] = new ListItem("吨", "06");
|
||
list[6] = new ListItem("万千瓦时", "07");
|
||
list[7] = new ListItem("吨", "08");
|
||
list[8] = new ListItem("吨", "09");
|
||
list[9] = new ListItem("吨", "10");
|
||
list[10] = new ListItem("吨", "11");
|
||
list[11] = new ListItem("吨", "12");
|
||
list[12] = new ListItem("万立方米", "13");
|
||
list[13] = new ListItem("百万千焦", "14");
|
||
list[14] = new ListItem("吨标准煤", "15");
|
||
list[15] = new ListItem("吨标准煤/万元", "16");
|
||
list[16] = new ListItem("万元", "17");
|
||
list[17] = new ListItem("吨标准煤/万元", "18");
|
||
list[18] = new ListItem("万元", "19");
|
||
list[19] = new ListItem("吨标准煤/万元", "20");
|
||
list[20] = new ListItem("万元", "21");
|
||
list[21] = new ListItem("吨标准煤/万元", "22");
|
||
list[22] = new ListItem("万元", "23");
|
||
list[23] = new ListItem("吨/万元", "24");
|
||
list[24] = new ListItem("万吨", "25");
|
||
list[25] = new ListItem("%", "26");
|
||
list[26] = new ListItem("万吨", "27");
|
||
list[27] = new ListItem("千克标准油/吨", "28");
|
||
list[28] = new ListItem("千克标准油", "29");
|
||
list[29] = new ListItem("吨", "30");
|
||
list[30] = new ListItem("千克标准煤/吨", "31");
|
||
list[31] = new ListItem("吨标准煤", "32");
|
||
list[32] = new ListItem("吨", "33");
|
||
list[33] = new ListItem("吨标准煤", "34");
|
||
list[34] = new ListItem("%", "35");
|
||
list[35] = new ListItem("%", "36");
|
||
list[36] = new ListItem("百万千焦", "37");
|
||
list[37] = new ListItem("万千瓦", "38");
|
||
list[38] = new ListItem("万千瓦", "39");
|
||
list[39] = new ListItem("万千瓦", "40");
|
||
list[40] = new ListItem("万千瓦", "41");
|
||
list[41] = new ListItem("万千瓦", "42");
|
||
list[42] = new ListItem("万千瓦", "43");
|
||
list[43] = new ListItem("万千瓦", "44");
|
||
list[44] = new ListItem("万千瓦", "45");
|
||
list[45] = new ListItem("万千瓦", "46");
|
||
list[46] = new ListItem("万千瓦", "47");
|
||
list[47] = new ListItem("万千瓦", "48");
|
||
list[48] = new ListItem("万千瓦", "49");
|
||
list[49] = new ListItem("%", "50");
|
||
list[50] = new ListItem("万千瓦时", "51");
|
||
list[51] = new ListItem("吨", "52");
|
||
list[52] = new ListItem("吨", "53");
|
||
list[53] = new ListItem("吨", "54");
|
||
list[54] = new ListItem("吨", "55");
|
||
list[55] = new ListItem("吨", "56");
|
||
list[56] = new ListItem("吨", "57");
|
||
list[57] = new ListItem("吨", "58");
|
||
list[58] = new ListItem("吨", "59");
|
||
list[59] = new ListItem("吨", "60");
|
||
list[60] = new ListItem("吨", "61");
|
||
list[61] = new ListItem("吨", "62");
|
||
list[62] = new ListItem("吨", "63");
|
||
list[63] = new ListItem("吨", "64");
|
||
list[64] = new ListItem("吨", "65");
|
||
list[65] = new ListItem("吨", "66");
|
||
list[66] = new ListItem("吨", "67");
|
||
list[67] = new ListItem("万吨", "68");
|
||
list[68] = new ListItem("吨二氧化碳当量/万元", "69");
|
||
list[69] = new ListItem("万吨二氧化碳当量", "70");
|
||
list[70] = new ListItem("%", "71");
|
||
list[71] = new ListItem("万吨", "72");
|
||
list[72] = new ListItem("万吨", "73");
|
||
list[73] = new ListItem("万吨", "74");
|
||
list[74] = new ListItem("%", "75");
|
||
list[75] = new ListItem("万吨", "76");
|
||
list[76] = new ListItem("万吨", "77");
|
||
list[77] = new ListItem("万吨", "78");
|
||
list[78] = new ListItem("%", "79");
|
||
list[79] = new ListItem("公顷", "80");
|
||
list[80] = new ListItem("公顷", "81");
|
||
list[81] = new ListItem("%", "82");
|
||
list[82] = new ListItem("公顷", "83");
|
||
list[83] = new ListItem("公顷", "84");
|
||
list[84] = new ListItem("%", "85");
|
||
list[85] = new ListItem("万千瓦", "86");
|
||
list[86] = new ListItem("%", "87");
|
||
list[87] = new ListItem("万千瓦", "88");
|
||
list[88] = new ListItem("%", "89");
|
||
list[89] = new ListItem("万千瓦", "90");
|
||
list[90] = new ListItem("套", "91");
|
||
list[91] = new ListItem("万立方米/年", "92");
|
||
list[92] = new ListItem("套", "93");
|
||
list[93] = new ListItem("万吨/年", "94");
|
||
list[94] = new ListItem("个", "95");
|
||
list[95] = new ListItem("个", "96");
|
||
list[96] = new ListItem("%", "97");
|
||
list[97] = new ListItem("万元", "98");
|
||
list[98] = new ListItem("万元", "99");
|
||
return list;
|
||
}
|
||
}
|
||
}
|