Fix refresh post inserimento min spegnimento mancanti
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<div class="row my-1 mx-0" style="background-color: #34495E; border-radius: 12px;">
|
||||
<div class="col-12">
|
||||
<div class="col-12 px-1">
|
||||
<CalendarMonth DtRif="@dtCurr" MainCss="table table-dark table-borderless" DateSelected="DisplayDate" MonthChanged="ReloadMonth" DateCheck="@DateCheck" DateCheckBlock="@DateCFF" SingleWeek="@showDetail" SelDayCss="selDate rounded-top p-2" HeadStyle="color: #E67E22"></CalendarMonth>
|
||||
</div>
|
||||
@if (showDetail)
|
||||
@@ -8,13 +8,13 @@
|
||||
{
|
||||
if (SeqStatus != null && SeqStatus.Count() > 0)
|
||||
{
|
||||
<div class="col-12 bg-dark pt-1">
|
||||
<div class="col-12 px-1 bg-dark pt-1">
|
||||
<div class="d-flex justify-content-between fs-4">
|
||||
<div class="px-1">OEE: @($"{DayOee:P0}")</div>
|
||||
<div class="px-1">@($"{DayMinLav:N1}") min</div>
|
||||
<div class="px-1">Prod: @($"{DayMinLav:N1}") min (@($"{DayOee:P0}"))</div>
|
||||
<div class="px-1">Caricati: @($"{DayMinTot:N0}")</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 bg-dark pb-2">
|
||||
<div class="col-12 px-1 bg-dark pb-2">
|
||||
<div class="progress" style="height: 4rem;">
|
||||
@foreach (var item in SeqStatus)
|
||||
{
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-12 bg-dark py-2">
|
||||
<div class="col-12 px-1 bg-dark py-2">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="form-floating">
|
||||
@@ -71,19 +71,20 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="col-12 ">
|
||||
<div class="col-12 px-1">
|
||||
<table class="table table-dark table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Macc</th>
|
||||
<th>Comm.</th>
|
||||
<th>Stato</th>
|
||||
<th>Art.</th>
|
||||
<th>Ora</th>
|
||||
<th>Pezzi #</th>
|
||||
<th>T.Ciclo</th>
|
||||
<th>Minuti</th>
|
||||
<th></th>
|
||||
<th class="text-end">Pezzi #</th>
|
||||
<th class="text-end">T.Ciclo</th>
|
||||
<th class="text-end">Minuti</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -93,24 +94,31 @@
|
||||
<td><button class="btn btn-sm btn-primary" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pen"></i></button></td>
|
||||
<td>@item.IdxMacchina</td>
|
||||
<td>@item.KeyRichiesta</td>
|
||||
<td>@item.IdxTipoEv</td>
|
||||
<td>@item.CodArticolo</td>
|
||||
<td title="@($"{item.InizioStato:yyyy.MM.dd HH:mm:ss} --> {item.FineStato:yyyy.MM.dd HH:mm:ss}")">@($"{item.InizioStato:HH:mm}")</td>
|
||||
<td>@item.PzBuoni</td>
|
||||
<td>@($"{item.TCiclo:f3}")</td>
|
||||
<td>@($"{item.MinProd:f2}")</td>
|
||||
<td class="text-end">@item.PzBuoni</td>
|
||||
<td class="text-end">@($"{item.TCiclo:f2}")</td>
|
||||
<td class="text-end">@($"{item.MinProd:f2}")</td>
|
||||
<td class="text-end"><button class="btn btn-sm btn-danger"><i class="fa-solid fa-trash-can"></i></button></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-4 my-2">
|
||||
@* <div class="col-3 my-2">
|
||||
<button class="btn btn-warning w-100" @onclick="() => RecalcDay()"><i class="fa-solid fa-calculator"></i> Recalc</button>
|
||||
</div> *@
|
||||
<div class="col-4 my-2">
|
||||
@if (DayMinTot < 1440)
|
||||
{
|
||||
<button class="btn btn-warning w-100" @onclick="() => FixMissing()" title="Riempi periodi mancanti"><i class="fa-solid fa-fill-drip"></i> Riempi</button>
|
||||
}
|
||||
</div>
|
||||
<div class="col-4 my-2">
|
||||
</div>
|
||||
<div class="col-4 my-2">
|
||||
<button class="btn btn-info w-100" @onclick="@CloseDet"><i class="fa-solid fa-xmark"></i> Close</button>
|
||||
<button class="btn btn-dark w-100" @onclick="@CloseDet"><i class="fa-solid fa-xmark"></i> Close</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -76,9 +76,27 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task FixMissing()
|
||||
{
|
||||
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler riempire i periodi mancanti?"))
|
||||
return;
|
||||
|
||||
// filtra dati odierni x tab editabile...
|
||||
if (ListPeriod != null && ListPeriod.Count > 0)
|
||||
{
|
||||
// chiamo insert con eventi spenta (12) HardCoded...
|
||||
int numAdd = await TabDServ.InsManFillMissing(ListDay, 12);
|
||||
// rileggo i dati...
|
||||
ReloadData();
|
||||
RecalcDayData(dtCurr);
|
||||
}
|
||||
//// chiudo!
|
||||
//showDetail = false;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
//return base.OnParametersSetAsync();
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
@@ -141,11 +159,13 @@ namespace MP_TAB3.Components
|
||||
// calcolo eventi giorno
|
||||
ListDay = ListPeriod
|
||||
.Where(x => x.InizioStato.Date == dtSel)
|
||||
.OrderBy(x => x.IdxInsMan)
|
||||
.OrderBy(x => x.InizioStato)
|
||||
.ThenBy(x => x.IdxInsMan)
|
||||
//.OrderBy(x => x.IdxInsMan)
|
||||
.ToList();
|
||||
|
||||
// ora calcolo il sequencer x mostrare dettaglio orario...
|
||||
SeqStatus = TabDServ.SeqDayStatus(ListDay);
|
||||
SeqStatus = TabDServ.InsManSeqDayStatus(ListDay);
|
||||
|
||||
// calcolo min lavorati odierni
|
||||
DayMinLav = 0;
|
||||
@@ -155,14 +175,21 @@ namespace MP_TAB3.Components
|
||||
DayMinLav = recLav.Value;
|
||||
DayOee = recLav.ValuePerc;
|
||||
}
|
||||
// minuti totali come record day...
|
||||
DayMinTot = (double)ListDay.Sum(x => x.MinProd);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minuti lavorfati (da sequencer)
|
||||
/// 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>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2504.207</Version>
|
||||
<Version>6.16.2504.212</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.207</h4>
|
||||
<h4>Versione: 6.16.2504.212</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.207
|
||||
6.16.2504.212
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.207</version>
|
||||
<version>6.16.2504.212</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>
|
||||
|
||||
@@ -850,7 +850,7 @@ namespace MP.Data.Services
|
||||
public async Task<bool> FlushCache()
|
||||
{
|
||||
RedisValue pattern = new RedisValue($"{redisBaseKey}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ namespace MP.Data.Services
|
||||
public async Task<bool> FlushCache(string KeyReq)
|
||||
{
|
||||
RedisValue pattern = new RedisValue($"{redisBaseKey}:{KeyReq}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -921,11 +921,15 @@ namespace MP.Data.Services
|
||||
/// <summary>
|
||||
/// Elenco DTO x plotting seq stati giornaliero
|
||||
/// </summary>
|
||||
/// <param name="listDetail">Dettagli</param>
|
||||
/// <param name="listDetail">Record dettaglio giornata</param>
|
||||
/// <returns></returns>
|
||||
public List<ManualStatusDTO> SeqDayStatus(List<InsManualiModel> listDetail)
|
||||
public List<ManualStatusDTO> InsManSeqDayStatus(List<InsManualiModel> listDetail)
|
||||
{
|
||||
List<ManualStatusDTO>? result = new List<ManualStatusDTO>();
|
||||
// per sicurezza RIORDINO!
|
||||
listDetail = listDetail
|
||||
.OrderBy(x => x.InizioStato)
|
||||
.ToList();
|
||||
if (listDetail.Count > 0)
|
||||
{
|
||||
DateTime periodStart = listDetail.FirstOrDefault().InizioStato;
|
||||
@@ -1009,6 +1013,75 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Riempie eventuali buchi con evento indicato
|
||||
/// </summary>
|
||||
/// <param name="listDetail">Record dettaglio giornata</param>
|
||||
/// <param name="idxTipoEv">IdxTipo da riempire</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> InsManFillMissing(List<InsManualiModel> listDetail, int idxTipoEv)
|
||||
{
|
||||
List<InsManualiModel> rec2add = new List<InsManualiModel>();
|
||||
InsManualiModel newRec = new InsManualiModel();
|
||||
if (listDetail.Count > 0)
|
||||
{
|
||||
// punto come record attuale il primo
|
||||
InsManualiModel currRec = listDetail.FirstOrDefault();
|
||||
|
||||
string idxMacc = currRec.IdxMacchina;
|
||||
DateTime periodStart = currRec.InizioStato;
|
||||
DateTime periodEnd = currRec.FineStato.Value;
|
||||
|
||||
// se NON parte da mezzanotte metto un "pad iniziale"...
|
||||
if (periodStart.TimeOfDay > new TimeSpan(0))
|
||||
{
|
||||
// creo record x la durata necessaria
|
||||
newRec = new InsManualiModel()
|
||||
{
|
||||
CodArticolo = "ND",
|
||||
KeyRichiesta = "",
|
||||
IdxMacchina = idxMacc,
|
||||
InizioStato = periodStart.Date,
|
||||
FineStato = periodStart,
|
||||
IdxTipoEv = idxTipoEv,
|
||||
MatrOpr = 0,
|
||||
PzBuoni = 0,
|
||||
TCiclo = 0,
|
||||
MinProd = (decimal)periodStart.TimeOfDay.TotalMinutes
|
||||
};
|
||||
rec2add.Add(newRec);
|
||||
}
|
||||
|
||||
// cerco ultimo record...
|
||||
currRec = listDetail.LastOrDefault();
|
||||
periodStart = currRec.InizioStato;
|
||||
periodEnd = currRec.FineStato.Value;
|
||||
// se non arrivo a mezzanotte aggiungo "pad finale"
|
||||
var lastPeriod = TimeSpan.FromHours(24).Subtract(periodEnd.TimeOfDay).TotalMinutes;
|
||||
if (lastPeriod > 1)
|
||||
{
|
||||
// creo record x la durata necessaria
|
||||
newRec = new InsManualiModel()
|
||||
{
|
||||
CodArticolo = "ND",
|
||||
KeyRichiesta = "",
|
||||
IdxMacchina = idxMacc,
|
||||
InizioStato = periodEnd,
|
||||
FineStato = periodEnd.Date.AddDays(1).AddSeconds(-1),
|
||||
IdxTipoEv = idxTipoEv,
|
||||
MatrOpr = 0,
|
||||
PzBuoni = 0,
|
||||
TCiclo = 0,
|
||||
MinProd = (decimal)lastPeriod
|
||||
};
|
||||
rec2add.Add(newRec);
|
||||
}
|
||||
// eseguo upsert massivo
|
||||
await InsManUpsert(rec2add);
|
||||
}
|
||||
return rec2add.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco insManuali macchina
|
||||
/// </summary>
|
||||
@@ -1056,8 +1129,8 @@ namespace MP.Data.Services
|
||||
// salvo
|
||||
fatto = dbTabController.InsManUpsert(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{redisBaseKey}:InsMan";
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
RedisValue pattern = $"{redisBaseKey}:InsMan:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1070,8 +1143,8 @@ namespace MP.Data.Services
|
||||
// salvo
|
||||
fatto = dbTabController.InsManUpsert(listRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{redisBaseKey}:InsMan";
|
||||
await ExecFlushRedisPattern(pattern);
|
||||
RedisValue pattern = $"{redisBaseKey}:InsMan:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -1996,7 +2069,7 @@ namespace MP.Data.Services
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
var done = await ExecFlushRedisPattern(currKey);
|
||||
var done = await ExecFlushRedisPatternAsync(currKey);
|
||||
if (done)
|
||||
{
|
||||
answ = true;
|
||||
@@ -2830,7 +2903,7 @@ namespace MP.Data.Services
|
||||
{
|
||||
pattern = new RedisValue($"{MpIoNS}:{baseMem}:*");
|
||||
}
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -3721,11 +3794,11 @@ namespace MP.Data.Services
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern
|
||||
/// Esegue flush memoria redis dato pattern in async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
|
||||
private async Task<bool> ExecFlushRedisPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
@@ -3748,6 +3821,34 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato pattern, metodo sincrono
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private bool ExecFlushRedisPattern(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConn.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
redisDb.KeyDelete(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
// notifico update ai client in ascolto x reset cache
|
||||
NotifyReloadRequest($"FlushRedisCache | {pattern}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hash dati EXE TASK x la macchina specificata
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user