Aggiunta classi iniziali x conf

This commit is contained in:
Samuele Locatelli
2022-12-23 09:19:19 +01:00
parent a12253c50f
commit 3a5d675801
14 changed files with 380 additions and 37 deletions
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IobConf.Core
{
public class InputSignalProcess
{
/// <summary>
/// Maschera di filtro blink, INT corrispondente ai BIT da filtrare, ad es
/// 11111111 = 255
/// 00010110 = 22
/// 00000111 = 7
/// </summary>
public int BlinkFilterMask { get; set; } = 0;
/// <summary>
/// Numero di cicli per cui effettuare il mascheramento dei valori (sul fronte di discesa)
/// </summary>
public int BlinkMaxCounter { get; set; } = 10;
}
}
+80
View File
@@ -0,0 +1,80 @@
namespace IobConf.Core
{
/// <summary>
/// Set comandi URI x chiamate server
/// </summary>
public class CmdUri
{
#region Public Properties
/// <summary>
/// comando base x check ALIVE
/// </summary>
public string Alive { get; set; } = "IOB";
/// <summary>
/// Comando base x INPUT
/// </summary>
public string Base { get; set; } = "IOB/input/";
/// <summary>
/// comando base x INPUT in modalità JSON payload come lista
/// </summary>
public string BaseJson { get; set; } = "IOB/evListJson/";
/// <summary>
/// comando base x Raw Transf LOG - salvataggio valori generici in modalità JSON payload
/// come lista
/// </summary>
public string RawTransfJson { get; set; } = "IOB/rawTransfJson/";
/// <summary>
/// comando base x check ENABLED
/// </summary>
public string Enabled { get; set; } = "IOB/enabled/";
/// <summary>
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO
/// </summary>
public string Flog { get; set; } = "IOB/flog/";
/// <summary>
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO in
/// modalità JSON payload come lista
/// </summary>
public string FlogJson { get; set; } = "IOB/flogJson/";
/// <summary>
/// Comando base x ForceSplitODL (check avvio ODL)
/// </summary>
public string ForcleSplitOdl { get; set; } = "IOB/forceSplitOdlFull/";
/// <summary>
/// comando base x check IDLE time IOB
/// </summary>
public string IdleTime { get; set; } = "IOB/getIdlePeriod/";
/// <summary>
/// comando base x check avvio ODL
/// </summary>
public string OdlStarted { get; set; } = "IOB/getCurrOdlStart/";
/// <summary>
/// comando base x comando reboot
/// </summary>
public string Reboot { get; set; } = "sendReboot.aspx?idxMacchina=";
/// <summary>
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO
/// </summary>
public string ULog { get; set; } = "IOB/ulog/";
/// <summary>
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON
/// payload come lista
/// </summary>
public string ULogJson { get; set; } = "IOB/ulogJson/";
#endregion Public Properties
}
}
+16 -1
View File
@@ -24,9 +24,24 @@ namespace IobConf.Core
/// </summary>
public string Port { get; set; } = "0";
/// <summary>
/// Timeout test PING
/// </summary>
public int pingMsTimeout { get; set; } = 500;
/// <summary>
/// TipoCPU (es: Siemens)
/// </summary>
public string cpuType { get; set; } = "ND";
public string CpuType { get; set; } = "ND";
/// <summary>
/// Rack (Siemens S7)
/// </summary>
public short rack { get; set; } = 0;
/// <summary>
/// Slot (Siemens S7)
/// </summary>
public short slot { get; set; } = 0;
}
}
+69 -10
View File
@@ -17,12 +17,32 @@ namespace IobConf.Core
/// <summary>
/// Init classe configurazione
/// </summary>
public IobConfTree()
public IobConfTree()
{ }
/// <summary>
/// Codice Cliente/Installazione
/// </summary>
public string Customer { get; set; } = "SteamWare";
/// <summary>
/// Codice univoco IOB
/// </summary>
public string codIOB { get; set; } = "ND";
public string CodIOB { get; set; } = "ND";
/// <summary>
/// Costruttore
/// </summary>
public string Vendor { get; set; } = "ACME";
/// <summary>
/// Codice modello
/// </summary>
public string Model { get; set; } = "NONE";
/// <summary>
/// Nome file di configurazione
/// </summary>
public string ConfFileName { get; set; } = "";
/// <summary>
/// TIpologia generale dell'adapter
@@ -32,13 +52,43 @@ namespace IobConf.Core
/// <summary>
/// Tipo Adapter specifico (implementazione)
/// </summary>
public AdapterType IobType { get; set; }= AdapterType.ND;
public AdapterType IobType { get; set; } = AdapterType.ND;
/// <summary>
/// Setup server MP da chiamare
/// </summary>
public ServerMapo ServerMES { get; set; } = new ServerMapo();
/// <summary>
/// Setup info verso IOB-MAN
/// </summary>
public RedisPub IobManConf { get; set; } = new RedisPub();
/// <summary>
/// Dati configurazione CNC
/// </summary>
public CncConf CncData { get; set; } = new CncConf();
/// <summary>
/// Setup processing dati in ingresso (es: blink segnali)
/// </summary>
public InputSignalProcess InputDataProc { get; set; } = new InputSignalProcess();
/// <summary>
/// Dati relativi ai parametri gestione tempo ciclo
/// </summary>
public TCData TempoCiclo { get; set; } = new TCData();
/// <summary>
/// Dizionario dei parametri opzionali
/// </summary>
public Dictionary<string, string> OptPar { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Versione software IOB
/// </summary>
public string ReleaseVers { get; set; } = "0.0.0.0";
#region Metodi Serializzazione
/// <summary>
@@ -77,8 +127,14 @@ namespace IobConf.Core
public bool SaveJson(string filePath)
{
bool answ = false;
string rawdata = JsonConvert.SerializeObject(this, Formatting.Indented);
File.WriteAllText(filePath, rawdata);
try
{
string rawdata = getJson();
File.WriteAllText(filePath, rawdata);
answ = true;
}
catch
{ }
return answ;
}
/// <summary>
@@ -89,11 +145,14 @@ namespace IobConf.Core
public bool SaveYaml(string filePath)
{
bool answ = false;
var serializer = new SerializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
var rawdata = serializer.Serialize(this);
File.WriteAllText(filePath, rawdata);
try
{
var rawdata = getYaml();
File.WriteAllText(filePath, rawdata);
answ = true;
}
catch
{ }
return answ;
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IobConf.Core
{
/// <summary>
/// Classe setup comunicazione server REDIS
/// </summary>
public class RedisPub
{
/// <summary>
/// Minimo delta in sec x considerare variazioni informazioni inviate ad IOB-MAN via redis
/// </summary>
public int MinDeltaSec { get; set; } = 2;
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IobConf.Core
{
public class ServerMapo
{
/// <summary>
/// Indica il metodo di trasporto http/https
/// </summary>
public string Transport { get; set; } = "http";
/// <summary>
/// Indirizzo IP server
/// </summary>
public string IpAddr { get; set; } = "127.0.0.1";
/// <summary>
/// URL Base del server applicativo
/// </summary>
public string BaseAppUrl { get; set; } = "/MP/IO/";
public CmdUri Commands { get; set; } = new CmdUri();
/// <summary>
/// Installazione di riferimento
/// </summary>
public string ClientInstall { get; set; } = "SW";
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IobConf.Core
{
/// <summary>
/// Classe gestione parametri legati a gestioen TempoCiclo
/// </summary>
public class TCData
{
/// <summary>
/// Fattore Lambda (innovazione) per calcolo EWMA valore TCiclo corrente
/// </summary>
public double Lambda { get; set; } = 0.4;
/// <summary>
/// Fattore massimo ammesso di delay x il TCiclo
/// </summary>
public double MaxDelayFactor { get; set; } = 1.2;
/// <summary>
/// Incremento massimo pezzi per cui fare calcolo del tempociclo attuale
/// </summary>
public double MaxIncrPz { get; set; } = 2;
}
}
+2 -2
View File
@@ -19,7 +19,7 @@
<button class="btn btn-sm btn-primary" @onclick="() => SaveJson()">Save Json</button>
</div>
</div>
<div class="card-body">
<div class="card-body small">
<p>@confJson</p>
</div>
</div>
@@ -34,7 +34,7 @@
<button class="btn btn-sm btn-primary" @onclick="() => SaveYaml()">Save Yaml</button>
</div>
</div>
<div class="card-body">
<div class="card-body small">
<p>@confYaml</p>
</div>
</div>
+3 -3
View File
@@ -29,7 +29,7 @@ namespace IobConf.UI.Components
CodIOB = $"NewIOB_{DateTime.Now.Second:00}";
CurrentConf = new IobConfTree()
{
codIOB = CodIOB
CodIOB = CodIOB
};
// aggiorno conf JSON/YAML
confJson = (MarkupString)CurrentConf.getJson().Replace("\n", "<br/>").Replace(" ", "&nbsp;&nbsp;");
@@ -58,9 +58,9 @@ namespace IobConf.UI.Components
#region Protected Methods
protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
UpdateConf();
await UpdateConf();
}
#endregion Protected Methods
+8 -2
View File
@@ -7,10 +7,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="google" content="notranslate">
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="lib/bootstrap-icons/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="css/site.min.css" />
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
<link href="IobConf.UI.styles.css" rel="stylesheet" />
@*<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="IobConf.UI.styles.css" rel="stylesheet" />*@
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
+1 -1
View File
@@ -9,7 +9,7 @@ main {
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);
}
.top-row {
+21 -18
View File
@@ -1,6 +1,13 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">IobConf.UI</a>
<div class="container-fluid px-0">
@if (!showText)
{
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">IC <i class="fas fa-caret-square-right"></i></a>
}
else
{
<a class="navbar-brand" @onclick="() => ToggleCompress()">IobConf.UI <i class="fas fa-caret-square-left compresser"></i></a>
}
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
@@ -11,29 +18,25 @@
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
<span class="oi oi-home" aria-hidden="true"></span> <span class="@hideText">Home</span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="oi oi-plus" aria-hidden="true"></span> Counter
<NavLink class="nav-link" href="Converter">
<span class="bi bi-puzzle pe-2" aria-hidden="true"></span> <span class="@hideText">Converter</span>
</NavLink>
</div>
@*<div class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="oi oi-plus" aria-hidden="true"></span> Counter
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
</NavLink>
</div>
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
</NavLink>
</div>*@
</nav>
</div>
@code {
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}
+43
View File
@@ -0,0 +1,43 @@
namespace IobConf.UI.Shared
{
public partial class NavMenu
{
#region Protected Properties
protected string hideText { get => showText ? "" : "invisible"; }
protected bool showText { get; set; } = true;
#endregion Protected Properties
#region Protected Methods
protected void ToggleCompress()
{
showText = !showText;
//EC_compressUpdated.InvokeAsync(showText);
}
#endregion Protected Methods
#region Private Fields
private bool collapseNavMenu = true;
#endregion Private Fields
#region Private Properties
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
#endregion Private Properties
#region Private Methods
private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
#endregion Private Methods
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"provider": "cdnjs",
"library": "bootstrap@5.2.3",
"destination": "wwwroot/lib/bootstrap/"
},
{
"provider": "cdnjs",
"library": "bootstrap-icons@1.10.2",
"destination": "wwwroot/lib/bootstrap-icons/"
}
,
{
"provider": "cdnjs",
"library": "font-awesome@6.2.1",
"destination": "wwwroot/lib/font-awesome/"
}
]
}