云平台下发尖峰平谷调试

master
xjl 3 months ago
parent e6e229fade
commit 900d7646a1

@ -31,12 +31,19 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName="version")]
public int Version {get;set;}
/// <summary>
/// Desc:生效时间;生效时间(左开右闭)
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="start_time")]
/// <summary>
/// Desc:云平台版本号;版本号,唯一
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "ceid")]
public string Ceid { get; set; }
/// <summary>
/// Desc:生效时间;生效时间(左开右闭)
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="start_time")]
public DateTime? StartTime {get;set;}
/// <summary>

@ -214,43 +214,43 @@ public class CloudClientMgr
if (CloudClient.Connected)
{
if (StationConstant.StationModel.Remote == BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
StaticStationInfo.StationModel))
{
CloudApi.SendStateLog();
}
//if (StationConstant.StationModel.Remote == BaseEnumExtensions.GetEnumByCode<StationConstant.StationModel>(
//StaticStationInfo.StationModel))
//{
// CloudApi.SendStateLog();
//}
TaskHostStatusReported();
TaskAirConditioningData();
//TaskAirConditioningData();
TaskTemperatureHumidityData();
//TaskTemperatureHumidityData();
TaskPowerTotal();
//TaskPowerTotal();
TaskStaChargingTota();
//TaskStaChargingTota();
TaskMeterEnergyKwh();
//TaskMeterEnergyKwh();
TaskMeterDayEnergyVal();
//TaskMeterDayEnergyVal();
TaskStaHourEnergyVal();
//TaskStaHourEnergyVal();
TaskStaDayEnergyVal();
//TaskStaDayEnergyVal();
TaskStaDayOpeEnergyVal();
//TaskStaDayOpeEnergyVal();
//TaskStaHourAmountVal();
////TaskStaHourAmountVal();
SendRealTimeFaultInfo();
//SendRealTimeFaultInfo();
SendStartLogMessage();
//SendStartLogMessage();
SendBatteryTotal();
//SendBatteryTotal();
SendChargingTotalDis();
//SendChargingTotalDis();
}
Thread.Sleep(1000);
}
@ -717,7 +717,7 @@ public class CloudClientMgr
}
/// <summary>
/// 换电站分时用电统计信息
/// 换电站分时用电统计信息(站控不计价,这一帧不要)
/// </summary>
private static void TaskStaHourAmountVal()
{

@ -0,0 +1,83 @@
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using Newtonsoft.Json;
using Repository.Station;
using Service.Cloud.Client;
using Service.Cloud.Common;
using Service.Cloud.Msg.Cloud.Req;
using Service.Cloud.Msg.Host.Resp;
namespace Service.Cloud.Handler;
[Scope]
public class ElectricityPriceModelHandler : IBaseHandler
{
private ElecPriceModelVersionRepository _versionRepository;
private ElecPriceModelVersionDetailRepository _detailRepository;
public ElectricityPriceModelHandler(ElecPriceModelVersionRepository elecPriceModelVersionRepository,
ElecPriceModelVersionDetailRepository elecPriceModelVersionDetailRepository)
{
this._versionRepository = elecPriceModelVersionRepository;
this._detailRepository = elecPriceModelVersionDetailRepository;
}
//两个电价帧用这个,另一个不用
public bool CanHandle(string cmd)
{
return CloudConst.setStaPrice == cmd;
}
public void Handle(string t)
{
SetStaPrice? priceModel = JsonConvert.DeserializeObject<SetStaPrice>(t);
if (priceModel != null)
{
if (priceModel.priceTemp.Count>0)
{
ElecPriceModelVersion version = _versionRepository.QueryByClause(d => d.Ceid == priceModel.priceTemp[0].ceid);
if (version == null)
{
var version01 = _versionRepository.QueryListByClause(d => d.Ceid != null, 1, "desc");
version = new ElecPriceModelVersion
{
Version = version01 == null ? 1:version01[0].Version + 1,
Ceid = priceModel.priceTemp[0].ceid,
};
}
version.StartTime = DateTime.Now;
version.EndTime = DateTime.Now.AddYears(10);
_versionRepository.InsertOrUpdate(version);
List<PriceTemp>? segs = priceModel.priceTemp;
if (segs is { Count: > 0 })
{
List<ElecPriceModelVersionDetail> versionDetails = segs.Select(d => new ElecPriceModelVersionDetail()
{
Version = version.Version,
Price = (int)d.ep,//* 10000
Type = d.pr,
StartHour = d.st.Hour,
StartMinute = d.st.Minute,
StartSecond = d.st.Second,
EndHour = d.et.Hour,
EndMinute = d.et.Minute,
EndSecond = d.et.Second
}).ToList();
//先删除同模型ID的数据
_detailRepository.Delete(u=>u.Version== version.Version);
_detailRepository.Insert(versionDetails);
}
}
SetStaPriceRes resp = new SetStaPriceRes();
CloudClientMgr.CloudClient?.Publish(resp);
}
}
}

@ -12,36 +12,50 @@ namespace Service.Cloud.Msg.Cloud.Req
/// </summary>
public class SetStaPrice : ICmd
{
/// <summary>
/// 计费模型ID
/// 唯一的计费 id由服务器统一进行分配
/// </summary>
public int eid { get; set; }
/// <summary>
/// 更新时间
/// 格 yyyy-MM-ddHH:mm:ss”
/// 格式”yyyy-MM-dd HH:mm:ss”
/// </summary>
public string ut { get; set; }
public List<PriceTemp>? priceTemp { get; set; }
public string GetCmd()
{
return CloudConst.setStaPrice;
}
}
public class PriceTemp
{
/// <summary>
/// 电价模型id
/// 由服务器统一进行分配
/// </summary>
public string ceid { get; set; }
/// <summary>
/// 电价
/// 精度 0.0001 元
/// </summary>
public float ep { get; set; }
/// <summary>
/// 开始时段
/// 格式”HH:mm:ss”精确到小时
/// </summary>
public string st { get; set; }
public DateTime st { get; set; }
/// <summary>
/// 结束时段
/// 格式“HH:mm:ss” 精确到小时
/// </summary>
public string et { get; set; }
public DateTime et { get; set; }
/// <summary>
/// 换电服务单价
/// 0.001
/// 时段序号
/// 对应尖峰平谷序号1:尖; 2:峰; 3:平; 4
/// <see cref="Entity.Constant.CloudEnum.PeriodNumber"/>
/// </summary>
public double pr { get; set; }
public string GetCmd()
{
return CloudConst.setStaPrice;
}
public int pr { get; set; }
}
}

