From 3c2b05615674731af806f80ac5674317368b4910 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 29 Nov 2022 13:11:53 +0100 Subject: [PATCH 1/4] Giacenze: -aggiunta classe giacenze -aggiunto metodo per interagire con db --- MP.Data/Controllers/MpSpecController.cs | 25 +++++++++++++++++ MP.Data/DatabaseModels/AnagGiacenzeModel.cs | 31 +++++++++++++++++++++ MP.Data/MoonPro_InveContext.cs | 9 ++++++ 3 files changed, 65 insertions(+) create mode 100644 MP.Data/DatabaseModels/AnagGiacenzeModel.cs diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 055522b3..f39426ae 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -329,6 +329,31 @@ namespace MP.Data.Controllers return answ; } + /// + /// Elenco giacenze + /// + /// record dossier da eliminare + /// + public List ListGiacenze(int IdxOdl) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbGiacenzeData + .AsNoTracking() + .Where(x => x.IdxOdl == IdxOdl).ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ListGiacenze{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato /// macchina (ordinato x data registrazione) diff --git a/MP.Data/DatabaseModels/AnagGiacenzeModel.cs b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs new file mode 100644 index 00000000..da8dff3b --- /dev/null +++ b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + [Table("RegGiacenze")] + public class AnagGiacenzeModel + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int IdxRG { get; set; } = 0; + public int IdxOdl { get; set; } = 0; + public string IdentRG { get; set; } = ""; + public string Product { get; set; } = ""; + public string Variety { get; set; } = ""; + public string Supplier { get; set; } = ""; + public string ExtDoc { get; set; } = ""; + public DateTime DateRif { get; set; } + public double QtyTot { get; set; } = 0; + public int NumPack { get; set; } = 0; + public string Notes { get; set; } = ""; + + } +} diff --git a/MP.Data/MoonPro_InveContext.cs b/MP.Data/MoonPro_InveContext.cs index ec5d15c5..e656d1c9 100644 --- a/MP.Data/MoonPro_InveContext.cs +++ b/MP.Data/MoonPro_InveContext.cs @@ -45,11 +45,20 @@ namespace MP.Data #region Public Properties + #region PER INVE + public virtual DbSet DbAnagMag { get; set; } public virtual DbSet DbInveSess { get; set; } public virtual DbSet DbScanData { get; set; } public virtual DbSet DbUdcData { get; set; } public virtual DbSet DbLottoData { get; set; } + #endregion PER INVE + + #region PER SPEC + + public virtual DbSet DbGiacenzeData { get; set; } + + #endregion PER SPEC #endregion Public Properties From 15882c9c8bba8a687462c1d479053262f2cb1673 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 29 Nov 2022 13:12:10 +0100 Subject: [PATCH 2/4] aggiunta gestione per display giacenze --- MP.SPEC/Components/ListDossiers.razor | 13 ++++- MP.SPEC/Data/MpDataService.cs | 36 ++++++++++++ MP.SPEC/Pages/Giacenze.razor | 83 +++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 MP.SPEC/Pages/Giacenze.razor diff --git a/MP.SPEC/Components/ListDossiers.razor b/MP.SPEC/Components/ListDossiers.razor index 38bdd19f..24efa151 100644 --- a/MP.SPEC/Components/ListDossiers.razor +++ b/MP.SPEC/Components/ListDossiers.razor @@ -245,13 +245,22 @@ else @record.IdxMacchina - @*
@record.MachineNav.Descrizione
*@ @record.DtRif - @record.IdxODL +
+
+ @record.IdxODL +
+ @if (record.IdxODL > 0) + { + + } +
@if (isEditing == false) diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 9fcf22f3..36b8a481 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -734,6 +734,41 @@ namespace MP.SPEC.Data Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; } + /// + /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) + /// + /// Solo lanciati (1) o ancora disponibili (0) + /// + public async Task> ListGiacenze(int IdxOdl) + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisGiacenzaList}:{IdxOdl}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ListGiacenze(IdxOdl)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } #if false @@ -1264,6 +1299,7 @@ namespace MP.SPEC.Data private const string redisPOdlByOdl = redisXdlData + ":POdlByOdl"; private const string redisPOdlByPOdl = redisXdlData + ":POdlByPOdl"; private const string redisPOdlList = redisXdlData + ":POdlList"; + private const string redisGiacenzaList = redisBaseAddr + ":GiacenzaList"; private const string redisPOdlListNOOdl = redisXdlData + ":POdlListNOOdl"; private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; diff --git a/MP.SPEC/Pages/Giacenze.razor b/MP.SPEC/Pages/Giacenze.razor new file mode 100644 index 00000000..99fbb5ec --- /dev/null +++ b/MP.SPEC/Pages/Giacenze.razor @@ -0,0 +1,83 @@ +@page "/Giacenze" + +
+
+

Giacenze

+
+
+ + + + + + + + + + + + + + + + + + @if (elencoGiacenze != null) + { + @foreach (var item in elencoGiacenze) + { + + + + + + + + + + + + + + + + + + + + } + } + +
IdxRGIdxOdlIdentRGProductVarietySupplierExtDocDateRifQtyTotNumPackNotes
+ @item.IdxRG + + @item.IdxOdl + + @item.IdentRG + + @item.Product + + @item.Variety + + @item.Supplier + + @item.ExtDoc + + @item.DateRif + + @item.QtyTot + + @item.NumPack + + @item.Notes +
+
+ +
+ + + + + From acc31a24926e10fecfa73c17db13d5045729de8f Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 29 Nov 2022 13:12:20 +0100 Subject: [PATCH 3/4] display --- MP.SPEC/Pages/Giacenze.razor.cs | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 MP.SPEC/Pages/Giacenze.razor.cs diff --git a/MP.SPEC/Pages/Giacenze.razor.cs b/MP.SPEC/Pages/Giacenze.razor.cs new file mode 100644 index 00000000..4d799bc1 --- /dev/null +++ b/MP.SPEC/Pages/Giacenze.razor.cs @@ -0,0 +1,47 @@ +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.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using MP.Data.DatabaseModels; +using MP.SPEC.Data; +using Microsoft.AspNetCore.WebUtilities; + +namespace MP.SPEC.Pages +{ + public partial class Giacenze + { + [Inject] + MpDataService MDService { get; set; } = null!; + + [Inject] + NavigationManager NavManager { get; set; } = null!; + + protected List? elencoGiacenze; + + protected int IdxOdl = 0; + + protected override async Task OnInitializedAsync() + { + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl)) + { + IdxOdl = int.Parse(_idxOdl); + } + + elencoGiacenze = await MDService.ListGiacenze(IdxOdl); + } + + } +} \ No newline at end of file From f954fb48b5073964cecdeb8498c616fbf64dded7 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 29 Nov 2022 13:12:28 +0100 Subject: [PATCH 4/4] refresh versione --- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 663173fe..a4ce8b5e 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2911 + 6.16.2211.2912 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 89bf537c..63edddad 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.2911

+

Versione: 6.16.2211.2912


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 74ea72d1..d37a13af 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2911 +6.16.2211.2912 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 26534e8b..715bc2cd 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2911 + 6.16.2211.2912 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