实现获取节能量(节电率)接口、获取电费电价接口、获取设备运行情况接口功能
This commit is contained in:
parent
1e1a51c87e
commit
c226764c38
|
|
@ -18,15 +18,15 @@ using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Maticsoft.Common;
|
using Maticsoft.Common;
|
||||||
using DataService.Model;
|
using DataServer.Model;
|
||||||
namespace DataService.BLL
|
namespace DataServer.BLL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// device_operation
|
/// device_operation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class device_operation
|
public partial class device_operation
|
||||||
{
|
{
|
||||||
private readonly DataService.DAL.device_operation dal=new DataService.DAL.device_operation();
|
private readonly DataServer.DAL.device_operation dal=new DataServer.DAL.device_operation();
|
||||||
public device_operation()
|
public device_operation()
|
||||||
{}
|
{}
|
||||||
#region BasicMethod
|
#region BasicMethod
|
||||||
|
|
@ -41,7 +41,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加一条数据
|
/// 增加一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Add(DataService.Model.device_operation model)
|
public bool Add(DataServer.Model.device_operation model)
|
||||||
{
|
{
|
||||||
return dal.Add(model);
|
return dal.Add(model);
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新一条数据
|
/// 更新一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Update(DataService.Model.device_operation model)
|
public bool Update(DataServer.Model.device_operation model)
|
||||||
{
|
{
|
||||||
return dal.Update(model);
|
return dal.Update(model);
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.device_operation GetModel(string OperationId)
|
public DataServer.Model.device_operation GetModel(string OperationId)
|
||||||
{
|
{
|
||||||
|
|
||||||
return dal.GetModel(OperationId);
|
return dal.GetModel(OperationId);
|
||||||
|
|
@ -82,7 +82,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体,从缓存中
|
/// 得到一个对象实体,从缓存中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.device_operation GetModelByCache(string OperationId)
|
public DataServer.Model.device_operation GetModelByCache(string OperationId)
|
||||||
{
|
{
|
||||||
|
|
||||||
string CacheKey = "device_operationModel-" + OperationId;
|
string CacheKey = "device_operationModel-" + OperationId;
|
||||||
|
|
@ -100,7 +100,7 @@ namespace DataService.BLL
|
||||||
}
|
}
|
||||||
catch{}
|
catch{}
|
||||||
}
|
}
|
||||||
return (DataService.Model.device_operation)objModel;
|
return (DataServer.Model.device_operation)objModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -113,7 +113,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得数据列表
|
/// 获得数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DataService.Model.device_operation> GetModelList(string strWhere)
|
public List<DataServer.Model.device_operation> GetModelList(string strWhere)
|
||||||
{
|
{
|
||||||
DataSet ds = dal.GetList(strWhere);
|
DataSet ds = dal.GetList(strWhere);
|
||||||
return DataTableToList(ds.Tables[0]);
|
return DataTableToList(ds.Tables[0]);
|
||||||
|
|
@ -121,13 +121,13 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得数据列表
|
/// 获得数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DataService.Model.device_operation> DataTableToList(DataTable dt)
|
public List<DataServer.Model.device_operation> DataTableToList(DataTable dt)
|
||||||
{
|
{
|
||||||
List<DataService.Model.device_operation> modelList = new List<DataService.Model.device_operation>();
|
List<DataServer.Model.device_operation> modelList = new List<DataServer.Model.device_operation>();
|
||||||
int rowsCount = dt.Rows.Count;
|
int rowsCount = dt.Rows.Count;
|
||||||
if (rowsCount > 0)
|
if (rowsCount > 0)
|
||||||
{
|
{
|
||||||
DataService.Model.device_operation model;
|
DataServer.Model.device_operation model;
|
||||||
for (int n = 0; n < rowsCount; n++)
|
for (int n = 0; n < rowsCount; n++)
|
||||||
{
|
{
|
||||||
model = dal.DataRowToModel(dt.Rows[n]);
|
model = dal.DataRowToModel(dt.Rows[n]);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Ver 变更日期 负责人 变更内容
|
* Ver 变更日期 负责人 变更内容
|
||||||
* ───────────────────────────────────
|
* ───────────────────────────────────
|
||||||
* V0.01 2024/1/9 10:06:20 N/A 初版
|
* V0.01 2024/1/9 11:09:28 N/A 初版
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
||||||
*┌──────────────────────────────────┐
|
*┌──────────────────────────────────┐
|
||||||
|
|
@ -18,15 +18,15 @@ using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Maticsoft.Common;
|
using Maticsoft.Common;
|
||||||
using DataService.Model;
|
using DataServer.Model;
|
||||||
namespace DataService.BLL
|
namespace DataServer.BLL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// electricity_price
|
/// electricity_price
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class electricity_price
|
public partial class electricity_price
|
||||||
{
|
{
|
||||||
private readonly DataService.DAL.electricity_price dal=new DataService.DAL.electricity_price();
|
private readonly DataServer.DAL.electricity_price dal=new DataServer.DAL.electricity_price();
|
||||||
public electricity_price()
|
public electricity_price()
|
||||||
{}
|
{}
|
||||||
#region BasicMethod
|
#region BasicMethod
|
||||||
|
|
@ -41,7 +41,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加一条数据
|
/// 增加一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Add(DataService.Model.electricity_price model)
|
public bool Add(DataServer.Model.electricity_price model)
|
||||||
{
|
{
|
||||||
return dal.Add(model);
|
return dal.Add(model);
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新一条数据
|
/// 更新一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Update(DataService.Model.electricity_price model)
|
public bool Update(DataServer.Model.electricity_price model)
|
||||||
{
|
{
|
||||||
return dal.Update(model);
|
return dal.Update(model);
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.electricity_price GetModel(string PriceId)
|
public DataServer.Model.electricity_price GetModel(string PriceId)
|
||||||
{
|
{
|
||||||
|
|
||||||
return dal.GetModel(PriceId);
|
return dal.GetModel(PriceId);
|
||||||
|
|
@ -82,7 +82,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体,从缓存中
|
/// 得到一个对象实体,从缓存中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.electricity_price GetModelByCache(string PriceId)
|
public DataServer.Model.electricity_price GetModelByCache(string PriceId)
|
||||||
{
|
{
|
||||||
|
|
||||||
string CacheKey = "electricity_priceModel-" + PriceId;
|
string CacheKey = "electricity_priceModel-" + PriceId;
|
||||||
|
|
@ -100,7 +100,7 @@ namespace DataService.BLL
|
||||||
}
|
}
|
||||||
catch{}
|
catch{}
|
||||||
}
|
}
|
||||||
return (DataService.Model.electricity_price)objModel;
|
return (DataServer.Model.electricity_price)objModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -113,7 +113,7 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得数据列表
|
/// 获得数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DataService.Model.electricity_price> GetModelList(string strWhere)
|
public List<DataServer.Model.electricity_price> GetModelList(string strWhere)
|
||||||
{
|
{
|
||||||
DataSet ds = dal.GetList(strWhere);
|
DataSet ds = dal.GetList(strWhere);
|
||||||
return DataTableToList(ds.Tables[0]);
|
return DataTableToList(ds.Tables[0]);
|
||||||
|
|
@ -121,13 +121,13 @@ namespace DataService.BLL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得数据列表
|
/// 获得数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DataService.Model.electricity_price> DataTableToList(DataTable dt)
|
public List<DataServer.Model.electricity_price> DataTableToList(DataTable dt)
|
||||||
{
|
{
|
||||||
List<DataService.Model.electricity_price> modelList = new List<DataService.Model.electricity_price>();
|
List<DataServer.Model.electricity_price> modelList = new List<DataServer.Model.electricity_price>();
|
||||||
int rowsCount = dt.Rows.Count;
|
int rowsCount = dt.Rows.Count;
|
||||||
if (rowsCount > 0)
|
if (rowsCount > 0)
|
||||||
{
|
{
|
||||||
DataService.Model.electricity_price model;
|
DataServer.Model.electricity_price model;
|
||||||
for (int n = 0; n < rowsCount; n++)
|
for (int n = 0; n < rowsCount; n++)
|
||||||
{
|
{
|
||||||
model = dal.DataRowToModel(dt.Rows[n]);
|
model = dal.DataRowToModel(dt.Rows[n]);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Maticsoft.DBUtility;//Please add references
|
using Maticsoft.DBUtility;//Please add references
|
||||||
namespace DataService.DAL
|
namespace DataServer.DAL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据访问类:device_operation
|
/// 数据访问类:device_operation
|
||||||
|
|
@ -49,7 +49,7 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加一条数据
|
/// 增加一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Add(DataService.Model.device_operation model)
|
public bool Add(DataServer.Model.device_operation model)
|
||||||
{
|
{
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("insert into device_operation(");
|
strSql.Append("insert into device_operation(");
|
||||||
|
|
@ -91,7 +91,7 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新一条数据
|
/// 更新一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Update(DataService.Model.device_operation model)
|
public bool Update(DataServer.Model.device_operation model)
|
||||||
{
|
{
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("update device_operation set ");
|
strSql.Append("update device_operation set ");
|
||||||
|
|
@ -184,7 +184,7 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.device_operation GetModel(string OperationId)
|
public DataServer.Model.device_operation GetModel(string OperationId)
|
||||||
{
|
{
|
||||||
|
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
|
|
@ -194,7 +194,7 @@ namespace DataService.DAL
|
||||||
new MySqlParameter("@OperationId", MySqlDbType.VarChar,50) };
|
new MySqlParameter("@OperationId", MySqlDbType.VarChar,50) };
|
||||||
parameters[0].Value = OperationId;
|
parameters[0].Value = OperationId;
|
||||||
|
|
||||||
DataService.Model.device_operation model=new DataService.Model.device_operation();
|
DataServer.Model.device_operation model=new DataServer.Model.device_operation();
|
||||||
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
|
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
|
||||||
if(ds.Tables[0].Rows.Count>0)
|
if(ds.Tables[0].Rows.Count>0)
|
||||||
{
|
{
|
||||||
|
|
@ -210,9 +210,9 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.device_operation DataRowToModel(DataRow row)
|
public DataServer.Model.device_operation DataRowToModel(DataRow row)
|
||||||
{
|
{
|
||||||
DataService.Model.device_operation model=new DataService.Model.device_operation();
|
DataServer.Model.device_operation model=new DataServer.Model.device_operation();
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
if(row["OperationId"]!=null)
|
if(row["OperationId"]!=null)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Ver 变更日期 负责人 变更内容
|
* Ver 变更日期 负责人 变更内容
|
||||||
* ───────────────────────────────────
|
* ───────────────────────────────────
|
||||||
* V0.01 2024/1/9 10:06:20 N/A 初版
|
* V0.01 2024/1/9 11:09:28 N/A 初版
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
||||||
*┌──────────────────────────────────┐
|
*┌──────────────────────────────────┐
|
||||||
|
|
@ -19,7 +19,7 @@ using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Maticsoft.DBUtility;//Please add references
|
using Maticsoft.DBUtility;//Please add references
|
||||||
namespace DataService.DAL
|
namespace DataServer.DAL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据访问类:electricity_price
|
/// 数据访问类:electricity_price
|
||||||
|
|
@ -49,18 +49,18 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加一条数据
|
/// 增加一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Add(DataService.Model.electricity_price model)
|
public bool Add(DataServer.Model.electricity_price model)
|
||||||
{
|
{
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("insert into electricity_price(");
|
strSql.Append("insert into electricity_price(");
|
||||||
strSql.Append("PriceId,Cost,UnitPrice,AcquisitionTime,Remark1,Remark2,Remark3,Remark4,Remark5)");
|
strSql.Append("PriceId,Cost,UnitPrice,Month,Remark1,Remark2,Remark3,Remark4,Remark5)");
|
||||||
strSql.Append(" values (");
|
strSql.Append(" values (");
|
||||||
strSql.Append("@PriceId,@Cost,@UnitPrice,@AcquisitionTime,@Remark1,@Remark2,@Remark3,@Remark4,@Remark5)");
|
strSql.Append("@PriceId,@Cost,@UnitPrice,@Month,@Remark1,@Remark2,@Remark3,@Remark4,@Remark5)");
|
||||||
MySqlParameter[] parameters = {
|
MySqlParameter[] parameters = {
|
||||||
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50),
|
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50),
|
||||||
new MySqlParameter("@Cost", MySqlDbType.Decimal,10),
|
new MySqlParameter("@Cost", MySqlDbType.Decimal,10),
|
||||||
new MySqlParameter("@UnitPrice", MySqlDbType.Decimal,10),
|
new MySqlParameter("@UnitPrice", MySqlDbType.Decimal,10),
|
||||||
new MySqlParameter("@AcquisitionTime", MySqlDbType.DateTime),
|
new MySqlParameter("@Month", MySqlDbType.Int32),
|
||||||
new MySqlParameter("@Remark1", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark1", MySqlDbType.VarChar,255),
|
||||||
new MySqlParameter("@Remark2", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark2", MySqlDbType.VarChar,255),
|
||||||
new MySqlParameter("@Remark3", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark3", MySqlDbType.VarChar,255),
|
||||||
|
|
@ -69,7 +69,7 @@ namespace DataService.DAL
|
||||||
parameters[0].Value = model.PriceId;
|
parameters[0].Value = model.PriceId;
|
||||||
parameters[1].Value = model.Cost;
|
parameters[1].Value = model.Cost;
|
||||||
parameters[2].Value = model.UnitPrice;
|
parameters[2].Value = model.UnitPrice;
|
||||||
parameters[3].Value = model.AcquisitionTime;
|
parameters[3].Value = model.Month;
|
||||||
parameters[4].Value = model.Remark1;
|
parameters[4].Value = model.Remark1;
|
||||||
parameters[5].Value = model.Remark2;
|
parameters[5].Value = model.Remark2;
|
||||||
parameters[6].Value = model.Remark3;
|
parameters[6].Value = model.Remark3;
|
||||||
|
|
@ -89,13 +89,13 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新一条数据
|
/// 更新一条数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Update(DataService.Model.electricity_price model)
|
public bool Update(DataServer.Model.electricity_price model)
|
||||||
{
|
{
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("update electricity_price set ");
|
strSql.Append("update electricity_price set ");
|
||||||
strSql.Append("Cost=@Cost,");
|
strSql.Append("Cost=@Cost,");
|
||||||
strSql.Append("UnitPrice=@UnitPrice,");
|
strSql.Append("UnitPrice=@UnitPrice,");
|
||||||
strSql.Append("AcquisitionTime=@AcquisitionTime,");
|
strSql.Append("Month=@Month,");
|
||||||
strSql.Append("Remark1=@Remark1,");
|
strSql.Append("Remark1=@Remark1,");
|
||||||
strSql.Append("Remark2=@Remark2,");
|
strSql.Append("Remark2=@Remark2,");
|
||||||
strSql.Append("Remark3=@Remark3,");
|
strSql.Append("Remark3=@Remark3,");
|
||||||
|
|
@ -105,7 +105,7 @@ namespace DataService.DAL
|
||||||
MySqlParameter[] parameters = {
|
MySqlParameter[] parameters = {
|
||||||
new MySqlParameter("@Cost", MySqlDbType.Decimal,10),
|
new MySqlParameter("@Cost", MySqlDbType.Decimal,10),
|
||||||
new MySqlParameter("@UnitPrice", MySqlDbType.Decimal,10),
|
new MySqlParameter("@UnitPrice", MySqlDbType.Decimal,10),
|
||||||
new MySqlParameter("@AcquisitionTime", MySqlDbType.DateTime),
|
new MySqlParameter("@Month", MySqlDbType.Int32),
|
||||||
new MySqlParameter("@Remark1", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark1", MySqlDbType.VarChar,255),
|
||||||
new MySqlParameter("@Remark2", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark2", MySqlDbType.VarChar,255),
|
||||||
new MySqlParameter("@Remark3", MySqlDbType.VarChar,255),
|
new MySqlParameter("@Remark3", MySqlDbType.VarChar,255),
|
||||||
|
|
@ -114,7 +114,7 @@ namespace DataService.DAL
|
||||||
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50)};
|
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50)};
|
||||||
parameters[0].Value = model.Cost;
|
parameters[0].Value = model.Cost;
|
||||||
parameters[1].Value = model.UnitPrice;
|
parameters[1].Value = model.UnitPrice;
|
||||||
parameters[2].Value = model.AcquisitionTime;
|
parameters[2].Value = model.Month;
|
||||||
parameters[3].Value = model.Remark1;
|
parameters[3].Value = model.Remark1;
|
||||||
parameters[4].Value = model.Remark2;
|
parameters[4].Value = model.Remark2;
|
||||||
parameters[5].Value = model.Remark3;
|
parameters[5].Value = model.Remark3;
|
||||||
|
|
@ -179,17 +179,17 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.electricity_price GetModel(string PriceId)
|
public DataServer.Model.electricity_price GetModel(string PriceId)
|
||||||
{
|
{
|
||||||
|
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("select PriceId,Cost,UnitPrice,AcquisitionTime,Remark1,Remark2,Remark3,Remark4,Remark5 from electricity_price ");
|
strSql.Append("select PriceId,Cost,UnitPrice,Month,Remark1,Remark2,Remark3,Remark4,Remark5 from electricity_price ");
|
||||||
strSql.Append(" where PriceId=@PriceId ");
|
strSql.Append(" where PriceId=@PriceId ");
|
||||||
MySqlParameter[] parameters = {
|
MySqlParameter[] parameters = {
|
||||||
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50) };
|
new MySqlParameter("@PriceId", MySqlDbType.VarChar,50) };
|
||||||
parameters[0].Value = PriceId;
|
parameters[0].Value = PriceId;
|
||||||
|
|
||||||
DataService.Model.electricity_price model=new DataService.Model.electricity_price();
|
DataServer.Model.electricity_price model=new DataServer.Model.electricity_price();
|
||||||
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
|
DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
|
||||||
if(ds.Tables[0].Rows.Count>0)
|
if(ds.Tables[0].Rows.Count>0)
|
||||||
{
|
{
|
||||||
|
|
@ -205,9 +205,9 @@ namespace DataService.DAL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 得到一个对象实体
|
/// 得到一个对象实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataService.Model.electricity_price DataRowToModel(DataRow row)
|
public DataServer.Model.electricity_price DataRowToModel(DataRow row)
|
||||||
{
|
{
|
||||||
DataService.Model.electricity_price model=new DataService.Model.electricity_price();
|
DataServer.Model.electricity_price model=new DataServer.Model.electricity_price();
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
if(row["PriceId"]!=null)
|
if(row["PriceId"]!=null)
|
||||||
|
|
@ -222,9 +222,9 @@ namespace DataService.DAL
|
||||||
{
|
{
|
||||||
model.UnitPrice=decimal.Parse(row["UnitPrice"].ToString());
|
model.UnitPrice=decimal.Parse(row["UnitPrice"].ToString());
|
||||||
}
|
}
|
||||||
if(row["AcquisitionTime"]!=null && row["AcquisitionTime"].ToString()!="")
|
if(row["Month"]!=null && row["Month"].ToString()!="")
|
||||||
{
|
{
|
||||||
model.AcquisitionTime=DateTime.Parse(row["AcquisitionTime"].ToString());
|
model.Month=int.Parse(row["Month"].ToString());
|
||||||
}
|
}
|
||||||
if(row["Remark1"]!=null)
|
if(row["Remark1"]!=null)
|
||||||
{
|
{
|
||||||
|
|
@ -256,7 +256,7 @@ namespace DataService.DAL
|
||||||
public DataSet GetList(string strWhere)
|
public DataSet GetList(string strWhere)
|
||||||
{
|
{
|
||||||
StringBuilder strSql=new StringBuilder();
|
StringBuilder strSql=new StringBuilder();
|
||||||
strSql.Append("select PriceId,Cost,UnitPrice,AcquisitionTime,Remark1,Remark2,Remark3,Remark4,Remark5 ");
|
strSql.Append("select PriceId,Cost,UnitPrice,Month,Remark1,Remark2,Remark3,Remark4,Remark5 ");
|
||||||
strSql.Append(" FROM electricity_price ");
|
strSql.Append(" FROM electricity_price ");
|
||||||
if(strWhere.Trim()!="")
|
if(strWhere.Trim()!="")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*└──────────────────────────────────┘
|
*└──────────────────────────────────┘
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
namespace DataService.Model
|
namespace DataServer.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// device_operation:实体类(属性说明自动提取数据库字段的描述信息)
|
/// device_operation:实体类(属性说明自动提取数据库字段的描述信息)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Ver 变更日期 负责人 变更内容
|
* Ver 变更日期 负责人 变更内容
|
||||||
* ───────────────────────────────────
|
* ───────────────────────────────────
|
||||||
* V0.01 2024/1/9 10:06:20 N/A 初版
|
* V0.01 2024/1/9 11:09:28 N/A 初版
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
|
||||||
*┌──────────────────────────────────┐
|
*┌──────────────────────────────────┐
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
*└──────────────────────────────────┘
|
*└──────────────────────────────────┘
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
namespace DataService.Model
|
namespace DataServer.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// electricity_price:实体类(属性说明自动提取数据库字段的描述信息)
|
/// electricity_price:实体类(属性说明自动提取数据库字段的描述信息)
|
||||||
|
|
@ -29,7 +29,7 @@ namespace DataService.Model
|
||||||
private string _priceid;
|
private string _priceid;
|
||||||
private decimal? _cost;
|
private decimal? _cost;
|
||||||
private decimal? _unitprice;
|
private decimal? _unitprice;
|
||||||
private DateTime? _acquisitiontime;
|
private int _month;
|
||||||
private string _remark1;
|
private string _remark1;
|
||||||
private string _remark2;
|
private string _remark2;
|
||||||
private string _remark3;
|
private string _remark3;
|
||||||
|
|
@ -62,10 +62,10 @@ namespace DataService.Model
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? AcquisitionTime
|
public int Month
|
||||||
{
|
{
|
||||||
set{ _acquisitiontime=value;}
|
set{ _month=value;}
|
||||||
get{return _acquisitiontime;}
|
get{return _month;}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,32 @@ namespace DataServer.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class get_amount_energy_response
|
public class get_amount_energy_response
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回码
|
||||||
|
/// </summary>
|
||||||
|
public int code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回说明
|
||||||
|
/// </summary>
|
||||||
|
public string msg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public amount_energy data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class amount_energy
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 节能量
|
||||||
|
/// </summary>
|
||||||
|
public decimal Energy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 节电率
|
||||||
|
/// </summary>
|
||||||
|
public decimal PowerSavingRate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,19 @@ namespace DataServer.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class get_device_operation_response
|
public class get_device_operation_response
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回码
|
||||||
|
/// </summary>
|
||||||
|
public int code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回说明
|
||||||
|
/// </summary>
|
||||||
|
public string msg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public List<DataServer.Model.device_operation> data { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,37 @@ namespace DataServer.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class get_electricity_price_response
|
public class get_electricity_price_response
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回码
|
||||||
|
/// </summary>
|
||||||
|
public int code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回说明
|
||||||
|
/// </summary>
|
||||||
|
public string msg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public List<electricity_price> data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class electricity_price
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 电费
|
||||||
|
/// </summary>
|
||||||
|
public decimal Cost { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 销售单价
|
||||||
|
/// </summary>
|
||||||
|
public decimal UnitPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 月份
|
||||||
|
/// </summary>
|
||||||
|
public int Month { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
using System;
|
using DataServer.api.EnergyEfficiency;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
|
|
@ -12,5 +15,26 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetAmountEnergyController : ApiController
|
public class GetAmountEnergyController : ApiController
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取节能量(节电率)接口
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResponseMessage Get()
|
||||||
|
{
|
||||||
|
var res = new get_amount_energy_response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
res.code = 200;
|
||||||
|
res.msg = "成功";
|
||||||
|
res.data = new amount_energy() { Energy = 24.21m, PowerSavingRate = 19m };
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
res.code = 500;
|
||||||
|
res.msg = "失败," + ex.Message;
|
||||||
|
}
|
||||||
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
using System;
|
using DataServer.api.EnergyEfficiency;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
|
|
@ -12,5 +15,28 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetDeviceOperationController : ApiController
|
public class GetDeviceOperationController : ApiController
|
||||||
{
|
{
|
||||||
|
DataServer.BLL.device_operation bll = new DataServer.BLL.device_operation();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取设备运行情况接口
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResponseMessage Get()
|
||||||
|
{
|
||||||
|
var res = new get_device_operation_response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
res.code = 200;
|
||||||
|
res.msg = "成功";
|
||||||
|
res.data = bll.GetModelList("");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
res.code = 500;
|
||||||
|
res.msg = "失败," + ex.Message;
|
||||||
|
}
|
||||||
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
using System;
|
using DataServer.api.EnergyEfficiency;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
|
|
@ -12,5 +15,48 @@ namespace DongYingAPI.Controllers.api.EnergyEfficiency
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetElectricityPriceController : ApiController
|
public class GetElectricityPriceController : ApiController
|
||||||
{
|
{
|
||||||
|
DataServer.BLL.electricity_price bll = new DataServer.BLL.electricity_price();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取电费电价接口
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public HttpResponseMessage Get()
|
||||||
|
{
|
||||||
|
var res = new get_electricity_price_response();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
res.code = 200;
|
||||||
|
res.msg = "成功";
|
||||||
|
|
||||||
|
var now = DateTime.Now;
|
||||||
|
var month = now.Month;//当前月份
|
||||||
|
var start_month = now.AddMonths(-5);
|
||||||
|
var list = bll.GetModelList("");
|
||||||
|
|
||||||
|
var data = new List<electricity_price>();
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
var model = new electricity_price();
|
||||||
|
var new_month = start_month.AddMonths(i);
|
||||||
|
model.Month = new_month.Month;
|
||||||
|
var price_model = list.Where(a => a.Month == model.Month).FirstOrDefault();
|
||||||
|
if (price_model != null)
|
||||||
|
{
|
||||||
|
model.UnitPrice = price_model.UnitPrice.Value;
|
||||||
|
model.Cost = price_model.Cost.Value;
|
||||||
|
}
|
||||||
|
data.Add(model);
|
||||||
|
}
|
||||||
|
res.data = data;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
res.code = 500;
|
||||||
|
res.msg = "失败," + ex.Message;
|
||||||
|
}
|
||||||
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue