From 2c9c86d7491d8bea48f1eccfad15940e8de350fa Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 27 Mar 2023 19:47:58 +0200 Subject: [PATCH 01/38] Gestione adapter: riavvio se dati "stale" che non si aggiornano oltre 60 sec --- MP.MONO.ADAPTER.OPC/IobOpcUa.cs | 16 +++++++++++++++- MP.MONO.ADAPTER.OPC/Program.cs | 15 +++++++++++---- MP.MONO.ADAPTER.OPC/appsettings.json | 3 ++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs index 1f88140..0564e68 100644 --- a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs +++ b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs @@ -45,6 +45,7 @@ namespace MP.MONO.ADAPTER.OPC msVetoRedCache = config.GetValue("OptPar:VetoSendCache"); MinWait = config.GetValue("OptPar:MinWait"); MaxWait = config.GetValue("OptPar:MaxWait"); + DataStaleSec = config.GetValue("OptPar:DataStaleSec"); AlarmCleanPre = config.GetValue("OptPar:AlarmCleanPre"); AlarmCleanPost = config.GetValue("OptPar:AlarmCleanPost"); AlarmTrimWSpace = config.GetValue("OptPar:AlarmTrimWSpace"); @@ -229,7 +230,20 @@ namespace MP.MONO.ADAPTER.OPC /// /// dataOra ultima verifica CNC disconnesso... /// - internal DateTime lastDisconnCheck; + protected DateTime lastDisconnCheck; + + /// + /// Valore soglia in secondi x indicare che i dati sono stale = bloccati/non aggiornati + /// + protected int DataStaleSec = 120; + + /// + /// Verifica se i dati siano stale = incastrati (ultimo dato letto oltre 2 minuti fa) e quindi sia encessario effettuare disconnect/reconnect + /// + public bool dataIsStale + { + get => DateTime.Now.Subtract(lastCurrent).TotalSeconds > DataStaleSec; + } /// /// Dizionario della DataOra ultimo invio x ogni valore diff --git a/MP.MONO.ADAPTER.OPC/Program.cs b/MP.MONO.ADAPTER.OPC/Program.cs index 1bced07..e00c306 100644 --- a/MP.MONO.ADAPTER.OPC/Program.cs +++ b/MP.MONO.ADAPTER.OPC/Program.cs @@ -89,13 +89,20 @@ namespace MP.MONO.ADAPTER.OPC do { // se non fosse connesso... riprovo la connessione... - if (!currIob.connectionOk) - { - currIob.tryConnect(); - } + currIob.tryConnect(); + // attesa... Thread.Sleep(100); + // aggiunta condizioni check dati "recenti" x ri-connessione: se NON si fosse + // aggiornato entro limite indicato --> disconnect/reconnect + if (currIob.dataIsStale) + { + currIob.tryDisconnect(); + Thread.Sleep(500); + currIob.tryConnect(); + } + // verifico se c'è evento quit quit = quitEvent.WaitOne(Math.Min(1_000, waitTime)); } while (!quit); diff --git a/MP.MONO.ADAPTER.OPC/appsettings.json b/MP.MONO.ADAPTER.OPC/appsettings.json index 12055af..f2f3b91 100644 --- a/MP.MONO.ADAPTER.OPC/appsettings.json +++ b/MP.MONO.ADAPTER.OPC/appsettings.json @@ -53,7 +53,8 @@ "Log2File": true, "MinWait": 50, "MaxWait": 150, - "VetoSendCache": 50 + "VetoSendCache": 50, + "DataStaleSec": 60 }, "Machine": { "Manufacturer": "Multiax", From 94edd546459705cf896e6342e28a71f25b6d070f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 27 Mar 2023 19:48:18 +0200 Subject: [PATCH 02/38] powershell x fix DB espostato da win verso linux --- Utils/DB_sqlFix.ps1 | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Utils/DB_sqlFix.ps1 diff --git a/Utils/DB_sqlFix.ps1 b/Utils/DB_sqlFix.ps1 new file mode 100644 index 0000000..9f8c32b --- /dev/null +++ b/Utils/DB_sqlFix.ps1 @@ -0,0 +1,47 @@ +#----------------------------------------- +# MySql script converter +# +# convertitore script mysql da Windows a linux (fix x maiuscole nei nomi...) +# +#----------------------------------------- + +# leggo ogni file *.sql nella folder in cui mi trovo +$fileList = Get-Childitem 'MAPO_MONO_DB.sql' #*.sql + +foreach($file in $fileList) +{ + ## nome ricetta (senza xml... + #$fileName=$file | Select-Object Name + #$recName = $fileName.Name.Replace('.xml','') + #$recName + + # leggo tutto il file + $contenuto = Get-Content $file -Raw + # effettuo 1:1 le sostituzioni + $newContenuto = $contenuto -replace 'alarmlist','AlarmList' + $newContenuto = $newContenuto -replace 'alarmlog','AlarmLog' + $newContenuto = $newContenuto -replace 'alarmrec','AlarmRec' + $newContenuto = $newContenuto -replace 'ankeyval','AnKeyVal' + $newContenuto = $newContenuto -replace 'config','Config' + $newContenuto = $newContenuto -replace 'counter','Counter' + $newContenuto = $newContenuto -replace 'datalog','DataLog' + $newContenuto = $newContenuto -replace 'datastag','DataStAg' + $newContenuto = $newContenuto -replace 'event','Event' + $newContenuto = $newContenuto -replace 'eventlog','EventLog' + $newContenuto = $newContenuto -replace 'machine','Machine' + $newContenuto = $newContenuto -replace 'machinegroup','MachineGroup' + $newContenuto = $newContenuto -replace 'pendingmainttask','PendingMaintTask' + $newContenuto = $newContenuto -replace 'prevmainttask','PrevMaintTask' + $newContenuto = $newContenuto -replace 'prodlog','ProdLog' + $newContenuto = $newContenuto -replace 'status','Status' + $newContenuto = $newContenuto -replace 'statuslog','StatusLog' + $newContenuto = $newContenuto -replace 'statusstag','StatusStAg' + $newContenuto = $newContenuto -replace 'tasktopic','TaskTopic' + $newContenuto = $newContenuto -replace 'userteam','UserTeam' + $newContenuto = $newContenuto -replace '__efmigrationshistory','__EFMigrationsHistory' + + + $newContenuto = $newContenuto.Trim() + # salvataggio file elaborato + Set-Content -Path $file -Value $newContenuto +} From 573375138bc591b5bb5bcbd54ed770349fb0c3fb Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 27 Mar 2023 19:48:45 +0200 Subject: [PATCH 03/38] refresh manifest vari --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/Conf/lic.IIS01.file | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 8384e7b..22ee56c 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2211.1019 + 1.2.2303.2719 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index f2b7064..e624c47 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

Version: 1.2.2211.1019

+

Version: 1.2.2303.2719


Release Note:
  • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 869a269..1bec892 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2211.1019 +1.2.2303.2719 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 64c3edd..ca0d4cc 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2211.1019 + 1.2.2303.2719 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 15b8b51..71148a2 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2211.1019 + 1.2.2303.2719 diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index f2b7064..e624c47 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

    Version: 1.2.2211.1019

    +

    Version: 1.2.2303.2719


    Release Note:
    • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 869a269..1bec892 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2211.1019 +1.2.2303.2719 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 2666ee5..8e383da 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2211.1019 + 1.2.2303.2719 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index c14130d..6a3c79d 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2211.1019 + 1.2.2303.2719 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index f2b7064..e624c47 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

      Version: 1.2.2211.1019

      +

      Version: 1.2.2303.2719


      Release Note:
      • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 869a269..1bec892 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2211.1019 +1.2.2303.2719 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index eb653a6..6137d9f 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2211.1019 + 1.2.2303.2719 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/Conf/lic.IIS01.file b/MP.MONO.UI/Conf/lic.IIS01.file index 187ca62..81f5d46 100644 --- a/MP.MONO.UI/Conf/lic.IIS01.file +++ b/MP.MONO.UI/Conf/lic.IIS01.file @@ -1 +1 @@ -7846c819c695edbad32f74f84430d98a82e57cc6a99ec55a4dce6c9c5eb62bec560dbfe8feca34eef826fadb81c4884b9b215fda89cf4dcee5eb46f52287e722 \ No newline at end of file +77b916d9f6d6157678a62fb9654d26346719ab9e4609be9b53e130f2395ee7a7273d2269e1843349fe6c081608221dc47e6ef76018e6039ea6c2910211f734ba \ No newline at end of file diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index a09cc86..dd815e3 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2211.1019 + 1.2.2303.2719 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index f2b7064..e624c47 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

        Version: 1.2.2211.1019

        +

        Version: 1.2.2303.2719


        Release Note:
        • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 869a269..1bec892 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2211.1019 +1.2.2303.2719 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 9fc5677..853d461 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2211.1019 + 1.2.2303.2719 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 43647dd648ae264989edd826a357b1597fc6bf5a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 14:18:48 +0200 Subject: [PATCH 04/38] Fix migration x DB + update conf --- MP.MONO.Data/Controllers/MpDbController.cs | 78 +- MP.MONO.Data/DbConfig.cs | 4 +- MP.MONO.Data/MapoMonoContext.cs | 10 +- ...0230328121501_UpdateConfStatus.Designer.cs | 1738 +++++++++++++++++ .../20230328121501_UpdateConfStatus.cs | 120 ++ .../MapoMonoContextModelSnapshot.cs | 156 +- MP.MONO.Data/ModelBuilderExtensions.cs | 19 +- 7 files changed, 2117 insertions(+), 8 deletions(-) create mode 100644 MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.Designer.cs create mode 100644 MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.cs diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 8c95cfd..6a6eab8 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -515,7 +515,7 @@ namespace MP.MONO.Data.Controllers var stillOpenAlarms = localDbCtx .DbSetAlarmRec .Where(x => x.DtStart >= x.DtEnd && x.AlarmId == newItem.AlarmId) - .Select(x=> x.AlarmId) + .Select(x => x.AlarmId) .ToList(); // se ho trovato --> salto! @@ -1158,6 +1158,33 @@ namespace MP.MONO.Data.Controllers return fatto; } + + /// + /// Inserimento di una lista record Production Log + /// + /// Lista Record da inserire (senza ID...) + /// + public async Task ProdLogInsertMany(List newItems) + { + bool fatto = false; + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + await localDbCtx + .DbSetProdLog + .AddRangeAsync(newItems); + await localDbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ProdLogInsertMany{Environment.NewLine}{exc}"); + } + } + return fatto; + } + /// /// genera elenco Task Schedulati missing da schema + attualmente presenti... /// @@ -1234,6 +1261,55 @@ namespace MP.MONO.Data.Controllers return answ; } + + /// + /// Inserisce un nuovo record status log calcolando durata da rec precedente.. + /// + /// + /// + public async Task StatusLogInsert(StatusLogModel newRec) + { + bool answ = false; + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + float duration = 0; + // ultimo inserito... + var lastrec = localDbCtx + .DbSetStatusLog + .Where(x => x.MachineId == newRec.MachineId) + .OrderByDescending(x => x.DtRif) + .FirstOrDefault(); + + // se trovato calcolo durata... + if (lastrec != null) + { + duration = (float)DateTime.Now.Subtract(lastrec.DtRif).TotalMinutes; + } + + // aggiorno durata + newRec.Duration = duration; + + // inserisco record + + localDbCtx + .DbSetStatusLog + .Add(newRec); + + // salvo + localDbCtx.SaveChanges(); + answ = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante StatusLogInsert{Environment.NewLine}{exc}"); + } + } + await Task.Delay(1); + return answ; + } + /// /// Recupero elenco Task Schedulati dati Macchina ed intervento "master" /// diff --git a/MP.MONO.Data/DbConfig.cs b/MP.MONO.Data/DbConfig.cs index 2151a07..2780dca 100644 --- a/MP.MONO.Data/DbConfig.cs +++ b/MP.MONO.Data/DbConfig.cs @@ -9,7 +9,7 @@ namespace MP.MONO.Data // Database config public static int DATABASE_PROCESS_TIMEOUT = 5; public static string DATABASE_SERV = "127.0.0.1"; - public static string DATABASE_NAME = "MAPO.MONO"; + public static string DATABASE_NAME = "MAPO_MONO"; public static string DATABASE_USER = "MAPO_MONO_User"; public static string DATABASE_PWD = "viadante16"; @@ -56,7 +56,7 @@ namespace MP.MONO.Data //public DbConfig() //{ // // stringa admin con utente root egalware... - // CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid=root;pwd=Egalware_24068!;sslmode=None"; + // CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid=root;pwd=Seriate_24068!;sslmode=None"; //} public static void InitDb(string server, string nKey, string sKey) diff --git a/MP.MONO.Data/MapoMonoContext.cs b/MP.MONO.Data/MapoMonoContext.cs index 7f75167..4b63e27 100644 --- a/MP.MONO.Data/MapoMonoContext.cs +++ b/MP.MONO.Data/MapoMonoContext.cs @@ -20,7 +20,7 @@ namespace MP.MONO.Data public MapoMonoContext() { - //connString = "server=10.74.82.230;port=3306;database=MAPO.MONO;uid=steamware;pwd=Egalware_24068!;sslmode=None;"; + //connString = "server=10.74.82.230;port=3306;database=MAPO.MONO;uid=steamware;pwd=Seriate_24068!;sslmode=None;"; } @@ -112,7 +112,7 @@ namespace MP.MONO.Data /// DbSet MachineGroup x Prev Maint ///
public virtual DbSet DbSetPMMachGroup { get; set; } = null!; - + /// /// DbSet Task di Prev Maint definiti /// @@ -133,9 +133,9 @@ namespace MP.MONO.Data #region Protected Methods + protected string connString = ""; protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - string connString = ""; // tento setup da config try { @@ -144,6 +144,10 @@ namespace MP.MONO.Data } catch { } + if(string.IsNullOrEmpty(connString)) + { + connString = "server=10.74.82.230; port=3306; database=MAPO.MONO; uid=steamware; pwd=Seriate_24068!; sslmode=None;"; + } if (!optionsBuilder.IsConfigured) { var serverVersion = ServerVersion.AutoDetect(connString); diff --git a/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.Designer.cs b/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.Designer.cs new file mode 100644 index 0000000..58a3692 --- /dev/null +++ b/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.Designer.cs @@ -0,0 +1,1738 @@ +// +using System; +using MP.MONO.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + [DbContext(typeof(MapoMonoContext))] + [Migration("20230328121501_UpdateConfStatus")] + partial class UpdateConfStatus + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmListModel", b => + { + b.Property("AlarmId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("FullValue") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmId"); + + b.ToTable("AlarmList"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.Property("AlarmLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("MemAddress") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Status") + .HasColumnType("int unsigned"); + + b.Property("ValDecoded") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.Property("AlarmRecId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AlarmId") + .HasColumnType("int"); + + b.Property("DtEnd") + .HasColumnType("datetime(6)"); + + b.Property("DtStart") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.HasKey("AlarmRecId"); + + b.HasIndex("AlarmId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmRec"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AnKeyValModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Descript") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValFloat") + .HasColumnType("int"); + + b.Property("ValInt") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("AnKeyVal"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ConfigModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Val") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValStd") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("Config"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.CounterModel", b => + { + b.Property("CCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ActualVal") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("LastReset") + .HasColumnType("datetime(6)"); + + b.HasKey("CCode"); + + b.ToTable("Counter"); + + b.HasData( + new + { + CCode = "MacPowerOn", + ActualVal = 0.0, + Description = "Machine Power On", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "CycleProc01", + ActualVal = 0.0, + Description = "Process 1 on Cycle state", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque01", + ActualVal = 0.0, + Description = "Spindle 01 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque02", + ActualVal = 0.0, + Description = "Spindle 02 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque03", + ActualVal = 0.0, + Description = "Spindle 03 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque04", + ActualVal = 0.0, + Description = "Spindle 04 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "LMCheckElapsed", + ActualVal = 0.0, + Description = "Time Elapsed from last full Manufacturer Check", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.Property("DataLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DataType") + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumRec") + .HasColumnType("double"); + + b.Property("ValNumAvg") + .HasColumnType("double"); + + b.Property("ValNumMax") + .HasColumnType("double"); + + b.Property("ValNumMin") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodEvent") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodEvent"); + + b.HasIndex("MachineId"); + + b.ToTable("EventLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventModel", b => + { + b.Property("CodEvent") + .HasColumnType("varchar(255)"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("IsUser") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodEvent"); + + b.ToTable("Event"); + + b.HasData( + new + { + CodEvent = "", + Active = true, + Description = "NA", + IsUser = false + }, + new + { + CodEvent = "Run", + Active = true, + Description = "Running", + IsUser = true + }, + new + { + CodEvent = "Setup", + Active = true, + Description = "Machine Setup", + IsUser = true + }, + new + { + CodEvent = "ProgEdit", + Active = true, + Description = "Program Editing", + IsUser = true + }, + new + { + CodEvent = "Fill", + Active = true, + Description = "Machine Fill", + IsUser = true + }, + new + { + CodEvent = "SetError", + Active = true, + Description = "Error", + IsUser = true + }, + new + { + CodEvent = "WuCd", + Active = true, + Description = "Warm Up / CoolDown Machine", + IsUser = false + }, + new + { + CodEvent = "ContrPwr", + Active = true, + Description = "Controlled PowerOn / ShutDown", + IsUser = false + }, + new + { + CodEvent = "ProgMiss", + Active = true, + Description = "Program Missing", + IsUser = true + }, + new + { + CodEvent = "HRMiss", + Active = true, + Description = "HR Missing", + IsUser = true + }, + new + { + CodEvent = "Maint", + Active = true, + Description = "Maintenance", + IsUser = true + }, + new + { + CodEvent = "Clean", + Active = true, + Description = "Machine CleanUp", + IsUser = true + }, + new + { + CodEvent = "SetPwrOff", + Active = true, + Description = "Power OFF Declaration", + IsUser = true + }, + new + { + CodEvent = "Init", + Active = true, + Description = "Init", + IsUser = false + }, + new + { + CodEvent = "PowerOff", + Active = true, + Description = "Power OFF", + IsUser = false + }, + new + { + CodEvent = "PowerOn", + Active = true, + Description = "Power ON", + IsUser = false + }, + new + { + CodEvent = "Cycle", + Active = true, + Description = "Machining", + IsUser = false + }, + new + { + CodEvent = "EndCycle", + Active = true, + Description = "End machining", + IsUser = false + }, + new + { + CodEvent = "Error", + Active = true, + Description = "Error", + IsUser = false + }, + new + { + CodEvent = "PzCount", + Active = true, + Description = "Item Count(+1)", + IsUser = false + }, + new + { + CodEvent = "StartPall", + Active = true, + Description = "Start pallet", + IsUser = false + }, + new + { + CodEvent = "EndPall", + Active = true, + Description = "End pallet", + IsUser = false + }, + new + { + CodEvent = "Manual", + Active = true, + Description = "Manual", + IsUser = false + }, + new + { + CodEvent = "LOutFull", + Active = true, + Description = "Line Out Full", + IsUser = false + }, + new + { + CodEvent = "LInEmpty", + Active = true, + Description = "Line In Empty", + IsUser = false + }, + new + { + CodEvent = "CycleTOut", + Active = true, + Description = "Timeout Std CycleTime", + IsUser = false + }, + new + { + CodEvent = "RMatMiss", + Active = true, + Description = "Raw Material Missing", + IsUser = true + }, + new + { + CodEvent = "Emergency", + Active = true, + Description = "Emergency", + IsUser = false + }, + new + { + CodEvent = "ToolRepl", + Active = true, + Description = "Tool Replacement", + IsUser = true + }, + new + { + CodEvent = "CncAlam", + Active = true, + Description = "CNC Alarm", + IsUser = false + }, + new + { + CodEvent = "PlcAlam", + Active = true, + Description = "PLC Alarm", + IsUser = false + }, + new + { + CodEvent = "Warning", + Active = true, + Description = "Warning State", + IsUser = false + }, + new + { + CodEvent = "Message", + Active = true, + Description = "Machine Message", + IsUser = false + }, + new + { + CodEvent = "PzIncr", + Active = true, + Description = "Item Count Increment", + IsUser = false + }, + new + { + CodEvent = "PzSet", + Active = true, + Description = "Item Count Set", + IsUser = false + }, + new + { + CodEvent = "UserComm", + Active = true, + Description = "User Comment", + IsUser = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.MachineModel", b => + { + b.Property("MachineId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BuildYear") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Model") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Serial") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("MachineId"); + + b.ToTable("Machine"); + + b.HasData( + new + { + MachineId = 1, + BuildYear = 2023, + Code = "", + Description = "Default SIM Machine", + Model = "Egalware SIM", + Name = "EGW-SIM-Machine", + Serial = "SN-0000-0000-0000" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.Property("SMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("CountStartVal") + .HasColumnType("double"); + + b.Property("DtCreation") + .HasColumnType("datetime(6)"); + + b.Property("DtExecution") + .HasColumnType("datetime(6)"); + + b.Property("ElapsedVal") + .HasColumnType("double"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("PMTaskId") + .HasColumnType("int"); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("PMTaskId"); + + b.ToTable("PendingMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMMGroupModel", b => + { + b.Property("PMMGCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMMGCode"); + + b.ToTable("MachineGroup"); + + b.HasData( + new + { + PMMGCode = "Whole", + Description = "Whole Machine" + }, + new + { + PMMGCode = "Load", + Description = "Part loader/unloader" + }, + new + { + PMMGCode = "MovBelts", + Description = "Part moving belts" + }, + new + { + PMMGCode = "MovRoll", + Description = "Part moving rollers" + }, + new + { + PMMGCode = "Axis", + Description = "Machining axis" + }, + new + { + PMMGCode = "Spindles", + Description = "Tool spindles" + }, + new + { + PMMGCode = "ToolChange", + Description = "Automatic tool changer" + }, + new + { + PMMGCode = "Cabinet", + Description = "Electrical cabinet" + }, + new + { + PMMGCode = "ChipConv", + Description = "Chips conveyor" + }, + new + { + PMMGCode = "DustSuct", + Description = "Dust suction" + }, + new + { + PMMGCode = "OpPanel", + Description = "Operator pannel" + }, + new + { + PMMGCode = "Access", + Description = "Accessories" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMTaskTopicModel", b => + { + b.Property("PMTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMTCode"); + + b.ToTable("TaskTopic"); + + b.HasData( + new + { + PMTCode = "Mechanical", + Description = "Mechanical system" + }, + new + { + PMTCode = "Electro", + Description = "Electrical system" + }, + new + { + PMTCode = "Lubro", + Description = "Lubrication system" + }, + new + { + PMTCode = "Coolant", + Description = "Coolant system" + }, + new + { + PMTCode = "Preumo", + Description = "Pneumatic system" + }, + new + { + PMTCode = "Hydro", + Description = "Hydraulic system" + }, + new + { + PMTCode = "Safety", + Description = "Enclosure/Safety system" + }, + new + { + PMTCode = "Suction", + Description = "Suction system" + }, + new + { + PMTCode = "GeoAdj", + Description = "Geometrical system" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMUTModel", b => + { + b.Property("PMUTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMUTCode"); + + b.ToTable("UserTeam"); + + b.HasData( + new + { + PMUTCode = "TrainOp", + Description = "Trained Operator" + }, + new + { + PMUTCode = "MaintServ", + Description = "Maintenance Service" + }, + new + { + PMUTCode = "DevSupp", + Description = "Device Supplier" + }, + new + { + PMUTCode = "MultiaxServ", + Description = "Multiax Service" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.Property("PMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("ExtIdx") + .HasColumnType("int"); + + b.Property("IsDisabled") + .HasColumnType("tinyint(1)"); + + b.Property("JobDescription") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumTaskDone") + .HasColumnType("int"); + + b.Property("PMMGCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMUTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("Protected") + .HasColumnType("tinyint(1)"); + + b.HasKey("PMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("MachineId"); + + b.HasIndex("PMMGCode"); + + b.HasIndex("PMTCode"); + + b.HasIndex("PMUTCode"); + + b.ToTable("PrevMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.Property("ProdLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("EvType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtRef") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("ProdLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("ProdLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("CssClass") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CssClassOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("GroupOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Prior") + .HasColumnType("int"); + + b.Property("ShowProdItem") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodStatus"); + + b.ToTable("Status"); + + b.HasData( + new + { + CodStatus = "", + CssClass = "dark", + CssClassOvr = "", + Description = "NA", + Group = "NA", + GroupOvr = "", + Prior = 0, + ShowProdItem = true + }, + new + { + CodStatus = "Error", + CssClass = "danger", + CssClassOvr = "", + Description = "Error", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Emergency", + CssClass = "danger", + CssClassOvr = "", + Description = "Emergency", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Manual", + CssClass = "warning", + CssClassOvr = "", + Description = "Manual", + Group = "ManYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "PzProd", + CssClass = "warning", + CssClassOvr = "", + Description = "Item Produced", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "Unkn", + CssClass = "warning", + CssClassOvr = "", + Description = "Unknown Stop", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "ProgMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "Program Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "HRMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "HR Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Maint", + CssClass = "warning", + CssClassOvr = "", + Description = "Maintenance", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineOutFull", + CssClass = "danger", + CssClassOvr = "", + Description = "Line Out Full", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineInEmpty", + CssClass = "danger", + CssClassOvr = "", + Description = "Line In Empty", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "RawMatMiss", + CssClass = "danger", + CssClassOvr = "", + Description = "Raw Material Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "CncAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "CNC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PlcAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "PLC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "WUpCDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Warm Up / CoolDown Machine", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ContrPOnSDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Controller PowerOn / ShutDown", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Init", + CssClass = "primary", + CssClassOvr = "", + Description = "Init", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOn", + CssClass = "primary", + CssClassOvr = "", + Description = "Power ON", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "TimeoutCycle", + CssClass = "primary", + CssClassOvr = "", + Description = "Timeout Std CycleTime", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Waiting", + CssClass = "primary", + CssClassOvr = "", + Description = "Waiting State", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ProgEdit", + CssClass = "warning", + CssClassOvr = "", + Description = "Program Editing", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Setup", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Setup", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Clean", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine CleanUp", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Fill", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Fill", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ToolReplace", + CssClass = "warning", + CssClassOvr = "", + Description = "Tool Replacement", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Warning", + CssClass = "warning", + CssClassOvr = "", + Description = "Warning State", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOff", + CssClass = "secondary", + CssClassOvr = "", + Description = "Power OFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Run", + CssClass = "success", + CssClassOvr = "", + Description = "Running", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Cycle", + CssClass = "success", + CssClassOvr = "", + Description = "Machining", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_000", + CssClass = "secondary", + CssClassOvr = "", + Description = "UNDEFINED", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_001", + CssClass = "secondary", + CssClassOvr = "", + Description = "POWEROFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_002", + CssClass = "success", + CssClassOvr = "", + Description = "AUTOMATIC", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_003", + CssClass = "warning", + CssClassOvr = "", + Description = "EDIT", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_004", + CssClass = "warning", + CssClassOvr = "", + Description = "SEMIAUTOMATIC", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_005", + CssClass = "warning", + CssClassOvr = "", + Description = "MANUAL_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_006", + CssClass = "danger", + CssClassOvr = "", + Description = "ALARM", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_007", + CssClass = "danger", + CssClassOvr = "", + Description = "ESTOP", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_008", + CssClass = "warning", + CssClassOvr = "", + Description = "MDI", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_009", + CssClass = "warning", + CssClassOvr = "", + Description = "STEP", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_010", + CssClass = "warning", + CssClassOvr = "", + Description = "INC_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_011", + CssClass = "warning", + CssClassOvr = "", + Description = "PROFILE", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_012", + CssClass = "warning", + CssClassOvr = "", + Description = "HOME", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_013", + CssClass = "warning", + CssClassOvr = "", + Description = "HANDWHEEL", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.AlarmListModel", "AlarmListNav") + .WithMany() + .HasForeignKey("AlarmId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("AlarmListNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.EventModel", "CodEventNav") + .WithMany() + .HasForeignKey("CodEvent") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodEventNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PrevMaintTaskModel", "PMTaskeNav") + .WithMany() + .HasForeignKey("PMTaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("PMTaskeNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMMGroupModel", "MachGroupNav") + .WithMany() + .HasForeignKey("PMMGCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMTaskTopicModel", "TopicNav") + .WithMany() + .HasForeignKey("PMTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMUTModel", "UserTeamNav") + .WithMany() + .HasForeignKey("PMUTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("MachGroupNav"); + + b.Navigation("MachineNav"); + + b.Navigation("TopicNav"); + + b.Navigation("UserTeamNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.cs b/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.cs new file mode 100644 index 0000000..5ae0cde --- /dev/null +++ b/MP.MONO.Data/Migrations/20230328121501_UpdateConfStatus.cs @@ -0,0 +1,120 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + public partial class UpdateConfStatus : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Machine", + keyColumn: "MachineId", + keyValue: 1, + column: "BuildYear", + value: 2023); + + migrationBuilder.InsertData( + table: "Status", + columns: new[] { "CodStatus", "CssClass", "CssClassOvr", "Description", "Group", "GroupOvr", "Prior", "ShowProdItem" }, + values: new object[,] + { + { "MS_000", "secondary", "", "UNDEFINED", "Gray", "", 1, true }, + { "MS_001", "secondary", "", "POWEROFF", "Gray", "", 1, true }, + { "MS_002", "success", "", "AUTOMATIC", "Green", "", 1, true }, + { "MS_003", "warning", "", "EDIT", "ManYellow", "", 1, true }, + { "MS_004", "warning", "", "SEMIAUTOMATIC", "ManYellow", "", 1, true }, + { "MS_005", "warning", "", "MANUAL_JOG", "ManYellow", "", 1, true }, + { "MS_006", "danger", "", "ALARM", "StopRed", "", 1, true }, + { "MS_007", "danger", "", "ESTOP", "StopRed", "", 1, true }, + { "MS_008", "warning", "", "MDI", "ManYellow", "", 1, true }, + { "MS_009", "warning", "", "STEP", "ManYellow", "", 1, true }, + { "MS_010", "warning", "", "INC_JOG", "ManYellow", "", 1, true }, + { "MS_011", "warning", "", "PROFILE", "ManYellow", "", 1, true }, + { "MS_012", "warning", "", "HOME", "ManYellow", "", 1, true }, + { "MS_013", "warning", "", "HANDWHEEL", "ManYellow", "", 1, true } + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_000"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_001"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_002"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_003"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_004"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_005"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_006"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_007"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_008"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_009"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_010"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_011"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_012"); + + migrationBuilder.DeleteData( + table: "Status", + keyColumn: "CodStatus", + keyValue: "MS_013"); + + migrationBuilder.UpdateData( + table: "Machine", + keyColumn: "MachineId", + keyValue: 1, + column: "BuildYear", + value: 2022); + } + } +} diff --git a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs index a379dc3..0a0d2e7 100644 --- a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs +++ b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs @@ -644,7 +644,7 @@ namespace MP.MONO.Data.Migrations new { MachineId = 1, - BuildYear = 2022, + BuildYear = 2023, Code = "", Description = "Default SIM Machine", Model = "Egalware SIM", @@ -1359,6 +1359,160 @@ namespace MP.MONO.Data.Migrations GroupOvr = "", Prior = 1, ShowProdItem = true + }, + new + { + CodStatus = "MS_000", + CssClass = "secondary", + CssClassOvr = "", + Description = "UNDEFINED", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_001", + CssClass = "secondary", + CssClassOvr = "", + Description = "POWEROFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_002", + CssClass = "success", + CssClassOvr = "", + Description = "AUTOMATIC", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_003", + CssClass = "warning", + CssClassOvr = "", + Description = "EDIT", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_004", + CssClass = "warning", + CssClassOvr = "", + Description = "SEMIAUTOMATIC", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_005", + CssClass = "warning", + CssClassOvr = "", + Description = "MANUAL_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_006", + CssClass = "danger", + CssClassOvr = "", + Description = "ALARM", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_007", + CssClass = "danger", + CssClassOvr = "", + Description = "ESTOP", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_008", + CssClass = "warning", + CssClassOvr = "", + Description = "MDI", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_009", + CssClass = "warning", + CssClassOvr = "", + Description = "STEP", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_010", + CssClass = "warning", + CssClassOvr = "", + Description = "INC_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_011", + CssClass = "warning", + CssClassOvr = "", + Description = "PROFILE", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_012", + CssClass = "warning", + CssClassOvr = "", + Description = "HOME", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_013", + CssClass = "warning", + CssClassOvr = "", + Description = "HANDWHEEL", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true }); }); diff --git a/MP.MONO.Data/ModelBuilderExtensions.cs b/MP.MONO.Data/ModelBuilderExtensions.cs index fb4bd7a..047db8e 100644 --- a/MP.MONO.Data/ModelBuilderExtensions.cs +++ b/MP.MONO.Data/ModelBuilderExtensions.cs @@ -100,7 +100,24 @@ namespace MP.MONO.Data // produzione , new StatusModel { Prior = 1, CodStatus = "Run", Description = "Running", CssClass = "success", Group = "Green" } , new StatusModel { Prior = 1, CodStatus = "Cycle", Description = "Machining", CssClass = "success", Group = "Green" } - + + + // eventi cablati da status macchina... + , new StatusModel { Prior = 1, CodStatus = "MS_000", Description = "UNDEFINED", CssClass = "secondary", Group = "Gray" } + , new StatusModel { Prior = 1, CodStatus = "MS_001", Description = "POWEROFF", CssClass = "secondary", Group = "Gray" } + , new StatusModel { Prior = 1, CodStatus = "MS_002", Description = "AUTOMATIC", CssClass = "success", Group = "Green" } + , new StatusModel { Prior = 1, CodStatus = "MS_003", Description = "EDIT", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_004", Description = "SEMIAUTOMATIC", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_005", Description = "MANUAL_JOG", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_006", Description = "ALARM", CssClass = "danger", Group = "StopRed" } + , new StatusModel { Prior = 1, CodStatus = "MS_007", Description = "ESTOP", CssClass = "danger", Group = "StopRed" } + , new StatusModel { Prior = 1, CodStatus = "MS_008", Description = "MDI", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_009", Description = "STEP", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_010", Description = "INC_JOG", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_011", Description = "PROFILE", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_012", Description = "HOME", CssClass = "warning", Group = "ManYellow" } + , new StatusModel { Prior = 1, CodStatus = "MS_013", Description = "HANDWHEEL", CssClass = "warning", Group = "ManYellow" } + ); // inizializzazione dei valori di default x Tipologia counters From 3143bd5233b6913c1f9f668f7745a2d29b73c9a7 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 14:18:59 +0200 Subject: [PATCH 05/38] Update decoder x salvataggio dati prodLog --- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 137 ++++++++++++++++++++++- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/appsettings.json | 2 +- MP.MONO.DECODER/appsettings.office.json | 2 +- 7 files changed, 141 insertions(+), 8 deletions(-) diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 71148a2..638bd5c 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2719 + 1.2.2303.2814 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 0706550..f7217cc 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -125,6 +125,8 @@ MessagePipe mpStatusSendPipe = new MessagePipe(redisConn, Constants.STATUS_M_QUE MessagePipe mpStatusRecvPipe = new MessagePipe(redisConn, Constants.STATUS_RAW_QUEUE); // datetime dell'inizio esecuzione task... x usare un semaforo di veto doppia esecuzione entro 30 sec DateTime lastExecStatus = DateTime.Now.AddHours(-1); +// ultimi parametri stato x check variazione.. +Dictionary parListLast = new Dictionary(); // registro gestione eventi mpStatusRecvPipe.EA_NewMessage += MpStatusRecvPipe_EA_NewMessage; @@ -393,6 +395,74 @@ void setupConf() } } +/// +/// Test di uguaglianza tra 2 dizionari... +/// +bool testEqual(Dictionary dict1, Dictionary dict2) +{ + // se nulli inizializzo... + if (dict1 == null) + { + dict1 = new Dictionary(); + } + if (dict2 == null) + { + dict2 = new Dictionary(); + } + // in primis testo num elementi + int num1 = dict1.Count; + int num2 = dict2.Count; + if (num1 != num2) + { + return false; + } + else + { + // comparazione sequenze ordinate... + return dict1.OrderBy(x => x.Key).SequenceEqual(dict2.OrderBy(x => x.Key)); + } +} + +/// +/// Stato precedentemente salvato su REDIS x calcolo variazioni +/// +Dictionary getLastStatusVal() +{ + Dictionary answ = new Dictionary(); + if (redisDb != null) + { + string rawData = redisDb.StringGet(Constants.STATUS_LAST_KEY); + if (!string.IsNullOrEmpty(rawData)) + { + try + { + var rawDict = JsonConvert.DeserializeObject>(rawData); + answ = rawDict != null ? rawDict : new Dictionary(); + } + catch + { } + } + } + return answ; +} + +/// +/// Salva su redis il set di valori ricevuti +/// +bool setLastStatusVal(Dictionary dataList) +{ + bool answ = false; + if (redisDb != null) + { + string rawData = JsonConvert.SerializeObject(dataList); + if (!string.IsNullOrEmpty(rawData)) + { + answ = redisDb.StringSet(Constants.STATUS_LAST_KEY, rawData); + } + } + return answ; +} + /// /// Gestione evento ricezione messaggi allarmi secondo tipologia attiva... /// @@ -1073,11 +1143,18 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) MachineDTO? machinePlate = new MachineDTO(); Dictionary parList = new Dictionary(); + // recupero status precedente... + string rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); if (!string.IsNullOrEmpty(rawData)) { machinePlate = JsonConvert.DeserializeObject(rawData); } + if (machinePlate == null) + { + machinePlate = new MachineDTO(); + } + int machStatus = 0; int procStatus = 0; int procMode = 0; @@ -1107,7 +1184,7 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) Stopwatch sw = new Stopwatch(); sw.Start(); -#if false +#if true // calcolo status if (machStatus == 0) { @@ -1189,6 +1266,7 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) Log.Info("-------------"); #endif +#if false // calcolo con LUA e vedo se cambia... sw.Restart(); bool done = mpStatusMan.processData(parList, ref machinePlate); @@ -1203,6 +1281,61 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) else { numSendMStatus++; + } +#endif + + // recupero elenco valori... + var lastStatusParams = getLastStatusVal(); + // verifico parametri state se modificati da ultimo invio --> salvo su DB + bool isEqual = testEqual(dataList, lastStatusParams); + if (!isEqual) + { + // calcolo differenze e salvo... + var diffVal = dataList.Where(entry => !lastStatusParams.ContainsKey(entry.Key) || lastStatusParams[entry.Key] != entry.Value) + .ToDictionary(entry => entry.Key, entry => entry.Value); + + // salvo ultimo blocco valori last status... + setLastStatusVal(dataList); + + // salvo i valori modificati... + List newProdRecords = diffVal + .Select(x => new ProdLogModel() + { + DtRif = adesso, + EvType = x.Key, + ValStr = x.Value, + MachineId = MachineId + }) + .ToList(); + // per ogni valore cerca di effettuare conversione a double... + double testVal = 0; + foreach (var item in newProdRecords) + { + testVal = 0; + double.TryParse(item.ValStr, out testVal); + item.ValNum = testVal; + } + // salvo su DB x log produzione + _ = dbController.ProdLogInsertMany(newProdRecords); + +#if false + // confronto variazioni x "MACHINE STATUS" + string keyStatus = "MACHINE STATUS"; + if (diffVal.ContainsKey(keyStatus)) + { + string codStatus = $"MS_{diffVal[keyStatus]:000}"; + // chiamo registrazione sul DB dello stato... + var newRecStatus = new StatusLogModel() + { + MachineId = MachineId, + DtRif = adesso, + Duration = 0, + CodStatus = codStatus + }; + _ = dbController.StatusLogInsert(newRecStatus); + } +#endif + } // invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati @@ -1218,7 +1351,7 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) }; /// -/// Gestione evento ricezione messaggi status +/// Gestione evento ricezione messaggi status x conteggi... /// void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) { diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index e624c47..a3a793e 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

