Update gestione ins manuali
This commit is contained in:
@@ -8,29 +8,21 @@
|
||||
{
|
||||
if (SeqStatus != null && SeqStatus.Count() > 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="col-12 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>
|
||||
</div>
|
||||
<div class="col-12 bg-dark pb-2">
|
||||
<div class="progress" style="height: 4rem;">
|
||||
@foreach (var item in SeqStatus)
|
||||
{
|
||||
<div class="progress-bar @item.CssBlock" style="width: @($"{item.ValuePerc:P0}");">
|
||||
<div>@item.Title</div>
|
||||
<small>@($"{item.Value:N0}min")</small>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
@* <div runat="server" id="divGray" class="progress-bar bg-secondary" style="width: @(NumGray)%">
|
||||
@($"{NumGray}%")
|
||||
</div>
|
||||
<div runat="server" id="divGreen" class="progress-bar bg-success" style="width: @(NumGreen)%">
|
||||
@($"{NumGreen}%")
|
||||
</div>
|
||||
<div runat="server" id="divYellow" class="progress-bar bg-warning text-dark" style="width: @(NumYellow)%">
|
||||
@($"{NumYellow}%")
|
||||
</div>
|
||||
<div runat="server" id="divGray" class="progress-bar bg-secondary" style="width: @(NumGray)%">
|
||||
@($"{NumGray}%")
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -102,7 +94,7 @@
|
||||
<td>@item.IdxMacchina</td>
|
||||
<td>@item.KeyRichiesta</td>
|
||||
<td>@item.CodArticolo</td>
|
||||
<td>@($"{item.InizioStato:HH:mm}")</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>
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
|
||||
using MP.Core.DTO;
|
||||
using MP.Data.DbModels;
|
||||
using MP.Data.Services;
|
||||
using System.Net.Security;
|
||||
using static MP_TAB3.Components.ProdAdvDispl;
|
||||
|
||||
namespace MP_TAB3.Components
|
||||
@@ -11,6 +12,12 @@ 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
|
||||
{
|
||||
@@ -24,111 +31,20 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Post update restituisco nuova lista dati
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<List<MappaStatoExpl>> E_Updated { get; set; }
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
#region Protected Properties
|
||||
|
||||
private bool confProdActive { get; set; } = false;
|
||||
private MappaStatoExpl? currRecMSE { get; set; } = null;
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
private DateTime dtCurr { get; set; } = DateTime.Today;
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
private void DisplayDate(DateTime dtSel)
|
||||
{
|
||||
dtCurr = dtSel;
|
||||
showDetail = true;
|
||||
// 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.IdxInsMan)
|
||||
.ToList();
|
||||
#endregion Protected Properties
|
||||
|
||||
// ora calcolo il sequencer x mostrare dettaglio orario...
|
||||
SeqStatus = TabDServ.SeqDayStatus(ListDay);
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseDet()
|
||||
{
|
||||
showDetail = false;
|
||||
}
|
||||
|
||||
private async Task ReloadMonth(DateTime dtSel)
|
||||
{
|
||||
dtCurr = dtSel;
|
||||
#if false
|
||||
MService.targetDate = dtSel;
|
||||
showDetail = false;
|
||||
await Task.Delay(1);
|
||||
MService.ReportDateChange();
|
||||
#endif
|
||||
await Task.Delay(1);
|
||||
}
|
||||
/// <summary>
|
||||
/// Lista date + css associato x display calendario
|
||||
/// </summary>
|
||||
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
|
||||
private Dictionary<DateTime, string> DateCFF = new Dictionary<DateTime, string>();
|
||||
|
||||
private List<ManualStatusDTO> SeqStatus = new List<ManualStatusDTO>();
|
||||
|
||||
private bool showDetail { get; set; } = false;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
//return base.OnParametersSetAsync();
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
// rileggo dati periodo...
|
||||
ListDTO = new List<InsManDayDto>();
|
||||
if (RecMSE != null)
|
||||
{
|
||||
DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1);
|
||||
DateTime MeseEnd = MeseStart.AddMonths(1);
|
||||
ListPeriod = TabDServ.InsManFilt(RecMSE.IdxMacchina, MeseStart, MeseEnd);
|
||||
ListDTO = TabDServ.InsManDayDto(ListPeriod);
|
||||
DateCheck = new Dictionary<DateTime, string>();
|
||||
DateCFF = new Dictionary<DateTime, string>();
|
||||
string cssOkComm = "bg-success text-light rounded-circle p-2";
|
||||
string cssOkLav = "bg-warning text-light rounded-circle p-2";
|
||||
string cssToday = "bg-info text-dark rounded-circle p-2";
|
||||
string cssFest = "bg-danger text-warning rounded-pill2 px-0 opacity-50";
|
||||
string cssChius = "bg-warning text-dark rounded-pill2 px-0 opacity-50";
|
||||
string cssFerie = "bg-success text-light px-0 opacity-50";
|
||||
if (ListDTO != null)
|
||||
{
|
||||
string currCss = "";
|
||||
foreach (var item in ListDTO)
|
||||
{
|
||||
currCss = item.MinProdTot == 0 ? "" : cssOkLav;
|
||||
if (item.DataRif == DateTime.Today)
|
||||
{
|
||||
currCss = cssToday;
|
||||
}
|
||||
else if (item.RatioImport == 1)
|
||||
{
|
||||
currCss = cssOkComm;
|
||||
}
|
||||
DateCheck.Add(item.DataRif, currCss);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Protected Methods
|
||||
|
||||
protected void DoEdit(InsManualiModel? selRec)
|
||||
{
|
||||
@@ -147,43 +63,115 @@ namespace MP_TAB3.Components
|
||||
EditRecord.FineStato = EditRecord.InizioStato.AddMinutes((double)EditRecord.MinProd);
|
||||
// lancio salvataggio sul DB
|
||||
await TabDServ.InsManUpsert(EditRecord);
|
||||
EditRecord = null;
|
||||
if (!timeInfoOk())
|
||||
// rileggo i dati...
|
||||
ReloadData();
|
||||
if (!IsTimeInfoOk())
|
||||
{
|
||||
int numChange = await DoRecalcDay();
|
||||
}
|
||||
// rileggo i dati...
|
||||
ReloadData();
|
||||
//RecalcDayData(dtCurr);
|
||||
EditRecord = null;
|
||||
}
|
||||
}
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
private bool timeInfoOk()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
bool allOk = false;
|
||||
if (ListDTO != null)
|
||||
//return base.OnParametersSetAsync();
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private Dictionary<DateTime, string> DateCFF = new Dictionary<DateTime, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Lista date + css associato x display calendario
|
||||
/// </summary>
|
||||
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
|
||||
|
||||
private InsManualiModel? EditRecord = null;
|
||||
private List<ManualStatusDTO> SeqStatus = new List<ManualStatusDTO>();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool confProdActive { get; set; } = false;
|
||||
private MappaStatoExpl? currRecMSE { get; set; } = null;
|
||||
|
||||
private DateTime dtCurr { get; set; } = DateTime.Today;
|
||||
|
||||
private List<InsManualiModel>? ListDay { get; set; } = new List<InsManualiModel>();
|
||||
|
||||
private List<InsManDayDto>? ListDTO { get; set; } = new List<InsManDayDto>();
|
||||
|
||||
private List<InsManualiModel>? ListPeriod { get; set; } = new List<InsManualiModel>();
|
||||
|
||||
private bool showDetail { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void CloseDet()
|
||||
{
|
||||
showDetail = false;
|
||||
}
|
||||
|
||||
private void DisplayDate(DateTime dtSel)
|
||||
{
|
||||
dtCurr = dtSel;
|
||||
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)
|
||||
{
|
||||
var dayDto = ListDTO.FirstOrDefault(x => x.DataRif == dtCurr.Date);
|
||||
if (dayDto != null && ListDay != null)
|
||||
// calcolo eventi giorno
|
||||
ListDay = ListPeriod
|
||||
.Where(x => x.InizioStato.Date == dtSel)
|
||||
.OrderBy(x => x.IdxInsMan)
|
||||
.ToList();
|
||||
|
||||
// ora calcolo il sequencer x mostrare dettaglio orario...
|
||||
SeqStatus = TabDServ.SeqDayStatus(ListDay);
|
||||
|
||||
// calcolo min lavorati odierni
|
||||
DayMinLav = 0;
|
||||
var recLav = SeqStatus.FirstOrDefault(x => x.IdxTipo == 1);
|
||||
if (recLav != null)
|
||||
{
|
||||
var firstRec = ListDay.OrderBy(x => x.InizioStato).FirstOrDefault();
|
||||
var lastRec = ListDay.OrderByDescending(x => x.InizioStato).FirstOrDefault();
|
||||
var deltaMins = lastRec!.FineStato!.Value.Subtract(firstRec!.InizioStato).TotalMinutes;
|
||||
allOk = Math.Abs(deltaMins - (double)dayDto.MinProdTot) < 1;
|
||||
DayMinLav = recLav.Value;
|
||||
DayOee = recLav.ValuePerc;
|
||||
}
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
|
||||
private async Task<int> RecalcDay()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler ricalcolare i dati della giornata?"))
|
||||
return 0;
|
||||
/// <summary>
|
||||
/// Minuti lavorfati (da sequencer)
|
||||
/// </summary>
|
||||
private double DayMinLav = 0;
|
||||
|
||||
return await DoRecalcDay();
|
||||
}
|
||||
/// <summary>
|
||||
/// OEE giornaliero (ore lav / 24h)
|
||||
/// </summary>
|
||||
private double DayOee = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ricalcolo dati giornalieri
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<int> DoRecalcDay()
|
||||
{
|
||||
int numChange = 0;
|
||||
@@ -213,16 +201,90 @@ namespace MP_TAB3.Components
|
||||
return numChange;
|
||||
}
|
||||
|
||||
private bool IsTimeInfoOk()
|
||||
{
|
||||
bool allOk = false;
|
||||
if (ListDTO != null)
|
||||
{
|
||||
var dayDto = ListDTO.FirstOrDefault(x => x.DataRif == dtCurr.Date);
|
||||
if (dayDto != null && ListDay != null)
|
||||
{
|
||||
var firstRec = ListDay.OrderBy(x => x.InizioStato).FirstOrDefault();
|
||||
var lastRec = ListDay.OrderByDescending(x => x.InizioStato).FirstOrDefault();
|
||||
var deltaMins = lastRec!.FineStato!.Value.Subtract(firstRec!.InizioStato).TotalMinutes;
|
||||
allOk = Math.Abs(deltaMins - (double)dayDto.MinProdTot) < 1;
|
||||
}
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
|
||||
private double NumGreen = 25;
|
||||
private double NumYellow = 5;
|
||||
private double NumGray = 30;
|
||||
private async Task<int> RecalcDay()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler ricalcolare i dati della giornata?"))
|
||||
return 0;
|
||||
|
||||
private List<InsManDayDto>? ListDTO { get; set; } = new List<InsManDayDto>();
|
||||
private List<InsManualiModel>? ListPeriod { get; set; } = new List<InsManualiModel>();
|
||||
private List<InsManualiModel>? ListDay { get; set; } = new List<InsManualiModel>();
|
||||
private InsManualiModel? EditRecord = null;
|
||||
return await DoRecalcDay();
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
private void ReloadData()
|
||||
{
|
||||
// rileggo dati periodo...
|
||||
ListDTO = new List<InsManDayDto>();
|
||||
if (RecMSE != null)
|
||||
{
|
||||
DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1);
|
||||
DateTime MeseEnd = MeseStart.AddMonths(1);
|
||||
ListPeriod = TabDServ.InsManFilt(RecMSE.IdxMacchina, MeseStart, MeseEnd);
|
||||
ListDTO = TabDServ.InsManDayDto(ListPeriod);
|
||||
DateCheck = new Dictionary<DateTime, string>();
|
||||
DateCFF = new Dictionary<DateTime, string>();
|
||||
string cssOkComm = "bg-success text-light rounded-circle p-2";
|
||||
string cssOkLav = "bg-warning text-light rounded-circle p-2";
|
||||
string cssToday = "bg-info text-dark rounded-circle p-2";
|
||||
string cssFest = "bg-danger text-warning rounded-pill2 px-0 opacity-50";
|
||||
string cssChius = "bg-warning text-dark rounded-pill2 px-0 opacity-50";
|
||||
string cssFerie = "bg-success text-light px-0 opacity-50";
|
||||
if (ListDTO != null)
|
||||
{
|
||||
string currCss = "";
|
||||
foreach (var item in ListDTO)
|
||||
{
|
||||
currCss = item.MinProdTot == 0 ? "" : cssOkLav;
|
||||
if (item.DataRif == DateTime.Today)
|
||||
{
|
||||
currCss = cssToday;
|
||||
}
|
||||
else if (item.RatioImport == 1)
|
||||
{
|
||||
currCss = cssOkComm;
|
||||
}
|
||||
DateCheck.Add(item.DataRif, currCss);
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
// verifico dati giornalieri...
|
||||
if (!IsTimeInfoOk())
|
||||
{
|
||||
// se non ok --> sposo primo e poi ricalcolo...
|
||||
//int numChange = await DoRecalcDay();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadMonth(DateTime dtSel)
|
||||
{
|
||||
dtCurr = dtSel;
|
||||
#if false
|
||||
MService.targetDate = dtSel;
|
||||
showDetail = false;
|
||||
await Task.Delay(1);
|
||||
MService.ReportDateChange();
|
||||
#endif
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2504.116</Version>
|
||||
<Version>6.16.2504.207</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.116</h4>
|
||||
<h4>Versione: 6.16.2504.207</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.116
|
||||
6.16.2504.207
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.116</version>
|
||||
<version>6.16.2504.207</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>
|
||||
|
||||
@@ -960,6 +960,15 @@ namespace MP.Data.Services
|
||||
periodStart = item.InizioStato;
|
||||
periodEnd = item.FineStato.Value;
|
||||
duration = (double)item.MinProd;
|
||||
currRec = new ManualStatusDTO
|
||||
{
|
||||
IdxTipo = lastIdxTipo,
|
||||
// fare da DB --> anagEventi
|
||||
CssBlock = item.IdxTipoEv == 1 ? "bg-success text-light" : "bg-secondary text-light",
|
||||
Title = $"{periodStart:HH:mm}-{periodEnd:HH:mm}",
|
||||
Value = duration,
|
||||
ValueMax = 1440
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user