/// Dati produzioen rilevati
@@ -152,7 +159,9 @@ namespace MP_TAB_SERV.Components
{
IdxMaccSel = RecMSE.IdxMacchina;
enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati");
+ chkPzBuoniNeg = SMServ.GetConfBool("TAB_ChkConfPz");
confRett = SMServ.GetConfBool("confRett");
+ enableMagPrint = SMServ.GetConfBool("enableMagPrint");
modoConfProd = SMServ.GetConfInt("modoConfProd");
await DoUpdate();
}
@@ -176,11 +185,11 @@ namespace MP_TAB_SERV.Components
RecMSE = ListMSE.Find(x => x.IdxMacchina == IdxMaccSel);
}
// mostro output
- lblOut = $"Confermata produzione {numPzConfermati - numPzLasciati} pezzi (+{numPzLasciati} pz lasciati, +{numPzScarto2Rec:N0} pz scarto) |{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}";
+ lblOut = $"Confermata produzione {numPzConfermati - numPzLasciati} pezzi (+{numPzLasciati} pz lasciati, +{numPzScarto2Rec} pz scarto) |{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}";
// cambio button conferma...
showInnov = false;
// sollevo evento!
- dtReqUpdate = DateTime.Now;
+ //dtReqUpdate = DateTime.Now;
numPzLasciati = 0;
await DoUpdate();
await Task.Delay(1);
@@ -196,20 +205,23 @@ namespace MP_TAB_SERV.Components
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
- await Task.Delay(10);
+ await Task.Delay(1);
IdxMaccSel = selIdxMacc;
await DoUpdate();
isProcessing = false;
- await Task.Delay(10);
+ await Task.Delay(1);
+ await E_MachSel.InvokeAsync(selIdxMacc);
}
///
/// Cambio stato visibilità pannello e testo button
///
- protected void ToggleConfProd()
+ protected async Task ToggleConfProd()
{
showInnov = !showInnov;
dtReqUpdate = DateTime.Now;
+ await DoUpdate();
+ StateHasChanged();
}
#endregion Protected Methods
@@ -219,6 +231,8 @@ namespace MP_TAB_SERV.Components
private bool confRett = false;
private bool enablePzProdLasciati = false;
+ private bool enableMagPrint = false;
+ private bool chkPzBuoniNeg = false;
private string lblOut = "";
diff --git a/MP-TAB-SERV/Components/ProdPlanMan.razor b/MP-TAB-SERV/Components/ProdPlanMan.razor
index cde2ec27..c2e6d0c9 100644
--- a/MP-TAB-SERV/Components/ProdPlanMan.razor
+++ b/MP-TAB-SERV/Components/ProdPlanMan.razor
@@ -72,7 +72,7 @@ else
- Tot: @($"{item.NumPezzi:N0}")
+ Tot: @($"{item.NumPezzi}")
@item.PzPallet pz/pal
diff --git a/MP-TAB-SERV/Components/ProdStat.razor b/MP-TAB-SERV/Components/ProdStat.razor
index e425aa5e..90b8fd52 100644
--- a/MP-TAB-SERV/Components/ProdStat.razor
+++ b/MP-TAB-SERV/Components/ProdStat.razor
@@ -49,7 +49,7 @@
Nr Pezzi lanciati
- @($"{RecMSE.NumPezzi:N0}") pz.
+ @($"{RecMSE.NumPezzi}") pz.
@@ -68,22 +68,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -91,7 +75,7 @@
Nr pezzi fatti
- (@($"{RecMSE.PezziProd:N0}") pz.)
+ (@($"{RecMSE.PezziProd}") pz.)
diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor b/MP-TAB-SERV/Components/ScrapEditor.razor
index 14b63d93..c3cbe104 100644
--- a/MP-TAB-SERV/Components/ScrapEditor.razor
+++ b/MP-TAB-SERV/Components/ScrapEditor.razor
@@ -10,6 +10,12 @@
+ @if(errMsg != "")
+ {
+
+ @errMsg
+
+ }
@if (ShowDetail)
{
diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor.cs b/MP-TAB-SERV/Components/ScrapEditor.razor.cs
index 14d2d7e7..c21c933c 100644
--- a/MP-TAB-SERV/Components/ScrapEditor.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapEditor.razor.cs
@@ -81,14 +81,26 @@ namespace MP_TAB_SERV.Components
Note = UserComment
};
// inserisco
- await TabServ.RegScartiInsert(newRec);
-
- // reset
- DoReset();
- //ToggleCtrl();
- await E_Updated.InvokeAsync(true);
+ var done = await TabServ.RegScartiInsert(newRec);
+ if (done)
+ {
+ // reset
+ DoReset();
+ errMsg = "";
+ //ToggleCtrl();
+ await E_Updated.InvokeAsync(true);
+ await ReloadData();
+ StateHasChanged();
+ }
+ else
+ {
+ errMsg = "ODL non attivo o data/ora errato";
+ }
+ ShowDetail = false;
}
+ protected string errMsg { get; set; } = "";
+
protected override async Task OnInitializedAsync()
{
await ReloadData();
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor b/MP-TAB-SERV/Components/ScrapMan.razor
index 9d18452a..d7eed171 100644
--- a/MP-TAB-SERV/Components/ScrapMan.razor
+++ b/MP-TAB-SERV/Components/ScrapMan.razor
@@ -1,33 +1,41 @@

-
-@if (useOdl)
-{
-
-}
-else
-{
-
-
-
-}
+
-
-
+ @if (enableScarti)
+ {
+
+
+
+ }
+ else
+ {
+ Registrazione scarti disabilitata
+ }
+
+ @if (useOdl)
+ {
+
+ }
+ else
+ {
+
+
+
+ }
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor.cs b/MP-TAB-SERV/Components/ScrapMan.razor.cs
index dc8c5248..022eb904 100644
--- a/MP-TAB-SERV/Components/ScrapMan.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapMan.razor.cs
@@ -50,16 +50,21 @@ namespace MP_TAB_SERV.Components
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
+ [Inject]
+ protected SharedMemService SMServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
+ protected bool enableScarti { get; set; } = true;
+
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
if (RecMSE != null)
{
+ enableScarti = SMServ.GetConfBool("enableScarti");
IdxMaccSel = RecMSE.IdxMacchina;
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-8);
diff --git a/MP-TAB-SERV/Components/SlideMenu.razor.cs b/MP-TAB-SERV/Components/SlideMenu.razor.cs
index b6b3766f..0e102d29 100644
--- a/MP-TAB-SERV/Components/SlideMenu.razor.cs
+++ b/MP-TAB-SERV/Components/SlideMenu.razor.cs
@@ -1,5 +1,6 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
+using MP.Data.Services;
namespace MP_TAB_SERV.Components
{
@@ -16,6 +17,8 @@ namespace MP_TAB_SERV.Components
[Inject]
protected NavigationManager navManager { get; set; } = null!;
+ [Inject]
+ protected MessageService MsgServ { get; set; } = null!;
#endregion Protected Properties
@@ -29,6 +32,11 @@ namespace MP_TAB_SERV.Components
protected async Task SetPage(string tgtUrl)
{
await Task.Delay(1);
+ if (tgtUrl.Contains("status-map"))
+ {
+ await MsgServ.IdxMaccSet("");
+ }
+ await MsgServ.LastOpenedPageSet(tgtUrl);
navManager.NavigateTo(tgtUrl);
}
diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj
index c93c3d22..9fd21e92 100644
--- a/MP-TAB-SERV/MP-TAB-SERV.csproj
+++ b/MP-TAB-SERV/MP-TAB-SERV.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 6.16.2311.1016
+ 6.16.2312.1115
enable
MP_TAB_SERV
@@ -17,15 +17,14 @@
-
-
+
+
-
diff --git a/MP-TAB-SERV/Pages/Index.razor b/MP-TAB-SERV/Pages/Index.razor
new file mode 100644
index 00000000..b5d0a9fb
--- /dev/null
+++ b/MP-TAB-SERV/Pages/Index.razor
@@ -0,0 +1,20 @@
+@page "/"
+@page "/home"
+
+
+
+@code {
+ protected override async Task OnInitializedAsync()
+ {
+ await Task.Delay(1);
+ }
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ await Task.Delay(1);
+ }
+
+ protected override async Task OnParametersSetAsync()
+ {
+ await Task.Delay(1);
+ }
+}
diff --git a/MP-TAB-SERV/Pages/Logout.razor b/MP-TAB-SERV/Pages/Logout.razor
index a881db05..6579df65 100644
--- a/MP-TAB-SERV/Pages/Logout.razor
+++ b/MP-TAB-SERV/Pages/Logout.razor
@@ -1,8 +1,6 @@
@page "/logout"
-logout
+
-@code {
-}
diff --git a/MP-TAB-SERV/Pages/Logout.razor.cs b/MP-TAB-SERV/Pages/Logout.razor.cs
new file mode 100644
index 00000000..81f91ac5
--- /dev/null
+++ b/MP-TAB-SERV/Pages/Logout.razor.cs
@@ -0,0 +1,48 @@
+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 Blazored.LocalStorage;
+
+namespace MP_TAB_SERV.Pages
+{
+ public partial class Logout
+ {
+ [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!;
+
+ protected override async Task OnInitializedAsync()
+ {
+ await Task.Delay(1);
+ await localStorage.SetItemAsync("currTkn", "");
+ await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr);
+ MsgServ.RigaOper = null;
+ NavMan.NavigateTo("reg-new-device");
+ }
+ }
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor b/MP-TAB-SERV/Pages/MachineDetail.razor
index ecda23b2..fd965bef 100644
--- a/MP-TAB-SERV/Pages/MachineDetail.razor
+++ b/MP-TAB-SERV/Pages/MachineDetail.razor
@@ -8,7 +8,7 @@
}
else
{
-
-
+
+
}
diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor.cs b/MP-TAB-SERV/Pages/MachineDetail.razor.cs
index c5e36643..67275899 100644
--- a/MP-TAB-SERV/Pages/MachineDetail.razor.cs
+++ b/MP-TAB-SERV/Pages/MachineDetail.razor.cs
@@ -61,14 +61,19 @@ namespace MP_TAB_SERV.Pages
}
}
+ protected void SetMacc(string selIdxMacc)
+ {
+ IdxMaccSubSel = selIdxMacc;
+ }
+
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
-
private bool enableMagLotti = false;
private bool enableSchedaTecnica = false;
+ private string IdxMaccSubSel = "";
#endregion Private Fields
diff --git a/MP-TAB-SERV/Pages/ODL.razor b/MP-TAB-SERV/Pages/ODL.razor
index 8fdeb1fa..cea8d71f 100644
--- a/MP-TAB-SERV/Pages/ODL.razor
+++ b/MP-TAB-SERV/Pages/ODL.razor
@@ -7,6 +7,6 @@
}
else
{
-
-
+
+
}
diff --git a/MP-TAB-SERV/Pages/ODL.razor.cs b/MP-TAB-SERV/Pages/ODL.razor.cs
index 6e382c7d..487859a9 100644
--- a/MP-TAB-SERV/Pages/ODL.razor.cs
+++ b/MP-TAB-SERV/Pages/ODL.razor.cs
@@ -23,25 +23,6 @@ namespace MP_TAB_SERV.Pages
await ReloadData();
}
- #endregion Protected Methods
-
- #region Private Methods
-
- private async Task ReloadData()
- {
- if (string.IsNullOrEmpty(IdxMacc))
- {
- IdxMacc = await MsgServ.IdxMaccGet();
- // recupero MSE macchina....
- if (!string.IsNullOrEmpty(IdxMacc))
- {
- CurrMSE = await MsgServ.GetMachineMse(IdxMacc);
- }
- }
- }
-
-
-
protected async Task RefreshData(List newList)
{
var ListMSE = newList;
@@ -69,6 +50,34 @@ namespace MP_TAB_SERV.Pages
}
}
+ protected void SetMacc(string selIdxMacc)
+ {
+ IdxMaccSubSel = selIdxMacc;
+ }
+
+ #endregion Protected Methods
+
+ #region Private Fields
+
+ private string IdxMaccSubSel = "";
+
+ #endregion Private Fields
+
+ #region Private Methods
+
+ private async Task ReloadData()
+ {
+ if (string.IsNullOrEmpty(IdxMacc))
+ {
+ IdxMacc = await MsgServ.IdxMaccGet();
+ // recupero MSE macchina....
+ if (!string.IsNullOrEmpty(IdxMacc))
+ {
+ CurrMSE = await MsgServ.GetMachineMse(IdxMacc);
+ }
+ }
+ }
+
#endregion Private Methods
}
}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Pages/RegNewDevice.razor b/MP-TAB-SERV/Pages/RegNewDevice.razor
new file mode 100644
index 00000000..2e07310a
--- /dev/null
+++ b/MP-TAB-SERV/Pages/RegNewDevice.razor
@@ -0,0 +1,74 @@
+@page "/reg-new-device"
+
+
+ QR-Scan USER LOGIN
+
+
+
+
+
+
+
+@if (ShowScanBarcode)
+{
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+@if (oprsList.Count > 0)
+{
+
+ Selezionare un operatore
+
+
+
+ User Auth Key
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+@if (!string.IsNullOrEmpty(txtError))
+{
+
+ @txtError
+
+}
diff --git a/MP-TAB-SERV/Pages/RegNewDevice.razor.cs b/MP-TAB-SERV/Pages/RegNewDevice.razor.cs
new file mode 100644
index 00000000..993a095c
--- /dev/null
+++ b/MP-TAB-SERV/Pages/RegNewDevice.razor.cs
@@ -0,0 +1,173 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.WebUtilities;
+
+//using MongoDB.Bson.IO;
+using MP.Data.DatabaseModels;
+using MP.Data.DTO;
+using MP.Data.Services;
+using Newtonsoft.Json;
+
+namespace MP_TAB_SERV.Pages
+{
+ public partial class RegNewDevice
+ {
+ #region Protected Fields
+
+ protected int expDays = 1;
+
+ protected DateTime vetoScan = DateTime.Now;
+
+ #endregion Protected Fields
+
+ #region Protected Properties
+
+ protected string _authKey { get; set; } = "";
+
+ protected int _matrOpr { get; set; } = 0;
+
+ protected string authKey
+ {
+ get
+ {
+ return _authKey;
+ }
+ set
+ {
+ if (_authKey != value)
+ {
+ _authKey = value;
+ FirstLogIn().ConfigureAwait(false);
+ }
+ }
+ }
+
+ protected string CurrOprTknLS { get; set; } = null!;
+
+ protected string CurrOprTknRedis { get; set; } = null!;
+
+ protected DateTime expDT { get; set; } = DateTime.Now;
+
+ protected int matrOpr
+ {
+ get
+ {
+ return _matrOpr;
+ }
+ set => _matrOpr = value;
+ }
+
+ [Inject]
+ protected MessageService MsgServ { get; set; } = null!;
+
+ [Inject]
+ protected NavigationManager NavMan { get; set; } = null!;
+
+ protected List oprsList { get; set; } = new List();
+
+ protected AnagOperatoriModel rigaOpr { get; set; } = null!;
+
+ [Inject]
+ protected TabDataService TDService { get; set; } = null!;
+ [Inject]
+ protected SharedMemService SMServ { get; set; } = null!;
+
+ #endregion Protected Properties
+
+ #region Protected Methods
+
+ protected async Task ToggleCodeScan()
+ {
+ await Task.Delay(1);
+ ShowScanBarcode = !ShowScanBarcode;
+ }
+
+ protected string txtError = "";
+
+ protected string Traduci(string lemma)
+ {
+ return SMServ.Traduci($"EN_{lemma}".ToUpper());
+ }
+ protected async Task FirstLogIn()
+ {
+ rigaOpr = await TDService.OperatoreSearch(matrOpr, authKey);
+ if (rigaOpr == null)
+ {
+ var deHash = TDService.DecryptData(authKey);
+ rigaOpr = await TDService.OperatoreSearch(matrOpr, deHash);
+ }
+ if (rigaOpr != null && rigaOpr.MatrOpr > 0)
+ {
+ userTknDTO newUserTkn = new userTknDTO()
+ {
+ currOpr = rigaOpr,
+ expTime = expDT
+ };
+
+ var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
+ string hash = TDService.EncryptData(jsonTkn);
+ MsgServ.RigaOper = rigaOpr;
+ await MsgServ.SetCurrOperDtoAsync(hash);
+ await MsgServ.SetLastMatrOprAsync(rigaOpr.MatrOpr);
+ await TDService.OperatoreSetRedis(matrOpr, hash);
+ NavMan.NavigateTo("status-map");
+ }
+ else
+ {
+ txtError = Traduci("UserPwdMismatch");
+ authKey = "";
+ }
+ }
+
+ protected override async Task OnInitializedAsync()
+ {
+ txtError = "";
+ matrOpr = await MsgServ.GetLastMatrOprAsync();
+ TDService.ConfigGetVal("cookieDayExpire", ref expDays);
+ ShowScanBarcode = !SMServ.GetConfBool("TAB_WebCamHide");
+ expDT = DateTime.Now.AddDays(expDays);
+ oprsList = await TDService.ElencoOperatori();
+ }
+
+ protected async Task ScanDoneHandler(string value)
+ {
+ DateTime adesso = DateTime.Now;
+ // non nullo
+ if (!string.IsNullOrEmpty(value))
+ {
+ // non veto...
+ if (adesso.Subtract(vetoScan).TotalMinutes > 0)
+ {
+ vetoScan = adesso.AddSeconds(4);
+ //NavManager.NavigateTo($"CodeProcess/{value}");
+ var uri = NavMan.ToAbsoluteUri(value);
+ if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var Uri_matrOpr))
+ {
+ if (!string.IsNullOrEmpty(Uri_matrOpr))
+ {
+ matrOpr = int.Parse(Uri_matrOpr);
+ }
+ }
+ if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var Uri_authKey))
+ {
+ if (!string.IsNullOrEmpty(Uri_authKey))
+ {
+ authKey = Uri_authKey;
+ }
+ }
+ await FirstLogIn();
+ }
+ }
+ }
+
+ #endregion Protected Methods
+
+ #region Private Properties
+
+ private bool ShowScanBarcode { get; set; } = false;
+
+ protected EgwCoreLib.Razor.BarcodeReader barcodeReaderCustom { get; set; } = null!;
+
+ #endregion Private Properties
+
+ }
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Pages/StatusMap.razor b/MP-TAB-SERV/Pages/StatusMap.razor
index 250dd569..37a4a0d2 100644
--- a/MP-TAB-SERV/Pages/StatusMap.razor
+++ b/MP-TAB-SERV/Pages/StatusMap.razor
@@ -1,6 +1,4 @@
-@page "/"
-@page "/home"
-@page "/status-map"
+@page "/status-map"
diff --git a/MP-TAB-SERV/Pages/StatusMap.razor.cs b/MP-TAB-SERV/Pages/StatusMap.razor.cs
index cbc1c392..1fd20987 100644
--- a/MP-TAB-SERV/Pages/StatusMap.razor.cs
+++ b/MP-TAB-SERV/Pages/StatusMap.razor.cs
@@ -3,6 +3,7 @@ using Microsoft.JSInterop;
using MP.Data.Conf;
using MP.Data.DatabaseModels;
using MP.Data.Services;
+using MP_TAB_SERV.Shared;
using NLog;
using System.Runtime.ExceptionServices;
@@ -10,6 +11,20 @@ namespace MP_TAB_SERV.Pages
{
public partial class StatusMap
{
+ #region Public Classes
+
+ public class WindowDimension
+ {
+ #region Public Properties
+
+ public int Height { get; set; }
+ public int Width { get; set; }
+
+ #endregion Public Properties
+ }
+
+ #endregion Public Classes
+
#region Protected Fields
protected bool _showCard = false;
@@ -25,13 +40,20 @@ namespace MP_TAB_SERV.Pages
[Inject]
protected IConfiguration config { get; set; } = null!;
+ protected int Height { get; set; } = 0;
+
+ protected bool isCalcSize { get; set; } = false;
+
+ [Inject]
+ protected IJSRuntime JSRuntime { get; set; } = null!;
+
[Inject]
protected StatusData MDataService { get; set; } = null!;
[Inject]
- protected MessageService MServ { get; set; } = null!;
+ protected MessageService MsgServ { get; set; } = null!;
[Inject]
- protected IJSRuntime JSRuntime{ get; set; } = null!;
+ protected NavigationManager NavMan { get; set; } = null!;
protected bool ShowCard
{
@@ -46,50 +68,19 @@ namespace MP_TAB_SERV.Pages
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
+ protected int Width { get; set; } = 0;
+
#endregion Protected Properties
#region Protected Methods
- ///
- /// Recupera da conf eventuale setup tag dell'IOB indicato
- ///
- ///
- ///
- protected List ? getIobTag(string codIob)
+ protected async Task getWDim()
{
- List? answ = null;
- if (MDataService.currTagConf != null)
- {
- // cerco x chiave IOB...
- if (MDataService.currTagConf.ContainsKey(codIob))
- {
- answ = MDataService.currTagConf[codIob];
- }
- }
- return answ;
+ var dimension = await JSRuntime.InvokeAsync("getWindowDimensions");
+ Height = dimension.Height;
+ Width = dimension.Width;
}
- ///
- /// Recupera da redis (in una chiamata soltanto) tutti i valori richiesti e compone un
- /// dizionario x ottimizzare visualizzazione
- ///
- ///
- ///
- protected Dictionary getTagVal(string codIob)
- {
- Dictionary answ = new Dictionary();
- // recupero conf tags...
- var currTags = getIobTag(codIob);
- if (currTags != null && currTags.Count > 0)
- {
- // FIXME TODO !!!! FARE !!!! - da verificare
- answ = currTags.ToDictionary(x => x.TagLocation, x => MDataService.getTagConf(x.TagLocation));
- }
- return answ;
- }
-
- protected bool isCalcSize { get; set; } = false;
-
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
@@ -102,24 +93,31 @@ namespace MP_TAB_SERV.Pages
if (ListMSE != null)
{
// salvo in LocalStorage...
- await MServ.SaveMse(ListMSE);
+ await MsgServ.SaveMse(ListMSE);
}
}
- protected override void OnInitialized()
+ protected override async Task OnInitializedAsync()
{
- var df = MServ.UserPrefGet("DefCardMode");
- ShowCard = df == "shrink" ? false : true;
- isCalcSize = true;
+ setDefaults();
ListMSE = null;
SetupConf();
+ var LastOpenedPage = await MsgServ.LastOpenedPageGet();
+ var currMacc = await MsgServ.IdxMaccGet();
+ if (currMacc != "" && currMacc != null)
+ {
+ await MsgServ.IdxMaccSet(currMacc);
+ if (LastOpenedPage != "" && LastOpenedPage != null)
+ {
+ NavMan.NavigateTo(LastOpenedPage);
+ }
+ //NavMan.NavigateTo($"machine-detail");
+ }
}
protected void SaveData(List newList)
{
- //await Task.Delay(1);
ListMSE = newList;
- //await InvokeAsync(StateHasChanged);
}
#endregion Protected Methods
@@ -140,6 +138,19 @@ namespace MP_TAB_SERV.Pages
#region Private Methods
+ private void setDefaults()
+ {
+ string df = MsgServ.UserPrefSetup("DefCardMode", "full");
+ baseLang = MsgServ.UserPrefSetup("Lang", "IT");
+ tcMode = MsgServ.UserPrefSetup("TcMode", "ms");
+ ShowCard = df == "shrink" ? false : true;
+ isCalcSize = true;
+ }
+
+
+ private string baseLang { get; set; } = "";
+ private string tcMode { get; set; } = "";
+
private void SetupConf()
{
// sistemo i parametri opzionali...
@@ -149,24 +160,5 @@ namespace MP_TAB_SERV.Pages
}
#endregion Private Methods
-
- protected int Width { get; set; } = 0;
- protected int Height { get; set; } = 0;
-
- public class WindowDimension
- {
- #region Public Properties
-
- public int Height { get; set; }
- public int Width { get; set; }
-
- #endregion Public Properties
- }
- protected async Task getWDim()
- {
- var dimension = await JSRuntime.InvokeAsync("getWindowDimensions");
- Height = dimension.Height;
- Width = dimension.Width;
- }
}
}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Pages/User.razor b/MP-TAB-SERV/Pages/User.razor
index bf09134d..d23fee31 100644
--- a/MP-TAB-SERV/Pages/User.razor
+++ b/MP-TAB-SERV/Pages/User.razor
@@ -14,15 +14,50 @@
}
- *@
+
+ Preferenze
+
+
+
+ User Data
+
-
- Preferenze
-
-
+
@if (Width > 1021)
@@ -192,7 +196,7 @@
}
}
- protected string _langIns { get; set; } = "";
+ protected string _langIns { get; set; } = "EN";
protected string langIns
{
@@ -242,21 +246,9 @@
}
protected async override Task OnInitializedAsync()
{
- var tcPrefItem = MsgServ.UserPrefGet("TcMode");
- if (tcPrefItem != null)
- {
- tcModIns = tcPrefItem;
- }
- var langPrefItem = MsgServ.UserPrefGet("Lang");
- if (langPrefItem != null)
- {
- langIns = langPrefItem;
- }
- var defCardPrefItem = MsgServ.UserPrefGet("DefCardMode");
- if (defCardPrefItem != null)
- {
- defCardModeIns = defCardPrefItem;
- }
+ tcModIns = MsgServ.UserPrefSetup("TcMode", "ms");
+ langIns = MsgServ.UserPrefSetup("Lang", "IT");
+ defCardModeIns = MsgServ.UserPrefSetup("DefCardMode", "full");
await Task.Delay(1);
if (string.IsNullOrEmpty(currIpv4))
{
diff --git a/MP-TAB-SERV/Pages/_Layout.cshtml b/MP-TAB-SERV/Pages/_Layout.cshtml
index 24f41386..0a7d54c9 100644
--- a/MP-TAB-SERV/Pages/_Layout.cshtml
+++ b/MP-TAB-SERV/Pages/_Layout.cshtml
@@ -38,6 +38,14 @@
🗙
+ @*
+ *@
+ @**@
+ @*
+ *@
+ @**@
+
+
diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html
index 8d44feee..aa25c504 100644
--- a/MP-TAB-SERV/Resources/ChangeLog.html
+++ b/MP-TAB-SERV/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 6.16.2311.1016
+ Versione: 6.16.2312.1115
Note di rilascio:
-
diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt
index e1f886bd..ea217199 100644
--- a/MP-TAB-SERV/Resources/VersNum.txt
+++ b/MP-TAB-SERV/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2311.1016
+6.16.2312.1115
diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml
index e8dda042..5c669432 100644
--- a/MP-TAB-SERV/Resources/manifest.xml
+++ b/MP-TAB-SERV/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2311.1016
+ 6.16.2312.1115
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html
false
diff --git a/MP-TAB-SERV/Shared/MainLayout.razor b/MP-TAB-SERV/Shared/MainLayout.razor
index d18e77a9..df3d355f 100644
--- a/MP-TAB-SERV/Shared/MainLayout.razor
+++ b/MP-TAB-SERV/Shared/MainLayout.razor
@@ -4,42 +4,23 @@
MP-TAB-SERV
-
-
+ handleBodyClick()">
-
-
-
-
- Username
-
- [999]
-
-
-
-
-
-
-
+
+ @if (MsgServ.RigaOper != null || NavMan.Uri.Contains("reg-new-device"))
+ {
+
+
+ @Body
-
-
-
-
-
- @Body
-
-
-
+ @if (!HideMenu)
+ {
+
+ }
+
+ }
diff --git a/MP-TAB-SERV/Shared/MainLayout.razor.cs b/MP-TAB-SERV/Shared/MainLayout.razor.cs
index c20d5162..8e4c9e6d 100644
--- a/MP-TAB-SERV/Shared/MainLayout.razor.cs
+++ b/MP-TAB-SERV/Shared/MainLayout.razor.cs
@@ -1,9 +1,9 @@
using global::Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
+using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
-using System.Diagnostics;
namespace MP_TAB_SERV.Shared
{
@@ -36,11 +36,16 @@ namespace MP_TAB_SERV.Shared
///
protected List CurrMenuItems { get; set; } = new List();
+ protected bool HideMenu
+ {
+ get => NavMan.Uri.Contains("reg-new-device");
+ }
+
[Inject]
protected ListSelectDataSrv MDataService { get; set; } = null!;
[Inject]
- protected MessageService MServ { get; set; } = null!;
+ protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected SharedMemService MStor { get; set; } = null!;
@@ -51,33 +56,59 @@ namespace MP_TAB_SERV.Shared
[Inject]
protected TabDataService TDataService { get; set; } = null!;
+ [Inject]
+ protected IJSRuntime JSRuntime { get; set; } = null!;
+
#endregion Protected Properties
#region Protected Methods
- protected async Task ForceReload()
+ protected string bodyTipe
{
- Stopwatch sw = new Stopwatch();
- sw.Start();
- Log.Info("Start ForceReload");
- ResetClass = "btn-warning";
- await InvokeAsync(StateHasChanged);
- // reset cache varie
- await MServ.ClearLocalStor();
- await MServ.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);
+ get => NavMan.Uri.Contains("reg-new-device") ? "mainBodyNoSide" : "mainBody";
+ }
+
+
+ protected async Task handleBodyClick()
+ {
+ await Task.Delay(1);
+ await checkDtDiff2Logout();
+
+ }
+ private int MatrOpr
+ {
+ get => MsgServ.MatrOpr;
+ }
+ protected int typeScadLogin { get; set; } = 0;
+ protected int dtScadLogin { get; set; } = 0;
+
+ protected async Task checkDtDiff2Logout()
+ {
+ var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
+ switch (typeScadLogin)
+ {
+ case 0:
+ if (diffOfTime.Minutes >= dtScadLogin)
+ {
+ NavMan.NavigateTo("logout");
+ }
+ break;
+ case 1:
+ if (diffOfTime.Minutes >= dtScadLogin)
+ {
+ var userTkn = await TDataService.OperatoreGetRedis(MatrOpr);
+ if (!string.IsNullOrEmpty(userTkn))
+ {
+ await MsgServ.DoLogIn(userTkn);
+ MsgServ.dtLastAction = DateTime.Now;
+ }
+ else
+ {
+ NavMan.NavigateTo("logout");
+ }
+ }
+ break;
+ }
}
///
@@ -86,6 +117,8 @@ namespace MP_TAB_SERV.Shared
///
protected override async Task OnInitializedAsync()
{
+ typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin");
+ dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin");
NavMan.LocationChanged += HandleLocationChanged;
// verifica preliminare setup mdati
if (!MStor.MenuOk)
diff --git a/MP-TAB-SERV/Shared/MainLayout.razor.css b/MP-TAB-SERV/Shared/MainLayout.razor.css
index 20fe1add..e22bf95a 100644
--- a/MP-TAB-SERV/Shared/MainLayout.razor.css
+++ b/MP-TAB-SERV/Shared/MainLayout.razor.css
@@ -13,59 +13,20 @@ main {
padding: 0 10px 0 0;
}
-.top-row {
- background-color: #05173d;
- /*border-bottom: 1px solid #d6d5d5;*/
- justify-content: flex-end;
- height: 3.5rem;
- display: flex;
- align-items: center;
-}
- .top-row ::deep a, .top-row ::deep .btn-link {
- white-space: nowrap;
- /*margin-left: 1.5rem;*/
- text-decoration: none;
- }
-
- .top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
- text-decoration: underline;
- }
-
- .top-row ::deep a:first-child {
- overflow: hidden;
- text-overflow: ellipsis;
- }
@media (min-width: 640.98px) {
- .slideMen:not(.auth) {
+ /*.slideMen:not(.auth) {
display: none;
- }
+ }*/
#mainBody {
width: 83%;
}
}
-
-
-
-@media (max-width: 640.98px) {
- .top-row:not(.auth) {
- display: none;
- }
-
- #mainBody {
- width: 100%;
- }
-
- .top-row.auth {
- justify-content: space-between;
- }
-
- .top-row ::deep a, .top-row ::deep .btn-link {
- margin-left: 0;
- }
+#mainBodyNoSide {
+ width: 100%;
}
@media (min-width: 641px) {
@@ -82,22 +43,6 @@ main {
}
}
-.top-row {
- position: sticky;
- top: 0;
- z-index: 1;
-}
-
- .top-row.auth ::deep a:first-child {
- flex: 1;
- text-align: right;
- width: 0;
- }
-
-.top-row, article {
- padding-left: 1rem !important;
- padding-right: .5rem !important;
-}
#blazor-error-ui {
background: lightyellow;
diff --git a/MP-TAB-SERV/Shared/NavMenu.razor b/MP-TAB-SERV/Shared/NavMenu.razor
index 9e64402e..a3cfec58 100644
--- a/MP-TAB-SERV/Shared/NavMenu.razor
+++ b/MP-TAB-SERV/Shared/NavMenu.razor
@@ -14,7 +14,7 @@
foreach (var item in MenuItems)
{
-
+ SetPage(item.NavigateUrl)">
@item.Testo
@@ -28,4 +28,20 @@
[Parameter]
public List MenuItems { get; set; } = new List();
+
+ [Inject]
+ protected MessageService MsgServ { get; set; } = null!;
+ [Inject]
+ protected NavigationManager navManager { get; set; } = null!;
+
+ protected async Task SetPage(string tgtUrl)
+ {
+ await Task.Delay(1);
+ if (tgtUrl.Contains("status-map"))
+ {
+ await MsgServ.IdxMaccSet("");
+ }
+ await MsgServ.LastOpenedPageSet(tgtUrl);
+ navManager.NavigateTo(tgtUrl);
+ }
}
diff --git a/MP-TAB-SERV/Shared/NavMenu.razor.css b/MP-TAB-SERV/Shared/NavMenu.razor.css
index 4e972e81..1cf40bb7 100644
--- a/MP-TAB-SERV/Shared/NavMenu.razor.css
+++ b/MP-TAB-SERV/Shared/NavMenu.razor.css
@@ -35,7 +35,7 @@
}
-@media (min-width: 640.98px) {
+@media (max-width: 640.98px) {
.slideMen:not(.auth) {
display: none;
}
diff --git a/MP-TAB-SERV/wwwroot/css/site.css b/MP-TAB-SERV/wwwroot/css/site.css
index 924a71e9..508a0b26 100644
--- a/MP-TAB-SERV/wwwroot/css/site.css
+++ b/MP-TAB-SERV/wwwroot/css/site.css
@@ -101,4 +101,56 @@ a,
}
.blazor-error-boundary::after {
content: "An error has occurred.";
+}
+.top-row {
+ background-color: #05173d;
+ /*border-bottom: 1px solid #d6d5d5;*/
+ justify-content: flex-end;
+ height: 3.5rem;
+ display: flex;
+ align-items: center;
+}
+.top-row ::deep a,
+.top-row ::deep .btn-link {
+ white-space: nowrap;
+ /*margin-left: 1.5rem;*/
+ text-decoration: none;
+}
+.top-row ::deep a:hover,
+.top-row ::deep .btn-link:hover {
+ text-decoration: underline;
+}
+.top-row ::deep a:first-child {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+@media (max-width: 640.98px) {
+ .top-row:not(.auth) {
+ display: none;
+ }
+ #mainBody {
+ width: 100%;
+ }
+ .top-row.auth {
+ justify-content: space-between;
+ }
+ .top-row ::deep a,
+ .top-row ::deep .btn-link {
+ margin-left: 0;
+ }
+}
+.top-row {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+}
+.top-row.auth ::deep a:first-child {
+ flex: 1;
+ text-align: right;
+ width: 0;
+}
+.top-row,
+article {
+ padding-left: 1rem !important;
+ padding-right: 0.5rem !important;
}
\ No newline at end of file
diff --git a/MP-TAB-SERV/wwwroot/css/site.less b/MP-TAB-SERV/wwwroot/css/site.less
index f1f08aa8..3623ea46 100644
--- a/MP-TAB-SERV/wwwroot/css/site.less
+++ b/MP-TAB-SERV/wwwroot/css/site.less
@@ -114,3 +114,63 @@ html, body {
.blazor-error-boundary::after {
content: "An error has occurred."
}
+
+.top-row {
+ background-color: #05173d;
+ /*border-bottom: 1px solid #d6d5d5;*/
+ justify-content: flex-end;
+ height: 3.5rem;
+ display: flex;
+ align-items: center;
+}
+
+.top-row ::deep a, .top-row ::deep .btn-link {
+ white-space: nowrap;
+ /*margin-left: 1.5rem;*/
+ text-decoration: none;
+}
+
+.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
+ text-decoration: underline;
+}
+
+.top-row ::deep a:first-child {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+
+@media (max-width: 640.98px) {
+ .top-row:not(.auth) {
+ display: none;
+ }
+
+ #mainBody {
+ width: 100%;
+ }
+
+ .top-row.auth {
+ justify-content: space-between;
+ }
+
+ .top-row ::deep a, .top-row ::deep .btn-link {
+ margin-left: 0;
+ }
+}
+
+.top-row {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+}
+
+.top-row.auth ::deep a:first-child {
+ flex: 1;
+ text-align: right;
+ width: 0;
+}
+
+.top-row, article {
+ padding-left: 1rem !important;
+ padding-right: .5rem !important;
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/wwwroot/css/site.min.css b/MP-TAB-SERV/wwwroot/css/site.min.css
index 9ec2a048..c429c6c5 100644
--- a/MP-TAB-SERV/wwwroot/css/site.min.css
+++ b/MP-TAB-SERV/wwwroot/css/site.min.css
@@ -1 +1 @@
-@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";}
\ No newline at end of file
+@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";}.top-row{background-color:#05173d;justify-content:flex-end;height:3.5rem;display:flex;align-items:center;}.top-row ::deep a,.top-row ::deep .btn-link{white-space:nowrap;text-decoration:none;}.top-row ::deep a:hover,.top-row ::deep .btn-link:hover{text-decoration:underline;}.top-row ::deep a:first-child{overflow:hidden;text-overflow:ellipsis;}@media(max-width:640.98px){.top-row:not(.auth){display:none;}#mainBody{width:100%;}.top-row.auth{justify-content:space-between;}.top-row ::deep a,.top-row ::deep .btn-link{margin-left:0;}}.top-row{position:sticky;top:0;z-index:1;}.top-row.auth ::deep a:first-child{flex:1;text-align:right;width:0;}.top-row,article{padding-left:1rem!important;padding-right:.5rem!important;}
\ No newline at end of file
diff --git a/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js b/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js
new file mode 100644
index 00000000..2fbce212
--- /dev/null
+++ b/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js
@@ -0,0 +1,317 @@
+import '_content/ZXingBlazor/lib/zxing/zxing.min.js';
+let codeReader = null;
+let id = null;
+let supportsVibrate = false;
+let opt = null;
+let inst = null;
+let selectedDeviceId = null;
+let deviceID = null;
+let element = null;
+let debug = false;
+export function vibrate() {
+ if (supportsVibrate) navigator.vibrate(1000);
+}
+export function init(instance, ele, elementid, options, deviceid) {
+ console.log('init' + elementid);
+ inst = instance;
+ opt = options;
+ id = elementid;
+ deviceID = deviceid;
+ element = ele;
+ debug = options.debug;
+ supportsVibrate = "vibrate" in navigator;
+ let startButton = element.querySelector("[data-action=startButton]");
+ let resetButton = element.querySelector("[data-action=resetButton]");
+ let closeButton = element.querySelector("[data-action=closeButton]");
+
+ if (startButton) startButton.addEventListener('click', () => {
+ start(elementid);
+ })
+
+ if (resetButton) resetButton.addEventListener('click', () => {
+ stop(elementid);
+ if (debug) console.log('Reset.')
+ })
+
+ if (closeButton) closeButton.addEventListener('click', () => {
+ stop(elementid);
+ if (debug) console.log('closeButton.')
+ instance.invokeMethodAsync("CloseScan");
+ })
+
+ load(elementid);
+}
+
+export function reload(elementid) {
+ load(elementid);
+}
+
+function genHints(opt) {
+ const hints = new Map();
+ if (opt.TRY_HARDER) {
+ hints.set(ZXing.DecodeHintType.TRY_HARDER, opt.TRY_HARDER);
+ }
+ if (opt.ASSUME_CODE_39_CHECK_DIGIT) {
+ hints.set(ZXing.DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT, opt.ASSUME_CODE_39_CHECK_DIGIT);
+ }
+ if (opt.ASSUME_GS1) {
+ hints.set(ZXing.DecodeHintType.ASSUME_GS1, opt.ASSUME_GS1);
+ }
+ if (opt.CHARACTER_SET) {
+ hints.set(ZXing.DecodeHintType.CHARACTER_SET, opt.CHARACTER_SET);
+ }
+ if (opt.OTHER) {
+ hints.set(ZXing.DecodeHintType.OTHER, opt.OTHER);
+ }
+ if (opt.PURE_BARCODE) {
+ hints.set(ZXing.DecodeHintType.PURE_BARCODE, opt.PURE_BARCODE);
+ }
+ if (opt.RETURN_CODABAR_START_END) {
+ hints.set(ZXing.DecodeHintType.RETURN_CODABAR_START_END, opt.RETURN_CODABAR_START_END);
+ }
+ if (opt.TRY_HARDER) {
+ hints.set(ZXing.DecodeHintType.TRY_HARDER, opt.TRY_HARDER);
+ }
+ return hints;
+}
+
+export function load(elementid) {
+ if (id == elementid) {
+
+ const sourceSelect = element.querySelector("[data-action=sourceSelect]");
+ const sourceSelectPanel = element.querySelector("[data-action=sourceSelectPanel]");
+ const hints = genHints(opt);
+
+ if (opt.pdf417) {
+ codeReader = new ZXing.BrowserPDF417Reader(hints);
+ if (debug) console.log('ZXing code PDF417 reader initialized')
+ } else if (opt.decodeAllFormats) {
+ const formats = opt.formats;
+ hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, formats);
+ codeReader = new ZXing.BrowserMultiFormatReader(hints)
+ if (debug) console.log('ZXing code reader initialized with all formats')
+ } else {
+ codeReader = new ZXing.BrowserMultiFormatReader(hints)
+ if (debug) console.log('ZXing code reader initialized')
+ }
+ codeReader.timeBetweenDecodingAttempts = opt.timeBetweenDecodingAttempts;
+
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
+ navigator.mediaDevices
+ .getUserMedia({ audio: false, video: true })
+ .then(() => {
+
+ codeReader.listVideoInputDevices()
+ .then((videoInputDevices) => {
+ if (deviceID != null) {
+ selectedDeviceId = deviceID
+ } else if (videoInputDevices.length > 1) {
+ selectedDeviceId = videoInputDevices[1].deviceId
+ } else {
+ selectedDeviceId = videoInputDevices[0].deviceId
+ }
+ if (debug) console.log('videoInputDevices:' + videoInputDevices.length);
+ if (videoInputDevices.length > 1) {
+ sourceSelect.innerHTML = '';
+ videoInputDevices.forEach((device) => {
+ const sourceOption = document.createElement('option');
+ if (device.label === '') {
+ sourceOption.text = 'Camera' + (sourceSelect.length + 1);
+ } else {
+ sourceOption.text = device.label
+ }
+ sourceOption.value = device.deviceId
+ if (selectedDeviceId != null && device.deviceId == selectedDeviceId) {
+ sourceOption.selected = true
+ }
+ sourceSelect.appendChild(sourceOption)
+ })
+
+ sourceSelect.onchange = () => {
+ selectedDeviceId = sourceSelect.value;
+ inst.invokeMethodAsync('SelectDeviceID', selectedDeviceId, sourceSelect.options[sourceSelect.selectedIndex].text);
+ codeReader.reset();
+ start(elementid);
+ }
+
+ sourceSelectPanel.style.display = 'block'
+ }
+
+ start(elementid);
+
+ })
+ .catch((err) => {
+ console.log(err)
+ inst.invokeMethodAsync("GetError", err + '');
+ })
+
+ })
+ .catch((err) => {
+ console.error(`An error occurred: ${err}`);
+ inst.invokeMethodAsync('GetError', `An error occurred: ${err}`);
+ });
+
+ }
+ }
+}
+
+export function start(elementid) {
+ if (undefined !== codeReader && null !== codeReader && id == elementid) {
+ if (opt.decodeonce) {
+ codeReader.decodeOnceFromVideoDevice(selectedDeviceId, 'video').then((result) => {
+ if (debug) console.log(result)
+ vibrate();
+ if (debug) console.log('autostop');
+ codeReader.reset();
+ return inst.invokeMethodAsync("GetResult", result.text);
+ }).catch((err) => {
+ if (err && !(err instanceof ZXing.NotFoundException)) {
+ console.log(err)
+ inst.invokeMethodAsync("GetError", err + '');
+ }
+ })
+ } else {
+ codeReader.decodeFromVideoDevice(selectedDeviceId, 'video', (result, err) => {
+ if (result) {
+ if (debug) console.log(result)
+ vibrate();
+ if (debug) console.log('None-stop');
+ inst.invokeMethodAsync("GetResult", result.text);
+ }
+ if (err && !(err instanceof ZXing.NotFoundException)) {
+ console.log(err)
+ inst.invokeMethodAsync("GetError", err + '');
+ }
+ })
+ }
+
+ var x = `decodeContinuously`;
+ if (opt.decodeonce) x = `decodeOnce`;
+ if (debug) console.log(`Started ` + x + ` decode from camera with id ${selectedDeviceId}`)
+ if (debug) console.log(id, 'start');
+ }
+}
+
+export function stop(elementid) {
+ if (undefined !== codeReader && null !== codeReader && id == elementid) {
+ codeReader.reset();
+ if (debug) console.log(id, 'stop');
+ }
+}
+
+export function QRCodeSvg(instance, input, element, tobase64, size = 300) {
+ const codeWriter = new ZXing.BrowserQRCodeSvgWriter()
+
+ if (debug) console.log('ZXing code writer initialized')
+
+ if (tobase64) {
+ const elementTemp = document.createElement('elementTemp');
+ codeWriter.writeToDom(elementTemp, input, size, size)
+ let svgElement = elementTemp.firstChild
+ const svgData = (new XMLSerializer()).serializeToString(svgElement)
+ //const blob = new Blob([svgData])
+ instance.invokeMethodAsync("GetQRCode", svgData);
+ } else {
+ codeWriter.writeToDom(element.querySelector("[data-action=result]"), input, size, size)
+ }
+}
+
+export function DecodeFormImage(instance, element, options, data) {
+ var codeReaderImage = null;
+ const hints = genHints(options);
+ if (options.pdf417) {
+ codeReaderImage = new ZXing.BrowserPDF417Reader(hints);
+ if (debug) console.log('ZXing code PDF417 reader initialized')
+ } else if (options.decodeAllFormats) {
+ const formats = options.formats;
+ hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, formats);
+ codeReaderImage = new ZXing.BrowserMultiFormatReader(hints)
+ if (debug) console.log('ZXing code reader initialized with all formats')
+ } else {
+ codeReaderImage = new ZXing.BrowserMultiFormatReader(hints)
+ if (debug) console.log('ZXing code reader initialized')
+ }
+ if (debug) console.log('ZXing code reader initialized')
+
+ if (data != null) {
+ codeReaderImage.decodeFromImageUrl(data).then(result => {
+ if (result) {
+ vibrate();
+ if (debug) console.log(result.text);
+ instance.invokeMethodAsync('GetResult', result.text)
+ }
+ }).catch((err) => {
+ if (err) {
+ console.log(err)
+ instance.invokeMethodAsync('GetError', err.message)
+ }
+ })
+
+ }
+ else {
+ const resetFile = () => {
+ let file = element.querySelector('[type="file"]')
+ if (file) {
+ file.removeEventListener('change', scanImageHandler)
+ file.remove()
+ }
+ file = document.createElement('input')
+ file.setAttribute('type', 'file')
+ file.setAttribute('hidden', 'true')
+ file.setAttribute('accept', 'image/*')
+ //file.setAttribute('capture', 'true')
+ element.append(file)
+ file.addEventListener('change', scanImageHandler)
+ codeReaderImage.file = file
+ return file
+ }
+
+ const scanImageHandler = () => {
+ const files = codeReaderImage.file.files
+ if (files.length === 0) {
+ return
+ }
+
+
+ const reader = new FileReader()
+ reader.onloadend = e => {
+
+ codeReaderImage.decodeFromImageUrl(e.target.result).then(result => {
+ if (result) {
+ vibrate();
+ if (debug) console.log(result.text);
+ instance.invokeMethodAsync('GetResult', result.text)
+ } else {
+ instance.invokeMethodAsync('GetError', "no valid barcode detected")
+ }
+ }).catch((err) => {
+ if (err) {
+ console.log(err)
+ instance.invokeMethodAsync('GetError', err.message)
+ }
+ })
+ }
+ reader.readAsDataURL(files[0])
+ }
+
+ let file = resetFile()
+ file.click()
+
+ }
+
+}
+
+export function destroy(elementid) {
+ if (undefined !== codeReader && null !== codeReader && id == elementid) {
+ codeReader.reset();
+ codeReader = null;
+ //id = null;
+ id = null;
+ opt = null;
+ inst = null;
+ selectedDeviceId = null;
+ deviceID = null;
+ element = null;
+ if (debug) console.log(id, 'destroy');
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/Constants.cs b/MP.Data/Constants.cs
index 9f43bd5b..4c988efc 100644
--- a/MP.Data/Constants.cs
+++ b/MP.Data/Constants.cs
@@ -20,6 +20,10 @@
public static string redisMseKey = "MP:MON:Cache:MSE";
+ public static string redisMseKeySingle = "MP:MON:Cache:MseSingle";
+
+ // passphrase cifratura
+ public const string passPhrase = "7871D817-C71F-4DFC-BF12-00A95BE507B5";
#endregion Public Fields
}
diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index 0b7b7aaa..73c17c66 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -611,7 +611,6 @@ namespace MP.Data.Controllers
numRecProc += numRec;
if (numRec > maxItem)
{
-
List listPeriodi = new List();
switch (valMode)
@@ -713,6 +712,27 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Elenco Gruppi
+ ///
+ ///
+ public List FluxLogPareto(string idxMacchina, DateTime dtFrom, DateTime dtTo)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbSetFluxLog
+ .Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo))
+ .AsNoTracking()
+ .GroupBy(x => x.CodFlux)
+ .Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() })
+ .OrderByDescending(x => x.Qty)
+ .ToList();
+ }
+ return dbResult;
+ }
+
///
/// Stored manutenzione del DB
///
@@ -1270,27 +1290,6 @@ namespace MP.Data.Controllers
return dbResult;
}
- ///
- /// Elenco Gruppi
- ///
- ///
- public List ParetoFluxLog(string idxMacchina, DateTime dtFrom, DateTime dtTo)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(_configuration))
- {
- dbResult = dbCtx
- .DbSetFluxLog
- .Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo))
- .AsNoTracking()
- .GroupBy(x => x.CodFlux)
- .Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() })
- .OrderByDescending(x => x.Qty)
- .ToList();
- }
- return dbResult;
- }
-
///
/// Stato prod macchina
///
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index ef4d23f9..e7311b81 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -54,6 +54,51 @@ namespace MP.Data.Controllers
return dbResult;
}
+
+ ///
+ /// Elenco operatori
+ ///
+ ///
+ public List ElencoOperatori()
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbOperatori
+ .Where(s => s.MatrOpr > 0)
+ .AsNoTracking()
+ .OrderBy(x => x.MatrOpr)
+ .ToList();
+ }
+ return dbResult;
+ }
+
+ ///
+ /// login operatori
+ ///
+ /// ///
+ /// ///
+ ///
+ public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey)
+ {
+ AnagOperatoriModel dbResult = null;
+ AnagOperatoriModel answ = new AnagOperatoriModel();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbOperatori
+ .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
+ .AsNoTracking()
+ .FirstOrDefault();
+ if (dbResult != null)
+ {
+ answ = dbResult;
+ }
+ }
+ return answ;
+ }
+
///
/// Registrato ACK allarme
///
@@ -765,6 +810,35 @@ namespace MP.Data.Controllers
return fatto;
}
+ ///
+ /// Dati MSE x singola macchina SUB (tipicamente TAV)
+ ///
+ ///
+ ///
+ ///
+ public List MseGetSub(string idxMacc, string idxMacchSub)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ try
+ {
+ var IdxMacc = new SqlParameter("@IdxMacchina", idxMacc);
+ var IdxMacchSub = new SqlParameter("@IdxMacchSub", idxMacchSub);
+ dbResult = dbCtx
+ .DbSetMSE
+ .FromSqlRaw("EXEC stp_MSE_getByIdxMacchAndSub @IdxMacchina, @IdxMacchSub", IdxMacc, IdxMacchSub)
+ .AsNoTracking()
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante MseGetSub{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
///
/// ODL da key
///
@@ -794,6 +868,34 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Clear operazione setup ODL (annullamento)
+ ///
+ ///
+ ///
+ ///
+ public bool OdlClearSetup(int idxODL, string idxMacchina)
+ {
+ bool answ = false;
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ try
+ {
+ var IdxODL = new SqlParameter("@idxODL", idxODL);
+ var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
+ var result = dbCtx
+ .Database
+ .ExecuteSqlRaw("EXEC stp_ODL_clearSetup @IdxODL, @IdxMacchina", IdxODL, IdxMacchina);
+ answ = result != 0;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante OdlClearSetup{Environment.NewLine}{exc}");
+ }
+ }
+ return answ;
+ }
+
///
/// ODL corrente macchina
///
@@ -821,33 +923,6 @@ namespace MP.Data.Controllers
return dbResult;
}
- ///
- /// Registro fine prod ODL
- ///
- ///
- ///
- ///
- public bool OdlFineProd(int idxODL, string idxMacchina)
- {
- bool fatto = false;
- using (var dbCtx = new MoonProContext(_configuration))
- {
- try
- {
- var IdxODL = new SqlParameter("@IdxODL", idxODL);
- var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
- var result = dbCtx
- .Database
- .ExecuteSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacc);
- fatto = result != 0;
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante OdlFineProd{Environment.NewLine}{exc}");
- }
- }
- return fatto;
- }
///
/// Attrezzo stesso ODL dell'altra tavola
///
@@ -878,7 +953,33 @@ namespace MP.Data.Controllers
return fatto;
}
-
+ ///
+ /// Registro fine prod ODL
+ ///
+ ///
+ ///
+ ///
+ public bool OdlFineProd(int idxODL, string idxMacchina)
+ {
+ bool fatto = false;
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ try
+ {
+ var IdxODL = new SqlParameter("@IdxODL", idxODL);
+ var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
+ var result = dbCtx
+ .Database
+ .ExecuteSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacc);
+ fatto = result != 0;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante OdlFineProd{Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
///
/// Fix ODL per macchine SLAVE
@@ -946,6 +1047,33 @@ namespace MP.Data.Controllers
return fatto;
}
+ ///
+ /// Ultimo ODL data macchina
+ ///
+ ///
+ ///
+ public List OdlLastByMacc(string idxMacchina)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ try
+ {
+ var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
+ dbResult = dbCtx
+ .DbSetODL
+ .FromSqlRaw("EXEC stp_ODL_getLastByMacchina @IdxMacchina", IdxMacchina)
+ .AsNoTracking()
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante OdlLastByMacc{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
+
///
/// Elenco ODL data macchina e periodo
///
@@ -977,34 +1105,6 @@ namespace MP.Data.Controllers
return dbResult;
}
- ///
- /// Ultimo ODL data macchina
- ///
- ///
- ///
- public List OdlLastByMacc(string idxMacchina)
- {
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(_configuration))
- {
- try
- {
- var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
- dbResult = dbCtx
- .DbSetODL
- .FromSqlRaw("EXEC stp_ODL_getLastByMacchina @IdxMacchina", IdxMacchina)
- .AsNoTracking()
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante OdlLastByMacc{Environment.NewLine}{exc}");
- }
- }
- return dbResult;
- }
-
-
///
/// Riapertura ULTIMO ODL data macchina
///
@@ -1032,8 +1132,6 @@ namespace MP.Data.Controllers
return dbResult;
}
-
-
///
/// Setup ODL Postumo
///
@@ -1137,6 +1235,9 @@ namespace MP.Data.Controllers
///
///
///
+ ///
+ ///
+ ///
///
public bool OdlUpdate(int idxODL, int matrOpr, decimal tCRichAttr, int pzPallet, string note)
{
@@ -1174,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;
}
@@ -1454,6 +1560,7 @@ namespace MP.Data.Controllers
///
public async Task RegScartiInsert(RegistroScartiModel newRec)
{
+ await Task.Delay(1);
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
@@ -1464,11 +1571,14 @@ namespace MP.Data.Controllers
var Note = new SqlParameter("@Note", newRec.Note);
var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr);
- var result = await dbCtx
- .Database
- .ExecuteSqlRawAsync("exec dbo.stp_RS_insert @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr);
+ var result = dbCtx
+ .DbSetRegWithCheck
+ .FromSqlRaw("exec dbo.stp_RS_Insert_withCheck @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr)
+ .AsNoTracking()
+ .ToList();
// indico eseguito!
- fatto = result > 0;
+ // -1 = restituisce una select
+ fatto = result.Count > 0;
}
return fatto;
}
diff --git a/MP.Data/DTO/userTknDTO.cs b/MP.Data/DTO/userTknDTO.cs
new file mode 100644
index 00000000..bc9a8db5
--- /dev/null
+++ b/MP.Data/DTO/userTknDTO.cs
@@ -0,0 +1,15 @@
+using MP.Data.DatabaseModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MP.Data.DTO
+{
+ public class userTknDTO
+ {
+ public AnagOperatoriModel currOpr { get; set; } = null;
+ public DateTime expTime { get; set; } = DateTime.Now;
+ }
+}
diff --git a/MP.Data/DatabaseModels/RegCheckModel.cs b/MP.Data/DatabaseModels/RegCheckModel.cs
new file mode 100644
index 00000000..1c18a6ed
--- /dev/null
+++ b/MP.Data/DatabaseModels/RegCheckModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#nullable disable
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace MP.Data.DatabaseModels
+{
+ public partial class RegCheckModel
+ {
+ #region Public Properties
+ [Key]
+ public string IdxMacchina { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index 43503dc5..b36b607f 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -78,6 +78,7 @@ namespace MP.Data
public virtual DbSet DbSetRegControlli { get; set; }
public virtual DbSet DbSetRegScarti { get; set; }
public virtual DbSet DbSetRegDich { get; set; }
+ public virtual DbSet DbSetRegWithCheck { get; set; }
public virtual DbSet DbSetStAct { get; set; }
diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs
index 6d751191..cd063eb6 100644
--- a/MP.Data/Services/MessageService.cs
+++ b/MP.Data/Services/MessageService.cs
@@ -1,7 +1,9 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
+using EgwCoreLib.Utils;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
+using MP.Data.DTO;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
@@ -24,13 +26,15 @@ namespace MP.Data.Services
#region Public Constructors
- public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore)
+ public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore, TabDataService tdService, SharedMemService smServ)
{
_configuration = configuration;
// gestione sessioni in browser
localStorage = genLocalStorage;
sessionStore = sessStore;
+ TDService = tdService;
+ SMService = smServ;
// setup compoenti REDIS
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
@@ -45,10 +49,38 @@ namespace MP.Data.Services
public event Action EA_PageUpdated = null!;
+ public event Action EA_ResetFooterTimer = null!;
+
#endregion Public Events
#region Public Properties
+#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
+
+ public DateTime dtLastAction { get; set; } = DateTime.Now;
+
public string CognomeNome
{
get
@@ -92,8 +124,7 @@ namespace MP.Data.Services
{
get
{
- int answ = 102;
- //int answ = -1;
+ int answ = -1;
if (_rigaOper != null)
{
answ = _rigaOper.MatrOpr;
@@ -211,6 +242,32 @@ namespace MP.Data.Services
await sessionStore.SetItemAsync(KeyCommText, Valore);
}
+ public string DecryptData(string encData)
+ {
+ return SteamCrypto.DecryptString(encData, Constants.passPhrase);
+ }
+
+ public string EncryptData(string rawData)
+ {
+ return SteamCrypto.EncryptString(rawData, Constants.passPhrase);
+ }
+
+ ///
+ /// Restituisce il record OperatoreDTO da localstorage
+ ///
+ ///
+ public async Task GetCurrOperDtoAsync()
+ {
+ string answ = "";
+ var result = await localStorage.GetItemAsync("currTkn");
+ if (result != null)
+ {
+ //var data = JsonConvert.DeserializeObject(result);
+ answ = result;
+ }
+ return answ;
+ }
+
///
/// Restituisce il valore Ipv4 del Device da localstorage
///
@@ -241,6 +298,21 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Restituisce ultima matrOpr registrata da localstorage
+ ///
+ ///
+ public async Task GetLastMatrOprAsync()
+ {
+ int answ = -1;
+ var result = await localStorage.GetItemAsync("lastMatrOpr");
+ if (!string.IsNullOrEmpty(result))
+ {
+ answ = int.Parse(result);
+ }
+ return answ;
+ }
+
///
/// Recupero dati MSE x macchina
///
@@ -262,7 +334,7 @@ namespace MP.Data.Services
///
public async Task IdxMaccGet()
{
- return await sessionStore.GetItemAsync("CurrMach");
+ return await localStorage.GetItemAsync("CurrMach");
}
///
@@ -270,7 +342,22 @@ namespace MP.Data.Services
///
public async Task IdxMaccSet(string machSel)
{
- await sessionStore.SetItemAsync("CurrMach", machSel);
+ await localStorage.SetItemAsync("CurrMach", machSel);
+ }
+ ///
+ /// Scrive sul local storage pagina corrente
+ ///
+ public async Task LastOpenedPageGet()
+ {
+ return await localStorage.GetItemAsync("LastPage");
+ }
+
+ ///
+ /// Ottiene sul local storage pagina corrente
+ ///
+ public async Task LastOpenedPageSet(string lastPage)
+ {
+ await localStorage.SetItemAsync("LastPage", lastPage);
}
///
@@ -299,6 +386,18 @@ namespace MP.Data.Services
return hasKey;
}
+ ///
+ /// scrive il record OperatoreDTO nel localstorage
+ ///
+ ///
+ public async Task SetCurrOperDtoAsync(string currTkn)
+ {
+ bool answ = false;
+ await localStorage.SetItemAsync("currTkn", currTkn);
+ answ = true;
+ return answ;
+ }
+
///
/// Scrive il valore di IPV4 del device nel localstoragee
///
@@ -339,6 +438,60 @@ namespace MP.Data.Services
return answ;
}
+ protected int expDays { get; set; } = 0;
+
+ public async Task DoLogIn(string decodValue)
+ {
+ bool answ = false;
+ expDays = SMService.GetConfInt("cookieDayExpire");
+ var expDT = DateTime.Now.AddDays(expDays);
+ // decifro i valori..
+ var decrVal = DecryptData(decodValue);
+ var opData = JsonConvert.DeserializeObject(decrVal);
+ if (opData != null)
+ {
+ var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey);
+ if (rigaOpr != null)
+ {
+ userTknDTO newUserTkn = new userTknDTO()
+ {
+ currOpr = rigaOpr,
+ expTime = expDT
+ };
+
+ var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
+ string hash = TDService.EncryptData(jsonTkn);
+ RigaOper = rigaOpr;
+ await SetLastMatrOprAsync(rigaOpr.MatrOpr);
+ await SetCurrOperDtoAsync(hash);
+ await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash);
+ answ = true;
+ //if (LastOpenedPage != "" && CurrMacc != "")
+ //{
+ // NavMan.NavigateTo(LastOpenedPage);
+ //}
+ //else
+ //{
+ // NavMan.NavigateTo("status-map");
+ //}
+ }
+ }
+ return answ;
+ }
+
+
+ ///
+ /// Salva matrOpr nel localstorage
+ ///
+ ///
+ public async Task SetLastMatrOprAsync(int matrOpr)
+ {
+ bool answ = false;
+ await localStorage.SetItemAsync("lastMatrOpr", matrOpr);
+ answ = true;
+ return answ;
+ }
+
///
/// Recupero singola preferenza utente
///
@@ -377,6 +530,30 @@ namespace MP.Data.Services
return done;
}
+ ///
+ /// Recupero singola preferenza utente se presente, oppure imposto quella di default
+ /// indicata e la rendo
+ ///
+ ///
+ ///
+ public string UserPrefSetup(string chiave, string defValue)
+ {
+ string answ = defValue;
+ var currDict = UsersPrefDict;
+ if (currDict.ContainsKey(chiave))
+ {
+ answ = currDict[chiave];
+ }
+ else
+ {
+ if (MatrOpr > 0)
+ {
+ UserPrefSave(chiave, defValue);
+ }
+ }
+ return answ;
+ }
+
#endregion Public Methods
#region Protected Fields
@@ -401,6 +578,8 @@ namespace MP.Data.Services
#region Protected Properties
protected ILocalStorageService localStorage { get; set; } = null!;
+ protected TabDataService TDService { get; set; } = null!;
+ protected SharedMemService SMService { get; set; } = null!;
protected ISessionStorageService sessionStore { get; set; } = null!;
@@ -483,243 +662,5 @@ namespace MP.Data.Services
}
#endregion Private Methods
-
-#if false
- public event Action EA_DateChanged = null!;
- public event Action EA_CalModeChanged = null!;
-
- public event Action EA_TimbUpd = null!;
-#endif
-
-#if false
- public RegAttivitaModel? clonedRA { get; set; } = null;
-
- ///
- /// Calcola HASH del codice impiego = payload utente
- ///
- ///
- public string HashDip
- {
- get
- {
- DataValidator cDV = new DataValidator(_rigaOper);
- string hash = cDV.HashDip;
- return hash;
- }
- }
-#endif
-#if false
- public bool IsActive
- {
- get
- {
- bool answ = false;
- if (_rigaOper != null && _rigaOper.Attivo != null)
- {
- answ = (bool)_rigaOper.Attivo;
- }
- return answ;
- }
- }
-
- public bool isRicTimb { get; set; } = false;
-
- public CalendarModeEnum.modoControllo modoCal { get; set; } = CalendarModeEnum.modoControllo.showCalendar;
-#endif
-
-#if false
- ///
- /// Indica ultima azione compiuta
- ///
- public string LastAction
- {
- get => lastAction;
- set
- {
- if (lastAction != value)
- {
- lastAction = value;
- }
- }
- }
-
- ///
- /// Indica se il prossimo stato timbratura sia entrata
- ///
- public bool NextIsEntrata
- {
- get => nextIsEntrata;
- set
- {
- if (nextIsEntrata != value)
- {
- nextIsEntrata = value;
- }
- }
- }
-
- public string PageIcon
- {
- get => _pageIcon;
- set
- {
- if (_pageIcon != value)
- {
- _pageIcon = value;
- ReportPageUpd();
- }
- }
- }
-
- public string PageName
- {
- get => _pageName;
- set
- {
- if (_pageName != value)
- {
- _pageName = value;
- ReportPageUpd();
- }
- }
- }
-
- public bool PayloadOk { get; set; } = false;
- public RegAttivitaModel? recordRA { get; set; } = null;
-#endif
-#if false
- public string SearchVal
- {
- get => _searchVal;
- set
- {
- if (_searchVal != value)
- {
- _searchVal = value;
-
- if (EA_DipUpdated != null)
- {
- EA_DipUpdated?.Invoke();
- }
- }
- }
- }
-
- public int selWeekNum { get; set; } = 0;
- public int selYear { get; set; } = DateTime.Today.Year;
-
- public bool ShowSearch
- {
- get => showSearch;
- set
- {
- if (showSearch != value)
- {
- showSearch = value;
- }
- }
- }
-
- public DateTime targetDate { get; set; } = DateTime.Today;
- public DateTime targetDateMancTimb { get; set; }
-#endif
-#if false
-
- public void ReportDateChange()
- {
- if (EA_DateChanged != null)
- {
- EA_DateChanged?.Invoke();
- }
- }
-
- public void setModeCalendar()
- {
- modoCal = CalendarModeEnum.modoControllo.showCalendar;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
- public void setModeGauge()
- {
- modoCal = CalendarModeEnum.modoControllo.showGauge;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
- public void setModeProj()
- {
- modoCal = CalendarModeEnum.modoControllo.showProj;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
- public void setModeTempRil()
- {
- modoCal = CalendarModeEnum.modoControllo.showTempRil;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
- public void setModeRichTimb()
- {
- modoCal = CalendarModeEnum.modoControllo.showTimbr;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
- public void setModeShowWeek()
- {
- modoCal = CalendarModeEnum.modoControllo.showWeek;
- if (EA_CalModeChanged != null)
- {
- EA_CalModeChanged?.Invoke();
- }
- }
-
- public void ReportTimbratura()
- {
- if (EA_TimbUpd != null)
- {
- EA_TimbUpd?.Invoke();
- }
- }
-#endif
-#if false
- private string _pageIcon = "";
- private string _pageName = "";
-#endif
-#if false
- private string _searchVal = "";
- private bool showSearch;
-#endif
-
-#if false
- private string lastAction { get; set; } = "";
- private bool nextIsEntrata { get; set; } = true;
-#endif
-
-#if false
- private void ReportPageUpd()
- {
- if (EA_PageUpdated != null)
- {
- EA_PageUpdated?.Invoke();
- }
- }
-
- private void ReportSearch()
- {
- if (EA_DipUpdated != null)
- {
- EA_DipUpdated?.Invoke();
- }
- }
-#endif
}
}
\ No newline at end of file
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index d73c08cc..baa9cbb9 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -1,4 +1,5 @@
-using Microsoft.EntityFrameworkCore;
+using EgwCoreLib.Utils;
+using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
@@ -10,7 +11,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
-using System.Drawing.Drawing2D;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -375,7 +376,7 @@ namespace MP.Data.Services
result = dbTabController.CommentiGetLastByMacc(idxMacchina, numDays);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, FastCache);
+ await redisDb.StringSetAsync(currKey, rawData, UltraFastCache);
}
if (result == null)
{
@@ -512,6 +513,36 @@ namespace MP.Data.Services
}
return answ;
}
+ ///
+ /// Recupera il valore in formato DOUBLE
+ ///
+ /// Valore da cercare
+ /// Int in cui salvare il valore se trovato
+ ///
+ public bool ConfigGetVal(string chiave, ref double varObj)
+ {
+ bool answ = false;
+ // se mancasse provo a configurare..
+ if (CurrConfig == null || CurrConfig.Count == 0)
+ {
+ SetupConfig();
+ }
+ if (CurrConfig != null && CurrConfig.Count > 0)
+ {
+ // sistemo i parametri opzionali...
+ ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
+ if (risultato != null)
+ {
+ NumberStyles numStyle;
+ CultureInfo culture;
+ numStyle = NumberStyles.Number;
+ culture = CultureInfo.InvariantCulture;
+ //culture = CultureInfo.CreateSpecificCulture("en-US");
+ answ = double.TryParse(risultato.Valore, numStyle, culture, out varObj);
+ }
+ }
+ return answ;
+ }
///
/// Recupera il valore in formato BOOL
@@ -567,6 +598,11 @@ namespace MP.Data.Services
return dbTabController.DDB_getNext(idxMacchina, inizioStato);
}
+ public string DecryptData(string encData)
+ {
+ return SteamCrypto.DecryptString(encData, Constants.passPhrase);
+ }
+
public void Dispose()
{
// Clear database controller
@@ -598,6 +634,45 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Elenco operatori
+ ///
+ ///
+ public async Task> ElencoOperatori()
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:ElencoOpr";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = dbTabController.ElencoOperatori();
+ // serializzo e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"ElencoOperatori | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
+ public string EncryptData(string rawData)
+ {
+ return SteamCrypto.EncryptString(rawData, Constants.passPhrase);
+ }
+
///
/// Elimina una riga in EventList se trovata
///
@@ -653,7 +728,7 @@ namespace MP.Data.Services
result = await dbTabController.EvListGetLastBySearch(idxMacchina, dtLimit, idxTipo, maxRec);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -817,7 +892,7 @@ namespace MP.Data.Services
result = await Task.FromResult(dbTabController.ListPODLByMacc(idxMacchina, onlyFree, onlyDirect));
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await redisDb.StringSetAsync(currKey, rawData, UltraFastCache);
}
if (result == null)
{
@@ -1057,6 +1132,49 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Recupera un valore MSE x una macchina sub specifica
+ ///
+ ///
+ ///
+ ///
+ ///
+ public MappaStatoExpl MseGetSub(string idxMacc, string idxMacchSub, bool forceDb)
+ {
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ MappaStatoExpl result = new MappaStatoExpl();
+ // cerco in redis...
+ string currKey = $"{Constants.redisMseKeySingle}:{idxMacchSub}";
+ RedisValue rawData = redisDb.StringGet(currKey);
+ if (rawData.HasValue && !forceDb)
+ {
+ result = JsonConvert.DeserializeObject($"{rawData}");
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"Read from REDIS: {ts.TotalMilliseconds}ms");
+ }
+ else
+ {
+ var rawResult = dbTabController.MseGetSub(idxMacc, idxMacchSub);
+ if (rawResult != null && rawResult.Count > 0)
+ {
+ result = rawResult.FirstOrDefault();
+ }
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ redisDb.StringSet(currKey, rawData, UltraLongCache);
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
+ }
+ if (result == null)
+ {
+ result = new MappaStatoExpl();
+ }
+ return result;
+ }
+
///
/// ODL da key
///
@@ -1094,6 +1212,31 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Clear operazione setup ODL (annullamento)
+ ///
+ ///
+ ///
+ ///
+ public async Task OdlClearSetup(int idxODL, string idxMacchina)
+ {
+ bool answ = false;
+ try
+ {
+ // inserisco evento
+ answ = dbTabController.OdlClearSetup(idxODL, idxMacchina);
+ await FlushCache("ODL");
+ await FlushCache("PODL");
+ await FlushCache("VSODL");
+ }
+ catch (Exception exc)
+ {
+ string logMsg = $"Eccezione in OdlUpdate | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}";
+ Log.Error(logMsg);
+ }
+ return answ;
+ }
+
///
/// ODL corrente macchina
///
@@ -1130,32 +1273,6 @@ namespace MP.Data.Services
return result;
}
- ///
- /// Registro fine prod ODL
- ///
- ///
- ///
- ///
- public async Task OdlFineProd(int idxODL, string idxMacchina)
- {
- bool answ = false;
- try
- {
- // inserisco evento
- answ = dbTabController.OdlFineProd(idxODL, idxMacchina);
- await FlushCache("ODL");
- await FlushCache("PODL");
- await FlushCache("VSODL");
- }
- catch (Exception exc)
- {
- string logMsg = $"Eccezione in OdlFineProd | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}";
- Log.Error(logMsg);
- }
- return answ;
- }
-
-
///
/// Attrezzo stesso ODL dell'altra tavola
///
@@ -1182,14 +1299,39 @@ namespace MP.Data.Services
return answ;
}
- ///
- /// Fix ODL per macchine SLAVE
- ///
- ///
- ///
- ///
- ///
- public async Task OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert)
+ ///
+ /// Registro fine prod ODL
+ ///
+ ///
+ ///
+ ///
+ public async Task OdlFineProd(int idxODL, string idxMacchina)
+ {
+ bool answ = false;
+ try
+ {
+ // inserisco evento
+ answ = dbTabController.OdlFineProd(idxODL, idxMacchina);
+ await FlushCache("ODL");
+ await FlushCache("PODL");
+ await FlushCache("VSODL");
+ }
+ catch (Exception exc)
+ {
+ string logMsg = $"Eccezione in OdlFineProd | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}";
+ Log.Error(logMsg);
+ }
+ return answ;
+ }
+
+ ///
+ /// Fix ODL per macchine SLAVE
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert)
{
bool answ = false;
try
@@ -1275,34 +1417,6 @@ namespace MP.Data.Services
return result;
}
- ///
- /// Riapertura ULTIMO ODL data macchina
- ///
- ///
- ///
- public ODLModel OdlReopenOdlMacc(string idxMacchina)
- {
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- ODLModel result = new ODLModel();
- // cerco in redis...
- string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST";
- var results = dbTabController.OdlReopenOdlMacc(idxMacchina);
- // riordino
- result = results.FirstOrDefault();
- // serializzp e salvo...
- var rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, UltraLongCache);
- if (result == null)
- {
- result = new ODLModel();
- }
- sw.Stop();
- Log.Debug($"OdlReopenOdlMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
-
///
/// Elenco ODL data macchina e periodo
///
@@ -1331,7 +1445,7 @@ namespace MP.Data.Services
result = result.OrderByDescending(x => x.DataInizio).ToList();
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
@@ -1342,6 +1456,35 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Riapertura ULTIMO ODL data macchina
+ ///
+ ///
+ ///
+ public async Task OdlReopenOdlMacc(string idxMacchina)
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ ODLModel result = new ODLModel();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST";
+ var results = await Task.FromResult(dbTabController.OdlReopenOdlMacc(idxMacchina));
+ // riordino
+ result = results.FirstOrDefault();
+ // svuoto cache
+ await FlushCache("ODL");
+ await FlushCache("PODL");
+ await FlushCache("VSODL");
+ if (result == null)
+ {
+ result = new ODLModel();
+ }
+ sw.Stop();
+ Log.Debug($"OdlReopenOdlMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
///
/// Setup ODL Postumo
///
@@ -1354,7 +1497,7 @@ namespace MP.Data.Services
try
{
// inserisco evento
- answ = dbTabController.OdlSetupPostumo(idxODL, idxMacchina);
+ answ = await Task.FromResult(dbTabController.OdlSetupPostumo(idxODL, idxMacchina));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
@@ -1380,7 +1523,7 @@ namespace MP.Data.Services
try
{
// inserisco evento
- answ = dbTabController.OdlSetupPromPostuma(idxPromOdl, matrOpr, idxMacchina);
+ answ = await Task.FromResult(dbTabController.OdlSetupPromPostuma(idxPromOdl, matrOpr, idxMacchina));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
@@ -1411,7 +1554,7 @@ namespace MP.Data.Services
try
{
// inserisco evento
- answ = dbTabController.OdlSplit(idxODL, matrOpr, idxMacchina, TCRich, pzPallet, note, startNewOdl, qtyRich);
+ answ = await Task.FromResult(dbTabController.OdlSplit(idxODL, matrOpr, idxMacchina, TCRich, pzPallet, note, startNewOdl, qtyRich));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
@@ -1429,6 +1572,9 @@ namespace MP.Data.Services
///
///
///
+ ///
+ ///
+ ///
///
public async Task OdlUpdate(int idxODL, int matrOpr, decimal tCRichAttr, int pzPallet, string note)
{
@@ -1449,6 +1595,117 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Delete dell'oggetto opr serializzato
+ ///
+ ///
+ ///
+ public async Task OperatoreDeleteRedis(int matrOpr)
+ {
+ string source = "REDIS";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ bool answ = false;
+ // cerco in redis...
+ string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ var done = await ExecFlushRedisPattern(currKey);
+ if (done)
+ {
+ answ = true;
+ }
+ }
+ sw.Stop();
+ Log.Debug($"OperatoreDeleteRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ await Task.Delay(1);
+ return answ;
+ }
+
+ ///
+ /// Scrive l'hash dell'oggetto curr opr
+ ///
+ ///
+ ///
+ public async Task OperatoreGetRedis(int matrOpr)
+ {
+ string source = "REDIS";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ string answ = "";
+ // cerco in redis...
+ string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ //var encrData = SteamCrypto.DecryptString(rawData, passPhrase);
+ //answ = JsonConvert.DeserializeObject(rawData);
+ answ = rawData;
+ }
+ if (answ == null)
+ {
+ answ = "";
+ }
+ sw.Stop();
+ Log.Debug($"OperatoreGetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ await Task.Delay(1);
+ return answ;
+ }
+
+ ///
+ /// Log in operatore
+ ///
+ /// matricola operatore
+ /// Auth Key
+ ///
+ public async Task OperatoreSearch(int matrOpr, string authKey)
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ AnagOperatoriModel answ = null;
+ answ = dbTabController.OperatoreSearch(matrOpr, authKey);
+ if (answ == null)
+ {
+ answ = new AnagOperatoriModel();
+ }
+ sw.Stop();
+ Log.Debug($"LoginOperatore | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ await Task.Delay(1);
+ return answ;
+ }
+
+ ///
+ /// legge l'hash dell'oggetto curr opr
+ ///
+ ///
+ ///
+ public async Task OperatoreSetRedis(int matrOpr, string currOpr)
+ {
+ setExpDays();
+ string source = "REDIS";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ string answ = "";
+ // cerco in redis...
+ string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
+ //RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ // serializzo e salvo...
+ //rawData = JsonConvert.SerializeObject(currOpr);
+ answ = currOpr;
+ //var encrData = SteamCrypto.EncryptString(rawData, passPhrase);
+ await redisDb.StringSetAsync(currKey, currOpr, ConfigCache);
+ if (answ == null)
+ {
+ answ = "";
+ }
+ sw.Stop();
+ Log.Debug($"OperatoreSetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ await Task.Delay(1);
+ return answ;
+ }
+
///
/// Stato prod macchina
///
@@ -1537,7 +1794,7 @@ namespace MP.Data.Services
result = await Task.FromResult(dbTabController.PODLExp_getByKey(idxPODL));
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
@@ -2517,7 +2774,7 @@ namespace MP.Data.Services
result = dbIocController.VMSFDGetAll();
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, UltraFastCache);
}
if (result == null)
{
@@ -2591,7 +2848,7 @@ namespace MP.Data.Services
result = dbIocController.VMSFDGetByMacc(idxMacc);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2656,7 +2913,7 @@ namespace MP.Data.Services
result = await Task.FromResult(dbTabController.VSCS_getAll());
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2729,7 +2986,7 @@ namespace MP.Data.Services
result = await Task.FromResult(dbTabController.VSOdlGetUnused(idxMacchina, showAll, numDayAdd));
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await redisDb.StringSetAsync(currKey, rawData, UltraFastCache);
}
if (result == null)
{
@@ -2744,6 +3001,8 @@ namespace MP.Data.Services
#region Protected Fields
+ protected int expMinutes = 1;
+
///
/// Oggetto per connessione a REDIS
///
@@ -2756,6 +3015,27 @@ namespace MP.Data.Services
#endregion Protected Fields
+ #region Protected Properties
+
+ ///
+ /// Durata cache data dal valore in config
+ ///
+ protected TimeSpan ConfigCache
+ {
+ get => TimeSpan.FromMinutes(expMinutes);
+ }
+
+ #endregion Protected Properties
+
+ #region Protected Methods
+
+ protected void setExpDays()
+ {
+ ConfigGetVal("TAB_dtTimerScadLogin", ref expMinutes);
+ }
+
+ #endregion Protected Methods
+
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
@@ -2771,6 +3051,7 @@ namespace MP.Data.Services
private string DataSource = "";
private string redisBaseKey = "MP:TAB:Cache";
+ private string redisUserDataKey = "MP:TAB:Users";
#endregion Private Fields
diff --git a/MP.Land/Components/CmpFooter.razor b/MP.Land/Components/CmpFooter.razor
index 75e13002..1ba50c22 100644
--- a/MP.Land/Components/CmpFooter.razor
+++ b/MP.Land/Components/CmpFooter.razor
@@ -4,7 +4,7 @@
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 2cc99106..424ea1e4 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net6.0
MP.Land
- 6.16.2311.1009
+ 6.16.2311.1619
@@ -44,6 +44,8 @@
+
+
diff --git a/MP.Land/Pages/About.razor b/MP.Land/Pages/About.razor
index 945c6f4d..58a78d18 100644
--- a/MP.Land/Pages/About.razor
+++ b/MP.Land/Pages/About.razor
@@ -6,7 +6,7 @@
|