Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd6548af2f | |||
| 40a5d6513d | |||
| 04cc2aa538 | |||
| 5a7c1c7d9c | |||
| 17bc27ef38 | |||
| 03f3241966 | |||
| cc01ffb89b | |||
| 7d76b7b5f7 | |||
| f84671fee8 | |||
| d93f5e168d | |||
| 424f3f3e9d | |||
| b68eadc2f7 | |||
| 98d3f13972 | |||
| 595ea40e6c | |||
| 3ce3808995 | |||
| a9011e014b | |||
| de1d30fdb6 | |||
| 1eb01b0532 | |||
| 20ae251943 |
@@ -49,6 +49,26 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
protected bool ShowInsFermata { get; set; } = false;
|
||||
|
||||
protected bool ShowReqControls { get; set; } = false;
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica necessit� visualizzare il check controlli
|
||||
/// </summary>
|
||||
@@ -87,25 +107,6 @@ namespace MP_TAB3.Components
|
||||
return answ;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
protected bool ShowInsFermata { get; set; } = false;
|
||||
|
||||
protected bool ShowReqControls { get; set; } = false;
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
protected DateTime lastCheck = DateTime.Today;
|
||||
protected string lastIdxMacc = "";
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void GoToControls()
|
||||
{
|
||||
NavMan.NavigateTo("controls");
|
||||
@@ -120,13 +121,11 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
if (RecMSE != null)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso.Subtract(lastCheck).TotalSeconds > 15 || lastIdxMacc != RecMSE.IdxMacchina)
|
||||
if (MServ.LastIdxMacchina != RecMSE.IdxMacchina)
|
||||
{
|
||||
ShowInsFermata = CheckShowInsFermata;
|
||||
ShowReqControls = await CheckShowReqControls();
|
||||
lastIdxMacc = RecMSE.IdxMacchina;
|
||||
lastCheck = adesso;
|
||||
MServ.LastIdxMacchina = RecMSE.IdxMacchina;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,17 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<ProgBar currVal="@CurrExpVal" maxVal="@MaxExpVal" singleLine="true" baseUM="m" yelLim="@yLimit" redLim="@rLimit"></ProgBar>
|
||||
if (MatrOper >= 0)
|
||||
{
|
||||
if (showProgrBar)
|
||||
{
|
||||
<ProgBar currVal="@CurrExpVal" maxVal="@MaxExpVal" singleLine="true" baseUM="m" yelLim="@yLimit" redLim="@rLimit"></ProgBar>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info text-center p-0 mb-0">...login...</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -8,9 +8,15 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public Guid CurrDevGuid { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int DtScadLogin { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public int MatrOper { get; set; } = -1;
|
||||
|
||||
[Parameter]
|
||||
public int TypeScadLogin { get; set; } = -1;
|
||||
|
||||
@@ -41,6 +47,9 @@ namespace MP_TAB3.Components
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TDataService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -49,16 +58,50 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
if (TypeScadLogin > 0)
|
||||
{
|
||||
var diffOfTime = DateTime.Now.Subtract(MsgServ.dtLastAction);
|
||||
CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
adesso = DateTime.Now;
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
// solo se NON sono in login...
|
||||
if (!IsLoginPage)
|
||||
{
|
||||
var diffOfTime = adesso.Subtract(MsgServ.dtLastAction);
|
||||
CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes;
|
||||
if (TypeScadLogin == 1)
|
||||
{
|
||||
if (CurrExpVal < 0)
|
||||
{
|
||||
MsgServ.dtLastAction = adesso;
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
}
|
||||
// in questo caso cerco SOLO se sia scaduto su redis
|
||||
else if (TypeScadLogin == 2)
|
||||
{
|
||||
// mitigazione check: solo ogni 10 secondi...
|
||||
if (adesso.Subtract(MsgServ.dtLastSave).TotalSeconds > 10)
|
||||
{
|
||||
MsgServ.dtLastSave = adesso;
|
||||
// rileggo scadenza ultima...
|
||||
TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOper, CurrDevGuid);
|
||||
// mostro scadenza SOLO se inferiore a 24h...
|
||||
showProgrBar = tsScadenza.TotalHours < 24;
|
||||
// se < 0 --> login
|
||||
if (tsScadenza.TotalMinutes < 0)
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgServ.dtLastAction = adesso.Subtract(TimeSpan.FromMinutes(MaxExpVal)).Add(tsScadenza);
|
||||
}
|
||||
// comunque controllo chiave redis
|
||||
var userTkn = await TDataService.OperatoreGetRedis(MatrOper, CurrDevGuid);
|
||||
if (string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -68,14 +111,24 @@ namespace MP_TAB3.Components
|
||||
var rawVers = typeof(Program).Assembly.GetName().Version;
|
||||
version = rawVers != null ? rawVers : new Version("0.0.0.0");
|
||||
DtScadLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin");
|
||||
showProgrBar = TypeScadLogin == 1;
|
||||
MaxExpVal = DtScadLogin;
|
||||
yLimit = MaxExpVal * 0.3;
|
||||
rLimit = MaxExpVal * 0.1;
|
||||
// rileggo scadenza ultima...
|
||||
TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOper, CurrDevGuid);
|
||||
MsgServ.dtLastAction = adesso.Subtract(TimeSpan.FromMinutes(MaxExpVal)).Add(tsScadenza);
|
||||
showProgrBar = tsScadenza.TotalHours < 24;
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
int tOutPeriod = 1000;
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
@@ -89,6 +142,7 @@ namespace MP_TAB3.Components
|
||||
|
||||
private DateTime adesso = DateTime.Now;
|
||||
private System.Timers.Timer aTimer = null!;
|
||||
private bool showProgrBar = true;
|
||||
private Version version = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -96,20 +150,30 @@ namespace MP_TAB3.Components
|
||||
#region Private Properties
|
||||
|
||||
private double CurrExpVal { get; set; } = 50;
|
||||
|
||||
private bool IsLoginPage
|
||||
{
|
||||
get
|
||||
{
|
||||
string currPage = NavMan.Uri;
|
||||
return currPage.Contains("logout") || currPage.Contains("reg-new-device");
|
||||
}
|
||||
}
|
||||
|
||||
private double MaxExpVal { get; set; } = 100;
|
||||
|
||||
private double rLimit { get; set; } = 10;
|
||||
|
||||
private string timeUm
|
||||
private string CurrUM
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "m";
|
||||
if (CurrExpVal > 60)
|
||||
if (MaxExpVal > 60)
|
||||
{
|
||||
answ = "h";
|
||||
}
|
||||
else if (CurrExpVal > 1440)
|
||||
else if (MaxExpVal > 1440)
|
||||
{
|
||||
answ = "gg";
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace MP_TAB3.Components
|
||||
public List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
|
||||
[Parameter]
|
||||
public EventCallback<bool> EA_UserIsOk { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<bool> EA_ReloadMStor { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -29,7 +31,7 @@ namespace MP_TAB3.Components
|
||||
#region Protected Properties
|
||||
|
||||
protected string CurrOprTknLS { get; set; } = null!;
|
||||
//protected Guid CurrDevGuid { get; set; }
|
||||
|
||||
protected string LastOpenedPage { get; set; } = null!;
|
||||
protected string CurrMacc { get; set; } = null!;
|
||||
|
||||
@@ -68,7 +70,7 @@ namespace MP_TAB3.Components
|
||||
protected async Task RefreshLogIn(string decodValue)
|
||||
{
|
||||
bool done = false;
|
||||
if (TypeScadLogin <= 0)
|
||||
if (TypeScadLogin <= 0 || TypeScadLogin == 2)
|
||||
{
|
||||
done = await MsgServ.DoLogIn(decodValue, false);
|
||||
}
|
||||
@@ -107,8 +109,8 @@ namespace MP_TAB3.Components
|
||||
await MsgServ.SetCurrDevGuidLSAsync(devGuid);
|
||||
await MsgServ.SetLastMatrOprAsync(lastOpr);
|
||||
await MsgServ.SetCurrOperDtoLSAsync(currToken);
|
||||
// reload MStor
|
||||
await ReloadMemStor();
|
||||
// richiesta reload MStor
|
||||
await EA_ReloadMStor.InvokeAsync(true);
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
@@ -116,7 +118,7 @@ namespace MP_TAB3.Components
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms");
|
||||
Log.Info($"ForceReload completed in {sw.Elapsed.TotalMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("status-map");
|
||||
}
|
||||
@@ -135,9 +137,6 @@ namespace MP_TAB3.Components
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
#if false
|
||||
TypeScadLogin = SMServ.GetConfInt("TAB_TypeScadLogin");
|
||||
#endif
|
||||
var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
|
||||
|
||||
if (CurrDevGuid == Guid.Empty)
|
||||
@@ -182,43 +181,6 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task ReloadMemStor()
|
||||
{
|
||||
// in primis svuoto...
|
||||
MStor.ClearCache();
|
||||
// rileggo link
|
||||
var allData = await MDataService.ListLinkAll();
|
||||
MStor.SetupMenu(allData);
|
||||
// fix config...
|
||||
var allConf = await MDataService.ConfigGetAll();
|
||||
MStor.SetConfig(allConf);
|
||||
// fix MSFD...
|
||||
var allMSFD = await TDService.VMSFDGetAll();
|
||||
MStor.SetMsfd(allMSFD);
|
||||
// fix slave
|
||||
var macSlave = await TDService.Macchine2Slave();
|
||||
MStor.SetM2S(macSlave);
|
||||
|
||||
// fix elenco eventi
|
||||
var allEvents = await TDService.AnagEventiGetAll();
|
||||
MStor.SetEventi(allEvents);
|
||||
// fix elenco stati
|
||||
var allStati = await TDService.AnaStatiGetAll();
|
||||
MStor.SetStati(allStati);
|
||||
// non da farsi globalmente // fix macchine var allMach = await
|
||||
// MDataService.MacchineByMatrOper(0); MStor.DictMacchine = allMach.ToDictionary(x =>
|
||||
// x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}");
|
||||
|
||||
// fix vocabolario
|
||||
var allVoc = TDService.VocabolarioGetAll();
|
||||
MStor.SetVocab(allVoc);
|
||||
|
||||
// resetto il tabDServ
|
||||
await TDService.FlushCache();
|
||||
// ricarica la config...
|
||||
TDService.SetupConfig();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
DateTime inizio = fine.AddDays(-3);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
DateTime inizio = fine.AddDays(-3);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
@@ -56,10 +56,9 @@ else
|
||||
<i class="fa-regular fa-circle-check"></i> @($" {RecMSE.PezziConf}")
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
+
|
||||
@if (datiProdAct != null)
|
||||
@if (datiProdAct != null && datiProdAct.PzConfScarto > 0)
|
||||
{
|
||||
@($" {datiProdAct.PzConfScarto}")
|
||||
@($"(- {datiProdAct.PzConfScarto})")
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,7 +94,6 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<div class="cardObj shadow" @onclick="ShowDetail">
|
||||
<div class="card-body p-0">
|
||||
<div class="@RecMSE.Semaforo borderStd p-1 text-center">
|
||||
@@ -107,25 +105,26 @@ else
|
||||
</div>
|
||||
@if (showCard)
|
||||
{
|
||||
<div class="row">
|
||||
@*<div class="col-8 text-center text-success d-flex justify-content-between pe-2">*@
|
||||
<div class="text-center col-4 d-flex justify-content-between text-success">
|
||||
<div class="col-2"><i class="fa-regular fa-circle-check"></i></div>
|
||||
<div class="col-10">
|
||||
@($"{RecMSE.PezziConf}")
|
||||
<div class="d-flex justify-content-between w-100">
|
||||
<div class="px-2">
|
||||
<div class="d-flex text-success">
|
||||
<div class="px-0">
|
||||
<i class="fa-regular fa-circle-check"></i> @($"{RecMSE.PezziConf}")
|
||||
</div>
|
||||
@if (datiProdAct != null && datiProdAct.PzConfScarto > 0)
|
||||
{
|
||||
<div class="px-1">
|
||||
<div class="text-danger">
|
||||
@($"(- {datiProdAct.PzConfScarto})")
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-danger col-4">
|
||||
+
|
||||
@if (datiProdAct != null)
|
||||
{
|
||||
@($" {datiProdAct.PzConfScarto}")
|
||||
}
|
||||
</div>
|
||||
@*</div>*@
|
||||
<div class="text-center col-4 text-warning d-flex justify-content-between">
|
||||
<div class="col-2"><i class="fa-solid fa-layer-group"></i></div>
|
||||
<div class="col-10">@($"{RecMSE.PezziProd}")</div>
|
||||
<div class="px-2">
|
||||
<div class="text-end text-warning">
|
||||
<i class="fa-solid fa-layer-group"></i> @($"{RecMSE.PezziProd}")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between w-100" style="height: 100px; width: 100px;">
|
||||
@@ -151,66 +150,80 @@ else
|
||||
else
|
||||
{
|
||||
<div class="cardObj px-3 py-1">
|
||||
<div class="text-center d-flex justify-content-between ">
|
||||
<div class="col-4">
|
||||
<div class="py-2">
|
||||
<h4 class="text-start mb-0 fw-bold">
|
||||
@RecMSE.Nome
|
||||
</h4>
|
||||
</div>
|
||||
<div style="font-size: 1rem" class="me-3">
|
||||
<div class="text-center d-flex justify-content-between align-items-center ">
|
||||
<div class="col-4 fs-5">
|
||||
<div class="lh-1">
|
||||
<div class="text-end text-success d-flex justify-content-between">
|
||||
<div class="col-4"><i class="fa-regular fa-circle-check"></i></div>
|
||||
<div class="col-8 d-flex justify-content-between">
|
||||
<div>
|
||||
@($"{RecMSE.PezziConf}")
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
+
|
||||
@if (datiProdAct != null)
|
||||
{
|
||||
@($" {datiProdAct.PzConfScarto}")
|
||||
}
|
||||
</div>
|
||||
<div class="px-0">
|
||||
Confermati
|
||||
@* <i class="fa-regular fa-circle-check"></i> *@
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@($"{RecMSE.PezziConf}")
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-end text-warning d-flex justify-content-between">
|
||||
<div class="col-4"><i class="fa-solid fa-layer-group"></i></div>
|
||||
<div class="col-8">@($"{RecMSE.PezziProd}")</div>
|
||||
</div>
|
||||
<div class="text-end text-primary d-flex justify-content-between">
|
||||
<div class="col-4"><i class="fa-brands fa-stack-overflow"></i></div>
|
||||
<div class="col-8">@($"{RecMSE.extraVal}")</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4" style="max-height: 8rem; max-width: 8rem;">
|
||||
<EgwCoreLib.Razor.CircleGaugeMulti Titolo="@($"{currMaxVal}")" Testo="#pz prod" maxVal="@currMaxVal" ListInner="@innerCircleVals" ListOuter="@outerCircleVals" ShowCircleBtn="true"></EgwCoreLib.Razor.CircleGaugeMulti>
|
||||
</div>
|
||||
<div class="col-4 d-flex flex-wrap justify-content-center align-items-center " style="line-height: 1.6rem;">
|
||||
<div>
|
||||
@if (!string.IsNullOrEmpty(IdxMacchSub))
|
||||
@if (datiProdAct != null && datiProdAct.PzConfScarto > 0)
|
||||
{
|
||||
<div class="text-warning border border-warning rounded-3 px-2">
|
||||
@IdxMacchSub <i class="fa-solid fa-triangle-exclamation"></i>
|
||||
<div class="text-end text-danger d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Scarto
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@($"- {datiProdAct.PzConfScarto}")
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="text-end text-warning d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Prodotti
|
||||
@* <i class="fa-solid fa-layer-group"></i> *@
|
||||
</div>
|
||||
<div class="px-0">@($"{RecMSE.PezziProd}")</div>
|
||||
</div>
|
||||
@if (RecMSE.extraVal > 0)
|
||||
{
|
||||
<div class="text-end text-primary d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
Extra
|
||||
@* <i class="fa-brands fa-stack-overflow"></i> *@
|
||||
</div>
|
||||
<div class="px-0">@($"{RecMSE.extraVal}")</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4" style="max-height: 8rem; max-width: 6rem;">
|
||||
<h4 class="text-center mb-0 fw-bold">
|
||||
@RecMSE.Nome
|
||||
</h4>
|
||||
<EgwCoreLib.Razor.CircleGaugeMulti Titolo="@($"{currMaxVal}")" Testo="#pz prod" maxVal="@currMaxVal" ListInner="@innerCircleVals" ListOuter="@outerCircleVals" ShowCircleBtn="true"></EgwCoreLib.Razor.CircleGaugeMulti>
|
||||
</div>
|
||||
<div class="col-4 d-flex flex-wrap justify-content-center align-items-center lh-1">
|
||||
<div class="w-100">
|
||||
@if (!string.IsNullOrEmpty(IdxMacchSub))
|
||||
{
|
||||
<div class="text-warning border border-warning rounded-3 small px-2 py-1 mb-1">
|
||||
@IdxMacchSub
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100 fs-5">
|
||||
<div class="text-light d-flex justify-content-between small lh-sm">
|
||||
<div class="text-start col-4">ART:</div>
|
||||
<div class="text-end col-8">@($"{RecMSE.CodArticolo}")</div>
|
||||
<div class="px-0">ART</div>
|
||||
<div class="px-0">@RecMSE.CodArticolo</div>
|
||||
</div>
|
||||
<div class="text-end text-light d-flex justify-content-between small lh-sm">
|
||||
<div class="text-start col-4">ODL:</div>
|
||||
<div class="text-end col-8">@($"ODL{RecMSE.IdxOdl:00000000}")</div>
|
||||
<div class="px-0">ODL</div>
|
||||
<div class="px-0">@RecMSE.IdxOdl</div>
|
||||
</div>
|
||||
<div class="text-end text-light d-flex justify-content-between small lh-sm">
|
||||
<div class="text-start col-4">PODL:</div>
|
||||
<div class="text-end col-8">@($"PODL{RecMSE.IdxPOdl:00000000}")</div>
|
||||
<div class="px-0">PODL:</div>
|
||||
<div class="px-0">@RecMSE.IdxPOdl</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="d-flex justify-content-between mt-1">
|
||||
<div class="col-10 mb-2 px-2 py-1 @RecMSE.Semaforo statusCard">
|
||||
<div class="d-flex justify-content-center ">
|
||||
<div class="p-0 mr-auto me-1">
|
||||
|
||||
@@ -175,14 +175,14 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
isLoading = RecMSE == null;
|
||||
// controllo SE avessi idxMacchSub --> rileggo!
|
||||
// controllo SE ho variazioni così rileggo
|
||||
if (RecMSE != null)
|
||||
{
|
||||
if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.NumPezzi)
|
||||
if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.PezziProd)
|
||||
{
|
||||
datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
|
||||
SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct);
|
||||
SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.NumPezzi);
|
||||
SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.PezziProd);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,6 +207,11 @@ namespace MP_TAB3.Components
|
||||
if (RecMSE.PezziConf > 0)
|
||||
{
|
||||
innerCircleVals.Add(new CircleGaugeMulti.CircSegm() { Color = "#198754", Value = RecMSE.PezziConf });
|
||||
// se ho scarti aggiungo all'inizio
|
||||
if (datiProdAct != null && datiProdAct.PzConfScarto > 0)
|
||||
{
|
||||
innerCircleVals.Add(new CircleGaugeMulti.CircSegm() { Color = "#CD1916", Value = datiProdAct.PzConfScarto });
|
||||
}
|
||||
}
|
||||
if (RecMSE.extraVal > 0)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace MP_TAB3.Components
|
||||
aTimer.Dispose();
|
||||
Log.Info("MseSampler Timer Disposed!");
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -91,6 +92,11 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
aTimer = new System.Timers.Timer(fastRefreshMs);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
}
|
||||
<div class="col-12 my-2">
|
||||
<div class="btn btn-danger w-100">
|
||||
<button class="btn btn-danger w-100" @onclick="GoToMachDetail">
|
||||
<div class="fs-1">@lblWarnHead</div>
|
||||
<div class="fs-4">
|
||||
@lblWarnBody
|
||||
@@ -52,7 +52,7 @@
|
||||
Pezzi NC: <b>@numPz2Conf</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
@if (!odlOk)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,18 @@ namespace MP_TAB3.Components
|
||||
public EventCallback<List<MappaStatoExpl>> E_Updated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? RecMSE { get; set; } = null;
|
||||
public MappaStatoExpl? RecMSE
|
||||
{
|
||||
get => currRecMSE;
|
||||
set
|
||||
{
|
||||
// salvo SOLO SE non sono in conferma
|
||||
if (!setupActive)
|
||||
{
|
||||
currRecMSE = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -68,6 +79,7 @@ namespace MP_TAB3.Components
|
||||
get => idxPOdlSel;
|
||||
set
|
||||
{
|
||||
setupActive = value != 0;
|
||||
if (idxPOdlSel != value)
|
||||
{
|
||||
idxPOdlSel = value;
|
||||
@@ -234,6 +246,12 @@ namespace MP_TAB3.Components
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void GoToMachDetail()
|
||||
{
|
||||
// navigo!
|
||||
NavMan.NavigateTo($"machine-detail");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla setup ODL (come se avesse fatto FINE PROD)
|
||||
/// </summary>
|
||||
@@ -401,11 +419,15 @@ namespace MP_TAB3.Components
|
||||
|
||||
// aggiorno note e tempo setup
|
||||
await TabDServ.OdlUpdate(idxODLStart, MatrOpr, tcRichAttr, PzPallet, noteAttr);
|
||||
// controllo se TC Assegnato != TCRichiesto allora invio email x verifiche...
|
||||
if (currOdl.Tcassegnato != tcRichAttr)
|
||||
// se abilitata gestione check TCiclo
|
||||
if (approvTCEnabled)
|
||||
{
|
||||
// invio email!
|
||||
await SendWarnTcChangeReq(idxODLStart, currOdl.Tcassegnato, tcRichAttr);
|
||||
// controllo se TC Assegnato != TCRichiesto allora invio email x verifiche...
|
||||
if (currOdl.Tcassegnato != tcRichAttr)
|
||||
{
|
||||
// invio email!
|
||||
await SendWarnTcChangeReq(idxODLStart, currOdl.Tcassegnato, tcRichAttr);
|
||||
}
|
||||
}
|
||||
await advStep(currStep++);
|
||||
|
||||
@@ -702,32 +724,40 @@ namespace MP_TAB3.Components
|
||||
enableRiattrezzaggio = SMServ.GetConfBool("enableRiattrezzaggio");
|
||||
showOdlProvv = SMServ.GetConfBool("showOdlProvv");
|
||||
gPeriodReopenOdlTav = SMServ.GetConfInt("gPeriodReopenOdlTav");
|
||||
approvTCEnabled = SMServ.GetConfBool("OptAdmApprTempiEnabled");
|
||||
string rawEmailDest = SMServ.GetConf("_adminEmail");
|
||||
emailAdmDest = rawEmailDest.Split(',').ToList();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (RecMSE != null)
|
||||
if (!setupActive)
|
||||
{
|
||||
if (string.IsNullOrEmpty(IdxMaccSel))
|
||||
if (RecMSE != null)
|
||||
{
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
}
|
||||
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
|
||||
if (isMulti)
|
||||
{
|
||||
var idxMSel = MServ.UserPrefGet(IdxMaccSel);
|
||||
if (!string.IsNullOrEmpty(idxMSel))
|
||||
if (string.IsNullOrEmpty(IdxMaccSel))
|
||||
{
|
||||
IdxMaccSel = idxMSel;
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
}
|
||||
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
|
||||
if (isMulti)
|
||||
{
|
||||
var idxMSel = MServ.UserPrefGet(IdxMaccSel);
|
||||
if (!string.IsNullOrEmpty(idxMSel))
|
||||
{
|
||||
IdxMaccSel = idxMSel;
|
||||
}
|
||||
}
|
||||
IdxMaccParent = getIdxMaccParent();
|
||||
}
|
||||
IdxMaccParent = getIdxMaccParent();
|
||||
checkAll();
|
||||
// verifica stato inAttr
|
||||
await CheckAttr();
|
||||
await ReloadData(true);
|
||||
}
|
||||
checkAll();
|
||||
// verifica stato inAttr
|
||||
await CheckAttr();
|
||||
await ReloadData(true);
|
||||
// verifica conferma produzione
|
||||
datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, DateTime.Now);
|
||||
checkConfProd();
|
||||
}
|
||||
|
||||
protected async Task ProdEnd()
|
||||
@@ -917,7 +947,7 @@ namespace MP_TAB3.Components
|
||||
protected async Task SendWarnTcChangeReq(int idxOdl, decimal tcAss, decimal tcRich)
|
||||
{
|
||||
// carico altri parametri email...
|
||||
string oggetto = SMServ.GetConf("oggettoChgTc");
|
||||
string oggetto = $"{SMServ.GetConf("Cliente")} | {SMServ.GetConf("oggettoChgTc")}"; ;
|
||||
string corpoChgTc = SMServ.GetConf("corpoChgTc");
|
||||
string mittente = SMServ.GetConf("_fromEmail");
|
||||
string baseUrlAdmin = SMServ.GetConf("baseUrlAdmin");
|
||||
@@ -1046,70 +1076,38 @@ namespace MP_TAB3.Components
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool approvTCEnabled = false;
|
||||
private bool confRett = true;
|
||||
|
||||
private double currVal = 0;
|
||||
|
||||
private List<string> emailAdmDest = new List<string>();
|
||||
|
||||
private bool enableAnnullaSetup = false;
|
||||
|
||||
private bool enableFixSetup = false;
|
||||
|
||||
private bool enableRiattrezzaggio = false;
|
||||
|
||||
private bool enableRPO = true;
|
||||
|
||||
private bool enableSchedaTecnica = false;
|
||||
|
||||
private bool enableSplitODL = false;
|
||||
|
||||
private int expTimeMsec = 500;
|
||||
|
||||
private bool forceCloseOdl = true;
|
||||
|
||||
private int gPeriodReopenOdlTav = 1;
|
||||
|
||||
private string IdxMaccSel = "";
|
||||
#if false
|
||||
private string IdxMaccSelLast = "";
|
||||
#endif
|
||||
|
||||
private int idxPOdlSel = 0;
|
||||
|
||||
private bool inAttr = false;
|
||||
|
||||
private bool isInProd = false;
|
||||
|
||||
private bool isMaster = false;
|
||||
|
||||
private bool isMulti = false;
|
||||
|
||||
private bool isProcessing = false;
|
||||
private bool isLoading = false;
|
||||
|
||||
private bool isMaster = false;
|
||||
private bool isMulti = false;
|
||||
private bool isProcessing = false;
|
||||
private bool isSlave = false;
|
||||
|
||||
private int lastIdxPOdl = 0;
|
||||
|
||||
private string lblOut = "";
|
||||
|
||||
private int MaxVal = 10;
|
||||
|
||||
private int modoConfProd = 0;
|
||||
|
||||
private double nextVal = 0;
|
||||
|
||||
private string noteAttr = "";
|
||||
|
||||
private int numDayOdl = 5;
|
||||
|
||||
private int PzPallet = 1;
|
||||
|
||||
private string searchPodl = "";
|
||||
private bool showAll = false;
|
||||
|
||||
private bool showChkCloseOdlVal = false;
|
||||
private bool showOdlDetail = false;
|
||||
private bool showOdlProvv = false;
|
||||
@@ -1138,8 +1136,8 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
|
||||
private ODLExpModel currOdl { get; set; } = new ODLExpModel();
|
||||
|
||||
private PODLExpModel currPodl { get; set; } = new PODLExpModel();
|
||||
private MappaStatoExpl? currRecMSE { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se l'ALTRA macchina NON abbia ODL valido (== 0)
|
||||
@@ -1211,6 +1209,11 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
}
|
||||
|
||||
private bool setupActive { get; set; } = false;
|
||||
#if false
|
||||
private string IdxMaccSelLast = "";
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Verifica visibilità btn riprendi ODL su 2° tavola SE:
|
||||
/// - sia un impianto MULTI (= con + tavole)
|
||||
@@ -1340,6 +1343,10 @@ namespace MP_TAB3.Components
|
||||
if (datiProdAct != null)
|
||||
{
|
||||
needConfProd = datiProdAct.Pz2RecTot > 0 && !isSlave;
|
||||
if (needConfProd)
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,11 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
aTimer = new System.Timers.Timer(dtTimerTabParam);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
@@ -76,15 +76,11 @@ namespace MP_TAB3.Components
|
||||
get => numPzConfermati - numPzLasciati;
|
||||
}
|
||||
|
||||
//protected int lblPzBuo2Rec { get; set; } = 0;
|
||||
protected int lblPz2RecScarto
|
||||
{
|
||||
get => numPzScarto2Rec;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected StatusData MDataService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
|
||||
@@ -131,6 +127,9 @@ namespace MP_TAB3.Components
|
||||
get => (RecMSE != null && RecMSE.IdxOdl > 0);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected StatusData SDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
@@ -210,7 +209,7 @@ namespace MP_TAB3.Components
|
||||
// refresh tabella dati tablet...
|
||||
await TabDServ.RicalcMse(IdxMaccSel, 0);
|
||||
// rileggo e salvo..
|
||||
var ListMSE = await MDataService.MseGetAll(true);
|
||||
var ListMSE = await SDService.MseGetAll(true);
|
||||
if (ListMSE != null)
|
||||
{
|
||||
// salvo in LocalStorage...
|
||||
@@ -224,6 +223,8 @@ namespace MP_TAB3.Components
|
||||
confProdActive = false;
|
||||
numPzLasciati = 0;
|
||||
dtReqUpdate = DateTime.Now;
|
||||
// azzero cache pezzi conf
|
||||
SDService.MachNumPzSet(IdxMaccSel, -1);
|
||||
await DoUpdate();
|
||||
await Task.Delay(1);
|
||||
await RefreshData();
|
||||
@@ -318,7 +319,7 @@ namespace MP_TAB3.Components
|
||||
|
||||
private async Task RefreshData()
|
||||
{
|
||||
List<MappaStatoExpl> ListMSE = await MDataService.MseGetAll(true);
|
||||
List<MappaStatoExpl> ListMSE = await SDService.MseGetAll(true);
|
||||
await MsgServ.SaveMse(ListMSE);
|
||||
await E_Updated.InvokeAsync(ListMSE);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace MP_TAB3.Components
|
||||
}
|
||||
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
DateTime inizio = fine.AddDays(-3);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2401.511</Version>
|
||||
<Version>6.16.2401.2618</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,41 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Blazored.LocalStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP_TAB3;
|
||||
using MP_TAB3.Shared;
|
||||
using MP_TAB3.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.Data.Services;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using EgwCoreLib.Razor;
|
||||
using Blazored.LocalStorage;
|
||||
|
||||
namespace MP_TAB3.Pages
|
||||
{
|
||||
public partial class Logout
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -60,5 +50,7 @@ namespace MP_TAB3.Pages
|
||||
MsgServ.RigaOper = null;
|
||||
NavMan.NavigateTo("reg-new-device", true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -2,35 +2,35 @@
|
||||
|
||||
<MseSampler SampleMult="1.5" E_Updated="SaveData"></MseSampler>
|
||||
<div class="pe-2">
|
||||
<div class="row mb-2">
|
||||
@if (ListMSE == null || ListMSE.Count == 0 || isCalcSize)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
int maxBlocks = calcMaxBlock();
|
||||
int currIdx = 0;
|
||||
@foreach (var item in ListMSE)
|
||||
<div class="row mb-2">
|
||||
@if (ListMSE == null || ListMSE.Count == 0 || isCalcSize)
|
||||
{
|
||||
currIdx++;
|
||||
<div class="col px-1">
|
||||
<MachineBlock RecMSE="@item" FullMode="true" Width="@Width" Height="@Height" showCard="@ShowCard"></MachineBlock>
|
||||
</div>
|
||||
@if (currIdx >= maxBlocks)
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
int maxBlocks = calcMaxBlock();
|
||||
int currIdx = 0;
|
||||
@foreach (var item in ListMSE)
|
||||
{
|
||||
currIdx = 0;
|
||||
@((MarkupString)"</div>")
|
||||
@((MarkupString)"<div class=\"row mb-2\">")
|
||||
currIdx++;
|
||||
<div class="col px-1">
|
||||
<MachineBlock RecMSE="@item" FullMode="true" Width="@Width" Height="@Height" showCard="@ShowCard"></MachineBlock>
|
||||
</div>
|
||||
@if (currIdx >= maxBlocks)
|
||||
{
|
||||
currIdx = 0;
|
||||
@((MarkupString)"</div>")
|
||||
@((MarkupString)"<div class=\"row mb-2\">")
|
||||
}
|
||||
}
|
||||
// controllo se devo "chiudere riga...
|
||||
int currNum = (currIdx % maxBlocks);
|
||||
while (currNum < (maxBlocks))
|
||||
{
|
||||
@((MarkupString)"<div class=\"col px-1 bloccoMacc\"> </div>")
|
||||
currNum++;
|
||||
}
|
||||
}
|
||||
// controllo se devo "chiudere riga...
|
||||
int currNum = (currIdx % maxBlocks);
|
||||
while (currNum < (maxBlocks))
|
||||
{
|
||||
@((MarkupString)"<div class=\"col px-1 bloccoMacc\"> </div>")
|
||||
currNum++;
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,8 +9,18 @@ using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace MP_TAB3.Pages
|
||||
{
|
||||
public partial class StatusMap
|
||||
public partial class StatusMap : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ListMSE = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class WindowDimension
|
||||
@@ -75,12 +85,6 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task getWDim()
|
||||
{
|
||||
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
|
||||
Height = dimension.Height;
|
||||
Width = dimension.Width;
|
||||
}
|
||||
/// <summary>
|
||||
/// calcola num blocchi max data dimensione larghezza
|
||||
/// </summary>
|
||||
@@ -102,6 +106,13 @@ namespace MP_TAB3.Pages
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task getWDim()
|
||||
{
|
||||
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
|
||||
Height = dimension.Height;
|
||||
Width = dimension.Width;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@@ -147,8 +158,6 @@ namespace MP_TAB3.Pages
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000);
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2401.511</h4>
|
||||
<h4>Versione: 6.16.2401.2618</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2401.511
|
||||
6.16.2401.2618
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2401.511</version>
|
||||
<version>6.16.2401.2618</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>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
<PageTitle>MP-TAB3</PageTitle>
|
||||
|
||||
<div class="page" @onclick="()=>handleBodyClick()">
|
||||
<div class="page" @onclick="()=>HandleBodyClick()">
|
||||
<main>
|
||||
<CmpTop TypeScadLogin="@typeScadLogin" CurrMenuItems="@CurrMenuItems" EA_UserIsOk="checkIfUserOk"></CmpTop>
|
||||
<CmpTop TypeScadLogin="@typeScadLogin" CurrMenuItems="@CurrMenuItems" EA_UserIsOk="SetUserOk" EA_ReloadMStor="ForceReloadMStor"></CmpTop>
|
||||
@if (userIsOk || NavMan.Uri.Contains("reg-new-device"))
|
||||
{
|
||||
<article class="content pt-1 d-flex mb-5">
|
||||
@@ -24,5 +24,5 @@
|
||||
</main>
|
||||
</div>
|
||||
<div class="fixed-bottom">
|
||||
<CmpFooter TypeScadLogin="@typeScadLogin" DtScadLogin="@dtScadLogin"></CmpFooter>
|
||||
<CmpFooter TypeScadLogin="@typeScadLogin" DtScadLogin="@dtScadLogin" MatrOper="@MatrOpr" CurrDevGuid="@currDevGuid"></CmpFooter>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
using MP_TAB3.Components;
|
||||
using NLog;
|
||||
|
||||
namespace MP_TAB3.Shared
|
||||
@@ -94,23 +93,25 @@ namespace MP_TAB3.Shared
|
||||
|
||||
protected async Task checkDtDiff2Logout()
|
||||
{
|
||||
TimeSpan tsDeltaAct = DateTime.Now.Subtract(MsgServ.dtLastAction);
|
||||
TimeSpan tsDeltaSave = DateTime.Now.Subtract(MsgServ.dtLastSave);
|
||||
DateTime adesso = DateTime.Now;
|
||||
TimeSpan tsDeltaAct = adesso.Subtract(MsgServ.dtLastAction);
|
||||
TimeSpan tsDeltaSave = adesso.Subtract(MsgServ.dtLastSave);
|
||||
string userTkn = "";
|
||||
switch (typeScadLogin)
|
||||
{
|
||||
case 1:
|
||||
if (tsDeltaAct.TotalMinutes >= dtScadLogin)
|
||||
{
|
||||
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
|
||||
if (!string.IsNullOrEmpty(userTkn))
|
||||
userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
|
||||
if (string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
await MsgServ.DoLogIn(userTkn, true);
|
||||
MsgServ.dtLastAction = DateTime.Now;
|
||||
MsgServ.dtLastSave = DateTime.Now;
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
else
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
await MsgServ.DoLogIn(userTkn, true);
|
||||
MsgServ.dtLastAction = adesso;
|
||||
MsgServ.dtLastSave = adesso;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -118,21 +119,35 @@ namespace MP_TAB3.Shared
|
||||
// se fosse oltre 1 minuto da ultimo save --> salvo!
|
||||
if (tsDeltaSave.TotalMinutes > 1)
|
||||
{
|
||||
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
|
||||
userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
|
||||
if (!string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
await MsgServ.DoLogIn(userTkn, true);
|
||||
MsgServ.dtLastAction = DateTime.Now;
|
||||
MsgServ.dtLastSave = DateTime.Now;
|
||||
MsgServ.dtLastAction = adesso;
|
||||
MsgServ.dtLastSave = adesso;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (tsDeltaAct.TotalMinutes >= dtScadLogin)
|
||||
// se fosse oltre 1 minuto da ultimo save --> salvo!
|
||||
if (tsDeltaSave.TotalMinutes > 1)
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
// mitigazione controlli: solo ogni 1 minuto...
|
||||
if (tsDeltaSave.TotalMinutes > 1)
|
||||
{
|
||||
MsgServ.dtLastSave = adesso;
|
||||
userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
|
||||
if (string.IsNullOrEmpty(userTkn))
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
if (tsDeltaAct.TotalMinutes >= dtScadLogin)
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -145,13 +160,12 @@ namespace MP_TAB3.Shared
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task checkIfUserOk(bool isOk)
|
||||
protected async Task ForceReloadMStor(bool isOk)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
userIsOk = isOk;
|
||||
await ReloadMemStor();
|
||||
}
|
||||
|
||||
protected async Task handleBodyClick()
|
||||
protected async Task HandleBodyClick()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (!pageOk)
|
||||
@@ -160,6 +174,15 @@ namespace MP_TAB3.Shared
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
currDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
|
||||
// rileggo scadenza ultima...
|
||||
DateTime adesso = DateTime.Now;
|
||||
TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOpr, currDevGuid);
|
||||
MsgServ.dtLastSave = adesso.Subtract(TimeSpan.FromMinutes(dtScadLogin)).Add(tsScadenza);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init struttura dati
|
||||
/// </summary>
|
||||
@@ -184,11 +207,6 @@ namespace MP_TAB3.Shared
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
currDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
|
||||
}
|
||||
|
||||
protected async Task ReloadMemStor()
|
||||
{
|
||||
// in primis svuoto...
|
||||
@@ -223,6 +241,12 @@ namespace MP_TAB3.Shared
|
||||
TDataService.SetupConfig();
|
||||
}
|
||||
|
||||
protected async Task SetUserOk(bool isOk)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
userIsOk = isOk;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -61,6 +61,6 @@
|
||||
await MsgServ.IdxMaccSet("");
|
||||
}
|
||||
await MsgServ.LastOpenedPageSet(tgtUrl);
|
||||
navManager.NavigateTo(tgtUrl);
|
||||
navManager.NavigateTo(tgtUrl, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace MP.Data.Services
|
||||
public ListSelectDataSrv(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
// setup compoenti REDIS
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
redisDb = redisConn.GetDatabase();
|
||||
@@ -101,8 +100,10 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulizia cache Redis (tutta)
|
||||
/// </summary>
|
||||
@@ -173,7 +174,6 @@ namespace MP.Data.Services
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:Menu:ALL";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<LinkMenu>>($"{rawData}");
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Blazored.SessionStorage;
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.Controllers;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using Newtonsoft.Json;
|
||||
@@ -14,12 +15,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Services
|
||||
{
|
||||
public class MessageService
|
||||
public class MessageService : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public const string KeyCommDtRif = "DtRifComm";
|
||||
|
||||
public const string KeyCommText = "ValComm";
|
||||
|
||||
public int orarioDip = 0;
|
||||
|
||||
#endregion Public Fields
|
||||
@@ -53,30 +56,6 @@ namespace MP.Data.Services
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#if false
|
||||
protected bool _tReset { get; set; } = false;
|
||||
protected bool tReset
|
||||
{
|
||||
get => _tReset;
|
||||
set
|
||||
{
|
||||
if (_tReset != value)
|
||||
{
|
||||
_tReset = value;
|
||||
resetTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void resetTimer()
|
||||
{
|
||||
if (EA_ResetFooterTimer != null)
|
||||
{
|
||||
EA_ResetFooterTimer?.Invoke();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CognomeNome
|
||||
@@ -119,8 +98,23 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
public DateTime dtLastAction { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime dtLastSave { get; set; } = DateTime.Now;
|
||||
|
||||
public string LastIdxMacchina
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
answ = redisDb.StringGet((RedisKey)$"{redisBaseKey}:{MatrOpr}:lastIdxMacc");
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
redisDb.StringSet((RedisKey)$"{redisBaseKey}:{MatrOpr}:lastIdxMacc", value, TimeSpan.FromSeconds(30));
|
||||
}
|
||||
}
|
||||
|
||||
public int MatrOpr
|
||||
{
|
||||
get
|
||||
@@ -248,11 +242,16 @@ namespace MP.Data.Services
|
||||
return SteamCrypto.DecryptString(encData, Constants.passPhrase);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
public async Task<bool> DoLogIn(string decodValue, bool saveOpr)
|
||||
{
|
||||
bool answ = false;
|
||||
//expDays = SMService.GetConfInt("cookieDayExpire");
|
||||
//var expDT = DateTime.Now.AddDays(expDays);
|
||||
var devGuid = await GetCurrDevGuidLSAsync();
|
||||
// decifro i valori..
|
||||
var decrVal = DecryptData(decodValue);
|
||||
@@ -306,6 +305,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il record OperatoreDTO da localstorage
|
||||
/// </summary>
|
||||
@@ -351,6 +351,20 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
public TimeSpan GetKeyTTL(string redKey)
|
||||
{
|
||||
TimeSpan answ = new TimeSpan();
|
||||
try
|
||||
{
|
||||
answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce ultima matrOpr registrata da localstorage
|
||||
/// </summary>
|
||||
@@ -440,17 +454,6 @@ namespace MP.Data.Services
|
||||
return hasKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrive il record OperatoreDTO nel localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> SetCurrOperDtoLSAsync(string currTkn)
|
||||
{
|
||||
bool answ = false;
|
||||
await localStorage.SetItemAsync("currTkn", currTkn);
|
||||
answ = true;
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive il record Device GUID nel localstorage
|
||||
/// </summary>
|
||||
@@ -463,6 +466,18 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrive il record OperatoreDTO nel localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> SetCurrOperDtoLSAsync(string currTkn)
|
||||
{
|
||||
bool answ = false;
|
||||
await localStorage.SetItemAsync("currTkn", currTkn);
|
||||
answ = true;
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore di IPV4 del device nel localstoragee
|
||||
/// </summary>
|
||||
@@ -515,7 +530,6 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupero singola preferenza utente
|
||||
/// </summary>
|
||||
@@ -623,6 +637,7 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
private int cacheTtlShort = 60 * 1;
|
||||
|
||||
private string lastIdxMacc = "";
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private string redisBaseKey = "MP:TAB:User";
|
||||
private Random rnd = new Random();
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -112,35 +115,6 @@ namespace MP.Data.Services
|
||||
return Task.FromResult(dbController.MacchineGetAll());
|
||||
}
|
||||
|
||||
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<MappaStatoExpl>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce numPezzi (ultimo) x macchina
|
||||
/// </summary>
|
||||
@@ -155,6 +129,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva numPezzi x macchina
|
||||
/// </summary>
|
||||
@@ -190,6 +165,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva numPezzi x macchina
|
||||
/// </summary>
|
||||
@@ -211,8 +187,34 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
private Dictionary<string, int> MachineNumPz { get; set; } = new Dictionary<string, int>();
|
||||
private Dictionary<string, StatoProdModel> MachineProdStatus { get; set; } = new Dictionary<string, StatoProdModel>();
|
||||
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<MappaStatoExpl>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -236,12 +238,20 @@ namespace MP.Data.Services
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private int maxAge = 2000;
|
||||
#if false
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#endif
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Dictionary<string, int> MachineNumPz { get; set; } = new Dictionary<string, int>();
|
||||
private Dictionary<string, StatoProdModel> MachineProdStatus { get; set; } = new Dictionary<string, StatoProdModel>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#if false
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#endif
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -610,6 +610,9 @@ namespace MP.Data.Services
|
||||
dbTabController.Dispose();
|
||||
dbIocController.Dispose();
|
||||
dbInveController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1617,6 +1620,36 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
public TimeSpan GetKeyTTL(string redKey)
|
||||
{
|
||||
TimeSpan answ = TimeSpan.FromMinutes(-1);
|
||||
try
|
||||
{
|
||||
answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Legge l'oggetto operatore+device loggato e restituisce la sua TTL
|
||||
/// </summary>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="currDevGuid"></param>
|
||||
/// <returns></returns>
|
||||
public TimeSpan OperatoreGetGuidTTL(int matrOpr, Guid currDevGuid)
|
||||
{
|
||||
TimeSpan answ = new TimeSpan();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}:CurrDevGuid:{currDevGuid}";
|
||||
answ = GetKeyTTL(currKey);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legge l'oggetto operatore loggato
|
||||
/// </summary>
|
||||
@@ -1633,8 +1666,6 @@ namespace MP.Data.Services
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
//var encrData = SteamCrypto.DecryptString(rawData, passPhrase);
|
||||
//answ = JsonConvert.DeserializeObject<string>(rawData);
|
||||
answ = rawData;
|
||||
}
|
||||
if (answ == null)
|
||||
@@ -1923,7 +1954,7 @@ namespace MP.Data.Services
|
||||
result = dbTabController.RegControlliFilt(idxMacchina, idxODL, dataFrom, dataTo, showMulti);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -1985,7 +2016,7 @@ namespace MP.Data.Services
|
||||
result = dbTabController.RegControlliLast(idxMacchina);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -2025,7 +2056,7 @@ namespace MP.Data.Services
|
||||
result = dbTabController.RegDichiarGetFilt(idxMacchina, tagCode, matrOpr, idxODL, dataFrom, dataTo);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -2111,7 +2142,7 @@ namespace MP.Data.Services
|
||||
result = dbTabController.RegScartiGetFilt(idxMacchina, idxODL, dataFrom, dataTo, showMulti);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2311.1009</Version>
|
||||
<Version>6.16.2311.1009</Version>
|
||||
<Version>6.16.2401.0914</Version>
|
||||
<Version>6.16.2401.0914</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -186,7 +186,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2302.2417" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2310.2417" />
|
||||
<PackageReference Include="ElmahCore" Version="2.1.2" />
|
||||
<PackageReference Include="ElmahCore.Common" Version="2.1.2" />
|
||||
<PackageReference Include="ElmahCore.Sql" Version="2.1.2" />
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
@page "/Energy"
|
||||
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th>Inizio</th>
|
||||
<th>Fine</th>
|
||||
<th class="text-right">Unit</th>
|
||||
<th class="text-right">Energy</th>
|
||||
<th class="text-right">Gas</th>
|
||||
<th class="text-right">P1</th>
|
||||
<th class="text-right">P2</th>
|
||||
<th class="text-right">P3</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxOdl)">
|
||||
<td>@record.IdxMacchina</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>@record.DataInizio</td>
|
||||
<td>@record.DataFine</td>
|
||||
<td class="text-right">@(record.NumPezziEv + 200) m</td>
|
||||
<td class="text-right">
|
||||
@{
|
||||
double currSim = simVal(record.NumPezzi, record.NumPezziEv + 200);
|
||||
double currSimGas = simVal(record.NumPezzi, record.NumPezziEv + 200);
|
||||
}
|
||||
<div>
|
||||
@currSim.ToString("N2") kWh
|
||||
</div>
|
||||
<small>
|
||||
@righDiv(currSim, record.NumPezziEv + 200).ToString("N1") kWh/m
|
||||
</small>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>
|
||||
@currSim.ToString("N2") m<sup>3</sup>
|
||||
</div>
|
||||
<small>
|
||||
@righDiv(currSim, record.NumPezziEv + 200).ToString("N1") m<sup>3</sup>/m
|
||||
</small>
|
||||
</td>
|
||||
<td class="text-right">@($"{currSim:N1}")</td>
|
||||
<td class="text-right">@($"{currSimGas:N1}")</td>
|
||||
<td class="text-right">@($"{currSim + currSimGas:N1}")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportEnabled="true" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,214 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
public partial class Energy : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.StatsODL currRecord = null;
|
||||
|
||||
private List<MP.Data.DatabaseModels.StatsODL> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.StatsODL> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string fileName = "ODL.csv";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectData currFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.ODL_Filter;
|
||||
}
|
||||
set
|
||||
{
|
||||
MessageService.ODL_Filter = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private string fullPath
|
||||
{
|
||||
get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}";
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void clearFile()
|
||||
{
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
private async Task ExportCsv()
|
||||
{
|
||||
isLoading = true;
|
||||
// salvo davvero!
|
||||
await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';');
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatOdlGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
clearFile();
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
clearFile();
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.PageName = "Report ODL/Comm.";
|
||||
MessageService.PageIcon = "oi oi-book";
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
clearFile();
|
||||
StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter(SelectData newFilter)
|
||||
{
|
||||
clearFile();
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = SelectData.Init(5, 7);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxODL)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxOdl == IdxODL) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
protected double righDiv(double num, double den)
|
||||
{
|
||||
if (den == 0)
|
||||
{
|
||||
den = 1;
|
||||
}
|
||||
double answ = num / den;
|
||||
return answ;
|
||||
}
|
||||
protected double simVal(double minVal, double maxVal)
|
||||
{
|
||||
Random rnd = new Random();
|
||||
return rnd.NextDouble() * (maxVal - minVal) + minVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2311.1009</h4>
|
||||
<h4>Versione: 6.16.2401.0914</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.1009
|
||||
6.16.2401.0914
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.1009</version>
|
||||
<version>6.16.2401.0914</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
<span class="oi oi-monitor" aria-hidden="true"></span> TRS/OEE %
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="Energy">
|
||||
<span class="oi oi-bar-chart" aria-hidden="true"></span> ENERGY
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="ReportODL">
|
||||
<span class="oi oi-book" aria-hidden="true" title="Dati di Produzione ODL"></span> Report ODL/Comm.
|
||||
|
||||
Reference in New Issue
Block a user