现场自动充电更改提交

master
CZ 5 months ago
parent ca28c4b23b
commit 06cc3b15f0

@ -76,10 +76,24 @@ public class AutoChargeTask : ITask
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails =
elecPriceModelVersionDetailRepository.QueryListByClause(it =>
it.Version == elecPriceModelVersion.Version);
ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
/*ElecPriceModelVersionDetail? elecPriceModelVersionDetail = elecPriceModelVersionDetails.Where(i =>
i.StartHour <= now.Hour && i.StartMinute <= now.Minute
&& 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)
{
Log.Info("lack of effective elecPriceModelVersionDetail");
@ -129,17 +143,24 @@ public class AutoChargeTask : ITask
List<BinInfo> canSwapList = binInfos.Where(it =>
it.Soc != null && Convert.ToSingle(it.Soc) >= StaticStationInfo.SwapSoc && it.CanSwapFlag == 1)
.ToList();
if (canSwapList.Count == needBatteryCount)
/*if (canSwapList.Count == needBatteryCount)
{
Log.Info($"lack of needBatteryCount {needBatteryCount}");
return;
}
}*/
if (canSwapList.Count > needBatteryCount)
if (canSwapList.Count >= needBatteryCount)
{
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)
{
//停电量低的

Loading…
Cancel
Save