From 591b66b52df9c0fba98644ba0411e96fe6ac010f Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 19 Oct 2022 12:49:13 +0200 Subject: [PATCH 1/6] delete msgService da dossier --- MP.SPEC/Components/ListDossiers.razor.cs | 32 +++++++--- MP.SPEC/Data/SelectArticoliParams.cs | 74 ++++++++++++++++++++++++ MP.SPEC/Data/SelectDossierParams.cs | 41 ++++++++----- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/Articoli.razor.cs | 19 +++--- MP.SPEC/Pages/DOSS.razor.cs | 26 ++++++--- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 9 files changed, 156 insertions(+), 44 deletions(-) create mode 100644 MP.SPEC/Data/SelectArticoliParams.cs diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs index 84e96282..acd2eabe 100644 --- a/MP.SPEC/Components/ListDossiers.razor.cs +++ b/MP.SPEC/Components/ListDossiers.razor.cs @@ -61,15 +61,25 @@ namespace MP.SPEC.Components } public void Dispose() { +#if false + MessageService.EA_PageUpdated -= MessageService_EA_PageUpdated; - MessageService.EA_SearchUpdated -= OnSeachUpdated; + MessageService.EA_SearchUpdated -= OnSeachUpdated; +#endif currRecord = null; SearchRecords = null; ListRecords = null; GC.Collect(); } - - + private SelectDossierParams lastFilter { get; set; } = new SelectDossierParams() { CurrPage = -1 }; + protected override async Task OnParametersSetAsync() + { + if (!lastFilter.Equals(SelFilter)) + { + lastFilter = SelFilter.clone(); + await reloadData(true); + } + } #endregion Public Methods #region Protected Properties @@ -79,10 +89,12 @@ namespace MP.SPEC.Components [Inject] protected MpDataService MDService { get; set; } = null!; +#if false [Inject] protected MessageService MessageService { get; set; } = null!; +#endif #endregion Protected Properties #region Protected Methods @@ -113,8 +125,10 @@ namespace MP.SPEC.Components protected override async Task OnInitializedAsync() { +#if false MessageService.EA_PageUpdated += MessageService_EA_PageUpdated; - MessageService.EA_SearchUpdated += OnSeachUpdated; + MessageService.EA_SearchUpdated += OnSeachUpdated; +#endif ListStati = await MDService.AnagStatiComm(); await reloadData(true); } @@ -159,11 +173,11 @@ namespace MP.SPEC.Components #endregion Private Fields #region Private Properties - + private int currPage { - get => MessageService.currPage; - set => MessageService.currPage = value; + get => SelFilter.CurrPage; + set => SelFilter.CurrPage = value; } private bool isLoading { get; set; } = false; @@ -177,8 +191,8 @@ namespace MP.SPEC.Components private int numRecord { - get => MessageService.numRecord; - set => MessageService.numRecord = value; + get => SelFilter.NumRec; + set => SelFilter.NumRec = value; } private string SelArticolo diff --git a/MP.SPEC/Data/SelectArticoliParams.cs b/MP.SPEC/Data/SelectArticoliParams.cs new file mode 100644 index 00000000..7158c192 --- /dev/null +++ b/MP.SPEC/Data/SelectArticoliParams.cs @@ -0,0 +1,74 @@ +namespace MP.SPEC.Data +{ + public class SelectArticoliParams + { + #region Public Constructors + + public SelectArticoliParams() + { } + + #endregion Public Constructors + + #region Public Properties + + + public int CurrPage { get; set; } = 1; + + public string IdxMacchina { get; set; } = "*"; + public string Azienda { get; set; } = "*"; + + public int MaxRecord { get; set; } = 100; + + public int NumRec { get; set; } = 10; + + public int TotCount { get; set; } = 0; + + #endregion Public Properties + + #region Public Methods + + public SelectArticoliParams clone() + { + SelectArticoliParams clonedData = new SelectArticoliParams() + { + CurrPage = this.CurrPage, + IdxMacchina = this.IdxMacchina, + Azienda = this.Azienda, + MaxRecord = this.MaxRecord, + NumRec = this.NumRec, + TotCount = this.TotCount + }; + return clonedData; + } + + public override bool Equals(object obj) + { + if (!(obj is SelectArticoliParams item)) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (NumRec != item.NumRec) + return false; + + if (TotCount != item.TotCount) + return false; + + if (CurrPage != item.CurrPage) + return false; + + if (IdxMacchina != item.IdxMacchina) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/SelectDossierParams.cs b/MP.SPEC/Data/SelectDossierParams.cs index c743e535..4d577074 100644 --- a/MP.SPEC/Data/SelectDossierParams.cs +++ b/MP.SPEC/Data/SelectDossierParams.cs @@ -1,4 +1,6 @@ -namespace MP.SPEC.Data +using MP.Data; + +namespace MP.SPEC.Data { public class SelectDossierParams { @@ -13,31 +15,34 @@ public int CurrPage { get; set; } = 1; - public DateTime DtEnd { get; set; } = InitDatetime(5); + public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5); - public DateTime DtStart { get; set; } = InitDatetime(5).AddDays(-730); + public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-730); public string IdxMacchina { get; set; } = "*"; public string CodArticolo { get; set; } = "*"; - + public int NumRec { get; set; } = 10; + public int TotCount { get; set; } = 0; public int MaxRecord { get; set; } = 100; #endregion Public Properties #region Public Methods - - /// - /// Inizializzazione con periodo e arrotondamento - /// - /// - /// - public static DateTime InitDatetime(int minRound) + public SelectDossierParams clone() { - TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); - int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; - DateTime endRounded = DateTime.Today.AddMinutes(minDay); - return endRounded; + SelectDossierParams clonedData = new SelectDossierParams() + { + DtEnd = this.DtEnd, + DtStart = this.DtStart, + CurrPage = this.CurrPage, + IdxMacchina = this.IdxMacchina, + CodArticolo = this.CodArticolo, + MaxRecord = this.MaxRecord, + NumRec = this.NumRec, + TotCount = this.TotCount + }; + return clonedData; } public override bool Equals(object obj) @@ -54,6 +59,12 @@ if (MaxRecord != item.MaxRecord) return false; + if (TotCount != item.TotCount) + return false; + + if (NumRec != item.NumRec) + return false; + if (DtEnd != item.DtEnd) return false; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index c0371246..fa0d94a9 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.1910 + 6.16.2210.1912 diff --git a/MP.SPEC/Pages/Articoli.razor.cs b/MP.SPEC/Pages/Articoli.razor.cs index 25bceea2..4df70329 100644 --- a/MP.SPEC/Pages/Articoli.razor.cs +++ b/MP.SPEC/Pages/Articoli.razor.cs @@ -24,9 +24,11 @@ namespace MP.SPEC.Pages return answ; } + private SelectArticoliParams currFilter = new SelectArticoliParams(); + public void Dispose() { - MessageService.EA_SearchUpdated -= OnSeachUpdated; + //MessageService.EA_SearchUpdated -= OnSeachUpdated; currRecord = null; ListTipoArt = null; ListAziende = null; @@ -54,9 +56,11 @@ namespace MP.SPEC.Pages [Inject] protected MpDataService MDService { get; set; } = null!; +#if false [Inject] - protected MessageService MessageService { get; set; } = null!; + protected MessageService MessageService { get; set; } = null!; +#endif [Inject] protected NavigationManager NavManager { get; set; } @@ -131,9 +135,6 @@ namespace MP.SPEC.Pages protected override async Task OnInitializedAsync() { numRecord = 10; - // mostro ricerca - MessageService.ShowSearch = true; - MessageService.EA_SearchUpdated += OnSeachUpdated; configData = await MDService.ConfigGetAll(); var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA"); if (currRec != null) @@ -172,14 +173,14 @@ namespace MP.SPEC.Pages { Azienda = selRec.Azienda, CodArticolo = selRec.CodArticolo, - DescArticolo = $"CLONE - { selRec.DescArticolo }", + DescArticolo = $"CLONE - {selRec.DescArticolo}", Disegno = selRec.Disegno, - Tipo=selRec.Tipo + Tipo = selRec.Tipo }; currRecord = newRec; await Task.Delay(1); } - + protected async Task update(AnagArticoli selRec) { @@ -294,7 +295,7 @@ namespace MP.SPEC.Pages private async Task reloadData() { isLoading = true; - SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, MessageService.SearchVal); + SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, "*"); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); isLoading = false; } diff --git a/MP.SPEC/Pages/DOSS.razor.cs b/MP.SPEC/Pages/DOSS.razor.cs index 4cc91662..3a9687bd 100644 --- a/MP.SPEC/Pages/DOSS.razor.cs +++ b/MP.SPEC/Pages/DOSS.razor.cs @@ -23,8 +23,10 @@ namespace MP.SPEC.Pages [Inject] protected MpDataService MDService { get; set; } = null!; +#if false [Inject] - protected MessageService MsgService { get; set; } = null!; + protected MessageService MsgService { get; set; } = null!; +#endif #endregion Protected Properties @@ -51,9 +53,11 @@ namespace MP.SPEC.Pages { isLoading = true; isFiltering = true; +#if false // disabilito ricerca... MsgService.SearchVal = ""; - MsgService.ShowSearch = false; + MsgService.ShowSearch = false; +#endif // fix pagina await Task.Delay(1); var modFilter = currFilter; @@ -115,8 +119,8 @@ namespace MP.SPEC.Pages private int currPage { - get => MsgService.currPage; - set => MsgService.currPage = value; + get => currFilter.CurrPage; + set => currFilter.CurrPage = value; } private Dossiers? currRecordDoss { get; set; } = null; @@ -125,11 +129,15 @@ namespace MP.SPEC.Pages private int numRecord { - get => MsgService.numRecord; - set => MsgService.numRecord = value; + get => currFilter.NumRec; + set => currFilter.NumRec = value; } - private int totalCount { get; set; } = 0; + private int totalCount + { + get => currFilter.TotCount; + set => currFilter.TotCount = value; + } #endregion Private Properties @@ -146,6 +154,10 @@ namespace MP.SPEC.Pages currFilter = newParams; isLoading = false; } + protected void UpdateTotCount(int newTotCount) + { + totalCount = newTotCount; + } #endregion Private Methods } diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index f16ff6c8..adc973b3 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2210.1910

+

Versione: 6.16.2210.1912


Note di rilascio: