diff --git a/EgwCoreLib.Lux.Core/Generic/EventDto.cs b/EgwCoreLib.Lux.Core/Generic/EventDto.cs new file mode 100644 index 00000000..a97d907f --- /dev/null +++ b/EgwCoreLib.Lux.Core/Generic/EventDto.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwCoreLib.Lux.Core.Generic +{ + public class EventDto + { + public string CodTipo { get; set; } = ""; + public int IdxEv { get; set; } = 0; + public int IdxDipendente { get; set; } = 0; + public string CognomeNome { get; set; } = ""; + public string Abbrev { get; set; } = ""; + public string Titolo { get; set; } = ""; + public string Descrizione { get; set; } = ""; + public string Tooltip { get; set; } = ""; + public DateTime DtStart { get; set; } = DateTime.Today.AddHours(9); + public DateTime DtEnd { get; set; } = DateTime.Today.AddHours(17); + public string Note { get; set; } = ""; + public bool Conf { get; set; } = false; + public bool IsDraggable { get; set; } = false; + public bool IsCompany { get; set; } = false; + + public EventDto Clone() + { + return new EventDto() + { + CodTipo = this.CodTipo, + IdxEv = this.IdxEv, + IdxDipendente = this.IdxDipendente, + CognomeNome = this.CognomeNome, + Abbrev = this.Abbrev, + Titolo = this.Titolo, + Descrizione = this.Descrizione, + Tooltip = this.Tooltip, + DtStart = this.DtStart, + DtEnd = this.DtEnd, + Note = this.Note, + Conf = this.Conf, + IsDraggable = this.IsDraggable, + IsCompany = this.IsCompany + }; + } + + public string Durata + { + get + { + string answ = "-"; + var durata = DtEnd.Subtract(DtStart); + if (CodTipo == "FER") + { + answ = $"{durata.TotalDays + 1:N0}gg"; + } + else + { + answ = $"{durata.TotalHours:N1}h"; + } + return answ; + } + } + public static string DateForm(string Tipo, DateTime DtEvent) + { + return (Tipo == "PERM" || Tipo == "104") ? $"{DtEvent:HH:mm}" : $"{DtEvent:ddd yyyy-MM-dd}"; + } + + public string Color + { + get => calcColor(CodTipo, Conf, IsCompany); + } + public string? ForeColor + { + get => calcText(CodTipo, Conf, IsCompany); + } + + private string calcColor(string codGiust, bool conf, bool isComp) + { + string answ = "#EDEDED"; + switch (codGiust) + { + case "FER": + answ = isComp ? "#EEDD11" : conf ? "#11CD44" : "#AAFFCD"; + break; + + case "FEST": + answ = "#DD0033"; + break; + + case "104": + answ = conf ? "#DE00AB" : "#FFAACD"; + break; + + case "MAL": + answ = conf ? "#000" : "#696969"; + break; + + case "PERM": + answ = conf ? "#9966DE" : "#CDAAFF"; + break; + + default: + break; + } + return answ; + } + + private string calcText(string codGiust, bool conf, bool isComp) + { + string answ = "#EDEDED"; + switch (codGiust) + { + case "FER": + answ = isComp ? "#000000" : conf ? "#FFFFFF" : "#000000"; + break; + + case "FEST": + answ = "#EEDD11"; + break; + + case "104": + answ = conf ? "#DEDEDE" : "#000000"; + break; + + case "MAL": + answ = conf ? "#DEDEDE" : "#ABABAB"; + break; + + case "PERM": + answ = conf ? "#DEDEDE" : "#000000"; + break; + + default: + break; + } + return answ; + } + + } +} diff --git a/EgwCoreLib.Lux.Data/Services/ProdService.cs b/EgwCoreLib.Lux.Data/Services/ProdService.cs index c236ad65..3aafc50c 100644 --- a/EgwCoreLib.Lux.Data/Services/ProdService.cs +++ b/EgwCoreLib.Lux.Data/Services/ProdService.cs @@ -34,7 +34,8 @@ namespace EgwCoreLib.Lux.Data.Services public enum QueueType { waiting, - running + running, + done } #endregion Public Enums diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 091debd6..37e27127 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2601.1415 + 0.9.2601.1417 diff --git a/Lux.UI/Components/App.razor b/Lux.UI/Components/App.razor index 84c281c3..56793e1b 100644 --- a/Lux.UI/Components/App.razor +++ b/Lux.UI/Components/App.razor @@ -3,6 +3,7 @@ + @@ -13,6 +14,7 @@ + @* *@ @@ -21,6 +23,7 @@ @* *@ + @@ -45,6 +48,7 @@ } }); *@ + diff --git a/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor b/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor new file mode 100644 index 00000000..e0c04898 --- /dev/null +++ b/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor @@ -0,0 +1,30 @@ +@using EgwCoreLib.Lux.Core.Generic + + + + + + @EvDTO.CodTipo | @EvDTO.Abbrev + + + @if (EvDTO.CodTipo == "PERM" || EvDTO.CodTipo == "104") + { + @($"{EventDto.DateForm(EvDTO.CodTipo, EvDTO.DtStart)} --> {EventDto.DateForm(EvDTO.CodTipo, EvDTO.DtEnd)}") + } + + + + + + + + + + + + diff --git a/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor.cs b/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor.cs new file mode 100644 index 00000000..3d75af29 --- /dev/null +++ b/Lux.UI/Components/Compo/Planner/CalendarPlanner.razor.cs @@ -0,0 +1,194 @@ +using EgwCoreLib.Lux.Core.Generic; +using EgwCoreLib.Utils; +using Microsoft.AspNetCore.Components; +using Radzen; +using Radzen.Blazor; +using static WebWindowComplex.TableComp; + +namespace Lux.UI.Components.Compo.Planner +{ + public partial class CalendarPlanner + { + #region Public Properties + + [Parameter] + public DtUtils.Periodo CurrPeriodo { get; set; } = null!; + + [Parameter] + public EventCallback EC_DtReq { get; set; } + + [Parameter] + public List EvDtoList { get; set; } = null!; + + [Parameter] + public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1); + + [Parameter] + public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1); + + [Parameter] + public DateTime minDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1); + + [Parameter] + public int MonthDispl + { + get => cMonth; + set => cMonth = value; + } + + [Parameter] + public EventCallback MonthReq { get; set; } + + [Parameter] + public bool ShowNeedConf { get; set; } = false; + + #endregion Public Properties + + #region Protected Fields + + protected RadzenScheduler scheduler = null!; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected DialogService DialogService { get; set; } = null!; + + #endregion Protected Properties + + #region Private Fields + + private int selectedIndex = 2; + + #endregion Private Fields + + #region Private Properties + + private int cMonth { get; set; } = 3; + + private List EvDtoFilt { get; set; } = new List(); + + private string schedHeight { get; set; } = "height: 50rem;"; + + private DateTime SelDate { get; set; } = DateTime.Today; + + #endregion Private Properties + + #region Private Methods + + /// + /// Sistemazione colore sfonto di ogni evento mostrato + /// + /// + private void OnAppointmentRender(SchedulerAppointmentRenderEventArgs args) + { + // Never call StateHasChanged in AppointmentRender - would lead to infinite loop + args.Attributes["style"] = $"background: {args.Data.Color}; color: {args.Data.ForeColor};"; + } + + /// + /// Selezione evento per display + /// + /// + /// + private async Task OnAppointmentSelect(SchedulerAppointmentSelectEventArgs selEv) + { + var copy = selEv.Data.Clone(); + await Task.Delay(1); + var data = await DialogService.OpenAsync("", new Dictionary { { "ThisTask", copy } }); + } + + private string currView { get; set; } = ""; + + /// + /// Gestione richeista caricamento dati dal controllo x avere nuovo set da mostrare + /// + /// + /// + private async Task OnLoadData(SchedulerLoadDataEventArgs args) + { + await Task.Delay(1); + currView = scheduler.SelectedView.Text.ToLowerInvariant(); + DateTime dtMid = args.Start.AddDays(args.End.Subtract(args.Start).TotalDays / 2); + // controllo se sia cambiata data anno precedente... + if (dtMid.Year != SelDate.Year) + { + SelDate = dtMid; + await EC_DtReq.InvokeAsync(SelDate); + } + // di almeno 1 anno in questo caso... + else if (SelDate != scheduler.Date || Math.Abs(scheduler.Date.Subtract(args.Start).TotalDays) > 365) + { + SelDate = args.Start.AddDays(4); + await EC_DtReq.InvokeAsync(SelDate); + } + + //schedHeight = (currView == "year" || currView == "planner") ? "height: 60rem;" : "height: 50rem;"; + // // Get the appointments for between the Start and End + // data = await MyAppointmentService.GetData(selEv.Start, selEv.End); + } + + private void OnSlotRender(SchedulerSlotRenderEventArgs args) + { + // Highlight today in month view + if (args.View.Text == "Month" && args.Start.Date == DateTime.Today) + { + args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));"; + } + + // Highlight working hours (9-18) + if ((args.View.Text == "Week" || args.View.Text == "Day") && args.Start.Hour > 8 && args.Start.Hour < 19) + { + args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));"; + } + } + + private async Task OnSlotSelect(SchedulerSlotSelectEventArgs args) + { + int prevIdx = selectedIndex; + await Task.Delay(1); + // verifico indice corretto della vista... + switch (args.View.Text) + { + case "Day": + selectedIndex = 0; + break; + + case "Week": + selectedIndex = 1; + break; + + case "Month": + selectedIndex = 2; + break; + + case "Planner": + selectedIndex = 3; + break; + + case "Year": + selectedIndex = 4; + break; + + default: + break; + } + if (prevIdx != selectedIndex) + { + await scheduler.Reload(); + } + await Task.Delay(1); + if (selectedIndex > 0) + { + selectedIndex--; + } + // imposto al data selezionata + SelDate = args.Start; + // riporto data al controller parent... + await EC_DtReq.InvokeAsync(SelDate); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/Planner/TaskDetail.razor b/Lux.UI/Components/Compo/Planner/TaskDetail.razor new file mode 100644 index 00000000..bf770d0c --- /dev/null +++ b/Lux.UI/Components/Compo/Planner/TaskDetail.razor @@ -0,0 +1,82 @@ +@using EgwCoreLib.Lux.Core.Generic +@inject DialogService DialogService + + + + + Tipologia: + @model.CodTipo + + + + + + Nome: + @if (@model.IdxDipendente > 0) + { + @model.Abbrev + } + else + { + @model.Descrizione + } + + + @if (model.DtEnd.Subtract(model.DtStart).TotalDays < 1 && model.CodTipo != "FER") + { + + + Data: + @($"{model.DtStart:ddd yyyy-MM-dd}") + + + } + + + Inizio: + @(EventDto.DateForm(model.CodTipo, model.DtStart)) + + + + + Fine: + @(EventDto.DateForm(model.CodTipo, model.DtEnd)) + + + @if (model.IdxDipendente == idxDipendente) + { + + + Note: + @model.Note + + + } + @if (!model.Conf) + { + + NON CONFERMATO + + } + + + +@code { + [Parameter] + public EventDto ThisTask { get; set; } = null!; + + // [Inject] + // protected MessageService AppMServ { get; set; } = null!; + + EventDto model = new EventDto(); + + protected override void OnParametersSet() + { + model = ThisTask; + } + protected int idxDipendente + { + // get => AppMServ.IdxDipendente; + get => 0; + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor b/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor new file mode 100644 index 00000000..fde5df86 --- /dev/null +++ b/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor @@ -0,0 +1,136 @@ + + + + + Job Eseguiti + @if (QueueAll.Count > 0 && EnableReset) + { + + ResetQueue()">Reset All + + } + + @if (QueuePaged == null || QueuePaged?.Count() == 0) + { + Nessun Job Eseguito! + } + else + { + foreach (var item in QueuePaged) + { + + + + @item + + + ReRunJob(item)"> Re-Run + + + + } + } + + @if (totalCount >= numRecord) + { + + + + } + + + +@code { + + #region Public Properties + + [Parameter] + public EventCallback EC_ReRunJob { get; set; } + + [Parameter] + public EventCallback EC_ResetQueue { get; set; } + + [Parameter] + public List QueueAll { get; set; } = new List(); + + [Parameter] + public string QueueType { get; set; } = "Run"; + + [Parameter] + public bool EnableReset { get; set; } = false; + + #endregion Public Properties + + #region Protected Methods + + protected override void OnParametersSet() + { + UpdateTable(); + } + + protected async Task ReRunJob(string? JobCode) + { + await EC_ReRunJob.InvokeAsync(JobCode); + } + + protected async Task ResetQueue() + { + await EC_ResetQueue.InvokeAsync(QueueType); + } + + + protected void SaveNumRec(int newNum) + { + numRecord = newNum; + UpdateTable(); + } + + protected void SavePage(int newNum) + { + currPage = newNum; + UpdateTable(); + } + + #endregion Protected Methods + + #region Private Fields + + /// + /// pagina attuale + /// + private int currPage = 1; + + /// + /// elementi per pagina + /// + private int numRecord = 10; + + /// + /// Numero tot records + /// + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private IEnumerable? QueuePaged { get; set; } = null; + + #endregion Private Properties + + #region Private Methods + + /// + /// Filtro e paginazione + /// + private void UpdateTable() + { + // fix paginazione + QueuePaged = QueueAll + .Skip(numRecord * (currPage - 1)) + .Take(numRecord); + totalCount = QueueAll.Count(); + } + + #endregion Private Methods +} diff --git a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor index 4de0189f..ea1e51ec 100644 --- a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor +++ b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor @@ -32,13 +32,13 @@ } - @if (ListRecords == null || ListRecords?.Count() == 0) + @if (QueueRunPaged == null || QueueRunPaged?.Count() == 0) { Nessun Job Eseguito! } else { - foreach (var item in ListRecords) + foreach (var item in QueueRunPaged) { diff --git a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor.cs b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor.cs index 467c6610..f56f34df 100644 --- a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor.cs +++ b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor.cs @@ -14,11 +14,14 @@ namespace Lux.UI.Components.Compo.WorkLoad [Parameter] public EventCallback EC_ResetQueue { get; set; } + [Parameter] + public List QueueWait { get; set; } = new List(); + [Parameter] public List QueueRun { get; set; } = new List(); [Parameter] - public List QueueWait { get; set; } = new List(); + public List QueueDone { get; set; } = new List(); #endregion Public Properties @@ -79,7 +82,8 @@ namespace Lux.UI.Components.Compo.WorkLoad #region Private Properties - private IEnumerable? ListRecords { get; set; } = null; + private IEnumerable? QueueRunPaged { get; set; } = null; + private IEnumerable? QueueDonePaged { get; set; } = null; #endregion Private Properties @@ -91,7 +95,7 @@ namespace Lux.UI.Components.Compo.WorkLoad private void UpdateTable() { // fix paginazione - ListRecords = QueueRun + QueueRunPaged = QueueRun .Skip(numRecord * (currPage - 1)) .Take(numRecord); totalCount = QueueRun.Count(); diff --git a/Lux.UI/Components/Pages/Orders.razor.cs b/Lux.UI/Components/Pages/Orders.razor.cs index 119c6baa..f3bca9e4 100644 --- a/Lux.UI/Components/Pages/Orders.razor.cs +++ b/Lux.UI/Components/Pages/Orders.razor.cs @@ -327,6 +327,7 @@ namespace Lux.UI.Components.Pages private bool isLoading = false; + private List JobQueueDone = new List(); private List JobQueueRun = new List(); private List JobQueueWait = new List(); @@ -545,12 +546,15 @@ namespace Lux.UI.Components.Pages // aggiorno coda corrente x display... var currQueueWait = await PService.QueueListAllAsync(ProdService.QueueType.waiting); var currQueueRun = await PService.QueueListAllAsync(ProdService.QueueType.running); + var currQueueDone = await PService.QueueListAllAsync(ProdService.QueueType.done); // converto x display... - JobQueueRun = currQueueRun.Select(x => $"{x}").ToList(); JobQueueWait = currQueueWait.Select(x => $"{x}").ToList(); + JobQueueRun = currQueueRun.Select(x => $"{x}").ToList(); + JobQueueDone = currQueueDone.Select(x => $"{x}").ToList(); // inverto ordine delle liste! - JobQueueRun.Reverse(); JobQueueWait.Reverse(); + JobQueueRun.Reverse(); + JobQueueDone.Reverse(); } diff --git a/Lux.UI/Components/Pages/ProdPlanner.razor b/Lux.UI/Components/Pages/ProdPlanner.razor index b4a2577b..32002464 100644 --- a/Lux.UI/Components/Pages/ProdPlanner.razor +++ b/Lux.UI/Components/Pages/ProdPlanner.razor @@ -11,6 +11,7 @@ + diff --git a/Lux.UI/Components/_Imports.razor b/Lux.UI/Components/_Imports.razor index cc0f06f9..e1f1cd61 100644 --- a/Lux.UI/Components/_Imports.razor +++ b/Lux.UI/Components/_Imports.razor @@ -24,3 +24,5 @@ @using Lux.UI.Components.Compo.JobTask @using Lux.UI.Components.Compo.Planner @using Lux.UI.Components.Compo.WorkLoad +@using Radzen +@using Radzen.Blazor diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 99362b32..7c14bf72 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 0.9.2601.1415 + 0.9.2601.1417 @@ -30,6 +30,7 @@ + diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs index b75bfe9c..8910f001 100644 --- a/Lux.UI/Program.cs +++ b/Lux.UI/Program.cs @@ -10,6 +10,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.FileProviders; using NLog; using NLog.Web; +using Radzen; using StackExchange.Redis; using System.Globalization; @@ -89,6 +90,9 @@ builder.Services.AddSingleton(new CalcRuidService( builder.Services.AddHostedService(); #endif +// aggiunta componenti Radzen +builder.Services.AddRadzenComponents(); + var app = builder.Build(); // aggiunt base URL x routing corretto diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index c905ffa4..dc2acee9 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES - Versione: 0.9.2601.1415 + Versione: 0.9.2601.1417 Note di rilascio: diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index e6a2efee..450e08a4 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2601.1415 +0.9.2601.1417 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index fff83ab6..932e322c 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2601.1415 + 0.9.2601.1417 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false