Version: 1.2.2303.2719

+

Version: 1.2.2303.2814


Release Note:
  • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 1bec892..d3460ae 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2719 +1.2.2303.2814 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 8e383da..94e415e 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2719 + 1.2.2303.2814 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/appsettings.json b/MP.MONO.DECODER/appsettings.json index 01b05de..297af27 100644 --- a/MP.MONO.DECODER/appsettings.json +++ b/MP.MONO.DECODER/appsettings.json @@ -10,7 +10,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.DECODER/appsettings.office.json b/MP.MONO.DECODER/appsettings.office.json index efa264c..252c28a 100644 --- a/MP.MONO.DECODER/appsettings.office.json +++ b/MP.MONO.DECODER/appsettings.office.json @@ -10,7 +10,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { From 230ad3531687ca975aa908adfa30078078d4174e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 14:19:13 +0200 Subject: [PATCH 06/38] Refresh generico conf admin --- MP.MONO.ADAPTER.OPC/appsettings.json | 2 +- MP.MONO.ADAPTER.OPC/appsettings.multiax.json | 2 +- MP.MONO.ADAPTER.OPC/appsettings.office.json | 2 +- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.Core/Constants.cs | 1 + MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.SIM/appsettings.json | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- MP.MONO.UI/appsettings.json | 2 +- MP.MONO.UI/appsettings.ufficio.json | 2 +- 19 files changed, 19 insertions(+), 18 deletions(-) diff --git a/MP.MONO.ADAPTER.OPC/appsettings.json b/MP.MONO.ADAPTER.OPC/appsettings.json index f2f3b91..3529b5e 100644 --- a/MP.MONO.ADAPTER.OPC/appsettings.json +++ b/MP.MONO.ADAPTER.OPC/appsettings.json @@ -9,7 +9,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.ADAPTER.OPC/appsettings.multiax.json b/MP.MONO.ADAPTER.OPC/appsettings.multiax.json index 3672fef..c6752df 100644 --- a/MP.MONO.ADAPTER.OPC/appsettings.multiax.json +++ b/MP.MONO.ADAPTER.OPC/appsettings.multiax.json @@ -9,7 +9,7 @@ "Redis": "localhost:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.ADAPTER.OPC/appsettings.office.json b/MP.MONO.ADAPTER.OPC/appsettings.office.json index 5feae5a..ba19e73 100644 --- a/MP.MONO.ADAPTER.OPC/appsettings.office.json +++ b/MP.MONO.ADAPTER.OPC/appsettings.office.json @@ -9,7 +9,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 22ee56c..c729fac 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2719 + 1.2.2303.2814 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index e624c47..a3a793e 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

    Version: 1.2.2303.2719

    +

    Version: 1.2.2303.2814


    Release Note:
    • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 1bec892..d3460ae 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2719 +1.2.2303.2814 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index ca0d4cc..5007bf5 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2719 + 1.2.2303.2814 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Core/Constants.cs b/MP.MONO.Core/Constants.cs index b7dbe86..4542b8f 100644 --- a/MP.MONO.Core/Constants.cs +++ b/MP.MONO.Core/Constants.cs @@ -57,6 +57,7 @@ namespace MP.MONO.Core public static readonly string PARAMS_CURR_KEY = $"{BASE_HASH}:Current:Params"; public static readonly string PROD_CURR_KEY = $"{BASE_HASH}:Current:Production"; public static readonly string STATUS_ACT_KEY = $"{BASE_HASH}:Current:StatusVal"; + public static readonly string STATUS_LAST_KEY = $"{BASE_HASH}:Current:StatusLastVal"; public static readonly string STATUS_CURR_KEY = $"{BASE_HASH}:Current:Status"; public static readonly string TOOLS_ACT_KEY = $"{BASE_HASH}:Current:ToolsVal"; public static readonly string TOOLS_CURR_KEY = $"{BASE_HASH}:Current:Tools"; diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 6a3c79d..bf7ea8e 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2719 + 1.2.2303.2814 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index e624c47..a3a793e 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

      Version: 1.2.2303.2719

      +

      Version: 1.2.2303.2814


      Release Note:
      • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 1bec892..d3460ae 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2719 +1.2.2303.2814 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 6137d9f..09a3af8 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2719 + 1.2.2303.2814 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/appsettings.json b/MP.MONO.SIM/appsettings.json index 2ff1dc6..0d64557 100644 --- a/MP.MONO.SIM/appsettings.json +++ b/MP.MONO.SIM/appsettings.json @@ -10,7 +10,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=30000,syncTimeout=30000,asyncTimeout=30000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 5aee921..d7cbc60 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2719 + 1.2.2303.2814 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index e624c47..a3a793e 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

        Version: 1.2.2303.2719

        +

        Version: 1.2.2303.2814


        Release Note:
        • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 1bec892..d3460ae 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2719 +1.2.2303.2814 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 853d461..cfc126a 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2719 + 1.2.2303.2814 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/appsettings.json b/MP.MONO.UI/appsettings.json index 1b20c19..d62e4b6 100644 --- a/MP.MONO.UI/appsettings.json +++ b/MP.MONO.UI/appsettings.json @@ -10,7 +10,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { diff --git a/MP.MONO.UI/appsettings.ufficio.json b/MP.MONO.UI/appsettings.ufficio.json index 0623025..ec5b059 100644 --- a/MP.MONO.UI/appsettings.ufficio.json +++ b/MP.MONO.UI/appsettings.ufficio.json @@ -10,7 +10,7 @@ "Redis": "nkcredis.steamware.net:6379,DefaultDatabase=7,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG", "AuthConnection": "Server=localhost;port=3306;database=GWMS;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;", - "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Egalware_24068!;sslmode=None;", + "AdminConnection": "Server=localhost;port=3306;database=MAPO.MONO;user=root;pwd=Seriate_24068!;sslmode=None;", "MP.MONO.Data": "Server=localhost;port=3306;database=MAPO.MONO;user=GWMS;pwd=GWMS_secret_pwd;sslmode=None;" }, "DbConfig": { From 7b94368e7cbb299dfbafcdd362bf7bb4aa75e2d6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 18:03:41 +0200 Subject: [PATCH 07/38] ok lettura vista pareto gloable stati amcchina --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.Core/Constants.cs | 2 + MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/MPStatusManager.cs | 19 +- MP.MONO.DECODER/Program.cs | 254 ++++++++++-------- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.Data/Controllers/MpDbController.cs | 68 ++++- MP.MONO.Data/DbModels/ParetoStatusModel.cs | 30 +++ .../ManualSql/stored_ParetoStatus.sql | 23 ++ MP.MONO.Data/ManualSql/view_ParetoStatus.sql | 11 + MP.MONO.Data/MapoMonoContext.cs | 8 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 24 files changed, 305 insertions(+), 142 deletions(-) create mode 100644 MP.MONO.Data/DbModels/ParetoStatusModel.cs create mode 100644 MP.MONO.Data/ManualSql/stored_ParetoStatus.sql create mode 100644 MP.MONO.Data/ManualSql/view_ParetoStatus.sql diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index c729fac..3396623 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2814 + 1.2.2303.2818 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index a3a793e..a543fac 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

          Version: 1.2.2303.2814

          +

          Version: 1.2.2303.2818


          Release Note:
          • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index d3460ae..95de523 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2814 +1.2.2303.2818 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 5007bf5..3129323 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2814 + 1.2.2303.2818 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Core/Constants.cs b/MP.MONO.Core/Constants.cs index 4542b8f..c4c0971 100644 --- a/MP.MONO.Core/Constants.cs +++ b/MP.MONO.Core/Constants.cs @@ -58,6 +58,7 @@ namespace MP.MONO.Core public static readonly string PROD_CURR_KEY = $"{BASE_HASH}:Current:Production"; public static readonly string STATUS_ACT_KEY = $"{BASE_HASH}:Current:StatusVal"; public static readonly string STATUS_LAST_KEY = $"{BASE_HASH}:Current:StatusLastVal"; + public static readonly string STATUS_PARETO_KEY = $"{BASE_HASH}:Current:StatusPareto"; public static readonly string STATUS_CURR_KEY = $"{BASE_HASH}:Current:Status"; public static readonly string TOOLS_ACT_KEY = $"{BASE_HASH}:Current:ToolsVal"; public static readonly string TOOLS_CURR_KEY = $"{BASE_HASH}:Current:Tools"; @@ -77,6 +78,7 @@ namespace MP.MONO.Core public static readonly string PARAMS_M_QUEUE = $"Params"; public static readonly string PROD_M_QUEUE = $"Production"; public static readonly string STATUS_M_QUEUE = $"Status"; + public static readonly string STATUS_PAR_QUEUE = $"StatusPareto"; public static readonly string COUNT_M_QUEUE = $"Count"; public static readonly string TOOLS_M_QUEUE = $"Tools"; diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 638bd5c..4ee60f1 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2814 + 1.2.2303.2818 diff --git a/MP.MONO.DECODER/MPStatusManager.cs b/MP.MONO.DECODER/MPStatusManager.cs index f203c94..68d1250 100644 --- a/MP.MONO.DECODER/MPStatusManager.cs +++ b/MP.MONO.DECODER/MPStatusManager.cs @@ -37,13 +37,18 @@ namespace MP.MONO.DECODER /// /// /// - public bool processData(Dictionary paramsList, ref MachineDTO? MachinePlate) + public MachineDTO processData(Dictionary paramsList, MachineDTO MachinePlate) { bool calcOk = false; - if (MachinePlate == null) + MachineDTO plateOut = new MachineDTO() { - MachinePlate = new MachineDTO(); - } + Manufacturer = MachinePlate.Manufacturer, + ModeId = MachinePlate.ModeId, + Model = MachinePlate.Model, + Name = MachinePlate.Name, + SerNumber = MachinePlate.SerNumber, + StatusId = MachinePlate.StatusId + }; DateTime adesso = DateTime.Now; state.NewTable("dataList"); @@ -75,12 +80,12 @@ namespace MP.MONO.DECODER var stringVal = state.GetString("statusId"); if (!string.IsNullOrEmpty(stringVal)) { - MachinePlate.StatusId = state.GetInteger("statusId"); + plateOut.StatusId = state.GetInteger("statusId"); } stringVal = state.GetString("modeId"); if (!string.IsNullOrEmpty(stringVal)) { - MachinePlate.ModeId = state.GetInteger("modeId"); + plateOut.ModeId = state.GetInteger("modeId"); } } catch (Exception exc) @@ -91,7 +96,7 @@ namespace MP.MONO.DECODER else { } - return calcOk; + return plateOut; } #endregion Public Methods diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index f7217cc..2de00b6 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -103,6 +103,14 @@ DateTime lastLogDetail = DateTime.Now.AddHours(-1); int numSendParam = 1; int numSendTools = 1; int numSendMStatus = 1; +Random rand = new Random(); + +/* ---------------------------------------------------------------- + * Setup Thread periodici (es calcolo pareto stati) + * ----------------------------------------------------------------*/ +MessagePipe mpStatusParetoSendPipe = new MessagePipe(redisConn, Constants.STATUS_PAR_QUEUE); +Thread threadStatus = new Thread(calcParetoStatus); +threadStatus.Start(); /* -------------------------------- * Setup Gestione Counters @@ -423,6 +431,29 @@ bool testEqual(Dictionary dict1, Dictionary dict } } +/// +/// Ultimo Plate machine salvato +/// +MachineDTO getLastMachinePlate() +{ + MachineDTO? currMPlate = new MachineDTO(); + string rawData = redisDb.StringGet(Constants.STATUS_CURR_KEY); + if (string.IsNullOrEmpty(rawData)) + { + rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); + } + if (!string.IsNullOrEmpty(rawData)) + { + currMPlate = JsonConvert.DeserializeObject(rawData); + } + if (currMPlate == null) + { + currMPlate = new MachineDTO(); + } + return currMPlate; +} + + /// /// Stato precedentemente salvato su REDIS x calcolo variazioni /// @@ -463,6 +494,29 @@ bool setLastStatusVal(Dictionary dataList) return answ; } +void calcParetoStatus() +{ + // ricalcolo ogni 60" +/- 3sec + int minPeriod = 57000; + int maxPeriod = 63000; + + do + { + // periodo riferimento sempre ricalcolato... + DateTime inizio = DateTime.Today; + DateTime fine = DateTime.Today.AddDays(1); + // recupero pareto da DB + var newStatus = dbController.ParetoStatusMach(MachineId, inizio, fine); + // serializzo e salvo + string rawData = JsonConvert.SerializeObject(newStatus); + mpStatusParetoSendPipe.saveAndSendMessage(Constants.STATUS_PARETO_KEY, rawData); + + // attesa random di circa 1 minuti x calcolare... + Thread.Sleep(rand.Next(minPeriod, maxPeriod)); + } while (true); +} + + /// /// Gestione evento ricezione messaggi allarmi secondo tipologia attiva... /// @@ -1140,20 +1194,10 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) *************************************************************************/ // recupero elenco parametri salvati in redis... - MachineDTO? machinePlate = new MachineDTO(); Dictionary parList = new Dictionary(); - // recupero status precedente... - - string rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); - if (!string.IsNullOrEmpty(rawData)) - { - machinePlate = JsonConvert.DeserializeObject(rawData); - } - if (machinePlate == null) - { - machinePlate = new MachineDTO(); - } + MachineDTO lastMachinePlate = getLastMachinePlate(); + MachineDTO nextMachinePlate = new MachineDTO(); int machStatus = 0; int procStatus = 0; @@ -1180,107 +1224,110 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) parList.Add(currKey, procMode); } + bool useLua = true; // fix me todo inserire gestione program name!!! - Stopwatch sw = new Stopwatch(); sw.Start(); -#if true - // calcolo status - if (machStatus == 0) + if (useLua) { - machinePlate.StatusId = 7; + // calcolo con LUA e vedo se cambia... + sw.Restart(); + nextMachinePlate = mpStatusMan.processData(parList, lastMachinePlate); + sw.Stop(); + + if (adesso.Subtract(lastLogDetail).TotalSeconds > 5 || numSendMStatus > 10) + { + Log.Info($"Calcolo LUA | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(nextMachinePlate)} | x {numSendMStatus}"); + lastLogDetail = adesso; + numSendMStatus = 0; + } + else + { + numSendMStatus++; + } } +#if false else { - switch (procMode) + // calcolo status + if (machStatus == 0) + { + nextMachinePlate.StatusId = 7; + } + else + { + switch (procMode) + { + case 1: + nextMachinePlate.StatusId = 8; + break; + + case 2: + nextMachinePlate.StatusId = 2; + break; + + case 3: + nextMachinePlate.StatusId = 9; + break; + + case 4: + nextMachinePlate.StatusId = 5; + break; + + case 5: + nextMachinePlate.StatusId = 10; + break; + + case 6: + nextMachinePlate.StatusId = 11; + break; + + case 7: + nextMachinePlate.StatusId = 12; + break; + + case 8: + nextMachinePlate.StatusId = 13; + break; + + default: + break; + } + } + // eseguo cablata la gestione x ora... rispetto a MachineStatus + MachineMode + // invierò un machineDTO + switch (procStatus) { case 1: - machinePlate.StatusId = 8; + lastMachinePlate.ModeId = 2; break; case 2: - machinePlate.StatusId = 2; + lastMachinePlate.ModeId = 1; break; case 3: - machinePlate.StatusId = 9; - break; - - case 4: - machinePlate.StatusId = 5; - break; - - case 5: - machinePlate.StatusId = 10; + lastMachinePlate.ModeId = 3; break; case 6: - machinePlate.StatusId = 11; - break; - - case 7: - machinePlate.StatusId = 12; + lastMachinePlate.ModeId = 8; break; case 8: - machinePlate.StatusId = 13; + lastMachinePlate.ModeId = 9; + break; + + case 11: + lastMachinePlate.ModeId = 10; break; default: break; } - } - // eseguo cablata la gestione x ora... rispetto a MachineStatus + MachineMode - // invierò un machineDTO - switch (procStatus) - { - case 1: - machinePlate.ModeId = 2; - break; - - case 2: - machinePlate.ModeId = 1; - break; - - case 3: - machinePlate.ModeId = 3; - break; - - case 6: - machinePlate.ModeId = 8; - break; - - case 8: - machinePlate.ModeId = 9; - break; - - case 11: - machinePlate.ModeId = 10; - break; - - default: - break; - } - sw.Stop(); - Log.Info($"Calcolo C# | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(machinePlate)}"); - Log.Info("-------------"); -#endif - -#if false - // calcolo con LUA e vedo se cambia... - sw.Restart(); - bool done = mpStatusMan.processData(parList, ref machinePlate); - sw.Stop(); - - if (adesso.Subtract(lastLogDetail).TotalSeconds > 5 || numSendMStatus > 10) - { - Log.Info($"Calcolo LUA | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(machinePlate)} | x {numSendMStatus}"); - lastLogDetail = adesso; - numSendMStatus = 0; - } - else - { - numSendMStatus++; + sw.Stop(); + Log.Info($"Calcolo C# | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(nextMachinePlate)}"); + Log.Info("-------------"); } #endif @@ -1317,29 +1364,26 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) } // salvo su DB x log produzione _ = dbController.ProdLogInsertMany(newProdRecords); + } -#if false - // confronto variazioni x "MACHINE STATUS" - string keyStatus = "MACHINE STATUS"; - if (diffVal.ContainsKey(keyStatus)) + // confronto variazioni x "MACHINE STATUS" + if (nextMachinePlate.StatusId != lastMachinePlate.StatusId) + { + //string codStatus = $"MS_{diffVal[keyStatus]:000}"; + string codStatus = $"MS_{nextMachinePlate.StatusId:000}"; + // chiamo registrazione sul DB dello stato... + var newRecStatus = new StatusLogModel() { - string codStatus = $"MS_{diffVal[keyStatus]:000}"; - // chiamo registrazione sul DB dello stato... - var newRecStatus = new StatusLogModel() - { - MachineId = MachineId, - DtRif = adesso, - Duration = 0, - CodStatus = codStatus - }; - _ = dbController.StatusLogInsert(newRecStatus); - } -#endif - + MachineId = MachineId, + DtRif = adesso, + Duration = 0, + CodStatus = codStatus + }; + _ = dbController.StatusLogInsert(newRecStatus); } // invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati - string updRawVal = JsonConvert.SerializeObject(machinePlate); + string updRawVal = JsonConvert.SerializeObject(nextMachinePlate); mpStatusSendPipe.saveAndSendMessage(Constants.STATUS_CURR_KEY, updRawVal); } } diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index a3a793e..a543fac 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

            Version: 1.2.2303.2814

            +

            Version: 1.2.2303.2818


            Release Note:
            • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index d3460ae..95de523 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2814 +1.2.2303.2818 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 94e415e..7bdb07b 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2814 + 1.2.2303.2818 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 6a6eab8..527091e 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -907,6 +907,34 @@ namespace MP.MONO.Data.Controllers return currMachDto; } + + /// + /// Recupero pareto status impianto + /// + /// Macchina selezionata + /// inizio periodo + /// fine periodo + /// + public List ParetoStatusMach(int MachineId, DateTime from, DateTime to) + { + List dbResult = new List(); + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + dbResult = localDbCtx + .DbSetParetoStatus + . OrderByDescending(x => x.TotDuration) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ParetoStatusMach{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// Recupera elenco contatori ammessi /// @@ -1274,28 +1302,42 @@ namespace MP.MONO.Data.Controllers { try { - float duration = 0; + bool needInsert = false; // ultimo inserito... - var lastrec = localDbCtx + var lastRec = localDbCtx .DbSetStatusLog .Where(x => x.MachineId == newRec.MachineId) .OrderByDescending(x => x.DtRif) .FirstOrDefault(); - // se trovato calcolo durata... - if (lastrec != null) + // se non trovato inserisco comunque + if (lastRec == null) { - duration = (float)DateTime.Now.Subtract(lastrec.DtRif).TotalMinutes; + needInsert = true; + } + // se trovato controllo variazione... + else + { + // se cambia stato... + if (lastRec.CodStatus != newRec.CodStatus) + { + needInsert = true; + } + // oppure se è passato il giorno... + else if (lastRec.DtRif.Date < newRec.DtRif.Date) + { + needInsert = true; + } + // calcolo durata vecchio record... + lastRec.Duration = (float)DateTime.Now.Subtract(lastRec.DtRif).TotalMinutes; } - // aggiorno durata - newRec.Duration = duration; - - // inserisco record - - localDbCtx - .DbSetStatusLog - .Add(newRec); + if (needInsert) + { + localDbCtx + .DbSetStatusLog + .Add(newRec); + } // salvo localDbCtx.SaveChanges(); diff --git a/MP.MONO.Data/DbModels/ParetoStatusModel.cs b/MP.MONO.Data/DbModels/ParetoStatusModel.cs new file mode 100644 index 0000000..f81fe1e --- /dev/null +++ b/MP.MONO.Data/DbModels/ParetoStatusModel.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.MONO.Data.DbModels +{ + /// + /// Tabella Codifica Stati + /// + public class ParetoStatusModel + { + #region Public Properties + + /// + /// UID + /// + [Key] + public string CodStatus { get; set; } = ""; + /// + /// Durata totale stato + /// + public float TotDuration { get; set; } = 0; + + + #endregion Public Properties + } +} diff --git a/MP.MONO.Data/ManualSql/stored_ParetoStatus.sql b/MP.MONO.Data/ManualSql/stored_ParetoStatus.sql new file mode 100644 index 0000000..a23301b --- /dev/null +++ b/MP.MONO.Data/ManualSql/stored_ParetoStatus.sql @@ -0,0 +1,23 @@ +-- stored +DELIMITER // +GO + +CREATE OR REPLACE PROCEDURE stp_paretoStatus( + IN machine_id INT, + IN dt_from DATETIME, + IN dt_to DATETIME +) +READS SQL DATA +BEGIN + SELECT CodStatus, SUM(Duration) AS TotDuration + FROM StatusLog + WHERE MachineId = machine_id + AND DtRif >= dt_from + AND DtRif <= dt_to + GROUP BY CodStatus; +END; +// +GO + +DELIMITER ; +GO \ No newline at end of file diff --git a/MP.MONO.Data/ManualSql/view_ParetoStatus.sql b/MP.MONO.Data/ManualSql/view_ParetoStatus.sql new file mode 100644 index 0000000..7f8fcc9 --- /dev/null +++ b/MP.MONO.Data/ManualSql/view_ParetoStatus.sql @@ -0,0 +1,11 @@ +-- creazione viste +DELIMITER ; + +DROP VIEW IF EXISTS v_ParetoStatus; +GO + +CREATE VIEW v_ParetoStatus AS +SELECT CodStatus,SUM(Duration) AS TotDuration +FROM StatusLog +GROUP BY CodStatus; +GO \ No newline at end of file diff --git a/MP.MONO.Data/MapoMonoContext.cs b/MP.MONO.Data/MapoMonoContext.cs index 4b63e27..f6c032a 100644 --- a/MP.MONO.Data/MapoMonoContext.cs +++ b/MP.MONO.Data/MapoMonoContext.cs @@ -123,6 +123,11 @@ namespace MP.MONO.Data /// public virtual DbSet DbSetSMTask { get; set; } = null!; + /// + /// DbSet Pareto Status giornaliero + /// + public virtual DbSet DbSetParetoStatus { get; set; } = null!; + #endregion Public Properties #region Private Methods @@ -146,7 +151,7 @@ namespace MP.MONO.Data { } if(string.IsNullOrEmpty(connString)) { - connString = "server=10.74.82.230; port=3306; database=MAPO.MONO; uid=steamware; pwd=Seriate_24068!; sslmode=None;"; + connString = "server=10.74.82.230; port=3306; database=MAPO.MONO;uid=steamware; pwd=Seriate_24068!; sslmode=None;"; } if (!optionsBuilder.IsConfigured) { @@ -162,6 +167,7 @@ namespace MP.MONO.Data relationship.DeleteBehavior = DeleteBehavior.Restrict; } + modelBuilder.Entity().ToView("v_ParetoStatus"); //modelBuilder.Entity(entity => //{ // entity.Property(e => e.ValStd) diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index bf7ea8e..e2d6c77 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2814 + 1.2.2303.2818 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index a3a793e..a543fac 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

              Version: 1.2.2303.2814

              +

              Version: 1.2.2303.2818


              Release Note:
              • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index d3460ae..95de523 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2814 +1.2.2303.2818 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 09a3af8..b392976 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2814 + 1.2.2303.2818 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index d7cbc60..5cc5fc5 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2814 + 1.2.2303.2818 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index a3a793e..a543fac 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                Version: 1.2.2303.2814

                +

                Version: 1.2.2303.2818


                Release Note:
                • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index d3460ae..95de523 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2814 +1.2.2303.2818 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index cfc126a..477403e 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2814 + 1.2.2303.2818 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 0e1607fc0e27d2fd92ff58b3c9a8478f3fb50f0f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 19:00:31 +0200 Subject: [PATCH 08/38] FIX gestione stored x pareto stati --- MP.MONO.DECODER/Program.cs | 6 ++++-- MP.MONO.Data/Controllers/MpDbController.cs | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 2de00b6..29c3369 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -497,8 +497,8 @@ bool setLastStatusVal(Dictionary dataList) void calcParetoStatus() { // ricalcolo ogni 60" +/- 3sec - int minPeriod = 57000; - int maxPeriod = 63000; + int minPeriod = 5700; + int maxPeriod = 6300; do { @@ -507,6 +507,8 @@ void calcParetoStatus() DateTime fine = DateTime.Today.AddDays(1); // recupero pareto da DB var newStatus = dbController.ParetoStatusMach(MachineId, inizio, fine); + // riordino... + newStatus = newStatus.OrderByDescending(x => x.TotDuration).ToList(); // serializzo e salvo string rawData = JsonConvert.SerializeObject(newStatus); mpStatusParetoSendPipe.saveAndSendMessage(Constants.STATUS_PARETO_KEY, rawData); diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 527091e..c82875e 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -2,6 +2,7 @@ using MP.MONO.Core.DTO; using MP.MONO.Data.DbModels; using MP.MONO.Data.DTO; +using MySqlConnector; using NLog; using System.Diagnostics; using static MP.MONO.Core.Enums; @@ -922,9 +923,12 @@ namespace MP.MONO.Data.Controllers { try { + var machId = new MySqlParameter("machine_id", MachineId); + var dtFrom = new MySqlParameter("dt_from",from); + var dtTo = new MySqlParameter("dt_to", to); dbResult = localDbCtx .DbSetParetoStatus - . OrderByDescending(x => x.TotDuration) + .FromSqlRaw("CALL stp_paretoStatus({0},{1},{2});", MachineId, from.ToString("yyyy-MM-dd"), to.ToString("yyyy-MM-dd")) .ToList(); } catch (Exception exc) From 27875043b86bd53b219bb6c8dc91ab1cb7dabe3e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 20:27:14 +0200 Subject: [PATCH 09/38] Aggiunto DTO x trasf dati status --- MP.MONO.Core/DTO/DisplayDataDTO.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MP.MONO.Core/DTO/DisplayDataDTO.cs b/MP.MONO.Core/DTO/DisplayDataDTO.cs index 36970f0..3d69c79 100644 --- a/MP.MONO.Core/DTO/DisplayDataDTO.cs +++ b/MP.MONO.Core/DTO/DisplayDataDTO.cs @@ -77,6 +77,10 @@ namespace MP.MONO.Core.DTO /// public string CssIcon { get; set; } = ""; /// + /// CSS Style + /// + public string CssClass { get; set; } = ""; + /// /// Sample period for DB recording of min/Avg/MAX data (seconds) /// public double SamplePeriod { get; set; } = 60 * 3; From 01c51fcb007539b824a6ec531576da3894dd7cf3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 20:27:26 +0200 Subject: [PATCH 10/38] Fix pareto status x calcolo % status --- MP.MONO.Data/Controllers/MpDbController.cs | 3 -- MP.MONO.Data/DTO/ParetoStatusDTO.cs | 60 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 MP.MONO.Data/DTO/ParetoStatusDTO.cs diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index c82875e..770d0f7 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -923,9 +923,6 @@ namespace MP.MONO.Data.Controllers { try { - var machId = new MySqlParameter("machine_id", MachineId); - var dtFrom = new MySqlParameter("dt_from",from); - var dtTo = new MySqlParameter("dt_to", to); dbResult = localDbCtx .DbSetParetoStatus .FromSqlRaw("CALL stp_paretoStatus({0},{1},{2});", MachineId, from.ToString("yyyy-MM-dd"), to.ToString("yyyy-MM-dd")) diff --git a/MP.MONO.Data/DTO/ParetoStatusDTO.cs b/MP.MONO.Data/DTO/ParetoStatusDTO.cs new file mode 100644 index 0000000..d29218b --- /dev/null +++ b/MP.MONO.Data/DTO/ParetoStatusDTO.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.MONO.Data.DTO +{ + public class ParetoStatusDTO + { + /// + /// UID + /// + [Key] + public string CodStatus { get; set; } = ""; + /// + /// Descrizione Stato + /// + public string Description { get; set; } = ""; + + /// + /// Livello di priorità (vince il maggiore) + /// + public int Prior { get; set; } = 1; + + /// + /// Classe css associata (default) + /// + public string CssClass { get; set; } = ""; + + /// + /// Classe css associata (override): se non vuota usa questa + /// + public string CssClassOvr { get; set; } = ""; + + /// + /// Gruppo di classificazione (default) + /// + public string Group { get; set; } = ""; + + /// + /// Gruppo di classificazione (override): se non vuoto usa questo + /// + public string GroupOvr { get; set; } = ""; + + /// + /// Indica se mostrare dettaglio item associato + /// + public bool ShowProdItem { get; set; } = true; + + /// + /// Durata totale stato + /// + public float TotDuration { get; set; } = 0; + } +} From bc1980e3885d48256d2b1f99b86edf44f3a252c5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 20:27:33 +0200 Subject: [PATCH 11/38] Refresh generale + install in SUM --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 77 +++++++++++++++++-- .../PublishProfiles/SingleApp.pubxml | 3 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Program.cs | 13 +++- .../PublishProfiles/SingleApp.pubxml | 1 + MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 20 files changed, 99 insertions(+), 27 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 3396623..28c838b 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2818 + 1.2.2303.2820 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index a543fac..b76bcda 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                  Version: 1.2.2303.2818

                  +

                  Version: 1.2.2303.2820


                  Release Note:
                  • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 95de523..422243c 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2818 +1.2.2303.2820 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 3129323..cfddc2c 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2818 + 1.2.2303.2820 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 4ee60f1..23a9716 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2818 + 1.2.2303.2820 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 29c3369..90b1323 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -1,16 +1,19 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; +using Microsoft.Extensions.Configuration; using MP.MONO.Core; using MP.MONO.Core.CONF; using MP.MONO.Core.DTO; using MP.MONO.Data; using MP.MONO.Data.Controllers; using MP.MONO.Data.DbModels; +using MP.MONO.Data.DTO; using MP.MONO.DECODER; using Newtonsoft.Json; using NLog; using Org.BouncyCastle.Asn1.Pkcs; using Pomelo.EntityFrameworkCore.MySql.Query.Internal; using StackExchange.Redis; +using System.Collections.Specialized; using System.Diagnostics; using System.Reflection; using static MP.MONO.Core.Enums; @@ -109,6 +112,7 @@ Random rand = new Random(); * Setup Thread periodici (es calcolo pareto stati) * ----------------------------------------------------------------*/ MessagePipe mpStatusParetoSendPipe = new MessagePipe(redisConn, Constants.STATUS_PAR_QUEUE); +MessagePipe mpStatsSendPipe = new MessagePipe(redisConn, Constants.MACH_STATS_M_QUEUE); Thread threadStatus = new Thread(calcParetoStatus); threadStatus.Start(); @@ -496,9 +500,9 @@ bool setLastStatusVal(Dictionary dataList) void calcParetoStatus() { - // ricalcolo ogni 60" +/- 3sec - int minPeriod = 5700; - int maxPeriod = 6300; + // ricalcolo ogni 30" +/- 2sec + int minPeriod = 28000; + int maxPeriod = 32000; do { @@ -507,17 +511,76 @@ void calcParetoStatus() DateTime fine = DateTime.Today.AddDays(1); // recupero pareto da DB var newStatus = dbController.ParetoStatusMach(MachineId, inizio, fine); - // riordino... - newStatus = newStatus.OrderByDescending(x => x.TotDuration).ToList(); + // riordino e aggiungo i dati di status... + var statusDTO = machineStatusConf + .Select(x => new ParetoStatusDTO() + { + CodStatus = $"MS_{x.MStatusID:000}", + CssClass = x.Css, + Description = x.Description, + Group = x.Group, + Prior = x.Priority + }) + .ToList(); + // ora ciclo tra i valori trovati... + foreach (var item in newStatus) + { + var recStatus = statusDTO.Where(x => x.CodStatus == item.CodStatus).FirstOrDefault(); + if (recStatus != null) + { + recStatus.TotDuration = item.TotDuration; + } + } + + // salvo i dati insieme alla traduzione degli stati relativa... + statusDTO = statusDTO + .Where(x => x.TotDuration > 0) + .OrderByDescending(x => x.TotDuration).ToList(); + // serializzo e salvo - string rawData = JsonConvert.SerializeObject(newStatus); + string rawData = JsonConvert.SerializeObject(statusDTO); mpStatusParetoSendPipe.saveAndSendMessage(Constants.STATUS_PARETO_KEY, rawData); + // calcolo Current:MachStats (OEE e status macchina...) + var currMStatDTO = getMachStatDTO(statusDTO); + if (currMStatDTO.Count > 0) + { + // serializzo e salvo + rawData = JsonConvert.SerializeObject(currMStatDTO); + mpStatsSendPipe.saveAndSendMessage(Constants.MACH_STATS_CURR_KEY, rawData); + } + // attesa random di circa 1 minuti x calcolare... Thread.Sleep(rand.Next(minPeriod, maxPeriod)); } while (true); } +List getMachStatDTO(List currStatus) +{ + List machStatList = new List(); + // calcolo OEE come % tempo RUN sul totale... + float globDur = currStatus.Sum(x => x.TotDuration); + int i = 0; + machStatList = currStatus + .Select(x => new DisplayDataDTO() + { + Order = i++, + Type = "TIME", + Title = $"{x.Group} | {x.Description}", + ValueNum = x.TotDuration / globDur, + Value = $"{x.TotDuration / globDur:P1}", + DisplFormat = "P1", + MinVal = 0, + MaxVal = 1, + IsNumeric = true, + EnablePlot = true, + ShowBar = true, + HLShow = true, + CssClass = x.CssClass + }) + .ToList(); + return machStatList; +} /// /// Gestione evento ricezione messaggi allarmi secondo tipologia attiva... diff --git a/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml b/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml index d7dbc65..9172df6 100644 --- a/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml +++ b/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml @@ -9,9 +9,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. bin\Release\net6.0\publish\win-x64\ FileSystem net6.0 - false + true win-x64 true true + Exe \ No newline at end of file diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index a543fac..b76bcda 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                    Version: 1.2.2303.2818

                    +

                    Version: 1.2.2303.2820


                    Release Note:
                    • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 95de523..422243c 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2818 +1.2.2303.2820 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 7bdb07b..b2aa89c 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2818 + 1.2.2303.2820 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index e2d6c77..c14f096 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2818 + 1.2.2303.2820 diff --git a/MP.MONO.SIM/Program.cs b/MP.MONO.SIM/Program.cs index 87a6e27..88a62be 100644 --- a/MP.MONO.SIM/Program.cs +++ b/MP.MONO.SIM/Program.cs @@ -81,22 +81,27 @@ Thread threadCount = new Thread(simCountersRaw); Thread threadAlarms = new Thread(simAlarms); Thread threadParams = new Thread(simParameters); Thread threadProd = new Thread(simProd); -Thread threadMacStats = new Thread(simMacStats); Thread threadMaint = new Thread(simMaint); Thread threadTools = new Thread(simTools); Thread threadEvHistory = new Thread(simEvents); Thread threadActLog = new Thread(simActivityLog); +#if false +Thread threadMacStats = new Thread(simMacStats); +#endif threadStatus.Start(); threadAlarms.Start(); threadParams.Start(); threadProd.Start(); threadCount.Start(); -threadMacStats.Start(); threadMaint.Start(); threadTools.Start(); threadEvHistory.Start(); threadActLog.Start(); +#if false +threadMacStats.Start(); +#endif + #if false /// @@ -642,6 +647,7 @@ void simProd() } +#if false void simMacStats() { int minPeriod = 3000; @@ -662,7 +668,8 @@ void simMacStats() Thread.Sleep(rand.Next(minPeriod, maxPeriod)); } while (true); } -} +} +#endif void simMaint() { diff --git a/MP.MONO.SIM/Properties/PublishProfiles/SingleApp.pubxml b/MP.MONO.SIM/Properties/PublishProfiles/SingleApp.pubxml index d7dbc65..8836074 100644 --- a/MP.MONO.SIM/Properties/PublishProfiles/SingleApp.pubxml +++ b/MP.MONO.SIM/Properties/PublishProfiles/SingleApp.pubxml @@ -8,6 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Any CPU bin\Release\net6.0\publish\win-x64\ FileSystem + <_TargetId>Folder net6.0 false win-x64 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index a543fac..b76bcda 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                      Version: 1.2.2303.2818

                      +

                      Version: 1.2.2303.2820


                      Release Note:
                      • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 95de523..422243c 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2818 +1.2.2303.2820 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index b392976..f98064b 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2818 + 1.2.2303.2820 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 5cc5fc5..6dd5475 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2818 + 1.2.2303.2820 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index a543fac..b76bcda 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                        Version: 1.2.2303.2818

                        +

                        Version: 1.2.2303.2820


                        Release Note:
                        • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 95de523..422243c 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2818 +1.2.2303.2820 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 477403e..4d78ca7 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2818 + 1.2.2303.2820 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 59f38fe228b44988ae4790d50da200509d15461c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 28 Mar 2023 20:54:33 +0200 Subject: [PATCH 12/38] Fix display prod data con barre --- MP.MONO.DECODER/Program.cs | 2 +- MP.MONO.UI/Components/MachStatsOverview.razor | 35 +++++++++++++++++-- .../Components/MachStatsOverview.razor.cs | 20 +++++++++-- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 90b1323..1c8b24e 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -575,7 +575,7 @@ List getMachStatDTO(List currStatus) IsNumeric = true, EnablePlot = true, ShowBar = true, - HLShow = true, + HLShow = x.TotDuration > (globDur * 0.01), CssClass = x.CssClass }) .ToList(); diff --git a/MP.MONO.UI/Components/MachStatsOverview.razor b/MP.MONO.UI/Components/MachStatsOverview.razor index 2e44d79..ec61eae 100644 --- a/MP.MONO.UI/Components/MachStatsOverview.razor +++ b/MP.MONO.UI/Components/MachStatsOverview.razor @@ -11,10 +11,41 @@ {
                        • -
                          @item.Title
                          -
                          @item.Value
                          + @if (!string.IsNullOrEmpty(item.CssIcon)) + { +
                          +
                          @item.Title
                          +
                          + } + else + { +
                          @item.Title
                          + }
                          +
                          +
                          +
                          +
                          + +
                          +   +
                          + @item.Value +
                          +
                          +
                          +
                          +
                          +
                          + @if (item.ShowBar) + { +
                          +
                          +
                          +
                          +
                          + }
                        • } diff --git a/MP.MONO.UI/Components/MachStatsOverview.razor.cs b/MP.MONO.UI/Components/MachStatsOverview.razor.cs index e62557a..360bf3b 100644 --- a/MP.MONO.UI/Components/MachStatsOverview.razor.cs +++ b/MP.MONO.UI/Components/MachStatsOverview.razor.cs @@ -17,15 +17,30 @@ namespace MP.MONO.UI.Components #region Protected Methods + protected string cssBar(string cssClass) + { + return cssClass; + } + protected override async Task OnInitializedAsync() { await ReloadData(); MMDataService.machStatsPipe.EA_NewMessage += MachStatsPipe_EA_NewMessage; } + protected string percProgress(double num, double minVal, double maxVal) + { + string answ = "width: 0%;"; + double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1; + double ratio = ((double)num) / den; + answ = $"width: {ratio:P0};"; + return answ; + } + protected async Task ReloadData() { - ListRecords = await MMDataService.getStats(); + var rawData = await MMDataService.getStats(); + ListRecords = rawData.Where(x => x.HLShow).ToList(); } #endregion Protected Methods @@ -45,7 +60,8 @@ namespace MP.MONO.UI.Components { try { - ListRecords = JsonConvert.DeserializeObject>(currArgs.newMessage); + var rawData = JsonConvert.DeserializeObject>(currArgs.newMessage); + ListRecords = rawData.Where(x => x.HLShow).ToList(); } catch { } From 72951058ed7f6bbd5014a8499c5003bad22fdd60 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 11:02:51 +0200 Subject: [PATCH 13/38] Fix visualizzazione prod e stats tempi --- .../PublishProfiles/SingleAppManual.pubxml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 MP.MONO.SIM/Properties/PublishProfiles/SingleAppManual.pubxml diff --git a/MP.MONO.SIM/Properties/PublishProfiles/SingleAppManual.pubxml b/MP.MONO.SIM/Properties/PublishProfiles/SingleAppManual.pubxml new file mode 100644 index 0000000..1794b80 --- /dev/null +++ b/MP.MONO.SIM/Properties/PublishProfiles/SingleAppManual.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\Release\net6.0-publish\ + FileSystem + <_TargetId>Folder + net6.0 + false + win-x64 + true + true + + \ No newline at end of file From 71b338077eb8ce5238ccf471345faa42a78c5614 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 11:02:55 +0200 Subject: [PATCH 14/38] refresh UI --- MP.MONO.ADAPTER.OPC/CONF/MPStatus.json | 14 +- MP.MONO.ADAPTER.OPC/CONF/Multiax.json | 8 +- MP.MONO.ADAPTER.OPC/Program.cs | 1 + MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 79 +++++++--- .../PublishProfiles/SingleApp.pubxml | 2 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Program.cs | 90 ++++-------- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.SIM/Simulator.cs | 136 ++++++++---------- MP.MONO.SIM/conf/MPStatus.json | 14 +- MP.MONO.SIM/conf/SimMachStat.json | 1 + .../Components/MachStatsOverview.razor.cs | 11 +- MP.MONO.UI/Components/ProdOverview.razor | 63 ++++---- MP.MONO.UI/Conf/lic.file | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Pages/Index.razor | 1 + MP.MONO.UI/Pages/Production.razor | 14 +- MP.MONO.UI/Pages/Production.razor.cs | 24 ++++ MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 31 files changed, 279 insertions(+), 213 deletions(-) create mode 100644 MP.MONO.UI/Pages/Production.razor.cs diff --git a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json index e879939..255668a 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json +++ b/MP.MONO.ADAPTER.OPC/CONF/MPStatus.json @@ -45,7 +45,7 @@ "MinVal": 0, "MaxVal": 10, "DisplFormat": "N0", - "IsNumeric": true + "IsNumeric": false }, { "Order": 5, @@ -94,5 +94,17 @@ "MaxVal": 10, "DisplFormat": "N0", "IsNumeric": true + }, + { + "Order": 9, + "ExtCode": "ns=1;s=504_PROC 1 P.P. ORDER", + "Type": "ORDER", + "Title": "CURR ORDER", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": false } ] \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/CONF/Multiax.json b/MP.MONO.ADAPTER.OPC/CONF/Multiax.json index 9b24df7..5cd4cef 100644 --- a/MP.MONO.ADAPTER.OPC/CONF/Multiax.json +++ b/MP.MONO.ADAPTER.OPC/CONF/Multiax.json @@ -8,7 +8,7 @@ "BrowseValue": 0, "keyPartCount": "1:507_2_WORKPIECE QTY", "keyPartReq": "", - "keyPartId": "", + "keyPartId": "1:504_PROC 1 P.P. ORDER", "keyProgName": "1:502_1_RECIPE NAME", "keyRunMode": "", "pingAsPowerOn": true, @@ -166,6 +166,10 @@ "ns=1;s=502_1_RECIPE NAME", "ns=1;s=507_1_WORKPIECE TIME", "ns=1;s=507_2_WORKPIECE QTY", - "ns=1;s=507_3_CYCLE TIME" + "ns=1;s=507_3_CYCLE TIME", + "ns=1;s=504_PROC 1 P.P. ORDER", + "ns=1;s=505_PROC 1 P.P. PROCESSING", + "ns=1;s=506_PROC 1 P.P. PROCESSING PHASE", + "ns=1;s=503_PROC 1 P.P. EXECUTION TIME [HH:MM:SS]" ] } \ No newline at end of file diff --git a/MP.MONO.ADAPTER.OPC/Program.cs b/MP.MONO.ADAPTER.OPC/Program.cs index e00c306..0ecc0d2 100644 --- a/MP.MONO.ADAPTER.OPC/Program.cs +++ b/MP.MONO.ADAPTER.OPC/Program.cs @@ -29,6 +29,7 @@ namespace MP.MONO.ADAPTER.OPC ///
                      public static async Task Main(string[] args) { + await Task.Delay(1); TextWriter output = Console.Out; output.WriteLine(lineSep); output.WriteLine("Egalware | MP.MONO.ADAPTER | OPC UA Console Client"); diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 28c838b..fce0404 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2820 + 1.2.2303.2910 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index b76bcda..52bee72 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                      Version: 1.2.2303.2820

                      +

                      Version: 1.2.2303.2910


                      Release Note:
                      • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 422243c..5a933c0 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2820 +1.2.2303.2910 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index cfddc2c..232ded0 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2820 + 1.2.2303.2910 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 23a9716..4e1a099 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2820 + 1.2.2303.2910 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 1c8b24e..10041ef 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -134,6 +134,7 @@ counterRecvPipe.EA_NewMessage += CounterRecvPipe_EA_NewMessage; MPStatusManager mpStatusMan = new MPStatusManager(); // inizializzo gestione messagePipe da Redis x allarmi MessagePipe mpStatusSendPipe = new MessagePipe(redisConn, Constants.STATUS_M_QUEUE); +MessagePipe mpProdSendPipe = new MessagePipe(redisConn, Constants.PROD_M_QUEUE); MessagePipe mpStatusRecvPipe = new MessagePipe(redisConn, Constants.STATUS_RAW_QUEUE); // datetime dell'inizio esecuzione task... x usare un semaforo di veto doppia esecuzione entro 30 sec DateTime lastExecStatus = DateTime.Now.AddHours(-1); @@ -457,6 +458,23 @@ MachineDTO getLastMachinePlate() return currMPlate; } +/// +/// Ultimo ProdDTO salvato +/// +ProductionDTO getCurrProdData() +{ + ProductionDTO? currProdData = new ProductionDTO(); + string rawData = redisDb.StringGet(Constants.PROD_CURR_KEY); + if (!string.IsNullOrEmpty(rawData)) + { + currProdData = JsonConvert.DeserializeObject(rawData); + } + if (currProdData == null) + { + currProdData = new ProductionDTO(); + } + return currProdData; +} /// /// Stato precedentemente salvato su REDIS x calcolo variazioni @@ -1289,27 +1307,27 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) parList.Add(currKey, procMode); } - bool useLua = true; + // effettuo verifica valori production e relativo invio + checkProduction(dataList); + // fix me todo inserire gestione program name!!! Stopwatch sw = new Stopwatch(); sw.Start(); - if (useLua) - { - // calcolo con LUA e vedo se cambia... - sw.Restart(); - nextMachinePlate = mpStatusMan.processData(parList, lastMachinePlate); - sw.Stop(); - if (adesso.Subtract(lastLogDetail).TotalSeconds > 5 || numSendMStatus > 10) - { - Log.Info($"Calcolo LUA | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(nextMachinePlate)} | x {numSendMStatus}"); - lastLogDetail = adesso; - numSendMStatus = 0; - } - else - { - numSendMStatus++; - } + // calcolo con LUA... + sw.Restart(); + nextMachinePlate = mpStatusMan.processData(parList, lastMachinePlate); + sw.Stop(); + + if (adesso.Subtract(lastLogDetail).TotalSeconds > 5 || numSendMStatus > 10) + { + Log.Info($"Calcolo LUA | {sw.ElapsedTicks} ticks | {sw.ElapsedMilliseconds} ms | {JsonConvert.SerializeObject(nextMachinePlate)} | x {numSendMStatus}"); + lastLogDetail = adesso; + numSendMStatus = 0; + } + else + { + numSendMStatus++; } #if false else @@ -1459,6 +1477,33 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) } }; +void checkProduction(Dictionary dataList) +{ + if(dataList.Count>0) + { + var currProdDTO = getCurrProdData(); + string currKey = "RECIPE NAME"; + if (dataList.ContainsKey(currKey)) + { + currProdDTO.ProgName = dataList[currKey]; + } + currKey = "PART COUNT"; + if (dataList.ContainsKey(currKey)) + { + int numPz = 0; + int.TryParse(dataList[currKey], out numPz); + currProdDTO.CurrQty = numPz; + } + currKey = "CURR ORDER"; + if (dataList.ContainsKey(currKey)) + { + currProdDTO.Order = dataList[currKey]; + } + string rawData = JsonConvert.SerializeObject(currProdDTO); + mpProdSendPipe.saveAndSendMessage(Constants.PROD_CURR_KEY, rawData); + } +} + /// /// Gestione evento ricezione messaggi status x conteggi... /// diff --git a/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml b/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml index 9172df6..17ee16f 100644 --- a/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml +++ b/MP.MONO.DECODER/Properties/PublishProfiles/SingleApp.pubxml @@ -9,7 +9,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. bin\Release\net6.0\publish\win-x64\ FileSystem net6.0 - true + false win-x64 true true diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index b76bcda..52bee72 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                        Version: 1.2.2303.2820

                        +

                        Version: 1.2.2303.2910


                        Release Note:
                        • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 422243c..5a933c0 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2820 +1.2.2303.2910 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index b2aa89c..6252bb3 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2820 + 1.2.2303.2910 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index c14f096..c6bf7bc 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2820 + 1.2.2303.2910 diff --git a/MP.MONO.SIM/Program.cs b/MP.MONO.SIM/Program.cs index 88a62be..acff0d3 100644 --- a/MP.MONO.SIM/Program.cs +++ b/MP.MONO.SIM/Program.cs @@ -80,42 +80,25 @@ Thread threadStatus = new Thread(simMPStatus); Thread threadCount = new Thread(simCountersRaw); Thread threadAlarms = new Thread(simAlarms); Thread threadParams = new Thread(simParameters); -Thread threadProd = new Thread(simProd); +#if false +Thread threadProd = new Thread(simProd); +#endif Thread threadMaint = new Thread(simMaint); Thread threadTools = new Thread(simTools); Thread threadEvHistory = new Thread(simEvents); Thread threadActLog = new Thread(simActivityLog); -#if false -Thread threadMacStats = new Thread(simMacStats); -#endif threadStatus.Start(); threadAlarms.Start(); threadParams.Start(); -threadProd.Start(); +#if false +threadProd.Start(); +#endif threadCount.Start(); threadMaint.Start(); threadTools.Start(); threadEvHistory.Start(); threadActLog.Start(); -#if false -threadMacStats.Start(); -#endif - -#if false - -/// -/// verifica esistenza file oppure lo crea... -/// -void checkFilePresent(string filePath) -{ - // verific presenza file log... - if (!File.Exists(filePath)) - { - File.WriteAllText(filePath, $"{filePath} created!"); - } -} -#endif /// /// Setup e salvataggio redis delle conf (es modi/stati) @@ -141,8 +124,6 @@ void setupConf() alarmMode = config.GetValue("OptPar:AlarmMode"); redisDb.StringSetAsync(Constants.ALARMS_MODE_KEY, JsonConvert.SerializeObject(alarmMode)); - - ConfigManager configManager = new ConfigManager(redisConf, confPath); if (alarmMode == AlarmReportingMode.RawList) { @@ -215,9 +196,12 @@ void saveAndSendMessage(string memKey, string notifyChannel, string message) } if (doSave) { - redisDb.StringSetAsync(memKey, message); - LastKeySave[memKey] = DateTime.Now; - logInfo($"Redis Cache Key: {memKey}"); + if (redisDb != null) + { + redisDb.StringSetAsync(memKey, message); + LastKeySave[memKey] = DateTime.Now; + logInfo($"Redis Cache Key: {memKey}"); + } } // invio notifica tramite il canale richiesto @@ -305,14 +289,11 @@ void simAlarms() { DateTime lastOk = DateTime.Now; DateTime lastAlarm = DateTime.Now.AddMilliseconds(-1); -#if false - int stdPeriod = 1000; -#endif /* Modalità simulazione blink... * - verifico da quanto non ho allarmi * - se supero soglia minima ok --> simulo allarme o interruzione (alternati) - * - vado in simulazione inizio/fine per le interruzioni (brevi) + * - vado in simulazione inizio/fine per le interruzioni (brevi) * - vado in simulazione inizio/fine per gli allarmi (che dovranno sparire e tornare ogni 10 sec) */ // Dict allarmi attivi (e da quando) @@ -337,7 +318,8 @@ void simAlarms() // ciclo x aggiungere il numero di allarmi indicato for (int i = 0; i < numNew; i++) { - // seleziono uno degli allarmi del banco.. dando + peso agli "allarmi bassi" + // seleziono uno degli allarmi del banco.. dando + peso agli + // "allarmi bassi" int alarmIndex = 0; int msgBlock = rand.Next(1, 5); switch (msgBlock) @@ -345,12 +327,15 @@ void simAlarms() case 1: alarmIndex = rand.Next(0, alarmGroup.messages.Count / 4); break; + case 2: alarmIndex = rand.Next(0, alarmGroup.messages.Count / 2); break; + case 3: alarmIndex = rand.Next(0, alarmGroup.messages.Count * 3 / 4); break; + case 4: default: alarmIndex = rand.Next(0, alarmGroup.messages.Count); @@ -405,8 +390,7 @@ void simAlarms() sendActiveAlarm(currAlarm); } - - // CICLO 03: aspetto periodo blink... + // CICLO 03: aspetto periodo blink... Thread.Sleep(rand.Next(800 * perRefresh, 1000 * perRefresh)); // tolgo tutti ed invio currAlarm = new Dictionary(); @@ -477,7 +461,8 @@ void simAlarms() // verifico situazione allarmi già presenti foreach (var singleAlarm in CurrActiveAlarm) { - // 1: seleziono allarmi se ce ne fossero e la loro durata è <= limite * rand (50-200) x rimetterli in elenco + // 1: seleziono allarmi se ce ne fossero e la loro durata è <= limite * rand + // (50-200) x rimetterli in elenco if (adesso.Subtract(singleAlarm.Value).TotalSeconds < MaxDurationAllarmi * ((double)rand.Next(50, 200) / 100)) { NewActiveAlarm.Add(singleAlarm.Key, singleAlarm.Value); @@ -494,7 +479,8 @@ void simAlarms() // ciclo x aggiungere il numero di allarmi indicato for (int i = 0; i < numNew; i++) { - // seleziono uno degli allarmi del banco.. dando + peso agli "allarmi bassi" + // seleziono uno degli allarmi del banco.. dando + peso agli + // "allarmi bassi" int alarmIndex = 0; int msgBlock = rand.Next(1, 5); switch (msgBlock) @@ -502,12 +488,15 @@ void simAlarms() case 1: alarmIndex = rand.Next(0, alarmGroup.messages.Count / 4); break; + case 2: alarmIndex = rand.Next(0, alarmGroup.messages.Count / 2); break; + case 3: alarmIndex = rand.Next(0, alarmGroup.messages.Count * 3 / 4); break; + case 4: default: alarmIndex = rand.Next(0, alarmGroup.messages.Count); @@ -625,6 +614,7 @@ void simCountersRaw() } } +#if false void simProd() { int minPeriod = 3000; @@ -640,30 +630,6 @@ void simProd() string rawData = JsonConvert.SerializeObject(newStatus); saveAndSendMessage(Constants.PROD_CURR_KEY, Constants.PROD_M_QUEUE, rawData); - // attesa random - Thread.Sleep(rand.Next(minPeriod, maxPeriod)); - } while (true); - } -} - - -#if false -void simMacStats() -{ - int minPeriod = 3000; - int maxPeriod = 5000; - - - // controllo se devo fare (se ho valori da simulare...) - if (currSimGen.currSimMachStat.Count > 0) - { - do - { - // recupero uno stato simulato - var newVal = currSimGen.getMacStats(); - string rawData = JsonConvert.SerializeObject(newVal); - saveAndSendMessage(Constants.MACH_STATS_CURR_KEY, Constants.MACH_STATS_M_QUEUE, rawData); - // attesa random Thread.Sleep(rand.Next(minPeriod, maxPeriod)); } while (true); @@ -676,7 +642,6 @@ void simMaint() int minPeriod = 10000; int maxPeriod = 20000; - // controllo se devo fare (se ho valori da simulare...) if (currSimGen.currSimMaint.Count > 0) { @@ -698,7 +663,6 @@ void simTools() int minPeriod = 30000; int maxPeriod = 120000; - // controllo se devo fare (se ho valori da simulare...) if (currSimGen.currSimTools.Count > 0) { diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index b76bcda..52bee72 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                          Version: 1.2.2303.2820

                          +

                          Version: 1.2.2303.2910


                          Release Note:
                          • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 422243c..5a933c0 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2820 +1.2.2303.2910 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index f98064b..53a6bae 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2820 + 1.2.2303.2910 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/Simulator.cs b/MP.MONO.SIM/Simulator.cs index 17b68c3..91d7a01 100644 --- a/MP.MONO.SIM/Simulator.cs +++ b/MP.MONO.SIM/Simulator.cs @@ -275,68 +275,16 @@ namespace MachineSim return currMachDto; } -#if false - public List getProdStats() - { - List answ = new List(); - - // genero a partire dall'elenco configurato da simulare... - answ = currSimMachStat.Select(i => new DisplayDataDTO() - { - IsNumeric = i.IsNumeric, - MaxVal = i.MaxVal, - MinVal = i.MinVal, - Order = i.Order, - Title = i.Title, - Type = i.Type, - ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd), - DisplFormat = i.DisplFormat - //Value = $"{getNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd):N3}", - }).ToList(); - - foreach (var item in answ) - { - item.Value = $"{item.ValueNum.ToString(item.DisplFormat)}"; - } - - return answ; - } -#endif - - /// - /// Discretizza valore sim pallet tra 0..1..2 dati valori limite - /// - /// - /// - /// - /// - protected int discretizePalletVal(int simVal, int lim_1, int lim_2) - { - int answ = 0; - if (simVal <= lim_1) - { - answ = 0; - } - else if (simVal <= (lim_1 + lim_2)) - { - answ = 1; - } - else - { - answ = 2; - } - return answ; - } - /// /// Restituisce elenco info stato Macchina simulato come lista da adapter /// /// public Dictionary getStatus() { + DateTime adesso = DateTime.Now; Dictionary answ = new Dictionary(); - // simulo stato macchina ad 1 nel 99.5% (0 nel 0.5% dei casi) - if (rand.Next(0, 1000) < 995) + // simulo stato macchina ad 1 nel 95% (0 nel 5% dei casi) + if (rand.Next(0, 1000) < 950) { answ.Add("MACHINE STATUS", "1"); } @@ -346,17 +294,15 @@ namespace MachineSim } // part count sono i minuti del giorno... - int simCount = (int)DateTime.Now.Subtract(DateTime.Today).TotalMinutes; + int simCount = (int)adesso.Subtract(DateTime.Today).TotalMinutes; answ.Add("PART COUNT", $"{simCount}"); - - // simulo stato processo in ciclo 90% dei casi, resto HOLD if (rand.Next(0, 1000) < 900) { answ.Add("PROCESS STATUS", "2"); - // simulo modo auto 90% dei casi - if (rand.Next(0, 1000) < 900) + // simulo modo auto 85% dei casi + if (rand.Next(0, 1000) < 850) { answ.Add("PROCESS MODE", "2"); } @@ -388,10 +334,16 @@ namespace MachineSim pVal = discretizePalletVal(rand.Next(0, 1000), 80, 890); answ.Add("P3 EXTERNAL PALLET STATUS", $"{pVal}"); - // aggiunta part program che cambia ogni minuto... - answ.Add("RECIPE NAME", $"{DateTime.Now:yyMMdd-HHmm}.prg"); + // aggiunta part program che cambia ogni 10 minuti... + int minRound = (adesso.Minute / 10) * 10; + answ.Add("RECIPE NAME", $"{adesso:yyMMdd-HH}{minRound:00}.prg"); + + // aggiunta ordine... orario + answ.Add("CURR ORDER", $"ODL000{adesso:MMddHH}"); + return answ; } + /// /// Simulo dati in formato DTO (già finale) /// @@ -431,6 +383,7 @@ namespace MachineSim return answ; } + /// /// Mostro un valore in formato chiave/valore (stringa/double) /// @@ -445,27 +398,17 @@ namespace MachineSim return answ; } - /// - /// Calcola prox valore simulato dati i parametri rand configurati, con innovazione - /// stocastica + deterministica: + /// Calcola prox valore simulato dati i parametri rand configurati, con + /// innovazione stocastica + deterministica: /// - ciclo ogni 4 minuti - con operazione modulo (4) /// * 0 fermo /// * 1 --> sale /// * 2 fermo - /// * 3 --> scende - /// - /// - /// - /// - /// - /// - /// Modalità simulazione (1-3) - /// 1 = std, RandomWalk + trend periodico con memoria - /// 2 = boolean - /// 3 = trend secondo valore mean (crescente se >0, decrescente se <0) - /// - /// - /// + /// * 3 --> scende Modalità simulazione (1-3) 1 = std, + /// RandomWalk + trend periodico con memoria 2 = boolean 3 = trend secondo valore mean + /// (crescente se >0, decrescente se <0) public double simNext(double CurrVal, double MinVal, double MaxVal, double sMean, double sStd, int simMode = 1, double trueRatio = 0.5) { double innov = 0; @@ -476,6 +419,7 @@ namespace MachineSim case 2: CurrVal = rand.Next(10000) <= trueRatio * 10000 ? 1 : 0; break; + case 3: innov = Normal.Sample(sMean, sStd); trend = rand.NextDouble() * 2 * sMean; @@ -490,6 +434,7 @@ namespace MachineSim CurrVal = CurrVal > MaxVal ? MinVal : CurrVal; CurrVal = CurrVal < MinVal ? MaxVal : CurrVal; break; + case 1: default: // innovazione stocastica di base @@ -529,6 +474,7 @@ namespace MachineSim #region Protected Fields protected string confPath = ""; + protected Random rand = new Random(); #endregion Protected Fields @@ -536,12 +482,44 @@ namespace MachineSim #region Protected Properties protected IConfigurationRoot appConf { get; set; } = null!; + protected int numMode { get; set; } = 1; + protected int numStatus { get; set; } = 1; + protected IDatabase redisDb { get; set; } = null!; #endregion Protected Properties + #region Protected Methods + + /// + /// Discretizza valore sim pallet tra 0..1..2 dati valori limite + /// + /// + /// + /// + /// + protected int discretizePalletVal(int simVal, int lim_1, int lim_2) + { + int answ = 0; + if (simVal <= lim_1) + { + answ = 0; + } + else if (simVal <= (lim_1 + lim_2)) + { + answ = 1; + } + else + { + answ = 2; + } + return answ; + } + + #endregion Protected Methods + #region Private Methods private void setupConfDTO(string paramFileName, ref List localObj) diff --git a/MP.MONO.SIM/conf/MPStatus.json b/MP.MONO.SIM/conf/MPStatus.json index e879939..255668a 100644 --- a/MP.MONO.SIM/conf/MPStatus.json +++ b/MP.MONO.SIM/conf/MPStatus.json @@ -45,7 +45,7 @@ "MinVal": 0, "MaxVal": 10, "DisplFormat": "N0", - "IsNumeric": true + "IsNumeric": false }, { "Order": 5, @@ -94,5 +94,17 @@ "MaxVal": 10, "DisplFormat": "N0", "IsNumeric": true + }, + { + "Order": 9, + "ExtCode": "ns=1;s=504_PROC 1 P.P. ORDER", + "Type": "ORDER", + "Title": "CURR ORDER", + "Value": "", + "ValueNum": 0, + "MinVal": 0, + "MaxVal": 10, + "DisplFormat": "N0", + "IsNumeric": false } ] \ No newline at end of file diff --git a/MP.MONO.SIM/conf/SimMachStat.json b/MP.MONO.SIM/conf/SimMachStat.json index 691b8f6..f7d84a9 100644 --- a/MP.MONO.SIM/conf/SimMachStat.json +++ b/MP.MONO.SIM/conf/SimMachStat.json @@ -4,6 +4,7 @@ "PROCESS STATUS", "PROCESS MODE", "RECIPE NAME", + "CURR ORDER", "P2 PALLET STATUS", "P3 PALLET STATUS", "P2 EXTERNAL PALLET STATUS", diff --git a/MP.MONO.UI/Components/MachStatsOverview.razor.cs b/MP.MONO.UI/Components/MachStatsOverview.razor.cs index 360bf3b..92566ef 100644 --- a/MP.MONO.UI/Components/MachStatsOverview.razor.cs +++ b/MP.MONO.UI/Components/MachStatsOverview.razor.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Components; using MP.MONO.Core.DTO; using MP.MONO.Data; using Newtonsoft.Json; @@ -6,6 +7,9 @@ namespace MP.MONO.UI.Components { public partial class MachStatsOverview : IDisposable { + [Parameter] + public bool ShowAll { get; set; } = false; + #region Public Methods public void Dispose() @@ -40,7 +44,7 @@ namespace MP.MONO.UI.Components protected async Task ReloadData() { var rawData = await MMDataService.getStats(); - ListRecords = rawData.Where(x => x.HLShow).ToList(); + ListRecords = rawData.Where(x => x.HLShow || ShowAll).ToList(); } #endregion Protected Methods @@ -61,7 +65,10 @@ namespace MP.MONO.UI.Components try { var rawData = JsonConvert.DeserializeObject>(currArgs.newMessage); - ListRecords = rawData.Where(x => x.HLShow).ToList(); + if (rawData != null) + { + ListRecords = rawData.Where(x => x.HLShow || ShowAll).ToList(); + } } catch { } diff --git a/MP.MONO.UI/Components/ProdOverview.razor b/MP.MONO.UI/Components/ProdOverview.razor index 01a713a..d91a387 100644 --- a/MP.MONO.UI/Components/ProdOverview.razor +++ b/MP.MONO.UI/Components/ProdOverview.razor @@ -27,36 +27,45 @@
                          • -
                          • -
                            -
                            - + @if (!string.IsNullOrEmpty(@currProd.ItemCode)) + { +
                          • +
                            +
                            + +
                            +
                            +
                            @currProd.ItemCode
                            +
                            -
                            -
                            @currProd.ItemCode
                            +
                          • + } + @if (@currProd.CycleTime.TotalMinutes > 0) + { +
                          • +
                            +
                            +
                            + @($"{currProd.CycleTime.Hours:00}:{currProd.CycleTime.Minutes:00}:{currProd.CycleTime.Seconds:00}") +
                            - -
                          • -
                          • -
                            -
                            -
                            - @($"{currProd.CycleTime.Hours:00}:{currProd.CycleTime.Minutes:00}:{currProd.CycleTime.Seconds:00}") +
                          • + } + @if (!string.IsNullOrEmpty(@currProd.ProgName)) + { +
                          • +
                            +
                            +
                            @currProd.ProgName
                            - -
                          • -
                          • -
                            -
                            -
                            @currProd.ProgName
                            -
                            - @if (!string.IsNullOrEmpty(currProd.Message)) - { -
                            - @currProd.Message -
                            - } -
                          • + @if (!string.IsNullOrEmpty(currProd.Message)) + { +
                            + @currProd.Message +
                            + } + + }
                          } diff --git a/MP.MONO.UI/Conf/lic.file b/MP.MONO.UI/Conf/lic.file index 69f59a3..9540e9d 100644 --- a/MP.MONO.UI/Conf/lic.file +++ b/MP.MONO.UI/Conf/lic.file @@ -1 +1 @@ -467e4b24bc3fe9d237169aa274ae589b64f072fb1cd91f4d79aaee76c64afbfced7fb51536b62cf612dedfb304202a1e653778b7cc8c758f83bb058984460301 \ No newline at end of file +31e9cc1c2e8f30a1b4098cb157d712f11f3f2e60fb74169a354c3fa646d6d0e28518b4e3139f844b25824fbcc4340051fc507d22c1c2d2786d3786c777c31cc3 \ No newline at end of file diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 6dd5475..680127c 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2820 + 1.2.2303.2910 diff --git a/MP.MONO.UI/Pages/Index.razor b/MP.MONO.UI/Pages/Index.razor index 534dbf8..11d0304 100644 --- a/MP.MONO.UI/Pages/Index.razor +++ b/MP.MONO.UI/Pages/Index.razor @@ -24,6 +24,7 @@
                          PRODUCTION
                          +
                          diff --git a/MP.MONO.UI/Pages/Production.razor b/MP.MONO.UI/Pages/Production.razor index 2c4b04d..699e10d 100644 --- a/MP.MONO.UI/Pages/Production.razor +++ b/MP.MONO.UI/Pages/Production.razor @@ -1,6 +1,16 @@ @page "/Production"
                          +
                          +
                          +
                          +
                          Machine State
                          +
                          +
                          + +
                          +
                          +
                          @@ -11,10 +21,8 @@
                          -
                          +
                          -@code { -} diff --git a/MP.MONO.UI/Pages/Production.razor.cs b/MP.MONO.UI/Pages/Production.razor.cs new file mode 100644 index 0000000..a0806f8 --- /dev/null +++ b/MP.MONO.UI/Pages/Production.razor.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.MONO.UI; +using MP.MONO.UI.Shared; +using MP.MONO.UI.Components; +using EgwCoreLib.Razor; + +namespace MP.MONO.UI.Pages +{ + public partial class Production + { + } +} \ No newline at end of file diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index b76bcda..52bee72 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                          Version: 1.2.2303.2820

                          +

                          Version: 1.2.2303.2910


                          Release Note:
                          • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 422243c..5a933c0 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2820 +1.2.2303.2910 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 4d78ca7..be822a0 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2820 + 1.2.2303.2910 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 49c22b57ade5f5d733c4c5e94f638d15758d303a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 17:48:07 +0200 Subject: [PATCH 15/38] Update pubblicazione IIS04 --- .../SingleAppDebugManual.pubxml | 17 +++++++++++ .../Properties/PublishProfiles/IIS04.pubxml | 28 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 MP.MONO.DECODER/Properties/PublishProfiles/SingleAppDebugManual.pubxml create mode 100644 MP.MONO.UI/Properties/PublishProfiles/IIS04.pubxml diff --git a/MP.MONO.DECODER/Properties/PublishProfiles/SingleAppDebugManual.pubxml b/MP.MONO.DECODER/Properties/PublishProfiles/SingleAppDebugManual.pubxml new file mode 100644 index 0000000..1d7663e --- /dev/null +++ b/MP.MONO.DECODER/Properties/PublishProfiles/SingleAppDebugManual.pubxml @@ -0,0 +1,17 @@ + + + + + Debug + Any CPU + bin\Debug\net6.0-publish\ + FileSystem + net6.0 + false + win-x64 + true + true + + \ No newline at end of file diff --git a/MP.MONO.UI/Properties/PublishProfiles/IIS04.pubxml b/MP.MONO.UI/Properties/PublishProfiles/IIS04.pubxml new file mode 100644 index 0000000..d7598c4 --- /dev/null +++ b/MP.MONO.UI/Properties/PublishProfiles/IIS04.pubxml @@ -0,0 +1,28 @@ + + + + + MSDeploy + true + Release + Any CPU + + + false + 6fb65850-c023-4986-9dff-770c4e582d60 + false + https://iis04.egalware.com:8172/MsDeploy.axd + Default Web Site/MP/MONO + + true + WMSVC + true + true + jenkins + <_SavePWD>true + net6.0 + + \ No newline at end of file From 115a9c3cc3440389a2f532d12480d75452d1b86b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 17:48:44 +0200 Subject: [PATCH 16/38] DATA: - Update conf sqlScripts - migration x TaskExec - views/stored creation (maybe) --- .gitlab-ci.yml | 6 +- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 33 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/appsettings.json | 3 +- MP.MONO.Data/Controllers/MpDbController.cs | 27 + MP.MONO.Data/DbConfig.cs | 6 - MP.MONO.Data/DbModels/TaskExecModel.cs | 42 + MP.MONO.Data/MP.MONO.Data.csproj | 12 + MP.MONO.Data/MapoMonoContext.cs | 12 +- .../20230329152217_TaskExecTable.Designer.cs | 1773 +++++++++++++++++ .../20230329152217_TaskExecTable.cs | 72 + .../MapoMonoContextModelSnapshot.cs | 35 + .../ManualFeed}/Multiax_MaintTableSetup.sql | 0 .../Stored/stp_paretoStatus.sql} | 14 +- .../SqlScripts/Stored/stp_removeOldData.sql | 62 + .../View/v_ParetoStatus.sql} | 4 - MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 6 +- .../Properties/PublishProfiles/IIS03.pubxml | 28 - .../PublishProfiles/IIS03.pubxml.user | 12 - MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 33 files changed, 2096 insertions(+), 81 deletions(-) create mode 100644 MP.MONO.Data/DbModels/TaskExecModel.cs create mode 100644 MP.MONO.Data/Migrations/20230329152217_TaskExecTable.Designer.cs create mode 100644 MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs rename MP.MONO.Data/{ManualSql => SqlScripts/ManualFeed}/Multiax_MaintTableSetup.sql (100%) rename MP.MONO.Data/{ManualSql/stored_ParetoStatus.sql => SqlScripts/Stored/stp_paretoStatus.sql} (83%) create mode 100644 MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql rename MP.MONO.Data/{ManualSql/view_ParetoStatus.sql => SqlScripts/View/v_ParetoStatus.sql} (90%) delete mode 100644 MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml delete mode 100644 MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml.user diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e296483..f94b406 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,10 +158,10 @@ UI:deploy: - main needs: ["UI:build"] script: - # IIS 02 + # IIS02 - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj - # IIS DEV - - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj + # IIS04 + - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj ADAPTER:packDebug: diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index fce0404..5339860 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2910 + 1.2.2303.2917 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 52bee72..38c9c14 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                            Version: 1.2.2303.2910

                            +

                            Version: 1.2.2303.2917


                            Release Note:
                            • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 5a933c0..53535f5 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2910 +1.2.2303.2917 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 232ded0..b7370d6 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2910 + 1.2.2303.2917 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 4e1a099..cc50ad3 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2910 + 1.2.2303.2917 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 10041ef..cf0d0b4 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -98,6 +98,7 @@ string AlarmCleanPost = ""; int DbSampleInt = 60; int BlinkPeriodMSec = 1000; bool AlarmLogActive = false; +int NumDay2Keep = 180; setupConf(); // datetime dell'inizio esecuzione task... x usare un semaforo di veto doppia esecuzione entro 30 sec @@ -115,6 +116,8 @@ MessagePipe mpStatusParetoSendPipe = new MessagePipe(redisConn, Constants.STATUS MessagePipe mpStatsSendPipe = new MessagePipe(redisConn, Constants.MACH_STATS_M_QUEUE); Thread threadStatus = new Thread(calcParetoStatus); threadStatus.Start(); +Thread threadDbMaint = new Thread(dbMaintenance); +threadDbMaint.Start(); /* -------------------------------- * Setup Gestione Counters @@ -464,7 +467,7 @@ MachineDTO getLastMachinePlate() ProductionDTO getCurrProdData() { ProductionDTO? currProdData = new ProductionDTO(); - string rawData = redisDb.StringGet(Constants.PROD_CURR_KEY); + string rawData = redisDb.StringGet(Constants.PROD_CURR_KEY); if (!string.IsNullOrEmpty(rawData)) { currProdData = JsonConvert.DeserializeObject(rawData); @@ -573,6 +576,32 @@ void calcParetoStatus() } while (true); } +void dbMaintenance() +{ + // ricalcolo ogni 120 min CIRCA +/- 2% + int msecOra = 1000 * 60 * 120; + int minPeriod = msecOra * 98/100; + int maxPeriod = msecOra * 102 / 100; + + // leggo conf x giorni da tenere... + int.TryParse(config.GetValue("OptPar:NumDay2Keep"), out NumDay2Keep); + + do + { + // effettuo su DB chiamata stored x pulizia dati vecchi + var cleanupResult = dbController.RemoveOldData(NumDay2Keep); + + // loggo esito cleanup eseguito + foreach (var item in cleanupResult) + { + Log.Info($"DB Cleanup: {item.CodTask} | {item.Result}"); + } + + // attesa random da periodo... + Thread.Sleep(rand.Next(minPeriod, maxPeriod)); + } while (true); +} + List getMachStatDTO(List currStatus) { List machStatList = new List(); @@ -1479,7 +1508,7 @@ void MpStatusRecvPipe_EA_NewMessage(object? sender, EventArgs e) void checkProduction(Dictionary dataList) { - if(dataList.Count>0) + if (dataList.Count > 0) { var currProdDTO = getCurrProdData(); string currKey = "RECIPE NAME"; diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 52bee72..38c9c14 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                              Version: 1.2.2303.2910

                              +

                              Version: 1.2.2303.2917


                              Release Note:
                              • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 5a933c0..53535f5 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2910 +1.2.2303.2917 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 6252bb3..245aaa4 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2910 + 1.2.2303.2917 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/appsettings.json b/MP.MONO.DECODER/appsettings.json index 297af27..169f800 100644 --- a/MP.MONO.DECODER/appsettings.json +++ b/MP.MONO.DECODER/appsettings.json @@ -42,6 +42,7 @@ //"AlarmRegexp": "^{.*}", "BlinkCount": 3, "DbSampleInt": 60, - "BlinkPeriodMSec": 2000 + "BlinkPeriodMSec": 2000, + "NumDay2Keep": 366 } } diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 770d0f7..3f8ac7b 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -4,7 +4,9 @@ using MP.MONO.Data.DbModels; using MP.MONO.Data.DTO; using MySqlConnector; using NLog; +using System.Collections.Generic; using System.Diagnostics; +using System.Reflection.PortableExecutable; using static MP.MONO.Core.Enums; namespace MP.MONO.Data.Controllers @@ -1483,6 +1485,31 @@ namespace MP.MONO.Data.Controllers return answ; } + /// + /// Effettua chiamata stored x pulizia dati stale/vecchi + /// + /// + /// + public List RemoveOldData(int numDay2Keep) + { + List dbResult = new List(); + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + dbResult = localDbCtx + .DbSetTaskExec + .FromSqlRaw("CALL stp_removeOldData({0});", numDay2Keep) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante RemoveOldData{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.MONO.Data/DbConfig.cs b/MP.MONO.Data/DbConfig.cs index 2780dca..a214869 100644 --- a/MP.MONO.Data/DbConfig.cs +++ b/MP.MONO.Data/DbConfig.cs @@ -53,12 +53,6 @@ namespace MP.MONO.Data return migrateTask.Result; } - //public DbConfig() - //{ - // // stringa admin con utente root egalware... - // CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid=root;pwd=Seriate_24068!;sslmode=None"; - //} - public static void InitDb(string server, string nKey, string sKey) { DATABASE_SERV = server; diff --git a/MP.MONO.Data/DbModels/TaskExecModel.cs b/MP.MONO.Data/DbModels/TaskExecModel.cs new file mode 100644 index 0000000..91f3ed0 --- /dev/null +++ b/MP.MONO.Data/DbModels/TaskExecModel.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.MONO.Data.DbModels +{ + /// + /// Vista virtuale x esito esecuzione task (es cleanup tabelle) + /// + [Table("TaskExec")] + public class TaskExecModel + { + #region Public Properties + + /// + /// ID + /// + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int TaskID { get; set; } + + /// + /// DataOra evento registrato + /// + public DateTime DtRif { get; set; } = DateTime.Now; + + /// + /// Cod task eseguito + /// + public string CodTask { get; set; } = ""; + + /// + /// Esito esecuzione registrato + /// + public string Result { get; set; } = ""; + + + #endregion Public Properties + } +} diff --git a/MP.MONO.Data/MP.MONO.Data.csproj b/MP.MONO.Data/MP.MONO.Data.csproj index 4832d7b..5edae6d 100644 --- a/MP.MONO.Data/MP.MONO.Data.csproj +++ b/MP.MONO.Data/MP.MONO.Data.csproj @@ -30,4 +30,16 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/MP.MONO.Data/MapoMonoContext.cs b/MP.MONO.Data/MapoMonoContext.cs index f6c032a..949e11f 100644 --- a/MP.MONO.Data/MapoMonoContext.cs +++ b/MP.MONO.Data/MapoMonoContext.cs @@ -126,7 +126,13 @@ namespace MP.MONO.Data /// /// DbSet Pareto Status giornaliero /// - public virtual DbSet DbSetParetoStatus { get; set; } = null!; + /// + public virtual DbSet DbSetParetoStatus { get; set; } = null!; + + /// + /// DbSet esecuzione task manutenzione DB + /// + public virtual DbSet DbSetTaskExec { get; set; } = null!; #endregion Public Properties @@ -149,8 +155,9 @@ namespace MP.MONO.Data } catch { } - if(string.IsNullOrEmpty(connString)) + if (string.IsNullOrEmpty(connString)) { + // to fix in case of migrations connString = "server=10.74.82.230; port=3306; database=MAPO.MONO;uid=steamware; pwd=Seriate_24068!; sslmode=None;"; } if (!optionsBuilder.IsConfigured) @@ -168,6 +175,7 @@ namespace MP.MONO.Data } modelBuilder.Entity().ToView("v_ParetoStatus"); + //modelBuilder.Entity(entity => //{ // entity.Property(e => e.ValStd) diff --git a/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.Designer.cs b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.Designer.cs new file mode 100644 index 0000000..be9bade --- /dev/null +++ b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.Designer.cs @@ -0,0 +1,1773 @@ +// +using System; +using MP.MONO.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + [DbContext(typeof(MapoMonoContext))] + [Migration("20230329152217_TaskExecTable")] + partial class TaskExecTable + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmListModel", b => + { + b.Property("AlarmId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("FullValue") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmId"); + + b.ToTable("AlarmList"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.Property("AlarmLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("MemAddress") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Status") + .HasColumnType("int unsigned"); + + b.Property("ValDecoded") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.Property("AlarmRecId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AlarmId") + .HasColumnType("int"); + + b.Property("DtEnd") + .HasColumnType("datetime(6)"); + + b.Property("DtStart") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.HasKey("AlarmRecId"); + + b.HasIndex("AlarmId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmRec"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AnKeyValModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Descript") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValFloat") + .HasColumnType("int"); + + b.Property("ValInt") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("AnKeyVal"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ConfigModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Val") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValStd") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("Config"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.CounterModel", b => + { + b.Property("CCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ActualVal") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("LastReset") + .HasColumnType("datetime(6)"); + + b.HasKey("CCode"); + + b.ToTable("Counter"); + + b.HasData( + new + { + CCode = "MacPowerOn", + ActualVal = 0.0, + Description = "Machine Power On", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "CycleProc01", + ActualVal = 0.0, + Description = "Process 1 on Cycle state", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque01", + ActualVal = 0.0, + Description = "Spindle 01 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque02", + ActualVal = 0.0, + Description = "Spindle 02 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque03", + ActualVal = 0.0, + Description = "Spindle 03 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque04", + ActualVal = 0.0, + Description = "Spindle 04 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "LMCheckElapsed", + ActualVal = 0.0, + Description = "Time Elapsed from last full Manufacturer Check", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.Property("DataLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DataType") + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumRec") + .HasColumnType("double"); + + b.Property("ValNumAvg") + .HasColumnType("double"); + + b.Property("ValNumMax") + .HasColumnType("double"); + + b.Property("ValNumMin") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodEvent") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodEvent"); + + b.HasIndex("MachineId"); + + b.ToTable("EventLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventModel", b => + { + b.Property("CodEvent") + .HasColumnType("varchar(255)"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("IsUser") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodEvent"); + + b.ToTable("Event"); + + b.HasData( + new + { + CodEvent = "", + Active = true, + Description = "NA", + IsUser = false + }, + new + { + CodEvent = "Run", + Active = true, + Description = "Running", + IsUser = true + }, + new + { + CodEvent = "Setup", + Active = true, + Description = "Machine Setup", + IsUser = true + }, + new + { + CodEvent = "ProgEdit", + Active = true, + Description = "Program Editing", + IsUser = true + }, + new + { + CodEvent = "Fill", + Active = true, + Description = "Machine Fill", + IsUser = true + }, + new + { + CodEvent = "SetError", + Active = true, + Description = "Error", + IsUser = true + }, + new + { + CodEvent = "WuCd", + Active = true, + Description = "Warm Up / CoolDown Machine", + IsUser = false + }, + new + { + CodEvent = "ContrPwr", + Active = true, + Description = "Controlled PowerOn / ShutDown", + IsUser = false + }, + new + { + CodEvent = "ProgMiss", + Active = true, + Description = "Program Missing", + IsUser = true + }, + new + { + CodEvent = "HRMiss", + Active = true, + Description = "HR Missing", + IsUser = true + }, + new + { + CodEvent = "Maint", + Active = true, + Description = "Maintenance", + IsUser = true + }, + new + { + CodEvent = "Clean", + Active = true, + Description = "Machine CleanUp", + IsUser = true + }, + new + { + CodEvent = "SetPwrOff", + Active = true, + Description = "Power OFF Declaration", + IsUser = true + }, + new + { + CodEvent = "Init", + Active = true, + Description = "Init", + IsUser = false + }, + new + { + CodEvent = "PowerOff", + Active = true, + Description = "Power OFF", + IsUser = false + }, + new + { + CodEvent = "PowerOn", + Active = true, + Description = "Power ON", + IsUser = false + }, + new + { + CodEvent = "Cycle", + Active = true, + Description = "Machining", + IsUser = false + }, + new + { + CodEvent = "EndCycle", + Active = true, + Description = "End machining", + IsUser = false + }, + new + { + CodEvent = "Error", + Active = true, + Description = "Error", + IsUser = false + }, + new + { + CodEvent = "PzCount", + Active = true, + Description = "Item Count(+1)", + IsUser = false + }, + new + { + CodEvent = "StartPall", + Active = true, + Description = "Start pallet", + IsUser = false + }, + new + { + CodEvent = "EndPall", + Active = true, + Description = "End pallet", + IsUser = false + }, + new + { + CodEvent = "Manual", + Active = true, + Description = "Manual", + IsUser = false + }, + new + { + CodEvent = "LOutFull", + Active = true, + Description = "Line Out Full", + IsUser = false + }, + new + { + CodEvent = "LInEmpty", + Active = true, + Description = "Line In Empty", + IsUser = false + }, + new + { + CodEvent = "CycleTOut", + Active = true, + Description = "Timeout Std CycleTime", + IsUser = false + }, + new + { + CodEvent = "RMatMiss", + Active = true, + Description = "Raw Material Missing", + IsUser = true + }, + new + { + CodEvent = "Emergency", + Active = true, + Description = "Emergency", + IsUser = false + }, + new + { + CodEvent = "ToolRepl", + Active = true, + Description = "Tool Replacement", + IsUser = true + }, + new + { + CodEvent = "CncAlam", + Active = true, + Description = "CNC Alarm", + IsUser = false + }, + new + { + CodEvent = "PlcAlam", + Active = true, + Description = "PLC Alarm", + IsUser = false + }, + new + { + CodEvent = "Warning", + Active = true, + Description = "Warning State", + IsUser = false + }, + new + { + CodEvent = "Message", + Active = true, + Description = "Machine Message", + IsUser = false + }, + new + { + CodEvent = "PzIncr", + Active = true, + Description = "Item Count Increment", + IsUser = false + }, + new + { + CodEvent = "PzSet", + Active = true, + Description = "Item Count Set", + IsUser = false + }, + new + { + CodEvent = "UserComm", + Active = true, + Description = "User Comment", + IsUser = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.MachineModel", b => + { + b.Property("MachineId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BuildYear") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Model") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Serial") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("MachineId"); + + b.ToTable("Machine"); + + b.HasData( + new + { + MachineId = 1, + BuildYear = 2023, + Code = "", + Description = "Default SIM Machine", + Model = "Egalware SIM", + Name = "EGW-SIM-Machine", + Serial = "SN-0000-0000-0000" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ParetoStatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("TotDuration") + .HasColumnType("float"); + + b.HasKey("CodStatus"); + + b.ToView("v_ParetoStatus"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.Property("SMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("CountStartVal") + .HasColumnType("double"); + + b.Property("DtCreation") + .HasColumnType("datetime(6)"); + + b.Property("DtExecution") + .HasColumnType("datetime(6)"); + + b.Property("ElapsedVal") + .HasColumnType("double"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("PMTaskId") + .HasColumnType("int"); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("PMTaskId"); + + b.ToTable("PendingMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMMGroupModel", b => + { + b.Property("PMMGCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMMGCode"); + + b.ToTable("MachineGroup"); + + b.HasData( + new + { + PMMGCode = "Whole", + Description = "Whole Machine" + }, + new + { + PMMGCode = "Load", + Description = "Part loader/unloader" + }, + new + { + PMMGCode = "MovBelts", + Description = "Part moving belts" + }, + new + { + PMMGCode = "MovRoll", + Description = "Part moving rollers" + }, + new + { + PMMGCode = "Axis", + Description = "Machining axis" + }, + new + { + PMMGCode = "Spindles", + Description = "Tool spindles" + }, + new + { + PMMGCode = "ToolChange", + Description = "Automatic tool changer" + }, + new + { + PMMGCode = "Cabinet", + Description = "Electrical cabinet" + }, + new + { + PMMGCode = "ChipConv", + Description = "Chips conveyor" + }, + new + { + PMMGCode = "DustSuct", + Description = "Dust suction" + }, + new + { + PMMGCode = "OpPanel", + Description = "Operator pannel" + }, + new + { + PMMGCode = "Access", + Description = "Accessories" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMTaskTopicModel", b => + { + b.Property("PMTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMTCode"); + + b.ToTable("TaskTopic"); + + b.HasData( + new + { + PMTCode = "Mechanical", + Description = "Mechanical system" + }, + new + { + PMTCode = "Electro", + Description = "Electrical system" + }, + new + { + PMTCode = "Lubro", + Description = "Lubrication system" + }, + new + { + PMTCode = "Coolant", + Description = "Coolant system" + }, + new + { + PMTCode = "Preumo", + Description = "Pneumatic system" + }, + new + { + PMTCode = "Hydro", + Description = "Hydraulic system" + }, + new + { + PMTCode = "Safety", + Description = "Enclosure/Safety system" + }, + new + { + PMTCode = "Suction", + Description = "Suction system" + }, + new + { + PMTCode = "GeoAdj", + Description = "Geometrical system" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMUTModel", b => + { + b.Property("PMUTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMUTCode"); + + b.ToTable("UserTeam"); + + b.HasData( + new + { + PMUTCode = "TrainOp", + Description = "Trained Operator" + }, + new + { + PMUTCode = "MaintServ", + Description = "Maintenance Service" + }, + new + { + PMUTCode = "DevSupp", + Description = "Device Supplier" + }, + new + { + PMUTCode = "MultiaxServ", + Description = "Multiax Service" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.Property("PMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("ExtIdx") + .HasColumnType("int"); + + b.Property("IsDisabled") + .HasColumnType("tinyint(1)"); + + b.Property("JobDescription") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumTaskDone") + .HasColumnType("int"); + + b.Property("PMMGCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMUTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("Protected") + .HasColumnType("tinyint(1)"); + + b.HasKey("PMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("MachineId"); + + b.HasIndex("PMMGCode"); + + b.HasIndex("PMTCode"); + + b.HasIndex("PMUTCode"); + + b.ToTable("PrevMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.Property("ProdLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("EvType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtRef") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("ProdLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("ProdLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("CssClass") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CssClassOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("GroupOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Prior") + .HasColumnType("int"); + + b.Property("ShowProdItem") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodStatus"); + + b.ToTable("Status"); + + b.HasData( + new + { + CodStatus = "", + CssClass = "dark", + CssClassOvr = "", + Description = "NA", + Group = "NA", + GroupOvr = "", + Prior = 0, + ShowProdItem = true + }, + new + { + CodStatus = "Error", + CssClass = "danger", + CssClassOvr = "", + Description = "Error", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Emergency", + CssClass = "danger", + CssClassOvr = "", + Description = "Emergency", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Manual", + CssClass = "warning", + CssClassOvr = "", + Description = "Manual", + Group = "ManYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "PzProd", + CssClass = "warning", + CssClassOvr = "", + Description = "Item Produced", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "Unkn", + CssClass = "warning", + CssClassOvr = "", + Description = "Unknown Stop", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "ProgMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "Program Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "HRMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "HR Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Maint", + CssClass = "warning", + CssClassOvr = "", + Description = "Maintenance", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineOutFull", + CssClass = "danger", + CssClassOvr = "", + Description = "Line Out Full", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineInEmpty", + CssClass = "danger", + CssClassOvr = "", + Description = "Line In Empty", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "RawMatMiss", + CssClass = "danger", + CssClassOvr = "", + Description = "Raw Material Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "CncAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "CNC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PlcAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "PLC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "WUpCDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Warm Up / CoolDown Machine", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ContrPOnSDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Controller PowerOn / ShutDown", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Init", + CssClass = "primary", + CssClassOvr = "", + Description = "Init", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOn", + CssClass = "primary", + CssClassOvr = "", + Description = "Power ON", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "TimeoutCycle", + CssClass = "primary", + CssClassOvr = "", + Description = "Timeout Std CycleTime", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Waiting", + CssClass = "primary", + CssClassOvr = "", + Description = "Waiting State", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ProgEdit", + CssClass = "warning", + CssClassOvr = "", + Description = "Program Editing", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Setup", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Setup", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Clean", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine CleanUp", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Fill", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Fill", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ToolReplace", + CssClass = "warning", + CssClassOvr = "", + Description = "Tool Replacement", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Warning", + CssClass = "warning", + CssClassOvr = "", + Description = "Warning State", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOff", + CssClass = "secondary", + CssClassOvr = "", + Description = "Power OFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Run", + CssClass = "success", + CssClassOvr = "", + Description = "Running", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Cycle", + CssClass = "success", + CssClassOvr = "", + Description = "Machining", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_000", + CssClass = "secondary", + CssClassOvr = "", + Description = "UNDEFINED", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_001", + CssClass = "secondary", + CssClassOvr = "", + Description = "POWEROFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_002", + CssClass = "success", + CssClassOvr = "", + Description = "AUTOMATIC", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_003", + CssClass = "warning", + CssClassOvr = "", + Description = "EDIT", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_004", + CssClass = "warning", + CssClassOvr = "", + Description = "SEMIAUTOMATIC", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_005", + CssClass = "warning", + CssClassOvr = "", + Description = "MANUAL_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_006", + CssClass = "danger", + CssClassOvr = "", + Description = "ALARM", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_007", + CssClass = "danger", + CssClassOvr = "", + Description = "ESTOP", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_008", + CssClass = "warning", + CssClassOvr = "", + Description = "MDI", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_009", + CssClass = "warning", + CssClassOvr = "", + Description = "STEP", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_010", + CssClass = "warning", + CssClassOvr = "", + Description = "INC_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_011", + CssClass = "warning", + CssClassOvr = "", + Description = "PROFILE", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_012", + CssClass = "warning", + CssClassOvr = "", + Description = "HOME", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_013", + CssClass = "warning", + CssClassOvr = "", + Description = "HANDWHEEL", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.TaskExecModel", b => + { + b.Property("TaskID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodTask") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Result") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TaskID"); + + b.ToTable("TaskExec"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.AlarmListModel", "AlarmListNav") + .WithMany() + .HasForeignKey("AlarmId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("AlarmListNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.EventModel", "CodEventNav") + .WithMany() + .HasForeignKey("CodEvent") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodEventNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PrevMaintTaskModel", "PMTaskeNav") + .WithMany() + .HasForeignKey("PMTaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("PMTaskeNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMMGroupModel", "MachGroupNav") + .WithMany() + .HasForeignKey("PMMGCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMTaskTopicModel", "TopicNav") + .WithMany() + .HasForeignKey("PMTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMUTModel", "UserTeamNav") + .WithMany() + .HasForeignKey("PMUTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("MachGroupNav"); + + b.Navigation("MachineNav"); + + b.Navigation("TopicNav"); + + b.Navigation("UserTeamNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs new file mode 100644 index 0000000..56fc9d8 --- /dev/null +++ b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs @@ -0,0 +1,72 @@ +using System; +using System.Reflection; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + public partial class TaskExecTable : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "TaskExec", + columns: table => new + { + TaskID = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + DtRif = table.Column(type: "datetime(6)", nullable: false), + CodTask = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Result = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_TaskExec", x => x.TaskID); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + // aggiunta view + addView(migrationBuilder, "v_ParetoStatus"); + // aggiunta stored + addStored(migrationBuilder, "stp_paretoStatus"); + addStored(migrationBuilder, "stp_removeOldData"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TaskExec"); + // rimozione view + remView(migrationBuilder, "v_ParetoStatus"); + // rimozione stored + remStored(migrationBuilder, "stp_paretoStatus"); + remStored(migrationBuilder, "stp_removeOldData"); + } + + + private void addView(MigrationBuilder migrationBuilder, string objName) + { + string path = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "SqlScripts", "View", $"{objName}.sql"); + string viewBody = File.ReadAllText(path); + migrationBuilder.Sql(viewBody); + } + private void addStored(MigrationBuilder migrationBuilder, string objName) + { + string path = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "SqlScripts", "Stored", $"{objName}.sql"); + string viewBody = File.ReadAllText(path); + migrationBuilder.Sql(viewBody); + } + + private void remView(MigrationBuilder migrationBuilder, string objName) + { + migrationBuilder.Sql($"exec('drop view dbo.{objName}');"); + } + private void remStored(MigrationBuilder migrationBuilder, string objName) + { + migrationBuilder.Sql($"exec('drop stored dbo.{objName}');"); + } + } +} diff --git a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs index 0a0d2e7..2346704 100644 --- a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs +++ b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs @@ -653,6 +653,19 @@ namespace MP.MONO.Data.Migrations }); }); + modelBuilder.Entity("MP.MONO.Data.DbModels.ParetoStatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("TotDuration") + .HasColumnType("float"); + + b.HasKey("CodStatus"); + + b.ToView("v_ParetoStatus"); + }); + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => { b.Property("SMTaskId") @@ -1549,6 +1562,28 @@ namespace MP.MONO.Data.Migrations b.ToTable("StatusStAg"); }); + modelBuilder.Entity("MP.MONO.Data.DbModels.TaskExecModel", b => + { + b.Property("TaskID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodTask") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Result") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TaskID"); + + b.ToTable("TaskExec"); + }); + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => { b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") diff --git a/MP.MONO.Data/ManualSql/Multiax_MaintTableSetup.sql b/MP.MONO.Data/SqlScripts/ManualFeed/Multiax_MaintTableSetup.sql similarity index 100% rename from MP.MONO.Data/ManualSql/Multiax_MaintTableSetup.sql rename to MP.MONO.Data/SqlScripts/ManualFeed/Multiax_MaintTableSetup.sql diff --git a/MP.MONO.Data/ManualSql/stored_ParetoStatus.sql b/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql similarity index 83% rename from MP.MONO.Data/ManualSql/stored_ParetoStatus.sql rename to MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql index a23301b..bc614e6 100644 --- a/MP.MONO.Data/ManualSql/stored_ParetoStatus.sql +++ b/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql @@ -1,6 +1,6 @@ --- stored -DELIMITER // -GO +---- stored +--DELIMITER // +--GO CREATE OR REPLACE PROCEDURE stp_paretoStatus( IN machine_id INT, @@ -16,8 +16,8 @@ BEGIN AND DtRif <= dt_to GROUP BY CodStatus; END; -// -GO +--// +--GO -DELIMITER ; -GO \ No newline at end of file +--DELIMITER ; +--GO \ No newline at end of file diff --git a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql new file mode 100644 index 0000000..d7288b1 --- /dev/null +++ b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql @@ -0,0 +1,62 @@ +---- stored +--DELIMITER // + +CREATE OR REPLACE PROCEDURE stp_removeOldData( + IN day_keep INT +) +READS SQL DATA +BEGIN + + SET @adesso = ADDDATE(CURRENT_DATE(), INTERVAL -1 SECOND); + SET @dt_min = ADDDATE(CURRENT_DATE(), INTERVAL -day_keep DAY); + + START TRANSACTION; + + -- AlarmLog + DELETE + FROM AlarmLog + WHERE DtRif <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_DATE() AS DtRif + ,'Cleanup AlarmLog' AS CodTask + ,'Deleted' + ROW_COUNT() +' rows' AS Result; + + -- AlarmRec + DELETE + FROM AlarmRec + WHERE DtStart <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_DATE() AS DtRif + ,'Cleanup AlarmRec' AS CodTask + ,'Deleted' + ROW_COUNT() +' rows' AS Result; + + -- DataLog + DELETE + FROM DataLog + WHERE DtRif <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_DATE() AS DtRif + ,'Cleanup DataLog' AS CodTask + ,'Deleted' + ROW_COUNT() +' rows' AS Result; + + -- StatusLog + DELETE + FROM StatusLog + WHERE DtRif <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_DATE() AS DtRif + ,'Cleanup StatusLog' AS CodTask + ,'Deleted' + ROW_COUNT() +' rows' AS Result; + + + COMMIT; + + -- seleziono risultato + SELECT * + FROM TaskExec + WHERE DtRif > @adesso; + +END +--// + +--DELIMITER ; \ No newline at end of file diff --git a/MP.MONO.Data/ManualSql/view_ParetoStatus.sql b/MP.MONO.Data/SqlScripts/View/v_ParetoStatus.sql similarity index 90% rename from MP.MONO.Data/ManualSql/view_ParetoStatus.sql rename to MP.MONO.Data/SqlScripts/View/v_ParetoStatus.sql index 7f8fcc9..783f700 100644 --- a/MP.MONO.Data/ManualSql/view_ParetoStatus.sql +++ b/MP.MONO.Data/SqlScripts/View/v_ParetoStatus.sql @@ -1,11 +1,7 @@ -- creazione viste -DELIMITER ; - DROP VIEW IF EXISTS v_ParetoStatus; -GO CREATE VIEW v_ParetoStatus AS SELECT CodStatus,SUM(Duration) AS TotDuration FROM StatusLog GROUP BY CodStatus; -GO \ No newline at end of file diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index c6bf7bc..894e4ad 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2910 + 1.2.2303.2917 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 52bee72..38c9c14 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                Version: 1.2.2303.2910

                                +

                                Version: 1.2.2303.2917


                                Release Note:
                                • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 5a933c0..53535f5 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2910 +1.2.2303.2917 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 53a6bae..e817747 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2910 + 1.2.2303.2917 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 680127c..0d54f8d 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2910 + 1.2.2303.2917 @@ -25,6 +25,10 @@ + + <_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS04.pubxml" /> + + diff --git a/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml b/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml deleted file mode 100644 index d73dd78..0000000 --- a/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - MSDeploy - true - Release - Any CPU - - - false - 6fb65850-c023-4986-9dff-770c4e582d60 - false - https://iis03.egalware.com:8172/MsDeploy.axd - Default Web Site/MP/MONO - - true - WMSVC - true - true - jenkins - <_SavePWD>true - net6.0 - - \ No newline at end of file diff --git a/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml.user b/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml.user deleted file mode 100644 index 257fe28..0000000 --- a/MP.MONO.UI/Properties/PublishProfiles/IIS03.pubxml.user +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAARwa+h3SucUCk0+IZCHMQsgAAAAACAAAAAAADZgAAwAAAABAAAADOPMd3758qI/y/dA1hJlk6AAAAAASAAACgAAAAEAAAALjI1Q4A+Na1SHTbn2iY4kQYAAAA+8wgMcZ+vEOXhrpk/ei4H4gSz/lppCy4FAAAADEgX6TTl06NoYYCkrCN2gRN2gDO - True|2022-03-18T07:13:40.4364579Z;True|2022-03-10T18:22:15.7066492+01:00; - - \ No newline at end of file diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 52bee72..38c9c14 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                  Version: 1.2.2303.2910

                                  +

                                  Version: 1.2.2303.2917


                                  Release Note:
                                  • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 5a933c0..53535f5 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2910 +1.2.2303.2917 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index be822a0..a0406c5 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2910 + 1.2.2303.2917 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 70dd210bb478c05703dee5c7bd5e1de34981f687 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 18:20:21 +0200 Subject: [PATCH 17/38] Data - Fix creazione stored + migration - refresh appsettings.json --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/appsettings.json | 2 +- MP.MONO.DECODER/appsettings.multiax.json | 5 +++- MP.MONO.DECODER/appsettings.office.json | 12 ++++++++- .../SqlScripts/Stored/stp_paretoStatus.sql | 11 +------- .../SqlScripts/Stored/stp_removeOldData.sql | 26 +++++++------------ MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 21 files changed, 43 insertions(+), 45 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 5339860..1af18da 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2917 + 1.2.2303.2918 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 38c9c14..6c0cfba 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                    Version: 1.2.2303.2917

                                    +

                                    Version: 1.2.2303.2918


                                    Release Note:
                                    • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 53535f5..4236344 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2917 +1.2.2303.2918 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index b7370d6..5b6feac 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2917 + 1.2.2303.2918 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index cc50ad3..02a0943 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2917 + 1.2.2303.2918 diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 38c9c14..6c0cfba 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                      Version: 1.2.2303.2917

                                      +

                                      Version: 1.2.2303.2918


                                      Release Note:
                                      • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 53535f5..4236344 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2917 +1.2.2303.2918 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 245aaa4..64f86ce 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2917 + 1.2.2303.2918 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/appsettings.json b/MP.MONO.DECODER/appsettings.json index 169f800..44049a0 100644 --- a/MP.MONO.DECODER/appsettings.json +++ b/MP.MONO.DECODER/appsettings.json @@ -43,6 +43,6 @@ "BlinkCount": 3, "DbSampleInt": 60, "BlinkPeriodMSec": 2000, - "NumDay2Keep": 366 + "NumDay2Keep": 365 } } diff --git a/MP.MONO.DECODER/appsettings.multiax.json b/MP.MONO.DECODER/appsettings.multiax.json index 5d4ac84..abfa834 100644 --- a/MP.MONO.DECODER/appsettings.multiax.json +++ b/MP.MONO.DECODER/appsettings.multiax.json @@ -39,6 +39,9 @@ "AlarmMode": "RawList", "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", "BlinkCount": 10, - "DbSampleInt": 60 + "DbSampleInt": 60, + //"AlarmLogActive": false, + "BlinkPeriodMSec": 2000, + "NumDay2Keep": 365 } } \ No newline at end of file diff --git a/MP.MONO.DECODER/appsettings.office.json b/MP.MONO.DECODER/appsettings.office.json index 252c28a..44049a0 100644 --- a/MP.MONO.DECODER/appsettings.office.json +++ b/MP.MONO.DECODER/appsettings.office.json @@ -33,6 +33,16 @@ } }, "OptPar": { - "AlarmMode": "RawList" + "AlarmLogActive": false, + "AlarmCleanPre": "", + "AlarmCleanPost": "", + "AlarmIgnoreEmpty": true, + "AlarmMode": "RawList", + "AlarmRegexp": "^{[\\d\\w\\:\\ \\.\\/\\(\\)]*}", + //"AlarmRegexp": "^{.*}", + "BlinkCount": 3, + "DbSampleInt": 60, + "BlinkPeriodMSec": 2000, + "NumDay2Keep": 365 } } diff --git a/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql b/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql index bc614e6..6ff2e85 100644 --- a/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql +++ b/MP.MONO.Data/SqlScripts/Stored/stp_paretoStatus.sql @@ -1,7 +1,3 @@ ----- stored ---DELIMITER // ---GO - CREATE OR REPLACE PROCEDURE stp_paretoStatus( IN machine_id INT, IN dt_from DATETIME, @@ -15,9 +11,4 @@ BEGIN AND DtRif >= dt_from AND DtRif <= dt_to GROUP BY CodStatus; -END; ---// ---GO - ---DELIMITER ; ---GO \ No newline at end of file +END; \ No newline at end of file diff --git a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql index d7288b1..696fafa 100644 --- a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql +++ b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql @@ -1,14 +1,11 @@ ----- stored ---DELIMITER // - CREATE OR REPLACE PROCEDURE stp_removeOldData( IN day_keep INT ) READS SQL DATA BEGIN - SET @adesso = ADDDATE(CURRENT_DATE(), INTERVAL -1 SECOND); - SET @dt_min = ADDDATE(CURRENT_DATE(), INTERVAL -day_keep DAY); + SET @adesso = ADDDATE(CURRENT_TIMESTAMP, INTERVAL -1 SECOND); + SET @dt_min = ADDDATE(CURRENT_TIMESTAMP, INTERVAL -day_keep DAY); START TRANSACTION; @@ -17,36 +14,36 @@ BEGIN FROM AlarmLog WHERE DtRif <= @dt_min; INSERT INTO TaskExec(DtRif, CodTask, Result) - SELECT CURRENT_DATE() AS DtRif + SELECT CURRENT_TIMESTAMP AS DtRif ,'Cleanup AlarmLog' AS CodTask - ,'Deleted' + ROW_COUNT() +' rows' AS Result; + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; -- AlarmRec DELETE FROM AlarmRec WHERE DtStart <= @dt_min; INSERT INTO TaskExec(DtRif, CodTask, Result) - SELECT CURRENT_DATE() AS DtRif + SELECT CURRENT_TIMESTAMP AS DtRif ,'Cleanup AlarmRec' AS CodTask - ,'Deleted' + ROW_COUNT() +' rows' AS Result; + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; -- DataLog DELETE FROM DataLog WHERE DtRif <= @dt_min; INSERT INTO TaskExec(DtRif, CodTask, Result) - SELECT CURRENT_DATE() AS DtRif + SELECT CURRENT_TIMESTAMP AS DtRif ,'Cleanup DataLog' AS CodTask - ,'Deleted' + ROW_COUNT() +' rows' AS Result; + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; -- StatusLog DELETE FROM StatusLog WHERE DtRif <= @dt_min; INSERT INTO TaskExec(DtRif, CodTask, Result) - SELECT CURRENT_DATE() AS DtRif + SELECT CURRENT_TIMESTAMP AS DtRif ,'Cleanup StatusLog' AS CodTask - ,'Deleted' + ROW_COUNT() +' rows' AS Result; + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; COMMIT; @@ -57,6 +54,3 @@ BEGIN WHERE DtRif > @adesso; END ---// - ---DELIMITER ; \ No newline at end of file diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 894e4ad..332ec43 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2917 + 1.2.2303.2918 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 38c9c14..6c0cfba 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                        Version: 1.2.2303.2917

                                        +

                                        Version: 1.2.2303.2918


                                        Release Note:
                                        • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 53535f5..4236344 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2917 +1.2.2303.2918 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index e817747..6facd3d 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2917 + 1.2.2303.2918 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 0d54f8d..d4a67ab 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2917 + 1.2.2303.2918 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 38c9c14..6c0cfba 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                          Version: 1.2.2303.2917

                                          +

                                          Version: 1.2.2303.2918


                                          Release Note:
                                          • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 53535f5..4236344 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2917 +1.2.2303.2918 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index a0406c5..cc2108b 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2917 + 1.2.2303.2918 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 8c5d331ed83c7ea3fe270fea45a89b006af786ff Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 18:22:44 +0200 Subject: [PATCH 18/38] Update stored x ProdLog --- MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql index 696fafa..4af4ab5 100644 --- a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql +++ b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql @@ -36,6 +36,15 @@ BEGIN ,'Cleanup DataLog' AS CodTask ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; + -- ProdLog + DELETE + FROM ProdLog + WHERE DtRif <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_TIMESTAMP AS DtRif + ,'Cleanup ProdLog' AS CodTask + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; + -- StatusLog DELETE FROM StatusLog From 9a0211f82c688e0071ff8f7e2fed1e24dc685e19 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 29 Mar 2023 18:32:19 +0200 Subject: [PATCH 19/38] Update migration - down x eliminazione stored & views OK --- MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs index 56fc9d8..098d2ad 100644 --- a/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs +++ b/MP.MONO.Data/Migrations/20230329152217_TaskExecTable.cs @@ -62,11 +62,11 @@ namespace MP.MONO.Data.Migrations private void remView(MigrationBuilder migrationBuilder, string objName) { - migrationBuilder.Sql($"exec('drop view dbo.{objName}');"); + migrationBuilder.Sql($"DROP VIEW IF EXISTS {objName};"); } private void remStored(MigrationBuilder migrationBuilder, string objName) { - migrationBuilder.Sql($"exec('drop stored dbo.{objName}');"); + migrationBuilder.Sql($"DROP PROCEDURE IF EXISTS {objName};"); } } } From c81045df7ee40351dc45c69af1f3b9c36b256003 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 30 Mar 2023 09:38:31 +0200 Subject: [PATCH 20/38] Fix SIM x spegnimento notturno --- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Program.cs | 23 ------ MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.SIM/Simulator.cs | 111 +++++++++++++++------------ 6 files changed, 68 insertions(+), 74 deletions(-) diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 332ec43..e466680 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2918 + 1.2.2303.3009 diff --git a/MP.MONO.SIM/Program.cs b/MP.MONO.SIM/Program.cs index acff0d3..650b16b 100644 --- a/MP.MONO.SIM/Program.cs +++ b/MP.MONO.SIM/Program.cs @@ -614,29 +614,6 @@ void simCountersRaw() } } -#if false -void simProd() -{ - int minPeriod = 3000; - int maxPeriod = 10000; - - // controllo se devo fare (se ho valori da simulare...) - if (currSimGen.currSimProd.Count > 0) - { - do - { - // recupero uno stato simulato - var newStatus = currSimGen.getProd(); - string rawData = JsonConvert.SerializeObject(newStatus); - saveAndSendMessage(Constants.PROD_CURR_KEY, Constants.PROD_M_QUEUE, rawData); - - // attesa random - Thread.Sleep(rand.Next(minPeriod, maxPeriod)); - } while (true); - } -} -#endif - void simMaint() { int minPeriod = 10000; diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 6c0cfba..d9f6c0a 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                            Version: 1.2.2303.2918

                                            +

                                            Version: 1.2.2303.3009


                                            Release Note:
                                            • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 4236344..1f6e279 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2918 +1.2.2303.3009 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 6facd3d..f0955eb 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2918 + 1.2.2303.3009 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/Simulator.cs b/MP.MONO.SIM/Simulator.cs index 91d7a01..eba8581 100644 --- a/MP.MONO.SIM/Simulator.cs +++ b/MP.MONO.SIM/Simulator.cs @@ -283,64 +283,81 @@ namespace MachineSim { DateTime adesso = DateTime.Now; Dictionary answ = new Dictionary(); - // simulo stato macchina ad 1 nel 95% (0 nel 5% dei casi) - if (rand.Next(0, 1000) < 950) + // dalle 22 alle 6 --> machine OFF + if (adesso.Hour < 6 || adesso.Hour >= 22) { - answ.Add("MACHINE STATUS", "1"); + answ.Add("MACHINE STATUS", "0"); + answ.Add("PART COUNT", "0"); + answ.Add("RECIPE NAME", "none"); + answ.Add("CURR ORDER", "NA"); + answ.Add("PROCESS STATUS", "1"); + answ.Add("PROCESS MODE", "1"); + answ.Add("P2 PALLET STATUS", "0"); + answ.Add("P3 PALLET STATUS", "0"); + answ.Add("P2 EXTERNAL PALLET STATUS", "0"); + answ.Add("P3 EXTERNAL PALLET STATUS", "0"); } else { - answ.Add("MACHINE STATUS", "0"); - } - - // part count sono i minuti del giorno... - int simCount = (int)adesso.Subtract(DateTime.Today).TotalMinutes; - answ.Add("PART COUNT", $"{simCount}"); - - // simulo stato processo in ciclo 90% dei casi, resto HOLD - if (rand.Next(0, 1000) < 900) - { - answ.Add("PROCESS STATUS", "2"); - // simulo modo auto 85% dei casi - if (rand.Next(0, 1000) < 850) + // simulo stato macchina ad 1 nel 99% (0 nel 1% dei casi) + if (rand.Next(0, 1000) < 990) { - answ.Add("PROCESS MODE", "2"); + answ.Add("MACHINE STATUS", "1"); } else { - answ.Add("PROCESS MODE", "1"); + answ.Add("MACHINE STATUS", "0"); } + + // part count sono i minuti del giorno... + int simCount = (int)adesso.Subtract(DateTime.Today).TotalMinutes; + answ.Add("PART COUNT", $"{simCount}"); + + // simulo stato processo in ciclo 90% dei casi, resto HOLD + if (rand.Next(0, 1000) < 900) + { + answ.Add("PROCESS STATUS", "2"); + // simulo modo auto 85% dei casi + if (rand.Next(0, 1000) < 850) + { + answ.Add("PROCESS MODE", "2"); + } + else + { + answ.Add("PROCESS MODE", "1"); + } + } + else + { + answ.Add("PROCESS STATUS", "3"); + answ.Add("PROCESS MODE", "7"); + } + // simulo status pallets... + + // Primo: 8% assente = 0, 90% presente=1, restante 2% error/hold=2 + int pVal = discretizePalletVal(rand.Next(0, 1000), 80, 900); + answ.Add("P2 PALLET STATUS", $"{pVal}"); + + // secondo: 7% assente = 0, 91% presente=1, restante 2% error/hold=2 + pVal = discretizePalletVal(rand.Next(0, 1000), 70, 910); + answ.Add("P3 PALLET STATUS", $"{pVal}"); + + // terzo: 6% assente = 0, 91% presente=1, restante 3% error/hold=2 + pVal = discretizePalletVal(rand.Next(0, 1000), 60, 910); + answ.Add("P2 EXTERNAL PALLET STATUS", $"{pVal}"); + + // quarto: 8% assente = 0, 89% presente=1, restante 3% error/hold=2 + pVal = discretizePalletVal(rand.Next(0, 1000), 80, 890); + answ.Add("P3 EXTERNAL PALLET STATUS", $"{pVal}"); + + // aggiunta part program che cambia ogni 10 minuti... + int minRound = (adesso.Minute / 10) * 10; + answ.Add("RECIPE NAME", $"{adesso:yyMMdd-HH}{minRound:00}.prg"); + + // aggiunta ordine... orario + answ.Add("CURR ORDER", $"ODL000{adesso:MMddHH}"); } - else - { - answ.Add("PROCESS STATUS", "3"); - answ.Add("PROCESS MODE", "7"); - } - // simulo status pallets... - // Primo: 8% assente = 0, 90% presente=1, restante 2% error/hold=2 - int pVal = discretizePalletVal(rand.Next(0, 1000), 80, 900); - answ.Add("P2 PALLET STATUS", $"{pVal}"); - - // secondo: 7% assente = 0, 91% presente=1, restante 2% error/hold=2 - pVal = discretizePalletVal(rand.Next(0, 1000), 70, 910); - answ.Add("P3 PALLET STATUS", $"{pVal}"); - - // terzo: 6% assente = 0, 91% presente=1, restante 3% error/hold=2 - pVal = discretizePalletVal(rand.Next(0, 1000), 60, 910); - answ.Add("P2 EXTERNAL PALLET STATUS", $"{pVal}"); - - // quarto: 8% assente = 0, 89% presente=1, restante 3% error/hold=2 - pVal = discretizePalletVal(rand.Next(0, 1000), 80, 890); - answ.Add("P3 EXTERNAL PALLET STATUS", $"{pVal}"); - - // aggiunta part program che cambia ogni 10 minuti... - int minRound = (adesso.Minute / 10) * 10; - answ.Add("RECIPE NAME", $"{adesso:yyMMdd-HH}{minRound:00}.prg"); - - // aggiunta ordine... orario - answ.Add("CURR ORDER", $"ODL000{adesso:MMddHH}"); - return answ; } From 789eb58590dea9fc8f66c0f5a60073c8ed2d9bfd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 30 Mar 2023 09:39:01 +0200 Subject: [PATCH 21/38] DECODER: - Aggiunto decodifica stati pareto in minuti (DayDuration) --- MP.MONO.ADAPTER.OPC/UAClient.cs | 10 ----- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.Core/Constants.cs | 4 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 54 +++++++++++++++++++---- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/lua/StatusDecoder.lua | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 16 files changed, 61 insertions(+), 33 deletions(-) diff --git a/MP.MONO.ADAPTER.OPC/UAClient.cs b/MP.MONO.ADAPTER.OPC/UAClient.cs index d43ac4e..701fed5 100644 --- a/MP.MONO.ADAPTER.OPC/UAClient.cs +++ b/MP.MONO.ADAPTER.OPC/UAClient.cs @@ -199,17 +199,7 @@ namespace MP.MONO.ADAPTER.OPC browser.NodeClassMask = (int)NodeClass.Object | (int)NodeClass.Variable; browser.ReferenceTypeId = ReferenceTypeIds.HierarchicalReferences; - //NodeId nodeToBrowse = ObjectIds.Server; - //NodeId nodeToBrowse = new NodeId("ns=4;i=5001"); NodeId nodeToBrowse = new NodeId(browsePath); - //nodeToBrowse = ObjectIds.Server; - //nodeToBrowse = new NodeId("Calibratrice_L1", 4); - //nodeToBrowse = new NodeId("Dati_Mes", 4); - //nodeToBrowse = new NodeId(5001, 2); - //nodeToBrowse = new NodeId("ns=4;s=NxController"); - //nodeToBrowse = new NodeId("ns=4;s=Dati_Mes"); - //nodeToBrowse = new NodeId("NxController.GlobalVars", 4); - //nodeToBrowse = new NodeId("Dati_Mes", 4); // Call Browse service lg.Trace($"Browsing {nodeToBrowse} node..."); diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 1af18da..1163a19 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2918 + 1.2.2303.3008 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 6c0cfba..f738928 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                              Version: 1.2.2303.2918

                                              +

                                              Version: 1.2.2303.3008


                                              Release Note:
                                              • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 4236344..f4b8ff5 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2918 +1.2.2303.3008 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 5b6feac..96daab2 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2918 + 1.2.2303.3008 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Core/Constants.cs b/MP.MONO.Core/Constants.cs index c4c0971..ebd48e9 100644 --- a/MP.MONO.Core/Constants.cs +++ b/MP.MONO.Core/Constants.cs @@ -51,6 +51,7 @@ namespace MP.MONO.Core public static readonly string ALARM_RECEIV_KEY = $"{BASE_HASH}:Current:AlarmsReceived"; public static readonly string ALARM_PEND_KEY = $"{BASE_HASH}:Current:AlarmsPendingClose"; public static readonly string EVENT_LOG_CURR_KEY = $"{BASE_HASH}:Current:EventsLog"; + public static readonly string MACH_DAY_DUR_CURR_KEY = $"{BASE_HASH}:Current:MachDayDur"; public static readonly string MACH_STATS_CURR_KEY = $"{BASE_HASH}:Current:MachStats"; public static readonly string MAINT_STATS_CURR_KEY = $"{BASE_HASH}:Current:Maintenance"; public static readonly string PARAMS_ACT_KEY = $"{BASE_HASH}:Current:ParamsVal"; @@ -72,7 +73,8 @@ namespace MP.MONO.Core // REDIS Channels messaggi (verso UI) public static readonly string ACT_LOG_M_QUEUE = $"ActivityLog"; public static readonly string ALARM_M_QUEUE = $"Alarms"; - public static readonly string EVENT_LOG_M_QUEUE = $"EventsLog"; + public static readonly string EVENT_LOG_M_QUEUE = $"EventsLog"; + public static readonly string MACH_DAY_DUR_M_QUEUE = $"MachDayDur"; public static readonly string MACH_STATS_M_QUEUE = $"MachStats"; public static readonly string MAINT_STATS_M_QUEUE = $"Maintenance"; public static readonly string PARAMS_M_QUEUE = $"Params"; diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 02a0943..0f5d266 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2918 + 1.2.2303.3009 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index cf0d0b4..3db8a06 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -114,6 +114,7 @@ Random rand = new Random(); * ----------------------------------------------------------------*/ MessagePipe mpStatusParetoSendPipe = new MessagePipe(redisConn, Constants.STATUS_PAR_QUEUE); MessagePipe mpStatsSendPipe = new MessagePipe(redisConn, Constants.MACH_STATS_M_QUEUE); +MessagePipe mpDayDurSendPipe = new MessagePipe(redisConn, Constants.MACH_DAY_DUR_M_QUEUE); Thread threadStatus = new Thread(calcParetoStatus); threadStatus.Start(); Thread threadDbMaint = new Thread(dbMaintenance); @@ -533,7 +534,7 @@ void calcParetoStatus() // recupero pareto da DB var newStatus = dbController.ParetoStatusMach(MachineId, inizio, fine); // riordino e aggiungo i dati di status... - var statusDTO = machineStatusConf + var statusAllDTO = machineStatusConf .Select(x => new ParetoStatusDTO() { CodStatus = $"MS_{x.MStatusID:000}", @@ -546,7 +547,7 @@ void calcParetoStatus() // ora ciclo tra i valori trovati... foreach (var item in newStatus) { - var recStatus = statusDTO.Where(x => x.CodStatus == item.CodStatus).FirstOrDefault(); + var recStatus = statusAllDTO.Where(x => x.CodStatus == item.CodStatus).FirstOrDefault(); if (recStatus != null) { recStatus.TotDuration = item.TotDuration; @@ -554,16 +555,25 @@ void calcParetoStatus() } // salvo i dati insieme alla traduzione degli stati relativa... - statusDTO = statusDTO + var statusActDTO = statusAllDTO .Where(x => x.TotDuration > 0) .OrderByDescending(x => x.TotDuration).ToList(); - // serializzo e salvo - string rawData = JsonConvert.SerializeObject(statusDTO); + // serializzo e salvo i valori x pareto + string rawData = JsonConvert.SerializeObject(statusActDTO); mpStatusParetoSendPipe.saveAndSendMessage(Constants.STATUS_PARETO_KEY, rawData); - // calcolo Current:MachStats (OEE e status macchina...) - var currMStatDTO = getMachStatDTO(statusDTO); + // calcolo le daily duration e invio + List currMDayDurDTO = getMachDayDurDTO(statusAllDTO); + if (currMDayDurDTO.Count > 0) + { + // serializzo e salvo + rawData = JsonConvert.SerializeObject(currMDayDurDTO); + mpDayDurSendPipe.saveAndSendMessage(Constants.MACH_DAY_DUR_CURR_KEY, rawData); + } + + // calcolo Current:MachStats (pareto status macchina...) + List currMStatDTO = getMachStatDTO(statusActDTO); if (currMStatDTO.Count > 0) { // serializzo e salvo @@ -602,17 +612,43 @@ void dbMaintenance() } while (true); } +List getMachDayDurDTO(List currStatus) +{ + List dayDurList = new List(); + // calcolo in minuti assoluti + int i = 0; + dayDurList = currStatus + .Select(x => new DisplayDataDTO() + { + Order = i++, + Type = "TIME", + Title = $"{x.Group} | {x.Description}", + ValueNum = x.TotDuration, + Value = $"{x.TotDuration:N2}", + DisplFormat = "N0", + MinVal = 0, + MaxVal = 1, + IsNumeric = true, + EnablePlot = true, + ShowBar = true, + HLShow = x.TotDuration > 5, + CssClass = x.CssClass + }) + .ToList(); + return dayDurList; +} + List getMachStatDTO(List currStatus) { List machStatList = new List(); - // calcolo OEE come % tempo RUN sul totale... + // calcolo come % tempo RUN sul totale... float globDur = currStatus.Sum(x => x.TotDuration); int i = 0; machStatList = currStatus .Select(x => new DisplayDataDTO() { Order = i++, - Type = "TIME", + Type = "PERC", Title = $"{x.Group} | {x.Description}", ValueNum = x.TotDuration / globDur, Value = $"{x.TotDuration / globDur:P1}", diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 6c0cfba..d9f6c0a 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                Version: 1.2.2303.2918

                                                +

                                                Version: 1.2.2303.3009


                                                Release Note:
                                                • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 4236344..1f6e279 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2918 +1.2.2303.3009 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 64f86ce..6142bc7 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2918 + 1.2.2303.3009 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/lua/StatusDecoder.lua b/MP.MONO.DECODER/lua/StatusDecoder.lua index 81dd074..2af9915 100644 --- a/MP.MONO.DECODER/lua/StatusDecoder.lua +++ b/MP.MONO.DECODER/lua/StatusDecoder.lua @@ -80,7 +80,7 @@ local function doCalc() -- calcolo dello statusId if(dataList["MACHINE STATUS"] == 0) then - statusId = 7 + statusId = 1 else if(dataList["PROCESS MODE"] == 1) then statusId = 8 diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index d4a67ab..dbc8c76 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.2918 + 1.2.2303.3009 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 6c0cfba..d9f6c0a 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                  Version: 1.2.2303.2918

                                                  +

                                                  Version: 1.2.2303.3009


                                                  Release Note:
                                                  • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 4236344..1f6e279 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.2918 +1.2.2303.3009 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index cc2108b..66f5018 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.2918 + 1.2.2303.3009 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From ae748ebeb28cf303449b2550050192767bcf4ebd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 30 Mar 2023 19:16:15 +0200 Subject: [PATCH 22/38] =?UTF-8?q?Update=20vers=20test=20DECODER=20-=20cabl?= =?UTF-8?q?ata=20logica=20C=C3=A0=20-=20test=20su=20WKST-SAM=20notturno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MP.MONO.ADAPTER.OPC/IobOpcUa.cs | 5 - MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/CounterManager.cs | 121 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 195 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.Data/Controllers/MpDbController.cs | 74 + MP.MONO.Data/DbConfig.cs | 2 + MP.MONO.Data/DbModels/CounterModel.cs | 6 + .../20230330165304_CounterAlias.Designer.cs | 1785 +++++++++++++++++ .../Migrations/20230330165304_CounterAlias.cs | 77 + .../MapoMonoContextModelSnapshot.cs | 12 + MP.MONO.Data/ModelBuilderExtensions.cs | 18 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.SIM/Simulator.cs | 4 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 27 files changed, 2136 insertions(+), 195 deletions(-) create mode 100644 MP.MONO.Data/Migrations/20230330165304_CounterAlias.Designer.cs create mode 100644 MP.MONO.Data/Migrations/20230330165304_CounterAlias.cs diff --git a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs index 0564e68..d2d68bc 100644 --- a/MP.MONO.ADAPTER.OPC/IobOpcUa.cs +++ b/MP.MONO.ADAPTER.OPC/IobOpcUa.cs @@ -909,11 +909,6 @@ namespace MP.MONO.ADAPTER.OPC // invio saveAndSendMessage(Constants.COUNT_CURR_KEY, Constants.COUNT_RAW_QUEUE, payloadParams); } - -#if false - // invio COMUNQUE negli eventi?!? - saveAndSendMessage("", Constants.RAW_EVENT_LOG_M_QUEUE, payload); -#endif } #endregion Protected Methods diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 1163a19..000df49 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3008 + 1.2.2303.3019 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index f738928..feec041 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                    Version: 1.2.2303.3008

                                                    +

                                                    Version: 1.2.2303.3019


                                                    Release Note:
                                                    • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index f4b8ff5..9873411 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3008 +1.2.2303.3019 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 96daab2..cebe509 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3008 + 1.2.2303.3019 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/CounterManager.cs b/MP.MONO.DECODER/CounterManager.cs index 216784c..6e37567 100644 --- a/MP.MONO.DECODER/CounterManager.cs +++ b/MP.MONO.DECODER/CounterManager.cs @@ -16,8 +16,43 @@ namespace MP.MONO.DECODER #endregion Public Fields + /// + /// DataOra ultimo check x confronto + /// + protected DateTime? dtLastCheck = null; + + /// + /// Accumulatore valori counter + /// + protected Dictionary countAccum = new Dictionary(); + + /// + /// Elenco ultimi valori ricevuti x confronto + /// + protected Dictionary lastStatusList = new Dictionary(); + #region Public Constructors + + /* -------------------------------------------------- + * processing in script LUA, partendo da + * - dataora corrente / dataora precedente + * - ultimo stato parametri (contatore, ultimo valore) + * - stato parametri ricevuti (contatore, ultimo valore) + * - stato contatori (contatore, valore cumulato) + * ... per ogni contatore gestito deciderà SE accumulare la frazione di minuti passati o meno + ---------------------------------------------------- */ + + // recupero i valori degl accumulatori + + // verifico cambio stato counter x accumulare i valori conteggi + + + + + /// + /// Getione contatori x check variazioni e accumulazione conteggi + /// public CounterManager() { // preparo variabile x avvisare script che il modo è da NLua @@ -37,20 +72,65 @@ namespace MP.MONO.DECODER #region Public Methods /// - /// Funzione chiamata LUA x calcolo degli eventuali parametri con periodi "scaduti" + /// Funzione chiamata (LUA) x controllo contatori + update in oggetto counter da persistere /// - /// - /// - /// - public List processData(Dictionary paramsList, List redisParamConf) + /// Situazione valori attuale + /// Dizionario valori da salvare... + public Dictionary processData(Dictionary newStatusList) { - List answ = new List(); DateTime adesso = DateTime.Now; - - // vado ad "accumulare i dati" a quelli presenti... - foreach (var item in paramsList) + // accumulo solo se ho un dat temporale precedente + if (dtLastCheck != null) { - var currParam = redisParamConf.FirstOrDefault(x => x.Title == item.Key); + var delta = adesso.Subtract((DateTime)dtLastCheck).TotalMinutes; + + // vado ad "accumulare i dati" a quelli presenti verificando 1:1... + foreach (var item in newStatusList) + { + bool doAdd = false; + // metodo CSharp (da tradurre LUA...) + if (lastStatusList.ContainsKey(item.Key)) + { + var currParam = lastStatusList.FirstOrDefault(x => x.Key == item.Key); + // se trovato --> confronto... + switch (item.Key) + { + case "MACHINE STATUS": + // se 1--> 1 conto! + doAdd = item.Value == "1" && currParam.Value == "1"; + break; + case "PROCESS STATUS": + // se 1--> 1 conto! + doAdd = item.Value == "2" && currParam.Value == "2"; + break; + case "SPINDLE 1 LOAD": + case "SPINDLE 2 LOAD": + case "SPINDLE 3 LOAD": + case "SPINDLE 4 LOAD": + // se 1--> 1 conto! + doAdd = item.Value != "0" && currParam.Value != "0"; + break; + default: + break; + } + if (doAdd) + { + if (countAccum.ContainsKey(item.Key)) + { + countAccum[item.Key] += delta; + } + else + { + countAccum.Add(item.Key, delta); + } + } + lastStatusList[item.Key] = item.Value; + } + else + { + lastStatusList.Add(item.Key, item.Value); + } +#if false // cerco nelle variabili accomulatori... if (!ParamsAccumulator.ContainsKey(item.Key)) { @@ -124,10 +204,29 @@ namespace MP.MONO.DECODER // elimino dai valori accumulati... ParamsAccumulator.Remove(item.Key); } + } +#endif } } + // salvo lastCheck + dtLastCheck = adesso; - return answ; + return countAccum; + } + + /// + /// Resetta l'accumulatore indicato + /// + /// + /// + public bool resetAccum(string accKey) + { + bool fatto = false; + if(countAccum.ContainsKey(accKey)) + { + countAccum[accKey] = 0; + } + return fatto; } #endregion Public Methods diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 0f5d266..4975efe 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3009 + 1.2.2303.3019 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 3db8a06..9a9e1a0 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -88,6 +88,7 @@ List? alarmsRListConf = new List(); List? alarmsRecorded = new List(); List? machineModeConf = new List(); List? machineStatusConf = new List(); +List? countStatus = new List(); MachineDTO machinePlate = new MachineDTO(); // gestione configurazioni da redis @@ -119,6 +120,8 @@ Thread threadStatus = new Thread(calcParetoStatus); threadStatus.Start(); Thread threadDbMaint = new Thread(dbMaintenance); threadDbMaint.Start(); +Thread threadPersistCount = new Thread(persistCount); +threadPersistCount.Start(); /* -------------------------------- * Setup Gestione Counters @@ -127,8 +130,6 @@ CounterManager counterMan = new CounterManager(); // inizializzo gestione messagePipe da Redis x allarmi MessagePipe counterSendPipe = new MessagePipe(redisConn, Constants.COUNT_M_QUEUE); MessagePipe counterRecvPipe = new MessagePipe(redisConn, Constants.COUNT_RAW_QUEUE); -// datetime dell'inizio esecuzione task... x usare un semaforo di veto doppia esecuzione entro 30 sec -DateTime lastExecCounters = DateTime.Now.AddHours(-1); // registro gestione eventi counterRecvPipe.EA_NewMessage += CounterRecvPipe_EA_NewMessage; @@ -590,7 +591,7 @@ void dbMaintenance() { // ricalcolo ogni 120 min CIRCA +/- 2% int msecOra = 1000 * 60 * 120; - int minPeriod = msecOra * 98/100; + int minPeriod = msecOra * 98 / 100; int maxPeriod = msecOra * 102 / 100; // leggo conf x giorni da tenere... @@ -600,7 +601,7 @@ void dbMaintenance() { // effettuo su DB chiamata stored x pulizia dati vecchi var cleanupResult = dbController.RemoveOldData(NumDay2Keep); - + // loggo esito cleanup eseguito foreach (var item in cleanupResult) { @@ -612,6 +613,26 @@ void dbMaintenance() } while (true); } + +void persistCount() +{ + // eseguo ogni 5 min CIRCA +/- 2% + int msecOra = 1000 * 60 * 5; + int minPeriod = msecOra * 98 / 100; + int maxPeriod = msecOra * 102 / 100; + + // per prima cosa leggo i counters attuali... + countStatus = dbController.CountersGetAll(); + do + { + // salvo su DB valori counters + _ = dbController.CountersUpsertMany(countStatus); + Log.Debug($"Counters: {countStatus.Count} saved"); + + // attesa random da periodo... + Thread.Sleep(rand.Next(minPeriod, maxPeriod)); + } while (true); +} List getMachDayDurDTO(List currStatus) { List dayDurList = new List(); @@ -1578,169 +1599,39 @@ void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) // conversione on-the-fly Dictionary --> parametri valorizzati (tra quelli configurati) if (!string.IsNullOrEmpty(currArgs.newMessage)) { -#if false - DateTime adesso = DateTime.Now; try { // verifico codici ricevuti var dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); + //int valInt = 0; if (dataList != null) { - /************************************************************************ - * - * - * - * - * - * - * - * - * - * - * - *************************************************************************/ - - // recupero elenco parametri salvati in redis... - MachineDTO? machinePlate = new MachineDTO(); - - string rawData = redisDb.StringGet(Constants.MACHINE_CONF_PLATE); - if (!string.IsNullOrEmpty(rawData)) + // chiamo metodo CounterManager... + var incrSet = counterMan.processData(dataList); + if (incrSet != null) { - machinePlate = JsonConvert.DeserializeObject(rawData); - } - int machStatus = 0; - int procStatus = 0; - int procMode = 0; - string currKey = ""; - - // ora processo il messaggio ricevuto x stati e modi vari - currKey = "MACHINE STATUS"; - if (dataList.ContainsKey(currKey)) - { - int.TryParse(dataList[currKey], out machStatus); - } - currKey = "PROCESS STATUS"; - if (dataList.ContainsKey(currKey)) - { - int.TryParse(dataList[currKey], out procStatus); - } - currKey = "PROCESS MODE"; - if (dataList.ContainsKey(currKey)) - { - int.TryParse(dataList[currKey], out procMode); - } - - // fix me todo inserire gestione program name!!! - - if (machStatus == 0) - { - machinePlate.StatusId = 7; - } - else - { - switch (procMode) + foreach (var item in incrSet) { - case 1: - machinePlate.StatusId = 8; - break; - - case 2: - machinePlate.StatusId = 2; - break; - - case 3: - machinePlate.StatusId = 9; - break; - - case 4: - machinePlate.StatusId = 5; - break; - - case 5: - machinePlate.StatusId = 10; - break; - - case 6: - machinePlate.StatusId = 11; - break; - - case 7: - machinePlate.StatusId = 12; - break; - - case 8: - machinePlate.StatusId = 13; - break; - - default: - break; + // verifico i valori > soglia... + if (item.Value > 0.5) + { + // salvo + var countRec = countStatus.Where(x => x.CCode == item.Key || x.CodAlias == item.Key).FirstOrDefault(); + if (countRec != null) + { + countRec.ActualVal = countRec.ActualVal + item.Value; + // resetto + counterMan.resetAccum(item.Key); + } + } } } - - // eseguo cablata la gestione x ora... rispetto a MachineStatus + MachineMode - // invierò un machineDTO - switch (procStatus) - { - case 1: - machinePlate.ModeId = 2; - break; - - case 2: - machinePlate.ModeId = 1; - break; - - case 3: - machinePlate.ModeId = 3; - break; - - case 6: - machinePlate.ModeId = 8; - break; - - case 8: - machinePlate.ModeId = 9; - break; - - case 11: - machinePlate.ModeId = 10; - break; - - default: - break; - } - - // invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati - string updRawVal = JsonConvert.SerializeObject(machinePlate); - paramsSendPipe.saveAndSendMessage(Constants.STATUS_CURR_KEY, updRawVal); } } catch (Exception exc) { - Log.Error($"Eccezione in MpStatusRecvPipe_EA_NewMessage:{Environment.NewLine}{exc}"); + Log.Error($"Eccezione in CounterRecvPipe_EA_NewMessage:{Environment.NewLine}{exc}"); } -#endif } } diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index d9f6c0a..feec041 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                      Version: 1.2.2303.3009

                                                      +

                                                      Version: 1.2.2303.3019


                                                      Release Note:
                                                      • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 1f6e279..9873411 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3009 +1.2.2303.3019 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 6142bc7..e19e6f1 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3009 + 1.2.2303.3019 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 3f8ac7b..59ae03e 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -621,6 +621,80 @@ namespace MP.MONO.Data.Controllers return fatto; } + /// + /// Recupero counters da DB + /// + /// + public List CountersGetAll() + { + List dbResult = new List(); + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + dbResult = localDbCtx + .DbSetCounter + .AsNoTracking() + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante CountersGetAll{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Inserimento/Update di una lista counters + /// + /// Lista Record da inserire + /// + public bool CountersUpsertMany(List newItems) + { + bool fatto = false; + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + if (newItems.Count > 0) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + // x ogni valore cerco... + foreach (var item in newItems) + { + var oldRec = localDbCtx + .DbSetCounter + .Where(x => x.CCode == item.CCode) + .FirstOrDefault(); + if (oldRec == null) + { + localDbCtx + .DbSetCounter + .Add(item); + } + else + { + oldRec.ActualVal = item.ActualVal; + localDbCtx.Entry(oldRec).State = EntityState.Modified; + } + } + // salvo le modifiche + localDbCtx.SaveChanges(); + fatto = true; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Info($"CountersUpsertMany| DB upsert | {newItems.Count} rec | {ts.TotalMilliseconds} ms"); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante CountersUpsertMany{Environment.NewLine}{exc}"); + } + } + return fatto; + } /// /// Recupero DataLogDTO data condizione filtro /// diff --git a/MP.MONO.Data/DbConfig.cs b/MP.MONO.Data/DbConfig.cs index a214869..f0a5fac 100644 --- a/MP.MONO.Data/DbConfig.cs +++ b/MP.MONO.Data/DbConfig.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore; +using MP.MONO.Data.DbModels; namespace MP.MONO.Data { @@ -37,6 +38,7 @@ namespace MP.MONO.Data return DbAdmin.checkCreateUser(DATABASE_USER, DATABASE_PWD); } + public static bool ExecMigrationIdentity() { // esecuzione migrazione diff --git a/MP.MONO.Data/DbModels/CounterModel.cs b/MP.MONO.Data/DbModels/CounterModel.cs index 325599d..35f352d 100644 --- a/MP.MONO.Data/DbModels/CounterModel.cs +++ b/MP.MONO.Data/DbModels/CounterModel.cs @@ -19,6 +19,12 @@ namespace MP.MONO.Data.DbModels [Key, DatabaseGenerated(DatabaseGeneratedOption.None), MaxLength(250)] public string CCode { get; set; } = ""; + /// + /// Counter Code Alias + /// + [MaxLength(250)] + public string CodAlias { get; set; } = ""; + /// /// Descrizione /// diff --git a/MP.MONO.Data/Migrations/20230330165304_CounterAlias.Designer.cs b/MP.MONO.Data/Migrations/20230330165304_CounterAlias.Designer.cs new file mode 100644 index 0000000..b780d00 --- /dev/null +++ b/MP.MONO.Data/Migrations/20230330165304_CounterAlias.Designer.cs @@ -0,0 +1,1785 @@ +// +using System; +using MP.MONO.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + [DbContext(typeof(MapoMonoContext))] + [Migration("20230330165304_CounterAlias")] + partial class CounterAlias + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmListModel", b => + { + b.Property("AlarmId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("FullValue") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmId"); + + b.ToTable("AlarmList"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.Property("AlarmLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("MemAddress") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Status") + .HasColumnType("int unsigned"); + + b.Property("ValDecoded") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("AlarmLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.Property("AlarmRecId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AlarmId") + .HasColumnType("int"); + + b.Property("DtEnd") + .HasColumnType("datetime(6)"); + + b.Property("DtStart") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.HasKey("AlarmRecId"); + + b.HasIndex("AlarmId"); + + b.HasIndex("MachineId"); + + b.ToTable("AlarmRec"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AnKeyValModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Descript") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValFloat") + .HasColumnType("int"); + + b.Property("ValInt") + .HasColumnType("int"); + + b.Property("ValString") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("AnKeyVal"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ConfigModel", b => + { + b.Property("KeyName") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("Val") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ValStd") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("KeyName"); + + b.ToTable("Config"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.CounterModel", b => + { + b.Property("CCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ActualVal") + .HasColumnType("double"); + + b.Property("CodAlias") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.Property("LastReset") + .HasColumnType("datetime(6)"); + + b.HasKey("CCode"); + + b.ToTable("Counter"); + + b.HasData( + new + { + CCode = "MacPowerOn", + ActualVal = 0.0, + CodAlias = "", + Description = "Machine Power On", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "CycleProc01", + ActualVal = 0.0, + CodAlias = "", + Description = "Process 1 on Cycle state", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque01", + ActualVal = 0.0, + CodAlias = "", + Description = "Spindle 01 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque02", + ActualVal = 0.0, + CodAlias = "", + Description = "Spindle 02 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque03", + ActualVal = 0.0, + CodAlias = "", + Description = "Spindle 03 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "SpindleTorque04", + ActualVal = 0.0, + CodAlias = "", + Description = "Spindle 04 Torque % > 0", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + CCode = "LMCheckElapsed", + ActualVal = 0.0, + CodAlias = "", + Description = "Time Elapsed from last full Manufacturer Check", + LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.Property("DataLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DataType") + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("FluxType") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumRec") + .HasColumnType("double"); + + b.Property("ValNumAvg") + .HasColumnType("double"); + + b.Property("ValNumMax") + .HasColumnType("double"); + + b.Property("ValNumMin") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("MachineId"); + + b.ToTable("DataStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodEvent") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodEvent"); + + b.HasIndex("MachineId"); + + b.ToTable("EventLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventModel", b => + { + b.Property("CodEvent") + .HasColumnType("varchar(255)"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("IsUser") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodEvent"); + + b.ToTable("Event"); + + b.HasData( + new + { + CodEvent = "", + Active = true, + Description = "NA", + IsUser = false + }, + new + { + CodEvent = "Run", + Active = true, + Description = "Running", + IsUser = true + }, + new + { + CodEvent = "Setup", + Active = true, + Description = "Machine Setup", + IsUser = true + }, + new + { + CodEvent = "ProgEdit", + Active = true, + Description = "Program Editing", + IsUser = true + }, + new + { + CodEvent = "Fill", + Active = true, + Description = "Machine Fill", + IsUser = true + }, + new + { + CodEvent = "SetError", + Active = true, + Description = "Error", + IsUser = true + }, + new + { + CodEvent = "WuCd", + Active = true, + Description = "Warm Up / CoolDown Machine", + IsUser = false + }, + new + { + CodEvent = "ContrPwr", + Active = true, + Description = "Controlled PowerOn / ShutDown", + IsUser = false + }, + new + { + CodEvent = "ProgMiss", + Active = true, + Description = "Program Missing", + IsUser = true + }, + new + { + CodEvent = "HRMiss", + Active = true, + Description = "HR Missing", + IsUser = true + }, + new + { + CodEvent = "Maint", + Active = true, + Description = "Maintenance", + IsUser = true + }, + new + { + CodEvent = "Clean", + Active = true, + Description = "Machine CleanUp", + IsUser = true + }, + new + { + CodEvent = "SetPwrOff", + Active = true, + Description = "Power OFF Declaration", + IsUser = true + }, + new + { + CodEvent = "Init", + Active = true, + Description = "Init", + IsUser = false + }, + new + { + CodEvent = "PowerOff", + Active = true, + Description = "Power OFF", + IsUser = false + }, + new + { + CodEvent = "PowerOn", + Active = true, + Description = "Power ON", + IsUser = false + }, + new + { + CodEvent = "Cycle", + Active = true, + Description = "Machining", + IsUser = false + }, + new + { + CodEvent = "EndCycle", + Active = true, + Description = "End machining", + IsUser = false + }, + new + { + CodEvent = "Error", + Active = true, + Description = "Error", + IsUser = false + }, + new + { + CodEvent = "PzCount", + Active = true, + Description = "Item Count(+1)", + IsUser = false + }, + new + { + CodEvent = "StartPall", + Active = true, + Description = "Start pallet", + IsUser = false + }, + new + { + CodEvent = "EndPall", + Active = true, + Description = "End pallet", + IsUser = false + }, + new + { + CodEvent = "Manual", + Active = true, + Description = "Manual", + IsUser = false + }, + new + { + CodEvent = "LOutFull", + Active = true, + Description = "Line Out Full", + IsUser = false + }, + new + { + CodEvent = "LInEmpty", + Active = true, + Description = "Line In Empty", + IsUser = false + }, + new + { + CodEvent = "CycleTOut", + Active = true, + Description = "Timeout Std CycleTime", + IsUser = false + }, + new + { + CodEvent = "RMatMiss", + Active = true, + Description = "Raw Material Missing", + IsUser = true + }, + new + { + CodEvent = "Emergency", + Active = true, + Description = "Emergency", + IsUser = false + }, + new + { + CodEvent = "ToolRepl", + Active = true, + Description = "Tool Replacement", + IsUser = true + }, + new + { + CodEvent = "CncAlam", + Active = true, + Description = "CNC Alarm", + IsUser = false + }, + new + { + CodEvent = "PlcAlam", + Active = true, + Description = "PLC Alarm", + IsUser = false + }, + new + { + CodEvent = "Warning", + Active = true, + Description = "Warning State", + IsUser = false + }, + new + { + CodEvent = "Message", + Active = true, + Description = "Machine Message", + IsUser = false + }, + new + { + CodEvent = "PzIncr", + Active = true, + Description = "Item Count Increment", + IsUser = false + }, + new + { + CodEvent = "PzSet", + Active = true, + Description = "Item Count Set", + IsUser = false + }, + new + { + CodEvent = "UserComm", + Active = true, + Description = "User Comment", + IsUser = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.MachineModel", b => + { + b.Property("MachineId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BuildYear") + .HasColumnType("int"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Model") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Serial") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("MachineId"); + + b.ToTable("Machine"); + + b.HasData( + new + { + MachineId = 1, + BuildYear = 2023, + Code = "", + Description = "Default SIM Machine", + Model = "Egalware SIM", + Name = "EGW-SIM-Machine", + Serial = "SN-0000-0000-0000" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ParetoStatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("TotDuration") + .HasColumnType("float"); + + b.HasKey("CodStatus"); + + b.ToView("v_ParetoStatus"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.Property("SMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("CountStartVal") + .HasColumnType("double"); + + b.Property("DtCreation") + .HasColumnType("datetime(6)"); + + b.Property("DtExecution") + .HasColumnType("datetime(6)"); + + b.Property("ElapsedVal") + .HasColumnType("double"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("PMTaskId") + .HasColumnType("int"); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("PMTaskId"); + + b.ToTable("PendingMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMMGroupModel", b => + { + b.Property("PMMGCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMMGCode"); + + b.ToTable("MachineGroup"); + + b.HasData( + new + { + PMMGCode = "Whole", + Description = "Whole Machine" + }, + new + { + PMMGCode = "Load", + Description = "Part loader/unloader" + }, + new + { + PMMGCode = "MovBelts", + Description = "Part moving belts" + }, + new + { + PMMGCode = "MovRoll", + Description = "Part moving rollers" + }, + new + { + PMMGCode = "Axis", + Description = "Machining axis" + }, + new + { + PMMGCode = "Spindles", + Description = "Tool spindles" + }, + new + { + PMMGCode = "ToolChange", + Description = "Automatic tool changer" + }, + new + { + PMMGCode = "Cabinet", + Description = "Electrical cabinet" + }, + new + { + PMMGCode = "ChipConv", + Description = "Chips conveyor" + }, + new + { + PMMGCode = "DustSuct", + Description = "Dust suction" + }, + new + { + PMMGCode = "OpPanel", + Description = "Operator pannel" + }, + new + { + PMMGCode = "Access", + Description = "Accessories" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMTaskTopicModel", b => + { + b.Property("PMTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMTCode"); + + b.ToTable("TaskTopic"); + + b.HasData( + new + { + PMTCode = "Mechanical", + Description = "Mechanical system" + }, + new + { + PMTCode = "Electro", + Description = "Electrical system" + }, + new + { + PMTCode = "Lubro", + Description = "Lubrication system" + }, + new + { + PMTCode = "Coolant", + Description = "Coolant system" + }, + new + { + PMTCode = "Preumo", + Description = "Pneumatic system" + }, + new + { + PMTCode = "Hydro", + Description = "Hydraulic system" + }, + new + { + PMTCode = "Safety", + Description = "Enclosure/Safety system" + }, + new + { + PMTCode = "Suction", + Description = "Suction system" + }, + new + { + PMTCode = "GeoAdj", + Description = "Geometrical system" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PMUTModel", b => + { + b.Property("PMUTCode") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("varchar(500)"); + + b.HasKey("PMUTCode"); + + b.ToTable("UserTeam"); + + b.HasData( + new + { + PMUTCode = "TrainOp", + Description = "Trained Operator" + }, + new + { + PMUTCode = "MaintServ", + Description = "Maintenance Service" + }, + new + { + PMUTCode = "DevSupp", + Description = "Device Supplier" + }, + new + { + PMUTCode = "MultiaxServ", + Description = "Multiax Service" + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.Property("PMTaskId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("ExpiryVal") + .HasColumnType("double"); + + b.Property("ExtIdx") + .HasColumnType("int"); + + b.Property("IsDisabled") + .HasColumnType("tinyint(1)"); + + b.Property("JobDescription") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("NumTaskDone") + .HasColumnType("int"); + + b.Property("PMMGCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("PMUTCode") + .IsRequired() + .HasColumnType("varchar(250)"); + + b.Property("Protected") + .HasColumnType("tinyint(1)"); + + b.HasKey("PMTaskId"); + + b.HasIndex("CCode"); + + b.HasIndex("MachineId"); + + b.HasIndex("PMMGCode"); + + b.HasIndex("PMTCode"); + + b.HasIndex("PMUTCode"); + + b.ToTable("PrevMaintTask"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.Property("ProdLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("EvType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExtRef") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValNum") + .HasColumnType("double"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("ProdLogId"); + + b.HasIndex("MachineId"); + + b.ToTable("ProdLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.Property("EventLogId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("EventLogId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusLog"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusModel", b => + { + b.Property("CodStatus") + .HasColumnType("varchar(255)"); + + b.Property("CssClass") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CssClassOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("GroupOvr") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Prior") + .HasColumnType("int"); + + b.Property("ShowProdItem") + .HasColumnType("tinyint(1)"); + + b.HasKey("CodStatus"); + + b.ToTable("Status"); + + b.HasData( + new + { + CodStatus = "", + CssClass = "dark", + CssClassOvr = "", + Description = "NA", + Group = "NA", + GroupOvr = "", + Prior = 0, + ShowProdItem = true + }, + new + { + CodStatus = "Error", + CssClass = "danger", + CssClassOvr = "", + Description = "Error", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Emergency", + CssClass = "danger", + CssClassOvr = "", + Description = "Emergency", + Group = "StopRed", + GroupOvr = "", + Prior = 5, + ShowProdItem = true + }, + new + { + CodStatus = "Manual", + CssClass = "warning", + CssClassOvr = "", + Description = "Manual", + Group = "ManYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "PzProd", + CssClass = "warning", + CssClassOvr = "", + Description = "Item Produced", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "Unkn", + CssClass = "warning", + CssClassOvr = "", + Description = "Unknown Stop", + Group = "MicroYellow", + GroupOvr = "", + Prior = 4, + ShowProdItem = true + }, + new + { + CodStatus = "ProgMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "Program Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "HRMissing", + CssClass = "danger", + CssClassOvr = "", + Description = "HR Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Maint", + CssClass = "warning", + CssClassOvr = "", + Description = "Maintenance", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineOutFull", + CssClass = "danger", + CssClassOvr = "", + Description = "Line Out Full", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "LineInEmpty", + CssClass = "danger", + CssClassOvr = "", + Description = "Line In Empty", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "RawMatMiss", + CssClass = "danger", + CssClassOvr = "", + Description = "Raw Material Missing", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "CncAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "CNC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PlcAlam", + CssClass = "danger", + CssClassOvr = "", + Description = "PLC Alarm", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "WUpCDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Warm Up / CoolDown Machine", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ContrPOnSDown", + CssClass = "primary", + CssClassOvr = "", + Description = "Controller PowerOn / ShutDown", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Init", + CssClass = "primary", + CssClassOvr = "", + Description = "Init", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOn", + CssClass = "primary", + CssClassOvr = "", + Description = "Power ON", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "TimeoutCycle", + CssClass = "primary", + CssClassOvr = "", + Description = "Timeout Std CycleTime", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Waiting", + CssClass = "primary", + CssClassOvr = "", + Description = "Waiting State", + Group = "WaitBlue", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ProgEdit", + CssClass = "warning", + CssClassOvr = "", + Description = "Program Editing", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Setup", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Setup", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Clean", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine CleanUp", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Fill", + CssClass = "warning", + CssClassOvr = "", + Description = "Machine Fill", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "ToolReplace", + CssClass = "warning", + CssClassOvr = "", + Description = "Tool Replacement", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Warning", + CssClass = "warning", + CssClassOvr = "", + Description = "Warning State", + Group = "MicroYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "PowerOff", + CssClass = "secondary", + CssClassOvr = "", + Description = "Power OFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Run", + CssClass = "success", + CssClassOvr = "", + Description = "Running", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "Cycle", + CssClass = "success", + CssClassOvr = "", + Description = "Machining", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_000", + CssClass = "secondary", + CssClassOvr = "", + Description = "UNDEFINED", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_001", + CssClass = "secondary", + CssClassOvr = "", + Description = "POWEROFF", + Group = "Gray", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_002", + CssClass = "success", + CssClassOvr = "", + Description = "AUTOMATIC", + Group = "Green", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_003", + CssClass = "warning", + CssClassOvr = "", + Description = "EDIT", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_004", + CssClass = "warning", + CssClassOvr = "", + Description = "SEMIAUTOMATIC", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_005", + CssClass = "warning", + CssClassOvr = "", + Description = "MANUAL_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_006", + CssClass = "danger", + CssClassOvr = "", + Description = "ALARM", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_007", + CssClass = "danger", + CssClassOvr = "", + Description = "ESTOP", + Group = "StopRed", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_008", + CssClass = "warning", + CssClassOvr = "", + Description = "MDI", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_009", + CssClass = "warning", + CssClassOvr = "", + Description = "STEP", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_010", + CssClass = "warning", + CssClassOvr = "", + Description = "INC_JOG", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_011", + CssClass = "warning", + CssClassOvr = "", + Description = "PROFILE", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_012", + CssClass = "warning", + CssClassOvr = "", + Description = "HOME", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }, + new + { + CodStatus = "MS_013", + CssClass = "warning", + CssClassOvr = "", + Description = "HANDWHEEL", + Group = "ManYellow", + GroupOvr = "", + Prior = 1, + ShowProdItem = true + }); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.Property("DataStAgId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodStatus") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Duration") + .HasColumnType("float"); + + b.Property("MachineId") + .HasColumnType("int"); + + b.Property("ValStr") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("DataStAgId"); + + b.HasIndex("CodStatus"); + + b.HasIndex("MachineId"); + + b.ToTable("StatusStAg"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.TaskExecModel", b => + { + b.Property("TaskID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CodTask") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DtRif") + .HasColumnType("datetime(6)"); + + b.Property("Result") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("TaskID"); + + b.ToTable("TaskExec"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.AlarmRecModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.AlarmListModel", "AlarmListNav") + .WithMany() + .HasForeignKey("AlarmId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("AlarmListNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.DataStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.EventLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.EventModel", "CodEventNav") + .WithMany() + .HasForeignKey("CodEvent") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodEventNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PendingMaintModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PrevMaintTaskModel", "PMTaskeNav") + .WithMany() + .HasForeignKey("PMTaskId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("PMTaskeNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.PrevMaintTaskModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.CounterModel", "CounterNav") + .WithMany() + .HasForeignKey("CCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMMGroupModel", "MachGroupNav") + .WithMany() + .HasForeignKey("PMMGCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMTaskTopicModel", "TopicNav") + .WithMany() + .HasForeignKey("PMTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.PMUTModel", "UserTeamNav") + .WithMany() + .HasForeignKey("PMUTCode") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CounterNav"); + + b.Navigation("MachGroupNav"); + + b.Navigation("MachineNav"); + + b.Navigation("TopicNav"); + + b.Navigation("UserTeamNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.ProdLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusLogModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); + + modelBuilder.Entity("MP.MONO.Data.DbModels.StatusStAgModel", b => + { + b.HasOne("MP.MONO.Data.DbModels.StatusModel", "CodStatusNav") + .WithMany() + .HasForeignKey("CodStatus") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("MP.MONO.Data.DbModels.MachineModel", "MachineNav") + .WithMany() + .HasForeignKey("MachineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CodStatusNav"); + + b.Navigation("MachineNav"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MP.MONO.Data/Migrations/20230330165304_CounterAlias.cs b/MP.MONO.Data/Migrations/20230330165304_CounterAlias.cs new file mode 100644 index 0000000..26466b5 --- /dev/null +++ b/MP.MONO.Data/Migrations/20230330165304_CounterAlias.cs @@ -0,0 +1,77 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MP.MONO.Data.Migrations +{ + public partial class CounterAlias : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CodAlias", + table: "Counter", + type: "varchar(250)", + maxLength: 250, + nullable: false, + defaultValue: "") + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "CycleProc01", + column: "CodAlias", + value: "PROCESS STATUS"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "LMCheckElapsed", + column: "CodAlias", + value: ""); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "MacPowerOn", + column: "CodAlias", + value: "MACHINE STATUS"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "SpindleTorque01", + column: "CodAlias", + value: "SPINDLE 1 LOAD"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "SpindleTorque02", + column: "CodAlias", + value: "SPINDLE 2 LOAD"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "SpindleTorque03", + column: "CodAlias", + value: "SPINDLE 3 LOAD"); + + migrationBuilder.UpdateData( + table: "Counter", + keyColumn: "CCode", + keyValue: "SpindleTorque04", + column: "CodAlias", + value: "SPINDLE 4 LOAD"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CodAlias", + table: "Counter"); + } + } +} diff --git a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs index 2346704..28fb19b 100644 --- a/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs +++ b/MP.MONO.Data/Migrations/MapoMonoContextModelSnapshot.cs @@ -157,6 +157,11 @@ namespace MP.MONO.Data.Migrations b.Property("ActualVal") .HasColumnType("double"); + b.Property("CodAlias") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + b.Property("Description") .IsRequired() .HasMaxLength(500) @@ -174,6 +179,7 @@ namespace MP.MONO.Data.Migrations { CCode = "MacPowerOn", ActualVal = 0.0, + CodAlias = "", Description = "Machine Power On", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -181,6 +187,7 @@ namespace MP.MONO.Data.Migrations { CCode = "CycleProc01", ActualVal = 0.0, + CodAlias = "", Description = "Process 1 on Cycle state", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -188,6 +195,7 @@ namespace MP.MONO.Data.Migrations { CCode = "SpindleTorque01", ActualVal = 0.0, + CodAlias = "", Description = "Spindle 01 Torque % > 0", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -195,6 +203,7 @@ namespace MP.MONO.Data.Migrations { CCode = "SpindleTorque02", ActualVal = 0.0, + CodAlias = "", Description = "Spindle 02 Torque % > 0", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -202,6 +211,7 @@ namespace MP.MONO.Data.Migrations { CCode = "SpindleTorque03", ActualVal = 0.0, + CodAlias = "", Description = "Spindle 03 Torque % > 0", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -209,6 +219,7 @@ namespace MP.MONO.Data.Migrations { CCode = "SpindleTorque04", ActualVal = 0.0, + CodAlias = "", Description = "Spindle 04 Torque % > 0", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, @@ -216,6 +227,7 @@ namespace MP.MONO.Data.Migrations { CCode = "LMCheckElapsed", ActualVal = 0.0, + CodAlias = "", Description = "Time Elapsed from last full Manufacturer Check", LastReset = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }); diff --git a/MP.MONO.Data/ModelBuilderExtensions.cs b/MP.MONO.Data/ModelBuilderExtensions.cs index 047db8e..49db863 100644 --- a/MP.MONO.Data/ModelBuilderExtensions.cs +++ b/MP.MONO.Data/ModelBuilderExtensions.cs @@ -85,7 +85,7 @@ namespace MP.MONO.Data , new StatusModel { Prior = 1, CodStatus = "PowerOn", Description = "Power ON", CssClass = "primary", Group = "WaitBlue" } , new StatusModel { Prior = 1, CodStatus = "TimeoutCycle", Description = "Timeout Std CycleTime", CssClass = "primary", Group = "WaitBlue" } , new StatusModel { Prior = 1, CodStatus = "Waiting", Description = "Waiting State", CssClass = "primary", Group = "WaitBlue" } - + // fermo giallo manuale , new StatusModel { Prior = 1, CodStatus = "ProgEdit", Description = "Program Editing", CssClass = "warning", Group = "ManYellow" } , new StatusModel { Prior = 1, CodStatus = "Setup", Description = "Machine Setup", CssClass = "warning", Group = "ManYellow" } @@ -96,7 +96,7 @@ namespace MP.MONO.Data // macchina spenta , new StatusModel { Prior = 1, CodStatus = "PowerOff", Description = "Power OFF", CssClass = "secondary", Group = "Gray" } - + // produzione , new StatusModel { Prior = 1, CodStatus = "Run", Description = "Running", CssClass = "success", Group = "Green" } , new StatusModel { Prior = 1, CodStatus = "Cycle", Description = "Machining", CssClass = "success", Group = "Green" } @@ -122,13 +122,13 @@ namespace MP.MONO.Data // inizializzazione dei valori di default x Tipologia counters modelBuilder.Entity().HasData( - new CounterModel { CCode = "MacPowerOn", Description = "Machine Power On" }, - new CounterModel { CCode = "CycleProc01", Description = "Process 1 on Cycle state" }, - new CounterModel { CCode = "SpindleTorque01", Description = "Spindle 01 Torque % > 0" }, - new CounterModel { CCode = "SpindleTorque02", Description = "Spindle 02 Torque % > 0" }, - new CounterModel { CCode = "SpindleTorque03", Description = "Spindle 03 Torque % > 0" }, - new CounterModel { CCode = "SpindleTorque04", Description = "Spindle 04 Torque % > 0" }, - new CounterModel { CCode = "LMCheckElapsed", Description = "Time Elapsed from last full Manufacturer Check" } + new CounterModel { CCode = "MacPowerOn", Description = "Machine Power On", CodAlias = "MACHINE STATUS" }, + new CounterModel { CCode = "CycleProc01", Description = "Process 1 on Cycle state", CodAlias = "PROCESS STATUS" }, + new CounterModel { CCode = "SpindleTorque01", Description = "Spindle 01 Torque % > 0", CodAlias = "SPINDLE 1 LOAD" }, + new CounterModel { CCode = "SpindleTorque02", Description = "Spindle 02 Torque % > 0", CodAlias = "SPINDLE 2 LOAD" }, + new CounterModel { CCode = "SpindleTorque03", Description = "Spindle 03 Torque % > 0", CodAlias = "SPINDLE 3 LOAD" }, + new CounterModel { CCode = "SpindleTorque04", Description = "Spindle 04 Torque % > 0", CodAlias = "SPINDLE 4 LOAD" }, + new CounterModel { CCode = "LMCheckElapsed", Description = "Time Elapsed from last full Manufacturer Check", CodAlias = "Manual Fix" } ); // inizializzazione dei valori di default x Tipologia UserTeam diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index e466680..0f778fd 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3009 + 1.2.2303.3019 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index d9f6c0a..feec041 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                        Version: 1.2.2303.3009

                                                        +

                                                        Version: 1.2.2303.3019


                                                        Release Note:
                                                        • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 1f6e279..9873411 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3009 +1.2.2303.3019 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index f0955eb..ac53655 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3009 + 1.2.2303.3019 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/Simulator.cs b/MP.MONO.SIM/Simulator.cs index eba8581..7dbb509 100644 --- a/MP.MONO.SIM/Simulator.cs +++ b/MP.MONO.SIM/Simulator.cs @@ -91,8 +91,8 @@ namespace MachineSim { Dictionary answ = new Dictionary(); - // simulo stato macchina ad 1 nel 99.5% (0 nel 0.5% dei casi - if (rand.Next(0, 1000) < 995) + // simulo stato macchina ad 1 nel 99% (0 nel 1% dei casi + if (rand.Next(0, 1000) < 990) { answ.Add("MACHINE STATUS", "1"); } diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index dbc8c76..a2e0bd5 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3009 + 1.2.2303.3019 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index d9f6c0a..feec041 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                          Version: 1.2.2303.3009

                                                          +

                                                          Version: 1.2.2303.3019


                                                          Release Note:
                                                          • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 1f6e279..9873411 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3009 +1.2.2303.3019 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 66f5018..f3bfe58 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3009 + 1.2.2303.3019 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 1b4d70330e70a068fa97267712ab9da2cfead1ef Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:53:06 +0200 Subject: [PATCH 23/38] update stored pulizia dati x Taskexec --- MP.MONO.Data/Controllers/MpDbController.cs | 195 ++++++++++-------- .../SqlScripts/Stored/stp_removeOldData.sql | 9 + 2 files changed, 117 insertions(+), 87 deletions(-) diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index 59ae03e..fe38664 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -2,23 +2,14 @@ using MP.MONO.Core.DTO; using MP.MONO.Data.DbModels; using MP.MONO.Data.DTO; -using MySqlConnector; using NLog; -using System.Collections.Generic; using System.Diagnostics; -using System.Reflection.PortableExecutable; using static MP.MONO.Core.Enums; namespace MP.MONO.Data.Controllers { public class MpDbController : IDisposable { - #region Private Fields - - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - - #endregion Private Fields - #region Public Constructors public MpDbController() @@ -513,8 +504,8 @@ namespace MP.MONO.Data.Controllers stopWatch.Start(); try { - // verifico non sia già aperto... - // verifico eventuali items già aperti da NON dover aggiungere... + // verifico non sia già aperto... verifico eventuali items già aperti da NON + // dover aggiungere... var stillOpenAlarms = localDbCtx .DbSetAlarmRec .Where(x => x.DtStart >= x.DtEnd && x.AlarmId == newItem.AlarmId) @@ -589,7 +580,7 @@ namespace MP.MONO.Data.Controllers newItems.Remove(singleItem); } } - } + } #endif if (newItems.Count > 0) @@ -695,6 +686,7 @@ namespace MP.MONO.Data.Controllers } return fatto; } + /// /// Recupero DataLogDTO data condizione filtro /// @@ -984,7 +976,6 @@ namespace MP.MONO.Data.Controllers return currMachDto; } - /// /// Recupero pareto status impianto /// @@ -1263,7 +1254,6 @@ namespace MP.MONO.Data.Controllers return fatto; } - /// /// Inserimento di una lista record Production Log /// @@ -1290,6 +1280,31 @@ namespace MP.MONO.Data.Controllers return fatto; } + /// + /// Effettua chiamata stored x pulizia dati stale/vecchi + /// + /// + /// + public List RemoveOldData(int numDay2Keep) + { + List dbResult = new List(); + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + dbResult = localDbCtx + .DbSetTaskExec + .FromSqlRaw("CALL stp_removeOldData({0});", numDay2Keep) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante RemoveOldData{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// genera elenco Task Schedulati missing da schema + attualmente presenti... /// @@ -1366,69 +1381,6 @@ namespace MP.MONO.Data.Controllers return answ; } - - /// - /// Inserisce un nuovo record status log calcolando durata da rec precedente.. - /// - /// - /// - public async Task StatusLogInsert(StatusLogModel newRec) - { - bool answ = false; - using (MapoMonoContext localDbCtx = new MapoMonoContext()) - { - try - { - bool needInsert = false; - // ultimo inserito... - var lastRec = localDbCtx - .DbSetStatusLog - .Where(x => x.MachineId == newRec.MachineId) - .OrderByDescending(x => x.DtRif) - .FirstOrDefault(); - - // se non trovato inserisco comunque - if (lastRec == null) - { - needInsert = true; - } - // se trovato controllo variazione... - else - { - // se cambia stato... - if (lastRec.CodStatus != newRec.CodStatus) - { - needInsert = true; - } - // oppure se è passato il giorno... - else if (lastRec.DtRif.Date < newRec.DtRif.Date) - { - needInsert = true; - } - // calcolo durata vecchio record... - lastRec.Duration = (float)DateTime.Now.Subtract(lastRec.DtRif).TotalMinutes; - } - - if (needInsert) - { - localDbCtx - .DbSetStatusLog - .Add(newRec); - } - - // salvo - localDbCtx.SaveChanges(); - answ = true; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante StatusLogInsert{Environment.NewLine}{exc}"); - } - } - await Task.Delay(1); - return answ; - } - /// /// Recupero elenco Task Schedulati dati Macchina ed intervento "master" /// @@ -1560,30 +1512,99 @@ namespace MP.MONO.Data.Controllers } /// - /// Effettua chiamata stored x pulizia dati stale/vecchi + /// Inserisce un nuovo record status log calcolando durata da rec precedente.. /// - /// + /// /// - public List RemoveOldData(int numDay2Keep) + public async Task StatusLogInsert(StatusLogModel newRec) { - List dbResult = new List(); + bool answ = false; using (MapoMonoContext localDbCtx = new MapoMonoContext()) { try { - dbResult = localDbCtx - .DbSetTaskExec - .FromSqlRaw("CALL stp_removeOldData({0});", numDay2Keep) - .ToList(); + bool needInsert = false; + // ultimo inserito... + var lastRec = localDbCtx + .DbSetStatusLog + .Where(x => x.MachineId == newRec.MachineId) + .OrderByDescending(x => x.DtRif) + .FirstOrDefault(); + + // se non trovato inserisco comunque + if (lastRec == null) + { + needInsert = true; + } + // se trovato controllo variazione... + else + { + // se cambia stato... + if (lastRec.CodStatus != newRec.CodStatus) + { + needInsert = true; + } + // oppure se è passato il giorno... + else if (lastRec.DtRif.Date < newRec.DtRif.Date) + { + needInsert = true; + } + // calcolo durata vecchio record... + lastRec.Duration = (float)DateTime.Now.Subtract(lastRec.DtRif).TotalMinutes; + } + + if (needInsert) + { + localDbCtx + .DbSetStatusLog + .Add(newRec); + } + + // salvo + localDbCtx.SaveChanges(); + answ = true; } catch (Exception exc) { - Log.Error($"Eccezione durante RemoveOldData{Environment.NewLine}{exc}"); + Log.Error($"Eccezione durante StatusLogInsert{Environment.NewLine}{exc}"); } } - return dbResult; + await Task.Delay(1); + return answ; + } + + /// + /// Registrazione record esecuzione task x log + /// + /// + /// + public bool TaskExecInsertLog(List recList) + { + bool answ = false; + using (MapoMonoContext localDbCtx = new MapoMonoContext()) + { + try + { + localDbCtx + .DbSetTaskExec + .AddRange(recList); + localDbCtx.SaveChanges(); + answ = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante TaskExecInsertLog{Environment.NewLine}{exc}"); + } + } + return answ; } #endregion Public Methods + + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields } } \ No newline at end of file diff --git a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql index 4af4ab5..fa1d08e 100644 --- a/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql +++ b/MP.MONO.Data/SqlScripts/Stored/stp_removeOldData.sql @@ -54,6 +54,15 @@ BEGIN ,'Cleanup StatusLog' AS CodTask ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; + -- TaskExec + DELETE + FROM TaskExec + WHERE DtRif <= @dt_min; + INSERT INTO TaskExec(DtRif, CodTask, Result) + SELECT CURRENT_TIMESTAMP AS DtRif + ,'Cleanup TaskExec' AS CodTask + ,CONCAT('Deleted ', CAST(ROW_COUNT() AS NCHAR), ' rows') AS Result; + COMMIT; From 250d98b1c522f15cab9d90182a48444722347f29 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:53:41 +0200 Subject: [PATCH 24/38] fix old lua --- MP.MONO.DECODER/lua/AlarmDecoder.lua | 8 +- MP.MONO.DECODER/lua/ParamsDecoder.lua | 148 ++++++++++++++++++-------- MP.MONO.DECODER/lua/StatusDecoder.lua | 6 +- 3 files changed, 110 insertions(+), 52 deletions(-) diff --git a/MP.MONO.DECODER/lua/AlarmDecoder.lua b/MP.MONO.DECODER/lua/AlarmDecoder.lua index ec82f08..3f30c42 100644 --- a/MP.MONO.DECODER/lua/AlarmDecoder.lua +++ b/MP.MONO.DECODER/lua/AlarmDecoder.lua @@ -110,10 +110,10 @@ local function displayTestInfo() if (callMode ~= 'NLua') then print('muteMask: ' .. muteMask .. ' | disableMask: ' .. disableMask) print(alarmStatus) - -- print('------------------------------') - -- for i,val in pairs(alarmListTable) do - -- print("AL"..i.." | "..val) - -- end + print('------------------------------') + for i,val in pairs(alarmListActive) do + print("AL"..i.." | "..val) + end end end diff --git a/MP.MONO.DECODER/lua/ParamsDecoder.lua b/MP.MONO.DECODER/lua/ParamsDecoder.lua index 2b76d18..c0fe7af 100644 --- a/MP.MONO.DECODER/lua/ParamsDecoder.lua +++ b/MP.MONO.DECODER/lua/ParamsDecoder.lua @@ -1,10 +1,10 @@ --[[--------------------------------------------------- -Procedura calcolo statistiche parametri: +Procedura calcolo STATUS: Variabili IN: -- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX] +- lastMode - valList(): elenco VALORI double da processare -- numRec(int): conteggio numero record da processare +- numRec(int): conteggio numero recorda da processare Variabili OUT: - calcVal(double): valore calcolato finale @@ -22,50 +22,104 @@ end local function checkInit() if (callMode ~= 'NLua') then -- imposto valori test - valList = { 4467, 4468, 4467, 4467, 4467, 4467 } - numRec = #valList - --valList = { 4.0, 5.0, 3.0, 6.0, 1.0, 2.0 } - vcFunct = 'AVG' - --POINT AVG MEDIAN MIN MAX + dataList = {} + dataList["MACHINE STATUS"] = 1 + dataList["PROCESS STATUS"] = 2 + dataList["PROCESS MODE"] = 2 end + numRec = tablelength(dataList) end -local function setupTable() - if numRec > 0 and valList[0] ~= nil then - for i = numRec, 1, -1 do - valListTable[i] = valList[i-1] - end - else - valListTable = valList - end +function tablelength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count end - +-- Main function: effettua calcolo stato secondo i parametri ricevuti local function doCalc() + + -- se ho dati processo if(numRec > 0) then - -- verifica il tipo di richiesta - if(vcFunct == 'AVG') then - s = 0 - for i,v in ipairs(valListTable) do - s = s + v + + -- /************************************************************************ + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- * + -- *************************************************************************/ + + -- calcolo dello statusId + if(dataList["MACHINE STATUS"] == 0) then + statusId = 1 + else + if(dataList["PROCESS MODE"] == 1) then + statusId = 8 + elseif(dataList["PROCESS MODE"] == 2) then + statusId = 2 + elseif(dataList["PROCESS MODE"] == 3) then + statusId = 9 + elseif(dataList["PROCESS MODE"] == 4) then + statusId = 5 + elseif(dataList["PROCESS MODE"] == 5) then + statusId = 10 + elseif(dataList["PROCESS MODE"] == 6) then + statusId = 11 + elseif(dataList["PROCESS MODE"] == 7) then + statusId = 12 + elseif(dataList["PROCESS MODE"] == 8) then + statusId = 13 end - calcVal = s / numRec - elseif(vcFunct == 'POINT') then - calcVal = valListTable[numRec] - elseif(vcFunct == 'MEDIAN') then - table.sort(valListTable) - calcVal = valListTable[numRec/2] - elseif(vcFunct == 'MIN') then - table.sort(valListTable) - calcVal = valListTable[1] - elseif(vcFunct == 'MAX') then - table.sort(valListTable) - calcVal = valListTable[numRec] end + -- calcolo del processId + if(dataList["PROCESS STATUS"] == 1) then + modeId = 2 + elseif(dataList["PROCESS STATUS"] == 2) then + modeId = 1 + elseif(dataList["PROCESS STATUS"] == 3) then + modeId = 3 + elseif(dataList["PROCESS STATUS"] == 6) then + modeId = 8 + elseif(dataList["PROCESS STATUS"] == 8) then + modeId = 9 + elseif(dataList["PROCESS STATUS"] == 11) then + modeId = 10 + end + calcOk = true + + -- altrimenti errore else - calcVal = -999999 - numRec = 1 + numRec = 1 calcOk = false end end @@ -73,11 +127,12 @@ end local function displayTestInfo() if (callMode ~= 'NLua') then print('------------------------------') - print('calcOk: ' .. tostring(calcOk) .. ' | vcFunct: ' .. vcFunct) - for i,val in pairs(valList) do - print("v_"..i.." | "..val) + print('calcOk: ' .. tostring(calcOk)) + for i,val in pairs(dataList) do + print(""..i.." | "..val) end - print('calcVal: ' .. calcVal) + print('statusId: ' .. statusId) + print('modeId: ' .. modeId) print('------------------------------') end end @@ -87,15 +142,14 @@ end function doProcess() -- variabile semaforo callMode (locali o remote da NLua) callMode = callMode or '' - calcVal = -999 - vcFunct = vcFunct or '' - valList = valList or {} - numRec = numRec or 1 + numRec = 0 + statusId = 0 + modeId = 0 + dataList = dataList or {} calcOk = false - valListTable = {} - + + --vero task da eseguire checkInit() - setupTable() doCalc() displayTestInfo() end diff --git a/MP.MONO.DECODER/lua/StatusDecoder.lua b/MP.MONO.DECODER/lua/StatusDecoder.lua index 2af9915..aaebd28 100644 --- a/MP.MONO.DECODER/lua/StatusDecoder.lua +++ b/MP.MONO.DECODER/lua/StatusDecoder.lua @@ -1,5 +1,5 @@ --[[--------------------------------------------------- -Procedura calcolo statistiche parametri: +Procedura calcolo statistiche STATUS: Variabili IN: - lastMode @@ -128,9 +128,13 @@ local function displayTestInfo() if (callMode ~= 'NLua') then print('------------------------------') print('calcOk: ' .. tostring(calcOk)) + print('------------------------------') + print('dataList:') + print('---------') for i,val in pairs(dataList) do print(""..i.." | "..val) end + print('------------------------------') print('statusId: ' .. statusId) print('modeId: ' .. modeId) print('------------------------------') From 769fadd17776d7cbe269483511013c3482b819dd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:53:53 +0200 Subject: [PATCH 25/38] implementaizone corretta LUA x contatori --- MP.MONO.DECODER/lua/CountersDecoder.lua | 162 +++++++++++++++--------- 1 file changed, 101 insertions(+), 61 deletions(-) diff --git a/MP.MONO.DECODER/lua/CountersDecoder.lua b/MP.MONO.DECODER/lua/CountersDecoder.lua index 8ce917a..3f70806 100644 --- a/MP.MONO.DECODER/lua/CountersDecoder.lua +++ b/MP.MONO.DECODER/lua/CountersDecoder.lua @@ -1,10 +1,10 @@ --[[--------------------------------------------------- -Procedura calcolo statistiche counters (derivato dai parametri): +Procedura calcolo STATUS: Variabili IN: -- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX] +- lastMode - valList(): elenco VALORI double da processare -- numRec(int): conteggio numero record da processare +- numRec(int): conteggio numero recorda da processare Variabili OUT: - calcVal(double): valore calcolato finale @@ -18,88 +18,128 @@ if not package.path:find(ZBS,1,true) then package.cpath = ZBS .. "/bin/?.dll;" .. ZBS .. "/bin/clibs53/?.dll;" .. package.cpath end +local function addDelta(key, value) + if(value == nil) then + return + end + + -- controllo esistenza + if(countAcc[key] ~= nil) then + countAcc[key] = countAcc[key] + value + else + countAcc[key] = value + end + +end + +local function tablelength(T) + local count = 0 + for _ in pairs(T) do count = count + 1 end + return count +end + + -- se non è da NLua inizializzo variabili accessorie local function checkInit() if (callMode ~= 'NLua') then - -- imposto valori test - valList = { 4467, 4468, 4467, 4467, 4467, 4467 } - numRec = #valList - --valList = { 4.0, 5.0, 3.0, 6.0, 1.0, 2.0 } - vcFunct = 'AVG' - --POINT AVG MEDIAN MIN MAX + -- imposto valore delta + delta = 0.5 + -- imposto valori (precedenti allo stato attuale) + dataList = {} + dataList["MACHINE STATUS"] = "1" + dataList["PROCESS STATUS"] = "2" + dataList["SPINDLE 1 LOAD"] = "1" + dataList["SPINDLE 2 LOAD"] = "0" + dataList["SPINDLE 3 LOAD"] = "3" + dataList["SPINDLE 4 LOAD"] = "0" end -end - -local function setupTable() - if numRec > 0 and valList[0] ~= nil then - for i = numRec, 1, -1 do - valListTable[i] = valList[i-1] - end - else - valListTable = valList - end -end - - -local function doCalc() - if(numRec > 0) then - -- verifica il tipo di richiesta - if(vcFunct == 'AVG') then - s = 0 - for i,v in ipairs(valListTable) do - s = s + v - end - calcVal = s / numRec - elseif(vcFunct == 'POINT') then - calcVal = valListTable[numRec] - elseif(vcFunct == 'MEDIAN') then - table.sort(valListTable) - calcVal = valListTable[numRec/2] - elseif(vcFunct == 'MIN') then - table.sort(valListTable) - calcVal = valListTable[1] - elseif(vcFunct == 'MAX') then - table.sort(valListTable) - calcVal = valListTable[numRec] - end - calcOk = true - else - calcVal = -999999 - numRec = 1 - calcOk = false - end + + -- init variabili contatori (just in case) + addDelta("MacPowerOn",0) + addDelta("CycleProc01",0) + addDelta("SpindleTorque01",0) + addDelta("SpindleTorque02",0) + addDelta("SpindleTorque03",0) + addDelta("SpindleTorque04",0) + -- verifico di avere record x processare + numRec = tablelength(dataList) end local function displayTestInfo() if (callMode ~= 'NLua') then print('------------------------------') - print('calcOk: ' .. tostring(calcOk) .. ' | vcFunct: ' .. vcFunct) - for i,val in pairs(valList) do - print("v_"..i.." | "..val) + print('calcOk: ' .. tostring(calcOk)) + print('------------------------------') + print('countAcc:') + print('---------') + for i,val in pairs(countAcc) do + print(""..i.." | "..val) end - print('calcVal: ' .. calcVal) print('------------------------------') end end +-- Main function: effettua calcolo stato secondo i parametri ricevuti +local function doCalc() + + -- se ho dati processo + if(numRec > 0) then + + -- se era poweron --> controllo ed eventualmente conto! + if(dataList["MACHINE STATUS"] ~= nil and dataList["MACHINE STATUS"] == "1" ) then + addDelta("MacPowerOn",delta) + + -- se era ANCHE AUTO --> conto + if(dataList["PROCESS STATUS"] ~= nil and dataList["PROCESS STATUS"] == "2") then + addDelta("CycleProc01",delta) + end + + -- se erano spindle > 0 --> conto + if(dataList["SPINDLE 1 LOAD"] ~= nil and dataList["SPINDLE 1 LOAD"] ~= "0" ) then + addDelta("SpindleTorque01",delta) + end + if(dataList["SPINDLE 2 LOAD"] ~= nil and dataList["SPINDLE 2 LOAD"] ~= "0" ) then + addDelta("SpindleTorque02",delta) + end + if(dataList["SPINDLE 3 LOAD"] ~= nil and dataList["SPINDLE 3 LOAD"] ~= "0" ) then + addDelta("SpindleTorque03",delta) + end + if(dataList["SPINDLE 4 LOAD"] ~= nil and dataList["SPINDLE 4 LOAD"] ~= "0" ) then + addDelta("SpindleTorque04",delta) + end + + end + + -- salvo calcolo eseguito + calcOk = true + + -- altrimenti errore + else + numRec = 1 + calcOk = false + end + +end --- MAIN + + + +-- Funct da chiamare da ext function doProcess() -- variabile semaforo callMode (locali o remote da NLua) callMode = callMode or '' - calcVal = -999 - vcFunct = vcFunct or '' - valList = valList or {} - numRec = numRec or 1 + dataList = dataList or {} + countAcc = countAcc or {} calcOk = false - valListTable = {} - + numRec = 0 + + --vero task da eseguire checkInit() - setupTable() doCalc() displayTestInfo() end +-- MAIN if (callMode ~= 'NLua') then doProcess() end From 41449df7bf06393f416655c238e39abb38e73bff Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:54:05 +0200 Subject: [PATCH 26/38] update decoder x contatori --- MP.MONO.DECODER/CounterManager.cs | 287 +++++++++-------------- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 6 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- 6 files changed, 119 insertions(+), 182 deletions(-) diff --git a/MP.MONO.DECODER/CounterManager.cs b/MP.MONO.DECODER/CounterManager.cs index 6e37567..c136522 100644 --- a/MP.MONO.DECODER/CounterManager.cs +++ b/MP.MONO.DECODER/CounterManager.cs @@ -1,55 +1,13 @@ -using MP.MONO.Core; -using MP.MONO.Core.DTO; -using MP.MONO.Data.DbModels; -using NLog; +using NLog; using NLua; +using System.Diagnostics; namespace MP.MONO.DECODER { public class CounterManager { - #region Public Fields - - public static string alarmStatus = ""; - - public static bool valueChanged = false; - - #endregion Public Fields - - /// - /// DataOra ultimo check x confronto - /// - protected DateTime? dtLastCheck = null; - - /// - /// Accumulatore valori counter - /// - protected Dictionary countAccum = new Dictionary(); - - /// - /// Elenco ultimi valori ricevuti x confronto - /// - protected Dictionary lastStatusList = new Dictionary(); - #region Public Constructors - - /* -------------------------------------------------- - * processing in script LUA, partendo da - * - dataora corrente / dataora precedente - * - ultimo stato parametri (contatore, ultimo valore) - * - stato parametri ricevuti (contatore, ultimo valore) - * - stato contatori (contatore, valore cumulato) - * ... per ogni contatore gestito deciderà SE accumulare la frazione di minuti passati o meno - ---------------------------------------------------- */ - - // recupero i valori degl accumulatori - - // verifico cambio stato counter x accumulare i valori conteggi - - - - /// /// Getione contatori x check variazioni e accumulazione conteggi /// @@ -57,10 +15,9 @@ namespace MP.MONO.DECODER { // preparo variabile x avvisare script che il modo è da NLua state["callMode"] = "NLua"; - state["vcFunct"] = "AVG"; // carico il file - luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ParamsDecoder.lua"); + luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "CountersDecoder.lua"); state.DoFile(luaPath); Log.Info("CounterManager OK"); @@ -79,138 +36,105 @@ namespace MP.MONO.DECODER public Dictionary processData(Dictionary newStatusList) { DateTime adesso = DateTime.Now; - // accumulo solo se ho un dat temporale precedente + double delta = 0; + // accumulo frazioni di minuto solo se ho un dato temporale precedente if (dtLastCheck != null) { - var delta = adesso.Subtract((DateTime)dtLastCheck).TotalMinutes; - - // vado ad "accumulare i dati" a quelli presenti verificando 1:1... - foreach (var item in newStatusList) + delta = adesso.Subtract((DateTime)dtLastCheck).TotalMinutes; + } + // preparo esecuzione + bool calcOk = false; + if (lastStatusList != null && lastStatusList.Count > 0) + { + state["delta"] = delta; + // tab dataList + state.NewTable("dataList"); + var currTabData = state.GetTable("dataList"); + foreach (var item in lastStatusList) { - bool doAdd = false; - // metodo CSharp (da tradurre LUA...) - if (lastStatusList.ContainsKey(item.Key)) + currTabData[item.Key] = item.Value; + } + state["dataList"] = currTabData; + + // tab countAcc + state.NewTable("countAcc"); + var currTabCount = state.GetTable("countAcc"); + foreach (var item in countAccum) + { + currTabCount[item.Key] = item.Value; + } + state["countAcc"] = currTabCount; + + // call! + try + { + // effettuo calcolo + state.DoString("doProcess()"); + } + catch (Exception exc) + { + Log.Error($"exception during doProcess{Environment.NewLine}{exc}"); + } + + // recupero valore calcolato + bool.TryParse(state.GetString("calcOk"), out calcOk); + if (calcOk) + { + try { - var currParam = lastStatusList.FirstOrDefault(x => x.Key == item.Key); - // se trovato --> confronto... - switch (item.Key) + // leggo nuovi valori accumulati.. + var tabAccum = state.GetTable("countAcc"); + //var dictAccum = state.GetTableDict(tabAccum); + var dictAccum = state["countAcc"]; + // vado a fare upgrade... + string sKey = ""; + string sVal = ""; + double dVal = 0; + foreach (var item in tabAccum.Keys) { - case "MACHINE STATUS": - // se 1--> 1 conto! - doAdd = item.Value == "1" && currParam.Value == "1"; - break; - case "PROCESS STATUS": - // se 1--> 1 conto! - doAdd = item.Value == "2" && currParam.Value == "2"; - break; - case "SPINDLE 1 LOAD": - case "SPINDLE 2 LOAD": - case "SPINDLE 3 LOAD": - case "SPINDLE 4 LOAD": - // se 1--> 1 conto! - doAdd = item.Value != "0" && currParam.Value != "0"; - break; - default: - break; - } - if (doAdd) - { - if (countAccum.ContainsKey(item.Key)) + sKey = $"{item}"; + sVal = $"{tabAccum[item]}"; + dVal = 0; + double.TryParse(sVal, out dVal); + if (countAccum.ContainsKey(sKey)) { - countAccum[item.Key] += delta; + countAccum[sKey] = dVal; } else { - countAccum.Add(item.Key, delta); + countAccum.Add(sKey, dVal); } + } - lastStatusList[item.Key] = item.Value; - } - else - { - lastStatusList.Add(item.Key, item.Value); - } -#if false - // cerco nelle variabili accomulatori... - if (!ParamsAccumulator.ContainsKey(item.Key)) - { - if (currParam != null) - { - var dataList = new List(); - dataList.Add(item.Value); - VCData newSet = new VCData() + // trace... stampo counters... + foreach (var cItem in countAccum.OrderBy(x => x.Key)) { - dataArray = dataList, - DTStart = adesso, - Funzione = currParam.VcFunc, - Period = currParam.SamplePeriod - }; - // se non ci fosse creo - ParamsAccumulator.Add(item.Key, newSet); + Log.Trace($"COUNTERS | {cItem.Key} | {cItem.Value}"); + } + } + catch (Exception exc) + { + Log.Error($"exception during LUA processData{Environment.NewLine}{exc}"); + } + } + } + + // salvo lastCheck + dtLastCheck = adesso; + // salvo ultimo stato da merge con precedente... + foreach (var item in newStatusList) + { + if (lastStatusList.ContainsKey(item.Key)) + { + lastStatusList[item.Key] = item.Value; } else { - // altrimenti aggiungo - ParamsAccumulator[item.Key].dataArray.Add(item.Value); - } - - // effettuo verifiche scadenza - bool calcOk = false; - double calcVal = 0; - if (ParamsAccumulator.ContainsKey(item.Key)) - { - if (ParamsAccumulator[item.Key].isElapsed) - { - string funcMode = $"{ParamsAccumulator[item.Key].Funzione}"; - // se scaduto --> mando a LUA x calcolo - state["valList"] = ParamsAccumulator[item.Key].dataArray; - state["numRec"] = ParamsAccumulator[item.Key].dataArray.Count; - state["vcFunct"] = funcMode; - - // effettuo calcolo - state.DoString("doProcess()"); - - // recupero valore calcolato - bool.TryParse(state.GetString("calcOk"), out calcOk); - if (calcOk) - { - try - { - var stringVal = state.GetString("calcVal"); - if (!string.IsNullOrEmpty(stringVal)) - { - calcVal = state.GetNumber("calcVal"); - Log.Trace($"calcVal: {calcVal}"); - } - } - catch (Exception exc) - { - Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}"); - } - } - - // aggiungo alla lista finale... - var dbRecord = new DataLogModel() - { - DtRif = adesso, - FluxType = item.Key, - MachineId = 1, - ValNum = calcVal, - ValStr = $"{calcVal:N3}" - }; - answ.Add(dbRecord); - - // elimino dai valori accumulati... - ParamsAccumulator.Remove(item.Key); - } - } -#endif + lastStatusList.Add(item.Key, item.Value); } } - // salvo lastCheck - dtLastCheck = adesso; - + // ritorno return countAccum; } @@ -222,7 +146,7 @@ namespace MP.MONO.DECODER public bool resetAccum(string accKey) { bool fatto = false; - if(countAccum.ContainsKey(accKey)) + if (countAccum.ContainsKey(accKey)) { countAccum[accKey] = 0; } @@ -233,23 +157,36 @@ namespace MP.MONO.DECODER #region Protected Fields - protected static Logger Log = LogManager.GetCurrentClassLogger(); - - protected static string luaPath = ""; - - protected static Lua state = new Lua(); - - protected List AlarmList = new List(); - - #endregion Protected Fields - - #region Private Fields + /// + /// Accumulatore valori counter + /// + protected static Dictionary countAccum = new Dictionary(); /// - /// Dizionario dei valori accumulati sulle variabili + /// Elenco ultimi valori ricevuti x confronto /// - private Dictionary ParamsAccumulator = new Dictionary(); + protected static Dictionary lastStatusList = new Dictionary(); - #endregion Private Fields + /// + /// Log instance + /// + protected static Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Path script LUA + /// + protected static string luaPath = ""; + + /// + /// OBJ state da scambiare + /// + protected static Lua state = new Lua(); + + /// + /// DataOra ultimo check x confronto + /// + protected DateTime? dtLastCheck = null; + + #endregion Protected Fields } } \ No newline at end of file diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 4975efe..43d2283 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3019 + 1.2.2303.3111 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 9a9e1a0..cbb382c 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -616,8 +616,8 @@ void dbMaintenance() void persistCount() { - // eseguo ogni 5 min CIRCA +/- 2% - int msecOra = 1000 * 60 * 5; + // eseguo ogni 1 min CIRCA +/- 2% + int msecOra = 1000 * 60 * 1; int minPeriod = msecOra * 98 / 100; int maxPeriod = msecOra * 102 / 100; @@ -1612,7 +1612,7 @@ void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) { foreach (var item in incrSet) { - // verifico i valori > soglia... + // verifico i valori > soglia 1/2 minuto... if (item.Value > 0.5) { // salvo diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index feec041..dff69bc 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                            Version: 1.2.2303.3019

                                                            +

                                                            Version: 1.2.2303.3111


                                                            Release Note:
                                                            • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 9873411..ee43d05 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3019 +1.2.2303.3111 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index e19e6f1..1315ff4 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3019 + 1.2.2303.3111 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false From 35923f29e372ffe312497f96992eda1bae49b699 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:54:08 +0200 Subject: [PATCH 27/38] refresh --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 000df49..e179064 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3019 + 1.2.2303.3111 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index feec041..dff69bc 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                              Version: 1.2.2303.3019

                                                              +

                                                              Version: 1.2.2303.3111


                                                              Release Note:
                                                              • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 9873411..ee43d05 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3019 +1.2.2303.3111 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index cebe509..8916719 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3019 + 1.2.2303.3111 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 0f778fd..cf00fc7 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3019 + 1.2.2303.3111 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index feec041..dff69bc 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                Version: 1.2.2303.3019

                                                                +

                                                                Version: 1.2.2303.3111


                                                                Release Note:
                                                                • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 9873411..ee43d05 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3019 +1.2.2303.3111 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index ac53655..0ec254f 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3019 + 1.2.2303.3111 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index a2e0bd5..f04382a 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3019 + 1.2.2303.3111 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index feec041..dff69bc 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                  Version: 1.2.2303.3019

                                                                  +

                                                                  Version: 1.2.2303.3111


                                                                  Release Note:
                                                                  • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 9873411..ee43d05 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3019 +1.2.2303.3111 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index f3bfe58..0bfe927 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3019 + 1.2.2303.3111 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 5933d31de86fac7d9d7953f012ce846ae66fa807 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 11:56:15 +0200 Subject: [PATCH 28/38] fix LUA parametri --- MP.MONO.DECODER/lua/ParamsDecoder.lua | 160 +++++++++----------------- 1 file changed, 53 insertions(+), 107 deletions(-) diff --git a/MP.MONO.DECODER/lua/ParamsDecoder.lua b/MP.MONO.DECODER/lua/ParamsDecoder.lua index c0fe7af..2b76d18 100644 --- a/MP.MONO.DECODER/lua/ParamsDecoder.lua +++ b/MP.MONO.DECODER/lua/ParamsDecoder.lua @@ -1,10 +1,10 @@ --[[--------------------------------------------------- -Procedura calcolo STATUS: +Procedura calcolo statistiche parametri: Variabili IN: -- lastMode +- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX] - valList(): elenco VALORI double da processare -- numRec(int): conteggio numero recorda da processare +- numRec(int): conteggio numero record da processare Variabili OUT: - calcVal(double): valore calcolato finale @@ -22,104 +22,50 @@ end local function checkInit() if (callMode ~= 'NLua') then -- imposto valori test - dataList = {} - dataList["MACHINE STATUS"] = 1 - dataList["PROCESS STATUS"] = 2 - dataList["PROCESS MODE"] = 2 + valList = { 4467, 4468, 4467, 4467, 4467, 4467 } + numRec = #valList + --valList = { 4.0, 5.0, 3.0, 6.0, 1.0, 2.0 } + vcFunct = 'AVG' + --POINT AVG MEDIAN MIN MAX end - numRec = tablelength(dataList) end -function tablelength(T) - local count = 0 - for _ in pairs(T) do count = count + 1 end - return count -end - --- Main function: effettua calcolo stato secondo i parametri ricevuti -local function doCalc() - - -- se ho dati processo - if(numRec > 0) then - - -- /************************************************************************ - -- * - -- * - -- * - -- * - -- * - -- * - -- * - -- * - -- * - -- * - -- * - -- *************************************************************************/ - - -- calcolo dello statusId - if(dataList["MACHINE STATUS"] == 0) then - statusId = 1 - else - if(dataList["PROCESS MODE"] == 1) then - statusId = 8 - elseif(dataList["PROCESS MODE"] == 2) then - statusId = 2 - elseif(dataList["PROCESS MODE"] == 3) then - statusId = 9 - elseif(dataList["PROCESS MODE"] == 4) then - statusId = 5 - elseif(dataList["PROCESS MODE"] == 5) then - statusId = 10 - elseif(dataList["PROCESS MODE"] == 6) then - statusId = 11 - elseif(dataList["PROCESS MODE"] == 7) then - statusId = 12 - elseif(dataList["PROCESS MODE"] == 8) then - statusId = 13 - end +local function setupTable() + if numRec > 0 and valList[0] ~= nil then + for i = numRec, 1, -1 do + valListTable[i] = valList[i-1] end - -- calcolo del processId - if(dataList["PROCESS STATUS"] == 1) then - modeId = 2 - elseif(dataList["PROCESS STATUS"] == 2) then - modeId = 1 - elseif(dataList["PROCESS STATUS"] == 3) then - modeId = 3 - elseif(dataList["PROCESS STATUS"] == 6) then - modeId = 8 - elseif(dataList["PROCESS STATUS"] == 8) then - modeId = 9 - elseif(dataList["PROCESS STATUS"] == 11) then - modeId = 10 - end - - calcOk = true - - -- altrimenti errore else - numRec = 1 + valListTable = valList + end +end + + +local function doCalc() + if(numRec > 0) then + -- verifica il tipo di richiesta + if(vcFunct == 'AVG') then + s = 0 + for i,v in ipairs(valListTable) do + s = s + v + end + calcVal = s / numRec + elseif(vcFunct == 'POINT') then + calcVal = valListTable[numRec] + elseif(vcFunct == 'MEDIAN') then + table.sort(valListTable) + calcVal = valListTable[numRec/2] + elseif(vcFunct == 'MIN') then + table.sort(valListTable) + calcVal = valListTable[1] + elseif(vcFunct == 'MAX') then + table.sort(valListTable) + calcVal = valListTable[numRec] + end + calcOk = true + else + calcVal = -999999 + numRec = 1 calcOk = false end end @@ -127,12 +73,11 @@ end local function displayTestInfo() if (callMode ~= 'NLua') then print('------------------------------') - print('calcOk: ' .. tostring(calcOk)) - for i,val in pairs(dataList) do - print(""..i.." | "..val) + print('calcOk: ' .. tostring(calcOk) .. ' | vcFunct: ' .. vcFunct) + for i,val in pairs(valList) do + print("v_"..i.." | "..val) end - print('statusId: ' .. statusId) - print('modeId: ' .. modeId) + print('calcVal: ' .. calcVal) print('------------------------------') end end @@ -142,14 +87,15 @@ end function doProcess() -- variabile semaforo callMode (locali o remote da NLua) callMode = callMode or '' - numRec = 0 - statusId = 0 - modeId = 0 - dataList = dataList or {} + calcVal = -999 + vcFunct = vcFunct or '' + valList = valList or {} + numRec = numRec or 1 calcOk = false - - --vero task da eseguire + valListTable = {} + checkInit() + setupTable() doCalc() displayTestInfo() end From 7522d18a7be66e6c05f11bb5ece974876e4da125 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 12:11:26 +0200 Subject: [PATCH 29/38] Update nuget + fix calcolo decimali valori counters in ore --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 9 +++++---- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/lua/CountersDecoder.lua | 8 ++++---- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 4 ++-- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 18 files changed, 26 insertions(+), 25 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index e179064..433c145 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3111 + 1.2.2303.3112 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index dff69bc..2a7c25e 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                    Version: 1.2.2303.3111

                                                                    +

                                                                    Version: 1.2.2303.3112


                                                                    Release Note:
                                                                    • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index ee43d05..be2a2bf 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3111 +1.2.2303.3112 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 8916719..252e63d 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3111 + 1.2.2303.3112 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 43d2283..f233458 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3111 + 1.2.2303.3112 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index cbb382c..7ad2525 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -1606,20 +1606,21 @@ void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) //int valInt = 0; if (dataList != null) { - // chiamo metodo CounterManager... + // chiamo metodo CounterManager... incrementi in MINUTI!!! var incrSet = counterMan.processData(dataList); if (incrSet != null) { foreach (var item in incrSet) { - // verifico i valori > soglia 1/2 minuto... - if (item.Value > 0.5) + // verifico i valori > soglia 1 minuto... + if (item.Value > 1) { // salvo var countRec = countStatus.Where(x => x.CCode == item.Key || x.CodAlias == item.Key).FirstOrDefault(); if (countRec != null) { - countRec.ActualVal = countRec.ActualVal + item.Value; + // attenzione valori in ore, incrementi in minuti! + countRec.ActualVal = Math.Round(countRec.ActualVal + item.Value/60, 3); // resetto counterMan.resetAccum(item.Key); } diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index dff69bc..2a7c25e 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                      Version: 1.2.2303.3111

                                                                      +

                                                                      Version: 1.2.2303.3112


                                                                      Release Note:
                                                                      • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index ee43d05..be2a2bf 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3111 +1.2.2303.3112 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 1315ff4..a8dd62f 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3111 + 1.2.2303.3112 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/lua/CountersDecoder.lua b/MP.MONO.DECODER/lua/CountersDecoder.lua index 3f70806..4492938 100644 --- a/MP.MONO.DECODER/lua/CountersDecoder.lua +++ b/MP.MONO.DECODER/lua/CountersDecoder.lua @@ -2,12 +2,12 @@ Procedura calcolo STATUS: Variabili IN: -- lastMode -- valList(): elenco VALORI double da processare -- numRec(int): conteggio numero recorda da processare +- delta(double): delta-time (minuti) +- dataList(string,string): tab stati (previus) +- countAcc(string,double): tab accumulatori Variabili OUT: -- calcVal(double): valore calcolato finale +- countAcc(string,double): tab accumulatori -----------------------------------------------------]] diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index cf00fc7..5a5e267 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3111 + 1.2.2303.3112 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index dff69bc..2a7c25e 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                        Version: 1.2.2303.3111

                                                                        +

                                                                        Version: 1.2.2303.3112


                                                                        Release Note:
                                                                        • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index ee43d05..be2a2bf 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3111 +1.2.2303.3112 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 0ec254f..d03f3d4 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3111 + 1.2.2303.3112 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index f04382a..52d8c92 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3111 + 1.2.2303.3112 @@ -37,7 +37,7 @@ - + all diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index dff69bc..2a7c25e 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                          Version: 1.2.2303.3111

                                                                          +

                                                                          Version: 1.2.2303.3112


                                                                          Release Note:
                                                                          • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index ee43d05..be2a2bf 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3111 +1.2.2303.3112 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 0bfe927..458abbd 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3111 + 1.2.2303.3112 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From c655fd5b048f29cb0c1d381e50eade46218db16a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 14:34:45 +0200 Subject: [PATCH 30/38] fix decimali x calcolo counter in H decoder --- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 6 +++--- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index f233458..6bd0283 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3112 + 1.2.2303.3114 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index 7ad2525..e9bf6d1 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -1612,15 +1612,15 @@ void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) { foreach (var item in incrSet) { - // verifico i valori > soglia 1 minuto... - if (item.Value > 1) + // verifico i valori > soglia 5 minuti... + if (item.Value > 5) { // salvo var countRec = countStatus.Where(x => x.CCode == item.Key || x.CodAlias == item.Key).FirstOrDefault(); if (countRec != null) { // attenzione valori in ore, incrementi in minuti! - countRec.ActualVal = Math.Round(countRec.ActualVal + item.Value/60, 3); + countRec.ActualVal = Math.Round(countRec.ActualVal + item.Value/60, 6); // resetto counterMan.resetAccum(item.Key); } diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 2a7c25e..f9dfae7 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                            Version: 1.2.2303.3112

                                                                            +

                                                                            Version: 1.2.2303.3114


                                                                            Release Note:
                                                                            • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index be2a2bf..124a9da 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3112 +1.2.2303.3114 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index a8dd62f..f45dd23 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3112 + 1.2.2303.3114 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false From c3b2e7d0cf407d68520a73d492bc3d1e26cf407e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 31 Mar 2023 14:58:44 +0200 Subject: [PATCH 31/38] Fix UI x display classi maint rosse --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/Components/ProgBar.razor | 19 +++++++++++++------ MP.MONO.UI/Components/ProgBar.razor.cs | 18 +++++++++++++++++- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 14 files changed, 42 insertions(+), 19 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 433c145..b88394c 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3112 + 1.2.2303.3114 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 2a7c25e..f9dfae7 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                              Version: 1.2.2303.3112

                                                                              +

                                                                              Version: 1.2.2303.3114


                                                                              Release Note:
                                                                              • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index be2a2bf..124a9da 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3112 +1.2.2303.3114 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 252e63d..91c4715 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3112 + 1.2.2303.3114 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 5a5e267..ea49adc 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3112 + 1.2.2303.3114 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 2a7c25e..f9dfae7 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                Version: 1.2.2303.3112

                                                                                +

                                                                                Version: 1.2.2303.3114


                                                                                Release Note:
                                                                                • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index be2a2bf..124a9da 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3112 +1.2.2303.3114 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index d03f3d4..9b3a8fa 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3112 + 1.2.2303.3114 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/Components/ProgBar.razor b/MP.MONO.UI/Components/ProgBar.razor index 9d62c7b..8b1f617 100644 --- a/MP.MONO.UI/Components/ProgBar.razor +++ b/MP.MONO.UI/Components/ProgBar.razor @@ -1,17 +1,24 @@ @if (singleLine) {
                                                                                  -
                                                                                  @($"{currVal:N0} h | {percWidth}%")
                                                                                  +
                                                                                  @($"{currVal:N0} h | {percWidthNum}%")
                                                                                  } else {
                                                                                  - @currVal.ToString("N0") + @currVal.ToString("N0") (@($"{maxVal:N0}"))
                                                                                  -
                                                                                  @(percWidth)%
                                                                                  +
                                                                                  + @if (percWidthNum > yelLim || percWidthNum <= 0) + { +
                                                                                  @(percWidthNum)%
                                                                                  + } +
                                                                                  + @if (percWidthNum <= yelLim && percWidthNum > 0) + { +
                                                                                  @(percWidthNum)%
                                                                                  + }
                                                                                  -} - - +} \ No newline at end of file diff --git a/MP.MONO.UI/Components/ProgBar.razor.cs b/MP.MONO.UI/Components/ProgBar.razor.cs index bee0f2e..82ad751 100644 --- a/MP.MONO.UI/Components/ProgBar.razor.cs +++ b/MP.MONO.UI/Components/ProgBar.razor.cs @@ -53,7 +53,23 @@ namespace MP.MONO.UI.Components } } - private int percWidth { get => (int)(100 * currVal / maxVal); } + private int percWidthNum { get => (int)(100 * currVal / maxVal); } + private int percWidh + { + get + { + int answ = percWidthNum; + if (answ <= 0) + { + answ = 100; + } + //else if (answ <= redLim) + //{ + // answ = redLim; + //} + return answ; + } + } private string textStyle { diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 52d8c92..3924bb6 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3112 + 1.2.2303.3114 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 2a7c25e..f9dfae7 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                  Version: 1.2.2303.3112

                                                                                  +

                                                                                  Version: 1.2.2303.3114


                                                                                  Release Note:
                                                                                  • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index be2a2bf..124a9da 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3112 +1.2.2303.3114 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 458abbd..460eb7f 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3112 + 1.2.2303.3114 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From ce990fd1ccc05be559a7a9edb7ab488114ef4298 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Apr 2023 08:41:35 +0200 Subject: [PATCH 32/38] Typo + fix BlinkPeriod (2-->3 sec) --- MP.MONO.DECODER/appsettings.json | 2 +- MP.MONO.DECODER/appsettings.multiax.json | 2 +- MP.MONO.DECODER/lua/CountersDecoder.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MP.MONO.DECODER/appsettings.json b/MP.MONO.DECODER/appsettings.json index 44049a0..83693a3 100644 --- a/MP.MONO.DECODER/appsettings.json +++ b/MP.MONO.DECODER/appsettings.json @@ -42,7 +42,7 @@ //"AlarmRegexp": "^{.*}", "BlinkCount": 3, "DbSampleInt": 60, - "BlinkPeriodMSec": 2000, + "BlinkPeriodMSec": 3000, "NumDay2Keep": 365 } } diff --git a/MP.MONO.DECODER/appsettings.multiax.json b/MP.MONO.DECODER/appsettings.multiax.json index abfa834..f80f6a2 100644 --- a/MP.MONO.DECODER/appsettings.multiax.json +++ b/MP.MONO.DECODER/appsettings.multiax.json @@ -41,7 +41,7 @@ "BlinkCount": 10, "DbSampleInt": 60, //"AlarmLogActive": false, - "BlinkPeriodMSec": 2000, + "BlinkPeriodMSec": 3000, "NumDay2Keep": 365 } } \ No newline at end of file diff --git a/MP.MONO.DECODER/lua/CountersDecoder.lua b/MP.MONO.DECODER/lua/CountersDecoder.lua index 4492938..84a4b5b 100644 --- a/MP.MONO.DECODER/lua/CountersDecoder.lua +++ b/MP.MONO.DECODER/lua/CountersDecoder.lua @@ -1,5 +1,5 @@ --[[--------------------------------------------------- -Procedura calcolo STATUS: +Procedura calcolo CONTATORI: Variabili IN: - delta(double): delta-time (minuti) From fd5153fe970fd1f5602201ec86cc5d00e04838c3 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Apr 2023 09:39:46 +0200 Subject: [PATCH 33/38] Refresh vers --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index b88394c..952943e 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3114 + 1.2.2304.809 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index f9dfae7..7313f97 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                    Version: 1.2.2303.3114

                                                                                    +

                                                                                    Version: 1.2.2304.809


                                                                                    Release Note:
                                                                                    • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 124a9da..a082242 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3114 +1.2.2304.809 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 91c4715..94f1249 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3114 + 1.2.2304.809 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 6bd0283..67cc517 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3114 + 1.2.2304.809 diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index f9dfae7..7313f97 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                      Version: 1.2.2303.3114

                                                                                      +

                                                                                      Version: 1.2.2304.809


                                                                                      Release Note:
                                                                                      • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 124a9da..a082242 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3114 +1.2.2304.809 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index f45dd23..8b19deb 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3114 + 1.2.2304.809 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index ea49adc..c3f8051 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3114 + 1.2.2304.809 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index f9dfae7..7313f97 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                        Version: 1.2.2303.3114

                                                                                        +

                                                                                        Version: 1.2.2304.809


                                                                                        Release Note:
                                                                                        • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 124a9da..a082242 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3114 +1.2.2304.809 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 9b3a8fa..2f18b2b 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3114 + 1.2.2304.809 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 3924bb6..e78c1a9 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2303.3114 + 1.2.2304.809 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index f9dfae7..7313f97 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                          Version: 1.2.2303.3114

                                                                                          +

                                                                                          Version: 1.2.2304.809


                                                                                          Release Note:
                                                                                          • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 124a9da..a082242 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2303.3114 +1.2.2304.809 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 460eb7f..561e010 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2303.3114 + 1.2.2304.809 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 4e91e2c4e02d2d18d0ad95178339022bb84dfac4 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Apr 2023 09:44:32 +0200 Subject: [PATCH 34/38] Cleanup parti inutilizzate --- MP.MONO.Data/Controllers/MpDbController.cs | 88 +--------------------- MP.MONO.Data/ModelBuilderExtensions.cs | 57 -------------- 2 files changed, 1 insertion(+), 144 deletions(-) diff --git a/MP.MONO.Data/Controllers/MpDbController.cs b/MP.MONO.Data/Controllers/MpDbController.cs index fe38664..d151822 100644 --- a/MP.MONO.Data/Controllers/MpDbController.cs +++ b/MP.MONO.Data/Controllers/MpDbController.cs @@ -867,93 +867,7 @@ namespace MP.MONO.Data.Controllers // Clear database context //Log.Info("Dispose di GWMSController"); } - - public List MachineGetDisplay() - { - List answ = new List(); - - // !!!FIXME TODO... è fake... - - Random rand = new Random(); - double currVal = 0; - currVal = rand.Next(10, 120) * 100; - DisplayDataDTO displ01 = new DisplayDataDTO() - { - Order = 0, - Title = "SPEED", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("N0"), - Type = "SPEED-5000-10000" - }; - answ.Add(displ01); - - currVal = rand.Next(10, 100) * 100; - DisplayDataDTO displ02 = new DisplayDataDTO() - { - Order = 0, - Title = "FEED", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("N0"), - Type = "FEED-3000-5000" - }; - answ.Add(displ02); - - currVal = rand.NextDouble() * 1.2; - DisplayDataDTO displ03 = new DisplayDataDTO() - { - Order = 0, - Title = "SPINDLE LOAD", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("P0"), - Type = "ORDER" - }; - answ.Add(displ03); - - currVal = rand.NextDouble() * 5000; - DisplayDataDTO displ04 = new DisplayDataDTO() - { - Order = 0, - Title = "X POS", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("N1"), - Type = "POS" - }; - answ.Add(displ04); - - currVal = rand.NextDouble() * 10000; - DisplayDataDTO displ05 = new DisplayDataDTO() - { - Order = 0, - Title = "Y POS", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("N1"), - Type = "POS" - }; - answ.Add(displ05); - - currVal = rand.NextDouble() * -3000; - DisplayDataDTO displ06 = new DisplayDataDTO() - { - Order = 0, - Title = "Z POS", - ValueNum = currVal, - IsNumeric = true, - Value = currVal.ToString("N1"), - Type = "POS" - }; - answ.Add(displ06); - - Task.Delay(200).Wait(); - - return answ; - } - - public ProductionDTO MachineGetProd() + public ProductionDTO MachineGetProd() { // !!!FIXME TODO... è fake... diff --git a/MP.MONO.Data/ModelBuilderExtensions.cs b/MP.MONO.Data/ModelBuilderExtensions.cs index 49db863..be3ec47 100644 --- a/MP.MONO.Data/ModelBuilderExtensions.cs +++ b/MP.MONO.Data/ModelBuilderExtensions.cs @@ -168,63 +168,6 @@ namespace MP.MONO.Data new PMMGroupModel { PMMGCode = "Access", Description = "Accessories" } ); -#if false - // inizializzazione dei valori di default x USER - modelBuilder.Entity().HasData( - new UserModel { UserId = 1, AuthKey = "th1sIsTh3R1vrOfThNgt98", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "samuele.locatelli", Email = "samuele@steamware.net", Firstname = "Samuele", Lastname = "Locatelli" }, - new UserModel { UserId = 2, AuthKey = "th1sIsTh3R1vrOfThNgt91", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "giancarlo.rottoli", Email = "giancarlo@steamware.net", Firstname = "Giancarlo", Lastname = "Rottoli" }, - new UserModel { UserId = 3, AuthKey = "th1sIsTh3R1vrOfThNgt93", Livello = UserLevel.SuperAdmin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "steamw.admin", Email = "info@steamware.net", Firstname = "Steamware", Lastname = "Admin" }, - new UserModel { UserId = 4, AuthKey = "th1sIsTh3R1vrOfThNgt97", Livello = UserLevel.Admin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "angelo.pizzaferri", Email = "a.pizzaferri@pizzaferripetroli.it", Firstname = "Angelo", Lastname = "Pizzaferri" }, - new UserModel { UserId = 5, AuthKey = "th1sIsTh3R1vrOfThNgt99", Livello = UserLevel.Admin, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 0, UserName = "andrei.valeanu", Email = "andrei.valeanu@winnlab.it", Firstname = "Andrei", Lastname = "Valeanu" }, - new UserModel { UserId = 6, AuthKey = "th1sIsTh3R1vrOfThNgt92", Livello = UserLevel.UserExt, MaskPlantId = 0, MaskSupplierId = 1, MaskTranspId = 0, UserName = "liquigas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LIQUIGAS" }, - new UserModel { UserId = 7, AuthKey = "th1sIsTh3R1vrOfThNgt94", Livello = UserLevel.UserExt, MaskPlantId = 0, MaskSupplierId = 2, MaskTranspId = 0, UserName = "vulkangas.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "VULKANGAS" }, - new UserModel { UserId = 8, AuthKey = "th1sIsTh3R1vrOfThNgt95", Livello = UserLevel.UserExt, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 1, UserName = "levorato.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "LEVORATO" }, - new UserModel { UserId = 9, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.UserExt, MaskPlantId = 0, MaskSupplierId = 0, MaskTranspId = 2, UserName = "traffik.user01", Email = "info@steamware.net", Firstname = "User", Lastname = "TRAFFIK" }, - new UserModel { UserId = 10, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 1, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz03.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Collecchio" }, - new UserModel { UserId = 11, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 2, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz04.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Noceto" }, - new UserModel { UserId = 12, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 3, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz05.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Baganzola" }, - new UserModel { UserId = 13, AuthKey = "th1sIsTh3R1vrOfThNgt96", Livello = UserLevel.User, MaskPlantId = 4, MaskSupplierId = 0, MaskTranspId = 0, UserName = "piz08.user01", Email = "info@steamware.net", Firstname = "Stazione", Lastname = "Pilastrello" } - ); -#endif - -#if false - // inizializzazione dei valori di default x Plant - modelBuilder.Entity().HasData( - new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 }, - new PlantDetailModel { PlantId = 2, PlantCode = "PIZ04", PlantDesc = "Noceto", LevelMax = 28000, LevelReorder = 15000, OrderQtyStd = 18000 }, - new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, LevelReorder = 15000, OrderQtyStd = 18000 }, - new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 }, - new PlantDetailModel { PlantId = 5, PlantCode = "PIZ09", PlantDesc = "Guardamiglio", LevelMax = 26000, LevelReorder = 15000, OrderQtyStd = 18000 } - // new PlantDetailModel { PlantId = 1, PlantCode = "PIZ03", PlantDesc = "Collecchio", LevelMax = 26000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, - //new PlantDetailModel { PlantId = 2, PlantCode = "PIZ04", PlantDesc = "Noceto", LevelMax = 28000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, - //new PlantDetailModel { PlantId = 3, PlantCode = "PIZ05", PlantDesc = "Baganzola", LevelMax = 24000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 }, - //new PlantDetailModel { PlantId = 4, PlantCode = "PIZ08", PlantDesc = "Pilastrello", LevelMax = 26000, PressMax = 19, PressBHMax = 270, PressBLMax = 270 } - ); -#endif - - -#if false - // inizializzazione dei valori di default x Trasportatori - modelBuilder.Entity().HasData( - new TransporterModel { TransporterId = 1, TransporterCode = "LEVO", TransporterDesc = "Levorato" }, - new TransporterModel { TransporterId = 2, TransporterCode = "TRAF", TransporterDesc = "Traffik" } - ); -#endif - -#if false - // init consegne... - modelBuilder.Entity().HasData( - new WeekPlanModel { WeekPlanId = 1, DayNum = DayOfWeek.Monday, DeliveryHour = 20, Note = "18K", PlantId = 2, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 2, DayNum = DayOfWeek.Tuesday, DeliveryHour = 20, Note = "18K", PlantId = 2, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 3, DayNum = DayOfWeek.Wednesday, DeliveryHour = 20, Note = "18K", PlantId = 2, SupplierId = 1, TransporterId = 2 }, - new WeekPlanModel { WeekPlanId = 4, DayNum = DayOfWeek.Thursday, DeliveryHour = 15, Note = "9K", PlantId = 2, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 5, DayNum = DayOfWeek.Thursday, DeliveryHour = 20, Note = "18K", PlantId = 2, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 6, DayNum = DayOfWeek.Saturday, DeliveryHour = 20, Note = "18K", PlantId = 2, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 7, DayNum = DayOfWeek.Tuesday, DeliveryHour = 14, Note = "3K", PlantId = 3, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 8, DayNum = DayOfWeek.Tuesday, DeliveryHour = 15, Note = "15K", PlantId = 4, SupplierId = 1, TransporterId = 1 }, - new WeekPlanModel { WeekPlanId = 9, DayNum = DayOfWeek.Tuesday, DeliveryHour = 17, Note = "18K", PlantId = 1, SupplierId = 2, TransporterId = 2 } - ); -#endif } } } From 23dc550e204d6a9762692ccf0fcf5eac1feec2cd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 8 Apr 2023 11:11:32 +0200 Subject: [PATCH 35/38] Update x timing gestione cehck tickets allarmi --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/AlarmsBlinkManager.cs | 6 +++--- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/NLog.config | 1 + MP.MONO.DECODER/Program.cs | 8 ++++---- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 19 files changed, 24 insertions(+), 23 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 952943e..5d1c696 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.809 + 1.2.2304.811 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index 7313f97..f921786 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                                                                            Version: 1.2.2304.809

                                                                                            +

                                                                                            Version: 1.2.2304.811


                                                                                            Release Note:
                                                                                            • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index a082242..374ad76 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.809 +1.2.2304.811 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 94f1249..5603320 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.809 + 1.2.2304.811 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/AlarmsBlinkManager.cs b/MP.MONO.DECODER/AlarmsBlinkManager.cs index d780a1f..66a0455 100644 --- a/MP.MONO.DECODER/AlarmsBlinkManager.cs +++ b/MP.MONO.DECODER/AlarmsBlinkManager.cs @@ -121,8 +121,8 @@ namespace MP.MONO.DECODER { // incremento contatore ticketNum++; - // faccio coda 0...999 - ticketNum = ticketNum > 999 ? 1 : ticketNum; + // faccio coda 0...9999 + ticketNum = ticketNum > 9999 ? 1 : ticketNum; // accodo... reqList.Enqueue(ticketNum); // rendo ticket @@ -147,7 +147,7 @@ namespace MP.MONO.DECODER ///
                          /// /// - public static bool checklTicket(int ticket) + public static bool checkTicket(int ticket) { bool fatto = false; if (!isProcessing) diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 67cc517..1c9f005 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.809 + 1.2.2304.811 diff --git a/MP.MONO.DECODER/NLog.config b/MP.MONO.DECODER/NLog.config index f21f67b..f3b990c 100644 --- a/MP.MONO.DECODER/NLog.config +++ b/MP.MONO.DECODER/NLog.config @@ -52,6 +52,7 @@ --> + \ No newline at end of file diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index e9bf6d1..e167ccf 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -951,19 +951,19 @@ async void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) { myTicket = AlarmsBlinkManager.getTicket(); // attendo che NON ci siano altri processi in coda... - while (!AlarmsBlinkManager.checklTicket(myTicket)) + while (!AlarmsBlinkManager.checkTicket(myTicket)) { - await Task.Delay(rand.Next(10, 30)); + await Task.Delay(rand.Next(100, 130)); if (numTry % 2 == 0) { TimeSpan ts = DateTime.Now.Subtract(adesso); - Log.Info($"Ticket {myTicket} | total wait {ts.TotalMilliseconds:N3}ms"); + Log.Debug($"Ticket {myTicket} | total wait {ts.TotalMilliseconds:N3}ms"); } numTry++; } stopWatch.Start(); - Log.Debug($"---------- INIZIO ticket {myTicket} ---------- "); + Log.Info($"---------- INIZIO ticket {myTicket} ---------- "); // decodifico allarmi ricevuti var alarmListRaw = JsonConvert.DeserializeObject>(currArgs.newMessage); diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index 7313f97..f921786 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                          Version: 1.2.2304.809

                          +

                          Version: 1.2.2304.811


                          Release Note:
                          • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index a082242..374ad76 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.809 +1.2.2304.811 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 8b19deb..7218565 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.809 + 1.2.2304.811 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index c3f8051..c30b3e5 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.809 + 1.2.2304.811 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index 7313f97..f921786 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                            Version: 1.2.2304.809

                            +

                            Version: 1.2.2304.811


                            Release Note:
                            • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index a082242..374ad76 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.809 +1.2.2304.811 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 2f18b2b..f73a642 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.809 + 1.2.2304.811 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index e78c1a9..577471a 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.809 + 1.2.2304.811 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index 7313f97..f921786 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                              Version: 1.2.2304.809

                              +

                              Version: 1.2.2304.811


                              Release Note:
                              • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index a082242..374ad76 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.809 +1.2.2304.811 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 561e010..fc1e35a 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.809 + 1.2.2304.811 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From 42055e8c7e4ad65aeebc57968bbbe1bdac85957c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Apr 2023 17:45:37 +0200 Subject: [PATCH 36/38] decoder: fix loglevel x ticket --- MP.MONO.DECODER/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index e167ccf..e2542d7 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -963,7 +963,7 @@ async void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) } stopWatch.Start(); - Log.Info($"---------- INIZIO ticket {myTicket} ---------- "); + Log.Debug($"---------- INIZIO ticket {myTicket} ---------- "); // decodifico allarmi ricevuti var alarmListRaw = JsonConvert.DeserializeObject>(currArgs.newMessage); @@ -1060,6 +1060,7 @@ async void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) { Log.Error($"Eccezione:{Environment.NewLine}{exc}"); } + // tolgo semaforo processing AlarmsBlinkManager.isProcessing = false; stopWatch.Stop(); From 7ff0836f38b6fad222204a35705e1291b99de967 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Apr 2023 17:45:46 +0200 Subject: [PATCH 37/38] Update minore di errori / warnings (nullability) --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/CounterManager.cs | 4 + MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.SIM/Simulator.cs | 2 +- MP.MONO.UI/Components/AlarmsOverview.razor.cs | 8 +- MP.MONO.UI/Components/CmpFooter.razor | 6 - MP.MONO.UI/Components/CmpFooter.razor.cs | 26 ++++ .../DisplayRecordComponent.razor.cs | 5 +- MP.MONO.UI/Components/EditMaintTask.razor.cs | 12 +- .../Components/MaintTaskExecHist.razor.cs | 2 +- .../Components/MaintTaskPending.razor.cs | 146 +++++++++--------- MP.MONO.UI/Components/ParamOverview.razor.cs | 28 ++-- MP.MONO.UI/Components/ToolsOverview.razor.cs | 3 +- MP.MONO.UI/Data/CurrentDataService.cs | 2 +- MP.MONO.UI/Data/DataFilter.cs | 2 +- MP.MONO.UI/Data/MessageService.cs | 7 +- MP.MONO.UI/Data/selectChartParams.cs | 2 +- MP.MONO.UI/Data/selectGlobalToggle.cs | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 32 files changed, 161 insertions(+), 128 deletions(-) create mode 100644 MP.MONO.UI/Components/CmpFooter.razor.cs diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index 5d1c696..eafdd0b 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.811 + 1.2.2304.1317 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index f921786..e020b74 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                Version: 1.2.2304.811

                                +

                                Version: 1.2.2304.1317


                                Release Note:
                                • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 374ad76..1204fe2 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.811 +1.2.2304.1317 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 5603320..6430ad8 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.811 + 1.2.2304.1317 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/CounterManager.cs b/MP.MONO.DECODER/CounterManager.cs index c136522..6eb0c5c 100644 --- a/MP.MONO.DECODER/CounterManager.cs +++ b/MP.MONO.DECODER/CounterManager.cs @@ -125,6 +125,10 @@ namespace MP.MONO.DECODER // salvo ultimo stato da merge con precedente... foreach (var item in newStatusList) { + if (lastStatusList == null) + { + lastStatusList = new Dictionary(); + } if (lastStatusList.ContainsKey(item.Key)) { lastStatusList[item.Key] = item.Value; diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 1c9f005..2bf792c 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.811 + 1.2.2304.1317 diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index f921786..e020b74 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                  Version: 1.2.2304.811

                                  +

                                  Version: 1.2.2304.1317


                                  Release Note:
                                  • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 374ad76..1204fe2 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.811 +1.2.2304.1317 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index 7218565..f10710f 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.811 + 1.2.2304.1317 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index c30b3e5..7410eaf 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.811 + 1.2.2304.1317 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index f921786..e020b74 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                    Version: 1.2.2304.811

                                    +

                                    Version: 1.2.2304.1317


                                    Release Note:
                                    • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 374ad76..1204fe2 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.811 +1.2.2304.1317 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index f73a642..4022c8f 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.811 + 1.2.2304.1317 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/Simulator.cs b/MP.MONO.SIM/Simulator.cs index 7dbb509..66fbbda 100644 --- a/MP.MONO.SIM/Simulator.cs +++ b/MP.MONO.SIM/Simulator.cs @@ -26,7 +26,7 @@ namespace MachineSim #region Public Constructors - public Simulator(string _confPath, int nMode, int nStatus, IDatabase? currRedisDb, IConfigurationRoot currAppConf) + public Simulator(string _confPath, int nMode, int nStatus, IDatabase currRedisDb, IConfigurationRoot currAppConf) { confPath = _confPath; numMode = nMode; diff --git a/MP.MONO.UI/Components/AlarmsOverview.razor.cs b/MP.MONO.UI/Components/AlarmsOverview.razor.cs index 5314178..f6c78fa 100644 --- a/MP.MONO.UI/Components/AlarmsOverview.razor.cs +++ b/MP.MONO.UI/Components/AlarmsOverview.razor.cs @@ -112,7 +112,7 @@ namespace MP.MONO.UI.Components }).ToList(); messageReceived.InvokeAsync(alarmList.Count); } - if (ListRecords.Count != 0 || ListRecords == null) + if (ListRecords == null || ListRecords.Count != 0) { compMode = false; trigger.show = false; @@ -130,6 +130,12 @@ namespace MP.MONO.UI.Components { StateHasChanged(); }); + + if (ListRecords == null) + { + ListRecords = new List(); + } + numAlarm = ListRecords.Count; diff --git a/MP.MONO.UI/Components/CmpFooter.razor b/MP.MONO.UI/Components/CmpFooter.razor index 9319658..df155e9 100644 --- a/MP.MONO.UI/Components/CmpFooter.razor +++ b/MP.MONO.UI/Components/CmpFooter.razor @@ -7,9 +7,3 @@ -@code { - protected DateTime adesso = DateTime.Now; - - Version version = typeof(Program).Assembly.GetName().Version; - -} \ No newline at end of file diff --git a/MP.MONO.UI/Components/CmpFooter.razor.cs b/MP.MONO.UI/Components/CmpFooter.razor.cs new file mode 100644 index 0000000..db9c290 --- /dev/null +++ b/MP.MONO.UI/Components/CmpFooter.razor.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.MONO.UI; +using MP.MONO.UI.Shared; +using MP.MONO.UI.Components; +using EgwCoreLib.Razor; + +namespace MP.MONO.UI.Components +{ + public partial class CmpFooter + { + protected DateTime adesso = DateTime.Now; + Version? version = typeof(Program).Assembly.GetName().Version; + } +} \ No newline at end of file diff --git a/MP.MONO.UI/Components/DisplayRecordComponent.razor.cs b/MP.MONO.UI/Components/DisplayRecordComponent.razor.cs index 5f8b8d3..8adbcd9 100644 --- a/MP.MONO.UI/Components/DisplayRecordComponent.razor.cs +++ b/MP.MONO.UI/Components/DisplayRecordComponent.razor.cs @@ -22,7 +22,7 @@ namespace MP.MONO.UI.Components string answ = "width: 0%;"; double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1; double ratio = ((double)num) / den; - answ = $"width: {ratio:P0};"; + answ = $"width: {ratio:P0};"; return answ; } protected string cssLast(string toolName) @@ -31,7 +31,8 @@ namespace MP.MONO.UI.Components // se è ultima testo giallo... if (SelVal != null && SelVal.Count > 0) { - if (SelVal.LastOrDefault().Equals(toolName)) + var ultimo = SelVal.LastOrDefault(); + if (ultimo != null && ultimo.Equals(toolName)) { answ = "bg-dark text-warning"; } diff --git a/MP.MONO.UI/Components/EditMaintTask.razor.cs b/MP.MONO.UI/Components/EditMaintTask.razor.cs index 6c6c191..8c651e7 100644 --- a/MP.MONO.UI/Components/EditMaintTask.razor.cs +++ b/MP.MONO.UI/Components/EditMaintTask.razor.cs @@ -9,10 +9,10 @@ namespace MP.MONO.UI.Components { #region Private Fields - private List ListCounters; - private List ListTopics; - private List ListMachGroup; - private List ListUserTeam; + private List? ListCounters { get; set; } = null; + private List? ListTopics { get; set; } = null; + private List? ListMachGroup { get; set; } = null; + private List? ListUserTeam { get; set; } = null; #endregion Private Fields @@ -108,8 +108,8 @@ namespace MP.MONO.UI.Components { Console.WriteLine("Record null!"); } - // delay x display - await DataUpdated.InvokeAsync(0); + // delay x display + await DataUpdated.InvokeAsync(0); } #endregion Private Methods diff --git a/MP.MONO.UI/Components/MaintTaskExecHist.razor.cs b/MP.MONO.UI/Components/MaintTaskExecHist.razor.cs index 2e5cc68..79aca75 100644 --- a/MP.MONO.UI/Components/MaintTaskExecHist.razor.cs +++ b/MP.MONO.UI/Components/MaintTaskExecHist.razor.cs @@ -39,7 +39,7 @@ namespace MP.MONO.UI.Components public EventCallback reqClose { get; set; } [Parameter] - public PrevMaintTaskModel currParentRec { get; set; } + public PrevMaintTaskModel currParentRec { get; set; } = null!; #endregion Public Properties diff --git a/MP.MONO.UI/Components/MaintTaskPending.razor.cs b/MP.MONO.UI/Components/MaintTaskPending.razor.cs index 4afe107..4181566 100644 --- a/MP.MONO.UI/Components/MaintTaskPending.razor.cs +++ b/MP.MONO.UI/Components/MaintTaskPending.razor.cs @@ -2,25 +2,66 @@ using Microsoft.AspNetCore.Components; using MP.MONO.Core; using MP.MONO.Data; using MP.MONO.Data.DbModels; -using Newtonsoft.Json; -using System.IO; -using System.Web; -using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IWebHostEnvironment; namespace MP.MONO.UI.Components { public partial class MaintTaskPending { - //private readonly IWebHostEnvironment _environment; + #region Public Fields + + public string dir = ""; + + #endregion Public Fields + + #region Public Properties + + /// + /// Abilita modalità compatta (solo x home) + /// + [Parameter] + public bool compMode { get; set; } = false; + + /// + /// Gestione evento x cambio modalità (pending/schedulati + /// + [Parameter] + public EventCallback reqChangeMode { get; set; } + + #endregion Public Properties + + #region Protected Properties + + protected string bodyCss + { + get => compMode ? "p-1" : ""; + } + + protected string currMode + { + get => doSetup ? "Pending" : "Scheduled"; + } + + #endregion Protected Properties + + #region Protected Methods + + //private readonly IWebHostEnvironment _HostEnvironment; + protected override async Task OnInitializedAsync() + { + //dir = _HostEnvironment.WebRootPath; + await ReloadData(); + MaintPendingRefreshVetoMin = Configuration.GetValue("OptPar:MaintPendingRefreshVetoMin"); + PercLim = Configuration.GetValue("OptPar:MaintLimitPerc"); + MMDataService.maintPipe.EA_NewMessage += MaintPipe_EA_NewMessage; + } + + #endregion Protected Methods - //public MaintTaskPending(IWebHostEnvironment environment) - //{ - // _environment = environment; - //} #region Private Fields private int _MaxRecord = 1000; + private bool doSetup = true; private DateTime LastUpdate = DateTime.Now.AddHours(-12); private List? ListRecords = null; @@ -49,35 +90,6 @@ namespace MP.MONO.UI.Components #endregion Private Fields - #region Public Properties - - /// - /// Abilita modalità compatta (solo x home) - /// - [Parameter] - public bool compMode { get; set; } = false; - - /// - /// Gestione evento x cambio modalità (pending/schedulati - /// - [Parameter] - public EventCallback reqChangeMode { get; set; } - - private bool doSetup = true; - protected string currMode - { - get => doSetup ? "Pending" : "Scheduled"; - } - - protected string bodyCss - { - get => compMode ? "p-1" : ""; - } - - public string dir = ""; - - #endregion Public Properties - #region Private Properties private int _currPage { get; set; } = 1; @@ -181,19 +193,6 @@ namespace MP.MONO.UI.Components #endregion Private Properties - #region Protected Methods - //private readonly IWebHostEnvironment _HostEnvironment; - protected override async Task OnInitializedAsync() - { - //dir = _HostEnvironment.WebRootPath; - await ReloadData(); - MaintPendingRefreshVetoMin = Configuration.GetValue("OptPar:MaintPendingRefreshVetoMin"); - PercLim = Configuration.GetValue("OptPar:MaintLimitPerc"); - MMDataService.maintPipe.EA_NewMessage += MaintPipe_EA_NewMessage; - } - - #endregion Protected Methods - #region Private Methods /// @@ -219,29 +218,11 @@ namespace MP.MONO.UI.Components ShowConfirm(0); } } + #if false string wwwroot = ""; - string file = ""; + string file = ""; #endif - private string pathFinder(int id) - { - //wwwroot = _environment.WebRootPath; -#if false - file = Path.Combine(wwwroot, id + ".pdf"); -#endif - string answ = ""; - string path = "Docs/Maint/" + id + ".pdf"; - if (File.Exists("wwwroot/" + path)) - { - answ = path; - } - else - { - path = "Docs/Maint/empty.pdf"; - answ = path; - } - return answ; - } private void ForceReload(int newNum) { @@ -271,6 +252,26 @@ namespace MP.MONO.UI.Components } } + private string pathFinder(int id) + { + //wwwroot = _environment.WebRootPath; +#if false + file = Path.Combine(wwwroot, id + ".pdf"); +#endif + string answ = ""; + string path = "Docs/Maint/" + id + ".pdf"; + if (File.Exists("wwwroot/" + path)) + { + answ = path; + } + else + { + path = "Docs/Maint/empty.pdf"; + answ = path; + } + return answ; + } + private async Task RegenTask() { await MMDataService.SchedMaintTaskCreateMissing(MachineId); @@ -296,13 +297,14 @@ namespace MP.MONO.UI.Components } #endregion Private Methods + #if false private bool showParams = false; private void toggleShowParams() { showParams = !showParams; - } + } #endif } } \ No newline at end of file diff --git a/MP.MONO.UI/Components/ParamOverview.razor.cs b/MP.MONO.UI/Components/ParamOverview.razor.cs index a0767ad..608fca5 100644 --- a/MP.MONO.UI/Components/ParamOverview.razor.cs +++ b/MP.MONO.UI/Components/ParamOverview.razor.cs @@ -53,7 +53,8 @@ namespace MP.MONO.UI.Components // se è ultima testo giallo... if (SelVal != null && SelVal.Count > 0) { - if (SelVal.LastOrDefault().Equals(ParamName)) + var ultimo = SelVal.LastOrDefault(); + if (ultimo != null && ultimo.Equals(ParamName)) { answ = "bg-dark text-warning"; } @@ -147,18 +148,21 @@ namespace MP.MONO.UI.Components try { var allData = JsonConvert.DeserializeObject>(currArgs.newMessage); - if (ShowReduced) + if (allData != null) { - ListRecords = allData - .Where(x => x.HLShow) - .OrderBy(x => x.Order) - .ToList(); - } - else - { - ListRecords = allData - .OrderBy(x => x.Order) - .ToList(); + if (ShowReduced) + { + ListRecords = allData + .Where(x => x.HLShow) + .OrderBy(x => x.Order) + .ToList(); + } + else + { + ListRecords = allData + .OrderBy(x => x.Order) + .ToList(); + } } } catch diff --git a/MP.MONO.UI/Components/ToolsOverview.razor.cs b/MP.MONO.UI/Components/ToolsOverview.razor.cs index fa4f4b9..f7508eb 100644 --- a/MP.MONO.UI/Components/ToolsOverview.razor.cs +++ b/MP.MONO.UI/Components/ToolsOverview.razor.cs @@ -52,7 +52,8 @@ namespace MP.MONO.UI.Components // se è ultima testo giallo... if (SelVal != null && SelVal.Count > 0) { - if (SelVal.LastOrDefault().Equals(toolName)) + var ultimo = SelVal.LastOrDefault(); + if (ultimo != null && ultimo.Equals(toolName)) { answ = "bg-dark text-warning"; } diff --git a/MP.MONO.UI/Data/CurrentDataService.cs b/MP.MONO.UI/Data/CurrentDataService.cs index 6d96623..750eddc 100644 --- a/MP.MONO.UI/Data/CurrentDataService.cs +++ b/MP.MONO.UI/Data/CurrentDataService.cs @@ -507,7 +507,7 @@ namespace MP.MONO.UI.Data /// public async Task> getAlarmRawSetup() { - List mutedList = new List(); + List? mutedList = new List(); string rawData = await redisDb.StringGetAsync(Constants.ALARMS_SETT_RLIST_KEY); // ora provo a deserializzare if (!string.IsNullOrEmpty(rawData)) diff --git a/MP.MONO.UI/Data/DataFilter.cs b/MP.MONO.UI/Data/DataFilter.cs index c1e3a5e..48fe9a9 100644 --- a/MP.MONO.UI/Data/DataFilter.cs +++ b/MP.MONO.UI/Data/DataFilter.cs @@ -6,7 +6,7 @@ public DateTime DtStart { get; set; } = DateTime.Today.AddDays(-3); public DateTime DtEnd { get; set; } = DateTime.Today.AddDays(3); - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is DataLogFilter item)) return false; diff --git a/MP.MONO.UI/Data/MessageService.cs b/MP.MONO.UI/Data/MessageService.cs index 3b622c5..3df7448 100644 --- a/MP.MONO.UI/Data/MessageService.cs +++ b/MP.MONO.UI/Data/MessageService.cs @@ -4,7 +4,7 @@ { #region Public Events - public event Action EA_PageUpdated; + public event Action EA_PageUpdated = null!; #endregion Public Events @@ -56,11 +56,6 @@ #endregion Protected Methods - #region Private Fields - - - #endregion Private Fields - #region Private Properties private int _currPage { get; set; } = 1; diff --git a/MP.MONO.UI/Data/selectChartParams.cs b/MP.MONO.UI/Data/selectChartParams.cs index ca96894..609e03d 100644 --- a/MP.MONO.UI/Data/selectChartParams.cs +++ b/MP.MONO.UI/Data/selectChartParams.cs @@ -41,7 +41,7 @@ #region Public Methods - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is selectChartParams item)) return false; diff --git a/MP.MONO.UI/Data/selectGlobalToggle.cs b/MP.MONO.UI/Data/selectGlobalToggle.cs index 5afc1c6..a8ee6bf 100644 --- a/MP.MONO.UI/Data/selectGlobalToggle.cs +++ b/MP.MONO.UI/Data/selectGlobalToggle.cs @@ -53,7 +53,7 @@ namespace MP.MONO.UI.Data #region Public Methods - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is selectGlobalToggle item)) return false; diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 577471a..9bc260c 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.811 + 1.2.2304.1317 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index f921786..e020b74 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                      Version: 1.2.2304.811

                                      +

                                      Version: 1.2.2304.1317


                                      Release Note:
                                      • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 374ad76..1204fe2 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.811 +1.2.2304.1317 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index fc1e35a..8f72e7b 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.811 + 1.2.2304.1317 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false From a49852b92e18146e309c6b907d0704fd633a1424 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Apr 2023 18:30:41 +0200 Subject: [PATCH 38/38] Refresh codice --- MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj | 2 +- MP.MONO.ANALYZER/Resources/ChangeLog.html | 2 +- MP.MONO.ANALYZER/Resources/VersNum.txt | 2 +- MP.MONO.ANALYZER/Resources/manifest.xml | 2 +- MP.MONO.DECODER/MP.MONO.DECODER.csproj | 2 +- MP.MONO.DECODER/Program.cs | 4 +++- MP.MONO.DECODER/Resources/ChangeLog.html | 2 +- MP.MONO.DECODER/Resources/VersNum.txt | 2 +- MP.MONO.DECODER/Resources/manifest.xml | 2 +- MP.MONO.SIM/MP.MONO.SIM.csproj | 2 +- MP.MONO.SIM/Resources/ChangeLog.html | 2 +- MP.MONO.SIM/Resources/VersNum.txt | 2 +- MP.MONO.SIM/Resources/manifest.xml | 2 +- MP.MONO.UI/MP.MONO.UI.csproj | 2 +- MP.MONO.UI/Resources/ChangeLog.html | 2 +- MP.MONO.UI/Resources/VersNum.txt | 2 +- MP.MONO.UI/Resources/manifest.xml | 2 +- 17 files changed, 19 insertions(+), 17 deletions(-) diff --git a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj index eafdd0b..1e95add 100644 --- a/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj +++ b/MP.MONO.ANALYZER/MP.MONO.ANALYZER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.1317 + 1.2.2304.1318 diff --git a/MP.MONO.ANALYZER/Resources/ChangeLog.html b/MP.MONO.ANALYZER/Resources/ChangeLog.html index e020b74..3225f24 100644 --- a/MP.MONO.ANALYZER/Resources/ChangeLog.html +++ b/MP.MONO.ANALYZER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                        Version: 1.2.2304.1317

                                        +

                                        Version: 1.2.2304.1318


                                        Release Note:
                                        • diff --git a/MP.MONO.ANALYZER/Resources/VersNum.txt b/MP.MONO.ANALYZER/Resources/VersNum.txt index 1204fe2..bbcaade 100644 --- a/MP.MONO.ANALYZER/Resources/VersNum.txt +++ b/MP.MONO.ANALYZER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.1317 +1.2.2304.1318 diff --git a/MP.MONO.ANALYZER/Resources/manifest.xml b/MP.MONO.ANALYZER/Resources/manifest.xml index 6430ad8..b9ffc03 100644 --- a/MP.MONO.ANALYZER/Resources/manifest.xml +++ b/MP.MONO.ANALYZER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.1317 + 1.2.2304.1318 http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.DECODER/MP.MONO.DECODER.csproj b/MP.MONO.DECODER/MP.MONO.DECODER.csproj index 2bf792c..365be07 100644 --- a/MP.MONO.DECODER/MP.MONO.DECODER.csproj +++ b/MP.MONO.DECODER/MP.MONO.DECODER.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.1317 + 1.2.2304.1318 diff --git a/MP.MONO.DECODER/Program.cs b/MP.MONO.DECODER/Program.cs index e2542d7..39252a0 100644 --- a/MP.MONO.DECODER/Program.cs +++ b/MP.MONO.DECODER/Program.cs @@ -1051,6 +1051,8 @@ async void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e) { checkCeasedAlarm(item); }); + //await Task.Run(() => checkCeasedAlarm(item)); + //await checkCeasedAlarm(item); } // Loggo quanto fatto Log.Debug($"Chiamato controllo differito per {ceasedAlarms.Count} allarmi cessati"); @@ -1621,7 +1623,7 @@ void CounterRecvPipe_EA_NewMessage(object? sender, EventArgs e) if (countRec != null) { // attenzione valori in ore, incrementi in minuti! - countRec.ActualVal = Math.Round(countRec.ActualVal + item.Value/60, 6); + countRec.ActualVal = Math.Round(countRec.ActualVal + item.Value / 60, 6); // resetto counterMan.resetAccum(item.Key); } diff --git a/MP.MONO.DECODER/Resources/ChangeLog.html b/MP.MONO.DECODER/Resources/ChangeLog.html index e020b74..3225f24 100644 --- a/MP.MONO.DECODER/Resources/ChangeLog.html +++ b/MP.MONO.DECODER/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                          Version: 1.2.2304.1317

                                          +

                                          Version: 1.2.2304.1318


                                          Release Note:
                                          • diff --git a/MP.MONO.DECODER/Resources/VersNum.txt b/MP.MONO.DECODER/Resources/VersNum.txt index 1204fe2..bbcaade 100644 --- a/MP.MONO.DECODER/Resources/VersNum.txt +++ b/MP.MONO.DECODER/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.1317 +1.2.2304.1318 diff --git a/MP.MONO.DECODER/Resources/manifest.xml b/MP.MONO.DECODER/Resources/manifest.xml index f10710f..68d6695 100644 --- a/MP.MONO.DECODER/Resources/manifest.xml +++ b/MP.MONO.DECODER/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.1317 + 1.2.2304.1318 http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.SIM/MP.MONO.SIM.csproj b/MP.MONO.SIM/MP.MONO.SIM.csproj index 7410eaf..fd189bd 100644 --- a/MP.MONO.SIM/MP.MONO.SIM.csproj +++ b/MP.MONO.SIM/MP.MONO.SIM.csproj @@ -6,7 +6,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.1317 + 1.2.2304.1318 diff --git a/MP.MONO.SIM/Resources/ChangeLog.html b/MP.MONO.SIM/Resources/ChangeLog.html index e020b74..3225f24 100644 --- a/MP.MONO.SIM/Resources/ChangeLog.html +++ b/MP.MONO.SIM/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                            Version: 1.2.2304.1317

                                            +

                                            Version: 1.2.2304.1318


                                            Release Note:
                                            • diff --git a/MP.MONO.SIM/Resources/VersNum.txt b/MP.MONO.SIM/Resources/VersNum.txt index 1204fe2..bbcaade 100644 --- a/MP.MONO.SIM/Resources/VersNum.txt +++ b/MP.MONO.SIM/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.1317 +1.2.2304.1318 diff --git a/MP.MONO.SIM/Resources/manifest.xml b/MP.MONO.SIM/Resources/manifest.xml index 4022c8f..69ba8c5 100644 --- a/MP.MONO.SIM/Resources/manifest.xml +++ b/MP.MONO.SIM/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.1317 + 1.2.2304.1318 http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html false diff --git a/MP.MONO.UI/MP.MONO.UI.csproj b/MP.MONO.UI/MP.MONO.UI.csproj index 9bc260c..4991bec 100644 --- a/MP.MONO.UI/MP.MONO.UI.csproj +++ b/MP.MONO.UI/MP.MONO.UI.csproj @@ -5,7 +5,7 @@ enable enable AnyCPU;x86;x64 - 1.2.2304.1317 + 1.2.2304.1318 diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html index e020b74..3225f24 100644 --- a/MP.MONO.UI/Resources/ChangeLog.html +++ b/MP.MONO.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MAPO-MONO -

                                              Version: 1.2.2304.1317

                                              +

                                              Version: 1.2.2304.1318


                                              Release Note:
                                              • diff --git a/MP.MONO.UI/Resources/VersNum.txt b/MP.MONO.UI/Resources/VersNum.txt index 1204fe2..bbcaade 100644 --- a/MP.MONO.UI/Resources/VersNum.txt +++ b/MP.MONO.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.2.2304.1317 +1.2.2304.1318 diff --git a/MP.MONO.UI/Resources/manifest.xml b/MP.MONO.UI/Resources/manifest.xml index 8f72e7b..aeb35ae 100644 --- a/MP.MONO.UI/Resources/manifest.xml +++ b/MP.MONO.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.2.2304.1317 + 1.2.2304.1318 http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html false