refresh methods signal-r & dobug S7Net

This commit is contained in:
Samuele Locatelli
2020-05-19 20:12:34 +02:00
parent dcb65ad4f3
commit bc0a33cf7f
2 changed files with 58 additions and 12 deletions
@@ -113,14 +113,39 @@ namespace Thermo.Active.Controllers.WebApi
SubCategory_1 = x.SubCategory_1,
SubCategory_2 = x.SubCategory_2,
Name = x.Name,
Description=x.Description,
Format=x.Format,
Label= $"{x.Category}_{x.SubCategory_1}_{x.SubCategory_2}_{x.Name}".Replace("__", "_").Replace("__", "_").ToLower()
Description = x.Description,
Format = x.Format,
Label = $"{x.Category}_{x.SubCategory_1}_{x.SubCategory_2}_{x.Name}".Replace("__", "_").Replace("__", "_").ToLower()
}).ToList();
return Ok(recipeConfig);
}
#if false
[Route("ThermoParams"), HttpGet]
public IHttpActionResult GetThermoParamsConfig()
{
// TODO FIXME
// passa i parametri di configurazione es min/max dei gauge...
List<DTORecipeConfigModel> recipeConfig = RecipeConfig.Select(x => new DTORecipeConfigModel()
{
Id = x.Id,
Category = x.Category.ToString(),
SubCategory_1 = x.SubCategory_1,
SubCategory_2 = x.SubCategory_2,
Name = x.Name,
Description = x.Description,
Format = x.Format,
Label = $"{x.Category}_{x.SubCategory_1}_{x.SubCategory_2}_{x.Name}".Replace("__", "_").Replace("__", "_").ToLower()
}).ToList();
return Ok(recipeConfig);
}
#endif
[Route("alarms"), HttpGet]
public IHttpActionResult GetAlarmsConfig()
{
@@ -260,6 +260,8 @@ namespace Thermo.Active.Listeners.SignalR
Dictionary<string, DTORecipeParam> diffData = new Dictionary<string, DTORecipeParam>();
// calcola ed invia SOLO le differenze...
if (false)
{
Parallel.ForEach(currRecipeFull, item =>
{
if (!LastRecipeFullData.ContainsKey(item.Key))
@@ -271,10 +273,29 @@ namespace Thermo.Active.Listeners.SignalR
// comparazione
if (!item.Value.Equals(LastRecipeFullData[item.Key]))
{
diffData.Add(item.Key, item.Value);
diffData[item.Key] = item.Value;
}
}
});
}
else
{
foreach (var item in currRecipeFull)
{
if (!LastRecipeFullData.ContainsKey(item.Key))
{
diffData.Add(item.Key, item.Value);
}
else
{
// comparazione
if (!item.Value.Equals(LastRecipeFullData[item.Key]))
{
diffData[item.Key] = item.Value;
}
}
}
}
if (diffData.Count > 0)
{