修改将6个改为全部

This commit is contained in:
xukanghao 2024-02-01 15:27:45 +08:00
parent 885a7c198e
commit 99b6f63281
50 changed files with 330 additions and 422 deletions

View File

@ -1,12 +1,12 @@
/**
* device_host.cs
* host_parameter.cs
*
* N/A
* device_host
* host_parameter
*
* Ver
*
* V0.01 2024/2/1 10:18:14 N/A
* V0.01 2024/2/1 13:22:21 N/A
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*
@ -22,12 +22,12 @@ using DataServer.Model;
namespace DataServer.BLL
{
/// <summary>
/// device_host
/// host_parameter
/// </summary>
public partial class device_host
public partial class host_parameter
{
private readonly DataServer.DAL.device_host dal=new DataServer.DAL.device_host();
public device_host()
private readonly DataServer.DAL.host_parameter dal=new DataServer.DAL.host_parameter();
public host_parameter()
{}
#region BasicMethod
/// <summary>
@ -41,7 +41,7 @@ namespace DataServer.BLL
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(DataServer.Model.device_host model)
public bool Add(DataServer.Model.host_parameter model)
{
return dal.Add(model);
}
@ -49,7 +49,7 @@ namespace DataServer.BLL
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update(DataServer.Model.device_host model)
public bool Update(DataServer.Model.host_parameter model)
{
return dal.Update(model);
}
@ -73,7 +73,7 @@ namespace DataServer.BLL
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataServer.Model.device_host GetModel(string HostId)
public DataServer.Model.host_parameter GetModel(string HostId)
{
return dal.GetModel(HostId);
@ -82,10 +82,10 @@ namespace DataServer.BLL
/// <summary>
/// 得到一个对象实体,从缓存中
/// </summary>
public DataServer.Model.device_host GetModelByCache(string HostId)
public DataServer.Model.host_parameter GetModelByCache(string HostId)
{
string CacheKey = "device_hostModel-" + HostId;
string CacheKey = "host_parameterModel-" + HostId;
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
if (objModel == null)
{
@ -100,7 +100,7 @@ namespace DataServer.BLL
}
catch{}
}
return (DataServer.Model.device_host)objModel;
return (DataServer.Model.host_parameter)objModel;
}
/// <summary>
@ -113,7 +113,7 @@ namespace DataServer.BLL
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataServer.Model.device_host> GetModelList(string strWhere)
public List<DataServer.Model.host_parameter> GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
@ -121,13 +121,13 @@ namespace DataServer.BLL
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataServer.Model.device_host> DataTableToList(DataTable dt)
public List<DataServer.Model.host_parameter> DataTableToList(DataTable dt)
{
List<DataServer.Model.device_host> modelList = new List<DataServer.Model.device_host>();
List<DataServer.Model.host_parameter> modelList = new List<DataServer.Model.host_parameter>();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
DataServer.Model.device_host model;
DataServer.Model.host_parameter model;
for (int n = 0; n < rowsCount; n++)
{
model = dal.DataRowToModel(dt.Rows[n]);

View File

@ -1,12 +1,12 @@
/**
* device_host.cs
* host_parameter.cs
*
* N/A
* device_host
* host_parameter
*
* Ver
*
* V0.01 2024/2/1 10:18:14 N/A
* V0.01 2024/2/1 13:22:21 N/A
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*
@ -22,11 +22,11 @@ using Maticsoft.DBUtility;//Please add references
namespace DataServer.DAL
{
/// <summary>
/// 数据访问类:device_host
/// 数据访问类:host_parameter
/// </summary>
public partial class device_host
public partial class host_parameter
{
public device_host()
public host_parameter()
{}
#region BasicMethod
@ -36,7 +36,7 @@ namespace DataServer.DAL
public bool Exists(string HostId)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from device_host");
strSql.Append("select count(1) from host_parameter");
strSql.Append(" where HostId=@HostId ");
MySqlParameter[] parameters = {
new MySqlParameter("@HostId", MySqlDbType.VarChar,255) };
@ -49,10 +49,10 @@ namespace DataServer.DAL
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(DataServer.Model.device_host model)
public bool Add(DataServer.Model.host_parameter model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into device_host(");
strSql.Append("insert into host_parameter(");
strSql.Append("HostId,HostName,DeviceName,DeviceValue,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5)");
strSql.Append(" values (");
strSql.Append("@HostId,@HostName,@DeviceName,@DeviceValue,@CreateTime,@EntireTime,@Reserve1,@Reserve2,@Reserve3,@Reserve4,@Reserve5)");
@ -93,10 +93,10 @@ namespace DataServer.DAL
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update(DataServer.Model.device_host model)
public bool Update(DataServer.Model.host_parameter model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("update device_host set ");
strSql.Append("update host_parameter set ");
strSql.Append("HostName=@HostName,");
strSql.Append("DeviceName=@DeviceName,");
strSql.Append("DeviceValue=@DeviceValue,");
@ -150,7 +150,7 @@ namespace DataServer.DAL
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from device_host ");
strSql.Append("delete from host_parameter ");
strSql.Append(" where HostId=@HostId ");
MySqlParameter[] parameters = {
new MySqlParameter("@HostId", MySqlDbType.VarChar,255) };
@ -172,7 +172,7 @@ namespace DataServer.DAL
public bool DeleteList(string HostIdlist )
{
StringBuilder strSql=new StringBuilder();
strSql.Append("delete from device_host ");
strSql.Append("delete from host_parameter ");
strSql.Append(" where HostId in ("+HostIdlist + ") ");
int rows=DbHelperMySQL.ExecuteSql(strSql.ToString());
if (rows > 0)
@ -189,17 +189,17 @@ namespace DataServer.DAL
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataServer.Model.device_host GetModel(string HostId)
public DataServer.Model.host_parameter GetModel(string HostId)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select HostId,HostName,DeviceName,DeviceValue,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from device_host ");
strSql.Append("select HostId,HostName,DeviceName,DeviceValue,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 from host_parameter ");
strSql.Append(" where HostId=@HostId ");
MySqlParameter[] parameters = {
new MySqlParameter("@HostId", MySqlDbType.VarChar,255) };
parameters[0].Value = HostId;
DataServer.Model.device_host model=new DataServer.Model.device_host();
DataServer.Model.host_parameter model=new DataServer.Model.host_parameter();
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
if(ds.Tables[0].Rows.Count>0)
{
@ -215,9 +215,9 @@ namespace DataServer.DAL
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataServer.Model.device_host DataRowToModel(DataRow row)
public DataServer.Model.host_parameter DataRowToModel(DataRow row)
{
DataServer.Model.device_host model=new DataServer.Model.device_host();
DataServer.Model.host_parameter model=new DataServer.Model.host_parameter();
if (row != null)
{
if(row["HostId"]!=null)
@ -275,7 +275,7 @@ namespace DataServer.DAL
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select HostId,HostName,DeviceName,DeviceValue,CreateTime,EntireTime,Reserve1,Reserve2,Reserve3,Reserve4,Reserve5 ");
strSql.Append(" FROM device_host ");
strSql.Append(" FROM host_parameter ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
@ -289,7 +289,7 @@ namespace DataServer.DAL
public int GetRecordCount(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) FROM device_host ");
strSql.Append("select count(1) FROM host_parameter ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
@ -320,7 +320,7 @@ namespace DataServer.DAL
{
strSql.Append("order by T.HostId desc");
}
strSql.Append(")AS Row, T.* from device_host T ");
strSql.Append(")AS Row, T.* from host_parameter T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
@ -345,7 +345,7 @@ namespace DataServer.DAL
new MySqlParameter("@OrderType", MySqlDbType.Bit),
new MySqlParameter("@strWhere", MySqlDbType.VarChar,1000),
};
parameters[0].Value = "device_host";
parameters[0].Value = "host_parameter";
parameters[1].Value = "HostId";
parameters[2].Value = PageSize;
parameters[3].Value = PageIndex;

View File

@ -105,7 +105,6 @@
<Compile Include="api\select_switching_room.cs" />
<Compile Include="api\Test.cs" />
<Compile Include="BLL\device_data.cs" />
<Compile Include="BLL\device_host.cs" />
<Compile Include="BLL\device_info.cs" />
<Compile Include="BLL\device_operation.cs" />
<Compile Include="BLL\device_state.cs" />
@ -114,13 +113,13 @@
<Compile Include="BLL\electricity_quantity.cs" />
<Compile Include="BLL\electrotherapy_room.cs" />
<Compile Include="BLL\gas_data.cs" />
<Compile Include="BLL\host_parameter.cs" />
<Compile Include="BLL\lighting_strategy.cs" />
<Compile Include="BLL\meteorological_station.cs" />
<Compile Include="BLL\planned_energy.cs" />
<Compile Include="BLL\water_data.cs" />
<Compile Include="DAL\device_data.cs" />
<Compile Include="api\get_realtime_data.cs" />
<Compile Include="DAL\device_host.cs" />
<Compile Include="DAL\device_info.cs" />
<Compile Include="DAL\device_operation.cs" />
<Compile Include="DAL\device_state.cs" />
@ -129,12 +128,12 @@
<Compile Include="DAL\electricity_quantity.cs" />
<Compile Include="DAL\electrotherapy_room.cs" />
<Compile Include="DAL\gas_data.cs" />
<Compile Include="DAL\host_parameter.cs" />
<Compile Include="DAL\lighting_strategy.cs" />
<Compile Include="DAL\meteorological_station.cs" />
<Compile Include="DAL\planned_energy.cs" />
<Compile Include="DAL\water_data.cs" />
<Compile Include="Model\device_data.cs" />
<Compile Include="Model\device_host.cs" />
<Compile Include="Model\device_info.cs" />
<Compile Include="Model\device_operation.cs" />
<Compile Include="Model\device_state.cs" />
@ -144,6 +143,7 @@
<Compile Include="Model\electrotherapy_room.cs" />
<Compile Include="Model\gas_data.cs" />
<Compile Include="api\get_carbon_measure.cs" />
<Compile Include="Model\host_parameter.cs" />
<Compile Include="Model\lighting_strategy.cs" />
<Compile Include="Model\meteorological_station.cs" />
<Compile Include="Model\planned_energy.cs" />
@ -151,6 +151,5 @@
<Compile Include="other\service_rating_data.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,12 +1,12 @@
/**
* device_host.cs
* host_parameter.cs
*
* N/A
* device_host
* host_parameter
*
* Ver
*
* V0.01 2024/2/1 10:18:14 N/A
* V0.01 2024/2/1 13:22:21 N/A
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*
@ -18,12 +18,12 @@ using System;
namespace DataServer.Model
{
/// <summary>
/// device_host:实体类(属性说明自动提取数据库字段的描述信息)
/// host_parameter:实体类(属性说明自动提取数据库字段的描述信息)
/// </summary>
[Serializable]
public partial class device_host
public partial class host_parameter
{
public device_host()
public host_parameter()
{}
#region Model
private string _hostid;

Binary file not shown.

View File

@ -1 +1 @@
098959a00783799e26d9b78bc1dbc8faad3ea038
7269330a6857a5dcb296b901e403539b3642fe2e

Binary file not shown.

Binary file not shown.

View File

@ -29,12 +29,12 @@ namespace DongYingAPI.Controllers.api
var time = DateTime.Now.ToString("yyyyMM");
if (date == "日")
{
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < 6; i++)
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -60,10 +60,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今月的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -87,10 +88,12 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -47,10 +47,11 @@ namespace DongYingAPI.Controllers.api
var blist = list.Where(x => x.DeviceName.Contains("地源侧循环泵")).ToList();
var clist = list.Where(x => x.DeviceName.Contains("主机控制柜")).ToList();
var now = DateTime.Now;
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今日的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -111,10 +112,11 @@ namespace DongYingAPI.Controllers.api
var blist = list.Where(x => x.DeviceName.Contains("地源侧循环泵")).ToList();
var clist = list.Where(x => x.DeviceName.Contains("主机控制柜")).ToList();
var now = DateTime.Now;
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今月的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -195,10 +197,11 @@ namespace DongYingAPI.Controllers.api
var blist = list.Where(x => x.DeviceName.Contains("地源侧循环泵")).ToList();
var clist = list.Where(x => x.DeviceName.Contains("主机控制柜")).ToList();
var now = DateTime.Now;
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -37,9 +37,14 @@ namespace DongYingAPI.Controllers.api
try
{
var data =new List<carbon_intensityData>();
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-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);

View File

@ -40,10 +40,11 @@ namespace DongYingAPI.Controllers
var data = new List<carbon_measureData>();
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -98,10 +99,11 @@ namespace DongYingAPI.Controllers
}
else if (date == "年")
{
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < 6; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -32,10 +32,11 @@ namespace DongYingAPI.Controllers.api
var time = DateTime.Now.ToString("yyyyMM");
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -62,10 +63,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -90,10 +92,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}
@ -128,10 +131,11 @@ namespace DongYingAPI.Controllers.api
var time = DateTime.Now.ToString("yyyyMM");
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
// 只处理今的数据
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -158,10 +162,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -186,10 +191,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}
@ -224,10 +230,11 @@ namespace DongYingAPI.Controllers.api
var time = DateTime.Now.ToString("yyyyMM");
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -254,10 +261,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -282,10 +290,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -30,7 +30,8 @@ namespace DongYingAPI.Controllers.api
if (room.type == "电流")
{
var data = new List<current_voltageData>();
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
var model=new current_voltageData();
model.time = DateTime.Now.AddHours(-i).ToString("HH:00");
@ -69,7 +70,8 @@ namespace DongYingAPI.Controllers.api
if (room.type == "电压")
{
var data = new List<current_voltageData>();
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
var model = new current_voltageData();
model.time = DateTime.Now.AddHours(-i).ToString("HH:00");

View File

@ -29,7 +29,8 @@ namespace DongYingAPI.Controllers.api
var data = new List<distribution_powerData>();
var list = bll_info.GetModelList("").Where(x => x.DeviceName == room.name).ToList();
var time = DateTime.Now.ToString("yyyyMM");
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
var model=new distribution_powerData();
model.time = DateTime.Now.AddHours(-i).ToString("HH:00");

View File

@ -32,10 +32,11 @@ namespace DongYingAPI.Controllers.api
var now = DateTime.Now;
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -84,10 +85,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -129,10 +131,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -1,4 +1,5 @@
using DataServer.api;
using DongYingAPI.Util;
using Newtonsoft.Json;
using System;
using System.Collections;
@ -35,16 +36,12 @@ namespace DongYingAPI.Controllers
var now = DateTime.Now;
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count =Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; 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)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -72,6 +69,10 @@ namespace DongYingAPI.Controllers
Time = Convert.ToDateTime(jdate).ToString("HH:00"),
EH = 0
};
if (model.EH < 0)
{
model.EH = 0;
}
data.Add(model);
}
else
@ -83,6 +84,10 @@ namespace DongYingAPI.Controllers
Time = Convert.ToDateTime(jdate).ToString("HH:00"),
EH = num1 - num2
};
if (model.EH < 0)
{
model.EH = 0;
}
data.Add(model);
}
@ -92,13 +97,9 @@ namespace DongYingAPI.Controllers
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今月的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
{
continue;
}
string jdate;
if (i == 0)
{
@ -133,7 +134,7 @@ 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)
if (model.EH < 0)
{
model.EH = 0;
}
@ -142,10 +143,11 @@ namespace DongYingAPI.Controllers
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}
@ -188,14 +190,14 @@ namespace DongYingAPI.Controllers
var model = new electricity_consumptionData(); ;
model.Time = jdate.ToString("MM月");
model.EH = num1 - num2;
if (model.EH > 0)
if (model.EH < 0)
{
model.EH = 0;
}
data.Add(model);
}
}
var adata = data.OrderBy(x => x.EH).ToList();
var adata = data.OrderBy(x => x.Time).ToList();
res.code = 200;
res.msg = "成功";
res.data = adata;

View File

@ -33,10 +33,11 @@ namespace DongYingAPI.Controllers.api
var list = bll_info.GetModelList(" FloorName='科技馆负一层地源热泵'");
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -74,10 +75,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -122,10 +124,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -23,10 +23,11 @@ namespace DongYingAPI.Controllers.api
var data = new List<gas_consumptionData>();
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -44,10 +45,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -65,10 +67,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -68,11 +68,11 @@ namespace DongYingAPI.Controllers.api
var list = bll_info.GetModelList("").Where(x => x.DeviceName.Contains("照明")).ToList();
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -112,10 +112,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "月")
{
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < 6; i++)
{
// 只处理今月的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -150,10 +151,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -31,11 +31,11 @@ namespace DongYingAPI.Controllers.api
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今日的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -62,10 +62,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今月的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -90,10 +91,11 @@ namespace DongYingAPI.Controllers.api
}
else if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -29,10 +29,11 @@ namespace DongYingAPI.Controllers.api
var list = bll.GetModelListDate("", time);
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -55,10 +56,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -79,10 +81,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -36,10 +36,11 @@ namespace DongYingAPI.Controllers.api
var now=DateTime.Now;
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -81,10 +82,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -131,10 +133,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < 6; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}
@ -196,10 +199,11 @@ namespace DongYingAPI.Controllers.api
var now = DateTime.Now;
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
// 只处理今的数据
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -241,10 +245,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -291,10 +296,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < 6; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}
@ -356,10 +362,11 @@ namespace DongYingAPI.Controllers.api
var now = DateTime.Now;
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Day != DateTime.Now.Day)
// 只处理今的数据
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
@ -401,10 +408,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
// 只处理今的数据
if (DateTime.Now.AddMonths(-i).Month != DateTime.Now.Month)
// 只处理今的数据
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
@ -451,10 +459,11 @@ namespace DongYingAPI.Controllers.api
}
if (date == "年")
{
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < 6; i++)
{
// 只处理今年的数据
if (DateTime.Now.AddYears(-i).Year != DateTime.Now.Year)
if (DateTime.Now.AddMonths(-i).Year != DateTime.Now.Year)
{
continue;
}

View File

@ -26,8 +26,13 @@ namespace DongYingAPI.Controllers.api
var list = bll.GetModelList("");
if (date == "日")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Hour);
for (int i = 0; i < time_count; i++)
{
if (DateTime.Now.AddHours(-i).Day != DateTime.Now.Day)
{
continue;
}
var now = DateTime.Now;
var time = now.AddHours(-i).ToString("HH:00");
//这个小时
@ -51,13 +56,22 @@ namespace DongYingAPI.Controllers.api
var model=new water_consumptionData();
model.time = time;
model.WaterValue = num1 - num2;
if (model.WaterValue < 0)
{
model.WaterValue = 0;
}
data.Add(model);
}
}
if (date == "月")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Day);
for (int i = 0; i < time_count; i++)
{
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
var now = DateTime.Now;
var time = now.AddDays(-i).ToString("MM-dd");
var ztime = "";
@ -91,13 +105,23 @@ namespace DongYingAPI.Controllers.api
var model = new water_consumptionData();
model.time = time;
model.WaterValue = num1 - num2;
model.WaterValue = num1 - num2;
if (model.WaterValue < 0)
{
model.WaterValue = 0;
}
data.Add(model);
}
}
if (date == "年")
{
for (int i = 0; i < 6; i++)
var time_count = Convert.ToInt32(DateTime.Now.Month);
for (int i = 0; i < time_count; i++)
{
if (DateTime.Now.AddDays(-i).Month != DateTime.Now.Month)
{
continue;
}
var now = DateTime.Now;
var time = now.AddMonths(-i).ToString("MM月");
var ztime1 = "";
@ -138,6 +162,11 @@ namespace DongYingAPI.Controllers.api
var model = new water_consumptionData();
model.time = time;
model.WaterValue = num1 - num2;
model.WaterValue = num1 - num2;
if (model.WaterValue < 0)
{
model.WaterValue = 0;
}
data.Add(model);
}
}

View File

@ -47,7 +47,7 @@
<ItemGroup>
<Reference Include="DataServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DataServer\bin\Debug\DataServer.dll</HintPath>
<HintPath>..\DataServer\bin\Release\DataServer.dll</HintPath>
</Reference>
<Reference Include="HslCommunication, Version=10.1.2.0, Culture=neutral, PublicKeyToken=cdb2261fa039ed67, processorArchitecture=MSIL">
<HintPath>..\packages\HslCommunication.10.1.2\lib\net451\HslCommunication.dll</HintPath>

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>E:\林谷项目\东营两馆一宫\后端框架\DongYing\DongYingAPI\bin\app.publish\</_PublishTargetUrl>
<History>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;</History>
<History>True|2024-02-01T06:38:16.2460751Z;True|2024-02-01T13:56:20.6256272+08:00;True|2024-02-01T10:10:55.0739031+08:00;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;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
@ -79,16 +79,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>09/10/2013 16:29:20</publishTime>
</File>
<File Include="bin/DataServer.dll">
<publishTime>01/31/2024 18:14:34</publishTime>
<publishTime>02/01/2024 13:39:38</publishTime>
</File>
<File Include="bin/DataServer.pdb">
<publishTime>01/31/2024 18:14:34</publishTime>
<publishTime>02/01/2024 13:39:38</publishTime>
</File>
<File Include="bin/DongYingAPI.dll">
<publishTime>02/01/2024 10:14:51</publishTime>
<publishTime>02/01/2024 15:22:34</publishTime>
</File>
<File Include="bin/DongYingAPI.pdb">
<publishTime>02/01/2024 10:14:51</publishTime>
<publishTime>02/01/2024 15:22:34</publishTime>
</File>
<File Include="bin/HslCommunication.dll">
<publishTime>08/03/2021 14:52:26</publishTime>
@ -394,22 +394,22 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/10/2024 13:26:12</publishTime>
</File>
<File Include="Controllers/api/GetAirConditionerController.cs">
<publishTime>02/01/2024 09:54:37</publishTime>
<publishTime>02/01/2024 14:46:23</publishTime>
</File>
<File Include="Controllers/api/GetBuildingLightingController.cs">
<publishTime>02/01/2024 09:28:11</publishTime>
</File>
<File Include="Controllers/api/GetCarbonEmissionController.cs">
<publishTime>02/01/2024 09:56:10</publishTime>
<publishTime>02/01/2024 14:47:53</publishTime>
</File>
<File Include="Controllers/api/GetCarbonFluxController.cs">
<publishTime>01/11/2024 18:27:33</publishTime>
</File>
<File Include="Controllers/api/GetCarbonIntensityController.cs">
<publishTime>01/12/2024 09:45:18</publishTime>
<publishTime>02/01/2024 14:49:15</publishTime>
</File>
<File Include="Controllers/api/GetCarbonMeasureController.cs">
<publishTime>02/01/2024 10:10:27</publishTime>
<publishTime>02/01/2024 14:51:17</publishTime>
</File>
<File Include="Controllers/api/GetCarbonOffsetController.cs">
<publishTime>01/10/2024 13:25:43</publishTime>
@ -421,10 +421,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/31/2024 18:13:29</publishTime>
</File>
<File Include="Controllers/api/GetChamberLoadController.cs">
<publishTime>02/01/2024 10:00:03</publishTime>
<publishTime>02/01/2024 14:54:17</publishTime>
</File>
<File Include="Controllers/api/GetCurrentVoltageController.cs">
<publishTime>01/31/2024 18:10:56</publishTime>
<publishTime>02/01/2024 14:55:51</publishTime>
</File>
<File Include="Controllers/api/GetDailyElectricityController.cs">
<publishTime>01/12/2024 15:06:05</publishTime>
@ -433,10 +433,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/30/2024 17:45:02</publishTime>
</File>
<File Include="Controllers/api/GetDeviceParameterController.cs">
<publishTime>01/12/2024 15:11:10</publishTime>
<publishTime>02/01/2024 13:56:01</publishTime>
</File>
<File Include="Controllers/api/GetDistributionPowerController.cs">
<publishTime>01/31/2024 16:19:42</publishTime>
<publishTime>02/01/2024 15:10:41</publishTime>
</File>
<File Include="Controllers/api/GetElectricalConditionController.cs">
<publishTime>01/31/2024 18:39:40</publishTime>
@ -448,13 +448,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/31/2024 16:39:57</publishTime>
</File>
<File Include="Controllers/api/GetElectricityConsumptionController.cs">
<publishTime>02/01/2024 10:01:29</publishTime>
<publishTime>02/01/2024 14:37:40</publishTime>
</File>
<File Include="Controllers/api/GetElectricQuantityController.cs">
<publishTime>02/01/2024 10:02:20</publishTime>
<publishTime>02/01/2024 14:57:16</publishTime>
</File>
<File Include="Controllers/api/GetEnergyTrendsController.cs">
<publishTime>02/01/2024 10:03:02</publishTime>
<publishTime>02/01/2024 15:10:41</publishTime>
</File>
<File Include="Controllers/api/GetEquipmentMonitoringController.cs">
<publishTime>01/31/2024 18:14:26</publishTime>
@ -466,16 +466,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/11/2024 13:37:00</publishTime>
</File>
<File Include="Controllers/api/GetGasConsumptionController.cs">
<publishTime>02/01/2024 10:03:47</publishTime>
<publishTime>02/01/2024 15:10:41</publishTime>
</File>
<File Include="Controllers/api/GetGeneralCatalogueController.cs">
<publishTime>01/24/2024 17:21:00</publishTime>
</File>
<File Include="Controllers/api/GetIlluminationLoadController.cs">
<publishTime>02/01/2024 10:04:57</publishTime>
<publishTime>02/01/2024 15:03:20</publishTime>
</File>
<File Include="Controllers/api/GetLightingLoadController.cs">
<publishTime>02/01/2024 10:10:27</publishTime>
<publishTime>02/01/2024 15:10:41</publishTime>
</File>
<File Include="Controllers/api/GetLightingMonitoringController.cs">
<publishTime>01/10/2024 16:58:07</publishTime>
@ -487,7 +487,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/30/2024 17:36:42</publishTime>
</File>
<File Include="Controllers/api/GetPowerLoadController.cs">
<publishTime>02/01/2024 10:06:37</publishTime>
<publishTime>02/01/2024 15:08:46</publishTime>
</File>
<File Include="Controllers/api/GetRealtimeDataController.cs">
<publishTime>01/31/2024 18:22:15</publishTime>
@ -496,13 +496,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/09/2024 17:02:14</publishTime>
</File>
<File Include="Controllers/api/GetRoomElectricityController.cs">
<publishTime>02/01/2024 10:08:52</publishTime>
<publishTime>02/01/2024 15:09:57</publishTime>
</File>
<File Include="Controllers/api/GetRunningStatusController.cs">
<publishTime>01/30/2024 17:33:34</publishTime>
</File>
<File Include="Controllers/api/GetWaterConsumptionController.cs">
<publishTime>01/31/2024 13:37:17</publishTime>
<publishTime>02/01/2024 15:22:13</publishTime>
</File>
<File Include="Controllers/api/loginController.cs">
<publishTime>01/09/2024 10:54:33</publishTime>
@ -580,7 +580,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>01/02/2024 09:27:24</publishTime>
</File>
<File Include="Web.config">
<publishTime>01/15/2024 11:00:59</publishTime>
<publishTime>02/01/2024 13:56:20</publishTime>
</File>
</ItemGroup>
</Project>

View File

@ -35,5 +35,41 @@ namespace DongYingAPI.Util
return 0;
}
}
/// <summary>
/// 计算两个时间的差别
/// </summary>
/// <param name="type"></param>
/// <param name="dynamicTime"></param>
/// <param name="currentDate"></param>
/// <returns></returns>
public static int GetUsedMonth2(string type, DateTime dynamicTime, DateTime currentDate)
{
try
{
int year = currentDate.Month - dynamicTime.Month; //月
int month = dynamicTime.Day-currentDate.Day; //日
int day = dynamicTime.Hour - currentDate.Hour;//小时 //int month1 = currentDate.Year * 12 + currentDate.Month - dynamicTime.Year * 12 - dynamicTime.Month; //相差的月份
if (type == "年")
{
return Convert.ToInt32(year);
}
else if(type=="月")
{
return Convert.ToInt32(month);
}
else if (type == "日")
{
return Convert.ToInt32(day);
}
else
{
return 0;
}
}
catch (Exception)
{
return 0;
}
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
6dd66ccb40f501fe19d1c9c146e1abf6c1d24609
663303696d9657af00206aa0ee4922bf9dbab726

View File

@ -63,7 +63,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="DataServer">
<HintPath>..\DataServer\bin\Debug\DataServer.dll</HintPath>
<HintPath>..\DataServer\bin\Release\DataServer.dll</HintPath>
</Reference>
<Reference Include="HslCommunication">
<HintPath>..\packages\HslCommunication.10.1.2\lib\net451\HslCommunication.dll</HintPath>

View File

@ -5,17 +5,7 @@ using System.ServiceProcess;
using System.Text;
using HslCommunication.MQTT;
using HslCommunication;
using DataServer.api;
using System.Collections.Generic;
using System.Runtime.Remoting.Channels;
using HslCommunication.Profinet.Geniitek;
using HslCommunication.Profinet.AllenBradley;
using System.Security.Policy;
using System.Text.RegularExpressions;
using LitJson;
using Newtonsoft.Json.Linq;
using System.Xml.Linq;
using System.Runtime.InteropServices;
namespace Security
{
@ -34,7 +24,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.host_parameter bll_host = new DataServer.BLL.host_parameter();
public ServiceSecurity()
{
InitializeComponent();
@ -5746,7 +5736,7 @@ namespace Security
if (item.dl.ContainsKey("1号压缩机当前容量"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "1号压缩机当前容量";
@ -5769,7 +5759,7 @@ namespace Security
}
if (item.dl.ContainsKey("1号压缩机主机运行状态"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "1号压缩机主机运行状态";
@ -5792,7 +5782,7 @@ namespace Security
}
if (item.dl.ContainsKey("2号压缩机当前容量"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "2号压缩机当前容量";
@ -5815,7 +5805,7 @@ namespace Security
}
if (item.dl.ContainsKey("2号压缩机主机运行状态"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "2号压缩机主机运行状态";
@ -5838,7 +5828,7 @@ namespace Security
}
if (item.dl.ContainsKey("3号压缩机当前容量"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "3号压缩机当前容量";
@ -5861,7 +5851,7 @@ namespace Security
}
if (item.dl.ContainsKey("3号压缩机主机运行状态"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "3号压缩机主机运行状态";
@ -5884,7 +5874,7 @@ namespace Security
}
if (item.dl.ContainsKey("本地远程指示0本地1远程"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "本地远程指示0本地1远程";
@ -5907,7 +5897,7 @@ namespace Security
}
if (item.dl.ContainsKey("电源电源单位V"))
{
var hmodel = new DataServer.Model.device_host();
var hmodel = new DataServer.Model.host_parameter();
hmodel.HostId = Guid.NewGuid().ToString("N");
hmodel.HostName = "一号主机";
hmodel.DeviceName = "电源电源单位V";
@ -5929,204 +5919,6 @@ namespace Security
}
}
}
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("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 == "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);
}
}

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>M35gbFM7GTDeHhYLvOzYTJUnd8unscXCkE14yPNwwH4=</dsig:DigestValue>
<dsig:DigestValue>4ch5AfcLtIzZPVLfMJ/ik2JeME0wtau+NLELeZ0EgiY=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -42,14 +42,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="163328">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="155648">
<assemblyIdentity name="DataServer" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>9km1gcVNWyjli/FvSB8HY8mLmhv1NJdJJyNVFTY36dU=</dsig:DigestValue>
<dsig:DigestValue>JfuOEh+ADhBVziCaijjA/je22YqH6PosXhjHyBumSVk=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@ -138,14 +138,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="ServiceSecurity.exe" size="105440">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="ServiceSecurity.exe" size="109024">
<assemblyIdentity name="ServiceSecurity" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>Zf3WECvVV2p3md+BpjkXIW9z4PJgHamKdrFraeGHhgg=</dsig:DigestValue>
<dsig:DigestValue>V8VaHiVOe6fnZRv9gWIdQ8TqAfmqLKEZSNMykAd32xA=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -1 +1 @@
9188912aea4f3bf964cf72ec7e5362953260c83a
f934b32f0702d40d90462ecfd610346cafedcd05

View File

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>M35gbFM7GTDeHhYLvOzYTJUnd8unscXCkE14yPNwwH4=</dsig:DigestValue>
<dsig:DigestValue>4ch5AfcLtIzZPVLfMJ/ik2JeME0wtau+NLELeZ0EgiY=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

View File

@ -42,14 +42,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="163328">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="DataServer.dll" size="155648">
<assemblyIdentity name="DataServer" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>9km1gcVNWyjli/FvSB8HY8mLmhv1NJdJJyNVFTY36dU=</dsig:DigestValue>
<dsig:DigestValue>JfuOEh+ADhBVziCaijjA/je22YqH6PosXhjHyBumSVk=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@ -138,14 +138,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="ServiceSecurity.exe" size="105440">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="ServiceSecurity.exe" size="109024">
<assemblyIdentity name="ServiceSecurity" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>Zf3WECvVV2p3md+BpjkXIW9z4PJgHamKdrFraeGHhgg=</dsig:DigestValue>
<dsig:DigestValue>V8VaHiVOe6fnZRv9gWIdQ8TqAfmqLKEZSNMykAd32xA=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>