与平台接口

zw
xjl 4 months ago
parent e8b0b56348
commit 49c471369d

@ -33,7 +33,7 @@ public class EmeterEnergy
/// 上报标识0未上传 1上传
/// </summary>
[SugarColumn(ColumnName = "upload_flag")]
public virtual string UploadFlag { get; set; }
public virtual int UploadFlag { get; set; }
/// <summary>
/// 统计sql小时接收

@ -4,7 +4,7 @@ using SqlSugar;
namespace Repository.Station;
[Scope]
[Scope("SingleInstance")]
public class EquipAlarmProcessRecordRepository : BaseRepository<EquipAlarmProcessRecord>
{
public EquipAlarmProcessRecordRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)

@ -1,5 +1,6 @@
using Entity.Ammeter;
using HybirdFrameworkCore.Autofac.Attribute;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Repository.Ammeter;
using SqlSugar;
@ -13,6 +14,7 @@ public class EmeterEnergyChangeService : BaseServices<EmeterEnergyChange>
public EmeterEnergyChangeService(EmeterEnergyChangeRepository emeterEnergyChangeRep)
{
_emeterEnergyChangeRep = emeterEnergyChangeRep;
BaseDal = emeterEnergyChangeRep;
}
/// <summary>

@ -14,8 +14,10 @@ namespace Service.Ammeter
[Scope("SingleInstance")]
public class EmeterHourEnergyService: BaseServices<EmeterHourEnergy>
{
EmeterHourEnergyRepository _emeterHourEnergyRepository;
public EmeterHourEnergyService(EmeterHourEnergyRepository service)
{
_emeterHourEnergyRepository = service;
this.BaseDal = service;
}

@ -512,7 +512,13 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
this.Publish(eqmStateStartLogInfo);
return StartLog.GetResp(timeSpan);
}
public EvmDataInfoRes? SendTemperatureHumidityData(EvmDataInfo evmDataInfo,
/// <summary>
/// 温湿度
/// </summary>
/// <param name="evmDataInfo"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public EvmDataInfoRes? SendEvmDataInfo(EvmDataInfo evmDataInfo,
TimeSpan timeSpan)
{
this.TemperatureHumidity.Req = evmDataInfo;
@ -538,7 +544,12 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
this.Publish(cardataReport);
return VehicleData.GetResp(timeSpan);
}
/// <summary>
/// 充电订单
/// </summary>
/// <param name="req"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public ChargeRecordUploadRes? SendChargeRecordUpLoad(ChargeRecordUpLoad req, TimeSpan? timeSpan = null)
{
this.ChargeRecordUpLoad.Req = req;
@ -566,7 +577,12 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
this.Publish(req);
return ChargingTotalDis.GetResp(timeSpan);
}
/// <summary>
/// 电表累计值
/// </summary>
/// <param name="req"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public PowerTotalRes? SendPowerTotal(PowerTotal req, TimeSpan? timeSpan = null)
{
this.PowerTotal.Req = req;
@ -574,13 +590,24 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
return PowerTotal.GetResp(timeSpan);
}
/// <summary>
/// 电表变化值
/// </summary>
/// <param name="req"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public StaChargingTotalRes? SendStaChargingTotal(StaChargingTotal req, TimeSpan? timeSpan = null)
{
this.StaChargingTotal.Req = req;
this.Publish(req);
return StaChargingTotal.GetResp(timeSpan);
}
/// <summary>
/// 电表小时值
/// </summary>
/// <param name="req"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public MeterEnergyKwhRes? SendMeterEnergyKwh(MeterEnergyKwh req, TimeSpan? timeSpan = null)
{
this.MeterEnergyKwh.Req = req;
@ -588,6 +615,12 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
return MeterEnergyKwh.GetResp(timeSpan);
}
/// <summary>
/// 电表天
/// </summary>
/// <param name="req"></param>
/// <param name="timeSpan"></param>
/// <returns></returns>
public MeterDayEnergyValRes? SendMeterDayEnergyVal(MeterDayEnergyVal req, TimeSpan? timeSpan = null)
{
this.MeterDayEnergyVal.Req = req;
@ -648,7 +681,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
#region business func
/// <summary>
///
///充电订单
/// </summary>
/// <param name="chargeOrder"></param>
/// <param name="op">1 自动; 2 人工手动</param>

@ -1,14 +1,27 @@
using Autofac;
using Entity.Ammeter;
using Entity.Constant;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Redis;
using log4net;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Repository.Station;
using Service.Ammeter;
using Service.Cloud.Msg;
using Service.Cloud.Msg.Cloud.Resp;
using Service.Cloud.Msg.Host.Req;
using Service.Execute.Api;
using Service.FireControl.Client;
using Service.Init;
using Service.Station;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Service.Cloud.Client;
@ -18,9 +31,28 @@ public class CloudClientMgr
private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr));
public static CloudClient? CloudClient { get; set; }
static EmeterDayEnergyService emeterDayEnergyService = AppInfo.Container.Resolve<EmeterDayEnergyService>();
static EmeterHourEnergyService emeterHourEnergyService = AppInfo.Container.Resolve<EmeterHourEnergyService>();
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
private static DateTime _dateTime2 = DateTime.Now.AddSeconds(-10);
private static DateTime _dateTime3 = DateTime.Now.AddSeconds(-10);
private static DateTime _dateTime4 = DateTime.Now.AddSeconds(-10);
private static DateTime _dateTime5 = DateTime.Now.AddMinutes(-15);//15分钟
private static DateTime _dateTime6 = DateTime.Now.AddMinutes(-15);//15分钟
private static DateTime _dateTime7 = DateTime.Today.AddHours(DateTime.Now.Hour-1);//小时
private static DateTime _dateTime8 = DateTime.Now.AddDays(-1).Date;//天
private static DateTime _dateTime9 = DateTime.Today.AddHours(DateTime.Now.Hour - 1);//小时
private static DateTime _dateTime10 = DateTime.Now.AddDays(-1).Date;//天
private static DateTime _dateTime11 = DateTime.Now.AddDays(-1).Date;//天
public static void Init()
private const int TimeSpan = 5;
public static async void Init()
{
CloudClient = AppInfo.Container.Resolve<CloudClient>();
@ -37,7 +69,7 @@ public class CloudClientMgr
CloudClient.AutoReConnect = true;
CloudClient.InitHandler();
var ddddd = CloudClient.Connected;
Task.Run(() => CloudClient.Connect());
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
@ -121,5 +153,549 @@ public class CloudClientMgr
Log.Info("error", e);
}
});
StartAsyncLoop();
}
private static async Task StartAsyncLoop()
{
await Task.Run(() =>
{
try
{
while (CloudClient!=null)
{
if (CloudClient.Connected)
{
//Log.Info("测试111111111111111111111111111111111111111111111111111111111111111111111111111111");
CloudApi.SendStateLog(0);
TaskHostStatusReported();
TaskAirConditioningData();
TaskTemperatureHumidityData();
TaskPowerTotal();
TaskStaChargingTota();
TaskMeterEnergyKwh();
TaskMeterDayEnergyVal();
TaskStaHourEnergyVal();
TaskStaDayEnergyVal();
TaskStaDayOpeEnergyVal();
TaskStaHourAmountVal();
}
Thread.Sleep(1000);
}
}
catch (Exception ex)
{
Log.Error(ex);
}
});
}
static int os = 0;
/// <summary>
/// 上传换电站状态 10s
/// </summary>
private static void TaskHostStatusReported()
{
if (os != StaticStationInfo.StationStatus)
{
if ((DateTime.Now - _dateTime2).TotalSeconds <= 30)
{
return;
}
_dateTime2 = DateTime.Now;
EquipAlarmRecordRepository equipAlarmRecordRepository = AppInfo.Container.Resolve<EquipAlarmRecordRepository>();
var EquipAlarm = equipAlarmRecordRepository.Query();
var ErrorLevel = Convert.ToInt32(EquipAlarm.Min(x => x.ErrorLevel));
StationRunStatus stationRunStatus = new()
{
rs = StaticStationInfo.StationStatus == 1 ? 1 : 2,
os = StaticStationInfo.StationStatus,
fl = ErrorLevel,
};
CloudApi.SendHostStatusReported(stationRunStatus);
}
os = StaticStationInfo.StationStatus;
}
/// <summary>
/// 空调数据上报 10s
/// </summary>
private static void TaskAirConditioningData()
{
if ((DateTime.Now - _dateTime3).TotalSeconds <= 60)
{
return;
}
_dateTime3 = DateTime.Now;
AcDataInfo airConditioningData = new()
{
sn = StaticStationInfo.StationNo,
ad = "",
an = "",
au = 0,
am = 3,
ap = 0,
bt = DateTime.Now,
};
CloudApi.SendAirConditioningData(airConditioningData);
}
/// <summary>
/// 温湿度 10s
/// </summary>
private static void TaskTemperatureHumidityData()
{
if ((DateTime.Now - _dateTime4).TotalSeconds <= 10)
{
return;
}
_dateTime4 = DateTime.Now;
EvmDataInfo evmDataInfo = new()
{
sn = StaticStationInfo.StationNo,
ea = "电池仓",
et = FireControlMgr.Temperature,
eh = FireControlMgr.Humidity,
bt = DateTime.Now,
};
CloudApi.SendEvmDataInfo(evmDataInfo);
}
/// <summary>
/// 电能表累计值信息 15m
/// </summary>
private static void TaskPowerTotal()//Desc记得改回来
{
if ((DateTime.Now - _dateTime5).TotalMinutes <= 15)
{
return;
}
_dateTime5 = DateTime.Now;
EmeterEnergyService emeterEnergyService = AppInfo.Container.Resolve<EmeterEnergyService>();
EmeterEnergyChangeService emeterEnergyChangeService = AppInfo.Container.Resolve<EmeterEnergyChangeService>();
List<EmeterEnergy> emeterEnergy = emeterEnergyService.QueryListByClause(u=>u.UploadFlag==0, 7,i => i.UploadTime,
OrderByType.Asc);
emeterEnergy = emeterEnergy.OrderBy(p => p.Code).ToList();
var emeterEnergyChange = emeterEnergyChangeService.QueryListByClause(u => u.UploadFlag == 0, 7, i => i.UploadTime,
OrderByType.Asc);
emeterEnergyChange = emeterEnergyChange.OrderBy(p => p.Code).ToList();
PowerTotal powerTotal = new()
{
sn = StaticStationInfo.StationNo,
};
powerTotal.meter = new List<meter>();
for (int i = 0; i < 7; i++)
{
meter meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓直流表",
ms = emeterEnergy[i].Code,
mk = emeterEnergy[i].Value,
};
powerTotal.meter.Add(meter);
}
for (int i = 0;i < 7; i++)
{
meter meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓交流表",
ms = emeterEnergyChange[i].Code,
mk = emeterEnergyChange[i].Value,
};
powerTotal.meter.Add(meter);
}
CloudApi.SendPowerTotal(powerTotal);
}
/// <summary>
/// 电能表变化值信息 15m
/// </summary>
private static void TaskStaChargingTota()
{
if ((DateTime.Now - _dateTime6).TotalMinutes <= 15)
{
return;
}
_dateTime6 = DateTime.Now;
EmeterEnergyService emeterEnergyService = AppInfo.Container.Resolve<EmeterEnergyService>();
EmeterEnergyChangeService emeterEnergyChangeService = AppInfo.Container.Resolve<EmeterEnergyChangeService>();
List<EmeterEnergy> emeterEnergy = emeterEnergyService.QueryListByClause(u => u.UploadFlag == 0, 7, i => i.UploadTime,
OrderByType.Asc);
emeterEnergy = emeterEnergy.OrderBy(p => p.Code).ToList();
var emeterEnergyChange = emeterEnergyChangeService.QueryListByClause(u => u.UploadFlag == 0, 7, i => i.UploadTime,
OrderByType.Asc);
emeterEnergyChange = emeterEnergyChange.OrderBy(p => p.Code).ToList();
StaChargingTotal staChargingTotal = new()
{
sn = StaticStationInfo.StationNo,
};
staChargingTotal.meter = new List<meter2>();
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓直流表",
ms = emeterEnergy[i].Code,
mk = emeterEnergy[i].Value,
st = DateTime.Now.AddMinutes(-15),
et = DateTime.Now,
};
staChargingTotal.meter.Add(meter);
}
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓交流表",
ms = emeterEnergyChange[i].Code,
mk = emeterEnergyChange[i].Value,
st = DateTime.Now.AddMinutes(-15),
et = DateTime.Now,
};
staChargingTotal.meter.Add(meter);
}
CloudApi.SendStaChargingTotal(staChargingTotal);
}
/// <summary>
/// 电能表小时能耗值信息 1h
/// </summary>
private static void TaskMeterEnergyKwh()
{
if ((DateTime.Now - _dateTime7).TotalHours <= 1)
{
return;
}
_dateTime7 = DateTime.Now;
var emeterEnergy = emeterHourEnergyService.QueryListByClause(u => u.UploadFlag == 0, 14, i => i.Time,
OrderByType.Asc);
emeterEnergy = emeterEnergy.OrderBy(p => p.Code).ToList();
var emeterEnergy1= emeterEnergy.Where(p => p.Type==1).ToList();
var emeterEnergy2= emeterEnergy.Where(p => p.Type==2).ToList();
MeterEnergyKwh meterEnergyKwh = new()
{
sn = StaticStationInfo.StationNo,
};
meterEnergyKwh.meter = new List<meter2>();
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓直流表",
ms = emeterEnergy1[i].Code,
mk = emeterEnergy1[i].Value,
//st = DateTime.Now.AddMinutes(-60),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy1[i].Time),
et = Convert.ToDateTime(emeterEnergy1[i].Time).AddHours(1),
};
meterEnergyKwh.meter.Add(meter);
}
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓交流表",
ms = emeterEnergy2[i].Code,
mk = emeterEnergy2[i].Value,
//st = DateTime.Now.AddMinutes(-15),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy1[i].Time),
et = Convert.ToDateTime(emeterEnergy1[i].Time).AddHours(1),
};
meterEnergyKwh.meter.Add(meter);
}
CloudApi.SendMeterEnergyKwh(meterEnergyKwh);
for (int i = 0; i < emeterEnergy.Count; i++)
{
emeterEnergy[i].UploadFlag = 1;
}
emeterHourEnergyService.Update(emeterEnergy);
}
/// <summary>
/// 电能表天能耗值信息 1d
/// </summary>
private static void TaskMeterDayEnergyVal()
{
if ((DateTime.Now - _dateTime8).TotalDays < 1)
{
return;
}
_dateTime8 = DateTime.Now;
EmeterDayEnergyService emeterDayEnergyService = AppInfo.Container.Resolve<EmeterDayEnergyService>();
var emeterEnergy = emeterDayEnergyService.QueryListByClause(u => u.UploadFlag == 0, 14, i => i.Time,
OrderByType.Asc);
emeterEnergy = emeterEnergy.OrderBy(p => p.Code).ToList();
var emeterEnergy1 = emeterEnergy.Where(p => p.Type == 1).ToList();
var emeterEnergy2 = emeterEnergy.Where(p => p.Type == 2).ToList();
MeterDayEnergyVal meterEnergyKwh = new()
{
sn = StaticStationInfo.StationNo,
};
meterEnergyKwh.meter = new List<meter2>();
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓直流表",
ms = emeterEnergy1[i].Code,
mk = emeterEnergy1[i].Value,
//st = DateTime.Now.AddDays(-1),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy1[i].Time).AddDays(-1),
et = Convert.ToDateTime(emeterEnergy1[i].Time),
};
meterEnergyKwh.meter.Add(meter);
}
for (int i = 0; i < 7; i++)
{
meter2 meter = new()
{
addr = i + 1,
desc = (i + 2).ToString() + "号仓交流表",
ms = emeterEnergy2[i].Code,
mk = emeterEnergy2[i].Value,
//st = DateTime.Now.AddDays(-1),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy1[i].Time).AddDays(-1),
et = Convert.ToDateTime(emeterEnergy1[i].Time),
};
meterEnergyKwh.meter.Add(meter);
}
CloudApi.SendMeterDayEnergyVal(meterEnergyKwh);
for (int i = 0; i < emeterEnergy.Count; i++)
{
emeterEnergy[i].UploadFlag = 1;
}
emeterDayEnergyService.Update(emeterEnergy);
}
/// <summary>
/// 换电站分时用电统计信息 1h
/// </summary>
private static void TaskStaHourEnergyVal()
{
if ((DateTime.Now - _dateTime9).TotalHours <= 1)
{
return;
}
_dateTime9 = DateTime.Now;
var emeterEnergy = emeterHourEnergyService.QueryListByClause(u => u.Type == 1, 7, i => i.Time,
OrderByType.Asc);
float hc = emeterEnergy.Sum(e => e.Value);
StaHourEnergyVal meterEnergyKwh = new()
{
sn = StaticStationInfo.StationNo,
ht= hc,
hc = hc,
hs =0,
ho=0,
//st = DateTime.Now.AddHours(-1),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy?.First().Time),
et = Convert.ToDateTime(emeterEnergy?.First().Time).AddHours(1),
};
CloudApi.SendStaHourEnergyVal(meterEnergyKwh);
}
/// <summary>
/// 换电站每天用电统计信息 1d
/// </summary>
private static void TaskStaDayEnergyVal()
{
if ((DateTime.Now - _dateTime10).TotalDays < 1)
{
return;
}
_dateTime10 = DateTime.Now;
var emeterEnergy = emeterDayEnergyService.QueryListByClause(u => u.Type == 1, 7, i => i.Time,
OrderByType.Asc);
float dc = emeterEnergy.Sum(e => e.Value);
StaDayEnergyVal staDayEnergyVal = new()
{
sn = StaticStationInfo.StationNo,
ht = dc,
hc = dc,
hs = 0,
ho = 0,
//st = DateTime.Now.AddDays(-1),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy?.First().Time).AddDays(-1),
et = Convert.ToDateTime(emeterEnergy?.First().Time),
};
CloudApi.SendStaDayEnergyVal(staDayEnergyVal);
}
/// <summary>
/// 换电站日运行统计结果 1d
/// </summary>
private static void TaskStaDayOpeEnergyVal()
{
if ((DateTime.Now - _dateTime11).TotalDays < 1)
{
return;
}
_dateTime11 = DateTime.Now;
ExStationDayRunResultService exStationDayRunResultService = AppInfo.Container.Resolve<ExStationDayRunResultService>();
var exStationDayRunResult = exStationDayRunResultService.QueryByClause(u => u.Id !=0, i => i.CreatedTime,
OrderByType.Asc);
StaDayOpeEnergyVal staDayOpeEnergyVal = new()
{
sn = StaticStationInfo.StationNo,
sm = StaticStationInfo.StationName,
st = Convert.ToDateTime(exStationDayRunResult?.RunStartTime),
et = Convert.ToDateTime(exStationDayRunResult?.RunEndTime),
tt = Convert.ToInt32(exStationDayRunResult?.ToltalTimeCount),
//tt = 24 * 60,
ft = Convert.ToDateTime(exStationDayRunResult?.FristSwapTime),
sp = Convert.ToDateTime(exStationDayRunResult?.StopTime),
ts = Convert.ToSingle(exStationDayRunResult?.ToltalSwapAllTime * 60),
tc = exStationDayRunResult.ToltalSwapCount,
cc = exStationDayRunResult.ChgCount,
os = Convert.ToByte(exStationDayRunResult.State),
at = Convert.ToSingle(exStationDayRunResult?.AvgRepTime),
ct = Convert.ToSingle(exStationDayRunResult?.AvgChgTime),
dt = Convert.ToDateTime(exStationDayRunResult?.SwapDate),
};
CloudApi.SendStaDayOpeEnergyVal(staDayOpeEnergyVal);
}
/// <summary>
/// 换电站分时用电统计信息
/// </summary>
private static void TaskStaHourAmountVal()
{
if ((DateTime.Now - _dateTime2).TotalSeconds <= 30)
{
return;
}
_dateTime2 = DateTime.Now;
var emeterEnergy = emeterDayEnergyService.QueryListByClause(u => u.Type == 1, 7, i => i.Time,
OrderByType.Asc);
float hc = emeterEnergy.Sum(e => e.Value);
ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices = AppInfo.Container.Resolve<ElecPriceModelVersionDetailServices>();
var elecPriceModelVersionDetail= elecPriceModelVersionDetailServices.QueryListByClause(u=>u.Version==1);
var timeList = elecPriceModelVersionDetail.Select(u => u.StartHour).ToList();
int targetTime = DateTime.Now.Hour;
int index1 = timeList.FindIndex(time => time > targetTime)-1;
index1 = index1<0? timeList.Count-1: index1;
int index2 = timeList.FindIndex(time => time == targetTime);
int index3 = index2 == -1 ? index1 : index2;
var price = elecPriceModelVersionDetail[index3].Price;
StaHourAmountVal staHourAmountVal = new()
{
sn = StaticStationInfo.StationNo,
ht = Convert.ToSingle(hc * price),
hc = Convert.ToSingle(hc * price),
hs = 0,
ho = 0,
//st = DateTime.Now.AddHours(-1),
//et = DateTime.Now,
st = Convert.ToDateTime(emeterEnergy?.First().Time),
et = Convert.ToDateTime(emeterEnergy?.First().Time).AddHours(1),
};
CloudApi.SendStaHourAmountVal(staHourAmountVal);
}
}

