diff --git a/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor b/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor index a1306c70..d6e1da1a 100644 --- a/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor +++ b/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor @@ -23,11 +23,15 @@ { @foreach (var item in ListArticoli) { - + } + @* @foreach (var item in ListArticoli) + { + + } *@ } - +
@@ -43,54 +47,7 @@
-@*
-
-

@Title

-
-
-
-
- - -
-
-
-
- - - -
-
-
-
*@ + @code { @@ -110,8 +67,10 @@ { if (!string.IsNullOrEmpty(SearchVal)) { - string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetArticoli?SearchArt={SearchVal}"; - var rawData = await Http.GetFromJsonAsync>(ArtApiUrl); + string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetDictArticoli?SearchArt={SearchVal}"; + // string ArtApiUrl = $"{BaseAddr}api/ListSelect/GetArticoli?SearchArt={SearchVal}"; + // var rawData = await Http.GetFromJsonAsync>(ArtApiUrl); + var rawData = await Http.GetFromJsonAsync>(ArtApiUrl); if (rawData != null) { ListArticoliAll = rawData; @@ -120,7 +79,14 @@ if (ListArticoliAll != null) { TotalCount = ListArticoliAll.Count; - ListArticoli = ListArticoliAll.Take(Num2Displ).ToList(); + ListArticoli = ListArticoliAll.Take(Num2Displ).ToDictionary(x => x.Key, x => x.Value); + DisplayCount = ListArticoli.Count; + } + else + { + TotalCount = 0; + ListArticoli = new Dictionary(); + DisplayCount = 0; } } await Task.Delay(1); @@ -176,6 +142,13 @@ protected string CodArtSel { get; set; } = ""; + + protected Dictionary ListArticoliAll { get; set; } = new Dictionary(); + protected Dictionary? ListArticoli { get; set; } = null; + + // protected List? ListArticoli { get; set; } = null; + + [Parameter] public int SearchMinChar { get; set; } [Parameter] @@ -187,8 +160,8 @@ [Parameter] public List ListMacchineAll { get; set; } = new List(); - [Parameter] - public List ListArticoliAll { get; set; } = new List(); + // [Parameter] + // public List ListArticoliAll { get; set; } = new List(); [Parameter] public int MatrOpr { get; set; } = 102; @@ -198,10 +171,10 @@ protected int Num2Displ { get; set; } = 50; protected int TotalCount { get; set; } = 0; + protected int DisplayCount { get; set; } = 0; - protected List? ListArticoli { get; set; } = null; protected void LoadMore() { @@ -209,7 +182,7 @@ // await Task.Delay(1); Num2Displ += 10; Num2Displ = Num2Displ < TotalCount ? Num2Displ : TotalCount; - ListArticoli = ListArticoliAll.Take(Num2Displ).ToList(); + // ListArticoli = ListArticoliAll.Take(Num2Displ).ToList(); } diff --git a/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor b/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor index bb9664f0..1050bc4e 100644 --- a/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor +++ b/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor @@ -3,7 +3,7 @@
- +
diff --git a/MP-TAB/MP-TAB/Controllers/ListSelectController.cs b/MP-TAB/MP-TAB/Controllers/ListSelectController.cs index 7128ed8a..05d88b71 100644 --- a/MP-TAB/MP-TAB/Controllers/ListSelectController.cs +++ b/MP-TAB/MP-TAB/Controllers/ListSelectController.cs @@ -50,6 +50,28 @@ namespace MP_TAB.Controllers return answ; } + + [HttpGet("GetDictArticoli")] + public async Task> GetDictArticoli(string SearchArt, string Azienda = "*", int NumRec = 100000) + { + Dictionary answ = new Dictionary(); + await Task.Delay(1); + try + { + var rawData = await FiltDataServ.ArticoliGetSearch(NumRec, Azienda, SearchArt); + // trasformo! + if (rawData != null) + { + answ = rawData.ToDictionary(x => x.CodArticolo, x => $"{x.CodArticolo} | {x.DescArticolo} | {x.Disegno}"); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in GetArticoli | SearchArt: {SearchArt} | Azienda: {Azienda} | NumRec: {NumRec}{Environment.NewLine}{exc}"); + } + return answ; + } + #endregion Public Methods #region Private Fields