diff --git a/.vs/JinanCementFactoryAPI/FileContentIndex/678c137a-91b8-4779-ac10-0e7763c4daad.vsidx b/.vs/JinanCementFactoryAPI/FileContentIndex/678c137a-91b8-4779-ac10-0e7763c4daad.vsidx deleted file mode 100644 index fe7ea75..0000000 Binary files a/.vs/JinanCementFactoryAPI/FileContentIndex/678c137a-91b8-4779-ac10-0e7763c4daad.vsidx and /dev/null differ diff --git a/.vs/JinanCementFactoryAPI/FileContentIndex/838e2aa4-04d1-448a-93d6-5de751c33c64.vsidx b/.vs/JinanCementFactoryAPI/FileContentIndex/8b8310dc-b9cc-47a4-ad00-d6b71df8536b.vsidx similarity index 99% rename from .vs/JinanCementFactoryAPI/FileContentIndex/838e2aa4-04d1-448a-93d6-5de751c33c64.vsidx rename to .vs/JinanCementFactoryAPI/FileContentIndex/8b8310dc-b9cc-47a4-ad00-d6b71df8536b.vsidx index 97c5436..c9a3f82 100644 Binary files a/.vs/JinanCementFactoryAPI/FileContentIndex/838e2aa4-04d1-448a-93d6-5de751c33c64.vsidx and b/.vs/JinanCementFactoryAPI/FileContentIndex/8b8310dc-b9cc-47a4-ad00-d6b71df8536b.vsidx differ diff --git a/.vs/JinanCementFactoryAPI/FileContentIndex/8ef96f07-a2d1-41fb-9844-85bd4aaaeb98.vsidx b/.vs/JinanCementFactoryAPI/FileContentIndex/8ef96f07-a2d1-41fb-9844-85bd4aaaeb98.vsidx new file mode 100644 index 0000000..d7dd9c1 Binary files /dev/null and b/.vs/JinanCementFactoryAPI/FileContentIndex/8ef96f07-a2d1-41fb-9844-85bd4aaaeb98.vsidx differ diff --git a/.vs/JinanCementFactoryAPI/v17/.suo b/.vs/JinanCementFactoryAPI/v17/.suo index 84a3505..8daa04b 100644 Binary files a/.vs/JinanCementFactoryAPI/v17/.suo and b/.vs/JinanCementFactoryAPI/v17/.suo differ diff --git a/.vs/JinanCementFactoryAPI/v17/HierarchyCache.v1.txt b/.vs/JinanCementFactoryAPI/v17/HierarchyCache.v1.txt index 1e16b2c..067290b 100644 Binary files a/.vs/JinanCementFactoryAPI/v17/HierarchyCache.v1.txt and b/.vs/JinanCementFactoryAPI/v17/HierarchyCache.v1.txt differ diff --git a/DataServer/BLL/electric_equipment.cs b/DataServer/BLL/electric_equipment.cs index 1a3b076..5645cd9 100644 --- a/DataServer/BLL/electric_equipment.cs +++ b/DataServer/BLL/electric_equipment.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2023/12/22 16:00:15 N/A 初版 +* V0.01 2023/12/29 16:02:04 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ diff --git a/DataServer/DAL/electric_equipment.cs b/DataServer/DAL/electric_equipment.cs index ae43160..6fac91f 100644 --- a/DataServer/DAL/electric_equipment.cs +++ b/DataServer/DAL/electric_equipment.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2023/12/22 16:00:15 N/A 初版 +* V0.01 2023/12/29 16:02:04 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ @@ -53,12 +53,13 @@ namespace DataServer.DAL { StringBuilder strSql=new StringBuilder(); strSql.Append("insert into electric_equipment("); - strSql.Append("EquipmentId,EquipmentName,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5)"); + strSql.Append("EquipmentId,EquipmentName,EquipmentDescribe,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5)"); strSql.Append(" values ("); - strSql.Append("@EquipmentId,@EquipmentName,@P,@EH,@Reserve1,@Reserve2,@Reserve3,@Reserve4,@Reserve5)"); + strSql.Append("@EquipmentId,@EquipmentName,@EquipmentDescribe,@P,@EH,@Reserve1,@Reserve2,@Reserve3,@Reserve4,@Reserve5)"); MySqlParameter[] parameters = { new MySqlParameter("@EquipmentId", MySqlDbType.VarChar,255), new MySqlParameter("@EquipmentName", MySqlDbType.VarChar,255), + new MySqlParameter("@EquipmentDescribe", MySqlDbType.VarChar,255), new MySqlParameter("@P", MySqlDbType.Float,255), new MySqlParameter("@EH", MySqlDbType.Float,255), new MySqlParameter("@Reserve1", MySqlDbType.VarChar,255), @@ -68,13 +69,14 @@ namespace DataServer.DAL new MySqlParameter("@Reserve5", MySqlDbType.VarChar,255)}; parameters[0].Value = model.EquipmentId; parameters[1].Value = model.EquipmentName; - parameters[2].Value = model.P; - parameters[3].Value = model.EH; - parameters[4].Value = model.Reserve1; - parameters[5].Value = model.Reserve2; - parameters[6].Value = model.Reserve3; - parameters[7].Value = model.Reserve4; - parameters[8].Value = model.Reserve5; + parameters[2].Value = model.EquipmentDescribe; + parameters[3].Value = model.P; + parameters[4].Value = model.EH; + parameters[5].Value = model.Reserve1; + parameters[6].Value = model.Reserve2; + parameters[7].Value = model.Reserve3; + parameters[8].Value = model.Reserve4; + parameters[9].Value = model.Reserve5; int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters); if (rows > 0) @@ -94,6 +96,7 @@ namespace DataServer.DAL StringBuilder strSql=new StringBuilder(); strSql.Append("update electric_equipment set "); strSql.Append("EquipmentName=@EquipmentName,"); + strSql.Append("EquipmentDescribe=@EquipmentDescribe,"); strSql.Append("P=@P,"); strSql.Append("EH=@EH,"); strSql.Append("Reserve1=@Reserve1,"); @@ -104,6 +107,7 @@ namespace DataServer.DAL strSql.Append(" where EquipmentId=@EquipmentId "); MySqlParameter[] parameters = { new MySqlParameter("@EquipmentName", MySqlDbType.VarChar,255), + new MySqlParameter("@EquipmentDescribe", MySqlDbType.VarChar,255), new MySqlParameter("@P", MySqlDbType.Float,255), new MySqlParameter("@EH", MySqlDbType.Float,255), new MySqlParameter("@Reserve1", MySqlDbType.VarChar,255), @@ -113,14 +117,15 @@ namespace DataServer.DAL new MySqlParameter("@Reserve5", MySqlDbType.VarChar,255), new MySqlParameter("@EquipmentId", MySqlDbType.VarChar,255)}; parameters[0].Value = model.EquipmentName; - parameters[1].Value = model.P; - parameters[2].Value = model.EH; - parameters[3].Value = model.Reserve1; - parameters[4].Value = model.Reserve2; - parameters[5].Value = model.Reserve3; - parameters[6].Value = model.Reserve4; - parameters[7].Value = model.Reserve5; - parameters[8].Value = model.EquipmentId; + parameters[1].Value = model.EquipmentDescribe; + parameters[2].Value = model.P; + parameters[3].Value = model.EH; + parameters[4].Value = model.Reserve1; + parameters[5].Value = model.Reserve2; + parameters[6].Value = model.Reserve3; + parameters[7].Value = model.Reserve4; + parameters[8].Value = model.Reserve5; + parameters[9].Value = model.EquipmentId; int rows=DbHelperMySQL.ExecuteSql(strSql.ToString(),parameters); if (rows > 0) @@ -183,7 +188,7 @@ namespace DataServer.DAL { StringBuilder strSql=new StringBuilder(); - strSql.Append("select EquipmentId,EquipmentName,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electric_equipment "); + strSql.Append("select EquipmentId,EquipmentName,EquipmentDescribe,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from electric_equipment "); strSql.Append(" where EquipmentId=@EquipmentId "); MySqlParameter[] parameters = { new MySqlParameter("@EquipmentId", MySqlDbType.VarChar,255) }; @@ -218,6 +223,10 @@ namespace DataServer.DAL { model.EquipmentName=row["EquipmentName"].ToString(); } + if(row["EquipmentDescribe"]!=null) + { + model.EquipmentDescribe=row["EquipmentDescribe"].ToString(); + } if(row["P"]!=null && row["P"].ToString()!="") { model.P=decimal.Parse(row["P"].ToString()); @@ -256,7 +265,7 @@ namespace DataServer.DAL public DataSet GetList(string strWhere) { StringBuilder strSql=new StringBuilder(); - strSql.Append("select EquipmentId,EquipmentName,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 "); + strSql.Append("select EquipmentId,EquipmentName,EquipmentDescribe,P,EH,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 "); strSql.Append(" FROM electric_equipment "); if(strWhere.Trim()!="") { diff --git a/DataServer/DataServer.csproj b/DataServer/DataServer.csproj index 5827362..6effc55 100644 --- a/DataServer/DataServer.csproj +++ b/DataServer/DataServer.csproj @@ -102,8 +102,16 @@ + + + + + + + + @@ -111,8 +119,10 @@ + + @@ -138,6 +148,8 @@ + + @@ -146,6 +158,7 @@ + diff --git a/DataServer/Model/electric_equipment.cs b/DataServer/Model/electric_equipment.cs index 189ef87..0e8d531 100644 --- a/DataServer/Model/electric_equipment.cs +++ b/DataServer/Model/electric_equipment.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2023/12/22 16:00:15 N/A 初版 +* V0.01 2023/12/29 16:02:04 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ @@ -28,6 +28,7 @@ namespace DataServer.Model #region Model private string _equipmentid; private string _equipmentname; + private string _equipmentdescribe; private decimal? _p; private decimal? _eh; private string _reserve1; @@ -54,6 +55,14 @@ namespace DataServer.Model /// /// /// + public string EquipmentDescribe + { + set{ _equipmentdescribe=value;} + get{return _equipmentdescribe;} + } + /// + /// + /// public decimal? P { set{ _p=value;} diff --git a/DataServer/api/get_air_pollution.cs b/DataServer/api/get_air_pollution.cs new file mode 100644 index 0000000..866c761 --- /dev/null +++ b/DataServer/api/get_air_pollution.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_air_pollution + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + /// + /// 数据 + /// + public List data { get; set; } + } + public class air_pollutionData + { + public string type { get; set; } + public List data { get; set; } + } + public class air_pollution + { + public string Name { get; set; } + public decimal? Value { get; set; } + } +} diff --git a/DataServer/api/get_carbon_emission.cs b/DataServer/api/get_carbon_emission.cs new file mode 100644 index 0000000..d21b30b --- /dev/null +++ b/DataServer/api/get_carbon_emission.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_emission + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_emissionData + { + public string CarbonTime { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_carbon_flux.cs b/DataServer/api/get_carbon_flux.cs new file mode 100644 index 0000000..8317b1d --- /dev/null +++ b/DataServer/api/get_carbon_flux.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_flux + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_fluxData + { + public string AmountName { get; set; } + public decimal? AmountValue { get; set; } + public List list { get; set; } + } + public class carbon_fluxlist + { + public string CoalName { get; set; } + public decimal? CoalValue { get; set; } + public List data { get; set; } + } + public class carbon_flux + { + public string CarbonName { get; set; } + public decimal? CarbonValue { get; set;} + } +} diff --git a/DataServer/api/get_carbon_footprint.cs b/DataServer/api/get_carbon_footprint.cs new file mode 100644 index 0000000..326bbd3 --- /dev/null +++ b/DataServer/api/get_carbon_footprint.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_footprint + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_footprintData + { + //public string CarbonName { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_carbon_intensity.cs b/DataServer/api/get_carbon_intensity.cs new file mode 100644 index 0000000..3473355 --- /dev/null +++ b/DataServer/api/get_carbon_intensity.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_intensity + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_intensityData + { + public string CarbonTime { get; set; } + public List data { get; set; } + } + public class carbon_intensity + { + public string CarbonName { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_carbon_neutral.cs b/DataServer/api/get_carbon_neutral.cs new file mode 100644 index 0000000..b1710cc --- /dev/null +++ b/DataServer/api/get_carbon_neutral.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_neutral + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_neutralData + { + public decimal? Amount { get; set; } + public List data { get; set; } + } + public class carbon_neutral + { + public string CarbonName { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_carbon_ratio.cs b/DataServer/api/get_carbon_ratio.cs new file mode 100644 index 0000000..51679a2 --- /dev/null +++ b/DataServer/api/get_carbon_ratio.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_carbon_ratio + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class carbon_ratioData + { + public decimal? Amount { get; set; } + public List data { get; set; } + } + public class carbon_ratio + { + public string CarbonName { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_clinker_boundary.cs b/DataServer/api/get_clinker_boundary.cs new file mode 100644 index 0000000..4b4c5eb --- /dev/null +++ b/DataServer/api/get_clinker_boundary.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_clinker_boundary + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class clinker_boundaryData + { + public string ClinkerName { get; set; } + public decimal? ClinkerValue { get; set; } + } +} diff --git a/DataServer/api/get_emission_ratio.cs b/DataServer/api/get_emission_ratio.cs new file mode 100644 index 0000000..d6acff3 --- /dev/null +++ b/DataServer/api/get_emission_ratio.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_emission_ratio + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class emission_ratioData + { + public decimal? Amount { get; set; } + public List list { get; set; } + } + public class emission_ratio + { + public string EmissionName { get; set; } + public decimal? EmissionValue { get; set; } + } +} diff --git a/DataServer/api/get_firm_boundary.cs b/DataServer/api/get_firm_boundary.cs new file mode 100644 index 0000000..8bbaebc --- /dev/null +++ b/DataServer/api/get_firm_boundary.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_firm_boundary + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class firm_boundaryData + { + public string DoundaryName { get; set; } + public decimal? DoundaryValue { get; set; } + } +} diff --git a/DataServer/api/get_realtime_carbon.cs b/DataServer/api/get_realtime_carbon.cs new file mode 100644 index 0000000..c3e1f07 --- /dev/null +++ b/DataServer/api/get_realtime_carbon.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_realtime_carbon + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class realtime_carbonData + { + public string CarbonTime { get; set; } + public decimal? CarbonValue { get; set; } + } +} diff --git a/DataServer/api/get_realtime_discharge.cs b/DataServer/api/get_realtime_discharge.cs new file mode 100644 index 0000000..9bd0887 --- /dev/null +++ b/DataServer/api/get_realtime_discharge.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_realtime_discharge + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + + /// + /// 数据 + /// + public List data { get; set; } + } + public class realtime_dischargeData + { + public string DischargeTime { get; set; } + public List data { get; set; } + } + public class realtime_discharge + { + public string DischargeName { get; set; } + public decimal? DischargeValue { get; set; } + } +} diff --git a/DataServer/api/get_unit_exception.cs b/DataServer/api/get_unit_exception.cs new file mode 100644 index 0000000..b2ec18e --- /dev/null +++ b/DataServer/api/get_unit_exception.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataServer.api +{ + public class get_unit_exception + { + /// + /// 返回码 + /// + public int code { get; set; } + + /// + /// 返回说明 + /// + public string msg { get; set; } + /// + /// 数据 + /// + public List data { get; set; } + } + public class unit_exceptionData + { + public string UnitTime { get; set; } + public List data { get; set; } + } + public class unit_exception + { + /// + /// 正常 + /// + public int Normal { get; set; } + /// + /// 预警 + /// + public int Early { get; set; } + /// + /// 故障 + /// + public int Malfunction { get; set; } + } +} diff --git a/DataServer/bin/Debug/DataServer.dll b/DataServer/bin/Debug/DataServer.dll index 295621e..f3b9d7f 100644 Binary files a/DataServer/bin/Debug/DataServer.dll and b/DataServer/bin/Debug/DataServer.dll differ diff --git a/DataServer/bin/Debug/DataServer.pdb b/DataServer/bin/Debug/DataServer.pdb index 8958fe3..f3d0b05 100644 Binary files a/DataServer/bin/Debug/DataServer.pdb and b/DataServer/bin/Debug/DataServer.pdb differ diff --git a/DataServer/bin/Release/DataServer.dll b/DataServer/bin/Release/DataServer.dll index 35adc08..f8e31c7 100644 Binary files a/DataServer/bin/Release/DataServer.dll and b/DataServer/bin/Release/DataServer.dll differ diff --git a/DataServer/bin/Release/DataServer.pdb b/DataServer/bin/Release/DataServer.pdb index 3bb047f..3e3ae0c 100644 Binary files a/DataServer/bin/Release/DataServer.pdb and b/DataServer/bin/Release/DataServer.pdb differ diff --git a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache index f8a2fc1..4b55996 100644 --- a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache +++ b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -93a0acd5f0de1502e6af17ba29e89052596def03 +7a7a48ef5c9ff137467e09c8553445cc55be06c9 diff --git a/DataServer/obj/Debug/DataServer.dll b/DataServer/obj/Debug/DataServer.dll index 295621e..f3b9d7f 100644 Binary files a/DataServer/obj/Debug/DataServer.dll and b/DataServer/obj/Debug/DataServer.dll differ diff --git a/DataServer/obj/Debug/DataServer.pdb b/DataServer/obj/Debug/DataServer.pdb index 8958fe3..f3d0b05 100644 Binary files a/DataServer/obj/Debug/DataServer.pdb and b/DataServer/obj/Debug/DataServer.pdb differ diff --git a/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index d14757e..664cf59 100644 Binary files a/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/DataServer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/DataServer/obj/Release/DataServer.csproj.CoreCompileInputs.cache b/DataServer/obj/Release/DataServer.csproj.CoreCompileInputs.cache index a7bb759..9fd3552 100644 --- a/DataServer/obj/Release/DataServer.csproj.CoreCompileInputs.cache +++ b/DataServer/obj/Release/DataServer.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3f23b6bc824aa7f44084adaaa298e638ad42b9d9 +aed7dacd62c8d6b45d212b0400eb49f40b156e68 diff --git a/DataServer/obj/Release/DataServer.dll b/DataServer/obj/Release/DataServer.dll index 35adc08..f8e31c7 100644 Binary files a/DataServer/obj/Release/DataServer.dll and b/DataServer/obj/Release/DataServer.dll differ diff --git a/DataServer/obj/Release/DataServer.pdb b/DataServer/obj/Release/DataServer.pdb index 3bb047f..3e3ae0c 100644 Binary files a/DataServer/obj/Release/DataServer.pdb and b/DataServer/obj/Release/DataServer.pdb differ diff --git a/JinanCementFactoryAPI/Controllers/api/GetAirPollutionController.cs b/JinanCementFactoryAPI/Controllers/api/GetAirPollutionController.cs new file mode 100644 index 0000000..d75a66a --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetAirPollutionController.cs @@ -0,0 +1,132 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Runtime.InteropServices; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 空气污染排放 + /// + public class GetAirPollutionController : ApiController + { + DataServer.BLL.environmental_protection bll = new DataServer.BLL.environmental_protection(); + // GET api/ + public HttpResponseMessage Get(string type="") + { + var res = new get_air_pollution(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (type == "二氧化碳") + { + var list1 = list.Where(x=>x.EnvironmentalDescription.Contains("SO2")).DistinctBy(x=>x.EnvironmentalName).ToList(); + var model = new air_pollutionData(); + + foreach (var item in list1) + { + model.type = item.EnvironmentalDescription; + var clist = new List(); + var blist = list.Where(x => x.EnvironmentalDescription == item.EnvironmentalDescription).ToList(); + foreach (var aitem in blist) + { + var amodel = new air_pollution(); + amodel.Name = aitem.EnvironmentalName; + amodel.Value = aitem.EnvironmentalValue; + clist.Add(amodel); + } + model.data = clist; + + } + alist.Add(model); + + } + else if (type == "氮氧化物") + { + var list1 = list.Where(x => x.EnvironmentalDescription.Contains("NOX")).DistinctBy(x => x.EnvironmentalName).ToList(); + var model = new air_pollutionData(); + foreach (var item in list1) + { + model.type = item.EnvironmentalDescription; + var clist = new List(); + var blist = list.Where(x => x.EnvironmentalDescription == item.EnvironmentalDescription).ToList(); + foreach (var aitem in blist) + { + var amodel = new air_pollution(); + amodel.Name = aitem.EnvironmentalName; + amodel.Value = aitem.EnvironmentalValue; + clist.Add(amodel); + } + model.data = clist; + + } + alist.Add(model); + } + else if (type == "一氧化碳") + { + var list1 = list.Where(x => x.EnvironmentalDescription.Contains("CO")).DistinctBy(x => x.EnvironmentalName).ToList(); + var model = new air_pollutionData(); + foreach (var item in list1) + { + + model.type = item.EnvironmentalDescription; + var clist = new List(); + var blist = list.Where(x => x.EnvironmentalDescription == item.EnvironmentalDescription).ToList(); + foreach (var aitem in blist) + { + var amodel = new air_pollution(); + amodel.Name = aitem.EnvironmentalName; + amodel.Value = aitem.EnvironmentalValue; + clist.Add(amodel); + + + } + model.data = clist; + } + alist.Add(model); + } + else if (type == "氧气") + { + var list1 = list.Where(x => x.EnvironmentalDescription.Contains("氧气")).DistinctBy(x => x.EnvironmentalName).ToList(); + var model = new air_pollutionData(); + foreach (var item in list1) + { + + model.type = item.EnvironmentalDescription; + var clist = new List(); + var blist = list.Where(x => x.EnvironmentalDescription == item.EnvironmentalDescription).ToList(); + foreach (var aitem in blist) + { + var amodel = new air_pollution(); + amodel.Name = aitem.EnvironmentalName; + amodel.Value = aitem.EnvironmentalValue; + clist.Add(amodel); + + + } + model.data = clist; + } + 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; + } + } + } \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetBrokenContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetBrokenContrastController.cs new file mode 100644 index 0000000..a100ad9 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetBrokenContrastController.cs @@ -0,0 +1,96 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 破碎系统用电量对比 + /// + public class GetBrokenContrastController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_contrast(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + var alist = new List(); + if (date == "日") + { + foreach (var item in list.DistinctBy(x=>x.EquipmentName)) + { + var list1=bll.GetModelList("").Where(x=>x.EquipmentName==item.EquipmentName).ToList(); + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + + alist.Add(model); + } + } + if (date == "月") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var list1 = bll.GetModelList("").Where(x => x.EquipmentName == item.EquipmentName).ToList(); + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + + alist.Add(model); + } + } + if (date == "年") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var list1 = bll.GetModelList("").Where(x => x.EquipmentName == item.EquipmentName).ToList(); + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday= num1; + model.Today= num2; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetBrokenLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetBrokenLoadController.cs new file mode 100644 index 0000000..9677cc5 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetBrokenLoadController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 破碎系统实时负荷 + /// + public class GetBrokenLoadController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_load(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "日") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddYears(-i).ToString("yyyy年"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetBrokenMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetBrokenMonitoringController.cs new file mode 100644 index 0000000..f1fdfa0 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetBrokenMonitoringController.cs @@ -0,0 +1,73 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 破碎系统监控 + /// + public class GetBrokenMonitoringController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_monitoring(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + var alist = new List(); + var count = 0; + var model = new one_monitoringData(); + model.Amount = list.DistinctBy(x => x.EquipmentName).Count(); + var blist = new List(); + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) + { + count++; + var amodel = new one_monitoring(); + amodel.SerialNumber = count; + amodel.ProductionName = aitem.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; + if (aitem.P > 0 && aitem.EH > 0) + { + amodel.EquipmentStatus = "正常"; + } + else + { + amodel.EquipmentStatus = "异常"; + } + blist.Add(amodel); + } + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetBrokenRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetBrokenRankingController.cs new file mode 100644 index 0000000..2299bae --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetBrokenRankingController.cs @@ -0,0 +1,67 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetBrokenRankingController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_ranking(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + var alist = new List(); + var count = 0; + var list1 = list.OrderByDescending(x => x.EH).ToList(); + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) + { + count++; + var model = new one_rankingData(); + model.SerialNumber = count; + model.DeviceName = item.EquipmentName; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; + alist.Add(model); + } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } + res.code = 200; + res.msg = "成功"; + res.data = elist; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetBrokenSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetBrokenSupplyController.cs new file mode 100644 index 0000000..18d0f7e --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetBrokenSupplyController.cs @@ -0,0 +1,74 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetBrokenSupplyController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string name = "") + { + var res = new get_room_electricity(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("破碎")).ToList(); + var alist = new List(); + if (name == "总用电") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (name == "分时段") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonEmissionController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonEmissionController.cs new file mode 100644 index 0000000..203455c --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonEmissionController.cs @@ -0,0 +1,71 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 碳排放量 + /// + public class GetCarbonEmissionController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get(string date="") + { + var res = new get_carbon_emission(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + var model = new carbon_emissionData(); + model.CarbonTime = DateTime.Now.AddMonths(-i).ToString("MM月"); + decimal? num = 0; + foreach (var item in list) + { + num += item.CoalValue; + } + model.CarbonValue = num; + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + var model = new carbon_emissionData(); + model.CarbonTime = DateTime.Now.AddYears(-i).ToString("yyyy"); + decimal? num = 0; + foreach (var item in list) + { + num += item.CoalValue; + } + model.CarbonValue = num; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonFluxController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonFluxController.cs new file mode 100644 index 0000000..38219dd --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonFluxController.cs @@ -0,0 +1,73 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 碳流图 + /// + public class GetCarbonFluxController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_carbon_flux(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + var model=new carbon_fluxData(); + model.AmountName = "总量"; + decimal? num = 0; + foreach (var item in list) + { + num += item.CoalValue; + var blist = new List(); + var list1 = list.DistinctBy(x => x.CoalName).ToList(); + foreach (var aitem in list1) + { + var model1 = new carbon_fluxlist(); + model1.CoalName= aitem.CoalName; + var flist1=list.Where(x=>x.CoalName==aitem.CoalName).ToList(); + decimal? num1 = 0; + var clist=new List(); + //decimal? num2 = 0; + foreach (var bitem in flist1) + { + num1 += bitem.CoalValue; + var model2=new carbon_flux(); + model2.CarbonName = bitem.CoalDescription; + model2.CarbonValue= bitem.CoalValue * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + clist.Add(model2); + } + model1.CoalValue= num1 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + model1.data = clist; + blist.Add(model1); + } + model.list = blist; + } + model.AmountValue = num * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonFootprintController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonFootprintController.cs new file mode 100644 index 0000000..e110c34 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonFootprintController.cs @@ -0,0 +1,49 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 碳排放量 + /// + public class GetCarbonFootprintController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_carbon_footprint(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + decimal? num = 0; + var model=new carbon_footprintData(); + foreach (var item in list) + { + num += item.CoalValue; + } + model.CarbonValue = num *Convert.ToDecimal(25.909) *Convert.ToDecimal(0.02610) * 44 / 12; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonIntensityController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonIntensityController.cs new file mode 100644 index 0000000..3cf62f0 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonIntensityController.cs @@ -0,0 +1,83 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Reflection; +using System.Text; +using System.Web.Http; +using System.Xml.Linq; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 碳排放强度 + /// + public class GetCarbonIntensityController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_carbon_intensity(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + + for (int i = 0; i < 6; i++) + { + var model=new carbon_intensityData(); + model.CarbonTime = DateTime.Now.AddMinutes(-i * 10).ToString("HH.mm"); + decimal? num1 = 0; + decimal? num2 = 0; + decimal? num3 = 0; + var blist=new List(); + var model1 = new carbon_intensity(); + model1.CarbonName = "一号线"; + var list1 = bll.GetModelList("").Where(x => x.CoalName.Contains("一号线")).ToList(); + foreach (var item1 in list1) + { + num1 += item1.CoalValue; + } + model1.CarbonValue = num1 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model1); + var model2 = new carbon_intensity(); + model2.CarbonName = "二号线"; + var list2 = bll.GetModelList("").Where(x => x.CoalName.Contains("二号线")).ToList(); + foreach (var item2 in list2) + { + num2 += item2.CoalValue; + } + model2.CarbonValue = num2 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model2); + var model3 = new carbon_intensity(); + model3.CarbonName = "三号线"; + var list3 = bll.GetModelList("").Where(x => x.CoalName.Contains("三号线")).ToList(); + foreach (var item3 in list3) + { + num3 += item3.CoalValue; + } + model3.CarbonValue = num3 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model3); + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonNeutralController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonNeutralController.cs new file mode 100644 index 0000000..b484873 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonNeutralController.cs @@ -0,0 +1,69 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 碳中和 + /// + public class GetCarbonNeutralController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_emission_ratio(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + var model = new emission_ratioData(); + decimal? num = 0; + foreach (var item in list) + { + + num += item.CoalValue; + var list1 = list.DistinctBy(x => x.CoalName).ToList(); + var blist = new List(); + foreach (var citem in list1) + { + + var amodel = new emission_ratio(); + amodel.EmissionName = citem.CoalName; + var list2 = list.Where(x => x.CoalName == amodel.EmissionName).ToList(); + decimal? num2 = 0; + foreach (var aitem in list2) + { + num2 += aitem.CoalValue; + } + amodel.EmissionValue = num2 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; ; + blist.Add(amodel); + model.list = blist; + + } + model.Amount = num * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; ; + + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCarbonRatioController.cs b/JinanCementFactoryAPI/Controllers/api/GetCarbonRatioController.cs new file mode 100644 index 0000000..3cab5dc --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCarbonRatioController.cs @@ -0,0 +1,80 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 排放各类占比 + /// + public class GetCarbonRatioController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_carbon_ratio(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + var model=new carbon_ratioData(); + decimal? num = 0; + foreach (var item in list) + { + num += item.CoalValue; + } + model.Amount = num * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + decimal? num1 = 0; + decimal? num2 = 0; + decimal? num3 = 0; + var blist = new List(); + var model1 = new carbon_ratio(); + model1.CarbonName = "一号线"; + var list1 = bll.GetModelList("").Where(x => x.CoalName.Contains("一号线")).ToList(); + foreach (var item1 in list1) + { + num1 += item1.CoalValue; + } + model1.CarbonValue = num1 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model1); + var model2 = new carbon_ratio(); + model2.CarbonName = "二号线"; + var list2 = bll.GetModelList("").Where(x => x.CoalName.Contains("二号线")).ToList(); + foreach (var item2 in list2) + { + num2 += item2.CoalValue; + } + model2.CarbonValue = num2 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model2); + var model3 = new carbon_ratio(); + model3.CarbonName = "三号线"; + var list3 = bll.GetModelList("").Where(x => x.CoalName.Contains("三号线")).ToList(); + foreach (var item3 in list3) + { + num3 += item3.CoalValue; + } + model3.CarbonValue = num3 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model3); + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCementContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetCementContrastController.cs new file mode 100644 index 0000000..4ca49ea --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCementContrastController.cs @@ -0,0 +1,98 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 水泥磨系统用电量对比 + /// + public class GetCementContrastController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_contrast(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + var alist = new List(); + if (date == "日") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "月") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "年") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCementLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetCementLoadController.cs new file mode 100644 index 0000000..76e3989 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCementLoadController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 水泥磨系统实时负荷 + /// + public class GetCementLoadController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_load(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "日") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddYears(-i).ToString("yyyy年"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCementMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetCementMonitoringController.cs new file mode 100644 index 0000000..4afe20b --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCementMonitoringController.cs @@ -0,0 +1,71 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetCementMonitoringController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_monitoring(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("一号线") || x.EquipmentName.Contains("一#空压机") || x.EquipmentName.Contains("二#空压机") || x.EquipmentName.Contains("三#空压机")).ToList(); + var alist = new List(); + var count = 0; + var model = new one_monitoringData(); + model.Amount = list.DistinctBy(x => x.EquipmentName).Count(); + var blist = new List(); + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) + { + count++; + var amodel = new one_monitoring(); + amodel.SerialNumber = count; + amodel.ProductionName = aitem.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; + if (aitem.P > 0 && aitem.EH > 0) + { + amodel.EquipmentStatus = "正常"; + } + else + { + amodel.EquipmentStatus = "异常"; + } + blist.Add(amodel); + } + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCementRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetCementRankingController.cs new file mode 100644 index 0000000..5dd9f06 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCementRankingController.cs @@ -0,0 +1,70 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 水泥磨系统用电量排名 + /// + public class GetCementRankingController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_ranking(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + var alist = new List(); + var count = 0; + var list1 = list.OrderByDescending(x => x.EH).ToList(); + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) + { + count++; + var model = new one_rankingData(); + model.SerialNumber = count; + model.DeviceName = item.EquipmentName; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; + alist.Add(model); + } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } + res.code = 200; + res.msg = "成功"; + res.data = elist; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetCementSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetCementSupplyController.cs new file mode 100644 index 0000000..c88f057 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetCementSupplyController.cs @@ -0,0 +1,77 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 水泥磨系统用电量 + /// + public class GetCementSupplyController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string name = "") + { + var res = new get_room_electricity(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + var alist = new List(); + if (name == "总用电") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (name == "分时段") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("水泥磨")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetClinkerBoundaryController.cs b/JinanCementFactoryAPI/Controllers/api/GetClinkerBoundaryController.cs new file mode 100644 index 0000000..7dba2ee --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetClinkerBoundaryController.cs @@ -0,0 +1,108 @@ +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 +{ + /// + /// 熟料边界总览 + /// + 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/ + 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(); + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetEmissionRatioController.cs b/JinanCementFactoryAPI/Controllers/api/GetEmissionRatioController.cs new file mode 100644 index 0000000..40dc684 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetEmissionRatioController.cs @@ -0,0 +1,70 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Reflection; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 各类排放占比 + /// + public class GetEmissionRatioController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_emission_ratio(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + var model = new emission_ratioData(); + decimal? num = 0; + foreach (var item in list) + { + + num += item.CoalValue; + var list1 = list.DistinctBy(x => x.CoalName).ToList(); + var blist = new List(); + foreach (var citem in list1) + { + + var amodel = new emission_ratio(); + amodel.EmissionName = citem.CoalName; + var list2 = list.Where(x => x.CoalName == amodel.EmissionName).ToList(); + decimal? num2 = 0; + foreach (var aitem in list2) + { + num2 += aitem.CoalValue; + } + amodel.EmissionValue = num2 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; ; + blist.Add(amodel); + model.list = blist; + + } + model.Amount = num * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; ; + + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetEnvironmentalAwarenessController.cs b/JinanCementFactoryAPI/Controllers/api/GetEnvironmentalAwarenessController.cs index 3e71a76..0d2676b 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetEnvironmentalAwarenessController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetEnvironmentalAwarenessController.cs @@ -11,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 环境感知监测 + /// public class GetEnvironmentalAwarenessController : ApiController { DataServer.BLL.environmental_protection bll = new DataServer.BLL.environmental_protection(); diff --git a/JinanCementFactoryAPI/Controllers/api/GetFirmBoundaryController.cs b/JinanCementFactoryAPI/Controllers/api/GetFirmBoundaryController.cs new file mode 100644 index 0000000..f892746 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetFirmBoundaryController.cs @@ -0,0 +1,186 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 企业边界总览 + /// + public class GetFirmBoundaryController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + DataServer.BLL.electric_equipment bll_loop = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date ="") + { + var res = new get_firm_boundary(); + try + { + if (date == "年") + { + var list1 = bll.GetModelList(""); + var list2 = bll_loop.GetModelList(""); + var alist = new List(); + var model1 = new firm_boundaryData(); + model1.DoundaryName = "总量"; + decimal? num = 0; + foreach (var item in list1) + { + num += item.CoalValue; + } + decimal? a = 0; + foreach (var item in list2) + { + a += item.EH; + } + model1.DoundaryValue = a * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model1); + var model2 = new firm_boundaryData(); + model2.DoundaryName = "破碎"; + decimal? a1 = 0; + var plist = list2.Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var item in plist) + { + a1 += item.EH; + } + model2.DoundaryValue = a1 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model2); + var model3 = new firm_boundaryData(); + model3.DoundaryName = "熟料"; + decimal? a2 = 0; + var slist = list2.Where(x => x.EquipmentName.Contains("熟料")).ToList(); + foreach (var item in slist) + { + a2 += item.EH; + } + model3.DoundaryValue = a2 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model3); + var model4 = new firm_boundaryData(); + model4.DoundaryName = "粉磨"; + decimal? a3 = 0; + var flist = list2.Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var item in flist) + { + a3 += item.EH; + } + model4.DoundaryValue = a3 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model4); + var model5 = new firm_boundaryData(); + model5.DoundaryName = "辅助生产系统"; + decimal? a4 = 0; + var fzlist = list2.Where(x => x.EquipmentName.Contains("生")).ToList(); + foreach (var item in fzlist) + { + a4 += item.EH; + } + model5.DoundaryValue = a4 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model5); + var model6 = new firm_boundaryData(); + model6.DoundaryName = "办公生活"; + decimal? a5 = 0; + var bglist = list2.Where(x => !(x.EquipmentName.Contains("生") || x.EquipmentName.Contains("煤磨") || x.EquipmentName.Contains("熟料") || + x.EquipmentName.Contains("破碎"))).ToList(); + foreach (var item in bglist) + { + a5 += item.EH; + } + model6.DoundaryValue = a5 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model6); + res.code = 200; + res.msg = "成功"; + res.data = alist; + } + if (date == "月") + { + var list1 = bll.GetModelList(""); + var list2 = bll_loop.GetModelList(""); + var alist = new List(); + var model1 = new firm_boundaryData(); + model1.DoundaryName = "总量"; + decimal? num = 0; + foreach (var item in list1) + { + num += item.CoalValue; + } + decimal? a = 0; + foreach (var item in list2) + { + a += item.EH; + } + model1.DoundaryValue = a * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model1); + var model2 = new firm_boundaryData(); + model2.DoundaryName = "破碎"; + decimal? a1 = 0; + var plist = list2.Where(x => x.EquipmentName.Contains("破碎")).ToList(); + foreach (var item in plist) + { + a1 += item.EH; + } + model2.DoundaryValue = a1 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model2); + var model3 = new firm_boundaryData(); + model3.DoundaryName = "熟料"; + decimal? a2 = 0; + var slist = list2.Where(x => x.EquipmentName.Contains("熟料")).ToList(); + foreach (var item in slist) + { + a2 += item.EH; + } + model3.DoundaryValue = a2 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model3); + var model4 = new firm_boundaryData(); + model4.DoundaryName = "粉磨"; + decimal? a3 = 0; + var flist = list2.Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var item in flist) + { + a3 += item.EH; + } + model4.DoundaryValue = a3 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model4); + var model5 = new firm_boundaryData(); + model5.DoundaryName = "辅助生产系统"; + decimal? a4 = 0; + var fzlist = list2.Where(x => x.EquipmentName.Contains("生")).ToList(); + foreach (var item in fzlist) + { + a4 += item.EH; + } + model5.DoundaryValue = a4 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model5); + var model6 = new firm_boundaryData(); + model6.DoundaryName = "办公生活"; + decimal? a5 = 0; + var bglist = list2.Where(x => !(x.EquipmentName.Contains("生") || x.EquipmentName.Contains("煤磨") || x.EquipmentName.Contains("熟料") || + x.EquipmentName.Contains("破碎"))).ToList(); + foreach (var item in bglist) + { + a5 += item.EH; + } + model6.DoundaryValue = a5 * Convert.ToDecimal(0.5703) + num * Convert.ToDecimal(0.02610); + alist.Add(model6); + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetGrindContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetGrindContrastController.cs new file mode 100644 index 0000000..baee29e --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetGrindContrastController.cs @@ -0,0 +1,98 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 煤磨系统用电量对比 + /// + public class GetGrindContrastController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_contrast(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + var alist = new List(); + if (date == "日") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "月") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "年") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetGrindLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetGrindLoadController.cs new file mode 100644 index 0000000..0bd4781 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetGrindLoadController.cs @@ -0,0 +1,92 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetGrindLoadController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_load(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "日") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddYears(-i).ToString("yyyy年"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetGrindMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetGrindMonitoringController.cs new file mode 100644 index 0000000..797985b --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetGrindMonitoringController.cs @@ -0,0 +1,74 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 三号生产线监控 + /// + public class GetGrindMonitoringController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_monitoring(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + var alist = new List(); + var count = 0; + var model = new one_monitoringData(); + model.Amount = list.DistinctBy(x => x.EquipmentName).Count(); + var blist = new List(); + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) + { + count++; + var amodel = new one_monitoring(); + amodel.SerialNumber = count; + amodel.ProductionName = aitem.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; + if (aitem.P > 0 && aitem.EH > 0) + { + amodel.EquipmentStatus = "正常"; + } + else + { + amodel.EquipmentStatus = "异常"; + } + blist.Add(amodel); + } + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetGrindRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetGrindRankingController.cs new file mode 100644 index 0000000..9afc346 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetGrindRankingController.cs @@ -0,0 +1,70 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 煤磨系统用电量排名 + /// + public class GetGrindRankingController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_ranking(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + var alist = new List(); + var count = 0; + var list1 = list.OrderByDescending(x => x.EH).ToList(); + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) + { + count++; + var model = new one_rankingData(); + model.SerialNumber = count; + model.DeviceName = item.EquipmentName; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; + alist.Add(model); + } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } + res.code = 200; + res.msg = "成功"; + res.data = elist; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetGrindSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetGrindSupplyController.cs new file mode 100644 index 0000000..22e7a0d --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetGrindSupplyController.cs @@ -0,0 +1,77 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 煤磨系统用电量 + /// + public class GetGrindSupplyController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string name = "") + { + var res = new get_room_electricity(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + var alist = new List(); + if (name == "总用电") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (name == "分时段") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("煤磨")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetMaterialContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetMaterialContrastController.cs new file mode 100644 index 0000000..f5901ff --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetMaterialContrastController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetMaterialContrastController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_contrast(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("生料")).ToList(); + var alist = new List(); + if (date == "日") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "月") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "年") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetMaterialLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetMaterialLoadController.cs new file mode 100644 index 0000000..c0cab38 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetMaterialLoadController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 生料系统实时负荷 + /// + public class GetMaterialLoadController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_load(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "日") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("生料")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("生料")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddYears(-i).ToString("yyyy年"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("生料")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetMaterialMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetMaterialMonitoringController.cs new file mode 100644 index 0000000..f048a6e --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetMaterialMonitoringController.cs @@ -0,0 +1,73 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 生料系统监控 + /// + public class GetMaterialMonitoringController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_monitoring(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("生料")).ToList(); + var alist = new List(); + var count = 0; + var model = new one_monitoringData(); + model.Amount = list.DistinctBy(x => x.EquipmentName).Count(); + var blist = new List(); + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) + { + count++; + var amodel = new one_monitoring(); + amodel.SerialNumber = count; + amodel.ProductionName = aitem.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; + if (aitem.P > 0 && aitem.EH > 0) + { + amodel.EquipmentStatus = "正常"; + } + else + { + amodel.EquipmentStatus = "异常"; + } + blist.Add(amodel); + } + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetMaterialRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetMaterialRankingController.cs new file mode 100644 index 0000000..f229099 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetMaterialRankingController.cs @@ -0,0 +1,70 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 生料系统用电量排名 + /// + public class GetMaterialRankingController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_ranking(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("生料")).ToList(); + var alist = new List(); + var count = 0; + var list1 = list.OrderByDescending(x => x.EH).ToList(); + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) + { + count++; + var model = new one_rankingData(); + model.SerialNumber = count; + model.DeviceName = item.EquipmentName; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; + alist.Add(model); + } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } + res.code = 200; + res.msg = "成功"; + res.data = elist; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetMaterialSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetMaterialSupplyController.cs new file mode 100644 index 0000000..cc176d3 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetMaterialSupplyController.cs @@ -0,0 +1,77 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 生料系统用电量 + /// + public class GetMaterialSupplyController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string name = "") + { + var res = new get_room_electricity(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("生料")).ToList(); + var alist = new List(); + if (name == "总用电") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("生料")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (name == "分时段") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("生料")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetOneContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetOneContrastController.cs index 2e31f2d..cf03cb6 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetOneContrastController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetOneContrastController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -26,34 +27,58 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); if (date == "日") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x=>x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x=>x.EquipmentName==model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "月") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "年") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } diff --git a/JinanCementFactoryAPI/Controllers/api/GetOneMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetOneMonitoringController.cs index 3a98727..c21c424 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetOneMonitoringController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetOneMonitoringController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -27,16 +28,24 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var model=new one_monitoringData(); - model.Amount=list.Count(); + model.Amount=list.DistinctBy(x=>x.EquipmentName).Count(); var blist=new List(); - foreach (var aitem in list) + foreach (var aitem in list.DistinctBy(x=>x.EquipmentName)) { count++; var amodel=new one_monitoring(); amodel.SerialNumber = count; amodel.ProductionName = aitem.EquipmentName; - amodel.P=aitem.P; - amodel.EH=aitem.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P=num1; + amodel.EH=num2; if (aitem.P > 0 && aitem.EH > 0) { amodel.EquipmentStatus = "正常"; diff --git a/JinanCementFactoryAPI/Controllers/api/GetOneRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetOneRankingController.cs index d1f33e8..1f8c1b7 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetOneRankingController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetOneRankingController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 一号生产线用电量排名 + /// public class GetOneRankingController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -23,18 +27,36 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var list1=list.OrderByDescending(x=>x.EH).ToList(); - foreach (var item in list1) + foreach (var item in list1.DistinctBy(x=>x.EquipmentName)) { count++; var model = new one_rankingData(); model.SerialNumber = count; model.DeviceName = item.EquipmentName; - model.EH = item.EH; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x=>x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; alist.Add(model); } + var elist = new List(); + var num = 0; + var clist=alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } res.code = 200; res.msg = "成功"; - res.data = alist; + res.data = elist; } catch (Exception ex) { diff --git a/JinanCementFactoryAPI/Controllers/api/GetPlantPowerController.cs b/JinanCementFactoryAPI/Controllers/api/GetPlantPowersController.cs similarity index 98% rename from JinanCementFactoryAPI/Controllers/api/GetPlantPowerController.cs rename to JinanCementFactoryAPI/Controllers/api/GetPlantPowersController.cs index 10eae69..f3bdb40 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetPlantPowerController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetPlantPowersController.cs @@ -14,7 +14,7 @@ namespace JinanCementFactoryAPI.Controllers.api /// /// 全厂用电量 /// - public class GetPlantPowerController : ApiController + public class GetPlantPowersController : ApiController { DataServer.BLL.loop_distribution bll = new DataServer.BLL.loop_distribution(); // GET api/ diff --git a/JinanCementFactoryAPI/Controllers/api/GetPowerSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetPowerSupplyController.cs index 700c6b2..0a85660 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetPowerSupplyController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetPowerSupplyController.cs @@ -10,6 +10,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 一号生产线用电量 + /// public class GetPowerSupplyController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -19,7 +22,7 @@ namespace JinanCementFactoryAPI.Controllers.api var res = new get_room_electricity(); try { - var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("一号线")).ToList(); + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("一号线") || x.EquipmentName.Contains("一#空压机") || x.EquipmentName.Contains("二#空压机") || x.EquipmentName.Contains("三#空压机")).ToList(); var alist = new List(); if (name == "总用电") { @@ -29,7 +32,7 @@ namespace JinanCementFactoryAPI.Controllers.api var model = new room_electricityData(); model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); var blist = bll.GetModelList(""); - var clist = blist.Where(x =>x.EquipmentName.Contains("一号线")).ToList(); + var clist = blist.Where(x => x.EquipmentName.Contains("一号线") || x.EquipmentName.Contains("一#空压机") || x.EquipmentName.Contains("二#空压机") || x.EquipmentName.Contains("三#空压机")).ToList(); foreach (var aitem in clist) { model.RealTimeLoad = aitem.EH; @@ -47,7 +50,7 @@ namespace JinanCementFactoryAPI.Controllers.api var model = new room_electricityData(); model.time = DateTime.Now.AddDays(-i).ToString("dd号"); var blist = bll.GetModelList(""); - var clist = blist.Where(x => x.EquipmentName.Contains("一号线")).ToList(); + var clist = blist.Where(x => x.EquipmentName.Contains("一号线") || x.EquipmentName.Contains("一#空压机") || x.EquipmentName.Contains("二#空压机") || x.EquipmentName.Contains("三#空压机")).ToList(); foreach (var aitem in clist) { diff --git a/JinanCementFactoryAPI/Controllers/api/GetRealtimeCarbonController.cs b/JinanCementFactoryAPI/Controllers/api/GetRealtimeCarbonController.cs new file mode 100644 index 0000000..31c6df1 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRealtimeCarbonController.cs @@ -0,0 +1,54 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 实时碳排放 + /// + public class GetRealtimeCarbonController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_realtime_carbon(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + for(var i = 0; i < 6; i++) + { + var model = new realtime_carbonData(); + int a = i * 60; + model.CarbonTime = DateTime.Now.AddHours(-i).ToString("HH:mm"); + decimal? num = 0; + foreach (var item in list) + { + num += item.CoalValue; + } + model.CarbonValue = num * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; ; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRealtimeDischargeController.cs b/JinanCementFactoryAPI/Controllers/api/GetRealtimeDischargeController.cs new file mode 100644 index 0000000..dcdfe5b --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRealtimeDischargeController.cs @@ -0,0 +1,80 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 实时碳排放 + /// + public class GetRealtimeDischargeController : ApiController + { + DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_realtime_discharge(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + + for (int i = 0; i < 6; i++) + { + var model = new realtime_dischargeData(); + model.DischargeTime = DateTime.Now.AddMinutes(-i * 10).ToString("HH.mm"); + decimal? num1 = 0; + decimal? num2 = 0; + decimal? num3 = 0; + var blist = new List(); + var model1 = new realtime_discharge(); + model1.DischargeName = "一号线"; + var list1 = bll.GetModelList("").Where(x => x.CoalName.Contains("一号线")).ToList(); + foreach (var item1 in list1) + { + num1 += item1.CoalValue; + } + model1.DischargeValue = num1 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model1); + var model2 = new realtime_discharge(); + model2.DischargeName = "二号线"; + var list2 = bll.GetModelList("").Where(x => x.CoalName.Contains("二号线")).ToList(); + foreach (var item2 in list2) + { + num2 += item2.CoalValue; + } + model2.DischargeValue = num2 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model2); + var model3 = new realtime_discharge(); + model3.DischargeName = "三号线"; + var list3 = bll.GetModelList("").Where(x => x.CoalName.Contains("三号线")).ToList(); + foreach (var item3 in list3) + { + num3 += item3.CoalValue; + } + model3.DischargeValue = num3 * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12; + blist.Add(model3); + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRotationContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetRotationContrastController.cs new file mode 100644 index 0000000..2d55fd3 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRotationContrastController.cs @@ -0,0 +1,98 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 回转窑系统用电量对比 + /// + public class GetRotationContrastController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_contrast(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + var alist = new List(); + if (date == "日") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "月") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + alist.Add(model); + } + } + if (date == "年") + { + foreach (var item in list.DistinctBy(x => x.EquipmentName)) + { + var model = new one_contrastData(); + model.DistributionName = item.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRotationLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetRotationLoadController.cs new file mode 100644 index 0000000..b9ce189 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRotationLoadController.cs @@ -0,0 +1,95 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 回转窑系统实时负荷 + /// + public class GetRotationLoadController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string date = "") + { + var res = new get_one_load(); + try + { + var list = bll.GetModelList(""); + var alist = new List(); + if (date == "日") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "月") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (date == "年") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new one_loadData(); + model.time = DateTime.Now.AddYears(-i).ToString("yyyy年"); + var blist = bll.GetModelList(""); + var clist = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.P; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRotationMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetRotationMonitoringController.cs new file mode 100644 index 0000000..83fa081 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRotationMonitoringController.cs @@ -0,0 +1,74 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 回转窑系统用电量 + /// + public class GetRotationMonitoringController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_monitoring(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + var alist = new List(); + var count = 0; + var model = new one_monitoringData(); + model.Amount = list.DistinctBy(x => x.EquipmentName).Count(); + var blist = new List(); + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) + { + count++; + var amodel = new one_monitoring(); + amodel.SerialNumber = count; + amodel.ProductionName = aitem.EquipmentName; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; + if (aitem.P > 0 && aitem.EH > 0) + { + amodel.EquipmentStatus = "正常"; + } + else + { + amodel.EquipmentStatus = "异常"; + } + blist.Add(amodel); + } + model.data = blist; + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRotationRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetRotationRankingController.cs new file mode 100644 index 0000000..6f6aa88 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRotationRankingController.cs @@ -0,0 +1,70 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 回转窑系统用电量排名 + /// + public class GetRotationRankingController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_one_ranking(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + var alist = new List(); + var count = 0; + var list1 = list.OrderByDescending(x => x.EH).ToList(); + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) + { + count++; + var model = new one_rankingData(); + model.SerialNumber = count; + model.DeviceName = item.EquipmentName; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; + alist.Add(model); + } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } + res.code = 200; + res.msg = "成功"; + res.data = elist; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetRotationSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetRotationSupplyController.cs new file mode 100644 index 0000000..fa4193a --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetRotationSupplyController.cs @@ -0,0 +1,74 @@ +using DataServer.api; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + public class GetRotationSupplyController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get(string name = "") + { + var res = new get_room_electricity(); + try + { + var list = bll.GetModelList("").Where(x => x.EquipmentName.Contains("回转窑")||x.EquipmentName.Contains("空压机")).ToList(); + var alist = new List(); + if (name == "总用电") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddMonths(-i).ToString("MM月"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + foreach (var aitem in clist) + { + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + alist.Add(model); + } + } + if (name == "分时段") + { + for (int i = 0; i < 6; i++) + { + decimal? num1 = 0; + var model = new room_electricityData(); + model.time = DateTime.Now.AddDays(-i).ToString("dd号"); + var blist = bll.GetModelList(""); + var clist = blist.Where(x => x.EquipmentName.Contains("回转窑") || x.EquipmentName.Contains("空压机")).ToList(); + foreach (var aitem in clist) + { + + model.RealTimeLoad = aitem.EH; + num1 = model.RealTimeLoad + num1; + model.RealTimeLoad = num1; + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/Controllers/api/GetThreeContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetThreeContrastController.cs index e1fd1a3..9e968e8 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetThreeContrastController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetThreeContrastController.cs @@ -1,6 +1,8 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; @@ -11,7 +13,7 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { /// - /// 三号生产线用量对比 + /// 三号生产线用电量对比 /// public class GetThreeContrastController : ApiController { @@ -26,34 +28,58 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); if (date == "日") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "月") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "年") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } diff --git a/JinanCementFactoryAPI/Controllers/api/GetThreeMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetThreeMonitoringController.cs index a136154..1211ed1 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetThreeMonitoringController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetThreeMonitoringController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 三号生产线监控 + /// public class GetThreeMonitoringController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -23,16 +27,24 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var model = new one_monitoringData(); - model.Amount = list.Count(); + model.Amount = list.DistinctBy(x=>x.EquipmentName).Count(); var blist = new List(); - foreach (var aitem in list) + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) { count++; var amodel = new one_monitoring(); amodel.SerialNumber = count; amodel.ProductionName = aitem.EquipmentName; - amodel.P = aitem.P; - amodel.EH = aitem.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; if (aitem.P > 0 && aitem.EH > 0) { amodel.EquipmentStatus = "正常"; @@ -45,7 +57,6 @@ namespace JinanCementFactoryAPI.Controllers.api } model.data = blist; alist.Add(model); - res.code = 200; res.msg = "成功"; res.data = alist; diff --git a/JinanCementFactoryAPI/Controllers/api/GetThreeRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetThreeRankingController.cs index 35356fa..73b8173 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetThreeRankingController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetThreeRankingController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 三号生产线用电量排名 + /// public class GetThreeRankingController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -23,18 +27,36 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var list1 = list.OrderByDescending(x => x.EH).ToList(); - foreach (var item in list1) + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) { count++; var model = new one_rankingData(); model.SerialNumber = count; model.DeviceName = item.EquipmentName; - model.EH = item.EH; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; alist.Add(model); } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } res.code = 200; res.msg = "成功"; - res.data = alist; + res.data = elist; } catch (Exception ex) { diff --git a/JinanCementFactoryAPI/Controllers/api/GetTwoContrastController.cs b/JinanCementFactoryAPI/Controllers/api/GetTwoContrastController.cs index 2918255..c826f60 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetTwoContrastController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetTwoContrastController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 二号生产线用电量对比 + /// public class GetTwoContrastController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -23,34 +27,58 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); if (date == "日") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "月") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } if (date == "年") { - foreach (var item in list) + foreach (var item in list.DistinctBy(x => x.EquipmentName)) { var model = new one_contrastData(); model.DistributionName = item.EquipmentName; - model.Yesterday = item.EH; - model.Today = item.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == model.DistributionName).ToList(); + foreach (var aitem in list1) + { + num1 += aitem.EH; + num2 += aitem.EH; + } + model.Yesterday = num1; + model.Today = num2; alist.Add(model); } } diff --git a/JinanCementFactoryAPI/Controllers/api/GetTwoLoadController.cs b/JinanCementFactoryAPI/Controllers/api/GetTwoLoadController.cs index 805077d..a7d60c2 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetTwoLoadController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetTwoLoadController.cs @@ -35,7 +35,6 @@ namespace JinanCementFactoryAPI.Controllers.api var clist = blist.Where(x => x.EquipmentName.Contains("二号线")).ToList(); foreach (var aitem in clist) { - model.RealTimeLoad = aitem.P; num1 = model.RealTimeLoad + num1; model.RealTimeLoad = num1; diff --git a/JinanCementFactoryAPI/Controllers/api/GetTwoMonitoringController.cs b/JinanCementFactoryAPI/Controllers/api/GetTwoMonitoringController.cs index 066397a..f870bae 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetTwoMonitoringController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetTwoMonitoringController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -11,7 +12,7 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { /// - /// 二号线生产监控 + /// 二号生产线监控 /// public class GetTwoMonitoringController : ApiController { @@ -26,16 +27,24 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var model = new one_monitoringData(); - model.Amount = list.Count(); + model.Amount = list.DistinctBy(x=>x.EquipmentName).Count(); var blist = new List(); - foreach (var aitem in list) + foreach (var aitem in list.DistinctBy(x => x.EquipmentName)) { count++; var amodel = new one_monitoring(); amodel.SerialNumber = count; amodel.ProductionName = aitem.EquipmentName; - amodel.P = aitem.P; - amodel.EH = aitem.EH; + decimal? num1 = 0; + decimal? num2 = 0; + var list1 = list.Where(x => x.EquipmentName == amodel.ProductionName).ToList(); + foreach (var bitem in list1) + { + num1 += bitem.P; + num2 += bitem.EH; + } + amodel.P = num1; + amodel.EH = num2; if (aitem.P > 0 && aitem.EH > 0) { amodel.EquipmentStatus = "正常"; @@ -48,7 +57,6 @@ namespace JinanCementFactoryAPI.Controllers.api } model.data = blist; alist.Add(model); - res.code = 200; res.msg = "成功"; res.data = alist; diff --git a/JinanCementFactoryAPI/Controllers/api/GetTwoRankingController.cs b/JinanCementFactoryAPI/Controllers/api/GetTwoRankingController.cs index 07e2b84..1a90344 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetTwoRankingController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetTwoRankingController.cs @@ -1,4 +1,5 @@ using DataServer.api; +using Microsoft.Ajax.Utilities; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -10,6 +11,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 二号生产线用电量排名 + /// public class GetTwoRankingController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); @@ -23,18 +27,36 @@ namespace JinanCementFactoryAPI.Controllers.api var alist = new List(); var count = 0; var list1 = list.OrderByDescending(x => x.EH).ToList(); - foreach (var item in list1) + foreach (var item in list1.DistinctBy(x => x.EquipmentName)) { count++; var model = new one_rankingData(); model.SerialNumber = count; model.DeviceName = item.EquipmentName; - model.EH = item.EH; + decimal? num1 = 0; + var list2 = list.Where(x => x.EquipmentName == model.DeviceName).OrderByDescending(x => x.EH).ToList(); + foreach (var aitem in list2) + { + num1 += aitem.EH; + } + model.EH = num1; alist.Add(model); } + var elist = new List(); + var num = 0; + var clist = alist.OrderByDescending(x => x.EH).ToList(); + foreach (var item in clist) + { + num++; + var model = new one_rankingData(); + model.SerialNumber = num; + model.DeviceName = item.DeviceName; + model.EH = item.EH; + elist.Add(model); + } res.code = 200; res.msg = "成功"; - res.data = alist; + res.data = elist; } catch (Exception ex) { diff --git a/JinanCementFactoryAPI/Controllers/api/GetTwoSupplyController.cs b/JinanCementFactoryAPI/Controllers/api/GetTwoSupplyController.cs index a236649..5d535e3 100644 --- a/JinanCementFactoryAPI/Controllers/api/GetTwoSupplyController.cs +++ b/JinanCementFactoryAPI/Controllers/api/GetTwoSupplyController.cs @@ -10,6 +10,9 @@ using System.Web.Http; namespace JinanCementFactoryAPI.Controllers.api { + /// + /// 二号生产线用电量 + /// public class GetTwoSupplyController : ApiController { DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); diff --git a/JinanCementFactoryAPI/Controllers/api/GetUnitExceptionController.cs b/JinanCementFactoryAPI/Controllers/api/GetUnitExceptionController.cs new file mode 100644 index 0000000..3de1350 --- /dev/null +++ b/JinanCementFactoryAPI/Controllers/api/GetUnitExceptionController.cs @@ -0,0 +1,75 @@ +using DataServer.api; +using Microsoft.Ajax.Utilities; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Web.Http; + +namespace JinanCementFactoryAPI.Controllers.api +{ + /// + /// 设备异常统计 + /// + public class GetUnitExceptionController : ApiController + { + DataServer.BLL.electric_equipment bll = new DataServer.BLL.electric_equipment(); + // GET api/ + public HttpResponseMessage Get() + { + var res = new get_unit_exception(); + try + { + var list = bll.GetModelList(""); + var alist=new List(); + for(var i = 0; i < 6;i++) + { + var date=DateTime.Now.AddMonths(-i).ToString("yyyy-MM-dd"); + var amodel=new unit_exceptionData(); + amodel.UnitTime= date; + var alist1 = new List(); + var bmodel = new unit_exception(); + foreach (var item in list.DistinctBy(x=>x.EquipmentName)) + { + + + var blist = list.Where(x => x.EquipmentName == item.EquipmentName).ToList(); + var clist1 = list.Where(x => x.EH > 0 && x.P > 0).ToList(); + var clist2=list.Where(x=>(x.EH==0&&x.P>0)||(x.EH>0&&x.P== 0)).ToList(); + var clist3=list.Where(x=>x.EH==0&&x.P== 0).ToList(); + if (clist1.Count != 0) + { + bmodel.Normal=clist1.Count; + } + if(clist2.Count != 0) + { + bmodel.Early=clist2.Count; + } + if(clist3.Count!=0) + { + bmodel.Malfunction =clist3.Count; + } + + } + alist1.Add(bmodel); + amodel.data = alist1; + alist.Add(amodel); + } + 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; + } + } +} \ No newline at end of file diff --git a/JinanCementFactoryAPI/JinanCementFactoryAPI.csproj b/JinanCementFactoryAPI/JinanCementFactoryAPI.csproj index 2ebdb00..195c8d5 100644 --- a/JinanCementFactoryAPI/JinanCementFactoryAPI.csproj +++ b/JinanCementFactoryAPI/JinanCementFactoryAPI.csproj @@ -158,9 +158,27 @@ + + + + + + + + + + + + + + + + + + @@ -168,13 +186,20 @@ + + + + + + + @@ -182,6 +207,11 @@ + + + + + @@ -192,15 +222,22 @@ - + + + + + + + + @@ -215,6 +252,7 @@ + diff --git a/JinanCementFactoryAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/JinanCementFactoryAPI/Properties/PublishProfiles/FolderProfile.pubxml.user index 142d42c..51552f1 100644 --- a/JinanCementFactoryAPI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/JinanCementFactoryAPI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>E:\林谷项目\济南水泥厂项目\发布文件 - True|2023-12-15T01:15:49.5317563Z; + True|2024-01-15T07:09:05.3782932Z;True|2024-01-03T14:38:44.4826705+08:00;True|2023-12-15T09:15:49.5317563+08:00; @@ -79,19 +79,19 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 12/13/2023 15:43:02 - 12/15/2023 09:15:47 + 01/03/2024 14:38:42 12/14/2023 09:59:45 - 12/15/2023 09:15:47 + 01/03/2024 14:38:42 - 12/15/2023 09:15:48 + 01/15/2024 15:13:17 - 12/15/2023 09:15:48 + 01/15/2024 15:13:17 12/13/2023 14:16:06 @@ -349,7 +349,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 12/13/2023 15:43:02 - 12/14/2023 17:53:48 + 12/19/2023 09:55:06 12/14/2023 14:30:07 @@ -357,15 +357,306 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 12/14/2023 13:11:50 + + 01/15/2024 15:06:28 + + + 12/21/2023 16:44:35 + + + 12/19/2023 15:46:18 + + + 12/28/2023 10:37:06 + + + 12/27/2023 17:36:37 + + + 12/28/2023 10:46:46 + + + 12/28/2023 10:55:07 + + + 12/27/2023 17:43:16 + + + 12/26/2023 10:43:21 + + + 12/27/2023 15:44:32 + + + 12/27/2023 17:43:02 + + + 12/28/2023 15:41:31 + + + 12/28/2023 16:14:03 + + + 12/27/2023 17:17:55 + + + 12/28/2023 17:05:24 + + + 12/29/2023 14:32:26 + + + 12/29/2023 14:37:21 + + + 12/29/2023 14:40:19 + + + 12/29/2023 14:50:56 + + + 12/29/2023 14:58:25 + + + 12/28/2023 14:56:32 + + + 12/26/2023 14:54:02 + + + 12/26/2023 14:54:15 + + + 12/19/2023 17:18:49 + + + 12/21/2023 15:53:46 + + + 12/26/2023 13:32:33 + + + 12/22/2023 15:19:10 + + + 12/26/2023 10:42:31 + + + 12/27/2023 17:07:38 + + + 12/21/2023 10:37:36 + + + 12/27/2023 09:47:07 + + + 12/26/2023 18:06:26 + + + 12/26/2023 10:56:03 + + + 12/27/2023 14:51:40 + 12/14/2023 14:54:38 + + 12/26/2023 10:44:08 + + + 12/26/2023 10:36:18 + + + 12/29/2023 09:25:44 + + + 12/29/2023 09:33:19 + + + 12/29/2023 09:39:15 + + + 12/29/2023 09:45:50 + + + 12/29/2023 14:32:26 + + + 12/21/2023 13:25:36 + + + 12/21/2023 14:02:45 + 12/14/2023 14:25:01 + + 12/21/2023 13:27:14 + + + 12/21/2023 14:49:30 + + + 12/19/2023 14:56:07 + + + 12/26/2023 13:38:29 + + + 12/28/2023 11:25:11 + + + 12/28/2023 11:12:03 + + + 12/28/2023 13:10:03 + + + 12/28/2023 13:16:36 + + + 12/28/2023 11:20:59 + + + 12/21/2023 15:55:28 + + + 12/27/2023 18:26:08 + + + 12/25/2023 09:51:01 + + + 12/28/2023 10:41:42 + + + 12/22/2023 16:53:39 + + + 12/28/2023 09:35:17 + + + 12/26/2023 16:03:07 + + + 12/26/2023 15:42:19 + + + 12/26/2023 09:53:33 + + + 12/26/2023 09:52:25 + + + 12/27/2023 10:09:22 + + + 12/26/2023 15:31:32 + + + 12/21/2023 17:29:06 + + + 12/28/2023 18:02:31 + + + 12/26/2023 13:13:47 + + + 12/26/2023 16:24:11 + + + 12/21/2023 15:11:56 + + + 12/21/2023 15:43:34 + + + 12/27/2023 17:08:07 + + + 12/28/2023 16:32:01 + 12/14/2023 14:45:31 + + 12/22/2023 10:38:07 + + + 12/28/2023 17:06:56 + + + 12/28/2023 17:15:22 + + + 12/28/2023 17:57:54 + + + 12/28/2023 17:57:54 + + + 12/28/2023 18:01:30 + + + 12/25/2023 15:33:30 + + + 12/25/2023 16:05:08 + + + 12/28/2023 10:14:52 + + + 12/25/2023 17:27:14 + + + 12/28/2023 10:43:20 + + + 12/28/2023 10:18:47 + + + 12/25/2023 17:31:22 + + + 12/21/2023 15:50:09 + + + 12/21/2023 13:26:19 + + + 12/28/2023 09:56:49 + + + 12/28/2023 09:51:17 + + + 12/28/2023 10:42:25 + + + 12/28/2023 10:07:07 + + + 12/28/2023 09:49:21 + + + 12/29/2023 16:53:15 + + + 12/26/2023 13:55:15 + + + 12/21/2023 10:20:43 + + + 12/21/2023 16:03:49 + + + 12/26/2023 13:43:28 + 12/13/2023 15:43:02 diff --git a/JinanCementFactoryAPI/bin/DataServer.dll b/JinanCementFactoryAPI/bin/DataServer.dll index 295621e..f3b9d7f 100644 Binary files a/JinanCementFactoryAPI/bin/DataServer.dll and b/JinanCementFactoryAPI/bin/DataServer.dll differ diff --git a/JinanCementFactoryAPI/bin/DataServer.pdb b/JinanCementFactoryAPI/bin/DataServer.pdb index 8958fe3..f3d0b05 100644 Binary files a/JinanCementFactoryAPI/bin/DataServer.pdb and b/JinanCementFactoryAPI/bin/DataServer.pdb differ diff --git a/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.dll b/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.dll index 3f15549..74594a1 100644 Binary files a/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.dll and b/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.dll differ diff --git a/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.pdb b/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.pdb index db71b9a..3e2e815 100644 Binary files a/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.pdb and b/JinanCementFactoryAPI/bin/JinanCementFactoryAPI.pdb differ diff --git a/JinanCementFactoryAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/JinanCementFactoryAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index a33cc95..110ec74 100644 Binary files a/JinanCementFactoryAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/JinanCementFactoryAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.AssemblyReference.cache b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.AssemblyReference.cache index fb765bd..0bfdff1 100644 Binary files a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.AssemblyReference.cache and b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.AssemblyReference.cache differ diff --git a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache index 20e8818..c32974c 100644 --- a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache +++ b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -be7ec77db9dd99509b20da2c6f9d45955f6e8d36 +37f162804be5b92e67b32ec28b1d89ebf7a33f6a diff --git a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.dll b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.dll index 3f15549..74594a1 100644 Binary files a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.dll and b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.dll differ diff --git a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.pdb b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.pdb index db71b9a..3e2e815 100644 Binary files a/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.pdb and b/JinanCementFactoryAPI/obj/Debug/JinanCementFactoryAPI.pdb differ diff --git a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.AssemblyReference.cache b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.AssemblyReference.cache index 4689726..fba8aac 100644 Binary files a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.AssemblyReference.cache and b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.AssemblyReference.cache differ diff --git a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache index 9798b27..5735b3a 100644 --- a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache +++ b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -c133f481856e40d8294d338f86a95b4aa1c27c73 +7d4194ef5bde721525215f5d063d524c3c3223f0 diff --git a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.dll b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.dll index e6eafb9..7d89f28 100644 Binary files a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.dll and b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.dll differ diff --git a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.pdb b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.pdb index f79a0a4..73e3502 100644 Binary files a/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.pdb and b/JinanCementFactoryAPI/obj/Release/JinanCementFactoryAPI.pdb differ diff --git a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.dll b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.dll index 35adc08..f8e31c7 100644 Binary files a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.dll and b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.dll differ diff --git a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.pdb b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.pdb index 3bb047f..3e3ae0c 100644 Binary files a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.pdb and b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/DataServer.pdb differ diff --git a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.dll b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.dll index e6eafb9..7d89f28 100644 Binary files a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.dll and b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.dll differ diff --git a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.pdb b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.pdb index f79a0a4..73e3502 100644 Binary files a/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.pdb and b/JinanCementFactoryAPI/obj/Release/Package/PackageTmp/bin/JinanCementFactoryAPI.pdb differ