@ -11,30 +11,8 @@ public class MeterDayEnergyVal : ICmd
/// 换电站编码
/// </summary>
public string sn { get; set; }
/// <summary>
/// 电表编码
/// </summary>
public string mn { get; set; }
/// <summary>
/// 安装位置编号
/// </summary>
public int addr { get; set; }
/// <summary>
/// 位置描述
/// </summary>
public string desc { get; set; }
/// <summary>
/// 天变化值 单位:kWh,保留两位小 数
/// </summary>
public float dv { get; set; }
/// <summary>
/// 开始时间 精确到天。格式” yyyy-MM-dd ”
/// </summary>
public DateTime st { get; set; }
/// <summary>
/// 结束时间 精确到天。格式” yyyy-MM-dd ”
/// </summary>
public DateTime et { get; set; }
public List<meter2> meter { get; set; }
public string GetCmd()
{
return CloudConst.meterDayEnergyVal;

@ -11,30 +11,9 @@ public class MeterEnergyKwh : ICmd
/// 换电站编码
/// </summary>
public string sn { get; set; }
/// <summary>
/// 电表编码
/// </summary>
public string ms { get; set; }
/// <summary>
/// 安装位置编号
/// </summary>
public int addr { get; set; }
/// <summary>
/// 位置描述
/// </summary>
public string desc { get; set; }
/// <summary>
/// 变化值 单位:kWh,保留两 位小数
/// </summary>
public float mc { get; set; }
/// <summary>
/// 开始时间 格式” yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime st { get; set; }
/// <summary>
/// 结束时间 格式” yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime et { get; set; }
public List<meter2> meter { get; set; }
public string GetCmd()
{
return CloudConst.meterEnergyKwh;

@ -11,6 +11,17 @@ public class PowerTotal : ICmd
/// 换电站编码
/// </summary>
public string sn { get; set; }
public List<meter> meter { get; set; }
public string GetCmd()
{
return CloudConst.powerTotal;
}
}
public class meter
{
/// <summary>
/// 安装位置编号
/// </summary>
@ -27,8 +38,4 @@ public class PowerTotal : ICmd
/// 累积值 单位:kWh,保留两位 小数
/// </summary>
public float mk { get; set; }
public string GetCmd()
{
return CloudConst.powerTotal;
}
}

@ -11,6 +11,20 @@ public class StaChargingTotal : ICmd
/// 换电站编码
/// </summary>
public string sn { get; set; }
public List<meter2> meter { get; set; }
public string GetCmd()
{
return CloudConst.staChargingTotal;
}
}
/// <summary>
/// 电表信息
/// </summary>
public class meter2
{
/// <summary>
/// 电表编码
/// </summary>
@ -26,7 +40,7 @@ public class StaChargingTotal : ICmd
/// <summary>
/// 变化值 单位:kWh,保留两 位小数
/// </summary>
public float mc { get; set; }
public float mk { get; set; }
/// <summary>
/// 开始时间 格式” yyyy-MM-dd HH:mm:ss ”
/// </summary>
@ -35,8 +49,4 @@ public class StaChargingTotal : ICmd
/// 结束时间 格式” yyyy-MM-dd HH:mm:ss ”
/// </summary>
public DateTime et { get; set; }
public string GetCmd()
{
return CloudConst.staChargingTotal;
}
}

