diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index a9522894..a13dc99f 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -598,11 +598,25 @@ namespace MP.Data.Controllers /// Cod articolo /// KeyRich (parziale) da cercare (es cod stato x yacht) /// - public List ListPODLFilt(string codArt, string keyRichPart) + public List ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo) { - List dbResult = new List(); + + List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) { + var Lanciato = new SqlParameter("@Lanciato", lanciato); + var CodGruppo = new SqlParameter("@CodGruppo", codGruppo); + var KeyRich = new SqlParameter("@KeyRich", keyRichPart); + var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); + + dbResult = dbCtx + .DbSetPODLExp + .FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina", Lanciato, KeyRich, codGruppo, IdxMacc) + .AsNoTracking() + //.AsEnumerable() + .ToList(); + } +#if false dbResult = dbCtx .DbSetPODL .Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) @@ -611,7 +625,7 @@ namespace MP.Data.Controllers .Include(a => a.ArticoloNav) .OrderByDescending(x => x.InsertDate) .ToList(); - } +#endif return dbResult; } @@ -945,7 +959,7 @@ namespace MP.Data.Controllers /// /// /// - public async Task PODL_startSetup(PODLModel editRec, int matrOpr, double tcRich, int pzPallet, string note) + public async Task PODL_startSetup(PODLExpModel editRec, int matrOpr, double tcRich, int pzPallet, string note) { bool answ = false; using (var dbCtx = new MoonProContext(_configuration)) @@ -953,7 +967,7 @@ namespace MP.Data.Controllers try { var currRec = dbCtx - .DbSetPODL + .DbSetPODLExp .AsNoTracking() .Where(x => x.IdxPromessa == editRec.IdxPromessa) .FirstOrDefault(); @@ -988,7 +1002,7 @@ namespace MP.Data.Controllers /// /// /// - public async Task PODLDeleteRecord(PODLModel currRec) + public async Task PODLDeleteRecord(PODLExpModel currRec) { bool fatto = false; using (var dbCtx = new MoonProContext(_configuration)) @@ -996,11 +1010,11 @@ namespace MP.Data.Controllers try { var currVal = dbCtx - .DbSetPODL + .DbSetPODLExp .Where(x => x.IdxPromessa == currRec.IdxPromessa) .FirstOrDefault(); dbCtx - .DbSetPODL + .DbSetPODLExp .Remove(currVal); await dbCtx.SaveChangesAsync(); fatto = true; @@ -1018,7 +1032,7 @@ namespace MP.Data.Controllers /// /// /// - public async Task PODLUpdateRecord(PODLModel editRec) + public async Task PODLUpdateRecord(PODLExpModel editRec) { bool fatto = false; using (var dbCtx = new MoonProContext(_configuration)) @@ -1026,7 +1040,7 @@ namespace MP.Data.Controllers try { var currRec = dbCtx - .DbSetPODL + .DbSetPODLExp .Where(x => x.IdxPromessa == editRec.IdxPromessa) .FirstOrDefault(); if (currRec != null) @@ -1045,7 +1059,7 @@ namespace MP.Data.Controllers else { dbCtx - .DbSetPODL + .DbSetPODLExp .Add(editRec); } await dbCtx.SaveChangesAsync(); diff --git a/MP.Data/DatabaseModels/PODLExpModel.cs b/MP.Data/DatabaseModels/PODLExpModel.cs new file mode 100644 index 00000000..849fb33d --- /dev/null +++ b/MP.Data/DatabaseModels/PODLExpModel.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + public partial class PODLExpModel + { + #region Public Properties + + [Key] + public int IdxPromessa { get; set; } + [MaxLength(50)] + public string KeyRichiesta { get; set; } + [MaxLength(50)] + public string KeyBCode { get; set; } + public bool Attivabile { get; set; } = false; + public int IdxOdl { get; set; } = 0; + [MaxLength(50)] + public string CodArticolo { get; set; } = ""; + [MaxLength(50)] + public string CodGruppo { get; set; } = ""; + [MaxLength(50)] + public string IdxMacchina { get; set; } + public int NumPezzi { get; set; } = 1; + public decimal Tcassegnato { get; set; } = 1; + public DateTime? DueDate { get; set; } + public int Priorita { get; set; } = 1; + public int PzPallet { get; set; } = 1; + [MaxLength(2500)] + public string Note { get; set; } = ""; + [MaxLength(50)] + public string CodCli { get; set; } = ""; + public DateTime InsertDate { get; set; } = DateTime.Now; + + [NotMapped] + public string CodFase + { + get + { + string answ = "*"; + var allData = KeyRichiesta.Split('_'); + if (allData.Length > 0) + { + answ = allData[0]; + } + return answ; + } + } + + /// + /// Navigazione oggetto Machine + /// + [ForeignKey("IdxMacchina")] + public virtual Macchine MachineNav { get; set; } = null!; + /// + /// Navigazione oggetto Articolo + /// + [ForeignKey("CodArticolo")] + public virtual AnagArticoli ArticoloNav { get; set; } = null!; + + public string DescArticolo { get; set; } = ""; + public string CodMacchina { get; set; } = ""; + public string Nome { get; set; } = ""; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index df436012..c971d028 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -46,6 +46,7 @@ namespace MP.Data public virtual DbSet DbSetLinkMenu { get; set; } public virtual DbSet DbSetODL { get; set; } public virtual DbSet DbSetODLExp { get; set; } + public virtual DbSet DbSetPODLExp { get; set; } public virtual DbSet DbSetPODL { get; set; } public virtual DbSet DbSetFluxLog { get; set; } public virtual DbSet DbSetDossiers { get; set; } diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index 33539043..b5a7d77e 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -22,7 +22,7 @@ namespace MP.SPEC.Components public EventCallback PagerResetReq { get; set; } [Parameter] - public EventCallback RecordSel { get; set; } + public EventCallback RecordSel { get; set; } [Parameter] public EventCallback updateRecordCount { get; set; } @@ -31,7 +31,7 @@ namespace MP.SPEC.Components #region Public Methods - public string checkSelect(PODLModel record) + public string checkSelect(PODLExpModel record) { string answ = ""; if (currRecord != null) @@ -72,10 +72,10 @@ namespace MP.SPEC.Components #region Protected Methods - protected async Task cloneRecord(PODLModel selRec) + protected async Task cloneRecord(PODLExpModel selRec) { // creo record duplicato... - PODLModel newRec = new PODLModel() + PODLExpModel newRec = new PODLExpModel() { Attivabile = selRec.Attivabile, CodArticolo = selRec.CodArticolo, @@ -103,7 +103,7 @@ namespace MP.SPEC.Components /// /// /// - protected async Task deleteRecord(PODLModel selRec) + protected async Task deleteRecord(PODLExpModel selRec) { if (!await JSRuntime.InvokeAsync("confirm", "Eliminazione Record: sei sicuro di voler procedere?")) return; @@ -152,13 +152,13 @@ namespace MP.SPEC.Components await RecordSel.InvokeAsync(null); } - protected async Task selRecord(PODLModel selRec) + protected async Task selRecord(PODLExpModel? selRec) { currRecord = selRec; await RecordSel.InvokeAsync(selRec); } - protected async Task startOdl(PODLModel selRec) + protected async Task startOdl(PODLExpModel selRec) { if (!await JSRuntime.InvokeAsync("confirm", "Sei sicuro di voler avviare PODL selezionato?")) return; @@ -223,8 +223,8 @@ namespace MP.SPEC.Components #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); - private PODLModel? currRecord = null; - private List? ListRecords; + private PODLExpModel? currRecord = null; + private List? ListRecords; private List? ListStati; /// @@ -237,7 +237,7 @@ namespace MP.SPEC.Components /// private List odlCurrList = new List(); - private List? SearchRecords; + private List? SearchRecords; #endregion Private Fields @@ -266,17 +266,29 @@ namespace MP.SPEC.Components set => actFilter.NumRec = value; } - private string SearchVal + private string macchina { - get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal; + get => actFilter.IdxMacchina; + set => actFilter.IdxMacchina = value; } + private string reparto + { + get => actFilter.CodReparto; + set => actFilter.CodReparto = value; + } private string StatoSel { get => actFilter.CodFase; set => actFilter.CodFase = value; } + private string SearchVal + { + get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal; + } + + private int totalCount { get => _totalCount; @@ -403,14 +415,16 @@ namespace MP.SPEC.Components { ListRecords = null; isLoading = true; +#if false if (hasOdl) { SearchRecords = await MDService.ListPODLFiltNOOdl(SearchVal, StatoSel); } else { - SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel); - } + } +#endif + SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, reparto); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); diff --git a/MP.SPEC/Components/SelFilterPODL.razor b/MP.SPEC/Components/SelFilterPODL.razor new file mode 100644 index 00000000..83b8b75d --- /dev/null +++ b/MP.SPEC/Components/SelFilterPODL.razor @@ -0,0 +1,72 @@ + +
+
+

