diff --git a/IobConf.Core/BlinkSignal.cs b/IobConf.Core/BlinkSignal.cs new file mode 100644 index 00000000..80684fe7 --- /dev/null +++ b/IobConf.Core/BlinkSignal.cs @@ -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 + { + /// + /// Maschera di filtro blink, INT corrispondente ai BIT da filtrare, ad es + /// 11111111 = 255 + /// 00010110 = 22 + /// 00000111 = 7 + /// + public int BlinkFilterMask { get; set; } = 0; + + /// + /// Numero di cicli per cui effettuare il mascheramento dei valori (sul fronte di discesa) + /// + public int BlinkMaxCounter { get; set; } = 10; + + } +} diff --git a/IobConf.Core/CmdUri.cs b/IobConf.Core/CmdUri.cs new file mode 100644 index 00000000..0635324f --- /dev/null +++ b/IobConf.Core/CmdUri.cs @@ -0,0 +1,80 @@ +namespace IobConf.Core +{ + /// + /// Set comandi URI x chiamate server + /// + public class CmdUri + { + #region Public Properties + + /// + /// comando base x check ALIVE + /// + public string Alive { get; set; } = "IOB"; + + /// + /// Comando base x INPUT + /// + public string Base { get; set; } = "IOB/input/"; + + /// + /// comando base x INPUT in modalità JSON payload come lista + /// + public string BaseJson { get; set; } = "IOB/evListJson/"; + + /// + /// comando base x Raw Transf LOG - salvataggio valori generici in modalità JSON payload + /// come lista + /// + public string RawTransfJson { get; set; } = "IOB/rawTransfJson/"; + + /// + /// comando base x check ENABLED + /// + public string Enabled { get; set; } = "IOB/enabled/"; + + /// + /// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO + /// + public string Flog { get; set; } = "IOB/flog/"; + + /// + /// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO in + /// modalità JSON payload come lista + /// + public string FlogJson { get; set; } = "IOB/flogJson/"; + + /// + /// Comando base x ForceSplitODL (check avvio ODL) + /// + public string ForcleSplitOdl { get; set; } = "IOB/forceSplitOdlFull/"; + + /// + /// comando base x check IDLE time IOB + /// + public string IdleTime { get; set; } = "IOB/getIdlePeriod/"; + + /// + /// comando base x check avvio ODL + /// + public string OdlStarted { get; set; } = "IOB/getCurrOdlStart/"; + + /// + /// comando base x comando reboot + /// + public string Reboot { get; set; } = "sendReboot.aspx?idxMacchina="; + + /// + /// comando base x USER LOG - salvataggio parametri extra sistema MAPO + /// + public string ULog { get; set; } = "IOB/ulog/"; + + /// + /// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON + /// payload come lista + /// + public string ULogJson { get; set; } = "IOB/ulogJson/"; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/IobConf.Core/CncConf.cs b/IobConf.Core/CncConf.cs index 3c748cee..2234c9b6 100644 --- a/IobConf.Core/CncConf.cs +++ b/IobConf.Core/CncConf.cs @@ -24,9 +24,24 @@ namespace IobConf.Core /// public string Port { get; set; } = "0"; + /// + /// Timeout test PING + /// + public int pingMsTimeout { get; set; } = 500; + /// /// TipoCPU (es: Siemens) /// - public string cpuType { get; set; } = "ND"; + public string CpuType { get; set; } = "ND"; + + /// + /// Rack (Siemens S7) + /// + public short rack { get; set; } = 0; + + /// + /// Slot (Siemens S7) + /// + public short slot { get; set; } = 0; } } diff --git a/IobConf.Core/IobConfTree.cs b/IobConf.Core/IobConfTree.cs index 1a0891cd..3f43310e 100644 --- a/IobConf.Core/IobConfTree.cs +++ b/IobConf.Core/IobConfTree.cs @@ -17,12 +17,32 @@ namespace IobConf.Core /// /// Init classe configurazione /// - public IobConfTree() + public IobConfTree() { } + + /// + /// Codice Cliente/Installazione + /// + public string Customer { get; set; } = "SteamWare"; + /// /// Codice univoco IOB /// - public string codIOB { get; set; } = "ND"; + public string CodIOB { get; set; } = "ND"; + /// + /// Costruttore + /// + public string Vendor { get; set; } = "ACME"; + + /// + /// Codice modello + /// + public string Model { get; set; } = "NONE"; + + /// + /// Nome file di configurazione + /// + public string ConfFileName { get; set; } = ""; /// /// TIpologia generale dell'adapter @@ -32,13 +52,43 @@ namespace IobConf.Core /// /// Tipo Adapter specifico (implementazione) /// - public AdapterType IobType { get; set; }= AdapterType.ND; + public AdapterType IobType { get; set; } = AdapterType.ND; + + /// + /// Setup server MP da chiamare + /// + public ServerMapo ServerMES { get; set; } = new ServerMapo(); + + /// + /// Setup info verso IOB-MAN + /// + public RedisPub IobManConf { get; set; } = new RedisPub(); /// /// Dati configurazione CNC /// public CncConf CncData { get; set; } = new CncConf(); + /// + /// Setup processing dati in ingresso (es: blink segnali) + /// + public InputSignalProcess InputDataProc { get; set; } = new InputSignalProcess(); + + /// + /// Dati relativi ai parametri gestione tempo ciclo + /// + public TCData TempoCiclo { get; set; } = new TCData(); + + /// + /// Dizionario dei parametri opzionali + /// + public Dictionary OptPar { get; set; } = new Dictionary(); + + /// + /// Versione software IOB + /// + public string ReleaseVers { get; set; } = "0.0.0.0"; + #region Metodi Serializzazione /// @@ -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; } /// @@ -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; } diff --git a/IobConf.Core/RedisPub.cs b/IobConf.Core/RedisPub.cs new file mode 100644 index 00000000..0edcd33c --- /dev/null +++ b/IobConf.Core/RedisPub.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IobConf.Core +{ + /// + /// Classe setup comunicazione server REDIS + /// + public class RedisPub + { + + /// + /// Minimo delta in sec x considerare variazioni informazioni inviate ad IOB-MAN via redis + /// + public int MinDeltaSec { get; set; } = 2; + } +} diff --git a/IobConf.Core/ServerMapo.cs b/IobConf.Core/ServerMapo.cs new file mode 100644 index 00000000..c766d44a --- /dev/null +++ b/IobConf.Core/ServerMapo.cs @@ -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 + { + /// + /// Indica il metodo di trasporto http/https + /// + public string Transport { get; set; } = "http"; + + /// + /// Indirizzo IP server + /// + public string IpAddr { get; set; } = "127.0.0.1"; + + /// + /// URL Base del server applicativo + /// + public string BaseAppUrl { get; set; } = "/MP/IO/"; + + public CmdUri Commands { get; set; } = new CmdUri(); + + /// + /// Installazione di riferimento + /// + public string ClientInstall { get; set; } = "SW"; + + + + + + + + } +} diff --git a/IobConf.Core/TCData.cs b/IobConf.Core/TCData.cs new file mode 100644 index 00000000..ad053ab8 --- /dev/null +++ b/IobConf.Core/TCData.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IobConf.Core +{ + /// + /// Classe gestione parametri legati a gestioen TempoCiclo + /// + public class TCData + { + /// + /// Fattore Lambda (innovazione) per calcolo EWMA valore TCiclo corrente + /// + public double Lambda { get; set; } = 0.4; + + /// + /// Fattore massimo ammesso di delay x il TCiclo + /// + public double MaxDelayFactor { get; set; } = 1.2; + + /// + /// Incremento massimo pezzi per cui fare calcolo del tempociclo attuale + /// + public double MaxIncrPz { get; set; } = 2; + + } +} diff --git a/IobConf.UI/Components/TestConfig.razor b/IobConf.UI/Components/TestConfig.razor index 4e6ce88d..fed6c4c2 100644 --- a/IobConf.UI/Components/TestConfig.razor +++ b/IobConf.UI/Components/TestConfig.razor @@ -19,7 +19,7 @@ -
+

@confJson

@@ -34,7 +34,7 @@ -
+

@confYaml

diff --git a/IobConf.UI/Components/TestConfig.razor.cs b/IobConf.UI/Components/TestConfig.razor.cs index 568c40a8..eb4f3947 100644 --- a/IobConf.UI/Components/TestConfig.razor.cs +++ b/IobConf.UI/Components/TestConfig.razor.cs @@ -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", "
").Replace(" ", "  "); @@ -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 diff --git a/IobConf.UI/Pages/_Layout.cshtml b/IobConf.UI/Pages/_Layout.cshtml index 0a64860f..e74a312a 100644 --- a/IobConf.UI/Pages/_Layout.cshtml +++ b/IobConf.UI/Pages/_Layout.cshtml @@ -7,10 +7,16 @@ + - - + + + + + @* + + *@ diff --git a/IobConf.UI/Shared/MainLayout.razor.css b/IobConf.UI/Shared/MainLayout.razor.css index 551e4b27..605602c6 100644 --- a/IobConf.UI/Shared/MainLayout.razor.css +++ b/IobConf.UI/Shared/MainLayout.razor.css @@ -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 { diff --git a/IobConf.UI/Shared/NavMenu.razor b/IobConf.UI/Shared/NavMenu.razor index 7fe9b182..031755ec 100644 --- a/IobConf.UI/Shared/NavMenu.razor +++ b/IobConf.UI/Shared/NavMenu.razor @@ -1,6 +1,13 @@