|
|
|
@ -20,9 +20,9 @@ public static class ClientMgr
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ClientMgr));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Dictionary<string, ChargerClient> Dictionary = new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool AutoChargeWorking { get; set; }
|
|
|
|
|
|
|
|
|
|
public static ChargerClient? GetBySn(string sn)
|
|
|
|
@ -64,7 +64,7 @@ public static class ClientMgr
|
|
|
|
|
List<EquipInfo> equipInfos = equipInfoRepository.QueryListByClause(it => it.TypeCode == (int)EquipmentType.Charger);
|
|
|
|
|
if (equipInfos.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string,EquipInfo> set = equipInfos.ToDictionary(it => it.Code, it => it);
|
|
|
|
|
Dictionary<string, EquipInfo> set = equipInfos.ToDictionary(it => it.Code, it => it);
|
|
|
|
|
List<EquipNetInfo> equipNetInfos = netInfoRepository.QueryListByClause(it => set.Keys.Contains(it.Code));
|
|
|
|
|
foreach (EquipNetInfo netInfo in equipNetInfos)
|
|
|
|
|
{
|
|
|
|
@ -100,10 +100,10 @@ public static class ClientMgr
|
|
|
|
|
{
|
|
|
|
|
ElecPriceModelVersionRepository elecPriceModelVersionRepository =
|
|
|
|
|
AppInfo.Container.Resolve<ElecPriceModelVersionRepository>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ElecPriceModelVersionDetailRepository elecPriceModelVersionDetailRepository =
|
|
|
|
|
AppInfo.Container.Resolve<ElecPriceModelVersionDetailRepository>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(1000 * 30);
|
|
|
|
@ -130,7 +130,7 @@ public static class ClientMgr
|
|
|
|
|
//int batteryCount = elecPriceModelVersionDetail.BatteryCount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (KeyValuePair<string,ChargerClient> pair in Dictionary)
|
|
|
|
|
foreach (KeyValuePair<string, ChargerClient> pair in Dictionary)
|
|
|
|
|
{
|
|
|
|
|
Result<bool> result = pair.Value.StartCharge();
|
|
|
|
|
Log.Info($"start {pair.Key} charge {result.IsSuccess}:{result.Msg}");
|
|
|
|
@ -149,7 +149,7 @@ public static class ClientMgr
|
|
|
|
|
ChargerClient client = AppInfo.Container.Resolve<ChargerClient>();
|
|
|
|
|
client.InitBootstrap(netInfo.NetAddr, int.Parse(netInfo.NetPort));
|
|
|
|
|
client.Connect();
|
|
|
|
|
client.SessionAttr(netInfo.Code, netInfo.NetAddr);
|
|
|
|
|
client.SessionAttr(netInfo.Code, netInfo.DestAddr);
|
|
|
|
|
AddBySn(netInfo.Code, client);
|
|
|
|
|
Log.Info($"connected {netInfo.Code} {netInfo.NetAddr}:{netInfo.NetPort}");
|
|
|
|
|
}
|
|
|
|
|