|
|
@ -76,10 +76,24 @@ public class AutoChargeTask : ITask
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails =
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails =
|
|
|
|
elecPriceModelVersionDetailRepository.QueryListByClause(it =>
|
|
|
|
elecPriceModelVersionDetailRepository.QueryListByClause(it =>
|
|
|
|
it.Version == elecPriceModelVersion.Version);
|
|
|
|
it.Version == elecPriceModelVersion.Version);
|
|
|
|
ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
|
|
|
|
/*ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
|
|
|
|
i.StartHour <= now.Hour && i.StartMinute <= now.Minute
|
|
|
|
i.StartHour <= now.Hour && i.StartMinute <= now.Minute
|
|
|
|
&& i.EndHour > now.Hour &&
|
|
|
|
&& i.EndHour > now.Hour &&
|
|
|
|
i.EndMinute > now.Minute).FirstOrDefault();
|
|
|
|
i.EndMinute > now.Minute).FirstOrDefault();*/
|
|
|
|
|
|
|
|
ElecPriceModelVersionDetail? elecPriceModelVersionDetail = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var VARIABLE in elecPriceModelVersionDetails)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 构造开始和结束的DateTime对象,使用当前日期的年月日
|
|
|
|
|
|
|
|
DateTime startTime = new DateTime(now.Year, now.Month, now.Day, VARIABLE.StartHour,
|
|
|
|
|
|
|
|
VARIABLE.StartMinute, 0);
|
|
|
|
|
|
|
|
DateTime endTime = new DateTime(now.Year, now.Month, now.Day, VARIABLE.EndHour, VARIABLE.EndMinute, 0);
|
|
|
|
|
|
|
|
if (DateTime.Now >= startTime && DateTime.Now <= endTime)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
elecPriceModelVersionDetail = VARIABLE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (elecPriceModelVersionDetail == null)
|
|
|
|
if (elecPriceModelVersionDetail == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info("lack of effective elecPriceModelVersionDetail");
|
|
|
|
Log.Info("lack of effective elecPriceModelVersionDetail");
|
|
|
@ -129,17 +143,24 @@ public class AutoChargeTask : ITask
|
|
|
|
List<BinInfo> canSwapList = binInfos.Where(it =>
|
|
|
|
List<BinInfo> canSwapList = binInfos.Where(it =>
|
|
|
|
it.Soc != null && Convert.ToSingle(it.Soc) >= StaticStationInfo.SwapSoc && it.CanSwapFlag == 1)
|
|
|
|
it.Soc != null && Convert.ToSingle(it.Soc) >= StaticStationInfo.SwapSoc && it.CanSwapFlag == 1)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
if (canSwapList.Count == needBatteryCount)
|
|
|
|
/*if (canSwapList.Count == needBatteryCount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Log.Info($"lack of needBatteryCount {needBatteryCount}");
|
|
|
|
Log.Info($"lack of needBatteryCount {needBatteryCount}");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
if (canSwapList.Count > needBatteryCount)
|
|
|
|
if (canSwapList.Count >= needBatteryCount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<BinInfo> chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList();
|
|
|
|
List<BinInfo> chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
int needStopCount = chargingList.Count - (canSwapList.Count - needBatteryCount);
|
|
|
|
var bininfo = binInfos.Where(i => i.No == "1").ToList();
|
|
|
|
|
|
|
|
int iCache = 0;//缓存仓电池数量
|
|
|
|
|
|
|
|
if (bininfo.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
iCache = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int needStopCount = chargingList.Count + iCache - (canSwapList.Count - needBatteryCount);
|
|
|
|
if (needStopCount > 0)
|
|
|
|
if (needStopCount > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//停电量低的
|
|
|
|
//停电量低的
|
|
|
|