From 586340a0f77a2779bcaf6bca838ae7c0abbc71b1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 7 Feb 2023 17:17:34 +0100 Subject: [PATCH 01/77] Aggiunta preliminare fodler conf ricette --- MP.SPEC/Recipe/Fimat/Recipe.json | 60 ++++++++++++++++++++++ MP.SPEC/Recipe/Fimat/RecipeCalcFields.json | 11 ++++ MP.SPEC/Recipe/Fimat/RecipeEditFields.json | 60 ++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 MP.SPEC/Recipe/Fimat/Recipe.json create mode 100644 MP.SPEC/Recipe/Fimat/RecipeCalcFields.json create mode 100644 MP.SPEC/Recipe/Fimat/RecipeEditFields.json diff --git a/MP.SPEC/Recipe/Fimat/Recipe.json b/MP.SPEC/Recipe/Fimat/Recipe.json new file mode 100644 index 00000000..5e5c1292 --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/Recipe.json @@ -0,0 +1,60 @@ +{ + "A_Recipe": { + "DesRecipe": { + "DesData": { + "Prio": "N", + "DrumType": "1", + "CustDrumCode": "123456789012", + "OrderCode": "ORDERCODE", + "Customer": "CUSTOMER", + "Design": "DESIGN", + "Screen": "SCREEN", + "Variant": "VARIANT", + "RecName": "RECNAME", + "Article": "ARTICLE", + "LotID": "LOTID", + "Info1": "INFO1", + "ViscoName": "", + "Taglio-N": "1", + "Taglio-D": "4", + "Sequence": "1", + "SequenceTot": "8", + "Series": "2", + "ViscoValue": "0", + "UM": "1", + "DosType": "P", + "ServiceType": "N", + "RecipeType": "C", + "Note1": "NOTE1", + "Note2": "NOTE2", + "Quantity-kg": "10.00" + } + }, + "ColRecipe": [ + { + "ColData": { + "CompNumber": "1", + "ColourCode": "C001", + "Description": "COLOR1", + "TypComp": "C", + "PartsWeight": "1.00", + "PartsPerc": "0.10", + "Weight-gr": "30.00", + "Weight-gr-prev": "0.00" + } + }, + { + "ColData": { + "CompNumber": "2", + "ColourCode": "THICK1", + "Description": "Thickner 1", + "TypComp": "A", + "PartsWeight": "997.00", + "PartsPerc": "99.70", + "Weight-gr": "9970.00", + "Weight-gr-prev": "0.00" + } + } + ] + } +} \ No newline at end of file diff --git a/MP.SPEC/Recipe/Fimat/RecipeCalcFields.json b/MP.SPEC/Recipe/Fimat/RecipeCalcFields.json new file mode 100644 index 00000000..d1ad3d32 --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/RecipeCalcFields.json @@ -0,0 +1,11 @@ +{ + "A_Recipe": { + "DesRecipe": { + "DesData": { + "Article": "ARTICLE", + "LotID": "LOTID", + "Info1": "INFO1" + } + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Recipe/Fimat/RecipeEditFields.json b/MP.SPEC/Recipe/Fimat/RecipeEditFields.json new file mode 100644 index 00000000..5e5c1292 --- /dev/null +++ b/MP.SPEC/Recipe/Fimat/RecipeEditFields.json @@ -0,0 +1,60 @@ +{ + "A_Recipe": { + "DesRecipe": { + "DesData": { + "Prio": "N", + "DrumType": "1", + "CustDrumCode": "123456789012", + "OrderCode": "ORDERCODE", + "Customer": "CUSTOMER", + "Design": "DESIGN", + "Screen": "SCREEN", + "Variant": "VARIANT", + "RecName": "RECNAME", + "Article": "ARTICLE", + "LotID": "LOTID", + "Info1": "INFO1", + "ViscoName": "", + "Taglio-N": "1", + "Taglio-D": "4", + "Sequence": "1", + "SequenceTot": "8", + "Series": "2", + "ViscoValue": "0", + "UM": "1", + "DosType": "P", + "ServiceType": "N", + "RecipeType": "C", + "Note1": "NOTE1", + "Note2": "NOTE2", + "Quantity-kg": "10.00" + } + }, + "ColRecipe": [ + { + "ColData": { + "CompNumber": "1", + "ColourCode": "C001", + "Description": "COLOR1", + "TypComp": "C", + "PartsWeight": "1.00", + "PartsPerc": "0.10", + "Weight-gr": "30.00", + "Weight-gr-prev": "0.00" + } + }, + { + "ColData": { + "CompNumber": "2", + "ColourCode": "THICK1", + "Description": "Thickner 1", + "TypComp": "A", + "PartsWeight": "997.00", + "PartsPerc": "99.70", + "Weight-gr": "9970.00", + "Weight-gr-prev": "0.00" + } + } + ] + } +} \ No newline at end of file From 68c7004828ea44139b3310fa5376b65e3546ca31 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 7 Feb 2023 17:17:43 +0100 Subject: [PATCH 02/77] Update modello dati x gestione conf ricette --- MP.Data/Controllers/MpSpecController.cs | 49 ++++++++++++++----------- MP.Data/DatabaseModels/Macchine.cs | 2 + 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 3f8b3c6d..aef9d456 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -699,31 +699,38 @@ namespace MP.Data.Controllers public List MacchineGetFilt(string codGruppo) { List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) + try { - if (codGruppo == "*") + using (var dbCtx = new MoonProContext(_configuration)) { - dbResult = dbCtx - .DbSetMacchine - .AsNoTracking() - .OrderBy(x => x.IdxMacchina) - .ToList(); - } - else - { - dbResult = dbCtx - .DbSetGrp2Macc - .Where(g => g.CodGruppo == codGruppo) - .Join(dbCtx.DbSetMacchine, - g => g.IdxMacchina, - m => m.IdxMacchina, - (g, m) => m - ) - .AsNoTracking() - .OrderBy(x => x.IdxMacchina) - .ToList(); + if (codGruppo == "*") + { + dbResult = dbCtx + .DbSetMacchine + .AsNoTracking() + .OrderBy(x => x.IdxMacchina) + .ToList(); + } + else + { + dbResult = dbCtx + .DbSetGrp2Macc + .Where(g => g.CodGruppo == codGruppo) + .Join(dbCtx.DbSetMacchine, + g => g.IdxMacchina, + m => m.IdxMacchina, + (g, m) => m + ) + .AsNoTracking() + .OrderBy(x => x.IdxMacchina) + .ToList(); + } } } + catch(Exception exc) + { + Log.Error($"Eccezione in MacchineGetFilt{Environment.NewLine}{exc}"); + } return dbResult; } diff --git a/MP.Data/DatabaseModels/Macchine.cs b/MP.Data/DatabaseModels/Macchine.cs index a2bbcc56..858e9709 100644 --- a/MP.Data/DatabaseModels/Macchine.cs +++ b/MP.Data/DatabaseModels/Macchine.cs @@ -20,6 +20,8 @@ namespace MP.Data.DatabaseModels public string CodMacchina { get; set; } = ""; public string Nome { get; set; } = ""; public string Descrizione { get; set; } = ""; + public string RecipePath { get; set; } = ""; + //public string Note { get; set; } = ""; //public string url { get; set; } = ""; //public string locazione { get; set; } = ""; From f099a8d48e54e473fef41d338c0f162c3c332c55 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 7 Feb 2023 17:17:53 +0100 Subject: [PATCH 03/77] Inizio modifiche PODL x gestione ricette --- MP.SPEC/Components/CmpFooter.razor.cs | 9 +- MP.SPEC/Components/ListPODL.razor | 118 +++++++++++++++----------- MP.SPEC/Components/ListPODL.razor.cs | 92 +++++++++++++------- MP.SPEC/Data/MpDataService.cs | 36 ++++++++ MP.SPEC/MP.SPEC.csproj | 5 +- MP.SPEC/Pages/PODL.razor | 18 ---- MP.SPEC/Pages/PODL.razor.cs | 1 + MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 10 files changed, 183 insertions(+), 102 deletions(-) diff --git a/MP.SPEC/Components/CmpFooter.razor.cs b/MP.SPEC/Components/CmpFooter.razor.cs index 45a9cccf..1bfe95fb 100644 --- a/MP.SPEC/Components/CmpFooter.razor.cs +++ b/MP.SPEC/Components/CmpFooter.razor.cs @@ -8,9 +8,12 @@ namespace MP.SPEC.Components public void Dispose() { - aTimer.Elapsed -= ElapsedTimer; - aTimer.Stop(); - aTimer.Dispose(); + if (aTimer != null) + { + aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + } } public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index 5500e381..b790af50 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -12,7 +12,7 @@ else if (totalCount == 0) else {
-
+
@@ -25,11 +25,13 @@ else - - - @**@ - - + @if (!showRecipe) + { + + + + + } @@ -37,27 +39,39 @@ else { - - - @**@ - - + @if (!showRecipe) + { + + + + + } }
Cod Articolo Fase Macchina Info ciclo Note Att Macchina Info ciclo Att
- - @if (record.IdxOdl == 0) + @if (!showRecipe) { - @if (canStartOdl(record.IdxMacchina)) + + @if (record.IdxOdl == 0) { - + @if (canStartOdl(record.IdxMacchina)) + { + + } + else + { + + } + @if (canStartOdl(record.IdxMacchina)) + { + + } + else + { + + } } - else + } + @if (MachineWithRecipe) + { + @if (machineHasRecipe(record.IdxMacchina).Result) { - - } - @if (canStartOdl(record.IdxMacchina)) - { - - } - else - { - } } @@ -100,36 +114,44 @@ else } - @record.IdxMacchina -
@record.Nome
-
-
N° pezzi: @record.NumPezzi
-
T. Ciclo: @record.Tcassegnato.ToString("N3")
-
@record.Note - @if (@record.Attivabile) - { - - } - else - { - - } - - @if (POdlDelEnabled(record.IdxOdl)) - { - - } - + @record.IdxMacchina +
@record.Nome
+
+
N° pezzi: @record.NumPezzi
+
T. Ciclo: @record.Tcassegnato.ToString("N3")
+
+ @if (@record.Attivabile) + { + + } + else + { + + } + + @if (POdlDelEnabled(record.IdxOdl)) + { + + } +
+ @if (showRecipe) + { +
+ dettaglio ricetta +
+ }
} diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index f481fb79..1bb09f32 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -59,6 +59,12 @@ namespace MP.SPEC.Components #region Protected Properties + protected string header + { + get => actFilter.Header; + set => actFilter.Header = value; + } + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -104,8 +110,9 @@ namespace MP.SPEC.Components protected override async Task OnInitializedAsync() { - //await FilterChanged.InvokeAsync(actFilter); ListStati = await MDService.AnagStatiComm(); + var strMachRecipe = await MDService.tryGetConfig("MachineWithRecipe"); + bool.TryParse(strMachRecipe, out MachineWithRecipe); } protected override async Task OnParametersSetAsync() @@ -136,6 +143,7 @@ namespace MP.SPEC.Components protected async Task resetSel() { currRecord = null; + showRecipe = false; await RecordSel.InvokeAsync(null); } @@ -196,6 +204,12 @@ namespace MP.SPEC.Components } } + protected void doShowRecipe(PODLExpModel selRec) + { + showRecipe = true; + currRecord = selRec; + } + protected async Task UpdateData() { currRecord = null; @@ -207,10 +221,15 @@ namespace MP.SPEC.Components #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); + private PODLExpModel? currRecord = null; + private List? ListRecords; + private List? ListStati; + private bool MachineWithRecipe = false; + /// /// scadenza validità lista ODL correnti /// @@ -223,35 +242,12 @@ namespace MP.SPEC.Components private List? SearchRecords; + private bool showRecipe = false; + #endregion Private Fields #region Private Properties - - private DateTime selDtStart - { - get => actFilter.DtStart; - set - { - if (!actFilter.DtStart.Equals(value)) - { - actFilter.DtStart = value; - currPage = 1; - } - } - } - private DateTime selDtEnd - { - get => actFilter.DtEnd; - set - { - if (!actFilter.DtEnd.Equals(value)) - { - actFilter.DtEnd = value; - currPage = 1; - } - } - } private int _totalCount { get; set; } = 0; private int currPage @@ -267,6 +263,7 @@ namespace MP.SPEC.Components } private bool isLoading { get; set; } = false; + private SelectXdlParams lastFilter { get; set; } = new SelectXdlParams() { CurrPage = -1 }; private string macchina @@ -275,6 +272,11 @@ namespace MP.SPEC.Components set => actFilter.IdxMacchina = value; } + private string mainCss + { + get => showRecipe ? "col-8" : "col-12"; + } + private int numRecord { get => actFilter.NumRec; @@ -292,6 +294,32 @@ namespace MP.SPEC.Components get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal; } + private DateTime selDtEnd + { + get => actFilter.DtEnd; + set + { + if (!actFilter.DtEnd.Equals(value)) + { + actFilter.DtEnd = value; + currPage = 1; + } + } + } + + private DateTime selDtStart + { + get => actFilter.DtStart; + set + { + if (!actFilter.DtStart.Equals(value)) + { + actFilter.DtStart = value; + currPage = 1; + } + } + } + private string StatoSel { get => actFilter.CodFase; @@ -385,10 +413,16 @@ namespace MP.SPEC.Components answ = !odlCurrList.Contains(idxMacchina); return answ; } - protected string header + + /// + /// Verifica se la macchina abbia associata una ricetta (template) + /// + /// + /// + private async Task machineHasRecipe(string idxMacchina) { - get => actFilter.Header; - set => actFilter.Header = value; + string recipePath = await MDService.MacchineRecipe(idxMacchina); + return !string.IsNullOrEmpty(recipePath); } /// diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index d8925e97..c583d9c8 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -886,6 +886,41 @@ namespace MP.SPEC.Data return result; } + /// + /// Verifica se la macchina abbia un codice ricetta associato + /// + /// + /// + public async Task MacchineRecipe(string idxMacchina) + { + string? result = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisMacRecipe}:{idxMacchina}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + readType = "REDIS"; + } + else + { + //recupero elenco macchine... + var machineList = await MacchineGetFilt("*"); + var currMach = machineList.Where(x => x.IdxMacchina == idxMacchina).FirstOrDefault(); + result = currMach != null ? currMach.RecipePath : null; + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"MacchineRecipe | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result ?? ""; + } + /// /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato /// @@ -1436,6 +1471,7 @@ namespace MP.SPEC.Data private const string redisMacByFlux = redisBaseAddrSpec + "Cache:MacByFlux"; private const string redisMacList = redisBaseAddrSpec + "Cache:MacList"; + private const string redisMacRecipe = redisBaseAddrSpec + "Cache:Recipe"; private const string redisOdlByBatch = redisXdlData + "OdlByBatch"; private const string redisOdlCurrByMac = redisXdlData + "OdlByMac"; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index f6142ab5..b174410e 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2302.315 + 6.16.2302.717 @@ -39,6 +39,9 @@ + + PreserveNewest + Always diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index 1c4eb2c1..ff9d7e44 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -80,17 +80,9 @@ { foreach (var item in ListArticoli) { - @* @if (item.CodArticolo == currRecordControlli.CodArticolo) - { - - else - { - } - }*@ } } - }
@@ -135,7 +127,6 @@ @if (currGruppoSel != null) { - @* *@ } @@ -153,15 +144,6 @@ { @if (!item.Descrizione.Contains("NEW Descrizione")) { - - @*if (item.IdxMacchina == currRecordControlli.IdxMacchina) - { - - } - else - { - } - *@ } } diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index cf8fe54f..8fd268a4 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -404,6 +404,7 @@ namespace MP.SPEC.Pages #region Private Methods + /// /// Chiama metodo x chiedere sync DB /// diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index d5e65297..bb9f2529 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2302.315

+

Versione: 6.16.2302.717


Note di rilascio: