Update fix x ODL con filtri nuovi
This commit is contained in:
@@ -6,6 +6,7 @@ using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
@@ -325,7 +326,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo== CodArticolo) && x.DtRif <= DtRef)
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo == CodArticolo) && x.DtRif <= DtRef)
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(o => o.OdlNav)
|
||||
.Include(a => a.OdlNav.ArticoloNav)
|
||||
@@ -436,19 +437,21 @@ namespace MP.Data.Controllers
|
||||
/// <param name="inCorso">Stato ODL: true=in corso/completato</param>
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <param name="startDate">Data inizio</param>
|
||||
/// <param name="endDate">Data fine</param>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart)
|
||||
public List<ODLModel> ListODLFilt(bool inCorso, string codArt, string keyRichPart, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.Where(x => ((inCorso && x.DataFine == null) || ((!inCorso && x.DataFine != null) && x.DataInizio >= startDate && x.DataInizio <= endDate)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
|
||||
.AsNoTracking()
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderBy(x => x.IdxOdl)
|
||||
.OrderByDescending(x => x.IdxOdl)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
|
||||
@@ -10,20 +10,10 @@ namespace MP.SPEC.Components
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
public SelectOdlParams currFilter { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public string StatoSel
|
||||
{
|
||||
get => _statoSel;
|
||||
set
|
||||
{
|
||||
if (_statoSel != value)
|
||||
{
|
||||
_statoSel = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> updateRecordCount { get; set; }
|
||||
@@ -46,8 +36,6 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
[Parameter]
|
||||
public bool inCorso { get; set; } = true;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -57,6 +45,7 @@ namespace MP.SPEC.Components
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -75,8 +64,10 @@ namespace MP.SPEC.Components
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
#if false
|
||||
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -105,7 +96,6 @@ namespace MP.SPEC.Components
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _statoSel = "*";
|
||||
private ODLModel? currRecord = null;
|
||||
private List<ODLModel>? ListRecords;
|
||||
private List<ListValues>? ListStati;
|
||||
@@ -129,11 +119,6 @@ namespace MP.SPEC.Components
|
||||
set => MessageService.numRecord = value;
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
|
||||
}
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -148,7 +133,7 @@ namespace MP.SPEC.Components
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListODLFilt(inCorso, SearchVal, StatoSel);
|
||||
SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.DtStart, currFilter.DtEnd);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -473,9 +473,9 @@ namespace MP.SPEC.Data
|
||||
/// <param name="codArt">Cod articolo</param>
|
||||
/// <param name="keyRichPart">KeyRich (parziale) da cercare (es cod stato x yacht)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart)
|
||||
public async Task<List<ODLModel>> ListODLFilt(bool inCorso, string codArt, string keyRichPart, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart));
|
||||
return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, startDate, endDate));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,11 +15,12 @@ namespace MP.SPEC.Data
|
||||
|
||||
public string CodStato { get; set; } = "*";
|
||||
public int CurrPage { get; set; } = 1;
|
||||
|
||||
public int NumRec { get; set; } = 10;
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now.AddDays(-7), 5);
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-7);
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public bool ShowClosed { get; set; } = false;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string SearchVal { get; set; } = "*";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -30,7 +31,7 @@ namespace MP.SPEC.Data
|
||||
if (!(obj is SelectOdlParams item))
|
||||
return false;
|
||||
|
||||
if (ShowClosed != item.ShowClosed)
|
||||
if (IsActive != item.IsActive)
|
||||
return false;
|
||||
|
||||
if (CodStato != item.CodStato)
|
||||
@@ -39,6 +40,9 @@ namespace MP.SPEC.Data
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (DtStart != item.DtStart)
|
||||
return false;
|
||||
|
||||
@@ -48,6 +52,9 @@ namespace MP.SPEC.Data
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,12 @@
|
||||
<h3><b>ODL</b></h3>
|
||||
</div>
|
||||
<div>
|
||||
<ToggleMode FilterChanged="updateFilter"></ToggleMode>
|
||||
@*<ToggleMode FilterChanged="updateFilter" SelFilter="toggleFilter"></ToggleMode>*@
|
||||
<span class="me-1 @leftStringCSS">Completati</span>
|
||||
<span class="form-check form-check-sm form-switch py-1" title="ODL Chiusi / Correnti">
|
||||
<input class="form-check-input" type="checkbox" id="switchActive" @bind="@isActive">
|
||||
</span>
|
||||
<span class="@rightStringCSS">In Corso</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,7 +36,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" inCorso="@inCorso"></ListODL>
|
||||
<ListODL PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" currFilter="@currFilter"></ListODL>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
|
||||
+31
-25
@@ -7,6 +7,11 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class ODL
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager pagerODL;
|
||||
@@ -28,11 +33,6 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -50,8 +50,10 @@ namespace MP.SPEC.Pages
|
||||
// resetto search
|
||||
MsgService.SearchVal = "";
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
#if false
|
||||
// carico dati
|
||||
await reloadData();
|
||||
await reloadData();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
@@ -62,6 +64,11 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -72,6 +79,8 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectOdlParams currFilter { get; set; } = new SelectOdlParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MsgService.currPage;
|
||||
@@ -86,7 +95,13 @@ namespace MP.SPEC.Pages
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string selStato { get; set; } = "*";
|
||||
private string selStato
|
||||
{
|
||||
get => currFilter.CodStato;
|
||||
set => currFilter.CodStato = value;
|
||||
}
|
||||
|
||||
private SelectGlobalToggle toggleFilter { get; set; } = new SelectGlobalToggle();
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
@@ -98,28 +113,19 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
protected bool isActive
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
public bool inCorso
|
||||
{
|
||||
get => currFilter.isActive;
|
||||
get => currFilter.IsActive;
|
||||
set => currFilter.IsActive = value;
|
||||
}
|
||||
|
||||
private SelectGlobalToggle currFilter { get; set; } = new SelectGlobalToggle();
|
||||
|
||||
private async Task updateFilter(SelectGlobalToggle newParams)
|
||||
private string leftStringCSS
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await Task.Delay(1);
|
||||
|
||||
newParams.leftString = "Tutti gli ODL";
|
||||
newParams.rightString= "ODL in corso";
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
get => isActive ? "text-secondary" : "text-dark";
|
||||
}
|
||||
private string rightStringCSS
|
||||
{
|
||||
get => isActive ? "text-dark" : "text-secondary";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
Reference in New Issue
Block a user