TAB3:
- Speedup reload calendario insManuali
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="progress" style="height: 4rem;">
|
||||
<div class="progress" style="min-height: 4rem;">
|
||||
@foreach (var item in SeqStatus)
|
||||
{
|
||||
<div class="progress-bar @item.CssBlock" style="width: @($"{item.ValuePerc:P0}");">
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Post update restituisco nuova lista dati
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<List<MappaStatoExpl>> 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<bool>("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
|
||||
/// </summary>
|
||||
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Minuti lavorati (da sequencer)
|
||||
/// </summary>
|
||||
private double DayMinLav = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Minuti caricati (da sequencer)
|
||||
/// </summary>
|
||||
private double DayMinTot = 0;
|
||||
|
||||
/// <summary>
|
||||
/// OEE giornaliero (ore lav / 24h)
|
||||
/// </summary>
|
||||
private double DayOee = 0;
|
||||
|
||||
private InsManualiModel? EditRecord = null;
|
||||
private List<ManualStatusDTO> SeqStatus = new List<ManualStatusDTO>();
|
||||
|
||||
@@ -176,53 +189,6 @@ namespace MP_TAB3.Components
|
||||
showDetail = true;
|
||||
RecalcDayData(dtSel);
|
||||
}
|
||||
/// <summary>
|
||||
/// Ricalcola dati giornalieri
|
||||
/// </summary>
|
||||
/// <param name="dtSel"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minuti lavorati (da sequencer)
|
||||
/// </summary>
|
||||
private double DayMinLav = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Minuti caricati (da sequencer)
|
||||
/// </summary>
|
||||
private double DayMinTot = 0;
|
||||
|
||||
/// <summary>
|
||||
/// OEE giornaliero (ore lav / 24h)
|
||||
/// </summary>
|
||||
private double DayOee = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricalcola dati giornalieri
|
||||
/// </summary>
|
||||
/// <param name="dtSel"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2504.212</Version>
|
||||
<Version>6.16.2504.216</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -12,7 +12,7 @@ else
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false" IdxMacchSub="@IdxMaccSubSel"></MachineBlock>
|
||||
@if (IsManual)
|
||||
{
|
||||
<InsManual RecMSE="CurrMSE" E_Updated="RefreshData"></InsManual>
|
||||
<InsManual RecMSE="CurrMSE"></InsManual>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.212</h4>
|
||||
<h4>Versione: 6.16.2504.216</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.212
|
||||
6.16.2504.216
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.212</version>
|
||||
<version>6.16.2504.216</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -1018,8 +1018,9 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
/// <param name="listDetail">Record dettaglio giornata</param>
|
||||
/// <param name="idxTipoEv">IdxTipo da riempire</param>
|
||||
/// <param name="matrOpr">MatrOperatore corrente</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> InsManFillMissing(List<InsManualiModel> listDetail, int idxTipoEv)
|
||||
public async Task<int> InsManFillMissing(List<InsManualiModel> listDetail, int idxTipoEv, int matrOpr)
|
||||
{
|
||||
List<InsManualiModel> rec2add = new List<InsManualiModel>();
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user