update MON + update stats in prod
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
@if (CurrRecord == null || !dataLoaded)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card mb-3 border border-dark rounded rounded-3 shadow">
|
||||
<div class="card-body @cssStatus(CurrRecord.Semaforo) bg-gradient text-white p-1">
|
||||
<div class="card-title text-uppercase text-center fs-4 mb-0">@CurrRecord.Nome</div>
|
||||
<div class="bg-light bg-gradient text-dark px-1 rounded shadow small lh-sm py-1">
|
||||
<div class="card-text d-flex justify-content-between small">
|
||||
<div class="px-1">
|
||||
ART:
|
||||
</div>
|
||||
<div class="px-1">
|
||||
@if (showArt == "CodArticolo")
|
||||
{
|
||||
<span>@CurrRecord.CodArticolo</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurrRecord.Disegno))
|
||||
{
|
||||
<span>[@CurrRecord.CodArticolo]</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@CurrRecord.Disegno</span>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text d-flex justify-content-between small">
|
||||
<div class="px-1">
|
||||
PODL:
|
||||
</div>
|
||||
<div class="px-1">
|
||||
@(CurrRecord.IdxPOdl > 0 ? $"{CurrRecord.IdxPOdl:00000000}" : "-")
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text d-flex justify-content-between small">
|
||||
<div class="px-1">
|
||||
ODL:
|
||||
</div>
|
||||
<div class="px-1">
|
||||
@(CurrRecord.IdxOdl > 0 ? $"{CurrRecord.IdxOdl:00000000}" : "-")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text text-light bg-dark bg-gradient rounded py-1 shadow my-1">
|
||||
<div class=" d-flex justify-content-between text-warning small">
|
||||
<div class="px-1 text-uppercase">@CurrRecord.DescrizioneStato</div>
|
||||
<div class="px-1">@getMinSec(getDecimal(@CurrRecord.Durata))</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-around fs-5">
|
||||
<div class="px-1">
|
||||
@CurrRecord.PezziProd / @CurrRecord.NumPezzi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* <div class="shadow bg-light rounded p-1">
|
||||
<div class="progress bg-secondary " role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="height: 10px">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated bg-success" style="width: 50%"></div>
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning" style="width: 25%"></div>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
<div class="card-footer p-0 text-opacity-50 small" style="font-size: 0.7rem;">
|
||||
<div class="d-flex justify-content-between @cssComStatus(CurrRecord.Semaforo, CurrRecord.LastUpdate)">
|
||||
@if (showComErr(CurrRecord.LastUpdate))
|
||||
{
|
||||
<div class="px-1 text-warning">
|
||||
<b>C.101</b>
|
||||
</div>
|
||||
}
|
||||
<div class="px-1 text-end text-light">
|
||||
@CurrRecord.LastUpdate
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.Conf;
|
||||
using MP.Data.DbModels;
|
||||
using Org.BouncyCastle.Asn1;
|
||||
|
||||
namespace MP.Mon.Components
|
||||
{
|
||||
public partial class DetailViewMSE
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public List<TagData>? currTagConf { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public Dictionary<string, string> currTagVal { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
[Parameter]
|
||||
public bool doAnimate { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool doBlink { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public int keepAliveMin { get; set; } = 5;
|
||||
|
||||
[Parameter]
|
||||
public string showArt { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int kaFactor = 60 / 2;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool dataLoaded { get; set; } = true;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private decimal getDecimal(object? rawData)
|
||||
{
|
||||
decimal answ = 0;
|
||||
if (rawData != null)
|
||||
{
|
||||
decimal.TryParse($"{rawData}", out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string cssStatus(string codSemaforo)
|
||||
{
|
||||
string answ = "";
|
||||
// se vuoto --> mostra nero!
|
||||
if (string.IsNullOrEmpty(codSemaforo))
|
||||
{
|
||||
codSemaforo = "sNe";
|
||||
}
|
||||
string codColore = codSemaforo.Substring(1, 2);
|
||||
switch (codSemaforo)
|
||||
{
|
||||
case "sVe":
|
||||
answ = "bg-success";
|
||||
doAnimate = false;
|
||||
break;
|
||||
case "sGi":
|
||||
answ = "bg-warning";
|
||||
break;
|
||||
case "sGr":
|
||||
answ = "bg-dark opacity-75";
|
||||
doAnimate = false;
|
||||
break;
|
||||
case "sRo":
|
||||
answ = "bg-danger";
|
||||
break;
|
||||
case "sBl":
|
||||
answ = "bg-primary";
|
||||
break;
|
||||
case "sNe":
|
||||
answ = "bg-dark";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (doAnimate)
|
||||
{
|
||||
if (doBlink)
|
||||
{
|
||||
answ += " opacity-75";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
string answ = cssStatus(semaforo);
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor))
|
||||
{
|
||||
answ = $"bg-danger";
|
||||
// blink se secondo pari...
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
answ += " opacity-75";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string getMinSec(decimal? currTimeMin)
|
||||
{
|
||||
string answ = "nd";
|
||||
TimeSpan tSpan = new TimeSpan(0);
|
||||
try
|
||||
{
|
||||
double cTimeMin = currTimeMin != null ? (double)currTimeMin : 0;
|
||||
tSpan = TimeSpan.FromMinutes(cTimeMin);
|
||||
if (tSpan.TotalHours < 1)
|
||||
{
|
||||
answ = $"{tSpan:mm}:{tSpan:ss}";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{tSpan.TotalHours:N0}h {tSpan:mm}:{tSpan:ss}";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
private bool showComErr(DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
bool answ = false;
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor))
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user