diff --git a/Thermo.Active.Model/DTOModels/ThIO/DTOChannelsSetup.cs b/Thermo.Active.Model/DTOModels/ThIO/DTOChannelsSetup.cs new file mode 100644 index 00000000..8c26c8b9 --- /dev/null +++ b/Thermo.Active.Model/DTOModels/ThIO/DTOChannelsSetup.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Thermo.Active.Model.DTOModels.ThIO +{ + public class DTOChannelsSetup + { + public List DI { get; set; } = new List(); + public List DO { get; set; } = new List(); + public List AI { get; set; } = new List(); + public List AO { get; set; } = new List(); + } +} diff --git a/Thermo.Active.Model/Thermo.Active.Model.csproj b/Thermo.Active.Model/Thermo.Active.Model.csproj index 24c9a727..37483ff3 100644 --- a/Thermo.Active.Model/Thermo.Active.Model.csproj +++ b/Thermo.Active.Model/Thermo.Active.Model.csproj @@ -113,6 +113,7 @@ + diff --git a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs index 32ce7a7f..5a0efe06 100644 --- a/Thermo.Active/Controllers/WebApi/ConfigurationController.cs +++ b/Thermo.Active/Controllers/WebApi/ConfigurationController.cs @@ -125,67 +125,47 @@ namespace Thermo.Active.Controllers.WebApi return Ok(recipeConfig); } -#if false - [Route("IO"), HttpGet] + + [Route("recipeTest"), HttpGet] + public IHttpActionResult GetRecipeTest() + { + List recipeConfig = RecipeConfig.Select(x => new DTORecipeConfigModel() + { + Id = x.Id, + ScaleFactor = x.ScaleFactor, + NumDec = x.NumDec, + 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(), + EnumVal = x.EnumVal + }).ToList(); + + return Ok(recipeConfig); + } + + [Route("configIO"), HttpGet] public IHttpActionResult GetIOConfig() { - DTOChannelsIOModel ChannelsIO = new DTOChannelsIOModel(); + DTOChannelsSetup configIO = new DTOChannelsSetup(); // leggo i 4 tipi di oggetti e popolo - List listDI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DI).Select(x => new DigitalIN() - { - Id = x.Id, - Bank = x.Bank, - Position = x.Position, - //Page = x.Category.ToString(), - Page = x.Page, - Wire = x.Wire, - Profinet = x.Profinet, - Label = x.Label.Replace("__", "_").Replace("__", "_").ToLower() - }).ToList(); - List listDO = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DO).Select(x => new DigitalOUT() - { - Id = x.Id, - Bank = x.Bank, - Position = x.Position, - //Page = x.Category.ToString(), - Page = x.Page, - Wire = x.Wire, - Profinet = x.Profinet, - Label = x.Label.Replace("__", "_").Replace("__", "_").ToLower() - }).ToList(); - List listAI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.AI).Select(x => new AnalogIN() - { - Id = x.Id, - Bank = x.Bank, - Position = x.Position, - //Page = x.Category.ToString(), - Page = x.Page, - Wire = x.Wire, - Profinet = x.Profinet, - Label = x.Label.Replace("__", "_").Replace("__", "_").ToLower() - }).ToList(); - List listAO = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.AO).Select(x => new AnalogOUT() - { - Id = x.Id, - Bank = x.Bank, - Position = x.Position, - //Page = x.Category.ToString(), - Page = x.Page, - Wire = x.Wire, - Profinet = x.Profinet, - Label = x.Label.Replace("__", "_").Replace("__", "_").ToLower() - }).ToList(); + List listDI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DI).GroupBy(x => x.Bank).Select(x => x.Key).ToList(); + List listDO = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DO).GroupBy(x => x.Bank).Select(x => x.Key).ToList(); + List listAI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.AI).GroupBy(x => x.Bank).Select(x => x.Key).ToList(); + List listAO = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.AO).GroupBy(x => x.Bank).Select(x => x.Key).ToList(); // assegno! - ChannelsIO.DI = listDI; - ChannelsIO.DO = listDO; - ChannelsIO.AI = listAI; - ChannelsIO.AO = listAO; + configIO.DI = listDI; + configIO.DO = listDO; + configIO.AI = listAI; + configIO.AO = listAO; // restituisco - return Ok(ChannelsIO); + return Ok(configIO); } -#endif [Route("thermoProd"), HttpGet] public IHttpActionResult GetThermoProdConfig() diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 00000000..864f6498 Binary files /dev/null and b/UpgradeLog.htm differ