@ -14,19 +14,19 @@ public class StaDayEnergyVal : ICmd
/// <summary>
/// 天计算总量能耗值 单位:kWh,保留两位小 数
/// </summary>
public float dt { get; set; }
public float ht { get; set; }//原dt改ht和小时字段一致云平台说的下面几个字段一样
/// <summary>
/// 天计算充电能耗值 单位:kWh,保留两位小 数
/// </summary>
public float dc { get; set; }
public float hc { get; set; }
/// <summary>
/// 天计算换电能耗值 单位:kWh,保留两位小 数
/// </summary>
public float ds { get; set; }
public float hs { get; set; }
/// <summary>
/// 天计算其它能耗值 单位:kWh,保留两位小 数
/// </summary>
public float dv { get; set; }
public float ho { get; set; }
/// <summary>
/// 开始时间 精确到天。格式”yyyy-MM-dd”如2020-11-20 )
/// </summary>

@ -52,7 +52,7 @@ namespace Service.Cloud.Msg.Host.Req
/// 更新时间
/// 格式”yyyy-MM-dd HH:mm:ss”
/// </summary>
public int ut { get; set; }
public DateTime ut { get; set; }
public string GetCmd()
{

@ -107,19 +107,60 @@ public abstract class CloudApi
return sendUploadPowerChangeOrder.re;
}
public static InfoEnum.BusinessSwappingForCloudState BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.Idle;
/// <summary>
/// 上报换电步序到云端
/// </summary>
/// <param name="swapOrder"></param>
/// <param name="state"></param>
public static void SendStateLog(SwapOrder swapOrder, InfoEnum.BusinessSwappingForCloudState state)
/// <param name="daad">是否空闲</param>
public static void SendStateLog( int state)
{
if (BusinessSwappingForCloudState!= StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState)
{
StationChnRunStatus stationChnRunStatus = new()
StationChnRunStatus stationChnRunStatus = null;
if (state == 1)
{
stationChnRunStatus = new()
{
ec = 0,
ws = StationSoftMgr.SwappingStateMachine.SwapStatus == 0 ? 2 : 3,
cs = (int)StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState,
iv = StationSoftMgr.SwappingStateMachine.RadarInFlag == true ? 1 : 2,
ls = StationSoftMgr.SwappingStateMachine.VelUnlockFlag == true ? 2 : 1,
fl = 0,
ut = DateTime.Now,
};
}
else
{
stationChnRunStatus = new()
{
ec = 0,
ws = 1,
cs = 1,
iv = 2,
ls = 0,
fl = 0,
ut = DateTime.Now,
};
}
CloudClientMgr.CloudClient?.SendChannelStatusReporting(stationChnRunStatus,
global::System.TimeSpan.FromSeconds(TimeSpan));
for (int i = 0; i < 3; i++)
{
}
}
BusinessSwappingForCloudState = StationSoftMgr.SwappingStateMachine.BusinessSwappingForCloudState;
return;
}
@ -184,4 +225,109 @@ public abstract class CloudApi
CloudClientMgr.CloudClient?.SendPileRealtime(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站状态上报
/// </summary>
/// <param name="req"></param>
public static void SendHostStatusReported(StationRunStatus req)
{
CloudClientMgr.CloudClient?.SendHostStatusReported(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 空调信息
/// </summary>
/// <param name="req"></param>
public static void SendAirConditioningData(AcDataInfo req)
{
CloudClientMgr.CloudClient?.SendAirConditioningData(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站温湿度数据信息
/// </summary>
/// <param name="req"></param>
public static void SendEvmDataInfo(EvmDataInfo req)
{
CloudClientMgr.CloudClient?.SendEvmDataInfo(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 电能表累计值信息
/// </summary>
/// <param name="req"></param>
public static void SendPowerTotal(PowerTotal req)
{
CloudClientMgr.CloudClient?.SendPowerTotal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站电能表变化值信息
/// </summary>
/// <param name="req"></param>
public static void SendStaChargingTotal(StaChargingTotal req)
{
CloudClientMgr.CloudClient?.SendStaChargingTotal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站分时用电统计信息
/// </summary>
/// <param name="req"></param>
public static void SendStaHourEnergyVal(StaHourEnergyVal req)
{
CloudClientMgr.CloudClient?.SendStaHourEnergyVal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 电能表小时能耗值信息
/// </summary>
/// <param name="req"></param>
public static void SendMeterEnergyKwh(MeterEnergyKwh req)
{
CloudClientMgr.CloudClient?.SendMeterEnergyKwh(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 电能表每天能耗值信息
/// </summary>
/// <param name="req"></param>
public static void SendMeterDayEnergyVal(MeterDayEnergyVal req)
{
CloudClientMgr.CloudClient?.SendMeterDayEnergyVal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站每天用电统计信息
/// </summary>
/// <param name="req"></param>
public static void SendStaDayEnergyVal(StaDayEnergyVal req)
{
CloudClientMgr.CloudClient?.SendStaDayEnergyVal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站日运行统计结果信息
/// </summary>
/// <param name="req"></param>
public static void SendStaDayOpeEnergyVal(StaDayOpeEnergyVal req)
{
CloudClientMgr.CloudClient?.SendStaDayOpeEnergyVal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 换电站分时用电计费信息
/// </summary>
/// <param name="req"></param>
public static void SendStaHourAmountVal(StaHourAmountVal req)
{
CloudClientMgr.CloudClient?.SendStaHourAmountVal(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
}

@ -79,6 +79,10 @@ public class CountDayOrderJob : AbstractCronJob
dayCount.AvgRepTime = avgRepTime.ToString("F2");
dayCount.SwapDate = DateTime.Now.AddDays(-1).ToString();
dayCount.RunStartTime = DateTime.Now.AddDays(-1).ToString();
dayCount.RunEndTime = DateTime.Now.ToString();
dayCount.ToltalTimeCount = 24 * 60;
dayCount.FristSwapTime = firstSwapOrder?.SwapBeginTime?.ToString() ?? null;
dayCount.StopTime = lastSwapOrder?.SwapEndTime?.ToString() ?? null;

Loading…
Cancel
Save