- Update in cascata info di PODL
This commit is contained in:
Samuele Locatelli
2024-11-06 10:12:04 +01:00
parent 69e7f41940
commit 499bdd7348
7 changed files with 128 additions and 117 deletions
+5 -2
View File
@@ -199,7 +199,10 @@ namespace MP.SPEC.Components
ListRecords = null;
isLoading = true;
SearchRecords = await MDService.POdlListGetFilt(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd);
totalCount = SearchRecords.Count;
if (totalCount != SearchRecords.Count)
{
totalCount = SearchRecords.Count;
}
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
@@ -331,7 +334,7 @@ namespace MP.SPEC.Components
#region Private Properties
private int _totalCount { get; set; } = 0;
private int _totalCount { get; set; } = -1;
private int currPage
{
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2411.408</Version>
<Version>6.16.2411.610</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+2 -2
View File
@@ -57,7 +57,7 @@
</a>
</div>
</div>
<SelFilterXDL currFilter="@currFilter" ListMacchine="@ListMacchine" ListStati="@ListStati" ListGruppiFase="@ListGruppiFase" FilterChanged="updateFilter"></SelFilterXDL>
<SelFilterXDL currFilter="@currFilter" ListMacchine="@ListMacchine" ListStati="@ListStati" ListGruppiFase="@ListGruppiFase" FilterChanged="UpdateFilter"></SelFilterXDL>
</div>
</div>
@if (currRecord != null)
@@ -294,6 +294,6 @@
}
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="totalCount" showLoading="@isLoading" />
</div>
</div>
+117 -109
View File
@@ -16,6 +16,9 @@ namespace MP.SPEC.Pages
{
#region Protected Fields
protected bool enableForceSync = true;
protected bool enableStartPODL = true;
protected bool enableStopODL = true;
protected DataPager? pagerODL = null!;
protected bool reqNew = false;
@@ -24,6 +27,34 @@ namespace MP.SPEC.Pages
#region Protected Properties
protected string addMessage
{
get => addEnabled ? "" : "Manca Selezione Impianto / Fase";
}
protected bool canSaveEdit
{
get
{
bool answ = false;
if (currRecord != null)
{
// controllo le condizioni di selezione fase
bool okSelReparto = (useFasi4KeyRich == "FASE" && selReparto != "*") || useFasi4KeyRich != "FASE";
// controllo condizione record valido
bool okCurrRecord = currRecord.CodArticolo != "" && currRecord.CodFase != "" && currRecord.IdxMacchina != "";
answ = okCurrRecord && okSelReparto;
}
return answ;
}
}
protected string header
{
get => currFilter.Header;
set => currFilter.Header = value;
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -39,6 +70,8 @@ namespace MP.SPEC.Pages
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
protected string useFasi4KeyRich { get; set; } = "";
#endregion Protected Properties
#region Protected Methods
@@ -59,32 +92,28 @@ namespace MP.SPEC.Pages
protected async Task cancel()
{
currRecord = null;
await reloadData();
await ReloadData();
await Task.Delay(1);
}
protected void resetFase()
protected async Task editRecord(PODLExpModel selRec)
{
StatoSel = "*";
canEdit = true;
// preseleziono ricerca articolo
artSearch = selRec.CodArticolo;
currRecord = selRec;
await Task.Delay(1);
}
protected void resetMacchina()
protected async Task forceSyncDb()
{
macchina = "*";
}
protected void resetReparto()
{
selReparto = "*";
}
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler (re)inviare i dati (Articoli, PODL) all'impianto?"))
return;
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(currRecord);
await callSyncDb(clonedRec);
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
protected async Task getReparto()
@@ -133,15 +162,10 @@ namespace MP.SPEC.Pages
}
}
protected bool enableStartPODL = true;
protected bool enableStopODL = true;
protected bool enableForceSync = true;
protected string useFasi4KeyRich { get; set; } = "";
protected override async Task OnParametersSetAsync()
{
// carico dati
await reloadData();
await ReloadData();
}
protected async Task pgResetReq(bool doReset)
@@ -156,11 +180,6 @@ namespace MP.SPEC.Pages
}
}
protected string addMessage
{
get => addEnabled ? "" : "Manca Selezione Impianto / Fase";
}
/// <summary>
/// Crea nuovo record e va in editing...
/// </summary>
@@ -202,14 +221,21 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
}
protected async Task editRecord(PODLExpModel selRec)
protected void resetFase()
{
canEdit = true;
// preseleziono ricerca articolo
artSearch = selRec.CodArticolo;
currRecord = selRec;
await Task.Delay(1);
StatoSel = "*";
}
protected void resetMacchina()
{
macchina = "*";
}
protected void resetReparto()
{
selReparto = "*";
}
protected async Task selRecord(PODLExpModel selRec)
{
canEdit = false;
@@ -217,6 +243,16 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
}
protected void SetNumRec(int newNum)
{
numRecord = newNum;
}
protected void SetPage(int newNum)
{
currPage = newNum;
}
protected async Task toggleClosed()
{
hasOdl = !hasOdl;
@@ -229,6 +265,12 @@ namespace MP.SPEC.Pages
return;
await Task.Delay(1);
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(selRec);
// se x qualche motivo mancasse codGruppo --> sistemo!
if(string.IsNullOrEmpty(clonedRec.CodGruppo))
{
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
Log.Error($"CodGruppo mancante: messo valore selezionato: {currGruppoSel.CodGruppo}");
}
// se selezionato sovrascrivo...
if (useFasi4KeyRich == "FASE")
{
@@ -244,17 +286,6 @@ namespace MP.SPEC.Pages
NavManager.NavigateTo(NavManager.Uri, true);
}
protected async Task forceSyncDb()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler (re)inviare i dati (Articoli, PODL) all'impianto?"))
return;
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(currRecord);
await callSyncDb(clonedRec);
currRecord = null;
NavManager.NavigateTo(NavManager.Uri, true);
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
@@ -268,10 +299,8 @@ namespace MP.SPEC.Pages
private PODLExpModel? _currRecord = null;
private PODLExpModel currRecordControlli = new PODLExpModel();
private AnagGruppi currGruppoSel = new AnagGruppi();
private PODLExpModel currRecordControlli = new PODLExpModel();
private List<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende;
@@ -295,7 +324,7 @@ namespace MP.SPEC.Pages
get
{
//bool answ = currFase != "*";
bool answ = (useFasi4KeyRich == "FASE" && currFase != "*") || (useFasi4KeyRich != "FASE" && selReparto!="*");
bool answ = (useFasi4KeyRich == "FASE" && currFase != "*") || (useFasi4KeyRich != "FASE" && selReparto != "*");
return answ;
}
}
@@ -310,7 +339,7 @@ namespace MP.SPEC.Pages
_artSearch = value;
var pUpd = Task.Run(async () =>
{
await reloadData();
await ReloadData();
});
pUpd.Wait();
}
@@ -322,6 +351,7 @@ namespace MP.SPEC.Pages
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
}
private bool canEdit { get; set; } = false;
private string currArticolo { get; set; } = "";
private string currAzienda
@@ -334,7 +364,7 @@ namespace MP.SPEC.Pages
_currAzienda = value;
var pUpd = Task.Run(async () =>
{
await reloadData();
await ReloadData();
});
pUpd.Wait();
}
@@ -353,30 +383,6 @@ namespace MP.SPEC.Pages
}
}
}
private DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (!currFilter.DtStart.Equals(value))
{
currFilter.DtStart = value;
currPage = 1;
}
}
}
private DateTime selDtEnd
{
get => currFilter.DtEnd;
set
{
if (!currFilter.DtEnd.Equals(value))
{
currFilter.DtEnd = value;
currPage = 1;
}
}
}
private SelectXdlParams currFilter { get; set; } = new SelectXdlParams();
@@ -386,8 +392,6 @@ namespace MP.SPEC.Pages
set => currFilter.CurrPage = value;
}
private bool canEdit { get; set; } = false;
private PODLExpModel? currRecord
{
get => _currRecord;
@@ -395,11 +399,16 @@ namespace MP.SPEC.Pages
{
_currRecord = value;
#if false
artSearch = value == null ? "" : value.CodArticolo.Substring(0, 2);
artSearch = value == null ? "" : value.CodArticolo.Substring(0, 2);
#endif
}
}
private bool filtActive
{
get => macchina != "*" || StatoSel != "*" || selReparto != "*";
}
private bool hasOdl
{
get => currFilter.HasOdl;
@@ -428,6 +437,32 @@ namespace MP.SPEC.Pages
private string padCodXdl { get; set; } = "00000";
private DateTime selDtEnd
{
get => currFilter.DtEnd;
set
{
if (!currFilter.DtEnd.Equals(value))
{
currFilter.DtEnd = value;
currPage = 1;
}
}
}
private DateTime selDtStart
{
get => currFilter.DtStart;
set
{
if (!currFilter.DtStart.Equals(value))
{
currFilter.DtStart = value;
currPage = 1;
}
}
}
private string selReparto
{
get => currFilter.CodReparto;
@@ -446,16 +481,10 @@ namespace MP.SPEC.Pages
set => currFilter.TotCount = value;
}
private bool filtActive
{
get => macchina != "*" || StatoSel != "*" || selReparto != "*";
}
#endregion Private Properties
#region Private Methods
/// <summary>
/// Chiama metodo x chiedere sync DB
/// </summary>
@@ -476,7 +505,7 @@ namespace MP.SPEC.Pages
}
}
private async Task reloadData()
private async Task ReloadData()
{
isLoading = true;
await Task.Delay(1);
@@ -492,36 +521,15 @@ namespace MP.SPEC.Pages
}
isLoading = false;
}
protected bool canSaveEdit
{
get
{
bool answ = false;
if (currRecord != null)
{
// controllo le condizioni di selezione fase
bool okSelReparto = (useFasi4KeyRich == "FASE" && selReparto != "*") || useFasi4KeyRich != "FASE";
// controllo condizione record valido
bool okCurrRecord = currRecord.CodArticolo != "" && currRecord.CodFase != "" && currRecord.IdxMacchina != "";
answ = okCurrRecord && okSelReparto;
}
return answ;
}
}
protected string header
{
get => currFilter.Header;
set => currFilter.Header = value;
}
private async Task updateFilter(SelectXdlParams newParams)
private async Task UpdateFilter(SelectXdlParams newParams)
{
isLoading = true;
await Task.Delay(1);
currPage = 1;
// salvo comunque filtro reparto x utente
await localStorage.SetItemAsync("reparto", selReparto);
await reloadData();
await ReloadData();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2411.408</h4>
<h4>Versione: 6.16.2411.610</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2411.408
6.16.2411.610
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2411.408</version>
<version>6.16.2411.610</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>