diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 3e309cca..1a1efb73 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2504.909 + 6.16.2504.911 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/KIT.razor b/MP.SPEC/Pages/KIT.razor new file mode 100644 index 00000000..3030210a --- /dev/null +++ b/MP.SPEC/Pages/KIT.razor @@ -0,0 +1,180 @@ +@page "/KIT" + + +
+
+
+
+
+
+

KIT

+
+
+ +
+
+
+
+
+ + + + + +
+
+
+ @if (currRecord != null) + { +
+
+
+
Modifica
+
+ +
+
+
+ Codice + +
+
+
+
+ Disegno + +
+
+
+
+ Azienda + + +
+
+
+
+
+
+ Tipo + +
+
+
+
+ Descrizione + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ @**@ +
+
+
+ } +
+
+ + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
+ @if (currRecord != null) + { + + } + Articolo Disegno Descrizione Tipo Azienda
+ + + +
@record.CodArticolo
+
+
@record.Disegno
+
+
@record.DescArticolo
+
+
@record.Tipo
+
@record.Azienda + @if (ArticoloDelEnabled(record.CodArticolo)) + { + + } +
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.SPEC/Pages/KIT.razor.cs b/MP.SPEC/Pages/KIT.razor.cs new file mode 100644 index 00000000..681e0524 --- /dev/null +++ b/MP.SPEC/Pages/KIT.razor.cs @@ -0,0 +1,336 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DbModels; +using MP.SPEC.Data; + +namespace MP.SPEC.Pages +{ + public partial class KIT : ComponentBase, IDisposable + { + #region Public Methods + + public string checkSelect(string CodArticolo) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + private SelectArticoliParams currFilter = new SelectArticoliParams(); + + public void Dispose() + { + currRecord = null; + ListTipoArt = null; + ListAziende = null; + SearchRecords = null; + ListRecords = null; + GC.Collect(); + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + currPage = 1; + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected MpDataService MDService { get; set; } = null!; + + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task addNew() + { + currRecord = new AnagArticoliModel() + { + CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}", + DescArticolo = "Nuovo articolo", + Azienda = selAzienda != "*" ? selAzienda : "MAPO", + Disegno = "", + Tipo = "ART" + }; + await Task.Delay(1); + } + + protected async Task resetSearch() + { + SearchVal = ""; + await ReloadData(); + } + + protected string searchCss + { + get => string.IsNullOrEmpty(searchVal) ? "btn-secondary" : "btn-primary"; + } + + protected string SearchVal + { + get => searchVal; + set + { + // salvo solo se 3+ chars + if (value.Length > 2 || string.IsNullOrEmpty(value)) + { + if (searchVal != value) + { + searchVal = value; + var pUpd = Task.Run(async () => + { + ListRecords = null; + await Task.Delay(1); + await ReloadData(); + }); + pUpd.Wait(); + } + } + } + } + private string searchVal { get; set; } = ""; + + protected async Task cancel() + { + currRecord = null; + await ReloadData(); + await Task.Delay(1); + } + + /// + /// Eliminazione record selezionato (previa conferma) + /// + /// + /// + protected async Task deleteRecord(AnagArticoliModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", "Eliminazione Articolo: sei sicuro di voler procedere?")) + return; + await Task.Delay(1); + var done = await MDService.ArticoliDeleteRecord(selRec); + currRecord = null; + await ReloadData(); + await Task.Delay(1); + } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected override async Task OnInitializedAsync() + { + numRecord = 10; +#if false + configData = await MDService.ConfigGetAll(); + var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA"); + if (currRec != null) + { + selAzienda = currRec.Valore; + } +#endif + selAzienda = await MDService.ConfigTryGet("AZIENDA"); + ListAziende = await MDService.ElencoAziende(); + ListTipoArt = await MDService.AnagTipoArtLV(); + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + } + + protected void ResetData() + { + currRecord = null; + } + + protected async Task resetSel() + { + currRecord = null; + await Task.Delay(1); + } + + protected async Task selRecord(AnagArticoliModel selRec) + { + currRecord = selRec; + await Task.Delay(1); + } + protected async Task cloneRecord(AnagArticoliModel selRec) + { + // creo record duplicato... + AnagArticoliModel newRec = new AnagArticoliModel() + { + Azienda = selRec.Azienda, + CodArticolo = selRec.CodArticolo, + DescArticolo = $"CLONE - {selRec.DescArticolo}", + Disegno = selRec.Disegno, + Tipo = selRec.Tipo + }; + currRecord = newRec; + await Task.Delay(1); + } + + + protected async Task update(AnagArticoliModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", "Confermi di voler salvare le modifiche?")) + return; + await Task.Delay(1); + var done = await MDService.ArticoliUpdateRecord(selRec); + currRecord = null; + await ReloadData(); + await Task.Delay(1); + } + + protected async Task UpdateData() + { + currRecord = null; + await ReloadData(); + } + + #endregion Protected Methods + + #region Private Fields + + private string _selAzienda = "*"; + private AnagArticoliModel? currRecord = null; + private List? ListAziende; + private List? ListRecords; + private List? ListTipoArt; + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int _currPage { get; set; } = 1; + private int _numRecord { get; set; } = 10; + + private int currPage + { + get => _currPage; + set + { + if (_currPage != value) + { + _currPage = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => _numRecord; + set + { + if (_numRecord != value) + { + _numRecord = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + private string selAzienda + { + get => _selAzienda; + set + { + if (value != _selAzienda) + { + _selAzienda = value; + var pUpd = Task.Run(async () => + { + // svuoto cache redis... + ConfigModel updRec = new ConfigModel() + { + Chiave = "AZIENDA", + Valore = value + }; + await MDService.ConfigUpdate(updRec); + await MDService.ConfigResetCache(); + // ricarico + await Task.Delay(1); + await ReloadData(); + }); + pUpd.Wait(); + } + } + } + + private bool ShowCharts { get; set; } = false; + + #endregion Private Properties + + #region Private Methods + + /// + /// Seleziona record x editing + /// + /// + /// + private bool ArticoloDelEnabled(string codArt) + { + bool answ = MDService.ArticoloDelEnabled(codArt); + return answ; + } + + private async Task ReloadData() + { + isLoading = true; + SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 52cc8992..f8080fc9 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.909

+

Versione: 6.16.2504.911


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index e9b59e07..f96593a6 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.909 +6.16.2504.911 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index d691ce52..a61eee77 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.909 + 6.16.2504.911 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