@ -13,36 +13,42 @@ namespace Service.Cloud.Msg.Host.Resp
public class SetStaPriceRes : ICmd
{
/// <summary>
/// 更新时间
/// 格式”yyyy-MM-dd HH:mm:ss”
/// 应答结果
/// 0:成功 1:失败
/// <see cref="Entity.Constant.CloudEnum.ResultInt"/>
/// </summary>
public string ut { get; set; }
/// <summary>
/// 电价模型 id
/// 由服务器统一进行分配
/// </summary>
public int ceid { get; set; }
/// <summary>
/// 电价
/// 精度 0.0001 元
/// </summary>
public float ep { get; set; }
/// <summary>
/// 开始时段
/// 格式”HH:mm:ss”精确到小时
/// </summary>
public string st { get; set; }
/// <summary>
/// 结束时段
/// 格式“HH:mm:ss” 精确到小时
/// </summary>
public string et { get; set; }
/// <summary>
/// 时段序号
/// 对应尖峰平谷序号1:尖; 2:峰; 3:平; 4
/// <see cref="Entity.Constant.CloudEnum.PeriodNumber"/>
/// </summary>
public int pr { get; set; }
public int re { get; set; }
///// <summary>
///// 更新时间
///// 格式”yyyy-MM-dd HH:mm:ss”
///// </summary>
//public string ut { get; set; }
///// <summary>
///// 电价模型 id
///// 由服务器统一进行分配
///// </summary>
//public int ceid { get; set; }
///// <summary>
///// 电价
///// 精度 0.0001 元
///// </summary>
//public float ep { get; set; }
///// <summary>
///// 开始时段
///// 格式”HH:mm:ss”精确到小时
///// </summary>
//public string st { get; set; }
///// <summary>
///// 结束时段
///// 格式“HH:mm:ss” 精确到小时
///// </summary>
//public string et { get; set; }
///// <summary>
///// 时段序号
///// 对应尖峰平谷序号1:尖; 2:峰; 3:平; 4
///// <see cref="Entity.Constant.CloudEnum.PeriodNumber"/>
///// </summary>
//public int pr { get; set; }
public string GetCmd()
{

@ -2,4 +2,8 @@ ALTER TABLE equip_alarm_record
ADD COLUMN upload_status INT DEFAULT 0 COMMENT '上报状态 0未上传 1已上传';
ALTER TABLE equip_alarm_process_record
ADD COLUMN upload_status INT DEFAULT 0 COMMENT '上报状态 0未上传 1已上传';
ADD COLUMN upload_status INT DEFAULT 0 COMMENT '上报状态 0未上传 1已上传';
ALTER TABLE elec_price_model_version
ADD COLUMN ceid VARCHAR(50) COMMENT '云平台模型ID';
Loading…
Cancel
Save