inizio modifica pagina ODL x SPEC

This commit is contained in:
Samuele Locatelli
2022-10-07 16:14:29 +02:00
parent a1f9a958b3
commit 1849101028
13 changed files with 330 additions and 12 deletions
+13
View File
@@ -77,6 +77,19 @@ namespace MP.Data
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
}
/// <summary>
/// Inizializzazione con periodo e arrotondamento
/// </summary>
/// <param name="minRound"></param>
/// <returns></returns>
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
}
}
+9 -2
View File
@@ -19,7 +19,7 @@ else
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
<th><i class="fa-solid fa-calendar-day"></i> Data inizio ciclo</th>
<th><i class="fa-solid fa-calendar-day"></i> Periodo</th>
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
@*<th><i class="fa-solid fa-pen-to-square"></i> Note</th>
@*<th><i class="fa-solid fa-code-pull-request"></i> Richiesta</th>
@@ -52,7 +52,14 @@ else
</td>
<td>
<div>@record.DataInizio</div>
@if (@record.DataFine != null)
{
<div>@record.DataFine</div>
}
else
{
<b><i class="fa-solid fa-hourglass-half"></i></b>
}
</td>
<td>
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
+3 -1
View File
@@ -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);
+12
View File
@@ -0,0 +1,12 @@
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @leftStringCSS">@leftString</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" checked @onclick="() => toggle()">
</div>
<span class="@rightStringCSS">@rightString</span>
</div>
</div>
+127
View File
@@ -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<SelectGlobalToggle> 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);
}
}
}
+74
View File
@@ -0,0 +1,74 @@
namespace MP.SPEC.Data
{
public class SelectGlobalToggle
{
#region Public Constructors
public SelectGlobalToggle()
{ }
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Bool: indica se il toggle è attivo
/// </summary>
public bool isActive { get; set; } = true;
/// <summary>
/// string: stringa da mostrare a sinistra (disattivo onInitialize)
/// </summary>
public string leftString { get; set; } = "";
/// <summary>
/// string: stringa da mostrare a destra (attivo onInitialize)
/// </summary>
public string rightString { get; set; } = "";
/// <summary>
/// string: stile stringa da mostrare a sinistra (disattivo onInitialize)
/// </summary>
public string leftStringCSS { get; set; } = "";
/// <summary>
/// string: stile stringa da mostrare a destra (attivo onInitialize)
/// </summary>
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
}
}
+61
View File
@@ -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
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2210.711</Version>
<Version>6.16.2210.716</Version>
</PropertyGroup>
<ItemGroup>
+10 -3
View File
@@ -4,12 +4,19 @@
<div class="card-header table-primary">
<div class="d-flex justify-content-between">
<div class="px-1">
<h3><b>ODL</b></h3>
<div class="d-flex">
<div>
<h3><b>ODL</b></h3>
</div>
<div>
<ToggleMode FilterChanged="updateFilter"></ToggleMode>
</div>
</div>
</div>
<div class="px-2">
<div class="input-group input-group">
<label class="input-group-text" for="maxRecord" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
<select @bind="@selStato" class="form-select"title="Selezionare la fase da visualizzare">
<select @bind="@selStato" class="form-select" title="Selezionare la fase da visualizzare">
<option value="*">--- Tutti ---</option>
@if (ListStati != null)
{
@@ -24,7 +31,7 @@
</div>
</div>
<div class="card-body">
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount"></ListODL>
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" inCorso="@inCorso"></ListODL>
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
+17 -2
View File
@@ -72,8 +72,6 @@ namespace MP.SPEC.Pages
#region Private Properties
private string currAzienda { get; set; } = "*";
private int currPage
{
get => MsgService.currPage;
@@ -106,6 +104,23 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
isLoading = false;
}
public bool inCorso
{
get => currFilter.isActive;
}
private SelectGlobalToggle currFilter { get; set; } = new SelectGlobalToggle();
private async Task updateFilter(SelectGlobalToggle newParams)
{
await Task.Delay(1);
await Task.Delay(1);
newParams.leftString = "Tutti gli ODL";
newParams.rightString= "ODL in corso";
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
}
#endregion Private Methods
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2210.711</h4>
<h4>Versione: 6.16.2210.716</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2210.711
6.16.2210.716
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2210.711</version>
<version>6.16.2210.716</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>