提交修改

This commit is contained in:
曾艳 2024-12-18 17:59:30 +08:00
parent 067b53334c
commit 4413be623e
10 changed files with 277 additions and 169 deletions

View File

@ -25,147 +25,147 @@ using System.Text;
namespace DataService.BLL
{
/// <summary>
/// electricity_data
/// </summary>
public partial class electricity_data
{
private readonly DataService.DAL.electricity_data dal=new DataService.DAL.electricity_data();
public electricity_data()
{}
#region BasicMethod
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string ElectricityId)
{
return dal.Exists(ElectricityId);
}
/// <summary>
/// electricity_data
/// </summary>
public partial class electricity_data
{
private readonly DataService.DAL.electricity_data dal = new DataService.DAL.electricity_data();
public electricity_data()
{ }
#region BasicMethod
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string ElectricityId)
{
return dal.Exists(ElectricityId);
}
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(DataService.Model.electricity_data model)
{
return dal.Add(model);
}
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(DataService.Model.electricity_data model)
{
return dal.Add(model);
}
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update(DataService.Model.electricity_data model)
{
return dal.Update(model);
}
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update(DataService.Model.electricity_data model)
{
return dal.Update(model);
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(string ElectricityId)
{
return dal.Delete(ElectricityId);
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool DeleteList(string ElectricityIdlist )
{
return dal.DeleteList(ElectricityIdlist );
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(string ElectricityId)
{
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataService.Model.electricity_data GetModel(string ElectricityId)
{
return dal.GetModel(ElectricityId);
}
return dal.Delete(ElectricityId);
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool DeleteList(string ElectricityIdlist)
{
return dal.DeleteList(ElectricityIdlist);
}
/// <summary>
/// 得到一个对象实体,从缓存中
/// </summary>
public DataService.Model.electricity_data GetModelByCache(string ElectricityId)
{
string CacheKey = "electricity_dataModel-" + ElectricityId;
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
if (objModel == null)
{
try
{
objModel = dal.GetModel(ElectricityId);
if (objModel != null)
{
int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
}
}
catch{}
}
return (DataService.Model.electricity_data)objModel;
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public DataService.Model.electricity_data GetModel(string ElectricityId)
{
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataService.Model.electricity_data> GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataService.Model.electricity_data> DataTableToList(DataTable dt)
{
List<DataService.Model.electricity_data> modelList = new List<DataService.Model.electricity_data>();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
DataService.Model.electricity_data model;
for (int n = 0; n < rowsCount; n++)
{
model = dal.DataRowToModel(dt.Rows[n]);
if (model != null)
{
modelList.Add(model);
}
}
}
return modelList;
}
return dal.GetModel(ElectricityId);
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetAllList()
{
return GetList("");
}
/// <summary>
/// 得到一个对象实体,从缓存中
/// </summary>
public DataService.Model.electricity_data GetModelByCache(string ElectricityId)
{
/// <summary>
/// 分页获取数据列表
/// </summary>
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
/// <summary>
/// 分页获取数据列表
/// </summary>
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
return dal.GetListByPage( strWhere, orderby, startIndex, endIndex);
}
string CacheKey = "electricity_dataModel-" + ElectricityId;
object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
if (objModel == null)
{
try
{
objModel = dal.GetModel(ElectricityId);
if (objModel != null)
{
int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
}
}
catch { }
}
return (DataService.Model.electricity_data)objModel;
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataService.Model.electricity_data> GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
/// <summary>
/// 获得数据列表
/// </summary>
public List<DataService.Model.electricity_data> DataTableToList(DataTable dt)
{
List<DataService.Model.electricity_data> modelList = new List<DataService.Model.electricity_data>();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
DataService.Model.electricity_data model;
for (int n = 0; n < rowsCount; n++)
{
model = dal.DataRowToModel(dt.Rows[n]);
if (model != null)
{
modelList.Add(model);
}
}
}
return modelList;
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetAllList()
{
return GetList("");
}
/// <summary>
/// 分页获取数据列表
/// </summary>
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
/// <summary>
/// 分页获取数据列表
/// </summary>
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
}
/// <summary>
/// 分页获取数据列表
/// </summary>
@ -195,6 +195,14 @@ namespace DataService.BLL
return dal.AddDate(model, date);
}
/// <summary>
/// 更新一条数据
/// </summary>
public bool UpdateDate(DataService.Model.electricity_data model, string date)
{
return dal.UpdateDate(model, date);
}
/// <summary>
/// 添加表
/// </summary>

View File

@ -541,6 +541,83 @@ namespace DataService.DAL
}
}
/// <summary>
/// 更新一条数据
/// </summary>
public bool UpdateDate(DataService.Model.electricity_data model, string date)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update electricity_data_" + date + " set ");
strSql.Append("DeviceName=@DeviceName,");
strSql.Append("EH=@EH,");
strSql.Append("P=@P,");
strSql.Append("Kvar=@Kvar,");
strSql.Append("Ia=@Ia,");
strSql.Append("Ib=@Ib,");
strSql.Append("Ic=@Ic,");
strSql.Append("Ua=@Ua,");
strSql.Append("Ub=@Ub,");
strSql.Append("Uc=@Uc,");
strSql.Append("ServiceRating=@ServiceRating,");
strSql.Append("CreateTime=@CreateTime,");
strSql.Append("EntireTime=@EntireTime,");
strSql.Append("Reserve1=@Reserve1,");
strSql.Append("Reserve2=@Reserve2,");
strSql.Append("Reserve3=@Reserve3,");
strSql.Append("Reserve4=@Reserve4,");
strSql.Append("Reserve5=@Reserve5");
strSql.Append(" where ElectricityId=@ElectricityId ");
MySqlParameter[] parameters = {
new MySqlParameter("@DeviceName", MySqlDbType.VarChar,255),
new MySqlParameter("@EH", MySqlDbType.Float,255),
new MySqlParameter("@P", MySqlDbType.Float,255),
new MySqlParameter("@Kvar", MySqlDbType.Float,255),
new MySqlParameter("@Ia", MySqlDbType.Float,255),
new MySqlParameter("@Ib", MySqlDbType.Float,255),
new MySqlParameter("@Ic", MySqlDbType.Float,255),
new MySqlParameter("@Ua", MySqlDbType.Float,255),
new MySqlParameter("@Ub", MySqlDbType.Float,255),
new MySqlParameter("@Uc", MySqlDbType.Float,255),
new MySqlParameter("@ServiceRating", MySqlDbType.Float,255),
new MySqlParameter("@CreateTime", MySqlDbType.DateTime),
new MySqlParameter("@EntireTime", MySqlDbType.DateTime),
new MySqlParameter("@Reserve1", MySqlDbType.VarChar,255),
new MySqlParameter("@Reserve2", MySqlDbType.VarChar,255),
new MySqlParameter("@Reserve3", MySqlDbType.VarChar,255),
new MySqlParameter("@Reserve4", MySqlDbType.VarChar,255),
new MySqlParameter("@Reserve5", MySqlDbType.VarChar,255),
new MySqlParameter("@ElectricityId", MySqlDbType.VarChar,255)};
parameters[0].Value = model.DeviceName;
parameters[1].Value = model.EH;
parameters[2].Value = model.P;
parameters[3].Value = model.Kvar;
parameters[4].Value = model.Ia;
parameters[5].Value = model.Ib;
parameters[6].Value = model.Ic;
parameters[7].Value = model.Ua;
parameters[8].Value = model.Ub;
parameters[9].Value = model.Uc;
parameters[10].Value = model.ServiceRating;
parameters[11].Value = model.CreateTime;
parameters[12].Value = model.EntireTime;
parameters[13].Value = model.Reserve1;
parameters[14].Value = model.Reserve2;
parameters[15].Value = model.Reserve3;
parameters[16].Value = model.Reserve4;
parameters[17].Value = model.Reserve5;
parameters[18].Value = model.ElectricityId;
int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 获得数据列表
/// </summary>

View File

@ -55,7 +55,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
var model = new carbon_intensityData()
{
time = DateTime.Now.AddMonths(-i).ToString("MM月"),
CarbonIntensity = Convert.ToDecimal(Math.Round((Convert.ToDouble(alist.Sum(x => x.EH) - blist.Sum(x => x.EH)) / 1000 * 0.5703) / 26010, 3))
CarbonIntensity = Convert.ToDecimal(Math.Round((Convert.ToDouble(alist.Sum(x => x.EH) - blist.Sum(x => x.EH)) / 1000 * 0.5703)*1000 / 26010, 3))
};
if (model.CarbonIntensity < 0)
{

View File

@ -38,7 +38,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
var model3 = new carbon_neutralData()
{
name = "绿证",
CarbonNeutral = "30"
CarbonNeutral = "35"
};
data.Add(model3);
res.code = 200;
@ -47,7 +47,6 @@ namespace LonglslandExhibitionCenter.Controllers.api
}
catch (Exception ex)
{
res.code = 500;
res.msg = "失败:" + ex.Message;
}

View File

@ -70,7 +70,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
var model = new energy_indexingData()
{
time = now.AddMonths(-i).ToString("MM月"),
EnergyIndexing = Convert.ToDecimal(Math.Round(Convert.ToDouble((num / 10000 * Convert.ToDecimal(1.229)) / 26010), 3))
EnergyIndexing = Convert.ToDecimal(Math.Round(Convert.ToDouble((num / 10000 * Convert.ToDecimal(1.229)) * 1000 / 26010), 3))
};
data.Add(model);
}
@ -108,7 +108,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
var model = new energy_indexingData()
{
time = now.AddYears(-i).ToString("yyyy"),
EnergyIndexing = Convert.ToDecimal(Math.Round(Convert.ToDouble((num / 10000 * Convert.ToDecimal(1.229)) / 26010), 3))
EnergyIndexing = Convert.ToDecimal(Math.Round(Convert.ToDouble((num / 10000 * Convert.ToDecimal(1.229)) * 1000 / 26010), 3))
};
data.Add(model);

View File

@ -34,7 +34,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
{
var data = new List<lighting_loadData>();
var now = DateTime.Now;
var list = bll.GetModelListDate("", time);
var list = bll.GetModelListDate(" Reserve2 like '%照明%' ", time);
if (!string.IsNullOrEmpty(date))
{
if (date == "日")
@ -57,6 +57,14 @@ namespace LonglslandExhibitionCenter.Controllers.api
}
if (date == "月")
{
var ytime = now.AddMonths(-1).ToString("yyyyMM");
var b = bll.IsExistsTable(date_base, "electricity_data_" + ytime);
if (b == false)
{
bll.CreateTable(ytime);
}
var list1 = bll.GetModelListDate(" Reserve2 like '%照明%' ", ytime);
var time_count = Convert.ToInt32(now.Day);
for (int i = 0; i < time_count; i++)
{
@ -64,13 +72,7 @@ namespace LonglslandExhibitionCenter.Controllers.api
var tedate = now.AddDays(-i + 1).ToString("yyyy-MM-dd 00:00:00");
var ysdate = now.AddMonths(-1).AddDays(-i).ToString("yyyy-MM-dd 00:00:00");
var yedate = now.AddMonths(-1).AddDays(-i + 1).ToString("yyyy-MM-dd 00:00:00");
var ytime = now.AddMonths(-1).ToString("yyyyMM");
var b = bll.IsExistsTable(date_base, "electricity_data_" + ytime);
if (b == false)
{
bll.CreateTable(ytime);
}
var list1 = bll.GetModelListDate("", ytime);
var alist = list.Where(x => x.EntireTime >= Convert.ToDateTime(tsdate) && x.EntireTime < Convert.ToDateTime(tedate) && x.Reserve2.Contains("照明")).ToList();
var blist = list1.Where(x => x.EntireTime >= Convert.ToDateTime(ysdate) && x.EntireTime < Convert.ToDateTime(yedate) && x.Reserve2.Contains("照明")).ToList();
var model = new lighting_loadData()

View File

@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>F:\项目\长岛展览馆\项目\LonglslandExhibitionCenter\LonglslandExhibitionCenter\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/Web API</Controller_SelectedScaffolderCategoryPath>

View File

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>F:\项目\长岛展览馆\发布文件</_PublishTargetUrl>
<History>True|2024-10-18T07:40:22.1071380Z;True|2024-10-18T10:43:40.6685613+08:00;True|2024-10-18T10:42:14.0970919+08:00;True|2024-09-19T14:04:55.6320188+08:00;True|2024-09-19T09:42:19.8527457+08:00;True|2024-08-27T21:03:21.5928516+08:00;True|2024-08-21T11:09:27.6586574+08:00;True|2024-08-19T10:17:16.4446095+08:00;True|2024-08-15T13:20:14.7663530+08:00;True|2024-08-14T10:07:28.2388461+08:00;True|2024-08-14T10:07:03.3134871+08:00;True|2024-08-14T10:06:43.4199921+08:00;True|2024-08-14T10:05:39.6303984+08:00;True|2024-08-14T10:00:18.4168360+08:00;True|2024-08-14T09:50:15.7791885+08:00;True|2024-08-11T20:53:54.5556138+08:00;True|2024-08-10T16:00:18.6655642+08:00;True|2024-08-10T10:41:02.8962798+08:00;True|2024-08-10T10:31:34.0807175+08:00;True|2024-08-10T10:11:01.4518697+08:00;True|2024-08-09T17:46:23.3977253+08:00;True|2024-08-09T14:57:51.6409237+08:00;True|2024-08-09T14:12:02.8124286+08:00;True|2024-08-09T13:57:09.6566238+08:00;True|2024-08-09T13:55:09.1957591+08:00;True|2024-08-09T13:53:12.0978886+08:00;True|2024-08-09T10:21:25.5364378+08:00;True|2024-08-08T17:30:17.0495176+08:00;True|2024-08-08T14:01:01.6427032+08:00;True|2024-08-08T10:26:20.9380493+08:00;True|2024-08-06T16:16:42.4971554+08:00;True|2024-04-15T08:46:26.1708600+08:00;True|2024-04-15T08:43:47.1675051+08:00;True|2024-03-20T09:52:41.5444999+08:00;True|2024-03-20T09:52:28.9463180+08:00;True|2024-03-19T16:26:27.2407972+08:00;True|2024-03-19T15:50:07.1464827+08:00;True|2024-03-14T15:48:46.0852411+08:00;True|2024-03-12T11:15:35.2934238+08:00;True|2024-03-07T16:29:08.9381292+08:00;True|2024-03-05T14:31:05.6269677+08:00;True|2024-03-04T14:37:08.7040845+08:00;True|2024-02-28T11:11:35.8506164+08:00;</History>
<History>True|2024-11-06T09:50:52.1366136Z;True|2024-11-06T17:38:02.9494823+08:00;True|2024-11-06T16:22:33.8030507+08:00;True|2024-10-18T15:40:22.1071380+08:00;True|2024-10-18T10:43:40.6685613+08:00;True|2024-10-18T10:42:14.0970919+08:00;True|2024-09-19T14:04:55.6320188+08:00;True|2024-09-19T09:42:19.8527457+08:00;True|2024-08-27T21:03:21.5928516+08:00;True|2024-08-21T11:09:27.6586574+08:00;True|2024-08-19T10:17:16.4446095+08:00;True|2024-08-15T13:20:14.7663530+08:00;True|2024-08-14T10:07:28.2388461+08:00;True|2024-08-14T10:07:03.3134871+08:00;True|2024-08-14T10:06:43.4199921+08:00;True|2024-08-14T10:05:39.6303984+08:00;True|2024-08-14T10:00:18.4168360+08:00;True|2024-08-14T09:50:15.7791885+08:00;True|2024-08-11T20:53:54.5556138+08:00;True|2024-08-10T16:00:18.6655642+08:00;True|2024-08-10T10:41:02.8962798+08:00;True|2024-08-10T10:31:34.0807175+08:00;True|2024-08-10T10:11:01.4518697+08:00;True|2024-08-09T17:46:23.3977253+08:00;True|2024-08-09T14:57:51.6409237+08:00;True|2024-08-09T14:12:02.8124286+08:00;True|2024-08-09T13:57:09.6566238+08:00;True|2024-08-09T13:55:09.1957591+08:00;True|2024-08-09T13:53:12.0978886+08:00;True|2024-08-09T10:21:25.5364378+08:00;True|2024-08-08T17:30:17.0495176+08:00;True|2024-08-08T14:01:01.6427032+08:00;True|2024-08-08T10:26:20.9380493+08:00;True|2024-08-06T16:16:42.4971554+08:00;True|2024-04-15T08:46:26.1708600+08:00;True|2024-04-15T08:43:47.1675051+08:00;True|2024-03-20T09:52:41.5444999+08:00;True|2024-03-20T09:52:28.9463180+08:00;True|2024-03-19T16:26:27.2407972+08:00;True|2024-03-19T15:50:07.1464827+08:00;True|2024-03-14T15:48:46.0852411+08:00;True|2024-03-12T11:15:35.2934238+08:00;True|2024-03-07T16:29:08.9381292+08:00;True|2024-03-05T14:31:05.6269677+08:00;True|2024-03-04T14:37:08.7040845+08:00;True|2024-02-28T11:11:35.8506164+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
@ -82,10 +82,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>05/08/2024 00:05:28</publishTime>
</File>
<File Include="bin/DataService.dll">
<publishTime>09/27/2024 17:28:37</publishTime>
<publishTime>11/06/2024 16:22:24</publishTime>
</File>
<File Include="bin/DataService.pdb">
<publishTime>09/27/2024 17:28:37</publishTime>
<publishTime>11/06/2024 16:22:24</publishTime>
</File>
<File Include="bin/Enums.NET.dll">
<publishTime>11/19/2022 06:40:50</publishTime>
@ -106,10 +106,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<publishTime>08/13/2024 17:44:43</publishTime>
</File>
<File Include="bin/LonglslandExhibitionCenter.dll">
<publishTime>10/18/2024 15:40:16</publishTime>
<publishTime>11/06/2024 17:50:50</publishTime>
</File>
<File Include="bin/LonglslandExhibitionCenter.pdb">
<publishTime>10/18/2024 15:40:16</publishTime>
<publishTime>11/06/2024 17:50:50</publishTime>
</File>
<File Include="bin/MathNet.Numerics.dll">
<publishTime>04/03/2022 22:02:06</publishTime>

View File

@ -411,7 +411,8 @@ namespace Security
var msg = Encoding.UTF8.GetString(payload);
try
{
var date = DateTime.Now.ToString("yyyyMM");
var d_now = DateTime.Now;
var date = d_now.ToString("yyyyMM");
var a = bll.IsExistsTable("changdao_zhanlanguang", "electricity_data_" + date);
if (a == false)
{
@ -441,9 +442,9 @@ namespace Security
if (!string.IsNullOrEmpty(name))
{
var device_name = GetDeviceName1(Convert.ToInt32(name));
var now = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var now = d_now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var ddate = Convert.ToDateTime(now);
var dtime = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
var dtime = d_now.AddMonths(-1).ToString("yyyyMM");
var sddate = Convert.ToDateTime(ddate.AddHours(-1));
var list = bll.GetModelListDate(" Reserve1='配电室低压' ", date).Where(x => x.EntireTime == ddate).ToList();
//if (list.Count < 74)
@ -481,7 +482,7 @@ namespace Security
// }
//}
var edate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
var edate = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
var clist = bll.GetModelListDate("", date).Where(x => x.DeviceName == device_name && x.EntireTime == Convert.ToDateTime(edate)).ToList();
if (clist.Count == 0)
{
@ -526,8 +527,8 @@ namespace Security
model.Kvar = item.dl["01030012"];
}
#endregion
model.CreateTime = DateTime.Now;
model.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
model.CreateTime = d_now;
model.EntireTime = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
model.Reserve1 = "配电室低压";
model.Reserve2 = GetDeviceName4(Convert.ToInt32(name));
if (model.EH != null && model.Ua != null && model.Ub != null && model.Uc != null && model.Ia != null && model.Ib != null && model.Ic != null && model.P != null && model.Kvar != null)
@ -565,9 +566,9 @@ namespace Security
}
if (!string.IsNullOrEmpty(name))
{
var now = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var now = d_now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var ddate = Convert.ToDateTime(now);
var dtime = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
var dtime = d_now.AddMonths(-1).ToString("yyyyMM");
var sddate = Convert.ToDateTime(ddate.AddHours(-1));
var list = bll.GetModelListDate(" Reserve1='配电室高压' ", date).Where(x => x.EntireTime == ddate).ToList();
//if (list.Count < 2)
@ -606,7 +607,7 @@ namespace Security
//}
var device_name = GetDeviceName2(Convert.ToInt32(name));
var edate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
var edate = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
var clist = bll.GetModelListDate("", date).Where(x => x.DeviceName == device_name && x.EntireTime == Convert.ToDateTime(edate)).ToList();
if (clist.Count == 0)
{
@ -651,8 +652,8 @@ namespace Security
model.Kvar = item.dl["01030012"];
}
#endregion
model.CreateTime = DateTime.Now;
model.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
model.CreateTime = d_now;
model.EntireTime = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
model.Reserve1 = "配电室高压";
//model.Reserve2 = GetDeviceName4(Convert.ToInt32(name));
if (model.EH != null && model.Ua != null && model.Ub != null && model.Uc != null && model.Ia != null && model.Ib != null && model.Ic != null && model.P != null && model.Kvar != null)
@ -689,9 +690,9 @@ namespace Security
if (!string.IsNullOrEmpty(name))
{
//log.Info("电能-室外箱变:" + msg);
var now = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var now = d_now.AddHours(-1).ToString("yyyy-MM-dd HH:00:00");
var ddate = Convert.ToDateTime(now);
var dtime = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
var dtime = d_now.AddMonths(-1).ToString("yyyyMM");
var sddate = Convert.ToDateTime(ddate.AddHours(-1));
var list = bll.GetModelListDate(" Reserve1='电能-室外箱变' ", date).Where(x => x.EntireTime == ddate).ToList();
//if (list.Count < 8)
@ -729,7 +730,7 @@ namespace Security
// }
//}
var device_name = GetDeviceName3(Convert.ToInt32(name));
var edate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
var edate = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
var clist = bll.GetModelListDate("", date).Where(x => x.DeviceName == device_name && x.EntireTime == Convert.ToDateTime(edate)).ToList();
if (clist.Count == 0)
{
@ -774,8 +775,8 @@ namespace Security
model.Kvar = item.dl["01030012"];
}
#endregion
model.CreateTime = DateTime.Now;
model.EntireTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:00:00"));
model.CreateTime = d_now;
model.EntireTime = Convert.ToDateTime(d_now.ToString("yyyy-MM-dd HH:00:00"));
model.Reserve1 = "电能-室外箱变";
//model.Reserve2 = GetDeviceName4(Convert.ToInt32(name));
if (model.EH != null && model.Ua != null && model.Ub != null && model.Uc != null && model.Ia != null && model.Ib != null && model.Ic != null && model.P != null && model.Kvar != null)

View File

@ -43,6 +43,27 @@ namespace Supplement
log = log4net.LogManager.GetLogger("loginfo");
log.Info("启动服务");
//decimal totalReduction = 233445.798m;
//var list = electricity_bll.GetModelListDate(" EntireTime='2024-08-01 00:00:00' and Reserve1='配电室低压' order by DeviceName asc ", "202408");
//// 计算总和
//var totalSum = list.Sum(a => a.EH);
//var error = 0;
//foreach (var item in list)
//{
// var reductions = (item.EH.Value / totalSum) * totalReduction;
// item.EH = item.EH - reductions;
// if(!electricity_bll.UpdateDate(item, "202408"))
// {
// error++;
// }
//}
//var totalSum2 = list.Sum(a => a.EH);
date_base = ConfigurationManager.AppSettings["changdao_zhanlanguang"];
timer1 = new System.Timers.Timer();
@ -62,7 +83,7 @@ namespace Supplement
{
log.Info("开始补录");
var now = DateTime.Now;
var start_time = DateTime.Parse(now.AddHours(-14).ToString("yyyy-MM-dd HH:00:00"));
var start_time = DateTime.Parse(now.AddDays(-7).ToString("yyyy-MM-dd HH:00:00"));
var end_time = DateTime.Parse(now.ToString("yyyy-MM-dd HH:00:00"));
var stime = start_time.ToString("yyyyMM");
var etime = end_time.ToString("yyyyMM");