diff --git a/MP-TAB3/Components/InsManual.razor b/MP-TAB3/Components/InsManual.razor index afdaa9c4..096cbf44 100644 --- a/MP-TAB3/Components/InsManual.razor +++ b/MP-TAB3/Components/InsManual.razor @@ -34,7 +34,7 @@
-
+
@foreach (var item in SeqStatus) {
diff --git a/MP-TAB3/Components/InsManual.razor.cs b/MP-TAB3/Components/InsManual.razor.cs index 03dda509..abb60c7b 100644 --- a/MP-TAB3/Components/InsManual.razor.cs +++ b/MP-TAB3/Components/InsManual.razor.cs @@ -3,6 +3,7 @@ using Microsoft.JSInterop; using MP.Core.DTO; using MP.Data.DbModels; using MP.Data.Services; +using MP_TAB3.Pages; using System.Net.Security; using static MP_TAB3.Components.ProdAdvDispl; @@ -12,11 +13,6 @@ namespace MP_TAB3.Components { #region Public Properties - /// - /// Post update restituisco nuova lista dati - /// - [Parameter] - public EventCallback> E_Updated { get; set; } [Parameter] public MappaStatoExpl? RecMSE @@ -39,6 +35,9 @@ namespace MP_TAB3.Components [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + protected MessageService MServ { get; set; } = null!; + [Inject] protected TabDataService TabDServ { get; set; } = null!; @@ -46,39 +45,7 @@ namespace MP_TAB3.Components #region Protected Methods - protected void DoEdit(InsManualiModel? selRec) - { - EditRecord = selRec; - } - - protected async Task DoSave() - { - // solo se ho record... - if (EditRecord != null) - { - // sistemo i dati... - var dayElap = EditRecord.InizioStato.Subtract(EditRecord.InizioStato.Date); - EditRecord.InizioStato = dtCurr.Date.Add(dayElap); - EditRecord.MinProd = EditRecord.TCiclo * EditRecord.PzBuoni; - EditRecord.FineStato = EditRecord.InizioStato.AddMinutes((double)EditRecord.MinProd); - // lancio salvataggio sul DB - await TabDServ.InsManUpsert(EditRecord); - // rileggo i dati... - ReloadData(); - if (!IsTimeInfoOk(dtCurr, false)) - { - int numChange = await DoRecalcDay(); - } - // rileggo i dati... - ReloadData(); - RecalcDayData(dtCurr); - //RecalcDayData(dtCurr); - EditRecord = null; - } - } - - - protected async Task AddNew() + protected void AddNew() { if (RecMSE != null) { @@ -102,14 +69,45 @@ namespace MP_TAB3.Components IdxMacchina = idxMacc, InizioStato = startPeriod, IdxTipoEv = 1, - MatrOpr = 0 + MatrOpr = MServ.MatrOpr }; } } + protected void DoEdit(InsManualiModel? selRec) + { + EditRecord = selRec; + } + + protected async Task DoSave() + { + // solo se ho record... + if (EditRecord != null) + { + // sistemo i dati... + var dayElap = EditRecord.InizioStato.Subtract(EditRecord.InizioStato.Date); + EditRecord.MatrOpr = MServ.MatrOpr; + EditRecord.InizioStato = dtCurr.Date.Add(dayElap); + EditRecord.MinProd = EditRecord.TCiclo * EditRecord.PzBuoni; + EditRecord.FineStato = EditRecord.InizioStato.AddMinutes((double)EditRecord.MinProd); + // lancio salvataggio sul DB + await TabDServ.InsManUpsert(EditRecord); + // rileggo i dati... + ReloadData(); + if (!IsTimeInfoOk(dtCurr, false)) + { + int numChange = await DoRecalcDay(); + } + // rileggo i dati... + ReloadData(); + RecalcDayData(dtCurr); + //RecalcDayData(dtCurr); + EditRecord = null; + } + } + protected async Task FixMissing() { - if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler riempire i periodi mancanti?")) return; @@ -117,7 +115,7 @@ namespace MP_TAB3.Components if (ListPeriod != null && ListPeriod.Count > 0) { // chiamo insert con eventi spenta (12) HardCoded... - int numAdd = await TabDServ.InsManFillMissing(ListDay, 12); + int numAdd = await TabDServ.InsManFillMissing(ListDay, 12, MServ.MatrOpr); // rileggo i dati... ReloadData(); RecalcDayData(dtCurr); @@ -141,6 +139,21 @@ namespace MP_TAB3.Components /// private Dictionary DateCheck = new Dictionary(); + /// + /// Minuti lavorati (da sequencer) + /// + private double DayMinLav = 0; + + /// + /// Minuti caricati (da sequencer) + /// + private double DayMinTot = 0; + + /// + /// OEE giornaliero (ore lav / 24h) + /// + private double DayOee = 0; + private InsManualiModel? EditRecord = null; private List SeqStatus = new List(); @@ -176,53 +189,6 @@ namespace MP_TAB3.Components showDetail = true; RecalcDayData(dtSel); } - /// - /// Ricalcola dati giornalieri - /// - /// - private void RecalcDayData(DateTime dtSel) - { - // filtra dati odierni x tab editabile... - if (ListPeriod != null && ListPeriod.Count > 0) - { - // calcolo eventi giorno - ListDay = ListPeriod - .Where(x => x.InizioStato.Date == dtSel) - .OrderBy(x => x.InizioStato) - .ThenBy(x => x.IdxInsMan) - //.OrderBy(x => x.IdxInsMan) - .ToList(); - - // ora calcolo il sequencer x mostrare dettaglio orario... - SeqStatus = TabDServ.InsManSeqDayStatus(ListDay); - - // calcolo min lavorati odierni - DayMinLav = 0; - var recLav = SeqStatus.FirstOrDefault(x => x.IdxTipo == 1); - if (recLav != null) - { - DayMinLav = recLav.Value; - DayOee = recLav.ValuePerc; - } - // minuti totali come record day... - DayMinTot = (double)ListDay.Sum(x => x.MinProd); - } - } - - /// - /// Minuti lavorati (da sequencer) - /// - private double DayMinLav = 0; - - /// - /// Minuti caricati (da sequencer) - /// - private double DayMinTot = 0; - - /// - /// OEE giornaliero (ore lav / 24h) - /// - private double DayOee = 0; /// /// Ricalcolo dati giornalieri @@ -242,10 +208,11 @@ namespace MP_TAB3.Components { item.InizioStato = lastDate; } - // controllo se la data fine è ok... + // controllo se la data fine � ok... if (!item.FineStato.HasValue || Math.Abs(item.InizioStato.AddMinutes((double)item.MinProd).Subtract(item.FineStato.Value).TotalMinutes) > 1) { item.FineStato = item.InizioStato.AddMinutes((double)item.MinProd); + item.MatrOpr = MServ.MatrOpr; numChange++; ListChange.Add(item); } @@ -299,6 +266,39 @@ namespace MP_TAB3.Components return await DoRecalcDay(); } + /// + /// Ricalcola dati giornalieri + /// + /// + private void RecalcDayData(DateTime dtSel) + { + // filtra dati odierni x tab editabile... + if (ListPeriod != null && ListPeriod.Count > 0) + { + // calcolo eventi giorno + ListDay = ListPeriod + .Where(x => x.InizioStato.Date == dtSel) + .OrderBy(x => x.InizioStato) + .ThenBy(x => x.IdxInsMan) + //.OrderBy(x => x.IdxInsMan) + .ToList(); + + // ora calcolo il sequencer x mostrare dettaglio orario... + SeqStatus = TabDServ.InsManSeqDayStatus(ListDay); + + // calcolo min lavorati odierni + DayMinLav = 0; + var recLav = SeqStatus.FirstOrDefault(x => x.IdxTipo == 1); + if (recLav != null) + { + DayMinLav = recLav.Value; + DayOee = recLav.ValuePerc; + } + // minuti totali come record day... + DayMinTot = (double)ListDay.Sum(x => x.MinProd); + } + } + private void ReloadData() { // rileggo dati periodo... @@ -346,7 +346,7 @@ namespace MP_TAB3.Components { // se non ok --> sposo primo e poi ricalcolo... //int numChange = await DoRecalcDay(); - } + } #endif } } @@ -354,12 +354,7 @@ namespace MP_TAB3.Components private async Task ReloadMonth(DateTime dtSel) { dtCurr = dtSel; -#if false - MService.targetDate = dtSel; - showDetail = false; - await Task.Delay(1); - MService.ReportDateChange(); -#endif + ReloadData(); await Task.Delay(1); } diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index e0140140..46ae4934 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2504.212 + 6.16.2504.216 enable MP_TAB3 diff --git a/MP-TAB3/Pages/MachineDetail.razor b/MP-TAB3/Pages/MachineDetail.razor index 7857b35d..d0bd6f9b 100644 --- a/MP-TAB3/Pages/MachineDetail.razor +++ b/MP-TAB3/Pages/MachineDetail.razor @@ -12,7 +12,7 @@ else @if (IsManual) { - + } else { diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 31831d7f..d22b27eb 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.212

+

Versione: 6.16.2504.216


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 29e490ea..5877ff0c 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.212 +6.16.2504.216 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index f4d26699..16e4348f 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.212 + 6.16.2504.216 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 333c5c7f..ce52b9fb 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1018,8 +1018,9 @@ namespace MP.Data.Services ///
/// Record dettaglio giornata /// IdxTipo da riempire + /// MatrOperatore corrente /// - public async Task InsManFillMissing(List listDetail, int idxTipoEv) + public async Task InsManFillMissing(List listDetail, int idxTipoEv, int matrOpr) { List rec2add = new List(); InsManualiModel newRec = new InsManualiModel(); @@ -1044,7 +1045,7 @@ namespace MP.Data.Services InizioStato = periodStart.Date, FineStato = periodStart, IdxTipoEv = idxTipoEv, - MatrOpr = 0, + MatrOpr = matrOpr, PzBuoni = 0, TCiclo = 0, MinProd = (decimal)periodStart.TimeOfDay.TotalMinutes @@ -1069,7 +1070,7 @@ namespace MP.Data.Services InizioStato = periodEnd, FineStato = periodEnd.Date.AddDays(1).AddSeconds(-1), IdxTipoEv = idxTipoEv, - MatrOpr = 0, + MatrOpr = matrOpr, PzBuoni = 0, TCiclo = 0, MinProd = (decimal)lastPeriod