diff --git a/MP.Data/Conf/TagData.cs b/MP.Data/Conf/TagData.cs index 4ea5b582..54f16d40 100644 --- a/MP.Data/Conf/TagData.cs +++ b/MP.Data/Conf/TagData.cs @@ -20,6 +20,10 @@ namespace MP.Data.Conf /// public int RowNum { get; set; } = 0; /// + /// Override CSS (es fontSmall) + /// + public string TagCss { get; set; } = ""; + /// /// Etichetta da mostrare /// public string TagName { get; set; } = ""; @@ -27,5 +31,14 @@ namespace MP.Data.Conf /// Indicazione della chiave REDIS dove recuperare il tag indicato (già in formato string) /// public string TagLocation { get; set; } = ""; + + /// + /// Clone dell'oggetto + /// + /// + public TagData Clone() + { + return (TagData)this.MemberwiseClone(); + } } } diff --git a/MP.Mon/Components/DetailMSE.razor b/MP.Mon/Components/DetailMSE.razor index b51ef88c..0700a123 100644 --- a/MP.Mon/Components/DetailMSE.razor +++ b/MP.Mon/Components/DetailMSE.razor @@ -9,44 +9,107 @@
@CurrRecord.Nome
-
-
Art
-
- @if (showArt == "CodArticolo") + @if (hasRow(1)) + { +
+ @foreach (var item in rowValues(1)) { - @CurrRecord.CodArticolo +
@item.TagName: @currVal(item.TagLocation)
} - else - { - if (string.IsNullOrEmpty(CurrRecord.Disegno)) +
+ } + else + { +
+
Art
+
+ @if (showArt == "CodArticolo") { - [@CurrRecord.CodArticolo] + @CurrRecord.CodArticolo } else { - @CurrRecord.Disegno + if (string.IsNullOrEmpty(CurrRecord.Disegno)) + { + [@CurrRecord.CodArticolo] + } + else + { + @CurrRecord.Disegno + } } +
+
+ } + @if (hasRow(2)) + { +
+ @foreach (var item in rowValues(2)) + { +
@item.TagName: @currVal(item.TagLocation)
}
-
-
-
@CurrRecord.DescrizioneStato
-
@getMinSec((decimal)CurrRecord.Durata)
-
-
- @*
OEE
-
xx%
*@ -
TCiclo
-
std: @getMinSec(@CurrRecord.TCAssegnato)
-
act: @getMinSec(@CurrRecord.TCLavRT)
-
-
- @*
Pezzi
-
prod: @CurrRecord.PezziProd
-
ord: @CurrRecord.NumPezzi
*@ -
Pezzi(prod/ord)
-
@CurrRecord.PezziProd / @CurrRecord.NumPezzi
-
+ } + else + { +
+
@CurrRecord.DescrizioneStato
+
@getMinSec((decimal)CurrRecord.Durata)
+
+ } + @if (hasRow(3)) + { +
+ @foreach (var item in rowValues(3)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+ @*
OEE
+
xx%
*@ +
TCiclo
+
std: @getMinSec(@CurrRecord.TCAssegnato)
+
act: @getMinSec(@CurrRecord.TCLavRT)
+
+ } + @if (hasRow(4)) + { +
+ @foreach (var item in rowValues(4)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
Pezzi(prod/ord)
+
@CurrRecord.PezziProd / @CurrRecord.NumPezzi
+
+ } + @if (hasRow(5)) + { +
+ @foreach (var item in rowValues(5)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + @if (hasRow(6)) + { +
+ @foreach (var item in rowValues(6)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ }
diff --git a/MP.Mon/Components/DetailMSE.razor.cs b/MP.Mon/Components/DetailMSE.razor.cs index df218e2f..60202343 100644 --- a/MP.Mon/Components/DetailMSE.razor.cs +++ b/MP.Mon/Components/DetailMSE.razor.cs @@ -56,6 +56,63 @@ namespace MP.Mon.Components #endregion Public Properties + /// + /// Verifica se ci sia un override per la riga indicata + /// + /// + /// + protected bool hasRow(int numRow) + { + bool answ = false; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + var currVals = rowValues(numRow); + answ = currVals.Count > 0; + } + } + return answ; + } + + /// + /// Restituisce (se presenti) valori di override per la riga indicata + /// + /// + /// + protected List rowValues(int numRow) + { + List? rowVals = null; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + //cerco solo la riga corrente... + rowVals = currTagConf.Where(x => x.RowNum == numRow).ToList(); + } + } + if (rowVals == null) + { + rowVals = new List(); + } + return rowVals; + } + + /// + /// restituisce il valore data la tagLocation + /// + /// + /// + protected string currVal(string tagLocation) + { + string answ = ""; + if (currTagVal.ContainsKey(tagLocation)) + { + answ = currTagVal[tagLocation]; + } + return answ; + } + #region Protected Properties protected string codIOB diff --git a/MP.Mon/Conf/iobTagsConf.json b/MP.Mon/Conf/iobTagsConf.json index 5a42529a..f216a4d6 100644 --- a/MP.Mon/Conf/iobTagsConf.json +++ b/MP.Mon/Conf/iobTagsConf.json @@ -1,5 +1,39 @@ { "IobSetup": { + "***": [ + { + "ColNum": 1, + "RowNum": 5, + "TagCss": "fontSmall", + "TagName": "Feed Over", + "TagLocation": "MoonPro:SQL2016DEV:MoonPro:FLOG:***:FEED_OVER" + }, + { + "ColNum": 2, + "RowNum": 5, + "TagCss": "fontSmall", + "TagName": "Rapid Over", + "TagLocation": "MoonPro:SQL2016DEV:MoonPro:FLOG:***:RAPID_OVER" + } + ], + "SIMUL_01": [ + { + "ColNum": 1, + "RowNum": 6, + "TagCss": "fontSmall", + "TagName": "Power", + "TagLocation": "MoonPro:SQL2016DEV:MoonPro:FLOG:SIMUL_01:POWER_01" + } + ], + "SIMUL_02": [ + { + "ColNum": 1, + "RowNum": 6, + "TagCss": "fontSmall", + "TagName": "Power", + "TagLocation": "MoonPro:SQL2016DEV:MoonPro:FLOG:SIMUL_02:POWER_01" + } + ], "GIACO_ICOEL_001": [ { "ColNum": 1, diff --git a/MP.Mon/Data/MpDataService.cs b/MP.Mon/Data/MpDataService.cs index cea45977..b95602c0 100644 --- a/MP.Mon/Data/MpDataService.cs +++ b/MP.Mon/Data/MpDataService.cs @@ -42,9 +42,6 @@ namespace MP.Mon.Data _logger = logger; _configuration = configuration; - // setup conf IOB da dizionario - tryLoadIobTags(); - // setup compoenti REDIS this.redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); this.redisDb = this.redisConn.GetDatabase(); @@ -65,6 +62,9 @@ namespace MP.Mon.Data //sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}"); _logger.LogInformation(sb.ToString()); } + + // setup conf IOB da dizionario + tryLoadIobTags(); } #endregion Public Constructors @@ -148,7 +148,57 @@ namespace MP.Mon.Data var fileConfData = JsonConvert.DeserializeObject(rawData); if (fileConfData != null) { - currConf = fileConfData.IobSetup; + // effettuo esplosione conf SE contenesse il valore "***" = tutti gli IOB + if (fileConfData.IobSetup.ContainsKey("***")) + { + // recupero elenco macchine... + var elencoMacc = dbController.MacchineGetAll(); + // x ogni macchina creo le righe standard da conf... + var baseConf = fileConfData.IobSetup.Where(x => x.Key == "***").FirstOrDefault(); + foreach (var item in elencoMacc) + { + if (!string.IsNullOrEmpty(item.IdxMacchina)) + { + // converto i valori x la macchina corrente... + // clono in nuovo oggetto + var specVal = baseConf.Value.Select(i => i.Clone()).ToList(); + // sostituisco segnaposto + foreach (var singleVal in specVal) + { + singleVal.TagLocation = singleVal.TagLocation.Replace("***", item.IdxMacchina); + } + // ora aggiungo eventuali valori in override... + if (fileConfData.IobSetup.ContainsKey(item.IdxMacchina)) + { + var otConf = fileConfData.IobSetup.Where(x => x.Key == item.IdxMacchina).FirstOrDefault(); + //verifico x ogni valore other... + foreach (var otTag in otConf.Value) + { + var ovrTag = specVal.Where(x => x.ColNum == otTag.ColNum && x.RowNum == otTag.RowNum).FirstOrDefault(); + // se contiene --> sovrascrivo + if (ovrTag != null) + { + //ovrTag = otTag.Clone(); + specVal.Remove(ovrTag); + specVal.Add(otTag.Clone()); + } + // se non contiene --> aggiungo + else + { + specVal.Add(otTag); + } + } + } + currConf.Add(item.IdxMacchina, specVal); + } + } + + } + // altrimenti copio ed ho finito + else + { + currConf = fileConfData.IobSetup; + } } } } diff --git a/MP.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index 1507350c..a99e600f 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 6.15.2206.418 + 6.15.2206.616 diff --git a/MP.Mon/Pages/Index.razor.cs b/MP.Mon/Pages/Index.razor.cs index e35a1aae..3d4b2548 100644 --- a/MP.Mon/Pages/Index.razor.cs +++ b/MP.Mon/Pages/Index.razor.cs @@ -169,7 +169,7 @@ namespace MP.Mon.Pages if (currTags != null && currTags.Count > 0) { // FIXME TODO !!!! FARE !!!! - da verificare - Dictionary dictVal = currTags.ToDictionary(x => x.TagLocation, x => MMDataService.getTagConf(x.TagLocation)); + answ = currTags.ToDictionary(x => x.TagLocation, x => MMDataService.getTagConf(x.TagLocation)); } return answ; } diff --git a/MP.Mon/Resources/ChangeLog.html b/MP.Mon/Resources/ChangeLog.html index 0a0853a2..0c9933fe 100644 --- a/MP.Mon/Resources/ChangeLog.html +++ b/MP.Mon/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MON MAPO -

Versione: 6.15.2206.418

+

Versione: 6.15.2206.616


Note di rilascio:
  • diff --git a/MP.Mon/Resources/VersNum.txt b/MP.Mon/Resources/VersNum.txt index ba526264..76e00419 100644 --- a/MP.Mon/Resources/VersNum.txt +++ b/MP.Mon/Resources/VersNum.txt @@ -1 +1 @@ -6.15.2206.418 +6.15.2206.616 diff --git a/MP.Mon/Resources/manifest.xml b/MP.Mon/Resources/manifest.xml index cda6bc9e..3e2bab2f 100644 --- a/MP.Mon/Resources/manifest.xml +++ b/MP.Mon/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.15.2206.418 + 6.15.2206.616 https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html false diff --git a/MP.Mon/appsettings.json b/MP.Mon/appsettings.json index f83e95f8..3d53e7ce 100644 --- a/MP.Mon/appsettings.json +++ b/MP.Mon/appsettings.json @@ -10,6 +10,6 @@ "ConnectionStrings": { "MP.Mon": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;", "MP.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;", - "Redis": "localhost:6379,DefaultDatabase=13,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false" + "Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false" } }