diff --git a/MP.SPEC/Components/ListDossiers.razor b/MP.SPEC/Components/ListDossiers.razor index 83356622..2f906524 100644 --- a/MP.SPEC/Components/ListDossiers.razor +++ b/MP.SPEC/Components/ListDossiers.razor @@ -81,9 +81,6 @@ else } - - - @if (currRecordClone != null) { @@ -92,50 +89,70 @@ else
- Modifica Parametro -
-
- @if (isEditing) - { - PENDING CHANGES... - } + Nuovo Dossier
-
+
- ARTICOLO - -
-
-
-
- FASE - + @if (ListMacchine != null) { - foreach (var item in ListGruppiFase) + foreach (var item in ListMacchine) { - + @if (item.IdxMacchina == currRecordClone.IdxMacchina) + { + + + } + else + { + + } } }
- -
+
- MACCHINA - + FASE +
-
+ +
- DATA - + ARTICOLI + +
@@ -179,7 +196,14 @@ else - +
+ + @if (currRecord != null) + { + + + } +
Articolo Fase @@ -199,7 +223,7 @@ else - + @**@ } else { @@ -215,7 +239,7 @@ else @record.IdxMacchina -
@record.MachineNav.Descrizione
+ @*
@record.MachineNav.Descrizione
*@ @record.DtRif diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs index f04d9b29..6acba0e4 100644 --- a/MP.SPEC/Components/ListDossiers.razor.cs +++ b/MP.SPEC/Components/ListDossiers.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using Microsoft.EntityFrameworkCore.Query.Internal; using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.DTO; @@ -41,7 +42,30 @@ namespace MP.SPEC.Components } return answ; } + private bool selectFirst(string idxMacchina) + { + //string firstMacchina = ""; + bool answ = false; + if (ListMacchine != null) + { + if (idxMacchina == idxMacchina) + { + answ = true; + } + else + { + answ = false; + } + //var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault(); + //firstMacchina = rawData != null ? rawData : ""; + } + //if (firstMacchina == idxMacchina) + //{ + // answ = true; + //} + return answ; + } public string checkSelPar(FluxLogDTO recordSel) { string answ = ""; @@ -112,8 +136,9 @@ namespace MP.SPEC.Components // creo record duplicato... DossierModel newRec = new DossierModel() { - IdxDossier = 0, + //IdxDossier = 0, DataType = selRec.DataType, + KeyRichiesta = selRec.KeyRichiesta, DtRif = DateTime.Now, IdxMacchina = selRec.IdxMacchina, CodArticolo = selRec.CodArticolo, @@ -158,17 +183,43 @@ namespace MP.SPEC.Components if (currRecordClone != null) { // serializzo valore x flux log... + + DossierFluxLogDTO? valoreDeserializzato = JsonConvert.DeserializeObject(selRec.Valore); + if (valoreDeserializzato != null) + { + + listaFlux = valoreDeserializzato + .ODL + .OrderBy(x => x.CodFlux) + .ToList(); + } + + if (listaFlux != null) + { + foreach (var item in listaFlux) + { + item.IdxMacchina = selRec.IdxMacchina; + item.Valore = "0"; + item.dtEvento = DateTime.Now; + } + } + DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux }; string newVal = JsonConvert.SerializeObject(updatedResult); // preparo x insert currRecordClone.DtRif = DateTime.Now; + currRecordClone.IdxMacchina = selRec.IdxMacchina; + currRecordClone.CodArticolo = selRec.CodArticolo; + currRecordClone.KeyRichiesta = selRec.KeyRichiesta; currRecordClone.Valore = newVal; // METODO PER UPDATE FLUX await MDService.DossiersInsert(currRecordClone); + //await reloadData(true); currRecordClone = null; isEditing = false; await Task.Delay(1); StateHasChanged(); + NavManager.NavigateTo(NavManager.Uri, true); } return; } @@ -177,7 +228,7 @@ namespace MP.SPEC.Components currRecordClone = null; await Task.Delay(1); // TOGLIERE!!!!! - await JSRuntime.InvokeAsync("location.reload"); + NavManager.NavigateTo("DOSS", true); } } @@ -185,6 +236,8 @@ namespace MP.SPEC.Components { ListGruppiFase = await MDService.ElencoGruppiFase(); ListStati = await MDService.AnagStatiComm(); + ListArticoli = await MDService.ArticoliGetSearch(100000, "BAGLIETTO", ""); + ListMacchine = await MDService.MacchineGetAll(); await reloadData(true); } @@ -271,6 +324,10 @@ namespace MP.SPEC.Components private List? SearchRecords; + private List? ListMacchine; + + private List? ListArticoli; + #endregion Private Fields #region Private Properties @@ -350,6 +407,7 @@ namespace MP.SPEC.Components { currFluxLogDto = null; currRecord = null; + currRecordClone = null; visualizzaFlux = true; isEditing = false; await RecordSelFlux.InvokeAsync(currFluxLogDto);