Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop
This commit is contained in:
@@ -1,34 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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_TAB_SERV;
|
||||
using MP_TAB_SERV.Shared;
|
||||
using MP_TAB_SERV.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 MP_TAB_SERV.Pages;
|
||||
using NLog.Fluent;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class CmpTop
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string ResetClass = "btn-primary";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string CurrOprTknLS { get; set; } = null!;
|
||||
|
||||
protected string CurrOprTknRedis { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ListSelectDataSrv MDataService { get; set; } = null!;
|
||||
|
||||
@@ -44,11 +42,56 @@ namespace MP_TAB_SERV.Components
|
||||
[Inject]
|
||||
protected TabDataService TDService { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string ResetClass = "btn-primary";
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
Log.Info("Start ForceReload");
|
||||
ResetClass = "btn-warning";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// reset cache varie
|
||||
await MsgServ.ClearLocalStor();
|
||||
await MsgServ.ClearSessionStor();
|
||||
await MDataService.FlushCache();
|
||||
// reload MStor
|
||||
await ReloadMemStor();
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
delta = delta > 0 ? delta : 50;
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
CurrOprTknLS = await MsgServ.getCurrOperDtoAsync();
|
||||
var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
|
||||
CurrOprTknRedis = await TDService.OperatoreGetRedis(MsgServ.MatrOpr);
|
||||
if (CurrOprTknRedis == "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("reg-new-device"))
|
||||
{
|
||||
NavMan.NavigateTo("reg-new-device", true);
|
||||
}
|
||||
}
|
||||
else if (CurrOprTknRedis != "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("status-map"))
|
||||
{
|
||||
NavMan.NavigateTo("status-map", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task ReloadMemStor()
|
||||
{
|
||||
@@ -87,53 +130,12 @@ namespace MP_TAB_SERV.Components
|
||||
TDService.SetupConfig();
|
||||
}
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
Log.Info("Start ForceReload");
|
||||
ResetClass = "btn-warning";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// reset cache varie
|
||||
await MsgServ.ClearLocalStor();
|
||||
await MsgServ.ClearSessionStor();
|
||||
await MDataService.FlushCache();
|
||||
// reload MStor
|
||||
await ReloadMemStor();
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
delta = delta > 0 ? delta : 50;
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("/", true);
|
||||
}
|
||||
#endregion Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
CurrOprTknLS = await MsgServ.getCurrOperDtoAsync();
|
||||
var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
|
||||
CurrOprTknRedis = await TDService.OperatoreGetRedis(MsgServ.MatrOpr);
|
||||
if (CurrOprTknRedis == "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("regnewdevice"))
|
||||
{
|
||||
NavMan.NavigateTo("regnewdevice", true);
|
||||
}
|
||||
}
|
||||
else if (CurrOprTknRedis != "")
|
||||
{
|
||||
if (!NavMan.Uri.Contains("status-map"))
|
||||
{
|
||||
NavMan.NavigateTo("status-map", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string CurrOprTknLS { get; set; } = null!;
|
||||
protected string CurrOprTknRedis { get; set; } = null!;
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (odlOk)
|
||||
if (odlOk && showChkCloseOdlVal)
|
||||
{
|
||||
<div class="col-12 col-md-6 p-2">
|
||||
<div class="form-check form-switch fs-3">
|
||||
|
||||
@@ -641,6 +641,7 @@ namespace MP_TAB_SERV.Components
|
||||
{
|
||||
//baseLang = SMServ.GetConf("baseLang");
|
||||
numDayOdl = SMServ.GetConfInt("numDaySelOdl");
|
||||
forceCloseOdl = SMServ.GetConfBool("chkCloseOdl");
|
||||
confRett = SMServ.GetConfBool("confRett");
|
||||
enableSplitODL = SMServ.GetConfBool("enableSplitODL");
|
||||
modoConfProd = SMServ.GetConfInt("modoConfProd");
|
||||
@@ -648,8 +649,9 @@ namespace MP_TAB_SERV.Components
|
||||
enableAnnullaSetup = SMServ.GetConfBool("enableAnnullaSetup");
|
||||
enableSchedaTecnica = SMServ.GetConfBool("enableSchedaTecnica");
|
||||
enableFixSetup = SMServ.GetConfBool("OptEnableFixSetup");
|
||||
showSplitOdlOnTav = SMServ.GetConfBool("showSplitOdlOnTav");
|
||||
showChkCloseOdlVal = SMServ.GetConfBool("showChkCloseOdlVal");
|
||||
showReopenOdlTav = SMServ.GetConfBool("showReopenOdlTav");
|
||||
showSplitOdlOnTav = SMServ.GetConfBool("showSplitOdlOnTav");
|
||||
gPeriodReopenOdlTav = SMServ.GetConfInt("gPeriodReopenOdlTav");
|
||||
string rawEmailDest = SMServ.GetConf("_adminEmail");
|
||||
emailAdmDest = rawEmailDest.Split(',').ToList();
|
||||
@@ -960,6 +962,7 @@ namespace MP_TAB_SERV.Components
|
||||
private bool showOdlDetail = false;
|
||||
|
||||
private bool showReopenOdlTav = false;
|
||||
private bool showChkCloseOdlVal = false;
|
||||
|
||||
private bool showSplitOdlOnTav = false;
|
||||
|
||||
@@ -1548,8 +1551,11 @@ namespace MP_TAB_SERV.Components
|
||||
Log.Trace($"found {ListODL.Count} rec");
|
||||
if (forceReload)
|
||||
{
|
||||
var rawData = await TabDServ.PezziProdMacchina(IdxMaccSel);
|
||||
prodMacchina = rawData.FirstOrDefault() ?? new PzProdModel();
|
||||
if (!isMulti || (isMulti && IdxMaccSel.IndexOf("#") > 0))
|
||||
{
|
||||
var rawData = await TabDServ.PezziProdMacchina(IdxMaccSel);
|
||||
prodMacchina = rawData.FirstOrDefault() ?? new PzProdModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
// imposto tcRichAttr in base allo stato...
|
||||
|
||||
@@ -1275,11 +1275,16 @@ namespace MP.Data.Controllers
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
dbResult = dbCtx
|
||||
.DbSetPzProd
|
||||
.FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
try
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPzProd
|
||||
.FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
string answ = "";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
string answ = "";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:CurrOpr:{matrOpr}";
|
||||
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
|
||||
//RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
// serializzo e salvo...
|
||||
//rawData = JsonConvert.SerializeObject(currOpr);
|
||||
@@ -3030,6 +3030,7 @@ namespace MP.Data.Services
|
||||
private string DataSource = "";
|
||||
|
||||
private string redisBaseKey = "MP:TAB:Cache";
|
||||
private string redisUserDataKey = "MP:TAB:Users";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
Reference in New Issue
Block a user