Files
mapo-core/MP-TAB-SERV/Pages/MachineDetail.razor.cs
T
2023-10-04 15:50:15 +02:00

116 lines
3.3 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
namespace MP_TAB_SERV.Pages
{
public partial class MachineDetail
{
#region Protected Properties
protected MappaStatoExpl? CurrMSE { get; set; } = null;
protected string IdxMacc { get; set; } = "";
[Inject]
protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected TabDataService TabServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
#if false
if (enableSchedaTecnica)
{
checkLottiOdl();
}
#endif
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private List<ConfigModel>? CurrConfig = null;
private bool enableSchedaTecnica = false;
#endregion Private Fields
#region Private Methods
private void checkLottiOdl()
{
#if false
// controlla se abilitato check LOTTI MAG
if (enableMagLotti)
{
if (idxOdl > 0)
{
// controlla se ci sia lotto x ODL
if (DataLayerObj.taMagELotti.getByODL(idxOdl).Rows.Count == 0)
{
try
{
// se non c'è chiama stored x rigenerare
DataLayerObj.taMagELotti.UpsertByOdl(idxOdl, true);
}
catch
{ }
}
}
}
#endif
}
private async Task ReloadData()
{
if (string.IsNullOrEmpty(IdxMacc))
{
try
{
IdxMacc = await MsgServ.IdxMaccGet();
// recupero MSE macchina....
if (!string.IsNullOrEmpty(IdxMacc))
{
CurrMSE = await MsgServ.GetMachineMse(IdxMacc);
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}");
}
}
// recupero parametri configurazione...
await setupConf();
}
private async Task setupConf()
{
CurrConfig = await TabServ.ConfigGetAll();
#if false
if (CurrConfig != null && CurrConfig.Count > 0)
{
// sistemo i parametri opzionali...
getConfValInt("keepAliveMin", ref keepAliveMin);
getConfValInt("MON_maxCol", ref maxCol);
int intDoAnim = 0;
getConfValInt("doAnimate", ref intDoAnim);
doAnimate = intDoAnim == 1;
getConfValInt("pageRefreshSec", ref slowRefreshSec);
getConfVal("sART", ref showArt);
Log.Info($"setupConf | Effettuato setup parametri | keepAlive: {keepAliveMin} | MaxCol: {maxCol} | doAnimate: {doAnimate} | slowRefreshSec: {slowRefreshSec}");
}
#endif
}
#endregion Private Methods
}
}