diff --git a/MP.Data/Utils.cs b/MP.Data/Utils.cs index ea335382..6f3ee38d 100644 --- a/MP.Data/Utils.cs +++ b/MP.Data/Utils.cs @@ -77,6 +77,19 @@ namespace MP.Data await Task.Run(() => File.WriteAllLines(path, lines.ToArray())); } + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + public static DateTime InitDatetime(DateTime dtRif, int minRound) + { + TimeSpan DayElapsed = dtRif.Subtract(dtRif.Date); + int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; + DateTime endRounded = DateTime.Today.AddMinutes(minDay); + return endRounded; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/MP.SPEC/Components/ListODL.razor b/MP.SPEC/Components/ListODL.razor index 9fb9debf..357aa2d3 100644 --- a/MP.SPEC/Components/ListODL.razor +++ b/MP.SPEC/Components/ListODL.razor @@ -19,7 +19,7 @@ else Articolo Fase Macchina - Data inizio ciclo + Periodo Info ciclo @* Note @* Richiesta @@ -52,7 +52,14 @@ else
@record.DataInizio
- + @if (@record.DataFine != null) + { +
@record.DataFine
+ } + else + { + + }
N° pezzi: @record.NumPezzi
diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 7ccfd34b..504e0154 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -46,6 +46,8 @@ namespace MP.SPEC.Components } return answ; } + [Parameter] + public bool inCorso { get; set; } = true; public void Dispose() { @@ -146,7 +148,7 @@ namespace MP.SPEC.Components private async Task reloadData() { isLoading = true; - SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel); + SearchRecords = await MDService.ListODLFilt(inCorso, SearchVal, StatoSel); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); diff --git a/MP.SPEC/Components/ToggleMode.razor b/MP.SPEC/Components/ToggleMode.razor new file mode 100644 index 00000000..259a0d14 --- /dev/null +++ b/MP.SPEC/Components/ToggleMode.razor @@ -0,0 +1,12 @@ +
+
+ @leftString +
+ +
+ @rightString +
+
+ + + diff --git a/MP.SPEC/Components/ToggleMode.razor.cs b/MP.SPEC/Components/ToggleMode.razor.cs new file mode 100644 index 00000000..c76ef352 --- /dev/null +++ b/MP.SPEC/Components/ToggleMode.razor.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class ToggleMode + { + [Parameter] + public EventCallback FilterChanged { get; set; } + + [Parameter] + public SelectGlobalToggle SelFilter { get; set; } = new SelectGlobalToggle(); + + protected bool isActive + { + get => SelFilter.isActive; + set + { + if (SelFilter.isActive != value) + { + SelFilter.isActive = value; + reportChange(); + } + } + } + + protected string leftString + { + get => SelFilter.leftString; + set + { + if (SelFilter.leftString != value) + { + SelFilter.leftString = value; + reportChange(); + } + } + } + protected string leftStringCSS + { + get => SelFilter.leftStringCSS; + set + { + if (SelFilter.leftStringCSS != value) + { + SelFilter.leftStringCSS = value; + reportChange(); + } + } + } + protected string rightString + { + get => SelFilter.rightString; + set + { + if (SelFilter.rightString != value) + { + SelFilter.rightString = value; + reportChange(); + } + } + } + protected string rightStringCSS + { + get => SelFilter.rightStringCSS; + set + { + if (SelFilter.rightStringCSS != value) + { + SelFilter.rightStringCSS = value; + reportChange(); + } + } + } + + protected void toggle() + { + var currFilt = SelFilter; + currFilt.isActive = !currFilt.isActive; + SelFilter = currFilt; + if (isActive) + { + rightStringCSS = "fw-bold"; + leftStringCSS = "text-secondary"; + } + else + { + leftStringCSS = "fw-bold"; + rightStringCSS = "text-secondary"; + } + } + protected override async Task OnInitializedAsync() + { + if (isActive) + { + rightStringCSS = "fw-bold"; + leftStringCSS = "text-secondary"; + } + else + { + leftStringCSS = "fw-bold"; + rightStringCSS = "text-secondary"; + } + await FilterChanged.InvokeAsync(SelFilter); + } + + private void reportChange() + { + FilterChanged.InvokeAsync(SelFilter); + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/SelectGlobalToggle.cs b/MP.SPEC/Data/SelectGlobalToggle.cs new file mode 100644 index 00000000..527bc25a --- /dev/null +++ b/MP.SPEC/Data/SelectGlobalToggle.cs @@ -0,0 +1,74 @@ +namespace MP.SPEC.Data +{ + public class SelectGlobalToggle + { + #region Public Constructors + + public SelectGlobalToggle() + { } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Bool: indica se il toggle è attivo + /// + public bool isActive { get; set; } = true; + + /// + /// string: stringa da mostrare a sinistra (disattivo onInitialize) + /// + public string leftString { get; set; } = ""; + + /// + /// string: stringa da mostrare a destra (attivo onInitialize) + /// + public string rightString { get; set; } = ""; + + /// + /// string: stile stringa da mostrare a sinistra (disattivo onInitialize) + /// + public string leftStringCSS { get; set; } = ""; + + /// + /// string: stile stringa da mostrare a destra (attivo onInitialize) + /// + public string rightStringCSS { get; set; } = ""; + + + #endregion Public Properties + + #region Public Methods + + public override bool Equals(object obj) + { + if (!(obj is SelectGlobalToggle item)) + return false; + + if (isActive != item.isActive) + return false; + + if (leftString != item.leftString) + return false; + + if (rightString != item.rightString) + return false; + + if (leftStringCSS != item.leftStringCSS) + return false; + + if (rightStringCSS != item.rightStringCSS) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} diff --git a/MP.SPEC/Data/SelectOdlParams.cs b/MP.SPEC/Data/SelectOdlParams.cs new file mode 100644 index 00000000..8533639e --- /dev/null +++ b/MP.SPEC/Data/SelectOdlParams.cs @@ -0,0 +1,61 @@ +using MP.Data; + +namespace MP.SPEC.Data +{ + public class SelectOdlParams + { + #region Public Constructors + + public SelectOdlParams() + { } + + #endregion Public Constructors + + #region Public Properties + + public string CodStato { get; set; } = "*"; + public int CurrPage { get; set; } = 1; + + public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5); + public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now.AddDays(-7), 5); + public int MaxRecord { get; set; } = 100; + public bool ShowClosed { get; set; } = false; + + #endregion Public Properties + + #region Public Methods + + public override bool Equals(object obj) + { + if (!(obj is SelectOdlParams item)) + return false; + + if (ShowClosed != item.ShowClosed) + return false; + + if (CodStato != item.CodStato) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (DtStart != item.DtStart) + return false; + + if (DtEnd != item.DtEnd) + return false; + + if (CurrPage != item.CurrPage) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index e8b293b6..bd1cca50 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.711 + 6.16.2210.716 diff --git a/MP.SPEC/Pages/ODL.razor b/MP.SPEC/Pages/ODL.razor index b66e1d20..82290fd4 100644 --- a/MP.SPEC/Pages/ODL.razor +++ b/MP.SPEC/Pages/ODL.razor @@ -4,12 +4,19 @@
-

ODL

+
+
+

ODL

+
+
+ +
+
- @if (ListStati != null) { @@ -24,7 +31,7 @@
- +