|
|
@ -23,6 +23,8 @@ public static class ClientMgr
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Dictionary<string, ChargerClient> Dictionary = new();
|
|
|
|
private static readonly Dictionary<string, ChargerClient> Dictionary = new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool AutoChargeWorking { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public static ChargerClient? GetBySn(string sn)
|
|
|
|
public static ChargerClient? GetBySn(string sn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Dictionary.TryGetValue(sn, out var o);
|
|
|
|
Dictionary.TryGetValue(sn, out var o);
|
|
|
@ -78,12 +80,16 @@ public static class ClientMgr
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static void StartAutoChargeThread()
|
|
|
|
public static void StartAutoChargeThread()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!AutoChargeWorking)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Thread thread = new Thread(AutoChargeThread)
|
|
|
|
Thread thread = new Thread(AutoChargeThread)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = @"auto-charge"
|
|
|
|
Name = @"auto-charge"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
thread.Start();
|
|
|
|
thread.Start();
|
|
|
|
|
|
|
|
AutoChargeWorking = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
///
|
|
|
@ -99,6 +105,8 @@ public static class ClientMgr
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Thread.Sleep(1000 * 30);
|
|
|
|
Thread.Sleep(1000 * 30);
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
ElecPriceModelVersion elecPriceModelVersion = elecPriceModelVersionRepository.QueryByClause(i => i.StartTime >= now && i.EndTime < now);
|
|
|
|
ElecPriceModelVersion elecPriceModelVersion = elecPriceModelVersionRepository.QueryByClause(i => i.StartTime >= now && i.EndTime < now);
|
|
|
|
if (elecPriceModelVersion == null)
|
|
|
|
if (elecPriceModelVersion == null)
|
|
|
@ -126,6 +134,11 @@ public static class ClientMgr
|
|
|
|
Log.Info($"start {pair.Key} charge {result.IsSuccess}:{result.Msg}");
|
|
|
|
Log.Info($"start {pair.Key} charge {result.IsSuccess}:{result.Msg}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Error("AutoChargeThread error", e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void ConnClient(EquipNetInfo netInfo)
|
|
|
|
private static void ConnClient(EquipNetInfo netInfo)
|
|
|
|