test x output conf IO

This commit is contained in:
Samuele E. Locatelli
2021-02-04 10:55:36 +01:00
parent d2d20d16a2
commit 89ee203461
4 changed files with 50 additions and 53 deletions
@@ -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<string> DI { get; set; } = new List<string>();
public List<string> DO { get; set; } = new List<string>();
public List<string> AI { get; set; } = new List<string>();
public List<string> AO { get; set; } = new List<string>();
}
}
@@ -113,6 +113,7 @@
<Compile Include="DTOModels\DTOM156InputModel.cs" />
<Compile Include="DTOModels\DTOMessageModel.cs" />
<Compile Include="DTOModels\ThAxes\DTOAxisInfoModel.cs" />
<Compile Include="DTOModels\ThIO\DTOChannelsSetup.cs" />
<Compile Include="DTOModels\ThIO\DTOChannelsIO.cs" />
<Compile Include="DTOModels\ThModules\DTOModulesBlock.cs" />
<Compile Include="DTOModels\ThProd\DTOProdInfo.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<DTORecipeConfigModel> 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<DigitalIN> 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<DigitalOUT> 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<AnalogIN> 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<AnalogOUT> 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<string> listDI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DI).GroupBy(x => x.Bank).Select(x => x.Key).ToList();
List<string> listDO = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.DO).GroupBy(x => x.Bank).Select(x => x.Key).ToList();
List<string> listAI = IOConfig.Where(x => x.Category == Model.Constants.TACT_IO_TYPE.AI).GroupBy(x => x.Bank).Select(x => x.Key).ToList();
List<string> 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()
BIN
View File
Binary file not shown.