diff --git a/DataServer/BLL/device_host.cs b/DataServer/BLL/device_host.cs index 37e3830..dbd6123 100644 --- a/DataServer/BLL/device_host.cs +++ b/DataServer/BLL/device_host.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2024/1/31 17:25:11 N/A 初版 +* V0.01 2024/2/1 10:18:14 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ diff --git a/DataServer/DAL/device_host.cs b/DataServer/DAL/device_host.cs index 04e6e6b..72d8ddc 100644 --- a/DataServer/DAL/device_host.cs +++ b/DataServer/DAL/device_host.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2024/1/31 17:25:11 N/A 初版 +* V0.01 2024/2/1 10:18:14 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ diff --git a/DataServer/DataServer.csproj b/DataServer/DataServer.csproj index 1eed312..b6f77e4 100644 --- a/DataServer/DataServer.csproj +++ b/DataServer/DataServer.csproj @@ -105,6 +105,7 @@ + @@ -119,6 +120,7 @@ + @@ -132,6 +134,7 @@ + diff --git a/DataServer/Model/device_host.cs b/DataServer/Model/device_host.cs index 0772d8b..4146f22 100644 --- a/DataServer/Model/device_host.cs +++ b/DataServer/Model/device_host.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -* V0.01 2024/1/31 17:25:11 N/A 初版 +* V0.01 2024/2/1 10:18:14 N/A 初版 * * Copyright (c) 2012 Maticsoft Corporation. All rights reserved. *┌──────────────────────────────────┐ diff --git a/DataServer/bin/Debug/DataServer.pdb b/DataServer/bin/Debug/DataServer.pdb index ba05dc5..c7720b8 100644 Binary files a/DataServer/bin/Debug/DataServer.pdb and b/DataServer/bin/Debug/DataServer.pdb differ diff --git a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache index 1f9fc65..888f47f 100644 --- a/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache +++ b/DataServer/obj/Debug/DataServer.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -bd5a431b4433af697881ea2191ec1d9588c75084 +098959a00783799e26d9b78bc1dbc8faad3ea038 diff --git a/DataServer/obj/Debug/DataServer.dll b/DataServer/obj/Debug/DataServer.dll index 3c212ae..4ef7fc2 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 ba05dc5..c7720b8 100644 Binary files a/DataServer/obj/Debug/DataServer.pdb and b/DataServer/obj/Debug/DataServer.pdb differ diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs index 3bb40f1..8718a57 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetClassifiedEnergyController.cs @@ -132,6 +132,11 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency var source = ""; for (int i = 0; i <= time_count; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var time = upper_start_time.AddMonths(i).ToString("yyyyMM"); if (bll.IsExistsTable(date_base, "electricity_data_" + time)) { diff --git a/DongYingAPI/Controllers/api/EnergyEfficiency/GetDeviceOperationController.cs b/DongYingAPI/Controllers/api/EnergyEfficiency/GetDeviceOperationController.cs index 228fa67..661daf4 100644 --- a/DongYingAPI/Controllers/api/EnergyEfficiency/GetDeviceOperationController.cs +++ b/DongYingAPI/Controllers/api/EnergyEfficiency/GetDeviceOperationController.cs @@ -35,7 +35,8 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency var time=DateTime.Now.ToString("yyyyMM"); var date = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var list = bll.GetModelList(""); - + var alist = bll_info.GetModelList(""); + var lblist = bll_data.GetModelListDate("", time); foreach (var item in list) { var model = new device_operation_response(); @@ -45,29 +46,29 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency if (model.SystematicName.Contains("空调")) { //空调 - kinfolist = bll_info.GetModelList("").Where(x => x.DeviceName.Contains("空调")).ToList(); + kinfolist = alist.Where(x => x.DeviceName.Contains("空调")).ToList(); } if (model.SystematicName.Contains("照明")) { //空调 - kinfolist = bll_info.GetModelList("").Where(x => x.DeviceName.Contains("照明")).ToList(); + kinfolist = alist.Where(x => x.DeviceName.Contains("照明")).ToList(); } if (model.SystematicName.Contains("电梯")) { //空调 - kinfolist = bll_info.GetModelList("").Where(x => x.DeviceName.Contains("梯")).ToList(); + kinfolist = alist.Where(x => x.DeviceName.Contains("梯")).ToList(); } if (model.SystematicName.Contains("风机")) { //空调 - kinfolist = bll_info.GetModelList("").Where(x => x.DeviceName.Contains("风机")).ToList(); + kinfolist = alist.Where(x => x.DeviceName.Contains("风机")).ToList(); } var kcount1 = 0; kcount1=kinfolist.Count; var kcount2 = 0; foreach (var aitem in kinfolist) { - var blist = bll_data.GetModelListDate("", time).Where(x => x.DeviceId == aitem.DeviceId&&x.EntireTime==Convert.ToDateTime(date)).ToList(); + var blist = lblist.Where(x => x.DeviceId == aitem.DeviceId&&x.EntireTime==Convert.ToDateTime(date)).ToList(); foreach (var bitem in blist) { kcount2++; diff --git a/DongYingAPI/Controllers/api/GetAirConditionerController.cs b/DongYingAPI/Controllers/api/GetAirConditionerController.cs index 0b3eba1..08c5efb 100644 --- a/DongYingAPI/Controllers/api/GetAirConditionerController.cs +++ b/DongYingAPI/Controllers/api/GetAirConditionerController.cs @@ -33,6 +33,11 @@ namespace DongYingAPI.Controllers.api for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -57,6 +62,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -79,6 +89,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddMonths(-i); var sdate = now.ToString("yyyy-MM") + "-01 00:00:00"; diff --git a/DongYingAPI/Controllers/api/GetBuildingLightingController.cs b/DongYingAPI/Controllers/api/GetBuildingLightingController.cs index a6f2db4..1db4e78 100644 --- a/DongYingAPI/Controllers/api/GetBuildingLightingController.cs +++ b/DongYingAPI/Controllers/api/GetBuildingLightingController.cs @@ -75,10 +75,11 @@ namespace DongYingAPI.Controllers.api var edate = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); var model1 = new building_lightingData(); model1.BuildingName = "科技馆"; + var lalist = bll.GetModelListDate(" EntireTime>='" + sdate + "' and EntireTime<'" + edate + "'", jtime); //科技馆 foreach (var item in list) { - var alist = bll.GetModelListDate(" EntireTime>='"+sdate+ "' and EntireTime<'"+edate+"'", jtime); + var alist=lalist.Where(x=>x.DeviceId==item.DeviceId).ToList(); decimal? num = alist.Sum(x=>Convert.ToDecimal(x.P)); model1.BuildingValue = num; @@ -88,21 +89,26 @@ namespace DongYingAPI.Controllers.api model2.BuildingName = "少年宫"; foreach (var item in list1) { - - - var alist = bll.GetModelListDate(" EntireTime>='" + sdate + "' and EntireTime<'" + edate + "'", jtime); + var alist = lalist.Where(x => x.DeviceId == item.DeviceId).ToList(); decimal? num = alist.Sum(x => Convert.ToDecimal(x.P)); - model1.BuildingValue = num; + model2.BuildingValue = num; + } + if (list1 == null) + { + model2.BuildingValue = 0; } data.Add(model2); var model3 = new building_lightingData(); model3.BuildingName = "图书馆"; foreach (var item in list2) { - - var alist = bll.GetModelListDate(" EntireTime>='" + sdate + "' and EntireTime<'" + edate + "'", jtime); + var alist = lalist.Where(x => x.DeviceId == item.DeviceId).ToList(); decimal? num = alist.Sum(x => Convert.ToDecimal(x.P)); - model1.BuildingValue = num; + model3.BuildingValue = num; + } + if(list2 == null) + { + model3.BuildingValue= 0; } data.Add(model3); diff --git a/DongYingAPI/Controllers/api/GetCarbonEmissionController.cs b/DongYingAPI/Controllers/api/GetCarbonEmissionController.cs index 396c621..faa4d79 100644 --- a/DongYingAPI/Controllers/api/GetCarbonEmissionController.cs +++ b/DongYingAPI/Controllers/api/GetCarbonEmissionController.cs @@ -49,6 +49,11 @@ namespace DongYingAPI.Controllers.api var now = DateTime.Now; for (int i = 0; i < 6; i++) { + // 只处理今日的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } time = now.AddDays(-i).ToString("yyyMM"); var atime = now.AddDays(-(i + 1)).ToString("yyyyMM"); var jtime = now.AddHours(-i).ToString("HH:00"); @@ -108,6 +113,11 @@ namespace DongYingAPI.Controllers.api var now = DateTime.Now; for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } time = now.AddDays(-i).ToString("yyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + time); if (a == false) @@ -179,6 +189,7 @@ namespace DongYingAPI.Controllers.api } else if (date == "年") { + var list = bll_info.GetModelList(" FloorName='科技馆负一层地源热泵'"); var alist = list.Where(x => x.DeviceName.Contains("B1一次循环") || x.DeviceName.Contains("B5二次循环")).ToList(); var blist = list.Where(x => x.DeviceName.Contains("地源侧循环泵")).ToList(); @@ -186,6 +197,11 @@ namespace DongYingAPI.Controllers.api var now = DateTime.Now; for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } time = now.AddMonths(-i).ToString("yyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + time); if (a == false) diff --git a/DongYingAPI/Controllers/api/GetCarbonMeasureController.cs b/DongYingAPI/Controllers/api/GetCarbonMeasureController.cs index 1bc59e6..dfb955b 100644 --- a/DongYingAPI/Controllers/api/GetCarbonMeasureController.cs +++ b/DongYingAPI/Controllers/api/GetCarbonMeasureController.cs @@ -42,7 +42,11 @@ namespace DongYingAPI.Controllers { for (int i = 0; i < 6; i++) { - + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var now = DateTime.Now; time = now.AddDays(-i).ToString("yyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + time); @@ -96,7 +100,11 @@ namespace DongYingAPI.Controllers { for (int i = 0; i < 6; i++) { - + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var now = DateTime.Now; time = now.AddMonths(-i).ToString("yyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + time); diff --git a/DongYingAPI/Controllers/api/GetCellRankingController.cs b/DongYingAPI/Controllers/api/GetCellRankingController.cs index 4168064..0c6862a 100644 --- a/DongYingAPI/Controllers/api/GetCellRankingController.cs +++ b/DongYingAPI/Controllers/api/GetCellRankingController.cs @@ -67,6 +67,10 @@ namespace DongYingAPI.Controllers.api decimal? num2 = 0; num2 = blist.Sum(x => Convert.ToDecimal(x.EH)); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } @@ -104,6 +108,10 @@ namespace DongYingAPI.Controllers.api decimal? num2 = 0; num2 = blist.Sum(x => Convert.ToDecimal(x.EH)); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } @@ -141,6 +149,10 @@ namespace DongYingAPI.Controllers.api decimal? num2 = 0; num2 = blist.Sum(x => Convert.ToDecimal(x.EH)); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } diff --git a/DongYingAPI/Controllers/api/GetChamberLoadController.cs b/DongYingAPI/Controllers/api/GetChamberLoadController.cs index 92560eb..3e2596a 100644 --- a/DongYingAPI/Controllers/api/GetChamberLoadController.cs +++ b/DongYingAPI/Controllers/api/GetChamberLoadController.cs @@ -34,6 +34,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -59,6 +64,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -82,6 +92,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddYears(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -115,6 +130,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今日的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -140,6 +160,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -163,6 +188,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddYears(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -196,6 +226,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -221,6 +256,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -244,6 +284,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddYears(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; diff --git a/DongYingAPI/Controllers/api/GetCurrentVoltageController.cs b/DongYingAPI/Controllers/api/GetCurrentVoltageController.cs index c38cdc0..2c4882b 100644 --- a/DongYingAPI/Controllers/api/GetCurrentVoltageController.cs +++ b/DongYingAPI/Controllers/api/GetCurrentVoltageController.cs @@ -49,12 +49,16 @@ namespace DongYingAPI.Controllers.api model.B = 0; model.C = 0; } - foreach (var aitem in list1) + else { - model.A = aitem.Ia; - model.B = aitem.Ib; - model.C = aitem.Ic; + foreach (var aitem in list1) + { + model.A = aitem.Ia; + model.B = aitem.Ib; + model.C = aitem.Ic; + } } + } data.Add(model); } @@ -76,11 +80,20 @@ namespace DongYingAPI.Controllers.api foreach (var item in list) { var list1 = bll.GetModelListDate("", time).Where(x => x.EntireTime >= Convert.ToDateTime(sdate) && x.EntireTime < Convert.ToDateTime(edate)); - foreach (var aitem in list1) + if (list1 == null) { - model.A = aitem.Ua; - model.B = aitem.Ub; - model.C = aitem.Uc; + model.A = 0; + model.B = 0; + model.C = 0; + } + else + { + foreach (var aitem in list1) + { + model.A = aitem.Ia; + model.B = aitem.Ib; + model.C = aitem.Ic; + } } } data.Add(model); diff --git a/DongYingAPI/Controllers/api/GetElectricQuantityController.cs b/DongYingAPI/Controllers/api/GetElectricQuantityController.cs index a972409..ce7939d 100644 --- a/DongYingAPI/Controllers/api/GetElectricQuantityController.cs +++ b/DongYingAPI/Controllers/api/GetElectricQuantityController.cs @@ -34,6 +34,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); @@ -81,6 +86,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { @@ -110,6 +120,10 @@ namespace DongYingAPI.Controllers.api var model = new electric_quantityData(); model.time = DateTime.Now.AddDays(-i).ToString("MM-dd"); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } } @@ -117,6 +131,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { @@ -151,6 +170,10 @@ namespace DongYingAPI.Controllers.api var model = new electric_quantityData(); ; model.time = jdate.ToString("MM月"); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } } diff --git a/DongYingAPI/Controllers/api/GetElectricalConditionController.cs b/DongYingAPI/Controllers/api/GetElectricalConditionController.cs index ce52c64..7dbd944 100644 --- a/DongYingAPI/Controllers/api/GetElectricalConditionController.cs +++ b/DongYingAPI/Controllers/api/GetElectricalConditionController.cs @@ -27,7 +27,7 @@ namespace DongYingAPI.Controllers.api try { var data = new List(); - var list = bll_info.GetModelList("").Where(x => x.FloorName == "科技馆负一层地源热泵").ToList(); + var list = bll_info.GetModelList(" FloorName='科技馆负一层地源热泵'"); #region 天 //今天 var now = DateTime.Now; @@ -51,16 +51,19 @@ namespace DongYingAPI.Controllers.api decimal? num1 = 0; decimal? num2 = 0; decimal? num3 = 0; + var jlist = bll.GetModelListDate(" EntireTime='" + jdate + "'", jtime); + var zlist= bll.GetModelListDate(" EntireTime='" + zdate + "'", ztime); + var qlist = bll.GetModelListDate(" EntireTime='" + qdate + "'", jtime); foreach (var aitem in list) { //今天列表 - var list1 = bll.GetModelListDate(" DeviceId='"+aitem.DeviceId+ "' and EntireTime='"+ jdate + "'", jtime); + var list1 = jlist.Where(x=>x.DeviceId==aitem.DeviceId).ToList(); num1 += list1.Sum(x=>Convert.ToDecimal(x.EH)); //昨天列表 - var list2 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + zdate + "'", ztime); + var list2 = zlist.Where(x => x.DeviceId == aitem.DeviceId).ToList(); num2 += list2.Sum(x => Convert.ToDecimal(x.EH)); //前天列表 - var list3 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + qdate + "'", jtime); + var list3 = qlist.Where(x => x.DeviceId == aitem.DeviceId).ToList(); num3 += list3.Sum(x => Convert.ToDecimal(x.EH)); } @@ -95,16 +98,19 @@ namespace DongYingAPI.Controllers.api decimal? mnum1 = 0; decimal? mnum2 = 0; decimal? mnum3 = 0; + var jmlist = bll.GetModelListDate(" EntireTime='" + jmdate + "'", jmtime); + var zmlist = bll.GetModelListDate(" EntireTime='" + zmdate + "'", zmtime); + var qmlist = bll.GetModelListDate(" EntireTime='" + qmdate + "'", qmtime); foreach (var aitem in list) { //今月列表 - var mlist1 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + jmdate + "'", jmtime); + var mlist1 = jmlist.Where(x=>x.DeviceId== aitem.DeviceId).ToList(); mnum1 += mlist1.Sum(x => Convert.ToDecimal(x.EH)); //昨月列表 - var mlist2 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + zmdate + "'", zmtime); + var mlist2 = zmlist.Where(x=>x.DeviceId==aitem.DeviceId).ToList(); mnum2 += mlist2.Sum(x => Convert.ToDecimal(x.EH)); //前月列表 - var mlist3 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + qmdate + "'", jmtime); + var mlist3 = qmlist.Where(x=>x.DeviceId== aitem.DeviceId).ToList(); mnum3 += mlist3.Sum(x => Convert.ToDecimal(x.EH)); } #endregion @@ -137,16 +143,19 @@ namespace DongYingAPI.Controllers.api decimal? ynum1 = 0; decimal? ynum2 = 0; decimal? ynum3 = 0; + var jylist= bll.GetModelListDate(" EntireTime='" + jydate + "'", jytime); + var zylist = bll.GetModelListDate(" EntireTime='" + zydate + "'", zytime); + var qylist= bll.GetModelListDate(" EntireTime='" + qydate + "'", qytime); foreach (var aitem in list) { //今年列表 - var ylist1 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + jydate + "'", jytime); + var ylist1 = jylist.Where(x=>x.DeviceId==aitem.DeviceId).ToList(); ynum1 += ylist1.Sum(x => Convert.ToDecimal(x.EH)); //昨年列表 - var ylist2 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + zydate + "'", zytime); + var ylist2 = zylist.Where(x => x.DeviceId == aitem.DeviceId).ToList(); ynum2 += ylist2.Sum(x => Convert.ToDecimal(x.EH)); //前年列表 - var ylist3 = bll.GetModelListDate(" DeviceId='" + aitem.DeviceId + "' and EntireTime='" + qydate + "'", qytime); + var ylist3 = qylist.Where(x => x.DeviceId == aitem.DeviceId).ToList(); ynum3 += ylist3.Sum(x => Convert.ToDecimal(x.EH)); } @@ -158,6 +167,30 @@ namespace DongYingAPI.Controllers.api model.LastMonth = mnum2 - mnum3; model.ThisYear= ynum1 - ynum2; model.LastYear= ynum2 - ynum3; + if (model.ToDay < 0) + { + model.ToDay = 0; + } + if (model.YearDay < 0) + { + model.YearDay = 0; + } + if (model.ThisMonth < 0) + { + model.ThisMonth = 0; + } + if (model.LastMonth < 0) + { + model.LastMonth = 0; + } + if (model.ThisYear < 0) + { + model.ThisYear = 0; + } + if (model.LastYear < 0) + { + model.LastYear = 0; + } if (model.YearDay == 0) { model.DayDency = 100; diff --git a/DongYingAPI/Controllers/api/GetElectricityConsumptionController.cs b/DongYingAPI/Controllers/api/GetElectricityConsumptionController.cs index 055c4f6..508bc68 100644 --- a/DongYingAPI/Controllers/api/GetElectricityConsumptionController.cs +++ b/DongYingAPI/Controllers/api/GetElectricityConsumptionController.cs @@ -37,7 +37,17 @@ namespace DongYingAPI.Controllers { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); + // 只处理今天的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); if (a == false) @@ -84,15 +94,25 @@ namespace DongYingAPI.Controllers { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { jdate = now.AddDays(-i).ToString("yyyy-MM-dd HH:00:00"); } - + else { jdate = now.AddDays(-i).ToString("yyyy-MM-dd 00:00:00"); } + // 只处理今月的数据 + if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month) + { + continue; + } var jtime = now.AddDays(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); if (a == false) @@ -113,6 +133,10 @@ namespace DongYingAPI.Controllers var model = new electricity_consumptionData(); ; model.Time = DateTime.Now.AddDays(-i).ToString("MM-dd"); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } } @@ -120,6 +144,11 @@ namespace DongYingAPI.Controllers { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { @@ -132,6 +161,11 @@ namespace DongYingAPI.Controllers var jdate2 = Convert.ToDateTime(jdate1); jdate = jdate2.AddDays(-i); } + // 只处理今年的数据 + if (jdate.Year != DateTime.Now.Year) + { + continue; + } var jtime = jdate.ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); if (a == false) @@ -154,12 +188,17 @@ namespace DongYingAPI.Controllers var model = new electricity_consumptionData(); ; model.Time = jdate.ToString("MM月"); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } data.Add(model); } } + var adata = data.OrderBy(x => x.EH).ToList(); res.code = 200; res.msg = "成功"; - res.data = data; + res.data = adata; } else { diff --git a/DongYingAPI/Controllers/api/GetEnergyTrendsController.cs b/DongYingAPI/Controllers/api/GetEnergyTrendsController.cs index 92de8cb..4fccb71 100644 --- a/DongYingAPI/Controllers/api/GetEnergyTrendsController.cs +++ b/DongYingAPI/Controllers/api/GetEnergyTrendsController.cs @@ -35,6 +35,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); @@ -71,6 +76,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { @@ -114,6 +124,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { diff --git a/DongYingAPI/Controllers/api/GetEquipmentMonitoringController.cs b/DongYingAPI/Controllers/api/GetEquipmentMonitoringController.cs index 969deb9..5586712 100644 --- a/DongYingAPI/Controllers/api/GetEquipmentMonitoringController.cs +++ b/DongYingAPI/Controllers/api/GetEquipmentMonitoringController.cs @@ -122,6 +122,10 @@ namespace DongYingAPI.Controllers.api decimal? num2 = 0; num2 = blist.Sum(x => Convert.ToDecimal(x.EH)); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } if (model.EH == 0) { model.DeviceState = 0; @@ -171,6 +175,10 @@ namespace DongYingAPI.Controllers.api decimal? num2 = 0; num2 = blist.Sum(x => Convert.ToDecimal(x.EH)); model.EH = num1 - num2; + if (model.EH > 0) + { + model.EH = 0; + } if (model.EH == 0) { model.DeviceState = 0; diff --git a/DongYingAPI/Controllers/api/GetGasConsumptionController.cs b/DongYingAPI/Controllers/api/GetGasConsumptionController.cs index a4498c2..35faf65 100644 --- a/DongYingAPI/Controllers/api/GetGasConsumptionController.cs +++ b/DongYingAPI/Controllers/api/GetGasConsumptionController.cs @@ -25,6 +25,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var now = DateTime.Now; var time = now.AddHours(-i).ToString("HH:00"); var model = new gas_consumptionData(); @@ -41,6 +46,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var now = DateTime.Now; var time = now.AddDays(-i).ToString("MM-dd"); var model = new gas_consumptionData(); @@ -57,6 +67,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var now = DateTime.Now; var time = now.AddMonths(-i).ToString("MM月"); var model = new gas_consumptionData(); diff --git a/DongYingAPI/Controllers/api/GetIlluminationLoadController.cs b/DongYingAPI/Controllers/api/GetIlluminationLoadController.cs index 368205a..a53d7df 100644 --- a/DongYingAPI/Controllers/api/GetIlluminationLoadController.cs +++ b/DongYingAPI/Controllers/api/GetIlluminationLoadController.cs @@ -71,6 +71,11 @@ namespace DongYingAPI.Controllers.api for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var model = new illumination_loadData(); var j = i * 60; @@ -109,6 +114,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var model = new illumination_loadData(); var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); model.time = atime; @@ -142,6 +152,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var model = new illumination_loadData(); var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); model.time = atime; diff --git a/DongYingAPI/Controllers/api/GetLightingLoadController.cs b/DongYingAPI/Controllers/api/GetLightingLoadController.cs index 1ce9ee4..9ffe264 100644 --- a/DongYingAPI/Controllers/api/GetLightingLoadController.cs +++ b/DongYingAPI/Controllers/api/GetLightingLoadController.cs @@ -34,6 +34,11 @@ namespace DongYingAPI.Controllers.api for (int i = 0; i < 6; i++) { + // 只处理今日的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -59,6 +64,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -82,6 +92,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddMonths(-i); var sdate = now.ToString("yyyy-MM") + "-01 00:00:00"; diff --git a/DongYingAPI/Controllers/api/GetPowerLoadController.cs b/DongYingAPI/Controllers/api/GetPowerLoadController.cs index 90a03b3..e1d6a5e 100644 --- a/DongYingAPI/Controllers/api/GetPowerLoadController.cs +++ b/DongYingAPI/Controllers/api/GetPowerLoadController.cs @@ -31,7 +31,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { - + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } string now = ""; now = DateTime.Now.ToString("yyyy-MM-dd HH:00:00"); var datetime = Convert.ToDateTime(now); @@ -53,6 +57,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } var atime = DateTime.Now.AddDays(-i).ToString("MM-dd"); var now = DateTime.Now.AddDays(-i); var sdate = now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -72,6 +81,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } var atime = DateTime.Now.AddMonths(-i).ToString("MM月"); var now = DateTime.Now.AddMonths(-i); var sdate = now.ToString("yyyy-MM") + "-01 00:00:00"; diff --git a/DongYingAPI/Controllers/api/GetRealtimeDataController.cs b/DongYingAPI/Controllers/api/GetRealtimeDataController.cs index 83e7eb2..94b021c 100644 --- a/DongYingAPI/Controllers/api/GetRealtimeDataController.cs +++ b/DongYingAPI/Controllers/api/GetRealtimeDataController.cs @@ -33,11 +33,13 @@ namespace DongYingAPI.Controllers.api var time = DateTime.Now.ToString("yyyyMM"); var sdate=DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); var edate=DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); - var list1=bll_info.GetModelList("").Where(x=>x.DeviceName==room.name).ToList(); + var list1=bll_info.GetModelList(" DeviceName='"+room.name+"'"); + var llist = bll.GetModelListDate("CreateTime>='" + sdate + "' and CreateTime<'" + edate + "'", time); + var alist = bll.GetModelListDate("CreateTime>='" + sdate + "' and CreateTime<'" + edate + "'", time); foreach (var bitem in list1) { - var list = bll.GetModelListDate("", time).Where(x =>x.DeviceId==bitem.DeviceId&& x.CreateTime >= Convert.ToDateTime(sdate) && x.CreateTime < Convert.ToDateTime(edate)).ToList(); - var alist = bll.GetModelListDate("", time); + var list = llist.Where(x=>x.DeviceId==bitem.DeviceId).ToList(); + if (list.Count == 0) { var model = new realtime_dataData(); diff --git a/DongYingAPI/Controllers/api/GetRoomElectricityController.cs b/DongYingAPI/Controllers/api/GetRoomElectricityController.cs index bb06e1b..baa7a45 100644 --- a/DongYingAPI/Controllers/api/GetRoomElectricityController.cs +++ b/DongYingAPI/Controllers/api/GetRoomElectricityController.cs @@ -38,6 +38,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); @@ -78,6 +83,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { @@ -123,6 +133,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { @@ -183,6 +198,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今日的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); @@ -223,6 +243,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { @@ -268,6 +293,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { @@ -328,6 +358,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今日的数据 + if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day) + { + continue; + } var jdate = now.AddHours(-i).ToString("yyyy-MM-dd HH:00:00"); var jtime = now.AddHours(-i).ToString("yyyyMM"); var a = bll.IsExistsTable(date_base, "electricity_data_" + jtime); @@ -368,6 +403,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今月的数据 + if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month) + { + continue; + } string jdate; if (i == 0) { @@ -413,6 +453,11 @@ namespace DongYingAPI.Controllers.api { for (int i = 0; i < 6; i++) { + // 只处理今年的数据 + if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year) + { + continue; + } DateTime jdate; if (i == 0) { diff --git a/DongYingAPI/DongYingAPI.csproj.user b/DongYingAPI/DongYingAPI.csproj.user index 70f6263..87c7a36 100644 --- a/DongYingAPI/DongYingAPI.csproj.user +++ b/DongYingAPI/DongYingAPI.csproj.user @@ -8,7 +8,7 @@ - Debug|Any CPU + Release|Any CPU E:\林谷项目\东营两馆一宫\后端框架\DongYing\DongYingAPI\Properties\PublishProfiles\FolderProfile1.pubxml ApiControllerEmptyScaffolder root/Common/Web API diff --git a/DongYingAPI/Properties/PublishProfiles/FolderProfile1.pubxml.user b/DongYingAPI/Properties/PublishProfiles/FolderProfile1.pubxml.user index 46ae6b7..6fb36ed 100644 --- a/DongYingAPI/Properties/PublishProfiles/FolderProfile1.pubxml.user +++ b/DongYingAPI/Properties/PublishProfiles/FolderProfile1.pubxml.user @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. <_PublishTargetUrl>E:\林谷项目\东营两馆一宫\后端框架\DongYing\DongYingAPI\bin\app.publish\ - True|2024-01-31T08:21:08.6583762Z;True|2024-01-31T13:41:30.5192673+08:00;True|2024-01-30T15:15:26.7880164+08:00;True|2024-01-30T14:10:09.8489640+08:00;True|2024-01-30T13:16:11.0447202+08:00;True|2024-01-30T09:45:36.4140361+08:00;True|2024-01-29T14:17:38.5560371+08:00;True|2024-01-29T14:16:41.5597407+08:00;True|2024-01-24T17:31:19.5804558+08:00;True|2024-01-20T14:34:47.0539217+08:00;False|2024-01-15T13:49:44.5332318+08:00;True|2024-01-15T11:01:00.7602516+08:00;True|2024-01-15T09:26:27.2161156+08:00;True|2024-01-10T17:34:07.8440850+08:00;False|2024-01-10T17:33:54.1670007+08:00;True|2024-01-10T17:32:39.4867251+08:00;True|2024-01-10T14:45:12.0400450+08:00; + True|2024-02-01T02:10:55.0739031Z;True|2024-02-01T09:46:59.8042783+08:00;True|2024-02-01T09:23:48.9652035+08:00;True|2024-01-31T16:21:08.6583762+08:00;True|2024-01-31T13:41:30.5192673+08:00;True|2024-01-30T15:15:26.7880164+08:00;True|2024-01-30T14:10:09.8489640+08:00;True|2024-01-30T13:16:11.0447202+08:00;True|2024-01-30T09:45:36.4140361+08:00;True|2024-01-29T14:17:38.5560371+08:00;True|2024-01-29T14:16:41.5597407+08:00;True|2024-01-24T17:31:19.5804558+08:00;True|2024-01-20T14:34:47.0539217+08:00;False|2024-01-15T13:49:44.5332318+08:00;True|2024-01-15T11:01:00.7602516+08:00;True|2024-01-15T09:26:27.2161156+08:00;True|2024-01-10T17:34:07.8440850+08:00;False|2024-01-10T17:33:54.1670007+08:00;True|2024-01-10T17:32:39.4867251+08:00;True|2024-01-10T14:45:12.0400450+08:00; @@ -79,16 +79,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 09/10/2013 16:29:20 - 01/30/2024 18:41:38 + 01/31/2024 18:14:34 - 01/30/2024 18:41:38 + 01/31/2024 18:14:34 - 01/31/2024 16:21:08 + 02/01/2024 10:14:51 - 01/31/2024 16:21:08 + 02/01/2024 10:14:51 08/03/2021 14:52:26 @@ -361,10 +361,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/11/2024 14:56:39 - 01/24/2024 17:21:00 + 02/01/2024 10:10:25 - 01/24/2024 17:21:00 + 01/31/2024 18:28:03 01/11/2024 14:58:40 @@ -373,16 +373,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/11/2024 14:56:39 - 01/24/2024 17:21:00 + 01/31/2024 18:10:58 - 01/10/2024 17:33:29 + 01/31/2024 18:10:58 01/09/2024 18:18:37 - 01/10/2024 17:33:29 + 01/31/2024 18:10:58 01/24/2024 17:21:00 @@ -394,13 +394,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/10/2024 13:26:12 - 01/31/2024 13:20:43 + 02/01/2024 09:54:37 - 01/30/2024 17:58:16 + 02/01/2024 09:28:11 - 01/31/2024 16:15:50 + 02/01/2024 09:56:10 01/11/2024 18:27:33 @@ -409,7 +409,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/12/2024 09:45:18 - 01/31/2024 13:27:02 + 02/01/2024 10:10:27 01/10/2024 13:25:43 @@ -418,13 +418,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/11/2024 14:10:28 - 01/30/2024 16:49:54 + 01/31/2024 18:13:29 - 01/31/2024 13:30:35 + 02/01/2024 10:00:03 - 01/30/2024 09:36:06 + 01/31/2024 18:10:56 01/12/2024 15:06:05 @@ -439,25 +439,25 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/31/2024 16:19:42 - 01/30/2024 17:01:12 + 01/31/2024 18:39:40 01/30/2024 14:08:39 - 01/30/2024 15:12:00 + 01/31/2024 16:39:57 - 01/31/2024 15:59:26 + 02/01/2024 10:01:29 - 01/31/2024 13:38:45 + 02/01/2024 10:02:20 - 01/31/2024 13:38:45 + 02/01/2024 10:03:02 - 01/30/2024 16:43:36 + 01/31/2024 18:14:26 01/30/2024 18:43:35 @@ -466,16 +466,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/11/2024 13:37:00 - 01/31/2024 13:38:45 + 02/01/2024 10:03:47 01/24/2024 17:21:00 - 01/31/2024 13:36:10 + 02/01/2024 10:04:57 - 01/31/2024 13:38:45 + 02/01/2024 10:10:27 01/10/2024 16:58:07 @@ -487,16 +487,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. 01/30/2024 17:36:42 - 01/31/2024 13:38:45 + 02/01/2024 10:06:37 - 01/30/2024 09:43:45 + 01/31/2024 18:22:15 01/09/2024 17:02:14 - 01/31/2024 13:34:44 + 02/01/2024 10:08:52 01/30/2024 17:33:34 diff --git a/DongYingAPI/bin/DataServer.dll b/DongYingAPI/bin/DataServer.dll index 3c212ae..4ef7fc2 100644 Binary files a/DongYingAPI/bin/DataServer.dll and b/DongYingAPI/bin/DataServer.dll differ diff --git a/DongYingAPI/bin/DataServer.pdb b/DongYingAPI/bin/DataServer.pdb index ba05dc5..c7720b8 100644 Binary files a/DongYingAPI/bin/DataServer.pdb and b/DongYingAPI/bin/DataServer.pdb differ diff --git a/DongYingAPI/bin/DongYingAPI.dll b/DongYingAPI/bin/DongYingAPI.dll index 1265fa5..5b34d3e 100644 Binary files a/DongYingAPI/bin/DongYingAPI.dll and b/DongYingAPI/bin/DongYingAPI.dll differ diff --git a/DongYingAPI/bin/DongYingAPI.pdb b/DongYingAPI/bin/DongYingAPI.pdb index f393c4d..a3ecba6 100644 Binary files a/DongYingAPI/bin/DongYingAPI.pdb and b/DongYingAPI/bin/DongYingAPI.pdb differ diff --git a/DongYingAPI/obj/Debug/DongYingAPI.csproj.AssemblyReference.cache b/DongYingAPI/obj/Debug/DongYingAPI.csproj.AssemblyReference.cache index 93520b3..ea59012 100644 Binary files a/DongYingAPI/obj/Debug/DongYingAPI.csproj.AssemblyReference.cache and b/DongYingAPI/obj/Debug/DongYingAPI.csproj.AssemblyReference.cache differ diff --git a/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache b/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache index f59b552..9f87141 100644 --- a/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache +++ b/DongYingAPI/obj/Debug/DongYingAPI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -d9ea997d3ff3557d0aa57072d033b88686537157 +6dd66ccb40f501fe19d1c9c146e1abf6c1d24609 diff --git a/DongYingAPI/obj/Debug/DongYingAPI.dll b/DongYingAPI/obj/Debug/DongYingAPI.dll index 1265fa5..376f776 100644 Binary files a/DongYingAPI/obj/Debug/DongYingAPI.dll and b/DongYingAPI/obj/Debug/DongYingAPI.dll differ diff --git a/DongYingAPI/obj/Debug/DongYingAPI.pdb b/DongYingAPI/obj/Debug/DongYingAPI.pdb index f393c4d..630b78d 100644 Binary files a/DongYingAPI/obj/Debug/DongYingAPI.pdb and b/DongYingAPI/obj/Debug/DongYingAPI.pdb differ diff --git a/Security/ServiceSecurity.cs b/Security/ServiceSecurity.cs index ac8300e..e66512a 100644 --- a/Security/ServiceSecurity.cs +++ b/Security/ServiceSecurity.cs @@ -34,7 +34,7 @@ namespace Security static DataServer.BLL.meteorological_station bll_meteorological =new DataServer.BLL.meteorological_station(); static DataServer.BLL.device_state bll_state=new DataServer.BLL.device_state(); static DataServer.BLL.device_info bll_info = new DataServer.BLL.device_info(); - //static DataServer.BLL.device_host bll_host=new DataServer.BLL.device_host(); + static DataServer.BLL.device_host bll_host=new DataServer.BLL.device_host(); public ServiceSecurity() { InitializeComponent(); @@ -5716,284 +5716,426 @@ namespace Security } } ////设备参数 - //if (topic.Contains("/ce5a0665-b5eb-4e75-a6a5-799449c3f092")) - //{ - // log.Info("设备参数msg" + msg); - // //设备参数 - // var j = msg.Substring(1); - // var data = JsonConvert.DeserializeObject(j); - // log.Info("设备参数:" + data); - // if (data.b != null) - // { - // foreach (var item in data.b.dvl) - // { - // var name = ""; - // char delimiter = '.'; // 分隔符 - // int lastDotIndex = item.da.LastIndexOf(delimiter); // 查找最后一个分隔符的位置 + if (topic.Contains("/ce5a0665-b5eb-4e75-a6a5-799449c3f092")) + { + log.Info("设备参数msg" + msg); + //设备参数 + var j = msg.Substring(1); + var data = JsonConvert.DeserializeObject(j); + log.Info("设备参数:" + data); + if (data.b != null) + { + foreach (var item in data.b.dvl) + { + var name = ""; + char delimiter = '.'; // 分隔符 + int lastDotIndex = item.da.LastIndexOf(delimiter); // 查找最后一个分隔符的位置 - // if (lastDotIndex != -1) // 如果找到分隔符 - // { - // name = item.da.Substring(lastDotIndex + 1); // 截取分隔符后面的子字符串 + if (lastDotIndex != -1) // 如果找到分隔符 + { + name = item.da.Substring(lastDotIndex + 1); // 截取分隔符后面的子字符串 - // } - // var now = DateTime.Now; - // var edate = Convert.ToDateTime(now.ToString("yyyy-MM-dd HH:00:00")); - // var alist = bll_state.GetModelList("").Where(x => x.EntireTime == edate).ToList(); - // if (alist.Count == 0) - // { - // if (name == "1") - // { - // if (item.dl.ContainsKey("1号压缩机当前容量")) - // { - // var hmodel = new DataServer.Model.device_host(); - // hmodel.HostId = Guid.NewGuid().ToString("N"); - // hmodel.HostName = "一号主机"; - // hmodel.DeviceName = "1号压缩机当前容量"; - // int number; - // var stringnumber = item.dl["1号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + } + var now = DateTime.Now; + var edate = Convert.ToDateTime(now.ToString("yyyy-MM-dd HH:00:00")); + var alist = bll_state.GetModelList("").Where(x => x.EntireTime == edate).ToList(); + if (alist.Count == 0) + { + if (name == "1") + { + if (item.dl.ContainsKey("1号压缩机当前容量")) + { - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // //smodel.DeviceOneState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // // smodel.DeviceOneState = num; - // } - // } - // if (item.dl.ContainsKey("1号压缩机主机运行状态")) - // { - // var hmodel = new DataServer.Model.device_host(); - // int number; - // var stringnumber = item.dl["1号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "1号压缩机当前容量"; + int number; + var stringnumber = item.dl["1号压缩机当前容量"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceOneState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceOneState = num; - // } - // } - // } - // if (name == "2") - // { - // //状态 - // smodel.DeviceId = Guid.NewGuid().ToString("N"); - // smodel.DeviceName = "二号主机"; - // if (item.dl.ContainsKey("1号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["1号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("1号压缩机主机运行状态")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "1号压缩机主机运行状态"; + int number; + var stringnumber = item.dl["1号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceOneState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceOneState = num; - // } - // } - // if (item.dl.ContainsKey("2号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["2号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("2号压缩机当前容量")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "2号压缩机当前容量"; + int number; + var stringnumber = item.dl["2号压缩机当前容量"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceTwoState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceTwoState = num; - // } - // } - // if (item.dl.ContainsKey("3号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["3号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("2号压缩机主机运行状态")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "2号压缩机主机运行状态"; + int number; + var stringnumber = item.dl["2号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceThreeState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceThreeState = num; - // } - // } - // smodel.CreateTime = DateTime.Now; - // smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); - // bll_state.Add(smodel); - // } - // if (name == "3") - // { - // //状态 - // smodel.DeviceId = Guid.NewGuid().ToString("N"); - // smodel.DeviceName = "三号主机"; - // if (item.dl.ContainsKey("1号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["1号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("3号压缩机当前容量")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "3号压缩机当前容量"; + int number; + var stringnumber = item.dl["3号压缩机当前容量"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceOneState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceOneState = num; - // } - // } - // if (item.dl.ContainsKey("2号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["2号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("3号压缩机主机运行状态")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "3号压缩机主机运行状态"; + int number; + var stringnumber = item.dl["3号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceTwoState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceTwoState = num; - // } - // } - // if (item.dl.ContainsKey("3号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["3号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("本地远程指示,0本地,1远程")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "本地远程指示,0本地,1远程"; + int number; + var stringnumber = item.dl["本地远程指示,0本地,1远程"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceThreeState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceThreeState = num; - // } - // } - // smodel.CreateTime = DateTime.Now; - // smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); - // bll_state.Add(smodel); - // } - // if (name == "4") - // { - // //状态 - // smodel.DeviceId = Guid.NewGuid().ToString("N"); - // smodel.DeviceName = "四号主机"; - // if (item.dl.ContainsKey("1号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["1号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("电源电源,单位V")) + { + var hmodel = new DataServer.Model.device_host(); + hmodel.HostId = Guid.NewGuid().ToString("N"); + hmodel.HostName = "一号主机"; + hmodel.DeviceName = "电源电源,单位V"; + int number; + var stringnumber = item.dl["电源电源,单位V"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceOneState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceOneState = num; - // } - // } - // if (item.dl.ContainsKey("2号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["2号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + //smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + // smodel.DeviceOneState = num; + } + } + } + if (name == "2") + { + //状态 + smodel.DeviceId = Guid.NewGuid().ToString("N"); + smodel.DeviceName = "二号主机"; + if (item.dl.ContainsKey("1号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["1号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceTwoState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceTwoState = num; - // } - // } - // if (item.dl.ContainsKey("3号压缩机主机运行状态")) - // { - // int number; - // var stringnumber = item.dl["3号压缩机主机运行状态"]; - // char delimiters = ':'; // 分隔符 - // int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("2号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["2号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 - // if (lastDotIndexs != -1) // 如果找到分隔符 - // { - // var num = stringnumber.Substring(lastDotIndexs + 1, 1); - // number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 - // smodel.DeviceThreeState = number; - // } - // else - // { - // var num = Convert.ToInt32(stringnumber); - // smodel.DeviceThreeState = num; - // } - // } - // smodel.CreateTime = DateTime.Now; - // smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); - // bll_state.Add(smodel); - // } - - // } - - // } + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceTwoState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceTwoState = num; + } + } + if (item.dl.ContainsKey("3号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["3号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceThreeState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceThreeState = num; + } + } + smodel.CreateTime = DateTime.Now; + smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); + bll_state.Add(smodel); + } + if (name == "3") + { + //状态 + smodel.DeviceId = Guid.NewGuid().ToString("N"); + smodel.DeviceName = "三号主机"; + if (item.dl.ContainsKey("1号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["1号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("2号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["2号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceTwoState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceTwoState = num; + } + } + if (item.dl.ContainsKey("3号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["3号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceThreeState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceThreeState = num; + } + } + smodel.CreateTime = DateTime.Now; + smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); + bll_state.Add(smodel); + } + if (name == "4") + { + //状态 + smodel.DeviceId = Guid.NewGuid().ToString("N"); + smodel.DeviceName = "四号主机"; + if (item.dl.ContainsKey("1号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["1号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceOneState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceOneState = num; + } + } + if (item.dl.ContainsKey("2号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["2号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceTwoState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceTwoState = num; + } + } + if (item.dl.ContainsKey("3号压缩机主机运行状态")) + { + int number; + var stringnumber = item.dl["3号压缩机主机运行状态"]; + char delimiters = ':'; // 分隔符 + int lastDotIndexs = stringnumber.LastIndexOf(delimiters); // 查找最后一个分隔符的位置 + + if (lastDotIndexs != -1) // 如果找到分隔符 + { + var num = stringnumber.Substring(lastDotIndexs + 1, 1); + number = Convert.ToInt32(num); // 截取分隔符后面的子字符串 + smodel.DeviceThreeState = number; + } + else + { + var num = Convert.ToInt32(stringnumber); + smodel.DeviceThreeState = num; + } + } + smodel.CreateTime = DateTime.Now; + smodel.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00")); + bll_state.Add(smodel); + } + + } + + } - // } - //} - + } + } + } catch (Exception ex) { diff --git a/Security/bin/Debug/DataServer.dll b/Security/bin/Debug/DataServer.dll index 3c212ae..4ef7fc2 100644 Binary files a/Security/bin/Debug/DataServer.dll and b/Security/bin/Debug/DataServer.dll differ diff --git a/Security/bin/Debug/DataServer.pdb b/Security/bin/Debug/DataServer.pdb index ba05dc5..c7720b8 100644 Binary files a/Security/bin/Debug/DataServer.pdb and b/Security/bin/Debug/DataServer.pdb differ diff --git a/Security/bin/Debug/ServiceSecurity.application b/Security/bin/Debug/ServiceSecurity.application index f30fd89..e063632 100644 --- a/Security/bin/Debug/ServiceSecurity.application +++ b/Security/bin/Debug/ServiceSecurity.application @@ -14,7 +14,7 @@ - aoc88+8FY3klsP2A/z6KMToSWOQIttHrHP8rOil7WM4= + M35gbFM7GTDeHhYLvOzYTJUnd8unscXCkE14yPNwwH4= diff --git a/Security/bin/Debug/ServiceSecurity.exe.manifest b/Security/bin/Debug/ServiceSecurity.exe.manifest index ecc068d..b824069 100644 --- a/Security/bin/Debug/ServiceSecurity.exe.manifest +++ b/Security/bin/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,14 @@ - + - Mxmk0J80etfRN6I7K6yBoXL0FSF/sshPcFmgRYVeTyQ= + 9km1gcVNWyjli/FvSB8HY8mLmhv1NJdJJyNVFTY36dU= diff --git a/Security/obj/Debug/Security.csproj.AssemblyReference.cache b/Security/obj/Debug/Security.csproj.AssemblyReference.cache index 0c8acfb..a6ee614 100644 Binary files a/Security/obj/Debug/Security.csproj.AssemblyReference.cache and b/Security/obj/Debug/Security.csproj.AssemblyReference.cache differ diff --git a/Security/obj/Debug/ServiceSecurity.application b/Security/obj/Debug/ServiceSecurity.application index f30fd89..e063632 100644 --- a/Security/obj/Debug/ServiceSecurity.application +++ b/Security/obj/Debug/ServiceSecurity.application @@ -14,7 +14,7 @@ - aoc88+8FY3klsP2A/z6KMToSWOQIttHrHP8rOil7WM4= + M35gbFM7GTDeHhYLvOzYTJUnd8unscXCkE14yPNwwH4= diff --git a/Security/obj/Debug/ServiceSecurity.exe.manifest b/Security/obj/Debug/ServiceSecurity.exe.manifest index ecc068d..b824069 100644 --- a/Security/obj/Debug/ServiceSecurity.exe.manifest +++ b/Security/obj/Debug/ServiceSecurity.exe.manifest @@ -42,14 +42,14 @@ - + - Mxmk0J80etfRN6I7K6yBoXL0FSF/sshPcFmgRYVeTyQ= + 9km1gcVNWyjli/FvSB8HY8mLmhv1NJdJJyNVFTY36dU=