|
|
|
@ -721,41 +721,41 @@ public class CloudClientMgr
|
|
|
|
|
/// </summary>
|
|
|
|
|
private static void TaskStaHourAmountVal()
|
|
|
|
|
{
|
|
|
|
|
if ((DateTime.Now - _dateTime2).TotalSeconds <= 30)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_dateTime2 = DateTime.Now;
|
|
|
|
|
//if ((DateTime.Now - _dateTime2).TotalSeconds <= 30)
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//_dateTime2 = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
var emeterEnergy = emeterDayEnergyService.QueryListByClause(u => u.Type == 1, 7, i => i.Time,
|
|
|
|
|
OrderByType.Desc);
|
|
|
|
|
float hc = emeterEnergy.Sum(e => e.Value);
|
|
|
|
|
//var emeterEnergy = emeterDayEnergyService.QueryListByClause(u => u.Type == 1, 7, i => i.Time,
|
|
|
|
|
// OrderByType.Desc);
|
|
|
|
|
//float hc = emeterEnergy.Sum(e => e.Value);
|
|
|
|
|
|
|
|
|
|
ElecPriceModelVersionDetailServices elecPriceModelVersionDetailServices = AppInfo.Container.Resolve<ElecPriceModelVersionDetailServices>();
|
|
|
|
|
//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 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);
|
|
|
|
|
//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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|