Ultimos ajustes no fluxo CAN
This commit is contained in:
parent
cdbcb8f1d7
commit
bd8069c545
|
|
@ -25,19 +25,12 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
}
|
||||
public bool RequisitarDados { get; set; } = true;
|
||||
public static int PingsConsiderarConexao { get; set; } = 5;
|
||||
public static int TempoLimiteConexao
|
||||
{
|
||||
get
|
||||
{
|
||||
return PingsConsiderarConexao * (Variaveis.OperacaoEmAndamento?.DispSen?._TaxaAmostragem ?? 1000);
|
||||
}
|
||||
}
|
||||
public static int TempoLimiteConexao { get; set; } = 8000;
|
||||
public bool Conectado
|
||||
{
|
||||
get
|
||||
{
|
||||
return DadosLeitura.UltimoComandoRespondido.AddMilliseconds(PingsConsiderarConexao * _TaxaAmostragem) > DateTime.Now;
|
||||
return DadosLeitura.Conectado;
|
||||
}
|
||||
}
|
||||
public bool ConexaoAtiva
|
||||
|
|
|
|||
|
|
@ -28,20 +28,12 @@ namespace AgroBase.Models.Modules
|
|||
}
|
||||
}
|
||||
public bool RequisitarDados { get; set; } = true;
|
||||
public static int PingsConsiderarConexao { get; set; } = 5;
|
||||
public static int TempoLimiteConexao
|
||||
{
|
||||
get
|
||||
{
|
||||
return PingsConsiderarConexao * (Variaveis.OperacaoEmAndamento?.DispSen?._TaxaAmostragem ?? 1000);
|
||||
}
|
||||
}
|
||||
public static int TempoLimiteConexao { get; set; } = 8000;
|
||||
public bool Conectado
|
||||
{
|
||||
get
|
||||
{
|
||||
//return DadosLeitura.UltimoComandoRespondido.AddMilliseconds(PingsConsiderarConexao * _TaxaAmostragem) > DateTime.Now;
|
||||
return DadosLeitura.UltimoComandoRespondido.AddMilliseconds(5000) > DateTime.Now;
|
||||
return DadosLeitura.Conectado;
|
||||
}
|
||||
}
|
||||
public bool ConexaoAtiva
|
||||
|
|
@ -2284,9 +2276,6 @@ namespace AgroBase.Models.Modules
|
|||
|
||||
private void AtualizaComponentesIniciados()
|
||||
{
|
||||
//AtualizarStatusComponentes();
|
||||
//return;
|
||||
|
||||
DateTime Agora = DateTime.Now;
|
||||
bool modConectado = DadosLeitura.UltimoComandoRespondido.AddMilliseconds(TempoLimiteConexao) > Agora;
|
||||
if (!modConectado && DadosLeitura.Conectado)
|
||||
|
|
|
|||
|
|
@ -111,7 +111,9 @@ namespace AgroBase.Models
|
|||
var mod_ant = saudeAnterior.FirstOrDefault(x => x.modulo == mod.modulo);
|
||||
if (mod.status != mod_ant?.status)
|
||||
{
|
||||
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura.InserirLog(mod.modulo, mod.status, mod.saude, string.Join("; ", mod.motivos), condicoes: string.Join("; ", mod.condicoes_operacionais.Select(x => x.descricao)));
|
||||
string msg = mod.motivos.Any() ? string.Join("; ", mod.motivos) : $"{mod.status} ({mod.saude:0}%)";
|
||||
string msg2 = mod.condicoes_operacionais.Any() ? string.Join("; ", mod.condicoes_operacionais.Select(x => x.descricao)) : null;
|
||||
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura.InserirLog(mod.modulo, mod.status, mod.saude, msg, condicoes: msg2);
|
||||
}
|
||||
if (mod.saude_individual.Any())
|
||||
{
|
||||
|
|
@ -120,7 +122,9 @@ namespace AgroBase.Models
|
|||
var ind_ant = saudeAnterior.FirstOrDefault(x => x.saude_individual.Any(y => y.id == ind.id))?.saude_individual?.FirstOrDefault(x => x.id == ind.id);
|
||||
if (ind.status != ind_ant?.status)
|
||||
{
|
||||
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura.InserirLog(mod.modulo, ind.status, ind.saude, string.Join("; ", ind.motivos), condicoes: string.Join("; ", ind.condicoes_operacionais.Select(x => x.descricao)), id: ind.id);
|
||||
string msg = ind.motivos.Any() ? string.Join("; ", ind.motivos) : $"{ind.status} ({ind.saude:0}%)";
|
||||
string msg2 = ind.condicoes_operacionais.Any() ? string.Join("; ", ind.condicoes_operacionais.Select(x => x.descricao)) : null;
|
||||
Variaveis.OperacaoEmAndamento.Parametros.DadosLeitura.InserirLog(mod.modulo, ind.status, ind.saude, msg, condicoes: msg2, id: ind.label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using AgroBase.Models;
|
||||
using Emgu.CV.Structure;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -591,7 +590,7 @@ namespace AgroBase.Services
|
|||
return;
|
||||
}
|
||||
|
||||
if (IsConnected && (((Agora - _ultimoTx).TotalSeconds > 2 && (Agora - _ultimoRx).TotalSeconds > 2) || _precisaReabrir))
|
||||
if (IsConnected && ((((Agora - _ultimoTx).TotalSeconds > 1 && (Agora - _ultimoRx).TotalSeconds > 1) || (Agora - _ultimoRx).TotalSeconds > 5) || _precisaReabrir))
|
||||
{
|
||||
ErrosCriticos++;
|
||||
_ultimoErroCritico = Agora;
|
||||
|
|
|
|||
|
|
@ -128,18 +128,22 @@
|
|||
<Label x:Name="lblDiagnosticos_DIR_DF" Content="🔒DIR" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="102" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_MOV_DF" Content="🔒MOV" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="128" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_FRODF" Tag="sFRO" Content="🔒FRO" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="346" Canvas.Top="128" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_MAGDF" Tag="sMAG" Content="🔒MAG" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="346" Canvas.Top="154" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_TMVDF" Tag="sNTC" Content="🔒TMP" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="154" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_DIR_EF" Content="🔒DIR" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="102" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_MOV_EF" Content="🔒MOV" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="128" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_FROEF" Tag="sFRO" Content="🔒FRO" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="53" Canvas.Top="128" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_MAGEF" Tag="sMAG" Content="🔒MAG" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="53" Canvas.Top="154" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_TMVEF" Tag="sNTC" Content="🔒TMP" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="154" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_DIR_ET" Content="🔒DIR" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="280" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_MOV_ET" Content="🔒MOV" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="306" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_FROET" Tag="sFRO" Content="🔒FRO" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="53" Canvas.Top="306" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_MAGET" Tag="sMAG" Content="🔒MAG" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="53" Canvas.Top="332" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_TMVET" Tag="sNTC" Content="🔒TMP" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="99" Canvas.Top="332" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_DIR_DT" Content="🔒DIR" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="280" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_MOV_DT" Content="🔒MOV" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="306" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_FRODT" Tag="sFRO" Content="🔒FRO" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="346" Canvas.Top="306" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_MAGDT" Tag="sMAG" Content="🔒MAG" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="346" Canvas.Top="332" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SEN_TMVDT" Tag="sNTC" Content="🔒TMP" Style="{StaticResource RoundedLabel}" Height="21" Width="41" Canvas.Left="300" Canvas.Top="332" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_SNR" Content="🔒SNR" Style="{StaticResource RoundedLabel}" Height="21" Width="40" Canvas.Left="202" Canvas.Top="102" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
<Label x:Name="lblDiagnosticos_LVX" Content="🔒LDR" Style="{StaticResource RoundedLabel}" Height="21" Width="40" Canvas.Left="202" Canvas.Top="128" HorizontalAlignment="Center" VerticalAlignment="Top"/>
|
||||
|
|
|
|||
|
|
@ -515,6 +515,9 @@ namespace OperationControl.Windows
|
|||
case AgroBase.Models.Enums.T_Code.Ipb:
|
||||
iniciado = rover.Alive;
|
||||
break;
|
||||
case AgroBase.Models.Enums.T_Code.Can:
|
||||
iniciado = rover.DadosLeitura.DispositivosMapeados?.Any(x => x.Dispositivo == AgroBase.Models.Enums.T_Code.Can) ?? false;
|
||||
break;
|
||||
case AgroBase.Models.Enums.T_Code.Lra:
|
||||
iniciado = rover.DadosLeitura?.DadosLoRa?.Conectado ?? false;
|
||||
break;
|
||||
|
|
@ -590,15 +593,17 @@ namespace OperationControl.Windows
|
|||
ucr = rover?.DadosLeitura?.Movimentacao?.Dados?.FirstOrDefault(x => x.ID == label)?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else if (modulo == AgroBase.Models.Enums.T_Code.Dir)
|
||||
ucr = rover?.DadosLeitura?.Direcional?.Dados?.FirstOrDefault(x => x.Modulo_ID == label)?.UltimoComandoRespondido ?? DateTime.MinValue;
|
||||
else
|
||||
ucr = rover.DadosLeitura?.Momento ?? DateTime.MinValue;
|
||||
|
||||
DateTime mom = rover.DadosLeitura?.Momento ?? DateTime.MinValue;
|
||||
double can_latencia = (mom - ucr).TotalMilliseconds;
|
||||
double can_latencia = (ucr - mom).TotalMilliseconds;
|
||||
|
||||
lblSaude_Descricao.Content = $"Módulo {modulo} {label}";
|
||||
lblSaude_Iniciado.Content = (iniciado ? "Iniciado" : "Não Iniciado");
|
||||
lblSaude_Iniciado.Foreground = new SolidColorBrush(iniciado ? System.Windows.Media.Colors.Green : System.Windows.Media.Colors.Red);
|
||||
lblSaude_Status.Content = $"{individual?.status ?? saude?.status ?? AgroBase.Models.Enums.StatusModulo.Desconectado} (Saúde {individual?.saude ?? saude?.saude ?? 0}%)";
|
||||
lblSaude_CAN.Content = $"CAN {can_latencia} ms";
|
||||
lblSaude_CAN.Content = $"CAN {can_latencia:0} ms";
|
||||
lblSaude_Latencia.Content = $"Latência {dispositivo?.Latencia ?? 0} ms";
|
||||
lblSaude_Impedimento.Text = $"Impedimento: {motivos ?? "Nenhum"}";
|
||||
|
||||
|
|
@ -614,7 +619,12 @@ namespace OperationControl.Windows
|
|||
PreencherAbaCondicoesOperacionais(saude?.condicoes_operacionais);
|
||||
PreencherAbaAcompanhamento(true);
|
||||
PreencherAbaOpcoes(true);
|
||||
PreencherAbaLogs(rover.DadosLeitura?.Logs?.Where(x => x.Dispositivo == modulo));
|
||||
var logs = rover.DadosLeitura?.Logs?.Where(x => x.Dispositivo == modulo);
|
||||
if (!string.IsNullOrEmpty(label))
|
||||
logs = logs.Where(x => x.ID == label);
|
||||
else
|
||||
logs = logs.Where(x => x.ID == null);
|
||||
PreencherAbaLogs(logs);
|
||||
}
|
||||
|
||||
private void PreencherAbaCondicoesOperacionais(List<ManagerWorkerMessageResponseModulosPendentesSaudeCondicoesModel> condicoes)
|
||||
|
|
|
|||
Loading…
Reference in New Issue