FILTRI

+ +
+
+
+
+ Seleziona i filtri per: +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+
+
+ diff --git a/MP.SPEC/Components/SelFilterPODL.razor.cs b/MP.SPEC/Components/SelFilterPODL.razor.cs new file mode 100644 index 00000000..667dee76 --- /dev/null +++ b/MP.SPEC/Components/SelFilterPODL.razor.cs @@ -0,0 +1,93 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class SelFilterPODL + { + #region Public Properties + + [Parameter] + public SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams(); + + [Parameter] + public EventCallback FilterChanged { get; set; } + + [Parameter] + public List? ListGruppiFase { get; set; } = null; + + [Parameter] + public List? ListMacchine { get; set; } = null; + + [Parameter] + public List? ListStati { get; set; } = null; + + #endregion Public Properties + + #region Protected Properties + + protected bool hasOdl + { + get => currFilter.hasOdl; + } + + + #endregion Protected Properties + + #region Private Properties + + private string selMacchina + { + get => currFilter.IdxMacchina; + set + { + if (currFilter.IdxMacchina != value) + { + currFilter.IdxMacchina = value; + Task.Delay(1); + reportChange(); + } + } + } + + private string selReparto + { + get => currFilter.CodReparto; + set + { + if (currFilter.CodReparto != value) + { + currFilter.CodReparto = value; + Task.Delay(1); + reportChange(); + } + } + } + + private string selStato + { + get => currFilter.CodFase; + set + { + if (currFilter.CodFase != value) + { + currFilter.CodFase = value; + Task.Delay(1); + reportChange(); + } + } + } + + #endregion Private Properties + + #region Private Methods + + private void reportChange() + { + FilterChanged.InvokeAsync(currFilter); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 99265065..b34dafe3 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -696,30 +696,30 @@ namespace MP.SPEC.Data /// Cod articolo /// KeyRich (parziale) da cercare (es cod stato x yacht) /// - public async Task> ListPODLFilt(string codArt, string keyRichPart) + public async Task> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo) { - List? result = new List(); + List? result = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; - string currKey = $"{redisPOdlList}:{codArt}:{keyRichPart}"; + string currKey = $"{redisPOdlList}:{lanciato}:{keyRichPart}:{idxMacchina}:{codGruppo}"; // cerco in redis dato valore sel macchina... RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) { - result = JsonConvert.DeserializeObject>($"{rawData}"); + result = JsonConvert.DeserializeObject>($"{rawData}"); readType = "REDIS"; } else { - result = await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart)); + result = await Task.FromResult(dbController.ListPODLFilt(lanciato, keyRichPart, idxMacchina, codGruppo)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); } if (result == null) { - result = new List(); + result = new List(); } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; @@ -1050,7 +1050,7 @@ namespace MP.SPEC.Data /// /// /// - public async Task PODLDeleteRecord(PODLModel currRec) + public async Task PODLDeleteRecord(PODLExpModel currRec) { return await dbController.PODLDeleteRecord(currRec); } @@ -1060,7 +1060,7 @@ namespace MP.SPEC.Data /// /// /// - public async Task POdlDoSetup(PODLModel currRec) + public async Task POdlDoSetup(PODLExpModel currRec) { return await dbController.PODL_startSetup(currRec, 0, 1, 1, ""); } @@ -1070,7 +1070,7 @@ namespace MP.SPEC.Data /// /// /// - public async Task POdlUpdateRecord(PODLModel currRec) + public async Task POdlUpdateRecord(PODLExpModel currRec) { var dbResult = await dbController.PODLUpdateRecord(currRec); // elimino cache redis... diff --git a/MP.SPEC/Data/SelectPOdlParams.cs b/MP.SPEC/Data/SelectPOdlParams.cs index 7d8b35f4..a09d3fbd 100644 --- a/MP.SPEC/Data/SelectPOdlParams.cs +++ b/MP.SPEC/Data/SelectPOdlParams.cs @@ -16,6 +16,7 @@ namespace MP.SPEC.Data public string CodFase { get; set; } = "*"; public int CurrPage { get; set; } = 1; + public string CodReparto { get; set; } = "*"; public string IdxMacchina { get; set; } = "*"; @@ -39,6 +40,7 @@ namespace MP.SPEC.Data CodFase = this.CodFase, CurrPage = this.CurrPage, IdxMacchina = this.IdxMacchina, + CodReparto = this.CodReparto, MaxRecord = this.MaxRecord, NumRec = this.NumRec, SearchVal = this.SearchVal, @@ -56,6 +58,9 @@ namespace MP.SPEC.Data if (CodFase != item.CodFase) return false; + if (CodReparto != item.CodReparto) + return false; + if (MaxRecord != item.MaxRecord) return false; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 4acf7c6b..9d5c6b7c 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2415 + 6.16.2211.2418 diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index 3bcdd3c7..e88f24d7 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -19,6 +19,7 @@ Lanciati +
@if (addEnabled) @@ -29,7 +30,7 @@
-
+
@* *@ - + @* + foreach (var item in ListStati) + { + + } + } + *@ +
+ + + +
+
@@ -119,7 +126,7 @@ { } - + } } @@ -144,7 +151,7 @@ { } - + } } diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index 5b54c2d6..5f9d9162 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -42,7 +42,7 @@ namespace MP.SPEC.Pages /// protected async Task addNew() { - currRecord = new PODLModel() + currRecord = new PODLExpModel() { CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}" }; @@ -69,10 +69,14 @@ namespace MP.SPEC.Pages protected override async Task OnInitializedAsync() { ListAziende = await MDService.ElencoAziende(); - ListGruppiFase = await MDService.ElencoGruppiFase(); + var allGruppiData = await MDService.ElencoGruppiFase(); + if (allGruppiData != null) + { + ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList(); + } ListMacchine = await MDService.MacchineGetAll(); ListStati = await MDService.AnagStatiComm(); - SearchRecords = await MDService.ListPODLFilt("*", "*"); + SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, reparto); #if false // preselezione valori configData = await MDService.ConfigGetAll(); @@ -134,7 +138,7 @@ namespace MP.SPEC.Pages codMacc = firstMacc.IdxMacchina; } } - currRecord = new PODLModel() + currRecord = new PODLExpModel() { CodArticolo = currArticolo, KeyBCode = codExt, @@ -147,7 +151,7 @@ namespace MP.SPEC.Pages await Task.Delay(1); } - protected async Task selRecord(PODLModel selRec) + protected async Task selRecord(PODLExpModel selRec) { currRecord = selRec; await Task.Delay(1); @@ -158,8 +162,18 @@ namespace MP.SPEC.Pages hasOdl = !hasOdl; await Task.Delay(1); } + private async Task updateFilter(SelectPOdlParams newParams) + { + isLoading = true; + await Task.Delay(1); + currPage = 1; + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + currFilter = newParams; + isLoading = false; + } - protected async Task update(PODLModel selRec) + protected async Task update(PODLExpModel selRec) { if (!await JSRuntime.InvokeAsync("confirm", "Confermi di voler salvare le modifiche?")) return; @@ -184,14 +198,14 @@ namespace MP.SPEC.Pages #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); - private PODLModel? _currRecord = null; - private PODLModel currRecordControlli = new PODLModel(); + private PODLExpModel? _currRecord = null; + private PODLExpModel currRecordControlli = new PODLExpModel(); private List? ListArticoli; private List? ListAziende; private List? ListGruppiFase; private List? ListMacchine; private List? ListStati; - private List? SearchRecords; + private List? SearchRecords; #endregion Private Fields @@ -274,7 +288,7 @@ namespace MP.SPEC.Pages set => currFilter.CurrPage = value; } - private PODLModel? currRecord + private PODLExpModel? currRecord { get => _currRecord; set @@ -312,6 +326,23 @@ namespace MP.SPEC.Pages set => currFilter.TotCount = value; } + private string macchina + { + get => currFilter.IdxMacchina; + set => currFilter.IdxMacchina = value; + } + + private string reparto + { + get => currFilter.CodReparto; + set => currFilter.CodReparto = value; + } + private string StatoSel + { + get => currFilter.CodFase; + set => currFilter.CodFase = value; + } + #endregion Private Properties #region Private Methods @@ -321,7 +352,7 @@ namespace MP.SPEC.Pages /// /// /// - private async Task callSyncDb(PODLModel selRec) + private async Task callSyncDb(PODLExpModel selRec) { // chiamo aggiunta task SyncDb... string idxMacc = selRec.IdxMacchina; diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 78514638..bec0925f 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.2415

+

Versione: 6.16.2211.2418


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index f839c200..61196467 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2415 +6.16.2211.2418 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 4aa1ab20..71fcb581 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2415 + 6.16.2211.2418 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false