aggiunti metodi x filtro PODL

This commit is contained in:
zaccaria.majid
2022-11-24 18:30:44 +01:00
parent 0ece87fc87
commit efc59349f3
14 changed files with 373 additions and 62 deletions
+28 -14
View File
@@ -22,7 +22,7 @@ namespace MP.SPEC.Components
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public EventCallback<PODLModel> RecordSel { get; set; }
public EventCallback<PODLExpModel> RecordSel { get; set; }
[Parameter]
public EventCallback<int> 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
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
protected async Task deleteRecord(PODLModel selRec)
protected async Task deleteRecord(PODLExpModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("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<bool>("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<PODLModel>? ListRecords;
private PODLExpModel? currRecord = null;
private List<PODLExpModel>? ListRecords;
private List<ListValues>? ListStati;
/// <summary>
@@ -237,7 +237,7 @@ namespace MP.SPEC.Components
/// </summary>
private List<string> odlCurrList = new List<string>();
private List<PODLModel>? SearchRecords;
private List<PODLExpModel>? 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);
+72
View File
@@ -0,0 +1,72 @@
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
<div class="offcanvas-header">
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div>
<div>
Seleziona i filtri per:
</div>
</div>
<div>
<div class="small mt-2">
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Reparto</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selReparto" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListGruppiFase != null)
{
foreach (var item in ListGruppiFase)
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
<div>
<div class="small mt-2">
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Macchina</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
<select @bind="@selMacchina" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListMacchine != null)
{
foreach (var item in ListMacchine)
{
<option value="@item.CodMacchina">@item.Descrizione</option>
}
}
</select>
</div>
</div>
<div>
<div class="small mt-2">
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
</div>
<div class="input-group px-2">
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
</div>
</div>
+93
View File
@@ -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<SelectPOdlParams> FilterChanged { get; set; }
[Parameter]
public List<AnagGruppi>? ListGruppiFase { get; set; } = null;
[Parameter]
public List<Macchine>? ListMacchine { get; set; } = null;
[Parameter]
public List<ListValues>? 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
}
}
+9 -9
View File
@@ -696,30 +696,30 @@ 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<PODLModel>> ListPODLFilt(string codArt, string keyRichPart)
public async Task<List<PODLExpModel>> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo)
{
List<PODLModel>? result = new List<PODLModel>();
List<PODLExpModel>? result = new List<PODLExpModel>();
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<List<PODLModel>>($"{rawData}");
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{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<PODLModel>();
result = new List<PODLExpModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
@@ -1050,7 +1050,7 @@ namespace MP.SPEC.Data
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> PODLDeleteRecord(PODLModel currRec)
public async Task<bool> PODLDeleteRecord(PODLExpModel currRec)
{
return await dbController.PODLDeleteRecord(currRec);
}
@@ -1060,7 +1060,7 @@ namespace MP.SPEC.Data
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> POdlDoSetup(PODLModel currRec)
public async Task<bool> POdlDoSetup(PODLExpModel currRec)
{
return await dbController.PODL_startSetup(currRec, 0, 1, 1, "");
}
@@ -1070,7 +1070,7 @@ namespace MP.SPEC.Data
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public async Task<bool> POdlUpdateRecord(PODLModel currRec)
public async Task<bool> POdlUpdateRecord(PODLExpModel currRec)
{
var dbResult = await dbController.PODLUpdateRecord(currRec);
// elimino cache redis...
+5
View File
@@ -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;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.2415</Version>
<Version>6.16.2211.2418</Version>
</PropertyGroup>
<ItemGroup>
+20 -13
View File
@@ -19,6 +19,7 @@
<span class="" title="Elenco PODL già lanciati/prodotti">Lanciati</span>
</div>
</div>
</div>
<div class="px-2">
@if (addEnabled)
@@ -29,7 +30,7 @@
</div>
</div>
<div class="col-5 col-lg-4">
<div class="input-group input-group-sm">
<div class="input-group input-group-sm d-flex flex-row-reverse">
@*<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
<select @bind="@currAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
@if (ListAziende != null)
@@ -40,18 +41,24 @@
}
}
</select>*@
<label class="input-group-text" for="maxRecord" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
@*<label class="input-group-text" for="maxRecord" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
<select @bind="@currFase" class="form-select" title="Selezionare la fase da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
}
}
</select>
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
}
}
</select>*@
<div class="p-2">
<a class="pt-2 text-dark" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample">
<i class="fa-solid fa-bars"></i>
</a>
</div>
<SelFilterPODL currFilter="@currFilter" ListMacchine="@ListMacchine" ListStati="@ListStati" ListGruppiFase="@ListGruppiFase" FilterChanged="updateFilter"></SelFilterPODL>
</div>
</div>
@@ -119,7 +126,7 @@
{
<option value="@item.value">@item.label</option>
}
}
}
</select>
@@ -144,7 +151,7 @@
{
<option value="@item.CodGruppo">@item.CodGruppo | @item.DescrGruppo</option>
}
}
}
</select>
+42 -11
View File
@@ -42,7 +42,7 @@ namespace MP.SPEC.Pages
/// <returns></returns>
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<bool>("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<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende;
private List<AnagGruppi>? ListGruppiFase;
private List<Macchine>? ListMacchine;
private List<ListValues>? ListStati;
private List<PODLModel>? SearchRecords;
private List<PODLExpModel>? 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
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task callSyncDb(PODLModel selRec)
private async Task callSyncDb(PODLExpModel selRec)
{
// chiamo aggiunta task SyncDb...
string idxMacc = selRec.IdxMacchina;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.2415</h4>
<h4>Versione: 6.16.2211.2418</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2415
6.16.2211.2418
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2415</version>
<version>6.16.2211.2418</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>