change - NanNan过滤改为ZXYG,取消重复ID主动断开

master
wenjy 9 months ago
parent afa3115d2a
commit a890a98e7c

@ -81,7 +81,7 @@ namespace Ems.CollectService.Analysis
{ {
var clients = tcpService.GetClients(); var clients = tcpService.GetClients();
var info = clients.Where(x => x.ID == clientIdStr).ToList(); var info = clients.Where(x => x.ID == clientIdStr).ToList();
if (info.Count > 0) /*if (info.Count > 0)
{ {
logger.Trace($"客户端:{client.ID};地址:{client.GetIPPort()};已存在连接信息,主动断开已有连接"); logger.Trace($"客户端:{client.ID};地址:{client.GetIPPort()};已存在连接信息,主动断开已有连接");
foreach (var item in info) foreach (var item in info)
@ -89,7 +89,7 @@ namespace Ems.CollectService.Analysis
item.Close(); item.Close();
logger.Trace($"客户端:{item.ID};地址:{item.GetIPPort()};已断开"); logger.Trace($"客户端:{item.ID};地址:{item.GetIPPort()};已断开");
} }
} }*/
if (client.ID != clientIdStr) if (client.ID != clientIdStr)
{ {
client.ResetID(clientIdStr); client.ResetID(clientIdStr);
@ -154,9 +154,12 @@ namespace Ems.CollectService.Analysis
if(SendMessageAsync(client, SendMessagePackInfo)) if(SendMessageAsync(client, SendMessagePackInfo))
{ {
logger.Debug($"向客户端:{client.ID};地址:{client.GetIPPort()};回复心跳指令成功"); logger.Debug($"向客户端:{client.ID};地址:{client.GetIPPort()};回复心跳指令成功");
Thread.Sleep(500); if (client.ID.Contains("450063"))
bool isRes = SendTimeSyncToClient(client, SendMessagePackInfo); {
logger.Info($"向客户端:{client.ID};地址:{client.GetIPPort()};发送校时指令{(isRes ? "":"")}"); Thread.Sleep(500);
bool isRes = SendTimeSyncToClient(client, SendMessagePackInfo);
logger.Info($"向客户端:{client.ID};地址:{client.GetIPPort()};发送校时指令{(isRes ? "":"")}");
}
return true; return true;
} }
else else
@ -277,7 +280,7 @@ namespace Ems.CollectService.Analysis
if (double.IsNaN(f_UA)) if (double.IsNaN(f_UA))
{ {
//此处判断a为NaN //此处判断a为NaN
recordDnbInstant.vA = appConfig.virtualValue; recordDnbInstant.vA = 0;
} }
else else
{ {
@ -388,7 +391,8 @@ namespace Ems.CollectService.Analysis
if (double.IsNaN(f_ZXYGZ)) if (double.IsNaN(f_ZXYGZ))
{ {
//此处判断a为NaN //此处判断a为NaN
recordDnbInstant.zxyg = 0; //recordDnbInstant.zxyg = 0;
recordDnbInstant.zxyg = appConfig.virtualValue;
} }
else else
{ {
@ -474,7 +478,7 @@ namespace Ems.CollectService.Analysis
if (appConfig.virtualFlag) if (appConfig.virtualFlag)
{ {
if (recordDnbInstant.vA != appConfig.virtualValue) if (recordDnbInstant.zxyg != appConfig.virtualValue)
{ {
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand(); var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
if (info > 0) if (info > 0)
@ -490,7 +494,7 @@ namespace Ems.CollectService.Analysis
else else
{ {
recordDnbInstant.vA = recordDnbInstant.vA == appConfig.virtualValue ? 0 : recordDnbInstant.vA; recordDnbInstant.zxyg = recordDnbInstant.zxyg == appConfig.virtualValue ? 0 : recordDnbInstant.zxyg;
var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand(); var info = SqlSugarHelper.Db.Insertable<RecordDnbInstant>(recordDnbInstant).ExecuteCommand();
if (info > 0) if (info > 0)

Loading…
Cancel
Save